debuggers.hg

view xen/include/xen/keyhandler.h @ 20975:bd0d6ec8caaa

keyhandler: global shared scratch space for temporary strings

Put one static definition in one place and we can make it as big as we
think reasonable.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 11 21:08:06 2010 +0000 (2010-02-11)
parents 68e8b8379244
children a4ddf47a1e91
line source
1 /******************************************************************************
2 * keyhandler.h
3 *
4 * We keep an array of 'handlers' for each key code between 0 and 255;
5 * this is intended to allow very simple debugging routines (toggle
6 * debug flag, dump registers, reboot, etc) to be hooked in in a slightly
7 * nicer fashion than just editing the serial/keyboard drivers.
8 */
10 #ifndef __XEN_KEYHANDLER_H__
11 #define __XEN_KEYHANDLER_H__
13 typedef void keyhandler_fn_t(
14 unsigned char key);
15 typedef void irq_keyhandler_fn_t(
16 unsigned char key, struct cpu_user_regs *regs);
18 struct keyhandler {
19 /*
20 * If TRUE then u.irq_fn is called in hardirq context with interrupts
21 * disabled. The @regs callback parameter points at the interrupted
22 * register context.
23 * If FALSE then u.fn is called in softirq context with no locks held and
24 * interrupts enabled.
25 */
26 bool_t irq_callback;
28 /*
29 * If TRUE then the keyhandler will be included in the "dump everything"
30 * keyhandler, so must not have any side-effects.
31 */
32 bool_t diagnostic;
34 union {
35 keyhandler_fn_t *fn;
36 irq_keyhandler_fn_t *irq_fn;
37 } u;
39 /* The string is not copied by register_keyhandler(), so must persist. */
40 char *desc;
41 };
43 /* Initialize keytable with default handlers */
44 extern void initialize_keytable(void);
46 /*
47 * Register a callback handler for key @key. The keyhandler structure is not
48 * copied, so must persist.
49 */
50 extern void register_keyhandler(unsigned char key, struct keyhandler *handler);
52 /* Inject a keypress into the key-handling subsystem. */
53 extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs);
55 /* Scratch space is available for use of any keyhandler. */
56 extern char keyhandler_scratch[100];
58 #endif /* __XEN_KEYHANDLER_H__ */