From fb9acb73f366fd73382acb561d7e00aaf7a52468 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Thu, 1 Sep 2016 19:33:52 +0100 Subject: [PATCH] Use raw pointers instead of references to avoid aliasing issues --- src/arch/or1k.rs | 2 +- src/arch/x86.rs | 2 +- src/arch/x86_64.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arch/or1k.rs b/src/arch/or1k.rs index c5af1c0..b706762 100644 --- a/src/arch/or1k.rs +++ b/src/arch/or1k.rs @@ -107,7 +107,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP } #[inline(always)] -pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, +pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer, new_stack: &Stack) -> usize { // Address of the topmost CFA stack slot. let new_cfa = (new_stack.base() as *mut usize).offset(-1); diff --git a/src/arch/x86.rs b/src/arch/x86.rs index 69e86bf..22b03a5 100644 --- a/src/arch/x86.rs +++ b/src/arch/x86.rs @@ -106,7 +106,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP } #[inline(always)] -pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, +pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer, new_stack: &Stack) -> usize { // Address of the topmost CFA stack slot. let new_cfa = (new_stack.base() as *mut usize).offset(-1); diff --git a/src/arch/x86_64.rs b/src/arch/x86_64.rs index efa057b..d6b46af 100644 --- a/src/arch/x86_64.rs +++ b/src/arch/x86_64.rs @@ -133,7 +133,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP } #[inline(always)] -pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer, +pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer, new_stack: &Stack) -> usize { // Address of the topmost CFA stack slot. let new_cfa = (new_stack.base() as *mut usize).offset(-1);