From c1595129b51940bb620302d6da5accef50626da9 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 21 Mar 2014 11:07:29 +0000 Subject: [bios] Fix screen clearing on even more buggy BIOSes Some BIOSes (observed with a ProLiant DL360p Gen8 SE) perform no range checking whatsoever on the parameters passed to INT10,06 and will therefore happily write to an area beyond the end of video RAM. The area immediately following the video RAM tends to be the VGA BIOS ROM image. Overwriting the VGA BIOS leads to an interesting variety of crashes and reboots. Fix by specifying an exact width and height to be cleared, rather than passing in large values and relying upon the BIOS to truncate them to the appropriate range. Reported-by: Alex Davies Signed-off-by: Michael Brown --- src/arch/i386/firmware/pcbios/bios_console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/arch/i386/firmware/pcbios/bios_console.c b/src/arch/i386/firmware/pcbios/bios_console.c index 035831c8..b2b7bf2d 100644 --- a/src/arch/i386/firmware/pcbios/bios_console.c +++ b/src/arch/i386/firmware/pcbios/bios_console.c @@ -101,7 +101,9 @@ static void bios_handle_ed ( struct ansiesc_context *ctx __unused, "int $0x10\n\t" "cli\n\t" ) : : "a" ( 0x0600 ), "b" ( bios_attr << 8 ), - "c" ( 0 ), "d" ( 0xfefe ) ); + "c" ( 0 ), + "d" ( ( ( console_height - 1 ) << 8 ) | + ( console_width - 1 ) ) ); } /** -- cgit v1.2.3-55-g7522