Statistics
| Branch: | Revision:

root / sysemu.h @ 07ef34c3

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