]> git.proxmox.com Git - mirror_qemu.git/blame - sysemu.h
protect exec-all.h frm multiple inclusion (Glauber Costa)
[mirror_qemu.git] / sysemu.h
CommitLineData
87ecb68b
PB
1#ifndef SYSEMU_H
2#define SYSEMU_H
3/* Misc. things related to the system emulator. */
4
5/* vl.c */
6extern const char *bios_name;
7extern const char *bios_dir;
8
9extern int vm_running;
10extern const char *qemu_name;
8fcb1b90
BS
11extern uint8_t qemu_uuid[];
12#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
87ecb68b
PB
13
14typedef struct vm_change_state_entry VMChangeStateEntry;
15typedef void VMChangeStateHandler(void *opaque, int running);
16typedef void VMStopHandler(void *opaque, int reason);
17
18VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
19 void *opaque);
20void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
21
22int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque);
23void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque);
24
25void vm_start(void);
26void vm_stop(int reason);
27
28int64_t cpu_get_ticks(void);
29void cpu_enable_ticks(void);
30void cpu_disable_ticks(void);
31
32void qemu_system_reset_request(void);
33void qemu_system_shutdown_request(void);
34void qemu_system_powerdown_request(void);
cf7a2fe2
AJ
35int qemu_shutdown_requested(void);
36int qemu_reset_requested(void);
37int qemu_powerdown_requested(void);
38#if !defined(TARGET_SPARC) && !defined(TARGET_I386)
87ecb68b
PB
39// Please implement a power failure function to signal the OS
40#define qemu_system_powerdown() do{}while(0)
41#else
42void qemu_system_powerdown(void);
43#endif
cf7a2fe2 44void qemu_system_reset(void);
87ecb68b 45
87ecb68b
PB
46void do_savevm(const char *name);
47void do_loadvm(const char *name);
48void do_delvm(const char *name);
49void do_info_snapshots(void);
50
210f41ba
AL
51void qemu_announce_self(void);
52
87ecb68b
PB
53void main_loop_wait(int timeout);
54
9366f418
AL
55int qemu_savevm_state_begin(QEMUFile *f);
56int qemu_savevm_state_iterate(QEMUFile *f);
57int qemu_savevm_state_complete(QEMUFile *f);
58int qemu_savevm_state(QEMUFile *f);
59int qemu_loadvm_state(QEMUFile *f);
60
87ecb68b
PB
61/* Polling handling */
62
63/* return TRUE if no sleep should be done afterwards */
64typedef int PollingFunc(void *opaque);
65
66int qemu_add_polling_cb(PollingFunc *func, void *opaque);
67void qemu_del_polling_cb(PollingFunc *func, void *opaque);
68
69#ifdef _WIN32
70/* Wait objects handling */
71typedef void WaitObjectFunc(void *opaque);
72
73int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
74void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
75#endif
76
77/* TAP win32 */
78int tap_win32_init(VLANState *vlan, const char *ifname);
79
80/* SLIRP */
81void do_info_slirp(void);
82
87ecb68b 83extern int bios_size;
87ecb68b
PB
84extern int cirrus_vga_enabled;
85extern int vmsvga_enabled;
86extern int graphic_width;
87extern int graphic_height;
88extern int graphic_depth;
2bfdab63 89extern int nographic;
87ecb68b
PB
90extern const char *keyboard_layout;
91extern int win2k_install_hack;
92extern int alt_grab;
93extern int usb_enabled;
94extern int smp_cpus;
95extern int cursor_hide;
96extern int graphic_rotate;
97extern int no_quit;
98extern int semihosting_enabled;
87ecb68b
PB
99extern int old_param;
100extern const char *bootp_filename;
101
102
103#ifdef USE_KQEMU
104extern int kqemu_allowed;
105#endif
106
107#define MAX_OPTION_ROMS 16
108extern const char *option_rom[MAX_OPTION_ROMS];
109extern int nb_option_roms;
110
111#ifdef TARGET_SPARC
112#define MAX_PROM_ENVS 128
113extern const char *prom_envs[MAX_PROM_ENVS];
114extern unsigned int nb_prom_envs;
115#endif
116
87ecb68b
PB
117#if defined (TARGET_PPC)
118#define BIOS_SIZE (1024 * 1024)
119#elif defined (TARGET_SPARC64)
120#define BIOS_SIZE ((512 + 32) * 1024)
121#elif defined(TARGET_MIPS)
122#define BIOS_SIZE (4 * 1024 * 1024)
123#endif
124
e4bcb14c
TS
125typedef enum {
126 IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD
127} BlockInterfaceType;
128
129typedef struct DriveInfo {
130 BlockDriverState *bdrv;
f60d39bc 131 BlockInterfaceType type;
e4bcb14c
TS
132 int bus;
133 int unit;
134} DriveInfo;
135
136#define MAX_IDE_DEVS 2
137#define MAX_SCSI_DEVS 7
138#define MAX_DRIVES 32
139
4d7a0880
BS
140extern int nb_drives;
141extern DriveInfo drives_table[MAX_DRIVES+1];
e4bcb14c 142
f60d39bc
TS
143extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
144extern int drive_get_max_bus(BlockInterfaceType type);
87ecb68b
PB
145
146/* serial ports */
147
148#define MAX_SERIAL_PORTS 4
149
150extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
151
152/* parallel ports */
153
154#define MAX_PARALLEL_PORTS 3
155
156extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
157
158#ifdef NEED_CPU_H
159/* loader.c */
160int get_image_size(const char *filename);
293f78bc
BS
161int load_image(const char *filename, uint8_t *addr); /* deprecated */
162int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
83c1f87c 163int load_elf(const char *filename, int64_t address_offset,
87ecb68b 164 uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr);
293f78bc 165int load_aout(const char *filename, target_phys_addr_t addr, int max_sz);
87ecb68b 166int load_uboot(const char *filename, target_ulong *ep, int *is_linux);
293f78bc
BS
167
168int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
169int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
170int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes);
171void pstrcpy_targphys(target_phys_addr_t dest, int buf_size,
172 const char *source);
87ecb68b
PB
173#endif
174
175#ifdef HAS_AUDIO
176struct soundhw {
177 const char *name;
178 const char *descr;
179 int enabled;
180 int isa;
181 union {
182 int (*init_isa) (AudioState *s, qemu_irq *pic);
183 int (*init_pci) (PCIBus *bus, AudioState *s);
184 } init;
185};
186
187extern struct soundhw soundhw[];
188#endif
189
190void do_usb_add(const char *devname);
191void do_usb_del(const char *devname);
192void usb_info(void);
193
194#endif