sysemu.h 4.9 KB
Newer Older
P
pbrook 已提交
1 2 3 4
#ifndef SYSEMU_H
#define SYSEMU_H
/* Misc. things related to the system emulator.  */

A
aliguori 已提交
5
#include "qemu-common.h"
6
#include "qemu-option.h"
B
Blue Swirl 已提交
7
#include "qemu-queue.h"
J
Jan Kiszka 已提交
8
#include "qemu-timer.h"
G
Gerd Hoffmann 已提交
9
#include "notify.h"
A
aliguori 已提交
10

11 12
#ifdef _WIN32
#include <windows.h>
13
#include "qemu-os-win32.h"
14 15
#endif

16 17 18 19
#ifdef CONFIG_POSIX
#include "qemu-os-posix.h"
#endif

P
pbrook 已提交
20 21
/* vl.c */
extern const char *bios_name;
P
Paul Brook 已提交
22 23 24 25

#define QEMU_FILE_TYPE_BIOS   0
#define QEMU_FILE_TYPE_KEYMAP 1
char *qemu_find_file(int type, const char *name);
P
pbrook 已提交
26 27 28

extern int vm_running;
extern const char *qemu_name;
29
extern uint8_t qemu_uuid[];
30
int qemu_uuid_parse(const char *str, uint8_t *uuid);
31
#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
P
pbrook 已提交
32 33

typedef struct vm_change_state_entry VMChangeStateEntry;
34
typedef void VMChangeStateHandler(void *opaque, int running, int reason);
P
pbrook 已提交
35 36 37 38 39 40 41 42

VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
                                                     void *opaque);
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);

void vm_start(void);
void vm_stop(int reason);

43 44 45 46
uint64_t ram_bytes_remaining(void);
uint64_t ram_bytes_transferred(void);
uint64_t ram_bytes_total(void);

P
pbrook 已提交
47 48 49 50 51 52 53
int64_t cpu_get_ticks(void);
void cpu_enable_ticks(void);
void cpu_disable_ticks(void);

void qemu_system_reset_request(void);
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
A
aurel32 已提交
54 55 56
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
B
Blue Swirl 已提交
57
extern qemu_irq qemu_system_powerdown;
A
aurel32 已提交
58
void qemu_system_reset(void);
P
pbrook 已提交
59

G
Gerd Hoffmann 已提交
60 61 62
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);

63
void do_savevm(Monitor *mon, const QDict *qdict);
64
int load_vmstate(const char *name);
65
void do_delvm(Monitor *mon, const QDict *qdict);
A
aliguori 已提交
66
void do_info_snapshots(Monitor *mon);
P
pbrook 已提交
67

68 69 70 71
void cpu_synchronize_all_states(void);
void cpu_synchronize_all_post_reset(void);
void cpu_synchronize_all_post_init(void);

72 73
void qemu_announce_self(void);

74
void main_loop_wait(int nonblocking);
P
pbrook 已提交
75

76 77 78 79 80
int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
                            int shared);
int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
A
aliguori 已提交
81 82
int qemu_loadvm_state(QEMUFile *f);

P
pbrook 已提交
83
/* SLIRP */
A
aliguori 已提交
84
void do_info_slirp(Monitor *mon);
P
pbrook 已提交
85

86
/* OS specific functions */
87
void os_setup_early_signal_handling(void);
88
char *os_find_datadir(const char *argv0);
89
void os_parse_cmd_args(int index, const char *optarg);
90
void os_pidfile_error(void);
91

92 93 94 95 96 97 98 99
typedef enum DisplayType
{
    DT_DEFAULT,
    DT_CURSES,
    DT_SDL,
    DT_NOGRAPHIC,
} DisplayType;

P
Paolo Bonzini 已提交
100
extern int autostart;
101
extern int incoming_expected;
P
pbrook 已提交
102
extern int bios_size;
103 104 105 106 107 108 109 110 111 112 113

typedef enum {
    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB
} VGAInterfaceType;

extern int vga_interface_type;
#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
#define std_vga_enabled (vga_interface_type == VGA_STD)
#define xenfb_enabled (vga_interface_type == VGA_XENFB)
#define vmsvga_enabled (vga_interface_type == VGA_VMWARE)

P
pbrook 已提交
114 115 116
extern int graphic_width;
extern int graphic_height;
extern int graphic_depth;
J
Jes Sorensen 已提交
117
extern uint8_t irq0override;
118
extern DisplayType display_type;
P
pbrook 已提交
119 120
extern const char *keyboard_layout;
extern int win2k_install_hack;
121
extern int rtc_td_hack;
P
pbrook 已提交
122
extern int alt_grab;
123
extern int ctrl_grab;
P
pbrook 已提交
124 125
extern int usb_enabled;
extern int smp_cpus;
126
extern int max_cpus;
P
pbrook 已提交
127 128 129
extern int cursor_hide;
extern int graphic_rotate;
extern int no_quit;
L
Luiz Capitulino 已提交
130
extern int no_shutdown;
P
pbrook 已提交
131 132
extern int semihosting_enabled;
extern int old_param;
133
extern int boot_menu;
J
Jan Kiszka 已提交
134
extern QEMUClock *rtc_clock;
P
pbrook 已提交
135

136 137 138
#define MAX_NODES 64
extern int nb_numa_nodes;
extern uint64_t node_mem[MAX_NODES];
B
Blue Swirl 已提交
139
extern uint64_t node_cpumask[MAX_NODES];
140

P
pbrook 已提交
141 142 143 144 145 146 147 148
#define MAX_OPTION_ROMS 16
extern const char *option_rom[MAX_OPTION_ROMS];
extern int nb_option_roms;

#define MAX_PROM_ENVS 128
extern const char *prom_envs[MAX_PROM_ENVS];
extern unsigned int nb_prom_envs;

149
/* pci-hotplug */
150
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
151
void drive_hot_add(Monitor *mon, const QDict *qdict);
152
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
153

P
pbrook 已提交
154 155 156 157 158 159 160 161 162 163 164 165
/* serial ports */

#define MAX_SERIAL_PORTS 4

extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];

/* parallel ports */

#define MAX_PARALLEL_PORTS 3

extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];

166 167
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)

P
pbrook 已提交
168 169 170 171 172 173 174
#ifdef HAS_AUDIO
struct soundhw {
    const char *name;
    const char *descr;
    int enabled;
    int isa;
    union {
P
Paul Brook 已提交
175 176
        int (*init_isa) (qemu_irq *pic);
        int (*init_pci) (PCIBus *bus);
P
pbrook 已提交
177 178 179 180 181 182
    } init;
};

extern struct soundhw soundhw[];
#endif

183 184
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
A
aliguori 已提交
185
void usb_info(Monitor *mon);
P
pbrook 已提交
186

187 188
void rtc_change_mon_event(struct tm *tm);

P
Paul Brook 已提交
189 190
void register_devices(void);

P
pbrook 已提交
191
#endif