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