patch grub EFI setjmp in IA32
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
Quoted 4 lines · bibo,mao
In IA32 application function parameter is passed on stack but not
register, ongrub_setjmpfunciton, 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