X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FDisplay%2FVESA%2Fmain.c;h=506a8b5ac54b93a8ff782f5bd7eece12b822cfcc;hb=de2ae10743172075f2d527780bdfd890ccddb8e7;hp=9b3de8d193c53cc3cf0ac59787eadf1d2804eb91;hpb=3998cfbbadb005bf3ad52ea2538dc21f82864ddc;p=tpg%2Facess2.git diff --git a/Modules/Display/VESA/main.c b/Modules/Display/VESA/main.c index 9b3de8d1..506a8b5a 100644 --- a/Modules/Display/VESA/main.c +++ b/Modules/Display/VESA/main.c @@ -16,7 +16,7 @@ // === CONSTANTS === #define FLAG_LFB 0x1 #define VESA_DEFAULT_FRAMEBUFFER (KERNEL_BASE|0xA0000) -#define BLINKING_CURSOR 0 +#define BLINKING_CURSOR 1 #if BLINKING_CURSOR # define VESA_CURSOR_PERIOD 1000 #endif @@ -44,7 +44,7 @@ tDevFS_Driver gVesa_DriverStruct = { .IOCtl = Vesa_Ioctl } }; -tSpinlock glVesa_Lock; +tMutex glVesa_Lock; tVM8086 *gpVesa_BiosState; int giVesaDriverId = -1; // --- Video Modes --- @@ -253,12 +253,17 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) ); // Sanity Check + if( Offset > (Uint64)(heightInChars*widthInChars) ) { + LEAVE('i', 0); + return 0; + } if(y >= heightInChars) { LEAVE('i', 0); return 0; } - if( Offset + Length > heightInChars*widthInChars ) { + + if( (int)Offset + (int)Length > heightInChars*widthInChars ) { Log_Debug("VESA", "%i + %i > %i*%i (%i)", (int)Offset, (int)Length, heightInChars, widthInChars, heightInChars*widthInChars); Length = heightInChars*widthInChars - Offset; @@ -270,7 +275,7 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) LOG("dest = %p", dest); - for( i = 0; i < Length; i++ ) + for( i = 0; i < (int)Length; i++ ) { VT_Font_Render( chars->Ch, @@ -362,7 +367,7 @@ int Vesa_Ioctl(tVFS_Node *Node, int ID, void *Data) case VIDEO_IOCTL_SETCURSOR: // Set cursor position #if !BLINKING_CURSOR - if(giVesaCursorX > 0 && giVesaCursorY) + if(giVesaCursorX > 0) Vesa_FlipCursor(Node); #endif giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x; @@ -416,7 +421,7 @@ int Vesa_Int_SetMode(int mode) Time_RemoveTimer(giVesaCursorTimer); giVesaCursorTimer = -1; - LOCK( &glVesa_Lock ); + Mutex_Acquire( &glVesa_Lock ); gpVesa_BiosState->AX = 0x4F02; gpVesa_BiosState->BX = gVesa_Modes[mode].code; @@ -441,7 +446,7 @@ int Vesa_Int_SetMode(int mode) giVesaCurrentMode = mode; gpVesaCurMode = &gVesa_Modes[giVesaCurrentMode]; - RELEASE( &glVesa_Lock ); + Mutex_Release( &glVesa_Lock ); return 1; } @@ -513,7 +518,7 @@ void Vesa_FlipCursor(void *Arg) // Sanity 1 if(giVesaCursorX < 0 || giVesaCursorY < 0 - || y*pitch + x + giVT_CharHeight*pitch > gpVesaCurMode->fbSize/4) { + || y*pitch + x + giVT_CharHeight*pitch > (int)gpVesaCurMode->fbSize/4) { Debug("Cursor OOB (%i,%i)", x, y); giVesaCursorTimer = -1; return;