]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pxe] Initialize EDX on PXE NBP entry and INT 1Ah
authorH. Peter Anvin <hpa@zytor.com>
Wed, 18 Feb 2009 06:28:46 +0000 (22:28 -0800)
committerMichael Brown <mcb30@etherboot.org>
Wed, 18 Feb 2009 18:13:20 +0000 (18:13 +0000)
The PXE 1.x spec specifies that on NBP entry or on return from INT
1Ah AX=5650h, EDX shall point to the physical address of the PXENV+
structure.  The PXE 2.x spec drops this requirement, simply stating
that EDX is clobbered.  Given the principle "be conservative in what
you send, liberal in what you accept", however, we should implement
this anyway.

src/arch/i386/interface/pxe/pxe_call.c
src/arch/i386/interface/pxe/pxe_entry.S

index 04aaf3b20d850c1521939b7181393c34617cfc57..320ae12558efbeb2940b7c648921be6664e281c9 100644 (file)
@@ -433,7 +433,7 @@ void pxe_init_structures ( void ) {
  * @ret rc             Return status code
  */
 int pxe_start_nbp ( void ) {
-       int discard_b, discard_c;
+       int discard_b, discard_c, discard_d;
        uint16_t rc;
 
        /* Far call to PXE NBP */
@@ -444,11 +444,12 @@ int pxe_start_nbp ( void ) {
                                           "lcall $0, $0x7c00\n\t"
                                           "addw $4, %%sp\n\t" )
                               : "=a" ( rc ), "=b" ( discard_b ),
-                                "=c" ( discard_c )
-                              :  "a" ( __from_text16 ( &ppxe ) ),
-                                 "b" ( __from_text16 ( &pxenv ) ),
-                                 "c" ( rm_cs )
-                              : "edx", "esi", "edi", "ebp", "memory" );
+                                "=c" ( discard_c ), "=d" ( discard_d )
+                              : "a" ( __from_text16 ( &ppxe ) ),
+                                "b" ( __from_text16 ( &pxenv ) ),
+                                "c" ( rm_cs ),
+                                "d" ( virt_to_phys ( &pxenv ) )
+                              : "esi", "edi", "ebp", "memory" );
 
        return rc;
 }
index 68b7374f61988eb58fcd0355908e4e52b55b791e..22ef41814ddeba25479e65ef9277b9938bf52342 100644 (file)
@@ -178,6 +178,7 @@ pxe_entry_common:
  * Returns:
  *   %ax : 0x564e
  *   %es:bx : Far pointer to the PXENV+ structure
+ *   %edx : Physical address of the PXENV+ structure
  *   CF cleared
  * Corrupts:
  *   none
@@ -191,9 +192,12 @@ pxe_int_1a:
        cmpw    $0x5650, %ax
        jne     1f
        /* INT 1A,5650 - PXE installation check */
-       pushw   %cs
-       popw    %es
+       xorl    %edx, %edx
+       movw    %cs, %dx
+       movw    %dx, %es
        movw    $pxenv, %bx
+       shll    $4, %edx
+       addl    $pxenv, %edx
        movw    $0x564e, %ax
        popfw
        clc