nmi.c (38a01e55d268aeba68c84eea425252e7f810feaf) nmi.c (f9a535e089abcbc7ac99db83c8c6e4644e395b12)
1/*
2 * NMI monitor handler class and helpers.
3 *
4 * Copyright IBM Corp., 2014
5 *
6 * Author: Alexey Kardashevskiy <aik@ozlabs.ru>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 7 unchanged lines hidden (view full) ---

16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "hw/nmi.h"
23#include "qapi/qmp/qerror.h"
1/*
2 * NMI monitor handler class and helpers.
3 *
4 * Copyright IBM Corp., 2014
5 *
6 * Author: Alexey Kardashevskiy <aik@ozlabs.ru>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 7 unchanged lines hidden (view full) ---

16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "hw/nmi.h"
23#include "qapi/qmp/qerror.h"
24#include "monitor/monitor.h"
24
25struct do_nmi_s {
26 int cpu_index;
27 Error *errp;
28 bool handled;
29};
30
31static void nmi_children(Object *o, struct do_nmi_s *ns);

--- 33 unchanged lines hidden (view full) ---

65 nmi_children(object_get_root(), &ns);
66 if (ns.handled) {
67 error_propagate(errp, ns.errp);
68 } else {
69 error_set(errp, QERR_UNSUPPORTED);
70 }
71}
72
25
26struct do_nmi_s {
27 int cpu_index;
28 Error *errp;
29 bool handled;
30};
31
32static void nmi_children(Object *o, struct do_nmi_s *ns);

--- 33 unchanged lines hidden (view full) ---

66 nmi_children(object_get_root(), &ns);
67 if (ns.handled) {
68 error_propagate(errp, ns.errp);
69 } else {
70 error_set(errp, QERR_UNSUPPORTED);
71 }
72}
73
74void inject_nmi(void)
75{
76#if defined(TARGET_I386)
77 CPUState *cs;
78
79 CPU_FOREACH(cs) {
80 X86CPU *cpu = X86_CPU(cs);
81
82 if (!cpu->apic_state) {
83 cpu_interrupt(cs, CPU_INTERRUPT_NMI);
84 } else {
85 apic_deliver_nmi(cpu->apic_state);
86 }
87 }
88#else
89 nmi_monitor_handle(0, NULL);
90#endif
91}
92
73static const TypeInfo nmi_info = {
74 .name = TYPE_NMI,
75 .parent = TYPE_INTERFACE,
76 .class_size = sizeof(NMIClass),
77};
78
79static void nmi_register_types(void)
80{
81 type_register_static(&nmi_info);
82}
83
84type_init(nmi_register_types)
93static const TypeInfo nmi_info = {
94 .name = TYPE_NMI,
95 .parent = TYPE_INTERFACE,
96 .class_size = sizeof(NMIClass),
97};
98
99static void nmi_register_types(void)
100{
101 type_register_static(&nmi_info);
102}
103
104type_init(nmi_register_types)