On 6/4/10 6:37 PM, Patrick Georgi wrote:
> Am Freitag, den 04.06.2010, 16:25 +0100 schrieb Edwin Beasant:
>   
>> 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 edwin_beas...@virtensys.com
>>     
> Except for the first two parts (the magic values in ecx/edx and
> whitespace), and assuming this is tested, the patch is
>
> Acked-by: Patrick Georgi <patrick.geo...@coresystems.de>
>
>
>   

I did a new version of the patch with those issues fixed (and pushing
one register instead of all), see attachment

Signed-off-by: Edwin Beasant <edwin_beas...@virtensys.com>
Signed-off-by: Stefan Reinauer <ste...@coresystems.de>
Index: src/devices/oprom/x86_asm.S
===================================================================
--- src/devices/oprom/x86_asm.S (revision 5608)
+++ src/devices/oprom/x86_asm.S (working copy)
@@ -141,21 +141,23 @@
        mov     %ax, %ds
        lidt    __realmode_idt
 
+       /* 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  
+
        /* Set all segments to 0x0000, ds to 0x0040 */
+       push    %ax
        mov     %ax, %es
        mov     %ax, %fs
        mov     %ax, %gs
        mov     $0x40, %ax
        mov     %ax, %ds
+       pop     %ax
 
-       /* 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
-
        /* ************************************ */
 __lcall_instr = RELOCATED(.)
        .byte 0x9a
@@ -262,12 +264,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 +272,14 @@
        movl    __registers + 16, %esi
        movl    __registers + 20, %edi
 
+       /* Set all segments to 0x0000 */
+       push    %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 +380,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: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to