Skip to content

Commit

Permalink
hw/i386: Make vmmouse helpers static
Browse files Browse the repository at this point in the history
The vmmouse helpers are only used in hw/i386/vmmouse.c,
make them static.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
philmd authored and mstsirkin committed May 4, 2020
1 parent e595112 commit d8a0599
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
22 changes: 21 additions & 1 deletion hw/i386/vmmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "ui/console.h"
#include "hw/i386/pc.h"
#include "hw/input/i8042.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "vmport.h"
#include "cpu.h"

/* debug only vmmouse */
//#define DEBUG_VMMOUSE
Expand Down Expand Up @@ -71,6 +71,26 @@ typedef struct VMMouseState
ISAKBDState *i8042;
} VMMouseState;

static void vmmouse_get_data(uint32_t *data)
{
X86CPU *cpu = X86_CPU(current_cpu);
CPUX86State *env = &cpu->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];
}

static void vmmouse_set_data(const uint32_t *data)
{
X86CPU *cpu = X86_CPU(current_cpu);
CPUX86State *env = &cpu->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 uint32_t vmmouse_get_status(VMMouseState *s)
{
DPRINTF("vmmouse_get_status()\n");
Expand Down
23 changes: 1 addition & 22 deletions hw/i386/vmport.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
*/
#include "qemu/osdep.h"
#include "hw/isa/isa.h"
#include "hw/i386/pc.h"
#include "sysemu/hw_accel.h"
#include "qemu/log.h"
#include "vmport.h"
#include "cpu.h"
#include "trace.h"

#define VMPORT_CMD_GETVERSION 0x0a
Expand Down Expand Up @@ -109,27 +109,6 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
return ram_size;
}

/* vmmouse helpers */
void vmmouse_get_data(uint32_t *data)
{
X86CPU *cpu = X86_CPU(current_cpu);
CPUX86State *env = &cpu->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)
{
X86CPU *cpu = X86_CPU(current_cpu);
CPUX86State *env = &cpu->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 const MemoryRegionOps vmport_ops = {
.read = vmport_ioport_read,
.write = vmport_ioport_write,
Expand Down
4 changes: 0 additions & 4 deletions include/hw/i386/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ typedef struct PCMachineClass {

GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled);

/* vmport.c */
void vmmouse_get_data(uint32_t *data);
void vmmouse_set_data(const uint32_t *data);

/* pc.c */
extern int fd_bootchk;

Expand Down

0 comments on commit d8a0599

Please sign in to comment.