From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JlRh2-0005sa-Ao for qemu-devel@nongnu.org; Mon, 14 Apr 2008 12:38:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JlRgx-0005iG-KO for qemu-devel@nongnu.org; Mon, 14 Apr 2008 12:38:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JlRgx-0005hv-7z for qemu-devel@nongnu.org; Mon, 14 Apr 2008 12:38:03 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JlRgw-0008W5-Lb for qemu-devel@nongnu.org; Mon, 14 Apr 2008 12:38:02 -0400 Message-ID: <48038868.8010703@web.de> Date: Mon, 14 Apr 2008 18:38:00 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4800DF6A.5010700@web.de> <87zlrwvj00.fsf@basil.nowhere.org> <480382AA.8060004@web.de> <48038397.6060202@firstfloor.org> In-Reply-To: <48038397.6060202@firstfloor.org> Content-Type: text/plain; charset=ISO-8859-1 Sender: jan.kiszka@web.de Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH 1/3] x86: Introduce CPU_INTERRUPT_NMI Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andi Kleen Cc: qemu-devel@nongnu.org Andi Kleen wrote: >>> Could you please add a monitor command to raise it too? Some OS suppo= rt >>> triggering debugging code from NMIs and that might be useful >>> inside qemu too. >> Will it be enough just the raise the NMI?=20 >=20 > Yes that's enough. >=20 >> Or doesn't you also have to >> modify some hardware state somewhere? >=20 > Not needed. >=20 >> 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). >=20 > Basically it would emulate an NMI button which can be found on some sys= tems. I see. Here is the patch. Works as expected for me. Signed-off-by: Jan Kiszka --- monitor.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) Index: b/monitor.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/monitor.c +++ b/monitor.c @@ -1283,6 +1283,19 @@ static void do_wav_capture (const char * } #endif =20 +#if defined(TARGET_I386) +static void do_inject_nmi(int cpu_index) +{ + CPUState *env; + + for (env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) + if (env->cpu_index =3D=3D cpu_index) { + cpu_interrupt(env, CPU_INTERRUPT_NMI); + break; + } +} +#endif + static term_cmd_t term_cmds[] =3D { { "help|?", "s?", do_help, "[cmd]", "show the help" }, @@ -1356,6 +1369,10 @@ static term_cmd_t term_cmds[] =3D { "addr size file", "save to disk virtual memory dump starting at 'a= ddr' 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, }, }; =20