diff options
Diffstat (limited to 'src/libstd/sys/common/stack.rs')
| -rw-r--r-- | src/libstd/sys/common/stack.rs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs index 8c428275ccf..8dc3407db77 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -46,7 +46,7 @@ // corresponding prolog, decision was taken to disable segmented // stack support on iOS. -pub const RED_ZONE: uint = 20 * 1024; +pub const RED_ZONE: usize = 20 * 1024; /// This function is invoked from rust's current __morestack function. Segmented /// stacks are currently not enabled as segmented stacks, but rather one giant @@ -117,7 +117,7 @@ extern fn stack_exhausted() { // On all other platforms both variants behave identically. #[inline(always)] -pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) { +pub unsafe fn record_os_managed_stack_bounds(stack_lo: usize, _stack_hi: usize) { record_sp_limit(stack_lo + RED_ZONE); } @@ -136,31 +136,31 @@ pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) { /// would be unfortunate for the functions themselves to trigger a morestack /// invocation (if they were an actual function call). #[inline(always)] -pub unsafe fn record_sp_limit(limit: uint) { +pub unsafe fn record_sp_limit(limit: usize) { return target_record_sp_limit(limit); // x86-64 #[cfg(all(target_arch = "x86_64", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $$0x60+90*8, %rsi movq $0, %gs:(%rsi)" :: "r"(limit) : "rsi" : "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:112" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile") } @@ -168,18 +168,18 @@ pub unsafe fn record_sp_limit(limit: uint) { #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movl $$0x48+90*4, %eax movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile") } #[cfg(all(target_arch = "x86", any(target_os = "linux", target_os = "freebsd")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } // mips, arm - Some brave soul can port these to inline asm, but it's over @@ -188,7 +188,7 @@ pub unsafe fn record_sp_limit(limit: uint) { target_arch = "mipsel", all(target_arch = "arm", not(target_os = "ios"))))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { use libc::c_void; return record_sp_limit(limit as *const c_void); extern { @@ -205,7 +205,7 @@ pub unsafe fn record_sp_limit(limit: uint) { all(target_arch = "arm", target_os = "ios"), target_os = "bitrig", target_os = "openbsd"))] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } } @@ -218,38 +218,38 @@ pub unsafe fn record_sp_limit(limit: uint) { /// As with the setter, this function does not have a __morestack header and can /// therefore be called in a "we're out of stack" situation. #[inline(always)] -pub unsafe fn get_sp_limit() -> uint { +pub unsafe fn get_sp_limit() -> usize { return target_get_sp_limit(); // x86-64 #[cfg(all(target_arch = "x86_64", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq $$0x60+90*8, %rsi movq %gs:(%rsi), $0" : "=r"(limit) :: "rsi" : "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:112, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { return 1024; } #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile"); return limit; @@ -259,7 +259,7 @@ pub unsafe fn get_sp_limit() -> uint { #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movl $$0x48+90*4, %eax movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile"); @@ -268,13 +268,13 @@ pub unsafe fn get_sp_limit() -> uint { #[cfg(all(target_arch = "x86", any(target_os = "linux", target_os = "freebsd")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movl %gs:48, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { return 1024; } @@ -284,9 +284,9 @@ pub unsafe fn get_sp_limit() -> uint { target_arch = "mipsel", all(target_arch = "arm", not(target_os = "ios"))))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { use libc::c_void; - return get_sp_limit() as uint; + return get_sp_limit() as usize; extern { fn get_sp_limit() -> *const c_void; } @@ -305,7 +305,7 @@ pub unsafe fn get_sp_limit() -> uint { target_os = "bitrig", target_os = "openbsd"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { 1024 } } |
