X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FInput%2FKeyboard%2Fmain.c;h=31d155f3d71fa43092d2d3c47e7f79b86ca526da;hb=91cb22a5f21eeca8f84456c1febf79f84a65d30d;hp=ccec8f5c4faeaa995ebaba6efb92b29d952b2b87;hpb=66cb73e82a05896035f605c96fde8b8a68e07bb9;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Input/Keyboard/main.c b/KernelLand/Modules/Input/Keyboard/main.c index ccec8f5c..31d155f3 100644 --- a/KernelLand/Modules/Input/Keyboard/main.c +++ b/KernelLand/Modules/Input/Keyboard/main.c @@ -16,23 +16,18 @@ #include #include "keymap_int.h" #include "layout_kbdus.h" +#include +#include #define USE_KERNEL_MAGIC 1 -// === IMPORTS === -#if USE_KERNEL_MAGIC -extern void Threads_ToggleTrace(int TID); -extern void Threads_Dump(void); -extern void Heap_Stats(void); -#endif - // === PROTOTYPES === int Keyboard_Install(char **Arguments); -void Keyboard_Cleanup(void); + int Keyboard_Cleanup(void); // - Internal tKeymap *Keyboard_LoadMap(const char *Name); void Keyboard_FreeMap(tKeymap *Keymap); -// - User side +// - "User" side (Actually VT) int Keyboard_IOCtl(tVFS_Node *Node, int ID, void *Data); // - Device Side tKeyboard *Keyboard_CreateInstance(int MaxSym, const char *Name); @@ -67,9 +62,10 @@ int Keyboard_Install(char **Arguments) /** * \brief Pre-unload cleanup function */ -void Keyboard_Cleanup(void) +int Keyboard_Cleanup(void) { // TODO: Do I need this? + return 0; } // --- Map Management --- @@ -162,6 +158,15 @@ void Keyboard_HandleKey(tKeyboard *Source, Uint32 HIDKeySym) Uint32 flag; Uint8 layer; + if( !Source ) { + Log_Error("Keyboard", "Passed NULL handle"); + return ; + } + if( !Source->Node ) { + Log_Error("Keyboard", "Passed handle with NULL node"); + return ; + } + bPressed = !(HIDKeySym & (1 << 31)); HIDKeySym &= 0x7FFFFFFF; @@ -279,11 +284,27 @@ void Keyboard_HandleKey(tKeyboard *Source, Uint32 HIDKeySym) case 'p': Threads_Dump(); return; // Heap Statistics case 'h': Heap_Stats(); return; + // PMem Statistics + case 'm': MM_DumpStatistics(); return; // Dump Structure case 's': return; } } #endif + #if defined(ARCHDIR_is_x86) || defined(ARCHDIR_is_x86_64) + if(bPressed + && Source->KeyStates[KEYSYM_LEFTCTRL/8] & (1 << (KEYSYM_LEFTCTRL&7)) + && Source->KeyStates[KEYSYM_LEFTALT/8] & (1 << (KEYSYM_LEFTALT &7)) ) + { + if( HIDKeySym == KEYSYM_DELETE ) + { + // Trigger triple fault + __asm__ __volatile__ ("lgdt (%esp) ; int $0x0"); + for(;;); + } + } + #endif + }