Commit 26fb5e48d9b4ab676b7b78e0f38e8e4ed126f047

Authored by aurel32
1 parent 4ce7ff6e

Fix vmmouse with -smp


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4165 c046a42c-6fe2-441c-8c8c-71466251a162
... ... @@ -748,9 +748,10 @@ static void pc_init1(int ram_size, int vga_ram_size,
748 748 if (pci_enabled) {
749 749 apic_init(env);
750 750 }
751   - vmport_init(env);
752 751 }
753 752  
  753 + vmport_init();
  754 +
754 755 /* allocate RAM */
755 756 ram_addr = qemu_ram_alloc(ram_size);
756 757 cpu_register_physical_memory(0, ram_size, ram_addr);
... ...
... ... @@ -59,7 +59,7 @@ int pit_get_mode(PITState *pit, int channel);
59 59 int pit_get_out(PITState *pit, int channel, int64_t current_time);
60 60  
61 61 /* vmport.c */
62   -void vmport_init(CPUState *env);
  62 +void vmport_init(void);
63 63 void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque);
64 64  
65 65 /* vmmouse.c */
... ...
hw/vmport.c
... ... @@ -34,7 +34,6 @@
34 34  
35 35 typedef struct _VMPortState
36 36 {
37   - CPUState *env;
38 37 IOPortReadFunc *func[VMPORT_ENTRIES];
39 38 void *opaque[VMPORT_ENTRIES];
40 39 } VMPortState;
... ... @@ -53,14 +52,15 @@ void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque)
53 52 static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
54 53 {
55 54 VMPortState *s = opaque;
  55 + CPUState *env = cpu_single_env;
56 56 unsigned char command;
57 57 uint32_t eax;
58 58  
59   - eax = s->env->regs[R_EAX];
  59 + eax = env->regs[R_EAX];
60 60 if (eax != VMPORT_MAGIC)
61 61 return eax;
62 62  
63   - command = s->env->regs[R_ECX];
  63 + command = env->regs[R_ECX];
64 64 if (command >= VMPORT_ENTRIES)
65 65 return eax;
66 66 if (!s->func[command])
... ... @@ -74,25 +74,23 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
74 74  
75 75 static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr)
76 76 {
77   - CPUState *env = opaque;
  77 + CPUState *env = cpu_single_env;
78 78 env->regs[R_EBX] = VMPORT_MAGIC;
79 79 return 6;
80 80 }
81 81  
82 82 static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
83 83 {
84   - CPUState *env = opaque;
  84 + CPUState *env = cpu_single_env;
85 85 env->regs[R_EBX] = 0x1177;
86 86 return ram_size;
87 87 }
88 88  
89   -void vmport_init(CPUState *env)
  89 +void vmport_init(void)
90 90 {
91   - port_state.env = env;
92   -
93 91 register_ioport_read(0x5658, 1, 4, vmport_ioport_read, &port_state);
94 92  
95 93 /* Register some generic port commands */
96   - vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, env);
97   - vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, env);
  94 + vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
  95 + vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
98 96 }
... ...