mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 05:16:47 +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) {
|
if options.perm.contains(VmPerm::W) {
|
||||||
flags.insert(PTFlags::WRITABLE);
|
flags.insert(PTFlags::WRITABLE);
|
||||||
}
|
}
|
||||||
if options.perm.contains(VmPerm::U) {
|
// if options.perm.contains(VmPerm::U) {
|
||||||
flags.insert(PTFlags::USER);
|
flags.insert(PTFlags::USER);
|
||||||
}
|
// }
|
||||||
if options.addr.is_none() {
|
if options.addr.is_none() {
|
||||||
return Err(Error::InvalidArgs);
|
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 =
|
let user_buffer =
|
||||||
copy_bytes_from_user(user_space, user_buf_ptr as usize, user_buf_len as usize)
|
copy_bytes_from_user(user_space, user_buf_ptr as usize, user_buf_len as usize)
|
||||||
.expect("read user buffer failed");
|
.expect("read user buffer failed");
|
||||||
let content = CString::from_vec_with_nul(user_buffer).expect("read string failed");
|
let content = alloc::str::from_utf8(user_buffer.as_slice()).expect("Invalid content"); // TODO: print content
|
||||||
// TODO: print content
|
|
||||||
info!("Message from user mode: {:?}", content);
|
info!("Message from user mode: {:?}", content);
|
||||||
SyscallResult::Return(0)
|
SyscallResult::Return(0)
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,7 +3,7 @@ global _start
|
|||||||
section .text
|
section .text
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
mov rax, 64 ; syswrite
|
mov rax, 1 ; syswrite
|
||||||
mov rdi, 1 ; fd
|
mov rdi, 1 ; fd
|
||||||
mov rsi, msg ; "Hello, world!\n",
|
mov rsi, msg ; "Hello, world!\n",
|
||||||
mov rdx, msglen ; sizeof("Hello, world!\n")
|
mov rdx, msglen ; sizeof("Hello, world!\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user