From cadaf0e35d4530a0aa3f3100c3c0e5c96d9f0556 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 26 Jul 2010 23:47:26 -0400 Subject: [PATCH] Be sure to disable bootsplash on all BIOS boot cases. Disable the bootsplash on cbfs payload exec, and if something hooks int19. Also, be sure to only disable the bootsplash (revert to text mode) once. --- src/biosvar.h | 3 ++- src/boot.c | 8 ++++---- src/bootsplash.c | 9 ++++++--- src/post.c | 8 +++++++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/biosvar.h b/src/biosvar.h index dce35af..df0df0e 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -1,6 +1,6 @@ // Variable layouts of bios. // -// Copyright (C) 2008,2009 Kevin O'Connor +// Copyright (C) 2008-2010 Kevin O'Connor // // This file may be distributed under the terms of the GNU LGPLv3 license. #ifndef __BIOSVAR_H @@ -216,6 +216,7 @@ struct extended_bios_data_area_s { u8 other2[0xC4]; // 0x121 - Begin custom storage. + u8 bootsplash_active; u8 ps2ctr; struct usbkeyinfo usbkey_last; diff --git a/src/boot.c b/src/boot.c index 814dee1..44964a7 100644 --- a/src/boot.c +++ b/src/boot.c @@ -1,6 +1,6 @@ // Code to load disk image and start system boot. // -// Copyright (C) 2008 Kevin O'Connor +// Copyright (C) 2008-2010 Kevin O'Connor // Copyright (C) 2002 MandrakeSoft S.A. // // This file may be distributed under the terms of the GNU LGPLv3 license. @@ -343,11 +343,10 @@ boot_prep(void) static void call_boot_entry(u16 bootseg, u16 bootip, u8 bootdrv) { - dprintf(1, "Booting from %04x:%04x\n", bootseg, bootip); - /* Go back to text, the OS might expect it... (Can't do this any later) */ disable_bootsplash(); + dprintf(1, "Booting from %04x:%04x\n", bootseg, bootip); struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; @@ -431,6 +430,7 @@ boot_cbfs(struct ipl_entry_s *ie) return; if (count--) continue; + disable_bootsplash(); cbfs_run_payload(file); } } @@ -462,7 +462,7 @@ do_boot(u16 seq_nr) printf("Booting from %s...\n" , strtcpy(desc, ie->description, ARRAY_SIZE(desc))); - switch(ie->type) { + switch (ie->type) { case IPL_TYPE_FLOPPY: boot_disk(0x00, IPL.checkfloppysig); break; diff --git a/src/bootsplash.c b/src/bootsplash.c index b96e066..9ff81b3 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -10,6 +10,7 @@ #include "config.h" // CONFIG_* #include "util.h" // dprintf #include "jpeg.h" // splash +#include "biosvar.h" // SET_EBDA /**************************************************************** @@ -99,7 +100,7 @@ static void enable_vga_text_console(void) call16_int10(&br); // Write to screen. - printf("Starting SeaBIOS (version %s)\n\n", VERSION); + printf("SeaBIOS (version %s)\n\n", VERSION); } void enable_vga_console(void) @@ -181,7 +182,7 @@ void enable_vga_console(void) dprintf(8, "bytes per scanline: %d\n", mode_info->bytes_per_scanline); dprintf(8, "bits per pixel: %d\n", mode_info->bits_per_pixel); - /* Look for bootsplash.jpg in CBFS and decompress it... */ + /* Decompress jpeg */ dprintf(8, "Copying boot splash screen...\n"); cbfs_copyfile(file, jpeg, filesize); dprintf(8, "Decompressing boot splash screen...\n"); @@ -194,6 +195,7 @@ void enable_vga_console(void) /* Show the picture */ iomemcpy(framebuffer, picture, imagesize); + SET_EBDA(bootsplash_active, 1); cleanup: free(jpeg); @@ -210,7 +212,8 @@ gotext: void disable_bootsplash(void) { - if (! CONFIG_BOOTSPLASH) + if (! CONFIG_BOOTSPLASH || !GET_EBDA(bootsplash_active)) return; + SET_EBDA(bootsplash_active, 0); enable_vga_text_console(); } diff --git a/src/post.c b/src/post.c index fc7acc5..0cb9e57 100644 --- a/src/post.c +++ b/src/post.c @@ -1,6 +1,6 @@ // 32bit code to Power On Self Test (POST) a machine. // -// Copyright (C) 2008,2009 Kevin O'Connor +// Copyright (C) 2008-2010 Kevin O'Connor // Copyright (C) 2002 MandrakeSoft S.A. // // This file may be distributed under the terms of the GNU LGPLv3 license. @@ -276,6 +276,12 @@ _start(void) // Write protect bios memory. make_bios_readonly(); + // Disable bootsplash if something has hooked int19. + extern void entry_19_official(void); + if (GET_IVT(0x19).segoff + != SEGOFF(SEG_BIOS, (u32)entry_19_official - BUILD_BIOS_ADDR).segoff) + disable_bootsplash(); + // Invoke int 19 to start boot process. dprintf(3, "Jump to int19\n"); struct bregs br; -- 2.25.1