]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pxe] Invoke INT 1a,564e when PXE stack is activated
authorMichael Brown <mcb30@ipxe.org>
Tue, 15 Sep 2015 12:20:17 +0000 (13:20 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 15 Sep 2015 12:33:44 +0000 (13:33 +0100)
Invoke INT 1a,564e whenever a PXE stack is activated, passing the
address of the PXENV+ structure in %es:%bx.  This is designed to allow
a BIOS to be notified when a PXE stack has been installed, providing
an opportunity for start-of-day commands such as setting the MAC
address according to a policy chosen by the BIOS.

PXE defines INT 1a,5650 as a means of locating the PXENV+ structure:
this call returns %ax=0x564e and the address of the PXENV+ structure
in %es:%bx.  We choose INT 1a,564e as a fairly natural notification
call, using the parameters as would be returned by INT 1a,5650.

The full calling convention (documented as per section 3.1 of the PXE
specification) is:

  INT 1a,564e - PXE installation notification
  Enter:
    %ax = 0x564e
    %es = 16-bit segment address of the PXENV+ structure
    %bx = 16-bit offset of the PXENV+ structure
  Exit:
    %edx may be trashed (as is the case for INT 1a,5650)
    All other register contents must be preserved
    CF is cleared
    IF is preserved
    All other flags are undefined

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/interface/pxe/pxe_call.c

index 104313666e4272da5f2cb9b8654faa08db0018a6..2d89cc4d4dbecba3e282e20c11bd7c7081719516 100644 (file)
@@ -265,6 +265,9 @@ struct init_fn pxe_init_fn __init_fn ( INIT_NORMAL ) = {
  * @v netdev           Net device to use as PXE net device
  */
 void pxe_activate ( struct net_device *netdev ) {
+       uint32_t discard_a;
+       uint32_t discard_b;
+       uint32_t discard_d;
 
        /* Ensure INT 1A is hooked */
        if ( ! int_1a_hooked ) {
@@ -276,6 +279,15 @@ void pxe_activate ( struct net_device *netdev ) {
 
        /* Set PXE network device */
        pxe_set_netdev ( netdev );
+
+       /* Notify BIOS of installation */
+       __asm__ __volatile__ ( REAL_CODE ( "pushw %%cs\n\t"
+                                          "popw %%es\n\t"
+                                          "int $0x1a\n\t" )
+                              : "=a" ( discard_a ), "=b" ( discard_b ),
+                                "=d" ( discard_d )
+                              : "0" ( 0x564e ),
+                                "1" ( __from_text16 ( &pxenv ) ) );
 }
 
 /**