A mechanism to allow debuggers to trigger on a certain hotkey (combination). Derived (generalized) from similar KDB work. Signed-Off-By: Jan Beulich Index: 2.6.14-nlkd/drivers/char/keyboard.c =================================================================== --- 2.6.14-nlkd.orig/drivers/char/keyboard.c 2005-11-09 10:40:17.000000000 +0100 +++ 2.6.14-nlkd/drivers/char/keyboard.c 2005-11-07 09:39:05.000000000 +0100 @@ -39,6 +39,7 @@ #include #include #include +#include static void kbd_disconnect(struct input_handle *handle); extern void ctrl_alt_del(void); @@ -153,6 +154,9 @@ static int sysrq_down; #endif static int sysrq_alt; +struct notifier_block *kdebug_chain = NULL; +EXPORT_SYMBOL(kdebug_chain); + /* * Translation of scancodes to keycodes. We set them on only the first attached * keyboard - for per-keyboard setting, /dev/input/event is more useful. @@ -1052,6 +1056,11 @@ static void kbd_keycode(unsigned int key rep = (down == 2); + if (notify_kdebug(KDEBUG_KEYBOARD, + keycode | ((long)!down << (BITS_PER_LONG - 1)), + regs) == NOTIFY_STOP) + return; + #ifdef CONFIG_MAC_EMUMOUSEBTN if (mac_hid_mouse_emulate_buttons(1, keycode, down)) return; Index: 2.6.14-nlkd/include/linux/kdebug.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/kdebug.h 2005-11-09 10:25:16.000000000 +0100 @@ -0,0 +1,27 @@ +#ifndef _KDEBUG_H +#define _KDEBUG_H + +/* + * This notifier is to replace hardcoded entries in e.g. the keyboard + * driver used by kernel debuggers. + */ +#include + +struct pt_regs; + +struct kdebug_args { + struct pt_regs *regs; + long data; +}; + +extern struct notifier_block *kdebug_chain; + +#define KDEBUG_KEYBOARD 1 + +static inline int notify_kdebug(unsigned long event, long data, struct pt_regs *regs) +{ + struct kdebug_args args = { .regs=regs, .data = data }; + return notifier_call_chain(&kdebug_chain, event, &args); +} + +#endif