root / sysemu.h @ df97b920
History | View | Annotate | Download (7.6 kB)
1 | 87ecb68b | pbrook | #ifndef SYSEMU_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define SYSEMU_H
|
3 | 87ecb68b | pbrook | /* Misc. things related to the system emulator. */
|
4 | 87ecb68b | pbrook | |
5 | 376253ec | aliguori | #include "qemu-common.h" |
6 | 376253ec | aliguori | |
7 | 49dc768d | aliguori | #ifdef _WIN32
|
8 | 49dc768d | aliguori | #include <windows.h> |
9 | 49dc768d | aliguori | #endif
|
10 | 49dc768d | aliguori | |
11 | 87ecb68b | pbrook | /* vl.c */
|
12 | 87ecb68b | pbrook | extern const char *bios_name; |
13 | 5cea8590 | Paul Brook | |
14 | 5cea8590 | Paul Brook | #define QEMU_FILE_TYPE_BIOS 0 |
15 | 5cea8590 | Paul Brook | #define QEMU_FILE_TYPE_KEYMAP 1 |
16 | 5cea8590 | Paul Brook | char *qemu_find_file(int type, const char *name); |
17 | 87ecb68b | pbrook | |
18 | 87ecb68b | pbrook | extern int vm_running; |
19 | 87ecb68b | pbrook | extern const char *qemu_name; |
20 | 8fcb1b90 | blueswir1 | extern uint8_t qemu_uuid[];
|
21 | c4be29ff | aliguori | int qemu_uuid_parse(const char *str, uint8_t *uuid); |
22 | 8fcb1b90 | blueswir1 | #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" |
23 | 87ecb68b | pbrook | |
24 | 87ecb68b | pbrook | typedef struct vm_change_state_entry VMChangeStateEntry; |
25 | 9781e040 | aliguori | typedef void VMChangeStateHandler(void *opaque, int running, int reason); |
26 | 87ecb68b | pbrook | |
27 | 87ecb68b | pbrook | VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, |
28 | 87ecb68b | pbrook | void *opaque);
|
29 | 87ecb68b | pbrook | void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
|
30 | 87ecb68b | pbrook | |
31 | 87ecb68b | pbrook | void vm_start(void); |
32 | 87ecb68b | pbrook | void vm_stop(int reason); |
33 | 87ecb68b | pbrook | |
34 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_remaining(void);
|
35 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_transferred(void);
|
36 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_total(void);
|
37 | 9f9e28cd | Glauber Costa | |
38 | 87ecb68b | pbrook | int64_t cpu_get_ticks(void);
|
39 | 87ecb68b | pbrook | void cpu_enable_ticks(void); |
40 | 87ecb68b | pbrook | void cpu_disable_ticks(void); |
41 | 87ecb68b | pbrook | |
42 | 87ecb68b | pbrook | void qemu_system_reset_request(void); |
43 | 87ecb68b | pbrook | void qemu_system_shutdown_request(void); |
44 | 87ecb68b | pbrook | void qemu_system_powerdown_request(void); |
45 | cf7a2fe2 | aurel32 | int qemu_shutdown_requested(void); |
46 | cf7a2fe2 | aurel32 | int qemu_reset_requested(void); |
47 | cf7a2fe2 | aurel32 | int qemu_powerdown_requested(void); |
48 | 1ad2134f | Paul Brook | #ifdef NEED_CPU_H
|
49 | cf7a2fe2 | aurel32 | #if !defined(TARGET_SPARC) && !defined(TARGET_I386)
|
50 | 87ecb68b | pbrook | // Please implement a power failure function to signal the OS
|
51 | 87ecb68b | pbrook | #define qemu_system_powerdown() do{}while(0) |
52 | 87ecb68b | pbrook | #else
|
53 | 87ecb68b | pbrook | void qemu_system_powerdown(void); |
54 | 87ecb68b | pbrook | #endif
|
55 | 1ad2134f | Paul Brook | #endif
|
56 | cf7a2fe2 | aurel32 | void qemu_system_reset(void); |
57 | 87ecb68b | pbrook | |
58 | 376253ec | aliguori | void do_savevm(Monitor *mon, const char *name); |
59 | 376253ec | aliguori | void do_loadvm(Monitor *mon, const char *name); |
60 | 376253ec | aliguori | void do_delvm(Monitor *mon, const char *name); |
61 | 376253ec | aliguori | void do_info_snapshots(Monitor *mon);
|
62 | 87ecb68b | pbrook | |
63 | 210f41ba | aliguori | void qemu_announce_self(void); |
64 | 210f41ba | aliguori | |
65 | 87ecb68b | pbrook | void main_loop_wait(int timeout); |
66 | 87ecb68b | pbrook | |
67 | 9366f418 | aliguori | int qemu_savevm_state_begin(QEMUFile *f);
|
68 | 9366f418 | aliguori | int qemu_savevm_state_iterate(QEMUFile *f);
|
69 | 9366f418 | aliguori | int qemu_savevm_state_complete(QEMUFile *f);
|
70 | 9366f418 | aliguori | int qemu_savevm_state(QEMUFile *f);
|
71 | 9366f418 | aliguori | int qemu_loadvm_state(QEMUFile *f);
|
72 | 9366f418 | aliguori | |
73 | 56f3a5d0 | aliguori | #ifdef _WIN32
|
74 | 87ecb68b | pbrook | /* Polling handling */
|
75 | 87ecb68b | pbrook | |
76 | 87ecb68b | pbrook | /* return TRUE if no sleep should be done afterwards */
|
77 | 87ecb68b | pbrook | typedef int PollingFunc(void *opaque); |
78 | 87ecb68b | pbrook | |
79 | 87ecb68b | pbrook | int qemu_add_polling_cb(PollingFunc *func, void *opaque); |
80 | 87ecb68b | pbrook | void qemu_del_polling_cb(PollingFunc *func, void *opaque); |
81 | 87ecb68b | pbrook | |
82 | 87ecb68b | pbrook | /* Wait objects handling */
|
83 | 87ecb68b | pbrook | typedef void WaitObjectFunc(void *opaque); |
84 | 87ecb68b | pbrook | |
85 | 87ecb68b | pbrook | int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
86 | 87ecb68b | pbrook | void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
87 | 87ecb68b | pbrook | #endif
|
88 | 87ecb68b | pbrook | |
89 | 87ecb68b | pbrook | /* TAP win32 */
|
90 | 7a9f6e4a | aliguori | int tap_win32_init(VLANState *vlan, const char *model, |
91 | 7a9f6e4a | aliguori | const char *name, const char *ifname); |
92 | 87ecb68b | pbrook | |
93 | 87ecb68b | pbrook | /* SLIRP */
|
94 | 376253ec | aliguori | void do_info_slirp(Monitor *mon);
|
95 | 87ecb68b | pbrook | |
96 | 993fbfdb | Anthony Liguori | typedef enum DisplayType |
97 | 993fbfdb | Anthony Liguori | { |
98 | 993fbfdb | Anthony Liguori | DT_DEFAULT, |
99 | 993fbfdb | Anthony Liguori | DT_CURSES, |
100 | 993fbfdb | Anthony Liguori | DT_SDL, |
101 | 993fbfdb | Anthony Liguori | DT_VNC, |
102 | 993fbfdb | Anthony Liguori | DT_NOGRAPHIC, |
103 | 993fbfdb | Anthony Liguori | } DisplayType; |
104 | 993fbfdb | Anthony Liguori | |
105 | 87ecb68b | pbrook | extern int bios_size; |
106 | 87ecb68b | pbrook | extern int cirrus_vga_enabled; |
107 | c2b3b41a | aliguori | extern int std_vga_enabled; |
108 | 87ecb68b | pbrook | extern int vmsvga_enabled; |
109 | 94909d9f | aliguori | extern int xenfb_enabled; |
110 | 87ecb68b | pbrook | extern int graphic_width; |
111 | 87ecb68b | pbrook | extern int graphic_height; |
112 | 87ecb68b | pbrook | extern int graphic_depth; |
113 | 993fbfdb | Anthony Liguori | extern DisplayType display_type;
|
114 | 87ecb68b | pbrook | extern const char *keyboard_layout; |
115 | 87ecb68b | pbrook | extern int win2k_install_hack; |
116 | 73822ec8 | aliguori | extern int rtc_td_hack; |
117 | 87ecb68b | pbrook | extern int alt_grab; |
118 | 87ecb68b | pbrook | extern int usb_enabled; |
119 | df97b920 | Eduardo Habkost | extern int no_virtio_balloon; |
120 | 87ecb68b | pbrook | extern int smp_cpus; |
121 | 87ecb68b | pbrook | extern int cursor_hide; |
122 | 87ecb68b | pbrook | extern int graphic_rotate; |
123 | 87ecb68b | pbrook | extern int no_quit; |
124 | 87ecb68b | pbrook | extern int semihosting_enabled; |
125 | 87ecb68b | pbrook | extern int old_param; |
126 | 87ecb68b | pbrook | |
127 | 640f42e4 | blueswir1 | #ifdef CONFIG_KQEMU
|
128 | 87ecb68b | pbrook | extern int kqemu_allowed; |
129 | 87ecb68b | pbrook | #endif
|
130 | 87ecb68b | pbrook | |
131 | 268a362c | aliguori | #define MAX_NODES 64 |
132 | 268a362c | aliguori | extern int nb_numa_nodes; |
133 | 268a362c | aliguori | extern uint64_t node_mem[MAX_NODES];
|
134 | 268a362c | aliguori | |
135 | 87ecb68b | pbrook | #define MAX_OPTION_ROMS 16 |
136 | 87ecb68b | pbrook | extern const char *option_rom[MAX_OPTION_ROMS]; |
137 | 87ecb68b | pbrook | extern int nb_option_roms; |
138 | 87ecb68b | pbrook | |
139 | 1ad2134f | Paul Brook | #ifdef NEED_CPU_H
|
140 | 95efd11c | blueswir1 | #if defined(TARGET_SPARC) || defined(TARGET_PPC)
|
141 | 87ecb68b | pbrook | #define MAX_PROM_ENVS 128 |
142 | 87ecb68b | pbrook | extern const char *prom_envs[MAX_PROM_ENVS]; |
143 | 87ecb68b | pbrook | extern unsigned int nb_prom_envs; |
144 | 87ecb68b | pbrook | #endif
|
145 | 1ad2134f | Paul Brook | #endif
|
146 | 87ecb68b | pbrook | |
147 | e4bcb14c | ths | typedef enum { |
148 | aae9460e | Paul Brook | IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, |
149 | aae9460e | Paul Brook | IF_COUNT |
150 | e4bcb14c | ths | } BlockInterfaceType; |
151 | e4bcb14c | ths | |
152 | 428c5705 | aliguori | typedef enum { |
153 | 428c5705 | aliguori | BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC, |
154 | 428c5705 | aliguori | BLOCK_ERR_STOP_ANY |
155 | 428c5705 | aliguori | } BlockInterfaceErrorAction; |
156 | 428c5705 | aliguori | |
157 | e4bcb14c | ths | typedef struct DriveInfo { |
158 | e4bcb14c | ths | BlockDriverState *bdrv; |
159 | f60d39bc | ths | BlockInterfaceType type; |
160 | e4bcb14c | ths | int bus;
|
161 | e4bcb14c | ths | int unit;
|
162 | 7d5aca9e | aliguori | int used;
|
163 | b01b1111 | aliguori | int drive_opt_idx;
|
164 | 428c5705 | aliguori | BlockInterfaceErrorAction onerror; |
165 | fa879c64 | aliguori | char serial[21]; |
166 | e4bcb14c | ths | } DriveInfo; |
167 | e4bcb14c | ths | |
168 | e4bcb14c | ths | #define MAX_IDE_DEVS 2 |
169 | e4bcb14c | ths | #define MAX_SCSI_DEVS 7 |
170 | e4bcb14c | ths | #define MAX_DRIVES 32 |
171 | e4bcb14c | ths | |
172 | 4d7a0880 | blueswir1 | extern int nb_drives; |
173 | 4d7a0880 | blueswir1 | extern DriveInfo drives_table[MAX_DRIVES+1]; |
174 | e4bcb14c | ths | |
175 | f60d39bc | ths | extern int drive_get_index(BlockInterfaceType type, int bus, int unit); |
176 | f60d39bc | ths | extern int drive_get_max_bus(BlockInterfaceType type); |
177 | b01b1111 | aliguori | extern void drive_uninit(BlockDriverState *bdrv); |
178 | b01b1111 | aliguori | extern void drive_remove(int index); |
179 | fa879c64 | aliguori | extern const char *drive_get_serial(BlockDriverState *bdrv); |
180 | 428c5705 | aliguori | extern BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv);
|
181 | 87ecb68b | pbrook | |
182 | aae9460e | Paul Brook | BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type); |
183 | aae9460e | Paul Brook | |
184 | ec691c80 | aliguori | struct drive_opt {
|
185 | ec691c80 | aliguori | const char *file; |
186 | ec691c80 | aliguori | char opt[1024]; |
187 | ec691c80 | aliguori | int used;
|
188 | ec691c80 | aliguori | }; |
189 | ec691c80 | aliguori | |
190 | ec691c80 | aliguori | extern struct drive_opt drives_opt[MAX_DRIVES]; |
191 | ec691c80 | aliguori | extern int nb_drives_opt; |
192 | ec691c80 | aliguori | |
193 | 4d73cd3b | aliguori | extern int drive_add(const char *file, const char *fmt, ...); |
194 | 4d73cd3b | aliguori | extern int drive_init(struct drive_opt *arg, int snapshot, void *machine); |
195 | 4d73cd3b | aliguori | |
196 | 5e3cb534 | aliguori | /* acpi */
|
197 | 5e3cb534 | aliguori | void qemu_system_hot_add_init(void); |
198 | ca2c72be | aliguori | void qemu_system_device_hot_add(int pcibus, int slot, int state); |
199 | 5e3cb534 | aliguori | |
200 | 6f338c34 | aliguori | /* device-hotplug */
|
201 | 6f338c34 | aliguori | |
202 | 6f338c34 | aliguori | typedef int (dev_match_fn)(void *dev_private, void *arg); |
203 | 6f338c34 | aliguori | |
204 | 6f338c34 | aliguori | int add_init_drive(const char *opts); |
205 | 6f338c34 | aliguori | void destroy_nic(dev_match_fn *match_fn, void *arg); |
206 | 6f338c34 | aliguori | void destroy_bdrvs(dev_match_fn *match_fn, void *arg); |
207 | 6f338c34 | aliguori | |
208 | 6f338c34 | aliguori | /* pci-hotplug */
|
209 | 376253ec | aliguori | void pci_device_hot_add(Monitor *mon, const char *pci_addr, const char *type, |
210 | 376253ec | aliguori | const char *opts); |
211 | 376253ec | aliguori | void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts); |
212 | 376253ec | aliguori | void pci_device_hot_remove(Monitor *mon, const char *pci_addr); |
213 | 6f338c34 | aliguori | void pci_device_hot_remove_success(int pcibus, int slot); |
214 | 6f338c34 | aliguori | |
215 | 87ecb68b | pbrook | /* serial ports */
|
216 | 87ecb68b | pbrook | |
217 | 87ecb68b | pbrook | #define MAX_SERIAL_PORTS 4 |
218 | 87ecb68b | pbrook | |
219 | 87ecb68b | pbrook | extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
|
220 | 87ecb68b | pbrook | |
221 | 87ecb68b | pbrook | /* parallel ports */
|
222 | 87ecb68b | pbrook | |
223 | 87ecb68b | pbrook | #define MAX_PARALLEL_PORTS 3 |
224 | 87ecb68b | pbrook | |
225 | 87ecb68b | pbrook | extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
|
226 | 87ecb68b | pbrook | |
227 | 9ede2fde | aliguori | /* virtio consoles */
|
228 | 9ede2fde | aliguori | |
229 | 9ede2fde | aliguori | #define MAX_VIRTIO_CONSOLES 1 |
230 | 9ede2fde | aliguori | |
231 | 9ede2fde | aliguori | extern CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
|
232 | 9ede2fde | aliguori | |
233 | 0e82f34d | aliguori | #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) |
234 | 0e82f34d | aliguori | |
235 | 87ecb68b | pbrook | #ifdef NEED_CPU_H
|
236 | 87ecb68b | pbrook | /* loader.c */
|
237 | 87ecb68b | pbrook | int get_image_size(const char *filename); |
238 | 293f78bc | blueswir1 | int load_image(const char *filename, uint8_t *addr); /* deprecated */ |
239 | 293f78bc | blueswir1 | int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz); |
240 | 83c1f87c | pbrook | int load_elf(const char *filename, int64_t address_offset, |
241 | 87ecb68b | pbrook | uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr); |
242 | 293f78bc | blueswir1 | int load_aout(const char *filename, target_phys_addr_t addr, int max_sz); |
243 | 5a9154e0 | aliguori | int load_uimage(const char *filename, target_ulong *ep, target_ulong *loadaddr, |
244 | 5a9154e0 | aliguori | int *is_linux);
|
245 | 293f78bc | blueswir1 | |
246 | 293f78bc | blueswir1 | int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
|
247 | 293f78bc | blueswir1 | int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
|
248 | 293f78bc | blueswir1 | int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes); |
249 | 293f78bc | blueswir1 | void pstrcpy_targphys(target_phys_addr_t dest, int buf_size, |
250 | 293f78bc | blueswir1 | const char *source); |
251 | 87ecb68b | pbrook | #endif
|
252 | 87ecb68b | pbrook | |
253 | 87ecb68b | pbrook | #ifdef HAS_AUDIO
|
254 | 87ecb68b | pbrook | struct soundhw {
|
255 | 87ecb68b | pbrook | const char *name; |
256 | 87ecb68b | pbrook | const char *descr; |
257 | 87ecb68b | pbrook | int enabled;
|
258 | 87ecb68b | pbrook | int isa;
|
259 | 87ecb68b | pbrook | union {
|
260 | 22d83b14 | Paul Brook | int (*init_isa) (qemu_irq *pic);
|
261 | 22d83b14 | Paul Brook | int (*init_pci) (PCIBus *bus);
|
262 | 87ecb68b | pbrook | } init; |
263 | 87ecb68b | pbrook | }; |
264 | 87ecb68b | pbrook | |
265 | 87ecb68b | pbrook | extern struct soundhw soundhw[]; |
266 | 87ecb68b | pbrook | #endif
|
267 | 87ecb68b | pbrook | |
268 | 376253ec | aliguori | void do_usb_add(Monitor *mon, const char *devname); |
269 | 376253ec | aliguori | void do_usb_del(Monitor *mon, const char *devname); |
270 | 376253ec | aliguori | void usb_info(Monitor *mon);
|
271 | 87ecb68b | pbrook | |
272 | 63a01ef8 | aliguori | int get_param_value(char *buf, int buf_size, |
273 | 63a01ef8 | aliguori | const char *tag, const char *str); |
274 | 0aa7a205 | Jan Kiszka | int check_params(char *buf, int buf_size, |
275 | 0aa7a205 | Jan Kiszka | const char * const *params, const char *str); |
276 | 63a01ef8 | aliguori | |
277 | aae9460e | Paul Brook | void register_devices(void); |
278 | aae9460e | Paul Brook | |
279 | 87ecb68b | pbrook | #endif |