From 40a6839c9ed17518e5984f4ea3e5530cbcfeb4c3 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 24 Jan 2013 13:24:41 +0000 Subject: [PATCH] ldlinux: Don't update UsingVGA when we just want the value There was a bug introduced when this code was copied from the old 4.x assembly implementation, we don't need to update UsingVGA everytime we read a character, we only need its value when comparing it against the DisplayMask. This bug caused every other character to be displayed when only writing to the text console, as well as other nasties such as making syslinux_force_text_mode() think it's in VGA mode even when it's in text mode. Signed-off-by: Matt Fleming --- com32/elflink/ldlinux/msg.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/com32/elflink/ldlinux/msg.c b/com32/elflink/ldlinux/msg.c index 4692716..6ce6368 100644 --- a/com32/elflink/ldlinux/msg.c +++ b/com32/elflink/ldlinux/msg.c @@ -42,13 +42,6 @@ int get_msg_file(char *filename) if (ch == 0x1A) break; - /* - * 01h = text mode - * 02h = graphics mode - */ - UsingVGA &= 0x1; - UsingVGA += 1; - NextCharJump(ch); /* Do what shall be done */ } @@ -149,12 +142,14 @@ static int convert_to_pcdisplay[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; static void msg_normal(uint8_t data) { uint8_t bg, fg; + uint8_t mask = UsingVGA & 0x1; /* Write to serial port */ if (DisplayMask & 0x4) write_serial(data); - if (!(DisplayMask & UsingVGA)) + /* 0x1 = text mode, 0x2 = graphics mode */ + if (!(DisplayMask & ++mask)) return; /* Not screen */ if (!(DisplayCon & 0x01)) -- 2.7.4