vga: Fix the support of extended ASCII
VGA defineds the extended ASCII set based on CP437, but there is a bug on printing them: in vga_write_at_offset(), we perform a bitwise or between 'unsigned short' and 'signed char': ``` p[i] = 0x0F00 | string[i]; ``` If we want to show an extended ASCII character, string[i] will be negative and this bitwise operation will fail due to their implicit casting rule: convert signed char to unsigned short by adding 65536. To fix this, we need to cast the string to unsigned char manually somewhere. Since we still want to leverage the built-in string utilities which only accepts const char*, we still preserve the original prototypes before, and cast it until we write into the frame buffer. BRANCH=brya BUG=b:264666392 TEST=emerge-brya coreboot chromeos-bootimage and verify drawing characters with code > 127. Change-Id: I9cd65fe9794e5b0d338147924f28efd27fc8a1e8 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/73090 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Tarun Tuli <taruntuli@google.com>
This commit is contained in:
parent
73e9ac66ad
commit
de74711dc8
|
@ -267,7 +267,7 @@ vga_write_at_offset(unsigned int line, unsigned int offset, const char *string)
|
|||
|
||||
for (i = 0; i < (VGA_COLUMNS - offset); i++) {
|
||||
if (i < len)
|
||||
p[i] = 0x0F00 | string[i];
|
||||
p[i] = 0x0F00 | (unsigned char)string[i];
|
||||
else
|
||||
p[i] = 0x0F00;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue