Skip to content

Commit

Permalink
[prefix] Call decompressor in flat real mode when DEBUG=libprefix is …
Browse files Browse the repository at this point in the history
…enabled

Allow the decompressor the option of generating debugging output via
the BIOS console by calling it in flat real mode (rather than 16-bit
protected mode) when libprefix.S is built with debugging enabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Feb 26, 2015
1 parent 9cdf68a commit 93178ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/arch/i386/prefix/libprefix.S
Expand Up @@ -394,8 +394,10 @@ process_bytes:
movw %ax, %fs
movw %ax, %gs

#ifdef NDEBUG
/* Call memcpy()-like function */
call *%bx
#endif

/* Return to (flat) real mode */
movl %cr0, %eax
Expand All @@ -409,6 +411,20 @@ process_bytes:
popw %fs
popw %gs

#ifndef NDEBUG
/* Call memcpy()-like function in flat real mode (to allow for
* debug output via INT 10).
*/
pushw %ds
pushw %es
xorw %ax, %ax
movw %ax, %ds
movw %ax, %es
call *%bx
popw %es
popw %ds
#endif

/* Restore GDT */
data32 lgdt -8(%bp)
addw $( 8 /* saved GDT */ + ( PM_DS + 8 ) /* GDT on stack */ ), %sp
Expand Down

0 comments on commit 93178ad

Please sign in to comment.