Skip to content

Commit

Permalink
update uses of MachineRegister
Browse files Browse the repository at this point in the history
These used to be CapabilityPtr and thus now need to be handled slightly
differently.
  • Loading branch information
bradjc committed Jan 8, 2025
1 parent aa631c4 commit 07c7d10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arch/rv32i/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl kernel::syscall::UserspaceKernelBoundary for SysCall {
state.regs[R_A0] = callback.argument0 as u32;
state.regs[R_A1] = callback.argument1 as u32;
state.regs[R_A2] = callback.argument2 as u32;
state.regs[R_A3] = callback.argument3.as_ptr::<()>() as usize as u32;
state.regs[R_A3] = usize::from(callback.argument3) as u32;

// We also need to set the return address (ra) register so that the new
// function that the process is running returns to the correct location.
Expand Down
8 changes: 4 additions & 4 deletions kernel/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl Syscall {
Ok(SyscallClass::Subscribe) => Some(Syscall::Subscribe {
driver_number: r0,
subdriver_number: r1.into(),
upcall_ptr: r2,
upcall_ptr: r2.into(),
appdata: r3,
}),
Ok(SyscallClass::Command) => Some(Syscall::Command {
Expand All @@ -267,19 +267,19 @@ impl Syscall {
Ok(SyscallClass::ReadWriteAllow) => Some(Syscall::ReadWriteAllow {
driver_number: r0,
subdriver_number: r1.into(),
allow_address: r2.as_ptr::<u8>().cast_mut(),
allow_address: usize::from(r2) as *mut u8,
allow_size: r3.into(),
}),
Ok(SyscallClass::UserspaceReadableAllow) => Some(Syscall::UserspaceReadableAllow {
driver_number: r0,
subdriver_number: r1.into(),
allow_address: r2.as_ptr::<u8>().cast_mut(),
allow_address: usize::from(r2) as *mut u8,
allow_size: r3.into(),
}),
Ok(SyscallClass::ReadOnlyAllow) => Some(Syscall::ReadOnlyAllow {
driver_number: r0,
subdriver_number: r1.into(),
allow_address: r2.as_ptr::<u8>().cast_mut(),
allow_address: usize::from(r2) as *mut u8,
allow_size: r3.into(),
}),
Ok(SyscallClass::Memop) => Some(Syscall::Memop {
Expand Down

0 comments on commit 07c7d10

Please sign in to comment.