[pxe] Convert external PXE API errors into iPXE platform-generated errors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-04-29 19:58:25 +01:00
parent de1fafd2f8
commit e411b37eb1
4 changed files with 27 additions and 16 deletions

View File

@@ -32,6 +32,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
* PXE API entry point
*/
/* Disambiguate the various error causes */
#define EINFO_EPXENBP \
__einfo_uniqify ( EINFO_EPLATFORM, 0x01, \
"External PXE NBP error" )
#define EPXENBP( status ) EPLATFORM ( EINFO_EPXENBP, status )
/** Vector for chaining INT 1A */
extern struct segoff __text16 ( pxe_int_1a_vector );
#define pxe_int_1a_vector __use_text16 ( pxe_int_1a_vector )
@@ -257,7 +263,7 @@ rmjmp_buf pxe_restart_nbp;
int pxe_start_nbp ( void ) {
int jmp;
int discard_b, discard_c, discard_d, discard_D;
uint16_t rc;
uint16_t status;
/* Allow restarting NBP via PXENV_RESTART_TFTP */
jmp = rmsetjmp ( pxe_restart_nbp );
@@ -271,7 +277,7 @@ int pxe_start_nbp ( void ) {
"sti\n\t"
"lcall $0, $0x7c00\n\t"
"addw $4, %%sp\n\t" )
: "=a" ( rc ), "=b" ( discard_b ),
: "=a" ( status ), "=b" ( discard_b ),
"=c" ( discard_c ), "=d" ( discard_d ),
"=D" ( discard_D )
: "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ),
@@ -279,8 +285,10 @@ int pxe_start_nbp ( void ) {
"d" ( virt_to_phys ( &pxenv ) ),
"D" ( __from_text16 ( &ppxe ) )
: "esi", "ebp", "memory" );
if ( status )
return -EPXENBP ( status );
return rc;
return 0;
}
REQUIRE_OBJECT ( pxe_preboot );