[pxe] Introduce PXE exit hook for NBP chaining

It might be the case that we wish to chain to an NBP without
being "in the way".  We now implement a hook in our exit path
for gPXE *.*pxe build targets.  The hook is a pointer to a
SEG16:OFF16 which we try to jump to during exit.  By default,
this pointer results in the usual exit path.

We also implement the "pxenv_file_exit_hook" PXE API routine
to allow the user to specify an alternate SEG16:OFF16 to jump
to during exit.

Unfortunately, this additional PXE extension has a cost
in code size.  Fortunately, a look at the size difference
for a gPXE .rom build target shows zero size difference
after compression.

The routine is documented in doc/pxe_extensions as follows:

FILE EXIT HOOK

Op-Code:	PXENV_FILE_EXIT_HOOK (00e7h)

Input:	Far pointer to a t_PXENV_FILE_EXIT_HOOK parameter
		structure that has been initialized by the caller.

Output:	PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be
		returned in AX.  The Status field in the parameter
		structure must be set to one of the values represented
		by the PXENV_STATUS_xxx constants.

Description:Modify the exit path to jump to the specified code.
		Only valid for pxeprefix-based builds.

typedef struct s_PXENV_FILE_EXIT_HOOK {
        PXENV_STATUS_t Status;
        SEGOFF16_t Hook;
} t_PXENV_FILE_EXIT_HOOK;

Set before calling API service:

Hook:	The SEG16:OFF16 of the code to jump to.

Returned from API service:

Status:	See PXENV_STATUS_xxx constants.

Requested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Marty Connor <mdc@etherboot.org>
This commit is contained in:
Shao Miller
2010-01-23 22:12:27 -05:00
committed by Marty Connor
parent 5efc2fcb60
commit 112a3f2de2
6 changed files with 112 additions and 1 deletions

View File

@@ -718,6 +718,13 @@ run_gpxe:
lret
.section ".text16", "ax", @progbits
1:
/* Update the exit hook */
movw %cs,pxe_exit_hook+2
push %ax
mov $2f,%ax
mov %ax,pxe_exit_hook
pop %ax
/* Run main program */
pushl $main
pushw %cs
@@ -731,7 +738,10 @@ run_gpxe:
movw %di, %ss
movl %ebp, %esp
/* Check PXE stack magic */
/* Jump to hook if applicable */
ljmpw *pxe_exit_hook
2: /* Check PXE stack magic */
popl %eax
cmpl $STACK_MAGIC, %eax
jne 1f