Skip to content

Commit 0d08f96

Browse files
committed
apparently x86 has signed types for registers but x64 has unsigned... i give up
1 parent 94bf0d2 commit 0d08f96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/shims/native_lib/trace/parent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ impl ArchIndependentRegs for libc::user_regs_struct {
5858
#[rustfmt::skip]
5959
impl ArchIndependentRegs for libc::user_regs_struct {
6060
#[inline]
61-
fn ip(&self) -> usize { self.eip.try_into().unwrap() }
61+
fn ip(&self) -> usize { self.eip.cast_unsigned().try_into().unwrap() }
6262
#[inline]
63-
fn set_ip(&mut self, ip: usize) { self.eip = ip.try_into().unwrap() }
63+
fn set_ip(&mut self, ip: usize) { self.eip = ip.cast_signed().try_into().unwrap() }
6464
#[inline]
65-
fn set_sp(&mut self, sp: usize) { self.esp = sp.try_into().unwrap() }
65+
fn set_sp(&mut self, sp: usize) { self.esp = sp.cast_signed().try_into().unwrap() }
6666
}
6767

6868
/// A unified event representing something happening on the child process. Wraps
@@ -493,7 +493,7 @@ fn handle_segfault(
493493
ptrace::write(
494494
pid,
495495
(&raw const PAGE_ADDR).cast_mut().cast(),
496-
libc::c_long::try_from(page_addr).unwrap(),
496+
libc::c_long::try_from(page_addr.cast_signed()).unwrap(),
497497
)
498498
.unwrap();
499499

0 commit comments

Comments
 (0)