]>
Commit | Line | Data |
---|---|---|
47c1c8c1 VP |
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 | ||
a8b991b5 MA |
13 | #ifndef HAX_I386_H |
14 | #define HAX_I386_H | |
47c1c8c1 VP |
15 | |
16 | #include "cpu.h" | |
17 | #include "sysemu/hax.h" | |
18 | ||
b65cc8de | 19 | #ifdef CONFIG_POSIX |
6f805823 VP |
20 | typedef int hax_fd; |
21 | #endif | |
22 | ||
47c1c8c1 VP |
23 | #ifdef CONFIG_WIN32 |
24 | typedef HANDLE hax_fd; | |
25 | #endif | |
26 | ||
27 | extern struct hax_state hax_global; | |
28 | struct hax_vcpu_state { | |
29 | hax_fd fd; | |
30 | int vcpu_id; | |
31 | struct hax_tunnel *tunnel; | |
32 | unsigned char *iobuf; | |
33 | }; | |
34 | ||
35 | struct hax_state { | |
36 | hax_fd fd; /* the global hax device interface */ | |
37 | uint32_t version; | |
38 | struct hax_vm *vm; | |
39 | uint64_t mem_quota; | |
7a5235c9 | 40 | bool supports_64bit_ramblock; |
47c1c8c1 VP |
41 | }; |
42 | ||
43 | #define HAX_MAX_VCPU 0x10 | |
47c1c8c1 VP |
44 | |
45 | struct hax_vm { | |
46 | hax_fd fd; | |
47 | int id; | |
34a09506 W |
48 | int numvcpus; |
49 | struct hax_vcpu_state **vcpus; | |
47c1c8c1 VP |
50 | }; |
51 | ||
52 | #ifdef NEED_CPU_H | |
53 | /* Functions exported to host specific mode */ | |
54 | hax_fd hax_vcpu_get_fd(CPUArchState *env); | |
55 | int valid_hax_tunnel_size(uint16_t size); | |
56 | ||
57 | /* Host specific functions */ | |
58 | int hax_mod_version(struct hax_state *hax, struct hax_module_version *version); | |
59 | int hax_inject_interrupt(CPUArchState *env, int vector); | |
34a09506 | 60 | struct hax_vm *hax_vm_create(struct hax_state *hax, int max_cpus); |
47c1c8c1 VP |
61 | int hax_vcpu_run(struct hax_vcpu_state *vcpu); |
62 | int hax_vcpu_create(int id); | |
63 | int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, | |
64 | int set); | |
65 | int hax_sync_msr(CPUArchState *env, struct hax_msr_data *msrs, int set); | |
66 | int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set); | |
67 | #endif | |
68 | ||
69 | int hax_vm_destroy(struct hax_vm *vm); | |
70 | int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap); | |
71 | int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion); | |
72 | int hax_set_ram(uint64_t start_pa, uint32_t size, uint64_t host_va, int flags); | |
73 | ||
74 | /* Common host function */ | |
75 | int hax_host_create_vm(struct hax_state *hax, int *vm_id); | |
76 | hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id); | |
77 | int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid); | |
78 | hax_fd hax_host_open_vcpu(int vmid, int vcpuid); | |
79 | int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu); | |
80 | hax_fd hax_mod_open(void); | |
81 | void hax_memory_init(void); | |
82 | ||
83 | ||
b65cc8de ASB |
84 | #ifdef CONFIG_POSIX |
85 | #include "target/i386/hax-posix.h" | |
6f805823 VP |
86 | #endif |
87 | ||
47c1c8c1 VP |
88 | #ifdef CONFIG_WIN32 |
89 | #include "target/i386/hax-windows.h" | |
90 | #endif | |
91 | ||
92 | #include "target/i386/hax-interface.h" | |
93 | ||
94 | #endif |