diff options
author | Michael Brown | 2012-07-11 18:59:47 +0200 |
---|---|---|
committer | Michael Brown | 2015-04-21 01:39:31 +0200 |
commit | 4925c41b181f1852084c9aae39d672413910d6a1 (patch) | |
tree | 82d555f6e896c115128c78fe6c483234d45ece8e | |
parent | [pxe] Exit back to the PXE stack instead of rebooting (diff) | |
download | memtest86-4925c41b181f1852084c9aae39d672413910d6a1.tar.gz memtest86-4925c41b181f1852084c9aae39d672413910d6a1.tar.xz memtest86-4925c41b181f1852084c9aae39d672413910d6a1.zip |
[pxe] Allow PXE NBP to accept a command line
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | main.c | 15 | ||||
-rw-r--r-- | pxe.S | 28 |
2 files changed, 39 insertions, 4 deletions
@@ -272,12 +272,15 @@ void reloc(void) #define OLD_CL_MAGIC_ADDR ((unsigned short*) MK_PTR(INITSEG,0x20)) #define OLD_CL_MAGIC 0xA33F #define OLD_CL_OFFSET_ADDR ((unsigned short*) MK_PTR(INITSEG,0x22)) +#define PXE_CL_MAGIC_ADDR ((unsigned short*) MK_PTR(BOOTSEG,0x20)) +#define PXE_CL_OFFSET_ADDR ((unsigned short*) MK_PTR(BOOTSEG,0x22)) static void parse_command_line(void) { long simple_strtoul(char *cmd, char *ptr, int base); char *cp, dummy; int i, j, k; + unsigned short offset; if (cmdline_parsed) return; @@ -287,11 +290,15 @@ static void parse_command_line(void) cpu_mask[i] = 1; } - if (*OLD_CL_MAGIC_ADDR != OLD_CL_MAGIC) + if (*OLD_CL_MAGIC_ADDR == OLD_CL_MAGIC) { + offset = *OLD_CL_OFFSET_ADDR; + cp = MK_PTR(INITSEG, offset); + } else if (*PXE_CL_MAGIC_ADDR == OLD_CL_MAGIC) { + offset = *PXE_CL_OFFSET_ADDR; + cp = MK_PTR(BOOTSEG, offset); + } else { return; - - unsigned short offset = *OLD_CL_OFFSET_ADDR; - cp = MK_PTR(INITSEG, offset); + } /* skip leading spaces */ while (*cp == ' ') @@ -11,6 +11,9 @@ #define PXENV_ENTRY 0x0a #define PXENV_UNDI_SHUTDOWN 0x0005 +#define PXENV_FILE_CMDLINE 0x00e8 + +#define CMDLINE_MAGIC 0xa33f .code16 .section ".bootsect", "ax", @progbits @@ -22,6 +25,13 @@ _main: /* Canonicalise addresses */ ljmp $BOOTSEG, $pxe_start + /* Command line magic */ +.org 0x20 +cmdline_magic: + .word 0 +cmdline_offset: + .word 0 + pxe_start: /* Preserve registers, %ss:%esp, and magic marker on PXE stack */ pushfl @@ -71,6 +81,19 @@ pxe_start: movw %ax, %ds movw %ax, %es + /* Check for a command line */ + movw $PXENV_FILE_CMDLINE, %bx + movw $pxenv_file_cmdline, %di + lcall *pxenv_vector + testw %ax, %ax + jnz no_cmdline + movw pxenv_file_cmdline + 2, %ax + testw %ax, %ax + jz no_cmdline + movw $CMDLINE_MAGIC, cmdline_magic + movw $RMSIZE, cmdline_offset +no_cmdline: + /* Shutdown NIC */ movw $PXENV_UNDI_SHUTDOWN, %bx movw $pxenv_undi_shutdown, %di @@ -85,5 +108,10 @@ pxenv_vector: pxenv_undi_shutdown: .word 0 /* Status */ +pxenv_file_cmdline: + .word 0 /* Status */ + .word 0xffff /* 64kB max length of command line */ + .word RMSIZE, BOOTSEG + .org 512 _epxe: |