mirror of
https://github.com/ipxe/ipxe
synced 2025-12-30 13:11:11 +03:00
[comboot] Restore the real-mode stack pointer on exit from a COMBOOT image
COMBOOT images use INTs to issue API calls; these end up making calls into gPXE from real mode, and so temporarily change the real-mode stack pointer. When our COMBOOT code uses a longjmp() to implement the various "exit COMBOOT image" API calls, this leaves the real-mode stack pointer stuck with its temporary value, which causes problems if we eventually try to exit out of gPXE back to the BIOS. Fix by adding rmsetjmp() and rmlongjmp() calls (analogous to sigsetjmp()/siglongjmp()); these save and restore the additional state needed for real-mode calls to function correctly.
This commit is contained in:
@@ -52,7 +52,7 @@ static int com32_exec ( struct image *image ) {
|
||||
int state;
|
||||
uint32_t avail_mem_top;
|
||||
|
||||
state = setjmp ( comboot_return );
|
||||
state = rmsetjmp ( comboot_return );
|
||||
|
||||
switch ( state ) {
|
||||
case 0: /* First time through; invoke COM32 program */
|
||||
|
||||
@@ -133,7 +133,7 @@ static int comboot_exec ( struct image *image ) {
|
||||
userptr_t seg_userptr = real_to_user ( COMBOOT_PSP_SEG, 0 );
|
||||
int state;
|
||||
|
||||
state = setjmp ( comboot_return );
|
||||
state = rmsetjmp ( comboot_return );
|
||||
|
||||
switch ( state ) {
|
||||
case 0: /* First time through; invoke COMBOOT program */
|
||||
|
||||
Reference in New Issue
Block a user