xorl %esi, %esi
/* Image destination = default */
xorl %edi, %edi
+ /* Allow relocation */
+ clc
/* Install text and data segments */
call install_prealloc
/* Restore registers and return */
* %bx : .data16 segment address
* %esi : Image source physical address (or zero for %cs:0000)
* %edi : Decompression temporary area physical address (or zero for default)
+ * CF set : Avoid relocating to top of memory
* Corrupts:
* none
****************************************************************************
pushal
pushw %ds
pushw %es
-
- /* Sanity: clear the direction flag asap */
- cld
+ cld /* Sanity: clear the direction flag asap */
+ pushfw
/* Copy decompression temporary area physical address to %ebp */
movl %edi, %ebp
movl %ebp, %edi
lcall *init_librm_vector
+ /* Skip relocation if CF was set on entry */
+ popfw
+ pushfw
+ jc skip_relocate
+
/* Call relocate() to determine target address for relocation.
* relocate() will return with %esi, %edi and %ecx set up
* ready for the copy to the new location.
/* Initialise librm at new location */
lcall *init_librm_vector
+skip_relocate:
#endif
/* Restore registers */
+ popfw
popw %es
popw %ds
popal
* picked up by the initial shell prompt, and we will drop
* into a shell.
*/
+ stc /* Inhibit relocation */
pushw %cs
call exec
2:
* Called by the PnP BIOS when it wants to boot us.
*/
bev_entry:
+ clc /* Allow relocation */
pushw %cs
call exec
lret
/* Leave keypress in buffer and start gPXE. The keypress will
* cause the usual initial Ctrl-B prompt to be skipped.
*/
+ clc /* Allow relocation */
pushw %cs
call exec
1: /* Try to call original INT 19 vector */
pushw %cs
popw %ds
+ /* Preserve state of CF */
+ lahf
+
/* Print message as soon as possible */
movw $prodstr, %si
xorw %di, %di
movw %sp, %bp
/* Obtain a reasonably-sized temporary stack */
- xorw %ax, %ax
- movw %ax, %ss
+ xorw %bx, %bx
+ movw %bx, %ss
movw $0x7c00, %sp
/* Install gPXE */
+ sahf
+ pushfw
+ call alloc_basemem
+ popfw
movl image_source, %esi
movl decompress_to, %edi
- call alloc_basemem
call install_prealloc
/* Print message indicating successful installation */