aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/keyhandler.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-08-02 13:43:15 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-08-02 13:43:15 +0100
commit2d986e611fada54d00d3759dad5725d337493719 (patch)
treeca5b9afcd291893d40b713acdbada93432eca186 /xen/include/xen/keyhandler.h
parent91baae515e845630309aa8d72bf1cf4a2eaa120c (diff)
downloadxen-2d986e611fada54d00d3759dad5725d337493719.tar.gz
xen-2d986e611fada54d00d3759dad5725d337493719.tar.bz2
xen-2d986e611fada54d00d3759dad5725d337493719.zip
Add a single trigger for all diagnostic keyhandlers
Add a new keyhandler that triggers all the side-effect-free keyhandlers. This lets automated tests (and users) log the full set of keyhandlers without having to be aware of which ones might reboot the host. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/include/xen/keyhandler.h')
-rw-r--r--xen/include/xen/keyhandler.h47
1 files changed, 33 insertions, 14 deletions
diff --git a/xen/include/xen/keyhandler.h b/xen/include/xen/keyhandler.h
index 451b4c3345..71e6dbe11c 100644
--- a/xen/include/xen/keyhandler.h
+++ b/xen/include/xen/keyhandler.h
@@ -10,25 +10,44 @@
#ifndef __XEN_KEYHANDLER_H__
#define __XEN_KEYHANDLER_H__
+typedef void keyhandler_fn_t(
+ unsigned char key);
+typedef void irq_keyhandler_fn_t(
+ unsigned char key, struct cpu_user_regs *regs);
+
+struct keyhandler {
+ /*
+ * If TRUE then u.irq_fn is called in hardirq context with interrupts
+ * disabled. The @regs callback parameter points at the interrupted
+ * register context.
+ * If FALSE then u.fn is called in softirq context with no locks held and
+ * interrupts enabled.
+ */
+ bool_t irq_callback;
+
+ /*
+ * If TRUE then the keyhandler will be included in the "dump everything"
+ * keyhandler, so must not have any side-effects.
+ */
+ bool_t diagnostic;
+
+ union {
+ keyhandler_fn_t *fn;
+ irq_keyhandler_fn_t *irq_fn;
+ } u;
+
+ /* The string is not copied by register_keyhandler(), so must persist. */
+ char *desc;
+};
+
/* Initialize keytable with default handlers */
extern void initialize_keytable(void);
/*
- * Register a callback function for key @key. The callback occurs in
- * softirq context with no locks held and interrupts enabled.
- */
-typedef void keyhandler_t(unsigned char key);
-extern void register_keyhandler(
- unsigned char key, keyhandler_t *handler, char *desc);
-
-/*
- * Register an IRQ callback function for key @key. The callback occurs
- * synchronously in hard-IRQ context with interrupts disabled. The @regs
- * callback parameter points at the interrupted register context.
+ * Register a callback handler for key @key. The keyhandler structure is not
+ * copied, so must persist.
*/
-typedef void irq_keyhandler_t(unsigned char key, struct cpu_user_regs *regs);
-extern void register_irq_keyhandler(
- unsigned char key, irq_keyhandler_t *handler, char *desc);
+extern void register_keyhandler(unsigned char key, struct keyhandler *handler);
/* Inject a keypress into the key-handling subsystem. */
extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs);