Kernel - Change virtual memory API to use void* for virtual addresses
[tpg/acess2.git] / KernelLand / Modules / Input / Keyboard / main.c
index f49d8ea..31d155f 100644 (file)
 #include "keymap_int.h"
 #include "layout_kbdus.h"
 #include <hal_proc.h>
+#include <debug_hooks.h>
 
 #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);
  int   Keyboard_Cleanup(void);
@@ -164,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;
 
@@ -289,5 +292,19 @@ void Keyboard_HandleKey(tKeyboard *Source, Uint32 HIDKeySym)
        }
        #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
+
 }
 

UCC git Repository :: git.ucc.asn.au