mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen: enable keyhandlers to work without register set specified
There are only two keyhandlers which make use of the cpu_user_regs struct passed to them. In order to be able to call any keyhandler in non-interrupt contexts, too, modify those two handlers to cope with a NULL regs pointer by using run_in_exception_handler() in that case. Suggested-by: Julien Grall <julien@xen.org> Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
1 parent
c8d4b6304a
commit
a4e8b178bf
1 file changed
+14
-3
+14
-3
@@ -181,7 +181,10 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs)
|
||||
cpumask_copy(&dump_execstate_mask, &cpu_online_map);
|
||||
|
||||
/* Get local execution state out immediately, in case we get stuck. */
|
||||
dump_execstate(regs);
|
||||
if ( regs )
|
||||
dump_execstate(regs);
|
||||
else
|
||||
run_in_exception_handler(dump_execstate);
|
||||
|
||||
/* Alt. handling: remaining CPUs are dumped asynchronously one-by-one. */
|
||||
if ( alt_key_handling )
|
||||
@@ -481,15 +484,23 @@ static void run_all_keyhandlers(unsigned char key, struct cpu_user_regs *regs)
|
||||
tasklet_schedule(&run_all_keyhandlers_tasklet);
|
||||
}
|
||||
|
||||
static void do_debug_key(unsigned char key, struct cpu_user_regs *regs)
|
||||
static void do_debugger_trap_fatal(struct cpu_user_regs *regs)
|
||||
{
|
||||
printk("'%c' pressed -> trapping into debugger\n", key);
|
||||
(void)debugger_trap_fatal(0xf001, regs);
|
||||
|
||||
/* Prevent tail call optimisation, which confuses xendbg. */
|
||||
barrier();
|
||||
}
|
||||
|
||||
static void do_debug_key(unsigned char key, struct cpu_user_regs *regs)
|
||||
{
|
||||
printk("'%c' pressed -> trapping into debugger\n", key);
|
||||
if ( regs )
|
||||
do_debugger_trap_fatal(regs);
|
||||
else
|
||||
run_in_exception_handler(do_debugger_trap_fatal);
|
||||
}
|
||||
|
||||
static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs)
|
||||
{
|
||||
alt_key_handling = !alt_key_handling;
|
||||
|
||||