/*
 * QEMU HAXM support
 *
 * Copyright (c) 2011 Intel Corporation
 *  Written by:
 *  Jiang Yunhong<yunhong.jiang@intel.com>
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 *
 */

#ifndef HAX_I386_H
#define HAX_I386_H

#include "cpu.h"
#include "sysemu/hax.h"

#ifdef CONFIG_POSIX
typedef int hax_fd;
#endif

#ifdef CONFIG_WIN32
typedef HANDLE hax_fd;
#endif

extern struct hax_state hax_global;
struct hax_vcpu_state {
    hax_fd fd;
    int vcpu_id;
    struct hax_tunnel *tunnel;
    unsigned char *iobuf;
};

struct hax_state {
    hax_fd fd; /* the global hax device interface */
    uint32_t version;
    struct hax_vm *vm;
    uint64_t mem_quota;
    bool supports_64bit_ramblock;
};

#define HAX_MAX_VCPU 0x10

struct hax_vm {
    hax_fd fd;
    int id;
    int numvcpus;
    struct hax_vcpu_state **vcpus;
};

/* Functions exported to host specific mode */
hax_fd hax_vcpu_get_fd(CPUArchState *env);
int valid_hax_tunnel_size(uint16_t size);

/* Host specific functions */
int hax_mod_version(struct hax_state *hax, struct hax_module_version *version);
int hax_inject_interrupt(CPUArchState *env, int vector);
struct hax_vm *hax_vm_create(struct hax_state *hax, int max_cpus);
int hax_vcpu_run(struct hax_vcpu_state *vcpu);
int hax_vcpu_create(int id);
void hax_kick_vcpu_thread(CPUState *cpu);

int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state,
                        int set);
int hax_sync_msr(CPUArchState *env, struct hax_msr_data *msrs, int set);
int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set);

int hax_vm_destroy(struct hax_vm *vm);
int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap);
int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion);
int hax_set_ram(uint64_t start_pa, uint32_t size, uint64_t host_va, int flags);

/* Common host function */
int hax_host_create_vm(struct hax_state *hax, int *vm_id);
hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id);
int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid);
hax_fd hax_host_open_vcpu(int vmid, int vcpuid);
int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu);
hax_fd hax_mod_open(void);
void hax_memory_init(void);


#ifdef CONFIG_POSIX
#include "hax-posix.h"
#endif

#ifdef CONFIG_WIN32
#include "hax-windows.h"
#endif

#include "hax-interface.h"

#endif
