scc-patches

scc patches
Log | Files | Refs | README

0003-lib-c-Update-setjmp.s-and-longjmp.s-for-i386-linux.patch (1900B)


      1 From 84656ce00b82d4256d7d6f354eca64977023073e Mon Sep 17 00:00:00 2001
      2 From: zerous Naveen Narayanan <zerous@nocebo.space>
      3 Date: Fri, 1 Nov 2019 15:21:34 +0100
      4 Subject: [PATCH 03/10] [lib/c] Update setjmp.s and longjmp.s for i386/linux
      5 
      6 This version respects %ecx unlike the last one.
      7 ---
      8  src/libc/arch/i386/longjmp.s | 20 +++++++++++---------
      9  src/libc/arch/i386/setjmp.s  | 23 ++++++++++++-----------
     10  2 files changed, 23 insertions(+), 20 deletions(-)
     11 
     12 diff --git a/src/libc/arch/i386/longjmp.s b/src/libc/arch/i386/longjmp.s
     13 index 7dd062c5..77c7f412 100644
     14 --- a/src/libc/arch/i386/longjmp.s
     15 +++ b/src/libc/arch/i386/longjmp.s
     16 @@ -1,19 +1,21 @@
     17  	.file	"longjmp.s"
     18  
     19  	.text
     20 -	.globl	_longjmp
     21 +	.globl	longjmp,_longjmp
     22  _longjmp:
     23 +longjmp:
     24  	mov  	4(%esp),%edx
     25  	mov  	8(%esp),%eax
     26  	test    %eax,%eax
     27  	jnz 	1f
     28  	inc     %eax
     29  1:
     30 -	mov   	(%edx),%ebx
     31 -	mov  	4(%edx),%esi
     32 -	mov  	8(%edx),%edi
     33 -	mov 	12(%edx),%ebp
     34 -	mov 	16(%edx),%ecx
     35 -	mov     %ecx,%esp
     36 -	mov 	20(%edx),%ecx
     37 -	jmp 	*%ecx
     38 +	movl   	(%edx),%ebx
     39 +	movl  	4(%edx),%ecx
     40 +	movl 	8(%edx),%esi
     41 +	movl 	12(%edx),%edi
     42 +	movl	16(%edx),%ebp
     43 +	movl	20(%edx),%esp
     44 +	pushl   24(%edx)
     45 +	popl	%edx
     46 +	jmp 	*%edx
     47 diff --git a/src/libc/arch/i386/setjmp.s b/src/libc/arch/i386/setjmp.s
     48 index 008f2fa9..39397d1d 100644
     49 --- a/src/libc/arch/i386/setjmp.s
     50 +++ b/src/libc/arch/i386/setjmp.s
     51 @@ -1,16 +1,17 @@
     52  	.file	"setjmp.s"
     53  
     54  	.text
     55 -	.globl	_setjmp
     56 +	.globl	setjmp,_setjmp
     57  _setjmp:
     58 -	mov 	4(%esp),%eax
     59 -	mov    	%ebx,(%eax)
     60 -	mov    	%esi,4(%eax)
     61 -	mov    	%edi,8(%eax)
     62 -	mov    	%ebp,12(%eax)
     63 -	lea 	4(%esp),%ecx
     64 -	mov    	%ecx,16(%eax)
     65 -	mov  	(%esp),%ecx
     66 -	mov    	%ecx,20(%eax)
     67 -	xor    	%eax,%eax
     68 +setjmp:
     69 +	movl    4(%esp),%eax
     70 +	movl    %ebx,(%eax)
     71 +	movl    %ecx,4(%eax)
     72 +	movl    %esi,8(%eax)
     73 +	movl    %edi,12(%eax)
     74 +	movl    %ebp,16(%eax)
     75 +	movl    %esp,20(%eax)
     76 +	pushl   (%esp)
     77 +	popl	24(%eax)
     78 +	xor     %eax,%eax
     79  	ret
     80 -- 
     81 2.23.0
     82