]> git.proxmox.com Git - mirror_qemu.git/blob - target/i386/hax-i386.h
target/i386: Add Intel HAX files
[mirror_qemu.git] / target / i386 / hax-i386.h
1 /*
2 * QEMU HAXM support
3 *
4 * Copyright (c) 2011 Intel Corporation
5 * Written by:
6 * Jiang Yunhong<yunhong.jiang@intel.com>
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
10 *
11 */
12
13 #ifndef _HAX_I386_H
14 #define _HAX_I386_H
15
16 #include "cpu.h"
17 #include "sysemu/hax.h"
18
19 #ifdef CONFIG_WIN32
20 typedef HANDLE hax_fd;
21 #endif
22
23 extern struct hax_state hax_global;
24 struct hax_vcpu_state {
25 hax_fd fd;
26 int vcpu_id;
27 struct hax_tunnel *tunnel;
28 unsigned char *iobuf;
29 };
30
31 struct hax_state {
32 hax_fd fd; /* the global hax device interface */
33 uint32_t version;
34 struct hax_vm *vm;
35 uint64_t mem_quota;
36 };
37
38 #define HAX_MAX_VCPU 0x10
39 #define MAX_VM_ID 0x40
40 #define MAX_VCPU_ID 0x40
41
42 struct hax_vm {
43 hax_fd fd;
44 int id;
45 struct hax_vcpu_state *vcpus[HAX_MAX_VCPU];
46 };
47
48 #ifdef NEED_CPU_H
49 /* Functions exported to host specific mode */
50 hax_fd hax_vcpu_get_fd(CPUArchState *env);
51 int valid_hax_tunnel_size(uint16_t size);
52
53 /* Host specific functions */
54 int hax_mod_version(struct hax_state *hax, struct hax_module_version *version);
55 int hax_inject_interrupt(CPUArchState *env, int vector);
56 struct hax_vm *hax_vm_create(struct hax_state *hax);
57 int hax_vcpu_run(struct hax_vcpu_state *vcpu);
58 int hax_vcpu_create(int id);
59 int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state,
60 int set);
61 int hax_sync_msr(CPUArchState *env, struct hax_msr_data *msrs, int set);
62 int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set);
63 #endif
64
65 int hax_vm_destroy(struct hax_vm *vm);
66 int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap);
67 int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion);
68 int hax_set_ram(uint64_t start_pa, uint32_t size, uint64_t host_va, int flags);
69
70 /* Common host function */
71 int hax_host_create_vm(struct hax_state *hax, int *vm_id);
72 hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id);
73 int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid);
74 hax_fd hax_host_open_vcpu(int vmid, int vcpuid);
75 int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu);
76 hax_fd hax_mod_open(void);
77 void hax_memory_init(void);
78
79
80 #ifdef CONFIG_WIN32
81 #include "target/i386/hax-windows.h"
82 #endif
83
84 #include "target/i386/hax-interface.h"
85
86 #endif