From: Jan Kiszka <jan.kiszka@web.de>
To: Andi Kleen <andi@firstfloor.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/3] x86: Introduce CPU_INTERRUPT_NMI
Date: Mon, 14 Apr 2008 18:38:00 +0200 [thread overview]
Message-ID: <48038868.8010703@web.de> (raw)
In-Reply-To: <48038397.6060202@firstfloor.org>
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 <jan.kiszka@web.de>
---
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, },
};
prev parent reply other threads:[~2008-04-14 16:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-12 16:12 [Qemu-devel] [PATCH 1/3] x86: Introduce CPU_INTERRUPT_NMI Jan Kiszka
2008-04-12 16:48 ` [Qemu-devel] " Jan Kiszka
2008-04-14 10:16 ` Andi Kleen
2008-04-14 16:13 ` Jan Kiszka
2008-04-14 16:17 ` Andi Kleen
2008-04-14 16:38 ` Jan Kiszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48038868.8010703@web.de \
--to=jan.kiszka@web.de \
--cc=andi@firstfloor.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).