root / sysemu.h @ 1eec614b
History | View | Annotate | Download (6.1 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 | 87ecb68b | pbrook | /* vl.c */
|
6 | 87ecb68b | pbrook | extern const char *bios_name; |
7 | 87ecb68b | pbrook | extern const char *bios_dir; |
8 | 87ecb68b | pbrook | |
9 | 87ecb68b | pbrook | extern int vm_running; |
10 | 87ecb68b | pbrook | extern const char *qemu_name; |
11 | 8fcb1b90 | blueswir1 | extern uint8_t qemu_uuid[];
|
12 | 8fcb1b90 | blueswir1 | #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" |
13 | 87ecb68b | pbrook | |
14 | 87ecb68b | pbrook | typedef struct vm_change_state_entry VMChangeStateEntry; |
15 | 9781e040 | aliguori | typedef void VMChangeStateHandler(void *opaque, int running, int reason); |
16 | 87ecb68b | pbrook | |
17 | 87ecb68b | pbrook | VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, |
18 | 87ecb68b | pbrook | void *opaque);
|
19 | 87ecb68b | pbrook | void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
|
20 | 87ecb68b | pbrook | |
21 | 87ecb68b | pbrook | void vm_start(void); |
22 | 87ecb68b | pbrook | void vm_stop(int reason); |
23 | 87ecb68b | pbrook | |
24 | 87ecb68b | pbrook | int64_t cpu_get_ticks(void);
|
25 | 87ecb68b | pbrook | void cpu_enable_ticks(void); |
26 | 87ecb68b | pbrook | void cpu_disable_ticks(void); |
27 | 87ecb68b | pbrook | |
28 | 87ecb68b | pbrook | void qemu_system_reset_request(void); |
29 | 87ecb68b | pbrook | void qemu_system_shutdown_request(void); |
30 | 87ecb68b | pbrook | void qemu_system_powerdown_request(void); |
31 | cf7a2fe2 | aurel32 | int qemu_shutdown_requested(void); |
32 | cf7a2fe2 | aurel32 | int qemu_reset_requested(void); |
33 | cf7a2fe2 | aurel32 | int qemu_powerdown_requested(void); |
34 | cf7a2fe2 | aurel32 | #if !defined(TARGET_SPARC) && !defined(TARGET_I386)
|
35 | 87ecb68b | pbrook | // Please implement a power failure function to signal the OS
|
36 | 87ecb68b | pbrook | #define qemu_system_powerdown() do{}while(0) |
37 | 87ecb68b | pbrook | #else
|
38 | 87ecb68b | pbrook | void qemu_system_powerdown(void); |
39 | 87ecb68b | pbrook | #endif
|
40 | cf7a2fe2 | aurel32 | void qemu_system_reset(void); |
41 | 87ecb68b | pbrook | |
42 | 87ecb68b | pbrook | void do_savevm(const char *name); |
43 | 87ecb68b | pbrook | void do_loadvm(const char *name); |
44 | 87ecb68b | pbrook | void do_delvm(const char *name); |
45 | 87ecb68b | pbrook | void do_info_snapshots(void); |
46 | 87ecb68b | pbrook | |
47 | 210f41ba | aliguori | void qemu_announce_self(void); |
48 | 210f41ba | aliguori | |
49 | 87ecb68b | pbrook | void main_loop_wait(int timeout); |
50 | 87ecb68b | pbrook | |
51 | 9366f418 | aliguori | int qemu_savevm_state_begin(QEMUFile *f);
|
52 | 9366f418 | aliguori | int qemu_savevm_state_iterate(QEMUFile *f);
|
53 | 9366f418 | aliguori | int qemu_savevm_state_complete(QEMUFile *f);
|
54 | 9366f418 | aliguori | int qemu_savevm_state(QEMUFile *f);
|
55 | 9366f418 | aliguori | int qemu_loadvm_state(QEMUFile *f);
|
56 | 9366f418 | aliguori | |
57 | 56f3a5d0 | aliguori | #ifdef _WIN32
|
58 | 87ecb68b | pbrook | /* Polling handling */
|
59 | 87ecb68b | pbrook | |
60 | 87ecb68b | pbrook | /* return TRUE if no sleep should be done afterwards */
|
61 | 87ecb68b | pbrook | typedef int PollingFunc(void *opaque); |
62 | 87ecb68b | pbrook | |
63 | 87ecb68b | pbrook | int qemu_add_polling_cb(PollingFunc *func, void *opaque); |
64 | 87ecb68b | pbrook | void qemu_del_polling_cb(PollingFunc *func, void *opaque); |
65 | 87ecb68b | pbrook | |
66 | 87ecb68b | pbrook | /* Wait objects handling */
|
67 | 87ecb68b | pbrook | typedef void WaitObjectFunc(void *opaque); |
68 | 87ecb68b | pbrook | |
69 | 87ecb68b | pbrook | int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
70 | 87ecb68b | pbrook | void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
71 | 87ecb68b | pbrook | #endif
|
72 | 87ecb68b | pbrook | |
73 | 87ecb68b | pbrook | /* TAP win32 */
|
74 | 7a9f6e4a | aliguori | int tap_win32_init(VLANState *vlan, const char *model, |
75 | 7a9f6e4a | aliguori | const char *name, const char *ifname); |
76 | 87ecb68b | pbrook | |
77 | 87ecb68b | pbrook | /* SLIRP */
|
78 | 87ecb68b | pbrook | void do_info_slirp(void); |
79 | 87ecb68b | pbrook | |
80 | 87ecb68b | pbrook | extern int bios_size; |
81 | 87ecb68b | pbrook | extern int cirrus_vga_enabled; |
82 | c2b3b41a | aliguori | extern int std_vga_enabled; |
83 | 87ecb68b | pbrook | extern int vmsvga_enabled; |
84 | 87ecb68b | pbrook | extern int graphic_width; |
85 | 87ecb68b | pbrook | extern int graphic_height; |
86 | 87ecb68b | pbrook | extern int graphic_depth; |
87 | 2bfdab63 | blueswir1 | extern int nographic; |
88 | 87ecb68b | pbrook | extern const char *keyboard_layout; |
89 | 87ecb68b | pbrook | extern int win2k_install_hack; |
90 | 73822ec8 | aliguori | extern int rtc_td_hack; |
91 | 87ecb68b | pbrook | extern int alt_grab; |
92 | 87ecb68b | pbrook | extern int usb_enabled; |
93 | 87ecb68b | pbrook | extern int smp_cpus; |
94 | 87ecb68b | pbrook | extern int cursor_hide; |
95 | 87ecb68b | pbrook | extern int graphic_rotate; |
96 | 87ecb68b | pbrook | extern int no_quit; |
97 | 87ecb68b | pbrook | extern int semihosting_enabled; |
98 | 87ecb68b | pbrook | extern int old_param; |
99 | 87ecb68b | pbrook | extern const char *bootp_filename; |
100 | 87ecb68b | pbrook | |
101 | 87ecb68b | pbrook | #ifdef USE_KQEMU
|
102 | 87ecb68b | pbrook | extern int kqemu_allowed; |
103 | 87ecb68b | pbrook | #endif
|
104 | 87ecb68b | pbrook | |
105 | 87ecb68b | pbrook | #define MAX_OPTION_ROMS 16 |
106 | 87ecb68b | pbrook | extern const char *option_rom[MAX_OPTION_ROMS]; |
107 | 87ecb68b | pbrook | extern int nb_option_roms; |
108 | 87ecb68b | pbrook | |
109 | 95efd11c | blueswir1 | #if defined(TARGET_SPARC) || defined(TARGET_PPC)
|
110 | 87ecb68b | pbrook | #define MAX_PROM_ENVS 128 |
111 | 87ecb68b | pbrook | extern const char *prom_envs[MAX_PROM_ENVS]; |
112 | 87ecb68b | pbrook | extern unsigned int nb_prom_envs; |
113 | 87ecb68b | pbrook | #endif
|
114 | 87ecb68b | pbrook | |
115 | 87ecb68b | pbrook | #if defined (TARGET_PPC)
|
116 | 87ecb68b | pbrook | #define BIOS_SIZE (1024 * 1024) |
117 | 87ecb68b | pbrook | #elif defined (TARGET_SPARC64)
|
118 | 87ecb68b | pbrook | #define BIOS_SIZE ((512 + 32) * 1024) |
119 | 87ecb68b | pbrook | #elif defined(TARGET_MIPS)
|
120 | 87ecb68b | pbrook | #define BIOS_SIZE (4 * 1024 * 1024) |
121 | 87ecb68b | pbrook | #endif
|
122 | 87ecb68b | pbrook | |
123 | e4bcb14c | ths | typedef enum { |
124 | 6e02c38d | aliguori | IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO |
125 | e4bcb14c | ths | } BlockInterfaceType; |
126 | e4bcb14c | ths | |
127 | 428c5705 | aliguori | typedef enum { |
128 | 428c5705 | aliguori | BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC, |
129 | 428c5705 | aliguori | BLOCK_ERR_STOP_ANY |
130 | 428c5705 | aliguori | } BlockInterfaceErrorAction; |
131 | 428c5705 | aliguori | |
132 | e4bcb14c | ths | typedef struct DriveInfo { |
133 | e4bcb14c | ths | BlockDriverState *bdrv; |
134 | f60d39bc | ths | BlockInterfaceType type; |
135 | e4bcb14c | ths | int bus;
|
136 | e4bcb14c | ths | int unit;
|
137 | 428c5705 | aliguori | BlockInterfaceErrorAction onerror; |
138 | fa879c64 | aliguori | char serial[21]; |
139 | e4bcb14c | ths | } DriveInfo; |
140 | e4bcb14c | ths | |
141 | e4bcb14c | ths | #define MAX_IDE_DEVS 2 |
142 | e4bcb14c | ths | #define MAX_SCSI_DEVS 7 |
143 | e4bcb14c | ths | #define MAX_DRIVES 32 |
144 | e4bcb14c | ths | |
145 | 4d7a0880 | blueswir1 | extern int nb_drives; |
146 | 4d7a0880 | blueswir1 | extern DriveInfo drives_table[MAX_DRIVES+1]; |
147 | e4bcb14c | ths | |
148 | f60d39bc | ths | extern int drive_get_index(BlockInterfaceType type, int bus, int unit); |
149 | f60d39bc | ths | extern int drive_get_max_bus(BlockInterfaceType type); |
150 | fa879c64 | aliguori | extern const char *drive_get_serial(BlockDriverState *bdrv); |
151 | 428c5705 | aliguori | extern BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv);
|
152 | 87ecb68b | pbrook | |
153 | 87ecb68b | pbrook | /* serial ports */
|
154 | 87ecb68b | pbrook | |
155 | 87ecb68b | pbrook | #define MAX_SERIAL_PORTS 4 |
156 | 87ecb68b | pbrook | |
157 | 87ecb68b | pbrook | extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
|
158 | 87ecb68b | pbrook | |
159 | 87ecb68b | pbrook | /* parallel ports */
|
160 | 87ecb68b | pbrook | |
161 | 87ecb68b | pbrook | #define MAX_PARALLEL_PORTS 3 |
162 | 87ecb68b | pbrook | |
163 | 87ecb68b | pbrook | extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
|
164 | 87ecb68b | pbrook | |
165 | 9ede2fde | aliguori | /* virtio consoles */
|
166 | 9ede2fde | aliguori | |
167 | 9ede2fde | aliguori | #define MAX_VIRTIO_CONSOLES 1 |
168 | 9ede2fde | aliguori | |
169 | 9ede2fde | aliguori | extern CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
|
170 | 9ede2fde | aliguori | |
171 | 0e82f34d | aliguori | #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) |
172 | 0e82f34d | aliguori | |
173 | 87ecb68b | pbrook | #ifdef NEED_CPU_H
|
174 | 87ecb68b | pbrook | /* loader.c */
|
175 | 87ecb68b | pbrook | int get_image_size(const char *filename); |
176 | 293f78bc | blueswir1 | int load_image(const char *filename, uint8_t *addr); /* deprecated */ |
177 | 293f78bc | blueswir1 | int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz); |
178 | 83c1f87c | pbrook | int load_elf(const char *filename, int64_t address_offset, |
179 | 87ecb68b | pbrook | uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr); |
180 | 293f78bc | blueswir1 | int load_aout(const char *filename, target_phys_addr_t addr, int max_sz); |
181 | 5a9154e0 | aliguori | int load_uimage(const char *filename, target_ulong *ep, target_ulong *loadaddr, |
182 | 5a9154e0 | aliguori | int *is_linux);
|
183 | 293f78bc | blueswir1 | |
184 | 293f78bc | blueswir1 | int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
|
185 | 293f78bc | blueswir1 | int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
|
186 | 293f78bc | blueswir1 | int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes); |
187 | 293f78bc | blueswir1 | void pstrcpy_targphys(target_phys_addr_t dest, int buf_size, |
188 | 293f78bc | blueswir1 | const char *source); |
189 | 87ecb68b | pbrook | #endif
|
190 | 87ecb68b | pbrook | |
191 | 87ecb68b | pbrook | #ifdef HAS_AUDIO
|
192 | 87ecb68b | pbrook | struct soundhw {
|
193 | 87ecb68b | pbrook | const char *name; |
194 | 87ecb68b | pbrook | const char *descr; |
195 | 87ecb68b | pbrook | int enabled;
|
196 | 87ecb68b | pbrook | int isa;
|
197 | 87ecb68b | pbrook | union {
|
198 | 87ecb68b | pbrook | int (*init_isa) (AudioState *s, qemu_irq *pic);
|
199 | 87ecb68b | pbrook | int (*init_pci) (PCIBus *bus, AudioState *s);
|
200 | 87ecb68b | pbrook | } init; |
201 | 87ecb68b | pbrook | }; |
202 | 87ecb68b | pbrook | |
203 | 87ecb68b | pbrook | extern struct soundhw soundhw[]; |
204 | 87ecb68b | pbrook | #endif
|
205 | 87ecb68b | pbrook | |
206 | 87ecb68b | pbrook | void do_usb_add(const char *devname); |
207 | 87ecb68b | pbrook | void do_usb_del(const char *devname); |
208 | 87ecb68b | pbrook | void usb_info(void); |
209 | 87ecb68b | pbrook | |
210 | 63a01ef8 | aliguori | const char *get_opt_name(char *buf, int buf_size, const char *p); |
211 | 63a01ef8 | aliguori | const char *get_opt_value(char *buf, int buf_size, const char *p); |
212 | 63a01ef8 | aliguori | int get_param_value(char *buf, int buf_size, |
213 | 63a01ef8 | aliguori | const char *tag, const char *str); |
214 | 63a01ef8 | aliguori | int check_params(char *buf, int buf_size, |
215 | 63a01ef8 | aliguori | const char * const *params, const char *str); |
216 | 63a01ef8 | aliguori | |
217 | 87ecb68b | pbrook | #endif |