]> git.proxmox.com Git - qemu.git/blame - sysemu.h
Use qemu-log.h
[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
51void main_loop_wait(int timeout);
52
53/* Polling handling */
54
55/* return TRUE if no sleep should be done afterwards */
56typedef int PollingFunc(void *opaque);
57
58int qemu_add_polling_cb(PollingFunc *func, void *opaque);
59void qemu_del_polling_cb(PollingFunc *func, void *opaque);
60
61#ifdef _WIN32
62/* Wait objects handling */
63typedef void WaitObjectFunc(void *opaque);
64
65int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
66void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
67#endif
68
69/* TAP win32 */
70int tap_win32_init(VLANState *vlan, const char *ifname);
71
72/* SLIRP */
73void do_info_slirp(void);
74
87ecb68b 75extern int bios_size;
87ecb68b
PB
76extern int cirrus_vga_enabled;
77extern int vmsvga_enabled;
78extern int graphic_width;
79extern int graphic_height;
80extern int graphic_depth;
81extern const char *keyboard_layout;
82extern int win2k_install_hack;
83extern int alt_grab;
84extern int usb_enabled;
85extern int smp_cpus;
86extern int cursor_hide;
87extern int graphic_rotate;
88extern int no_quit;
89extern int semihosting_enabled;
90extern int autostart;
91extern int old_param;
92extern const char *bootp_filename;
93
94
95#ifdef USE_KQEMU
96extern int kqemu_allowed;
97#endif
98
99#define MAX_OPTION_ROMS 16
100extern const char *option_rom[MAX_OPTION_ROMS];
101extern int nb_option_roms;
102
103#ifdef TARGET_SPARC
104#define MAX_PROM_ENVS 128
105extern const char *prom_envs[MAX_PROM_ENVS];
106extern unsigned int nb_prom_envs;
107#endif
108
87ecb68b
PB
109#if defined (TARGET_PPC)
110#define BIOS_SIZE (1024 * 1024)
111#elif defined (TARGET_SPARC64)
112#define BIOS_SIZE ((512 + 32) * 1024)
113#elif defined(TARGET_MIPS)
114#define BIOS_SIZE (4 * 1024 * 1024)
115#endif
116
e4bcb14c
TS
117typedef enum {
118 IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD
119} BlockInterfaceType;
120
121typedef struct DriveInfo {
122 BlockDriverState *bdrv;
f60d39bc 123 BlockInterfaceType type;
e4bcb14c
TS
124 int bus;
125 int unit;
126} DriveInfo;
127
128#define MAX_IDE_DEVS 2
129#define MAX_SCSI_DEVS 7
130#define MAX_DRIVES 32
131
4d7a0880
BS
132extern int nb_drives;
133extern DriveInfo drives_table[MAX_DRIVES+1];
e4bcb14c 134
f60d39bc
TS
135extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
136extern int drive_get_max_bus(BlockInterfaceType type);
87ecb68b
PB
137
138/* serial ports */
139
140#define MAX_SERIAL_PORTS 4
141
142extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
143
144/* parallel ports */
145
146#define MAX_PARALLEL_PORTS 3
147
148extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
149
150#ifdef NEED_CPU_H
151/* loader.c */
152int get_image_size(const char *filename);
293f78bc
BS
153int load_image(const char *filename, uint8_t *addr); /* deprecated */
154int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
87ecb68b
PB
155int load_elf(const char *filename, int64_t virt_to_phys_addend,
156 uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr);
293f78bc 157int load_aout(const char *filename, target_phys_addr_t addr, int max_sz);
87ecb68b 158int load_uboot(const char *filename, target_ulong *ep, int *is_linux);
293f78bc
BS
159
160int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
161int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
162int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes);
163void pstrcpy_targphys(target_phys_addr_t dest, int buf_size,
164 const char *source);
87ecb68b
PB
165#endif
166
167#ifdef HAS_AUDIO
168struct soundhw {
169 const char *name;
170 const char *descr;
171 int enabled;
172 int isa;
173 union {
174 int (*init_isa) (AudioState *s, qemu_irq *pic);
175 int (*init_pci) (PCIBus *bus, AudioState *s);
176 } init;
177};
178
179extern struct soundhw soundhw[];
180#endif
181
182void do_usb_add(const char *devname);
183void do_usb_del(const char *devname);
184void usb_info(void);
185
186#endif