From: aurel32 Date: Mon, 7 Apr 2008 19:47:25 +0000 (+0000) Subject: Fix vmmouse with -smp X-Git-Tag: TizenStudio_2.0_p2.3~12058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f1cbe5eec404cc99f770efc2c97e4624b041088;p=sdk%2Femulator%2Fqemu.git Fix vmmouse with -smp git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4165 c046a42c-6fe2-441c-8c8c-71466251a162 --- diff --git a/hw/pc.c b/hw/pc.c index 4fec2d4..e126f92 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -748,9 +748,10 @@ static void pc_init1(int ram_size, int vga_ram_size, if (pci_enabled) { apic_init(env); } - vmport_init(env); } + vmport_init(); + /* allocate RAM */ ram_addr = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_addr); diff --git a/hw/pc.h b/hw/pc.h index 9f83050..8626599 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -59,7 +59,7 @@ int pit_get_mode(PITState *pit, int channel); int pit_get_out(PITState *pit, int channel, int64_t current_time); /* vmport.c */ -void vmport_init(CPUState *env); +void vmport_init(void); void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque); /* vmmouse.c */ diff --git a/hw/vmport.c b/hw/vmport.c index 8044c9f..3655ad1 100644 --- a/hw/vmport.c +++ b/hw/vmport.c @@ -34,7 +34,6 @@ typedef struct _VMPortState { - CPUState *env; IOPortReadFunc *func[VMPORT_ENTRIES]; void *opaque[VMPORT_ENTRIES]; } VMPortState; @@ -53,14 +52,15 @@ void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque) static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) { VMPortState *s = opaque; + CPUState *env = cpu_single_env; unsigned char command; uint32_t eax; - eax = s->env->regs[R_EAX]; + eax = env->regs[R_EAX]; if (eax != VMPORT_MAGIC) return eax; - command = s->env->regs[R_ECX]; + command = env->regs[R_ECX]; if (command >= VMPORT_ENTRIES) return eax; if (!s->func[command]) @@ -74,25 +74,23 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr) { - CPUState *env = opaque; + CPUState *env = cpu_single_env; env->regs[R_EBX] = VMPORT_MAGIC; return 6; } static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr) { - CPUState *env = opaque; + CPUState *env = cpu_single_env; env->regs[R_EBX] = 0x1177; return ram_size; } -void vmport_init(CPUState *env) +void vmport_init(void) { - port_state.env = env; - register_ioport_read(0x5658, 1, 4, vmport_ioport_read, &port_state); /* Register some generic port commands */ - vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, env); - vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, env); + vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL); + vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL); }