debuggers.hg

view tools/ioemu/vl.h @ 13688:d1710eb35385

[HVM] Allow HVM guest to request invalidation of foreign mappings via
an I/O port write.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author kaf24@localhost.localdomain
date Sat Jan 27 13:32:27 2007 +0000 (2007-01-27)
parents 67a06a9b7b1d
children eedbddf55e51
line source
1 /*
2 * QEMU System Emulator header
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 #ifndef VL_H
25 #define VL_H
27 /* we put basic includes here to avoid repeating them in device drivers */
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <stdarg.h>
31 #include <string.h>
32 #include <inttypes.h>
33 #include <limits.h>
34 #include <time.h>
35 #include <ctype.h>
36 #include <errno.h>
37 #include <unistd.h>
38 #include <fcntl.h>
39 #include <sys/stat.h>
40 #include <sys/socket.h>
41 #include <sys/types.h>
42 #include "xenctrl.h"
43 #include "xs.h"
44 #include <xen/hvm/e820.h>
46 #ifndef O_LARGEFILE
47 #define O_LARGEFILE 0
48 #endif
49 #ifndef O_BINARY
50 #define O_BINARY 0
51 #endif
53 #ifdef _WIN32
54 #include <windows.h>
55 #define fsync _commit
56 #define lseek _lseeki64
57 #define ENOTSUP 4096
58 extern int qemu_ftruncate64(int, int64_t);
59 #define ftruncate qemu_ftruncate64
62 static inline char *realpath(const char *path, char *resolved_path)
63 {
64 _fullpath(resolved_path, path, _MAX_PATH);
65 return resolved_path;
66 }
68 #define PRId64 "I64d"
69 #define PRIx64 "I64x"
70 #define PRIu64 "I64u"
71 #define PRIo64 "I64o"
72 #endif
74 #ifdef QEMU_TOOL
76 /* we use QEMU_TOOL in the command line tools which do not depend on
77 the target CPU type */
78 #include "config-host.h"
79 #include <setjmp.h>
80 #include "osdep.h"
81 #include "bswap.h"
83 #else
85 #include "audio/audio.h"
86 #include "cpu.h"
87 #include "gdbstub.h"
89 #endif /* !defined(QEMU_TOOL) */
91 #ifndef glue
92 #define xglue(x, y) x ## y
93 #define glue(x, y) xglue(x, y)
94 #define stringify(s) tostring(s)
95 #define tostring(s) #s
96 #endif
98 #ifndef MIN
99 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
100 #endif
101 #ifndef MAX
102 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
103 #endif
105 /* vl.c */
106 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
108 void hw_error(const char *fmt, ...);
110 extern const char *bios_dir;
112 void pstrcpy(char *buf, int buf_size, const char *str);
113 char *pstrcat(char *buf, int buf_size, const char *s);
114 int strstart(const char *str, const char *val, const char **ptr);
116 extern int vm_running;
118 typedef struct vm_change_state_entry VMChangeStateEntry;
119 typedef void VMChangeStateHandler(void *opaque, int running);
120 typedef void VMStopHandler(void *opaque, int reason);
122 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
123 void *opaque);
124 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
126 int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque);
127 void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque);
129 void vm_start(void);
130 void vm_stop(int reason);
132 typedef void QEMUResetHandler(void *opaque);
134 void qemu_register_reset(QEMUResetHandler *func, void *opaque);
135 void qemu_system_reset_request(void);
136 void qemu_system_reset(void);
137 void qemu_system_shutdown_request(void);
138 void qemu_system_powerdown_request(void);
139 #if !defined(TARGET_SPARC)
140 // Please implement a power failure function to signal the OS
141 #define qemu_system_powerdown() do{}while(0)
142 #else
143 void qemu_system_powerdown(void);
144 #endif
146 extern int reset_requested;
148 void main_loop_wait(int timeout);
150 int unset_mm_mapping(int xc_handle, uint32_t domid, unsigned long nr_pages,
151 unsigned int address_bits, unsigned long *extent_start);
152 int set_mm_mapping(int xc_handle, uint32_t domid, unsigned long nr_pages,
153 unsigned int address_bits, unsigned long *extent_start);
155 extern void *shared_vram;
157 extern FILE *logfile;
160 #if defined(__i386__) || defined(__x86_64__)
162 #define MAPCACHE
164 #if defined(__i386__)
165 #define MAX_MCACHE_SIZE 0x40000000 /* 1GB max for x86 */
166 #define MCACHE_BUCKET_SHIFT 16
167 #elif defined(__x86_64__)
168 #define MAX_MCACHE_SIZE 0x1000000000 /* 64GB max for x86_64 */
169 #define MCACHE_BUCKET_SHIFT 20
170 #endif
172 #define MCACHE_BUCKET_SIZE (1UL << MCACHE_BUCKET_SHIFT)
174 struct map_cache {
175 unsigned long paddr_index;
176 uint8_t *vaddr_base;
177 };
179 uint8_t *qemu_map_cache(target_phys_addr_t phys_addr);
180 void qemu_invalidate_map_cache(void);
182 #include <pthread.h>
183 extern pthread_mutex_t mapcache_mutex;
184 #define mapcache_lock() pthread_mutex_lock(&mapcache_mutex)
185 #define mapcache_unlock() pthread_mutex_unlock(&mapcache_mutex)
187 #else
189 #define qemu_invalidate_map_cache() ((void)0)
191 #define mapcache_lock() ((void)0)
192 #define mapcache_unlock() ((void)0)
194 #endif
196 extern int xc_handle;
197 extern int domid;
199 extern uint64_t ram_size;
200 extern int bios_size;
201 extern int rtc_utc;
202 extern int cirrus_vga_enabled;
203 extern int graphic_width;
204 extern int graphic_height;
205 extern int graphic_depth;
206 extern const char *keyboard_layout;
207 extern int kqemu_allowed;
208 extern int win2k_install_hack;
209 extern int usb_enabled;
210 extern int acpi_enabled;
211 extern int smp_cpus;
213 /* XXX: make it dynamic */
214 #if defined (TARGET_PPC) || defined (TARGET_SPARC64)
215 #define BIOS_SIZE ((512 + 32) * 1024)
216 #elif defined(TARGET_MIPS)
217 #define BIOS_SIZE (128 * 1024)
218 #else
219 #define BIOS_SIZE ((256 + 64) * 1024)
220 #endif
222 /* keyboard/mouse support */
224 #define MOUSE_EVENT_LBUTTON 0x01
225 #define MOUSE_EVENT_RBUTTON 0x02
226 #define MOUSE_EVENT_MBUTTON 0x04
228 typedef void QEMUPutKBDEvent(void *opaque, int keycode);
229 typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
231 void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
232 void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute);
234 void kbd_put_keycode(int keycode);
235 void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
236 int kbd_mouse_is_absolute(void);
238 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
239 constants) */
240 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
241 #define QEMU_KEY_BACKSPACE 0x007f
242 #define QEMU_KEY_UP QEMU_KEY_ESC1('A')
243 #define QEMU_KEY_DOWN QEMU_KEY_ESC1('B')
244 #define QEMU_KEY_RIGHT QEMU_KEY_ESC1('C')
245 #define QEMU_KEY_LEFT QEMU_KEY_ESC1('D')
246 #define QEMU_KEY_HOME QEMU_KEY_ESC1(1)
247 #define QEMU_KEY_END QEMU_KEY_ESC1(4)
248 #define QEMU_KEY_PAGEUP QEMU_KEY_ESC1(5)
249 #define QEMU_KEY_PAGEDOWN QEMU_KEY_ESC1(6)
250 #define QEMU_KEY_DELETE QEMU_KEY_ESC1(3)
252 #define QEMU_KEY_CTRL_UP 0xe400
253 #define QEMU_KEY_CTRL_DOWN 0xe401
254 #define QEMU_KEY_CTRL_LEFT 0xe402
255 #define QEMU_KEY_CTRL_RIGHT 0xe403
256 #define QEMU_KEY_CTRL_HOME 0xe404
257 #define QEMU_KEY_CTRL_END 0xe405
258 #define QEMU_KEY_CTRL_PAGEUP 0xe406
259 #define QEMU_KEY_CTRL_PAGEDOWN 0xe407
261 void kbd_put_keysym(int keysym);
263 /* async I/O support */
265 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
266 typedef int IOCanRWHandler(void *opaque);
267 typedef void IOHandler(void *opaque);
269 int qemu_set_fd_handler2(int fd,
270 IOCanRWHandler *fd_read_poll,
271 IOHandler *fd_read,
272 IOHandler *fd_write,
273 void *opaque);
274 int qemu_set_fd_handler(int fd,
275 IOHandler *fd_read,
276 IOHandler *fd_write,
277 void *opaque);
279 /* Polling handling */
281 /* return TRUE if no sleep should be done afterwards */
282 typedef int PollingFunc(void *opaque);
284 int qemu_add_polling_cb(PollingFunc *func, void *opaque);
285 void qemu_del_polling_cb(PollingFunc *func, void *opaque);
287 #ifdef _WIN32
288 /* Wait objects handling */
289 typedef void WaitObjectFunc(void *opaque);
291 int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
292 void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
293 #endif
295 /* character device */
297 #define CHR_EVENT_BREAK 0 /* serial break char */
298 #define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */
302 #define CHR_IOCTL_SERIAL_SET_PARAMS 1
303 typedef struct {
304 int speed;
305 int parity;
306 int data_bits;
307 int stop_bits;
308 } QEMUSerialSetParams;
310 #define CHR_IOCTL_SERIAL_SET_BREAK 2
312 #define CHR_IOCTL_PP_READ_DATA 3
313 #define CHR_IOCTL_PP_WRITE_DATA 4
314 #define CHR_IOCTL_PP_READ_CONTROL 5
315 #define CHR_IOCTL_PP_WRITE_CONTROL 6
316 #define CHR_IOCTL_PP_READ_STATUS 7
318 typedef void IOEventHandler(void *opaque, int event);
320 typedef struct CharDriverState {
321 int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len);
322 void (*chr_add_read_handler)(struct CharDriverState *s,
323 IOCanRWHandler *fd_can_read,
324 IOReadHandler *fd_read, void *opaque);
325 int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg);
326 IOEventHandler *chr_event;
327 void (*chr_send_event)(struct CharDriverState *chr, int event);
328 void (*chr_close)(struct CharDriverState *chr);
329 void *opaque;
330 } CharDriverState;
332 void qemu_chr_printf(CharDriverState *s, const char *fmt, ...);
333 int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
334 void qemu_chr_send_event(CharDriverState *s, int event);
335 void qemu_chr_add_read_handler(CharDriverState *s,
336 IOCanRWHandler *fd_can_read,
337 IOReadHandler *fd_read, void *opaque);
338 void qemu_chr_add_event_handler(CharDriverState *s, IOEventHandler *chr_event);
339 int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
341 /* consoles */
343 typedef struct DisplayState DisplayState;
344 typedef struct TextConsole TextConsole;
346 typedef void (*vga_hw_update_ptr)(void *);
347 typedef void (*vga_hw_invalidate_ptr)(void *);
348 typedef void (*vga_hw_screen_dump_ptr)(void *, const char *);
350 TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update,
351 vga_hw_invalidate_ptr invalidate,
352 vga_hw_screen_dump_ptr screen_dump,
353 void *opaque);
354 void vga_hw_update(void);
355 void vga_hw_invalidate(void);
356 void vga_hw_screen_dump(const char *filename);
358 int is_graphic_console(void);
359 CharDriverState *text_console_init(DisplayState *ds);
360 void console_select(unsigned int index);
361 void set_color_table(DisplayState *ds);
363 /* serial ports */
365 #define MAX_SERIAL_PORTS 4
367 extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
369 /* parallel ports */
371 #define MAX_PARALLEL_PORTS 3
373 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
375 /* VLANs support */
377 typedef struct VLANClientState VLANClientState;
379 struct VLANClientState {
380 IOReadHandler *fd_read;
381 /* Packets may still be sent if this returns zero. It's used to
382 rate-limit the slirp code. */
383 IOCanRWHandler *fd_can_read;
384 void *opaque;
385 struct VLANClientState *next;
386 struct VLANState *vlan;
387 char info_str[256];
388 };
390 typedef struct VLANState {
391 int id;
392 VLANClientState *first_client;
393 struct VLANState *next;
394 } VLANState;
396 VLANState *qemu_find_vlan(int id);
397 VLANClientState *qemu_new_vlan_client(VLANState *vlan,
398 IOReadHandler *fd_read,
399 IOCanRWHandler *fd_can_read,
400 void *opaque);
401 int qemu_can_send_packet(VLANClientState *vc);
402 void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
403 void qemu_handler_true(void *opaque);
405 void do_info_network(void);
407 /* TAP win32 */
408 int tap_win32_init(VLANState *vlan, const char *ifname);
409 void tap_win32_poll(void);
411 /* NIC info */
413 #define MAX_NICS 8
415 typedef struct NICInfo {
416 uint8_t macaddr[6];
417 const char *model;
418 VLANState *vlan;
419 } NICInfo;
421 extern int nb_nics;
422 extern NICInfo nd_table[MAX_NICS];
424 /* timers */
426 typedef struct QEMUClock QEMUClock;
427 typedef struct QEMUTimer QEMUTimer;
428 typedef void QEMUTimerCB(void *opaque);
430 /* The real time clock should be used only for stuff which does not
431 change the virtual machine state, as it is run even if the virtual
432 machine is stopped. The real time clock has a frequency of 1000
433 Hz. */
434 extern QEMUClock *rt_clock;
436 /* The virtual clock is only run during the emulation. It is stopped
437 when the virtual machine is stopped. Virtual timers use a high
438 precision clock, usually cpu cycles (use ticks_per_sec). */
439 extern QEMUClock *vm_clock;
441 int64_t qemu_get_clock(QEMUClock *clock);
443 QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
444 void qemu_free_timer(QEMUTimer *ts);
445 void qemu_del_timer(QEMUTimer *ts);
446 void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
447 void qemu_advance_timer(QEMUTimer *ts, int64_t expire_time);
448 int qemu_timer_pending(QEMUTimer *ts);
450 extern int64_t ticks_per_sec;
451 extern int pit_min_timer_count;
453 int64_t cpu_get_ticks(void);
454 void cpu_enable_ticks(void);
455 void cpu_disable_ticks(void);
457 /* VM Load/Save */
459 typedef FILE QEMUFile;
461 void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
462 void qemu_put_byte(QEMUFile *f, int v);
463 void qemu_put_be16(QEMUFile *f, unsigned int v);
464 void qemu_put_be32(QEMUFile *f, unsigned int v);
465 void qemu_put_be64(QEMUFile *f, uint64_t v);
466 int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
467 int qemu_get_byte(QEMUFile *f);
468 unsigned int qemu_get_be16(QEMUFile *f);
469 unsigned int qemu_get_be32(QEMUFile *f);
470 uint64_t qemu_get_be64(QEMUFile *f);
472 static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
473 {
474 qemu_put_be64(f, *pv);
475 }
477 static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
478 {
479 qemu_put_be32(f, *pv);
480 }
482 static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
483 {
484 qemu_put_be16(f, *pv);
485 }
487 static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
488 {
489 qemu_put_byte(f, *pv);
490 }
492 static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
493 {
494 *pv = qemu_get_be64(f);
495 }
497 static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
498 {
499 *pv = qemu_get_be32(f);
500 }
502 static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
503 {
504 *pv = qemu_get_be16(f);
505 }
507 static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
508 {
509 *pv = qemu_get_byte(f);
510 }
512 #if TARGET_LONG_BITS == 64
513 #define qemu_put_betl qemu_put_be64
514 #define qemu_get_betl qemu_get_be64
515 #define qemu_put_betls qemu_put_be64s
516 #define qemu_get_betls qemu_get_be64s
517 #else
518 #define qemu_put_betl qemu_put_be32
519 #define qemu_get_betl qemu_get_be32
520 #define qemu_put_betls qemu_put_be32s
521 #define qemu_get_betls qemu_get_be32s
522 #endif
524 int64_t qemu_ftell(QEMUFile *f);
525 int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
527 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
528 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
530 int qemu_loadvm(const char *filename);
531 int qemu_savevm(const char *filename);
532 int register_savevm(const char *idstr,
533 int instance_id,
534 int version_id,
535 SaveStateHandler *save_state,
536 LoadStateHandler *load_state,
537 void *opaque);
538 void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
539 void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
541 void cpu_save(QEMUFile *f, void *opaque);
542 int cpu_load(QEMUFile *f, void *opaque, int version_id);
544 /* block.c */
545 typedef struct BlockDriverState BlockDriverState;
546 typedef struct BlockDriver BlockDriver;
548 extern BlockDriver bdrv_raw;
549 extern BlockDriver bdrv_cow;
550 extern BlockDriver bdrv_qcow;
551 extern BlockDriver bdrv_vmdk;
552 extern BlockDriver bdrv_cloop;
553 extern BlockDriver bdrv_dmg;
554 extern BlockDriver bdrv_bochs;
555 extern BlockDriver bdrv_vpc;
556 extern BlockDriver bdrv_vvfat;
558 void bdrv_init(void);
559 BlockDriver *bdrv_find_format(const char *format_name);
560 int bdrv_create(BlockDriver *drv,
561 const char *filename, int64_t size_in_sectors,
562 const char *backing_file, int flags);
563 BlockDriverState *bdrv_new(const char *device_name);
564 void bdrv_delete(BlockDriverState *bs);
565 int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot);
566 int bdrv_open2(BlockDriverState *bs, const char *filename, int snapshot,
567 BlockDriver *drv);
568 void bdrv_close(BlockDriverState *bs);
569 int bdrv_read(BlockDriverState *bs, int64_t sector_num,
570 uint8_t *buf, int nb_sectors);
571 int bdrv_write(BlockDriverState *bs, int64_t sector_num,
572 const uint8_t *buf, int nb_sectors);
573 void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr);
574 int bdrv_commit(BlockDriverState *bs);
575 void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size);
576 /* Ensure contents are flushed to disk. */
577 void bdrv_flush(BlockDriverState *bs);
579 #define BDRV_TYPE_HD 0
580 #define BDRV_TYPE_CDROM 1
581 #define BDRV_TYPE_FLOPPY 2
582 #define BIOS_ATA_TRANSLATION_AUTO 0
583 #define BIOS_ATA_TRANSLATION_NONE 1
584 #define BIOS_ATA_TRANSLATION_LBA 2
586 void bdrv_set_geometry_hint(BlockDriverState *bs,
587 int cyls, int heads, int secs);
588 void bdrv_set_type_hint(BlockDriverState *bs, int type);
589 void bdrv_set_translation_hint(BlockDriverState *bs, int translation);
590 void bdrv_get_geometry_hint(BlockDriverState *bs,
591 int *pcyls, int *pheads, int *psecs);
592 int bdrv_get_type_hint(BlockDriverState *bs);
593 int bdrv_get_translation_hint(BlockDriverState *bs);
594 int bdrv_is_removable(BlockDriverState *bs);
595 int bdrv_is_read_only(BlockDriverState *bs);
596 int bdrv_is_inserted(BlockDriverState *bs);
597 int bdrv_is_locked(BlockDriverState *bs);
598 void bdrv_set_locked(BlockDriverState *bs, int locked);
599 void bdrv_set_change_cb(BlockDriverState *bs,
600 void (*change_cb)(void *opaque), void *opaque);
601 void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
602 void bdrv_info(void);
603 BlockDriverState *bdrv_find(const char *name);
604 void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque);
605 int bdrv_is_encrypted(BlockDriverState *bs);
606 int bdrv_set_key(BlockDriverState *bs, const char *key);
607 void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
608 void *opaque);
609 const char *bdrv_get_device_name(BlockDriverState *bs);
611 int qcow_get_cluster_size(BlockDriverState *bs);
612 int qcow_compress_cluster(BlockDriverState *bs, int64_t sector_num,
613 const uint8_t *buf);
615 #ifndef QEMU_TOOL
617 typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size,
618 char *boot_device,
619 DisplayState *ds, const char **fd_filename, int snapshot,
620 const char *kernel_filename, const char *kernel_cmdline,
621 const char *initrd_filename, time_t timeoffset);
623 typedef struct QEMUMachine {
624 const char *name;
625 const char *desc;
626 QEMUMachineInitFunc *init;
627 struct QEMUMachine *next;
628 } QEMUMachine;
630 int qemu_register_machine(QEMUMachine *m);
632 typedef void SetIRQFunc(void *opaque, int irq_num, int level);
633 typedef void IRQRequestFunc(void *opaque, int level);
635 /* ISA bus */
637 extern target_phys_addr_t isa_mem_base;
639 typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
640 typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
642 int register_ioport_read(int start, int length, int size,
643 IOPortReadFunc *func, void *opaque);
644 int register_ioport_write(int start, int length, int size,
645 IOPortWriteFunc *func, void *opaque);
646 void isa_unassign_ioport(int start, int length);
648 /* PCI bus */
650 extern target_phys_addr_t pci_mem_base;
652 typedef struct PCIBus PCIBus;
653 typedef struct PCIDevice PCIDevice;
655 typedef void PCIConfigWriteFunc(PCIDevice *pci_dev,
656 uint32_t address, uint32_t data, int len);
657 typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev,
658 uint32_t address, int len);
659 typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num,
660 uint32_t addr, uint32_t size, int type);
662 #define PCI_ADDRESS_SPACE_MEM 0x00
663 #define PCI_ADDRESS_SPACE_IO 0x01
664 #define PCI_ADDRESS_SPACE_MEM_PREFETCH 0x08
666 typedef struct PCIIORegion {
667 uint32_t addr; /* current PCI mapping address. -1 means not mapped */
668 uint32_t size;
669 uint8_t type;
670 PCIMapIORegionFunc *map_func;
671 } PCIIORegion;
673 #define PCI_ROM_SLOT 6
674 #define PCI_NUM_REGIONS 7
676 #define PCI_DEVICES_MAX 64
678 #define PCI_VENDOR_ID 0x00 /* 16 bits */
679 #define PCI_DEVICE_ID 0x02 /* 16 bits */
680 #define PCI_COMMAND 0x04 /* 16 bits */
681 #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
682 #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
683 #define PCI_CLASS_DEVICE 0x0a /* Device class */
684 #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
685 #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
686 #define PCI_MIN_GNT 0x3e /* 8 bits */
687 #define PCI_MAX_LAT 0x3f /* 8 bits */
689 struct PCIDevice {
690 /*
691 * PCI config space. The 4 extra bytes are a safety buffer for guest
692 * word/dword writes that can extend past byte 0xff.
693 */
694 uint8_t config[256+4];
696 /* the following fields are read only */
697 PCIBus *bus;
698 int devfn;
699 char name[64];
700 PCIIORegion io_regions[PCI_NUM_REGIONS];
702 /* do not access the following fields */
703 PCIConfigReadFunc *config_read;
704 PCIConfigWriteFunc *config_write;
705 /* ??? This is a PC-specific hack, and should be removed. */
706 int irq_index;
707 };
709 PCIDevice *pci_register_device(PCIBus *bus, const char *name,
710 int instance_size, int devfn,
711 PCIConfigReadFunc *config_read,
712 PCIConfigWriteFunc *config_write);
714 void pci_register_io_region(PCIDevice *pci_dev, int region_num,
715 uint32_t size, int type,
716 PCIMapIORegionFunc *map_func);
718 void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level);
720 uint32_t pci_default_read_config(PCIDevice *d,
721 uint32_t address, int len);
722 void pci_default_write_config(PCIDevice *d,
723 uint32_t address, uint32_t val, int len);
724 void generic_pci_save(QEMUFile* f, void *opaque);
725 int generic_pci_load(QEMUFile* f, void *opaque, int version_id);
727 typedef void (*pci_set_irq_fn)(PCIDevice *pci_dev, void *pic,
728 int irq_num, int level);
729 PCIBus *pci_register_bus(pci_set_irq_fn set_irq, void *pic, int devfn_min);
731 void pci_nic_init(PCIBus *bus, NICInfo *nd);
732 void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len);
733 uint32_t pci_data_read(void *opaque, uint32_t addr, int len);
734 int pci_bus_num(PCIBus *s);
735 void pci_for_each_device(void (*fn)(PCIDevice *d));
737 void pci_info(void);
739 /* prep_pci.c */
740 PCIBus *pci_prep_init(void);
742 /* grackle_pci.c */
743 PCIBus *pci_grackle_init(uint32_t base, void *pic);
745 /* unin_pci.c */
746 PCIBus *pci_pmac_init(void *pic);
748 /* apb_pci.c */
749 PCIBus *pci_apb_init(target_ulong special_base, target_ulong mem_base,
750 void *pic);
752 PCIBus *pci_vpb_init(void *pic);
754 /* piix_pci.c */
755 PCIBus *i440fx_init(void);
756 int piix3_init(PCIBus *bus);
757 void pci_bios_init(void);
759 /* openpic.c */
760 typedef struct openpic_t openpic_t;
761 void openpic_set_irq(void *opaque, int n_IRQ, int level);
762 openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
763 CPUState **envp);
765 /* heathrow_pic.c */
766 typedef struct HeathrowPICS HeathrowPICS;
767 void heathrow_pic_set_irq(void *opaque, int num, int level);
768 HeathrowPICS *heathrow_pic_init(int *pmem_index);
770 #ifdef HAS_AUDIO
771 struct soundhw {
772 const char *name;
773 const char *descr;
774 int enabled;
775 int isa;
776 union {
777 int (*init_isa) (AudioState *s);
778 int (*init_pci) (PCIBus *bus, AudioState *s);
779 } init;
780 };
782 extern struct soundhw soundhw[];
783 #endif
785 /* vga.c */
787 #define VGA_RAM_SIZE (8192 * 1024)
789 struct DisplayState {
790 uint8_t *data;
791 int linesize;
792 int depth;
793 int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */
794 int width;
795 int height;
796 void *opaque;
798 void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
799 void (*dpy_resize)(struct DisplayState *s, int w, int h);
800 void (*dpy_refresh)(struct DisplayState *s);
801 void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y, int dst_x, int dst_y, int w, int h);
802 };
804 static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
805 {
806 s->dpy_update(s, x, y, w, h);
807 }
809 static inline void dpy_resize(DisplayState *s, int w, int h)
810 {
811 s->dpy_resize(s, w, h);
812 }
814 int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
815 unsigned long vga_ram_offset, int vga_ram_size,
816 unsigned long vga_bios_offset, int vga_bios_size);
818 /* cirrus_vga.c */
819 void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
820 unsigned long vga_ram_offset, int vga_ram_size);
821 void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
822 unsigned long vga_ram_offset, int vga_ram_size);
824 /* sdl.c */
825 void sdl_display_init(DisplayState *ds, int full_screen);
827 /* cocoa.m */
828 void cocoa_display_init(DisplayState *ds, int full_screen);
830 /* vnc.c */
831 int vnc_display_init(DisplayState *ds, int display, int find_unused, struct sockaddr_in *addr);
832 int vnc_start_viewer(int port);
834 /* ide.c */
835 #define MAX_DISKS 4
837 extern BlockDriverState *bs_table[MAX_DISKS];
839 void isa_ide_init(int iobase, int iobase2, int irq,
840 BlockDriverState *hd0, BlockDriverState *hd1);
841 void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
842 int secondary_ide_enabled);
843 void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn);
844 int pmac_ide_init (BlockDriverState **hd_table,
845 SetIRQFunc *set_irq, void *irq_opaque, int irq);
847 /* cdrom.c */
848 int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track);
849 int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num);
851 /* es1370.c */
852 int es1370_init (PCIBus *bus, AudioState *s);
854 /* sb16.c */
855 int SB16_init (AudioState *s);
857 /* adlib.c */
858 int Adlib_init (AudioState *s);
860 /* gus.c */
861 int GUS_init (AudioState *s);
863 /* dma.c */
864 typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
865 int DMA_get_channel_mode (int nchan);
866 int DMA_read_memory (int nchan, void *buf, int pos, int size);
867 int DMA_write_memory (int nchan, void *buf, int pos, int size);
868 void DMA_hold_DREQ (int nchan);
869 void DMA_release_DREQ (int nchan);
870 void DMA_schedule(int nchan);
871 void DMA_run (void);
872 void DMA_init (int high_page_enable);
873 void DMA_register_channel (int nchan,
874 DMA_transfer_handler transfer_handler,
875 void *opaque);
876 /* fdc.c */
877 #define MAX_FD 2
878 extern BlockDriverState *fd_table[MAX_FD];
880 typedef struct fdctrl_t fdctrl_t;
882 fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped,
883 uint32_t io_base,
884 BlockDriverState **fds);
885 int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
887 /* ne2000.c */
889 void isa_ne2000_init(int base, int irq, NICInfo *nd);
890 void pci_ne2000_init(PCIBus *bus, NICInfo *nd);
892 /* rtl8139.c */
894 void pci_rtl8139_init(PCIBus *bus, NICInfo *nd);
896 /* pcnet.c */
898 void pci_pcnet_init(PCIBus *bus, NICInfo *nd);
900 /* pckbd.c */
902 void kbd_init(void);
904 /* mc146818rtc.c */
906 typedef struct RTCState RTCState;
908 RTCState *rtc_init(int base, int irq);
909 void rtc_set_memory(RTCState *s, int addr, int val);
910 void rtc_set_date(RTCState *s, const struct tm *tm);
912 /* serial.c */
914 typedef struct SerialState SerialState;
915 SerialState *serial_init(SetIRQFunc *set_irq, void *opaque,
916 int base, int irq, CharDriverState *chr);
917 SerialState *serial_mm_init (SetIRQFunc *set_irq, void *opaque,
918 target_ulong base, int it_shift,
919 int irq, CharDriverState *chr);
921 /* parallel.c */
923 typedef struct ParallelState ParallelState;
924 ParallelState *parallel_init(int base, int irq, CharDriverState *chr);
926 /* i8259.c */
928 typedef struct PicState2 PicState2;
929 extern PicState2 *isa_pic;
930 void pic_set_irq(int irq, int level);
931 void pic_set_irq_new(void *opaque, int irq, int level);
932 PicState2 *pic_init(IRQRequestFunc *irq_request, void *irq_request_opaque);
933 void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func,
934 void *alt_irq_opaque);
935 int pic_read_irq(PicState2 *s);
936 void pic_update_irq(PicState2 *s);
937 uint32_t pic_intack_read(PicState2 *s);
938 void pic_info(void);
939 void irq_info(void);
940 void sp_info(void);
942 /* APIC */
943 typedef struct IOAPICState IOAPICState;
945 int apic_init(CPUState *env);
946 int apic_get_interrupt(CPUState *env);
947 IOAPICState *ioapic_init(void);
948 void ioapic_set_irq(void *opaque, int vector, int level);
950 /* i8254.c */
952 #define PIT_FREQ 1193182
954 typedef struct PITState PITState;
956 PITState *pit_init(int base, int irq);
957 void pit_set_gate(PITState *pit, int channel, int val);
958 int pit_get_gate(PITState *pit, int channel);
959 int pit_get_initial_count(PITState *pit, int channel);
960 int pit_get_mode(PITState *pit, int channel);
961 int pit_get_out(PITState *pit, int channel, int64_t current_time);
963 /* pcspk.c */
964 void pcspk_init(PITState *);
965 int pcspk_audio_init(AudioState *);
967 /* acpi.c */
968 extern int acpi_enabled;
969 void piix4_pm_init(PCIBus *bus, int devfn);
970 void acpi_bios_init(void);
972 /* tpm_tis.c */
973 int has_tpm_device(void);
974 void tpm_tis_init(SetIRQFunc *set_irq, void *irq_opaque, int irq);
976 /* piix4acpi.c */
977 extern void pci_piix4_acpi_init(PCIBus *bus, int devfn);
979 /* pc.c */
980 extern QEMUMachine pc_machine;
981 extern QEMUMachine isapc_machine;
982 extern int fd_bootchk;
984 void ioport_set_a20(int enable);
985 int ioport_get_a20(void);
987 /* ppc.c */
988 extern QEMUMachine prep_machine;
989 extern QEMUMachine core99_machine;
990 extern QEMUMachine heathrow_machine;
992 /* mips_r4k.c */
993 extern QEMUMachine mips_machine;
995 /* shix.c */
996 extern QEMUMachine shix_machine;
998 #ifdef TARGET_PPC
999 ppc_tb_t *cpu_ppc_tb_init (CPUState *env, uint32_t freq);
1000 #endif
1001 void PREP_debug_write (void *opaque, uint32_t addr, uint32_t val);
1003 extern CPUWriteMemoryFunc *PPC_io_write[];
1004 extern CPUReadMemoryFunc *PPC_io_read[];
1005 void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val);
1007 /* sun4m.c */
1008 extern QEMUMachine sun4m_machine;
1009 uint32_t iommu_translate(uint32_t addr);
1010 void pic_set_irq_cpu(int irq, int level, unsigned int cpu);
1012 /* iommu.c */
1013 void *iommu_init(uint32_t addr);
1014 uint32_t iommu_translate_local(void *opaque, uint32_t addr);
1016 /* lance.c */
1017 void lance_init(NICInfo *nd, int irq, uint32_t leaddr, uint32_t ledaddr);
1019 /* tcx.c */
1020 void tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base,
1021 unsigned long vram_offset, int vram_size, int width, int height);
1023 /* slavio_intctl.c */
1024 void *slavio_intctl_init(void);
1025 void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env);
1026 void slavio_pic_info(void *opaque);
1027 void slavio_irq_info(void *opaque);
1028 void slavio_pic_set_irq(void *opaque, int irq, int level);
1029 void slavio_pic_set_irq_cpu(void *opaque, int irq, int level, unsigned int cpu);
1031 /* loader.c */
1032 int get_image_size(const char *filename);
1033 int load_image(const char *filename, uint8_t *addr);
1034 int load_elf(const char *filename, int64_t virt_to_phys_addend, uint64_t *pentry);
1035 int load_aout(const char *filename, uint8_t *addr);
1037 /* slavio_timer.c */
1038 void slavio_timer_init(uint32_t addr, int irq, int mode, unsigned int cpu);
1040 /* slavio_serial.c */
1041 SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDriverState *chr2);
1042 void slavio_serial_ms_kbd_init(int base, int irq);
1044 /* slavio_misc.c */
1045 void *slavio_misc_init(uint32_t base, int irq);
1046 void slavio_set_power_fail(void *opaque, int power_failing);
1048 /* esp.c */
1049 void esp_init(BlockDriverState **bd, int irq, uint32_t espaddr, uint32_t espdaddr);
1051 /* sun4u.c */
1052 extern QEMUMachine sun4u_machine;
1054 /* NVRAM helpers */
1055 #include "hw/m48t59.h"
1057 void NVRAM_set_byte (m48t59_t *nvram, uint32_t addr, uint8_t value);
1058 uint8_t NVRAM_get_byte (m48t59_t *nvram, uint32_t addr);
1059 void NVRAM_set_word (m48t59_t *nvram, uint32_t addr, uint16_t value);
1060 uint16_t NVRAM_get_word (m48t59_t *nvram, uint32_t addr);
1061 void NVRAM_set_lword (m48t59_t *nvram, uint32_t addr, uint32_t value);
1062 uint32_t NVRAM_get_lword (m48t59_t *nvram, uint32_t addr);
1063 void NVRAM_set_string (m48t59_t *nvram, uint32_t addr,
1064 const unsigned char *str, uint32_t max);
1065 int NVRAM_get_string (m48t59_t *nvram, uint8_t *dst, uint16_t addr, int max);
1066 void NVRAM_set_crc (m48t59_t *nvram, uint32_t addr,
1067 uint32_t start, uint32_t count);
1068 int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
1069 const unsigned char *arch,
1070 uint32_t RAM_size, char *boot_device,
1071 uint32_t kernel_image, uint32_t kernel_size,
1072 const char *cmdline,
1073 uint32_t initrd_image, uint32_t initrd_size,
1074 uint32_t NVRAM_image,
1075 int width, int height, int depth);
1077 /* adb.c */
1079 #define MAX_ADB_DEVICES 16
1081 #define ADB_MAX_OUT_LEN 16
1083 typedef struct ADBDevice ADBDevice;
1085 /* buf = NULL means polling */
1086 typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out,
1087 const uint8_t *buf, int len);
1088 typedef int ADBDeviceReset(ADBDevice *d);
1090 struct ADBDevice {
1091 struct ADBBusState *bus;
1092 int devaddr;
1093 int handler;
1094 ADBDeviceRequest *devreq;
1095 ADBDeviceReset *devreset;
1096 void *opaque;
1097 };
1099 typedef struct ADBBusState {
1100 ADBDevice devices[MAX_ADB_DEVICES];
1101 int nb_devices;
1102 int poll_index;
1103 } ADBBusState;
1105 int adb_request(ADBBusState *s, uint8_t *buf_out,
1106 const uint8_t *buf, int len);
1107 int adb_poll(ADBBusState *s, uint8_t *buf_out);
1109 ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
1110 ADBDeviceRequest *devreq,
1111 ADBDeviceReset *devreset,
1112 void *opaque);
1113 void adb_kbd_init(ADBBusState *bus);
1114 void adb_mouse_init(ADBBusState *bus);
1116 /* cuda.c */
1118 extern ADBBusState adb_bus;
1119 int cuda_init(SetIRQFunc *set_irq, void *irq_opaque, int irq);
1121 #include "hw/usb.h"
1123 /* usb ports of the VM */
1125 void qemu_register_usb_port(USBPort *port, void *opaque, int index,
1126 usb_attachfn attach);
1128 #define VM_USB_HUB_SIZE 8
1130 void do_usb_add(const char *devname);
1131 void do_usb_del(const char *devname);
1132 void usb_info(void);
1134 /* scsi-disk.c */
1135 typedef struct SCSIDevice SCSIDevice;
1136 typedef void (*scsi_completionfn)(void *, uint32_t, int);
1138 SCSIDevice *scsi_disk_init(BlockDriverState *bdrv,
1139 scsi_completionfn completion,
1140 void *opaque);
1141 void scsi_disk_destroy(SCSIDevice *s);
1143 int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun);
1144 int scsi_read_data(SCSIDevice *s, uint8_t *data, uint32_t len);
1145 int scsi_write_data(SCSIDevice *s, uint8_t *data, uint32_t len);
1147 /* lsi53c895a.c */
1148 void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id);
1149 void *lsi_scsi_init(PCIBus *bus, int devfn);
1151 /* integratorcp.c */
1152 extern QEMUMachine integratorcp926_machine;
1153 extern QEMUMachine integratorcp1026_machine;
1155 /* versatilepb.c */
1156 extern QEMUMachine versatilepb_machine;
1157 extern QEMUMachine versatileab_machine;
1159 /* ps2.c */
1160 void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg);
1161 void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg);
1162 void ps2_write_mouse(void *, int val);
1163 void ps2_write_keyboard(void *, int val);
1164 uint32_t ps2_read_data(void *);
1165 void ps2_queue(void *, int b);
1166 void ps2_keyboard_set_translation(void *opaque, int mode);
1168 /* smc91c111.c */
1169 void smc91c111_init(NICInfo *, uint32_t, void *, int);
1171 /* pl110.c */
1172 void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq, int);
1174 /* pl011.c */
1175 void pl011_init(uint32_t base, void *pic, int irq, CharDriverState *chr);
1177 /* pl050.c */
1178 void pl050_init(uint32_t base, void *pic, int irq, int is_mouse);
1180 /* pl080.c */
1181 void *pl080_init(uint32_t base, void *pic, int irq);
1183 /* pl190.c */
1184 void *pl190_init(uint32_t base, void *parent, int irq, int fiq);
1186 /* arm-timer.c */
1187 void sp804_init(uint32_t base, void *pic, int irq);
1188 void icp_pit_init(uint32_t base, void *pic, int irq);
1190 /* arm_boot.c */
1192 void arm_load_kernel(int ram_size, const char *kernel_filename,
1193 const char *kernel_cmdline, const char *initrd_filename,
1194 int board_id);
1196 /* sh7750.c */
1197 struct SH7750State;
1199 struct SH7750State *sh7750_init(CPUState * cpu);
1201 typedef struct {
1202 /* The callback will be triggered if any of the designated lines change */
1203 uint16_t portamask_trigger;
1204 uint16_t portbmask_trigger;
1205 /* Return 0 if no action was taken */
1206 int (*port_change_cb) (uint16_t porta, uint16_t portb,
1207 uint16_t * periph_pdtra,
1208 uint16_t * periph_portdira,
1209 uint16_t * periph_pdtrb,
1210 uint16_t * periph_portdirb);
1211 } sh7750_io_device;
1213 int sh7750_register_io_device(struct SH7750State *s,
1214 sh7750_io_device * device);
1215 /* tc58128.c */
1216 int tc58128_init(struct SH7750State *s, char *zone1, char *zone2);
1218 /* NOR flash devices */
1219 typedef struct pflash_t pflash_t;
1221 pflash_t *pflash_register (target_ulong base, ram_addr_t off,
1222 BlockDriverState *bs,
1223 target_ulong sector_len, int nb_blocs, int width,
1224 uint16_t id0, uint16_t id1,
1225 uint16_t id2, uint16_t id3);
1227 #endif /* defined(QEMU_TOOL) */
1229 /* monitor.c */
1230 void monitor_init(CharDriverState *hd, int show_banner);
1231 void term_puts(const char *str);
1232 void term_vprintf(const char *fmt, va_list ap);
1233 void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
1234 void term_flush(void);
1235 void term_print_help(void);
1236 void monitor_readline(const char *prompt, int is_password,
1237 char *buf, int buf_size);
1238 void do_eject(int force, const char *filename);
1239 void do_change(const char *device, const char *filename);
1241 /* readline.c */
1242 typedef void ReadLineFunc(void *opaque, const char *str);
1244 extern int completion_index;
1245 void add_completion(const char *str);
1246 void readline_handle_byte(int ch);
1247 void readline_find_completion(const char *cmdline);
1248 const char *readline_get_history(unsigned int index);
1249 void readline_start(const char *prompt, int is_password,
1250 ReadLineFunc *readline_func, void *opaque);
1252 /* xenstore.c */
1253 void xenstore_parse_domain_config(int domid);
1254 int xenstore_fd(void);
1255 void xenstore_process_event(void *opaque);
1256 void xenstore_check_new_media_present(int timeout);
1257 void xenstore_write_vncport(int vnc_display);
1258 int xenstore_read_vncpasswd(int domid);
1260 int xenstore_domain_has_devtype(struct xs_handle *handle,
1261 const char *devtype);
1262 char **xenstore_domain_get_devices(struct xs_handle *handle,
1263 const char *devtype, unsigned int *num);
1264 char *xenstore_read_hotplug_status(struct xs_handle *handle,
1265 const char *devtype, const char *inst);
1266 char *xenstore_backend_read_variable(struct xs_handle *,
1267 const char *devtype, const char *inst,
1268 const char *var);
1269 int xenstore_subscribe_to_hotplug_status(struct xs_handle *handle,
1270 const char *devtype,
1271 const char *inst,
1272 const char *token);
1273 int xenstore_unsubscribe_from_hotplug_status(struct xs_handle *handle,
1274 const char *devtype,
1275 const char *inst,
1276 const char *token);
1279 /* xen_platform.c */
1280 void pci_xen_platform_init(PCIBus *bus);
1283 void kqemu_record_dump(void);
1285 extern char domain_name[];
1287 void destroy_hvm_domain(void);
1289 /* VNC Authentication */
1290 #define AUTHCHALLENGESIZE 16
1292 #endif /* VL_H */