Fix x86 setjmp/longjmp
This commit is contained in:
@@ -4,17 +4,13 @@
|
||||
.type longjmp,@function
|
||||
_longjmp:
|
||||
longjmp:
|
||||
mov 4(%esp),%edx
|
||||
mov 8(%esp),%eax
|
||||
test %eax,%eax
|
||||
jnz 1f
|
||||
inc %eax
|
||||
1:
|
||||
mov (%edx),%ebx
|
||||
mov 4(%edx),%esi
|
||||
mov 8(%edx),%edi
|
||||
mov 12(%edx),%ebp
|
||||
mov 16(%edx),%ecx
|
||||
mov %ecx,%esp
|
||||
mov 20(%edx),%ecx
|
||||
jmp *%ecx
|
||||
mov edx, [esp + 4]
|
||||
mov eax, [esp + 8]
|
||||
cmp eax, 1
|
||||
adc al, 0
|
||||
mov ebx, [edx]
|
||||
mov esi, [edx + 4]
|
||||
mov edi, [edx + 8]
|
||||
mov ebp, [edx + 12]
|
||||
mov esp, [edx + 16]
|
||||
jmp [edx + 20]
|
||||
|
||||
@@ -10,14 +10,14 @@ ___setjmp:
|
||||
__setjmp:
|
||||
_setjmp:
|
||||
setjmp:
|
||||
mov 4(%esp), %eax
|
||||
mov %ebx, (%eax)
|
||||
mov %esi, 4(%eax)
|
||||
mov %edi, 8(%eax)
|
||||
mov %ebp, 12(%eax)
|
||||
lea 4(%esp), %ecx
|
||||
mov %ecx, 16(%eax)
|
||||
mov (%esp), %ecx
|
||||
mov %ecx, 20(%eax)
|
||||
xor %eax, %eax
|
||||
mov eax, [esp + 4]
|
||||
mov [eax], ebx
|
||||
mov [eax + 4], esi
|
||||
mov [eax + 8], edi
|
||||
mov [eax + 12], ebp
|
||||
lea ecx, [esp + 4]
|
||||
mov [eax + 16], ecx
|
||||
mov ecx, [esp]
|
||||
mov [eax + 20], ecx
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
@@ -3,30 +3,18 @@
|
||||
use core::arch::global_asm;
|
||||
|
||||
macro_rules! platform_specific {
|
||||
($($arch:expr,$ext:expr;)+) => {
|
||||
($($rust_arch:expr,$c_arch:expr,$ext:expr;)+) => {
|
||||
$(
|
||||
#[cfg(target_arch = $arch)]
|
||||
global_asm!(include_str!(concat!("impl/", $arch, "/setjmp.", $ext)));
|
||||
#[cfg(target_arch = $arch)]
|
||||
global_asm!(include_str!(concat!("impl/", $arch, "/longjmp.", $ext)));
|
||||
#[cfg(target_arch = $rust_arch)]
|
||||
global_asm!(include_str!(concat!("impl/", $c_arch, "/setjmp.", $ext)));
|
||||
#[cfg(target_arch = $rust_arch)]
|
||||
global_asm!(include_str!(concat!("impl/", $c_arch, "/longjmp.", $ext)));
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
platform_specific! {
|
||||
"aarch64","s";
|
||||
"arm","s";
|
||||
"i386","s";
|
||||
"m68k","s";
|
||||
"microblaze","s";
|
||||
"mips","S";
|
||||
"mips64","S";
|
||||
"mipsn32","S";
|
||||
"or1k","s";
|
||||
"powerpc","S";
|
||||
"powerpc64","s";
|
||||
"s390x","s";
|
||||
"sh","S";
|
||||
"x32","s";
|
||||
"x86_64","s";
|
||||
"aarch64","aarch64", "s";
|
||||
"x86","i386","s";
|
||||
"x86_64","x86_64","s";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user