#include <limits.h>\r
\r
// === CONSTANTS ===\r
-#define USE_BIOS 1\r
+#ifdef ARCHDIR_is_x86\r
+# define USE_BIOS 1\r
+#else\r
+# define USE_BIOS 0\r
+#endif\r
#define VESA_DEFAULT_FRAMEBUFFER (KERNEL_BASE|0xA0000)\r
#define BLINKING_CURSOR 0\r
#if BLINKING_CURSOR\r
int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data);\r
void Vesa_int_HideCursor(void);\r
void Vesa_int_ShowCursor(void);\r
+ int Vesa_int_SetCursor(tVideo_IOCtl_Bitmap *Cursor);\r
void Vesa_FlipCursor(void *Arg);\r
Uint16 VBE_int_GetWord(const tVT_Char *Char);\r
void VBE_int_Text_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);\r
\r
// Allocate Info Block\r
info = VM8086_Allocate(gpVesa_BiosState, 512, &infoPtr.seg, &infoPtr.ofs);\r
+ if( info == NULL ) {\r
+ Log_Warning("VBE", "VM8086 allocation error");\r
+ return MODULE_ERR_NOTNEEDED;\r
+ }\r
// Set Requested Version\r
memcpy(info->signature, "VBE2", 4);\r
// Set Registers\r
case VIDEO_IOCTL_SETBUFFORMAT:\r
Vesa_int_HideCursor();\r
ret = gVesa_BufInfo.BufferFormat;\r
- if(Data) gVesa_BufInfo.BufferFormat = *(int*)Data;\r
+ if(Data)\r
+ gVesa_BufInfo.BufferFormat = *(int*)Data;\r
if(gVesa_BufInfo.BufferFormat == VIDEO_BUFFMT_TEXT)\r
- DrvUtil_Video_SetCursor( &gVesa_BufInfo, &gDrvUtil_TextModeCursor );\r
+ Vesa_int_SetCursor(&gDrvUtil_TextModeCursor);\r
Vesa_int_ShowCursor();\r
return ret;\r
\r
case VIDEO_IOCTL_SETCURSOR: // Set cursor position\r
+ if( !CheckMem(Data, sizeof(tVideo_IOCtl_Pos)) )\r
+ return -EINVAL;\r
Vesa_int_HideCursor();\r
giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x;\r
giVesaCursorY = ((tVideo_IOCtl_Pos*)Data)->y;\r
return 0;\r
\r
case VIDEO_IOCTL_SETCURSORBITMAP:\r
- if( gpVesaCurMode->flags & FLAG_LFB )\r
- DrvUtil_Video_SetCursor( &gVesa_BufInfo, Data );\r
- return 0;\r
+ return Vesa_int_SetCursor(Data);\r
}\r
return 0;\r
}\r
}\r
}\r
\r
+int Vesa_int_SetCursor(tVideo_IOCtl_Bitmap *Cursor)\r
+{\r
+ if( !CheckMem(Cursor, sizeof(tVideo_IOCtl_Bitmap)) )\r
+ return -EINVAL;\r
+ \r
+ if( gpVesaCurMode && gpVesaCurMode->flags & FLAG_LFB )\r
+ {\r
+ DrvUtil_Video_SetCursor( &gVesa_BufInfo, Cursor );\r
+ }\r
+ else\r
+ {\r
+ }\r
+ return 0;\r
+}\r
+\r
/**\r
* \brief Swaps the text cursor on/off\r
*/\r