mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-08 21:06:48 +00:00
fix some bugs
This commit is contained in:
parent
5359879499
commit
d31d5f0bde
@ -48,9 +48,9 @@ impl VmSpace {
|
||||
if options.perm.contains(VmPerm::W) {
|
||||
flags.insert(PTFlags::WRITABLE);
|
||||
}
|
||||
if options.perm.contains(VmPerm::U) {
|
||||
// if options.perm.contains(VmPerm::U) {
|
||||
flags.insert(PTFlags::USER);
|
||||
}
|
||||
// }
|
||||
if options.addr.is_none() {
|
||||
return Err(Error::InvalidArgs);
|
||||
}
|
||||
|
@ -70,8 +70,7 @@ pub fn sys_write(fd: u64, user_buf_ptr: u64, user_buf_len: u64) -> SyscallResult
|
||||
let user_buffer =
|
||||
copy_bytes_from_user(user_space, user_buf_ptr as usize, user_buf_len as usize)
|
||||
.expect("read user buffer failed");
|
||||
let content = CString::from_vec_with_nul(user_buffer).expect("read string failed");
|
||||
// TODO: print content
|
||||
let content = alloc::str::from_utf8(user_buffer.as_slice()).expect("Invalid content"); // TODO: print content
|
||||
info!("Message from user mode: {:?}", content);
|
||||
SyscallResult::Return(0)
|
||||
} else {
|
||||
|
@ -3,7 +3,7 @@ global _start
|
||||
section .text
|
||||
|
||||
_start:
|
||||
mov rax, 64 ; syswrite
|
||||
mov rax, 1 ; syswrite
|
||||
mov rdi, 1 ; fd
|
||||
mov rsi, msg ; "Hello, world!\n",
|
||||
mov rdx, msglen ; sizeof("Hello, world!\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user