@@ -15,12 +15,13 @@ pub fn futex<'tcx>(
15
15
) -> InterpResult < ' tcx > {
16
16
let [ addr, op, val] = check_min_vararg_count ( "`syscall(SYS_futex, ...)`" , varargs) ?;
17
17
18
+ // See <https://man7.org/linux/man-pages/man2/futex.2.html> for docs.
18
19
// The first three arguments (after the syscall number itself) are the same to all futex operations:
19
- // (int *addr, int op, int val).
20
+ // (uint32_t *addr, int op, uint32_t val).
20
21
// We checked above that these definitely exist.
21
22
let addr = ecx. read_pointer ( addr) ?;
22
23
let op = ecx. read_scalar ( op) ?. to_i32 ( ) ?;
23
- let val = ecx. read_scalar ( val) ?. to_i32 ( ) ?;
24
+ let val = ecx. read_scalar ( val) ?. to_u32 ( ) ?;
24
25
25
26
// This is a vararg function so we have to bring our own type for this pointer.
26
27
let addr = ecx. ptr_to_mplace ( addr, ecx. machine . layouts . i32 ) ;
@@ -138,7 +139,7 @@ pub fn futex<'tcx>(
138
139
// It's not uncommon for `addr` to be passed as another type than `*mut i32`, such as `*const AtomicI32`.
139
140
// We do an acquire read -- it only seems reasonable that if we observe a value here, we
140
141
// actually establish an ordering with that value.
141
- let futex_val = ecx. read_scalar_atomic ( & addr, AtomicReadOrd :: Acquire ) ?. to_i32 ( ) ?;
142
+ let futex_val = ecx. read_scalar_atomic ( & addr, AtomicReadOrd :: Acquire ) ?. to_u32 ( ) ?;
142
143
if val == futex_val {
143
144
// The value still matches, so we block the thread and make it wait for FUTEX_WAKE.
144
145
0 commit comments