|
|
@ -59,15 +59,16 @@ impl Syscall<'_> {
|
|
|
|
uaddr: usize,
|
|
|
|
uaddr: usize,
|
|
|
|
op: u32,
|
|
|
|
op: u32,
|
|
|
|
val: i32,
|
|
|
|
val: i32,
|
|
|
|
timeout: *const TimeSpec,
|
|
|
|
// timeout: *const TimeSpec,
|
|
|
|
) -> SysResult {
|
|
|
|
) -> SysResult {
|
|
|
|
info!(
|
|
|
|
info!(
|
|
|
|
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}",
|
|
|
|
//"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}",
|
|
|
|
|
|
|
|
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}. timeout ALWAYS 0",
|
|
|
|
thread::current().id(),
|
|
|
|
thread::current().id(),
|
|
|
|
uaddr,
|
|
|
|
uaddr,
|
|
|
|
op,
|
|
|
|
op,
|
|
|
|
val,
|
|
|
|
val
|
|
|
|
timeout
|
|
|
|
// timeout
|
|
|
|
);
|
|
|
|
);
|
|
|
|
// if op & OP_PRIVATE == 0 {
|
|
|
|
// if op & OP_PRIVATE == 0 {
|
|
|
|
// unimplemented!("futex only support process-private");
|
|
|
|
// unimplemented!("futex only support process-private");
|
|
|
@ -77,11 +78,13 @@ impl Syscall<'_> {
|
|
|
|
return Err(SysError::EINVAL);
|
|
|
|
return Err(SysError::EINVAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let atomic = unsafe { self.vm().check_write_ptr(uaddr as *mut AtomicI32)? };
|
|
|
|
let atomic = unsafe { self.vm().check_write_ptr(uaddr as *mut AtomicI32)? };
|
|
|
|
let _timeout = if timeout.is_null() {
|
|
|
|
// musl libc 1.1.22 _wake FUN didn't provide timeout, ___futexwait FUN set timeout=0
|
|
|
|
None
|
|
|
|
// now rcore just ignored the timeout parameter. TODO
|
|
|
|
} else {
|
|
|
|
// let _timeout = if timeout.is_null() {
|
|
|
|
Some(unsafe { *self.vm().check_read_ptr(timeout)? })
|
|
|
|
// None
|
|
|
|
};
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// Some(unsafe { *self.vm().check_read_ptr(timeout)? })
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
const OP_WAIT: u32 = 0;
|
|
|
|
const OP_WAIT: u32 = 0;
|
|
|
|
const OP_WAKE: u32 = 1;
|
|
|
|
const OP_WAKE: u32 = 1;
|
|
|
|