summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/firmware/pcbios/bios_console.c
diff options
context:
space:
mode:
authorMichael Brown2012-03-22 13:22:38 +0100
committerMichael Brown2012-03-22 13:30:47 +0100
commitefb0c7fce4f9dd8e782209a84221088ee39bce67 (patch)
tree577c59184d6793ca953b2a7dc51101cf3503dda7 /src/arch/i386/firmware/pcbios/bios_console.c
parent[test] Add CMS self-tests (diff)
downloadipxe-efb0c7fce4f9dd8e782209a84221088ee39bce67.tar.gz
ipxe-efb0c7fce4f9dd8e782209a84221088ee39bce67.tar.xz
ipxe-efb0c7fce4f9dd8e782209a84221088ee39bce67.zip
[bios] Set character attributes only when necessary
There is no INT 10 call for "display character with attribute, advancing the cursor and scrolling the screen as necessary". We therefore make two INT 10 calls: INT 10,09 to write the character with its attribute at the current cursor position, and then INT 10,0e to (re)write the character (leaving the attribute unchanged), advance the cursor position and scroll as necessary. This confuses the serial-over-LAN console redirection feature provided by some BIOSes. Fix by performing the INT10,09 only when necessary to change the existing attribute. Reported-by: Itay Gazit <itaygazit@gmail.com> Tested-by: Itay Gazit <itaygazit@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/firmware/pcbios/bios_console.c')
-rw-r--r--src/arch/i386/firmware/pcbios/bios_console.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arch/i386/firmware/pcbios/bios_console.c b/src/arch/i386/firmware/pcbios/bios_console.c
index 1ecd07dd..e489971f 100644
--- a/src/arch/i386/firmware/pcbios/bios_console.c
+++ b/src/arch/i386/firmware/pcbios/bios_console.c
@@ -163,6 +163,14 @@ static void bios_putchar ( int character ) {
/* Skip non-printable characters */
"cmpb $0x20, %%al\n\t"
"jb 1f\n\t"
+ /* Read attribute */
+ "movb %%al, %%cl\n\t"
+ "movb $0x08, %%ah\n\t"
+ "int $0x10\n\t"
+ "xchgb %%al, %%cl\n\t"
+ /* Skip if attribute matches */
+ "cmpb %%ah, %%bl\n\t"
+ "je 1f\n\t"
/* Set attribute */
"movw $0x0001, %%cx\n\t"
"movb $0x09, %%ah\n\t"