diff --git a/src/header/setjmp/impl/i386/longjmp.s b/src/header/setjmp/impl/i386/longjmp.s index 772d28ddb283e8ee983e75ec6b167ef0f80979d7..a2378b9fc3c0cc6c824d47fcf6c34ceea3ae5b4a 100644 --- a/src/header/setjmp/impl/i386/longjmp.s +++ b/src/header/setjmp/impl/i386/longjmp.s @@ -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] diff --git a/src/header/setjmp/impl/i386/setjmp.s b/src/header/setjmp/impl/i386/setjmp.s index 4d19cf87cbe924cb7724045400039610950a77d2..03678fdf419a01294181392c52c595e9344760eb 100644 --- a/src/header/setjmp/impl/i386/setjmp.s +++ b/src/header/setjmp/impl/i386/setjmp.s @@ -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 diff --git a/src/header/setjmp/mod.rs b/src/header/setjmp/mod.rs index 372e5676127639d0c2d88e7e0c8746fd3f7189d0..5ed23a510be0ca042add69e9557373d3e8351b8a 100644 --- a/src/header/setjmp/mod.rs +++ b/src/header/setjmp/mod.rs @@ -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"; }