diff --git a/TESTFILES/WinQemu.dll b/TESTFILES/WinQemu.dll index f05458cc..8221918d 100644 Binary files a/TESTFILES/WinQemu.dll and b/TESTFILES/WinQemu.dll differ diff --git a/TESTFILES/WinQemu.pdb b/TESTFILES/WinQemu.pdb index 4f3ee424..c86a03cd 100644 Binary files a/TESTFILES/WinQemu.pdb and b/TESTFILES/WinQemu.pdb differ diff --git a/qemu/Makefile b/qemu/Makefile index bbb5e910..e993ec6d 100644 --- a/qemu/Makefile +++ b/qemu/Makefile @@ -189,6 +189,13 @@ endif LIBS+=$(VDE_LIBS) +# xen backend driver support +XEN_OBJS := xen_backend.o xen_devconfig.o +XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o +ifdef CONFIG_XEN + OBJS += $(XEN_OBJS) +endif + cocoa.o: cocoa.m keymaps.o: keymaps.c keymaps.h diff --git a/qemu/Makefile.hw b/qemu/Makefile.hw index 87675fde..6da37a97 100644 --- a/qemu/Makefile.hw +++ b/qemu/Makefile.hw @@ -21,7 +21,13 @@ OBJS+= fw_cfg.o OBJS+= watchdog.o OBJS+= nand.o ecc.o -OBJS+= m48t59.o +OBJS+= m48t59.o escc.o + +# PC style devices +OBJS+= fdc.o + +# SCSI layer +OBJS+= lsi53c895a.o esp.o OBJS+= dma-helpers.o sysbus.o diff --git a/qemu/configure b/qemu/configure index 186e5357..36596ba9 100644 --- a/qemu/configure +++ b/qemu/configure @@ -1708,6 +1708,11 @@ else exit 1 fi +if test "$xen" = "yes" ; + then + echo "CONFIG_XEN=yes" >> $config_mak +fi + tools= if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then tools="qemu-img\$(EXESUF) $tools" diff --git a/qemu/hw/boards.h b/qemu/hw/boards.h index 31440176..f6733b7c 100644 --- a/qemu/hw/boards.h +++ b/qemu/hw/boards.h @@ -16,11 +16,11 @@ typedef struct QEMUMachine { QEMUMachineInitFunc *init; int use_scsi; int max_cpus; + int is_default; struct QEMUMachine *next; } QEMUMachine; int qemu_register_machine(QEMUMachine *m); -void register_machines(void); extern QEMUMachine *current_machine; diff --git a/qemu/hw/etraxfs.c b/qemu/hw/etraxfs.c index 27205ad5..f043c19d 100644 --- a/qemu/hw/etraxfs.c +++ b/qemu/hw/etraxfs.c @@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = { .name = "bareetraxfs", .desc = "Bare ETRAX FS board", .init = bareetraxfs_init, + .is_default = 1, }; static void bareetraxfs_machine_init(void) diff --git a/qemu/hw/fw_cfg.c b/qemu/hw/fw_cfg.c index 39bd9559..e605cda6 100644 --- a/qemu/hw/fw_cfg.c +++ b/qemu/hw/fw_cfg.c @@ -277,7 +277,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, } fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); - fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)nographic); + fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s); diff --git a/qemu/hw/integratorcp.c b/qemu/hw/integratorcp.c index ac0bd264..493866c9 100644 --- a/qemu/hw/integratorcp.c +++ b/qemu/hw/integratorcp.c @@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = { .name = "integratorcp", .desc = "ARM Integrator/CP (ARM926EJ-S)", .init = integratorcp_init, + .is_default = 1, }; static void integratorcp_machine_init(void) diff --git a/qemu/hw/lsi53c895a.c b/qemu/hw/lsi53c895a.c index a3c7ec5f..15262546 100644 --- a/qemu/hw/lsi53c895a.c +++ b/qemu/hw/lsi53c895a.c @@ -851,14 +851,15 @@ static inline int32_t sxt24(int32_t n) return (n << 8) >> 8; } +#define LSI_BUF_SIZE 4096 static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count) { int n; - uint8_t buf[TARGET_PAGE_SIZE]; + uint8_t buf[LSI_BUF_SIZE]; DPRINTF("memcpy dest 0x%08x src 0x%08x count %d\n", dest, src, count); while (count) { - n = (count > TARGET_PAGE_SIZE) ? TARGET_PAGE_SIZE : count; + n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count; cpu_physical_memory_read(src, buf, n); cpu_physical_memory_write(dest, buf, n); src += n; diff --git a/qemu/hw/mcf5208.c b/qemu/hw/mcf5208.c index 21b2bc8a..47a0f3ea 100644 --- a/qemu/hw/mcf5208.c +++ b/qemu/hw/mcf5208.c @@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = { .name = "mcf5208evb", .desc = "MCF5206EVB", .init = mcf5208evb_init, + .is_default = 1, }; static void mcf5208evb_machine_init(void) diff --git a/qemu/hw/mips_malta.c b/qemu/hw/mips_malta.c index eb81edf1..d8621824 100644 --- a/qemu/hw/mips_malta.c +++ b/qemu/hw/mips_malta.c @@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = { .name = "malta", .desc = "MIPS Malta Core LV", .init = mips_malta_init, + .is_default = 1, }; static void mips_malta_machine_init(void) diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c index 43b73914..e9682fad 100644 --- a/qemu/hw/pc.c +++ b/qemu/hw/pc.c @@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = { .desc = "Standard PC", .init = pc_init_pci, .max_cpus = 255, + .is_default = 1, }; static QEMUMachine isapc_machine = { diff --git a/qemu/hw/ppc_oldworld.c b/qemu/hw/ppc_oldworld.c index c6ec635e..377ed593 100644 --- a/qemu/hw/ppc_oldworld.c +++ b/qemu/hw/ppc_oldworld.c @@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = { .desc = "Heathrow based PowerMAC", .init = ppc_heathrow_init, .max_cpus = MAX_CPUS, + .is_default = 1, }; static void heathrow_machine_init(void) diff --git a/qemu/hw/shix.c b/qemu/hw/shix.c index eeee6bbc..19b0155a 100644 --- a/qemu/hw/shix.c +++ b/qemu/hw/shix.c @@ -92,6 +92,7 @@ static QEMUMachine shix_machine = { .name = "shix", .desc = "shix card", .init = shix_init, + .is_default = 1, }; static void shix_machine_init(void) diff --git a/qemu/hw/sun4m.c b/qemu/hw/sun4m.c index f6b35eff..a2e02316 100644 --- a/qemu/hw/sun4m.c +++ b/qemu/hw/sun4m.c @@ -505,7 +505,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, slavio_cpu_irq, smp_cpus); slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq], - nographic, ESCC_CLOCK, 1); + display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1); // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], slavio_irq[hwdef->ser_irq], @@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = { .desc = "Sun4m platform, SPARCstation 5", .init = ss5_init, .use_scsi = 1, + .is_default = 1, }; static QEMUMachine ss10_machine = { @@ -1273,7 +1274,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size, sbi_cpu_irq, smp_cpus); slavio_serial_ms_kbd_init(hwdef->ms_kb_base, sbi_irq[hwdef->ms_kb_irq], - nographic, ESCC_CLOCK, 1); + display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1); // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], sbi_irq[hwdef->ser_irq], @@ -1476,7 +1477,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size, hwdef->nvram_size, 2); slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq], - nographic, ESCC_CLOCK, 1); + display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1); // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], diff --git a/qemu/hw/sun4u.c b/qemu/hw/sun4u.c index 1ff0efa8..08789bcc 100644 --- a/qemu/hw/sun4u.c +++ b/qemu/hw/sun4u.c @@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = { .desc = "Sun4u platform", .init = sun4u_init, .max_cpus = 1, // XXX for now + .is_default = 1, }; static QEMUMachine sun4v_machine = { diff --git a/qemu/hw/xen_backend.c b/qemu/hw/xen_backend.c index 2f2ec7ff..76d07ecd 100644 --- a/qemu/hw/xen_backend.c +++ b/qemu/hw/xen_backend.c @@ -38,6 +38,7 @@ #include "hw.h" #include "qemu-char.h" +#include "qemu-log.h" #include "xen_backend.h" /* ------------------------------------------------------------- */ diff --git a/qemu/qemu-char.c b/qemu/qemu-char.c index e16e3028..01e95251 100644 --- a/qemu/qemu-char.c +++ b/qemu/qemu-char.c @@ -571,7 +571,7 @@ static void fd_chr_update_read_handler(CharDriverState *chr) FDCharDriver *s = chr->opaque; if (s->fd_in >= 0) { - if (nographic && s->fd_in == 0) { + if (display_type == DT_NOGRAPHIC && s->fd_in == 0) { } else { qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll, fd_chr_read, NULL, chr); @@ -584,7 +584,7 @@ static void fd_chr_close(struct CharDriverState *chr) FDCharDriver *s = chr->opaque; if (s->fd_in >= 0) { - if (nographic && s->fd_in == 0) { + if (display_type == DT_NOGRAPHIC && s->fd_in == 0) { } else { qemu_set_fd_handler2(s->fd_in, NULL, NULL, NULL, NULL); } @@ -714,7 +714,7 @@ static void term_init(void) tty.c_oflag |= OPOST; tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); /* if graphical mode, we allow Ctrl-C handling */ - if (nographic) + if (display_type == DT_NOGRAPHIC) tty.c_lflag &= ~ISIG; tty.c_cflag &= ~(CSIZE|PARENB); tty.c_cflag |= CS8; diff --git a/qemu/sysemu.h b/qemu/sysemu.h index 7d65804b..4063533f 100644 --- a/qemu/sysemu.h +++ b/qemu/sysemu.h @@ -86,6 +86,15 @@ int tap_win32_init(VLANState *vlan, const char *model, /* SLIRP */ void do_info_slirp(Monitor *mon); +typedef enum DisplayType +{ + DT_DEFAULT, + DT_CURSES, + DT_SDL, + DT_VNC, + DT_NOGRAPHIC, +} DisplayType; + extern int bios_size; extern int cirrus_vga_enabled; extern int std_vga_enabled; @@ -94,7 +103,7 @@ extern int xenfb_enabled; extern int graphic_width; extern int graphic_height; extern int graphic_depth; -extern int nographic; +extern DisplayType display_type; extern const char *keyboard_layout; extern int win2k_install_hack; extern int rtc_td_hack; diff --git a/qemu/vl.c b/qemu/vl.c index 27869ccc..c1981c75 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -210,12 +210,9 @@ static IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; to store the VM snapshots */ DriveInfo drives_table[MAX_DRIVES+1]; int nb_drives; -static int vga_ram_size; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; static DisplayState *display_state; -int nographic; -static int curses; -static int sdl; +DisplayType display_type = DT_DEFAULT; const char* keyboard_layout = NULL; int64_t ticks_per_sec; ram_addr_t ram_size; @@ -1554,7 +1551,7 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t) sigaction(SIGALRM, &act, NULL); - /* + /* * Initialize ev struct to 0 to avoid valgrind complaining * about uninitialized data in timer_create call */ @@ -3511,6 +3508,18 @@ static QEMUMachine *find_machine(const char *name) return NULL; } +static QEMUMachine *find_default_machine(void) +{ + QEMUMachine *m; + + for(m = first_machine; m != NULL; m = m->next) { + if (m->is_default) { + return m; + } + } + return NULL; +} + /***********************************************************/ /* main execution loop */ @@ -4865,6 +4874,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) const char *run_as = NULL; #endif CPUState *env; + int show_vnc_port = 0; qemu_cache_utils_init(envp); @@ -4900,13 +4910,11 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) #endif module_call_init(MODULE_INIT_MACHINE); - machine = first_machine; + machine = find_default_machine(); cpu_model = NULL; initrd_filename = NULL; ram_size = 0; snapshot = 0; - nographic = 0; - curses = 0; kernel_filename = NULL; kernel_cmdline = ""; cyls = heads = secs = 0; @@ -4993,7 +5001,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) for(m = first_machine; m != NULL; m = m->next) { printf("%-10s %s%s\n", m->name, m->desc, - m == first_machine ? " (default)" : ""); + m->is_default ? " (default)" : ""); } exit(*optarg != '?'); } @@ -5098,11 +5106,11 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) numa_add(optarg); break; case QEMU_OPTION_nographic: - nographic = 1; + display_type = DT_NOGRAPHIC; break; #ifdef CONFIG_CURSES case QEMU_OPTION_curses: - curses = 1; + display_type = DT_CURSES; break; #endif case QEMU_OPTION_portrait: @@ -5381,7 +5389,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) no_quit = 1; break; case QEMU_OPTION_sdl: - sdl = 1; + display_type = DT_SDL; break; #endif case QEMU_OPTION_pidfile: @@ -5443,6 +5451,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) } break; case QEMU_OPTION_vnc: + display_type = DT_VNC; vnc_display = optarg; break; #ifdef TARGET_I386 @@ -5601,7 +5610,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) exit(1); } - if (nographic) { + if (display_type == DT_NOGRAPHIC) { if (serial_device_index == 0) serial_devices[0] = "stdio"; if (parallel_device_index == 0) @@ -5973,33 +5982,46 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) dumb_display_init(); /* just use the first displaystate for the moment */ ds = display_state; - /* terminal init */ - if (nographic) { - if (curses) { - fprintf(stderr, "fatal: -nographic can't be used with -curses\n"); - exit(1); - } - } else { + + if (display_type == DT_DEFAULT) { +#if defined(CONFIG_SDL) || defined(CONFIG_COCOA) + display_type = DT_SDL; +#else + display_type = DT_VNC; + vnc_display = "localhost:0,to=99"; + show_vnc_port = 1; +#endif + } + + + switch (display_type) { + case DT_NOGRAPHIC: + break; #if defined(CONFIG_CURSES) - if (curses) { - /* At the moment curses cannot be used with other displays */ - curses_display_init(ds, full_screen); - } else + case DT_CURSES: + curses_display_init(ds, full_screen); + break; #endif - { - if (vnc_display != NULL) { - vnc_display_init(ds); - if (vnc_display_open(ds, vnc_display) < 0) - exit(1); - } #if defined(CONFIG_SDL) - if (sdl || !vnc_display) - sdl_display_init(ds, full_screen, no_frame); + case DT_SDL: + sdl_display_init(ds, full_screen, no_frame); + break; #elif defined(CONFIG_COCOA) - if (sdl || !vnc_display) - cocoa_display_init(ds, full_screen); + case DT_SDL: + cocoa_display_init(ds, full_screen); + break; #endif - } + case DT_VNC: + vnc_display_init(ds); + if (vnc_display_open(ds, vnc_display) < 0) + exit(1); + + if (show_vnc_port) { + printf("VNC server running on `%s'\n", vnc_display_local_addr(ds)); + } + break; + default: + break; } dpy_resize(ds); @@ -6012,7 +6034,7 @@ int __declspec(dllexport) qemu_main(int argc, char** argv, char** envp) dcl = dcl->next; } - if (nographic || (vnc_display && !sdl)) { + if (display_type == DT_NOGRAPHIC || display_type == DT_VNC) { nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); }