slirp: Fix use after release on tcp_input
[qemu/ar7.git] / sysemu.h
blob43ff546f9b08c4501383a87416abd6a7af39ffba
1 #ifndef SYSEMU_H
2 #define SYSEMU_H
3 /* Misc. things related to the system emulator. */
5 #include "qemu-common.h"
6 #include "qemu-option.h"
7 #include "qemu-queue.h"
8 #include "qemu-timer.h"
9 #include "notify.h"
11 /* vl.c */
13 typedef enum {
14 RSTATE_NO_STATE,
15 RSTATE_DEBUG, /* qemu is running under gdb */
16 RSTATE_IN_MIGRATE, /* paused waiting for an incoming migration */
17 RSTATE_PANICKED, /* paused due to an internal error */
18 RSTATE_IO_ERROR, /* paused due to an I/O error */
19 RSTATE_PAUSED, /* paused by the user (ie. the 'stop' command) */
20 RSTATE_POST_MIGRATE, /* paused following a successful migration */
21 RSTATE_PRE_LAUNCH, /* qemu was started with -S and haven't started */
22 RSTATE_PRE_MIGRATE, /* paused preparing to finish migrate */
23 RSTATE_RESTORE, /* paused restoring the VM state */
24 RSTATE_RUNNING, /* qemu is running */
25 RSTATE_SAVEVM, /* paused saving VM state */
26 RSTATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */
27 RSTATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */
28 RSTATE_MAX
29 } RunState;
31 extern const char *bios_name;
33 extern const char *qemu_name;
34 extern uint8_t qemu_uuid[];
35 int qemu_uuid_parse(const char *str, uint8_t *uuid);
36 #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
38 void runstate_init(void);
39 bool runstate_check(RunState state);
40 void runstate_set(RunState new_state);
41 int runstate_is_running(void);
42 const char *runstate_as_string(void);
43 typedef struct vm_change_state_entry VMChangeStateEntry;
44 typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
46 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
47 void *opaque);
48 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
49 void vm_state_notify(int running, RunState state);
51 #define VMRESET_SILENT false
52 #define VMRESET_REPORT true
54 void vm_start(void);
55 void vm_stop(RunState state);
57 void qemu_system_reset_request(void);
58 void qemu_system_shutdown_request(void);
59 void qemu_system_powerdown_request(void);
60 void qemu_system_debug_request(void);
61 void qemu_system_vmstop_request(RunState reason);
62 int qemu_shutdown_requested_get(void);
63 int qemu_reset_requested_get(void);
64 int qemu_shutdown_requested(void);
65 int qemu_reset_requested(void);
66 int qemu_powerdown_requested(void);
67 void qemu_system_killed(int signal, pid_t pid);
68 void qemu_kill_report(void);
69 extern qemu_irq qemu_system_powerdown;
70 void qemu_system_reset(bool report);
72 void qemu_add_exit_notifier(Notifier *notify);
73 void qemu_remove_exit_notifier(Notifier *notify);
75 void qemu_add_machine_init_done_notifier(Notifier *notify);
77 void do_savevm(Monitor *mon, const QDict *qdict);
78 int load_vmstate(const char *name);
79 void do_delvm(Monitor *mon, const QDict *qdict);
80 void do_info_snapshots(Monitor *mon);
82 void qemu_announce_self(void);
84 int main_loop_wait(int nonblocking);
86 bool qemu_savevm_state_blocked(Monitor *mon);
87 int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
88 int shared);
89 int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
90 int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
91 void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
92 int qemu_loadvm_state(QEMUFile *f);
94 /* SLIRP */
95 void do_info_slirp(Monitor *mon);
97 typedef enum DisplayType
99 DT_DEFAULT,
100 DT_CURSES,
101 DT_SDL,
102 DT_NOGRAPHIC,
103 DT_NONE,
104 } DisplayType;
106 extern int autostart;
107 extern int bios_size;
109 typedef enum {
110 VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
111 } VGAInterfaceType;
113 extern int vga_interface_type;
114 #define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
115 #define std_vga_enabled (vga_interface_type == VGA_STD)
116 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
117 #define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
118 #define qxl_enabled (vga_interface_type == VGA_QXL)
120 extern int graphic_width;
121 extern int graphic_height;
122 extern int graphic_depth;
123 extern uint8_t irq0override;
124 extern DisplayType display_type;
125 extern const char *keyboard_layout;
126 extern int win2k_install_hack;
127 extern int rtc_td_hack;
128 extern int alt_grab;
129 extern int ctrl_grab;
130 extern int usb_enabled;
131 extern int smp_cpus;
132 extern int max_cpus;
133 extern int cursor_hide;
134 extern int graphic_rotate;
135 extern int no_quit;
136 extern int no_shutdown;
137 extern int semihosting_enabled;
138 extern int old_param;
139 extern int boot_menu;
140 extern uint8_t *boot_splash_filedata;
141 extern int boot_splash_filedata_size;
142 extern uint8_t qemu_extra_params_fw[2];
143 extern QEMUClock *rtc_clock;
145 #define MAX_NODES 64
146 extern int nb_numa_nodes;
147 extern uint64_t node_mem[MAX_NODES];
148 extern uint64_t node_cpumask[MAX_NODES];
150 #define MAX_OPTION_ROMS 16
151 typedef struct QEMUOptionRom {
152 const char *name;
153 int32_t bootindex;
154 } QEMUOptionRom;
155 extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
156 extern int nb_option_roms;
158 #define MAX_PROM_ENVS 128
159 extern const char *prom_envs[MAX_PROM_ENVS];
160 extern unsigned int nb_prom_envs;
162 /* pci-hotplug */
163 void pci_device_hot_add(Monitor *mon, const QDict *qdict);
164 void drive_hot_add(Monitor *mon, const QDict *qdict);
165 void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
167 /* pcie aer error injection */
168 void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
169 int do_pcie_aer_inejct_error(Monitor *mon,
170 const QDict *qdict, QObject **ret_data);
172 /* serial ports */
174 #define MAX_SERIAL_PORTS 4
176 extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
178 /* parallel ports */
180 #define MAX_PARALLEL_PORTS 3
182 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
184 void do_usb_add(Monitor *mon, const QDict *qdict);
185 void do_usb_del(Monitor *mon, const QDict *qdict);
186 void usb_info(Monitor *mon);
188 void rtc_change_mon_event(struct tm *tm);
190 void register_devices(void);
192 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
193 const char *suffix);
194 char *get_boot_devices_list(uint32_t *size);
195 #endif