Skip to contentSkip to conversation

patch grub EFI setjmp in IA32

PATCH bibo,mao 2 participants 2 messages Aug 3, 2006 – Aug 4, 2006

lore
Share & tools
lore

bibo,mao

author
#0 lore raw

hi,
In IA32 application function parameter is passed on stack but not register,
on grub_setjmp funciton, env is pushed on stack, but not eax register.Caller is responsible to push parameter on the stack and after function call pop the stack.

Here is the patch for setjmp.S in IA32 EFI, any suggestion is welcome.

Thanks
bibo,mao

normal/i386/setjmp.S +0 -0
@@ -27,11 +27,13 @@
 * int grub_setjmp (grub_jmp_buf env)
 */

FUNCTION(grub_setjmp)
+ popl %ecx
+ popl %eax
+ pushl %eax

	movl	%ebx, 0(%eax)	/* EBX */
	movl	%esi, 4(%eax)	/* ESI */
	movl	%edi, 8(%eax)	/* EDI */
	movl	%ebp, 12(%eax)	/* EBP */
-	popl	%ecx
	movl	%esp, 16(%eax)	/* ESP */
	movl	%ecx, 20(%eax)	/* EIP */
	xorl	%eax, %eax

@@ -42,6 +44,11 @@ FUNCTION(grub_setjmp)
* int grub_longjmp (grub_jmp_buf env, int val)
*/
FUNCTION(grub_longjmp)
+ popl %eax /* skip return address */
+ popl %edx
+ popl %eax
+ pushl %eax
+ pushl %edx

	movl	0(%eax), %ebx
	movl	4(%eax), %esi
	movl	8(%eax), %edi
#1 lore raw
Quoted 4 lines · bibo,mao

In IA32 application function parameter is passed on stack but not
register, on grub_setjmp funciton, env is pushed on stack, but not eax register.Caller is responsible to push parameter on the stack and after function call pop the stack.

I fixed this differently, as I didn't want to break the i386-pc port.

Thanks,
Okuji