From: John Hodge Date: Mon, 6 Jan 2014 14:21:48 +0000 (+0800) Subject: Modules/VBE - Sanity checking, pre-set current mode to boot mode X-Git-Tag: rel0.15~19 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=8bbb351f7b34a384a15787541b68e3a3c0ac4588;p=tpg%2Facess2.git Modules/VBE - Sanity checking, pre-set current mode to boot mode --- diff --git a/KernelLand/Modules/Display/VESA/main.c b/KernelLand/Modules/Display/VESA/main.c index 3422d0e6..86079c67 100644 --- a/KernelLand/Modules/Display/VESA/main.c +++ b/KernelLand/Modules/Display/VESA/main.c @@ -2,7 +2,7 @@ * AcessOS 1 * Video BIOS Extensions (Vesa) Driver */ -#define DEBUG 1 +#define DEBUG 0 #define VERSION 0x100 #include @@ -13,6 +13,7 @@ #include #include "common.h" #include +#include // === CONSTANTS === #define USE_BIOS 1 @@ -54,7 +55,7 @@ tVM8086 *gpVesa_BiosState; int giVesaCurrentMode = 0; tVesa_Mode gVesa_BootMode = {0x03, 80*8, 25*16, 80*8*2, 12, FLAG_POPULATED, 80*25*2, 0xB8000}; tVesa_Mode *gVesa_Modes; -tVesa_Mode *gpVesaCurMode; +tVesa_Mode *gpVesaCurMode = &gVesa_BootMode; int giVesaModeCount = 0; int gbVesaModesChecked; // --- Framebuffer --- @@ -470,6 +471,11 @@ int Vesa_Int_SetMode(int mode) int VBE_int_MatchModes(tVideo_IOCtl_Mode *ReqMode, tVesa_Mode *ThisMode) { + if( ThisMode->bpp == 0 ) { + Log_Warning("VBE", "VESA mode %x (%ix%i) has 0bpp", + ThisMode->code, ThisMode->width, ThisMode->height); + return INT_MAX; + } LOG("Matching %ix%i %ibpp", ThisMode->width, ThisMode->height, ThisMode->bpp); if(ThisMode->width == ReqMode->width && ThisMode->height == ReqMode->height) { @@ -580,7 +586,7 @@ void Vesa_int_HideCursor(void) void Vesa_int_ShowCursor(void) { - if( gpVesaCurMode->flags & FLAG_LFB ) + if( gpVesaCurMode && gpVesaCurMode->flags & FLAG_LFB ) { gbVesa_CursorVisible = (giVesaCursorX >= 0); if(gVesa_BufInfo.BufferFormat == VIDEO_BUFFMT_TEXT) @@ -615,7 +621,7 @@ void Vesa_FlipCursor(void *Arg) if( gVesa_BufInfo.BufferFormat != VIDEO_BUFFMT_TEXT ) return ; - if( gpVesaCurMode->flags & FLAG_LFB ) + if( gpVesaCurMode && gpVesaCurMode->flags & FLAG_LFB ) { if( gbVesa_CursorVisible ) DrvUtil_Video_RemoveCursor(&gVesa_BufInfo);