]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[bios] Set character attributes only when necessary
authorMichael Brown <mcb30@ipxe.org>
Thu, 22 Mar 2012 12:22:38 +0000 (12:22 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 22 Mar 2012 12:30:47 +0000 (12:30 +0000)
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>
src/arch/i386/firmware/pcbios/bios_console.c

index 1ecd07dddeb59d2d28b77503c509d76d23801353..e489971f1c9888789f53e333b056272ad92f752e 100644 (file)
@@ -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"