Replace all setjmp()/longjmp() with sigsetjmp()/siglongjmp()
[qemu/pbrook.git] / hw / debugexit.c
blobc1b489ddcb81ff19165fb84324e68f6181ead71a
1 /*
2 * debug exit port emulation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) any later version.
8 */
10 #include "hw.h"
11 #include "isa.h"
13 #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
14 #define ISA_DEBUG_EXIT_DEVICE(obj) \
15 OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
17 typedef struct ISADebugExitState {
18 ISADevice parent_obj;
20 uint32_t iobase;
21 uint32_t iosize;
22 MemoryRegion io;
23 } ISADebugExitState;
25 static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
26 unsigned width)
28 exit((val << 1) | 1);
31 static const MemoryRegionOps debug_exit_ops = {
32 .write = debug_exit_write,
33 .valid.min_access_size = 1,
34 .valid.max_access_size = 4,
35 .endianness = DEVICE_LITTLE_ENDIAN,
38 static int debug_exit_initfn(ISADevice *dev)
40 ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
42 memory_region_init_io(&isa->io, &debug_exit_ops, isa,
43 TYPE_ISA_DEBUG_EXIT_DEVICE, isa->iosize);
44 memory_region_add_subregion(isa_address_space_io(dev),
45 isa->iobase, &isa->io);
46 return 0;
49 static Property debug_exit_properties[] = {
50 DEFINE_PROP_HEX32("iobase", ISADebugExitState, iobase, 0x501),
51 DEFINE_PROP_HEX32("iosize", ISADebugExitState, iosize, 0x02),
52 DEFINE_PROP_END_OF_LIST(),
55 static void debug_exit_class_initfn(ObjectClass *klass, void *data)
57 DeviceClass *dc = DEVICE_CLASS(klass);
58 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
59 ic->init = debug_exit_initfn;
60 dc->props = debug_exit_properties;
63 static const TypeInfo debug_exit_info = {
64 .name = TYPE_ISA_DEBUG_EXIT_DEVICE,
65 .parent = TYPE_ISA_DEVICE,
66 .instance_size = sizeof(ISADebugExitState),
67 .class_init = debug_exit_class_initfn,
70 static void debug_exit_register_types(void)
72 type_register_static(&debug_exit_info);
75 type_init(debug_exit_register_types)