reloc/reloc_init.S: save/restore preserved GPRs if we return
authorH. Peter Anvin <hpa@zytor.com>
Wed, 6 Feb 2008 07:52:11 +0000 (23:52 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 6 Feb 2008 07:52:11 +0000 (23:52 -0800)
If we return to the calling environment, save and restore the GPRs
that are preserved by the normal 32-bit C calling conventions: %ebx,
%ebp, %esi, %edi.

reloc/reloc_init.S

index 4e9cce6..5e274ec 100644 (file)
@@ -43,12 +43,16 @@ _start:
                pushl   %cs
                pushl   %edx
                pushfl
+               cli
+               cld
                pushl   %ds
                pushl   %es
                pushl   %fs
                pushl   %gs
-               cli
-               cld
+               pushl   %ebx
+               pushl   %ebp
+               pushl   %esi
+               pushl   %edi
 
                calll   1f
 1:             popl    %ebx            /* Figure out where we are */
@@ -107,6 +111,10 @@ _exit:
                lidtl   orig_idt(%ebx)
                lgdtl   orig_gdt(%ebx)
                lssl    orig_esp(%ebx),%esp
+               popl    %edi
+               popl    %esi
+               popl    %ebp
+               popl    %ebx
                popl    %gs
                popl    %fs
                popl    %es