Author: stepan
Date: Fri Jun  4 22:32:12 2010
New Revision: 5612
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5612

Log:
This patch fixes the option rom code that was buggy when it switched
segment registers before restoring register values. This was breaking
the Geode VSA, and probably would have hurt other option roms as well.

Signed-off-by: Edwin Beasant <[email protected]>
Acked-by: Patrick Georgi <[email protected]>
Signed-off-by: Stefan Reinauer <[email protected]>
Acked-by: Nils Jacobs <[email protected]>

Modified:
   trunk/src/devices/oprom/x86_asm.S

Modified: trunk/src/devices/oprom/x86_asm.S
==============================================================================
--- trunk/src/devices/oprom/x86_asm.S   Fri Jun  4 22:24:11 2010        (r5611)
+++ trunk/src/devices/oprom/x86_asm.S   Fri Jun  4 22:32:12 2010        (r5612)
@@ -141,20 +141,23 @@
        mov     %ax, %ds
        lidt    __realmode_idt
 
-       /* Set all segments to 0x0000, ds to 0x0040 */
-       mov     %ax, %es
-       mov     %ax, %fs
-       mov     %ax, %gs
-       mov     $0x40, %ax
-       mov     %ax, %ds
-
        /* initialize registers for option rom lcall */
        movl    __registers +  0, %eax
        movl    __registers +  4, %ebx
        movl    __registers +  8, %ecx
        movl    __registers + 12, %edx
        movl    __registers + 16, %esi
-       movl    __registers + 20, %edi
+       movl    __registers + 20, %edi  
+
+       /* Set all segments to 0x0000, ds to 0x0040 */
+       push    %ax
+       xor     %ax, %ax
+       mov     %ax, %es
+       mov     %ax, %fs
+       mov     %ax, %gs
+       mov     $0x40, %ax
+       mov     %ax, %ds
+       pop     %ax
 
        /* ************************************ */
 __lcall_instr = RELOCATED(.)
@@ -262,12 +265,6 @@
        mov     %ax, %ds
        lidt    __realmode_idt
 
-       /* Set all segments to 0x0000 */
-       mov     %ax, %ds
-       mov     %ax, %es
-       mov     %ax, %fs
-       mov     %ax, %gs
-
        /* initialize registers for intXX call */
        movl    __registers +  0, %eax
        movl    __registers +  4, %ebx
@@ -276,6 +273,15 @@
        movl    __registers + 16, %esi
        movl    __registers + 20, %edi
 
+       /* Set all segments to 0x0000 */
+       push    %ax
+       xor     %ax, %ax
+       mov     %ax, %ds
+       mov     %ax, %es
+       mov     %ax, %fs
+       mov     %ax, %gs
+       pop     %ax
+
 __intXX_instr = RELOCATED(.)
        .byte 0xcd, 0x00 /* This becomes intXX */
 
@@ -376,7 +382,7 @@
        mov     %ax, %ds
        lidt    __realmode_idt
 
-       /* Set up segment registers to segment 0x0000 */
+       /* Set up segment registers to segment 0x0000 and ds to 0x040 */
        mov     %ax, %es
        mov     %ax, %fs
        mov     %ax, %gs

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to