[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 1/3] x86: Introduce CPU_INTERRUPT_NMI
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] Re: [PATCH 1/3] x86: Introduce CPU_INTERRUPT_NMI |
Date: |
Mon, 14 Apr 2008 18:38:00 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080226) |
Andi Kleen wrote:
>>> Could you please add a monitor command to raise it too? Some OS support
>>> triggering debugging code from NMIs and that might be useful
>>> inside qemu too.
>> Will it be enough just the raise the NMI?
>
> Yes that's enough.
>
>> Or doesn't you also have to
>> modify some hardware state somewhere?
>
> Not needed.
>
>> Maybe you could provide an example
>> for what you have in mind (it's trivial to hack such an extension, I'm
>> just curious to understand its background).
>
> Basically it would emulate an NMI button which can be found on some systems.
I see. Here is the patch. Works as expected for me.
Signed-off-by: Jan Kiszka <address@hidden>
---
monitor.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
Index: b/monitor.c
===================================================================
--- a/monitor.c
+++ b/monitor.c
@@ -1283,6 +1283,19 @@ static void do_wav_capture (const char *
}
#endif
+#if defined(TARGET_I386)
+static void do_inject_nmi(int cpu_index)
+{
+ CPUState *env;
+
+ for (env = first_cpu; env != NULL; env = env->next_cpu)
+ if (env->cpu_index == cpu_index) {
+ cpu_interrupt(env, CPU_INTERRUPT_NMI);
+ break;
+ }
+}
+#endif
+
static term_cmd_t term_cmds[] = {
{ "help|?", "s?", do_help,
"[cmd]", "show the help" },
@@ -1356,6 +1369,10 @@ static term_cmd_t term_cmds[] = {
"addr size file", "save to disk virtual memory dump starting at 'addr'
of size 'size'", },
{ "pmemsave", "lis", do_physical_memory_save,
"addr size file", "save to disk physical memory dump starting at 'addr'
of size 'size'", },
+#if defined(TARGET_I386)
+ { "nmi", "i", do_inject_nmi,
+ "cpu", "inject an NMI on the given CPU", },
+#endif
{ NULL, NULL, },
};