Browse Source

[prefix] Call decompressor in flat real mode when DEBUG=libprefix is 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>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
93178adb98
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      src/arch/i386/prefix/libprefix.S

+ 16
- 0
src/arch/i386/prefix/libprefix.S View File

@@ -394,8 +394,10 @@ process_bytes:
394 394
 	movw	%ax, %fs
395 395
 	movw	%ax, %gs
396 396
 
397
+#ifdef NDEBUG
397 398
 	/* Call memcpy()-like function */
398 399
 	call	*%bx
400
+#endif
399 401
 
400 402
 	/* Return to (flat) real mode */
401 403
 	movl	%cr0, %eax
@@ -409,6 +411,20 @@ process_bytes:
409 411
 	popw	%fs
410 412
 	popw	%gs
411 413
 
414
+#ifndef NDEBUG
415
+	/* Call memcpy()-like function in flat real mode (to allow for
416
+	 * debug output via INT 10).
417
+	 */
418
+	pushw	%ds
419
+	pushw	%es
420
+	xorw	%ax, %ax
421
+	movw	%ax, %ds
422
+	movw	%ax, %es
423
+	call	*%bx
424
+	popw	%es
425
+	popw	%ds
426
+#endif
427
+
412 428
 	/* Restore GDT */
413 429
 	data32 lgdt -8(%bp)
414 430
 	addw	$( 8 /* saved GDT */ + ( PM_DS + 8 ) /* GDT on stack */ ), %sp

Loading…
Cancel
Save