Modify the userspace read/write usage location

This commit is contained in:
Chen Chengjun
2024-06-28 09:36:43 +08:00
committed by Tate, Hongliang Tian
parent af908c29cf
commit cd2b305fa8
14 changed files with 25 additions and 19 deletions

View File

@ -17,6 +17,6 @@ pub fn sys_read(fd: FileDesc, user_buf_addr: Vaddr, buf_len: usize) -> Result<Sy
let mut read_buf = vec![0u8; buf_len];
let read_len = file.read(&mut read_buf)?;
write_bytes_to_user(user_buf_addr, &read_buf)?;
write_bytes_to_user(user_buf_addr, &mut VmReader::from(read_buf.as_slice()))?;
Ok(SyscallReturn::Return(read_len as _))
}