aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-02-05 14:34:52 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-02-12 09:43:44 +0000
commit86d864140bc597dce0fedf8547f4d615a920c444 (patch)
tree02dd6fbfc5cf10e0eca8bd614b54bd0ea59e065b /hw
parent86f4a9a5c7f1d98b73520ff9f396206ebc5ddb71 (diff)
x86: make vmmouse optional
Compile vmmouse in hwlib. Ignore failure if vmmouse device can't be created. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/pc.c6
-rw-r--r--hw/pc.h2
-rw-r--r--hw/vmmouse.c24
-rw-r--r--hw/vmport.c19
4 files changed, 25 insertions, 26 deletions
diff --git a/hw/pc.c b/hw/pc.c
index cde20c06da..00fe04e9d7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1134,8 +1134,10 @@ void pc_basic_device_init(qemu_irq *isa_irq,
i8042 = isa_create_simple("i8042");
i8042_setup_a20_line(i8042, &a20_line[0]);
vmport_init();
- vmmouse = isa_create("vmmouse");
- qdev_prop_set_ptr(&vmmouse->qdev, "ps2_mouse", i8042);
+ vmmouse = isa_try_create("vmmouse");
+ if (vmmouse) {
+ qdev_prop_set_ptr(&vmmouse->qdev, "ps2_mouse", i8042);
+ }
port92 = isa_create_simple("port92");
port92_init(port92, &a20_line[1]);
diff --git a/hw/pc.h b/hw/pc.h
index 3ae1462dd4..d5d2f42f96 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -70,6 +70,8 @@ static inline void vmport_init(void)
isa_create_simple("vmport");
}
void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque);
+void vmmouse_get_data(uint32_t *data);
+void vmmouse_set_data(const uint32_t *data);
/* pckbd.c */
diff --git a/hw/vmmouse.c b/hw/vmmouse.c
index 3b39144873..11b125c7af 100644
--- a/hw/vmmouse.c
+++ b/hw/vmmouse.c
@@ -178,30 +178,6 @@ static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size)
memmove(s->queue, &s->queue[size], sizeof(s->queue[0]) * s->nb_queue);
}
-static void vmmouse_get_data(uint32_t *data)
-{
- CPUState *env = cpu_single_env;
-
- data[0] = env->regs[R_EAX]; data[1] = env->regs[R_EBX];
- data[2] = env->regs[R_ECX]; data[3] = env->regs[R_EDX];
- data[4] = env->regs[R_ESI]; data[5] = env->regs[R_EDI];
-
- DPRINTF("get_data = {%x, %x, %x, %x, %x, %x}\n",
- data[0], data[1], data[2], data[3], data[4], data[5]);
-}
-
-static void vmmouse_set_data(const uint32_t *data)
-{
- CPUState *env = cpu_single_env;
-
- DPRINTF("set_data = {%x, %x, %x, %x, %x, %x}\n",
- data[0], data[1], data[2], data[3], data[4], data[5]);
-
- env->regs[R_EAX] = data[0]; env->regs[R_EBX] = data[1];
- env->regs[R_ECX] = data[2]; env->regs[R_EDX] = data[3];
- env->regs[R_ESI] = data[4]; env->regs[R_EDI] = data[5];
-}
-
static uint32_t vmmouse_ioport_read(void *opaque, uint32_t addr)
{
VMMouseState *s = opaque;
diff --git a/hw/vmport.c b/hw/vmport.c
index 4432be02f7..292d78ffb4 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -102,6 +102,25 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
return ram_size;
}
+/* vmmouse helpers */
+void vmmouse_get_data(uint32_t *data)
+{
+ CPUState *env = cpu_single_env;
+
+ data[0] = env->regs[R_EAX]; data[1] = env->regs[R_EBX];
+ data[2] = env->regs[R_ECX]; data[3] = env->regs[R_EDX];
+ data[4] = env->regs[R_ESI]; data[5] = env->regs[R_EDI];
+}
+
+void vmmouse_set_data(const uint32_t *data)
+{
+ CPUState *env = cpu_single_env;
+
+ env->regs[R_EAX] = data[0]; env->regs[R_EBX] = data[1];
+ env->regs[R_ECX] = data[2]; env->regs[R_EDX] = data[3];
+ env->regs[R_ESI] = data[4]; env->regs[R_EDI] = data[5];
+}
+
static int vmport_initfn(ISADevice *dev)
{
VMPortState *s = DO_UPCAST(VMPortState, dev, dev);