Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Commit eb55883

Browse files
committed
Unified IOCTL definitions
- Centralizing ioctl definitions in hax_interface.h, and adding __LEGACY suffix to previous platform-specific definitions. - Removed previously deprecated ioctls: HAX_VM_IOCTL_VCPU_CREATE_ORIG and HAX_VCPU_IOCTL_KICKOFF. Removed underlying functions, if any. - Deprecated HAX_VM_IOCTL_NOTIFY_QEMU_VERSION, and turned into a no-op ioctl. Signed-off-by: Alexandro Sanchez Bach <[email protected]>
1 parent 6cbfdc4 commit eb55883

File tree

15 files changed

+224
-239
lines changed

15 files changed

+224
-239
lines changed

core/include/hax_core_interface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ struct vm_t * hax_get_vm(int vm_id, int refer);
8989
int hax_vm_core_open(struct vm_t *vm);
9090
/* Corresponding hax_get_vm with refer == 1 */
9191
int hax_put_vm(struct vm_t *vm);
92-
int hax_vm_set_qemuversion(struct vm_t *vm, struct hax_qemu_version *ver);
9392

9493
struct vm_t * hax_create_vm(int *vm_id);
9594
int hax_teardown_vm(struct vm_t *vm);

core/include/vcpu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ int hax_vm_create_host(struct vm_t *cvm, int vm_id);
274274

275275
int vcpu_pause(struct vcpu_t *vcpu);
276276
int vcpu_unpause(struct vcpu_t *vcpu);
277-
int vcpu_takeoff(struct vcpu_t *vcpu);
278277

279278
void *vcpu_vmcs_va(struct vcpu_t *vcpu);
280279
paddr_t vcpu_vmcs_pa(struct vcpu_t *vcpu);

core/include/vm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ struct vm_t {
6060
#define VM_STATE_FLAGS_OPENED 0x1
6161
#define VM_STATE_FLAGS_MEM_ALLOC 0x2
6262
uint64_t flags;
63-
#define VM_FEATURES_FASTMMIO_BASIC 0x1
64-
#define VM_FEATURES_FASTMMIO_EXTRA 0x2
65-
uint32_t features;
6663
int vm_id;
6764
#define VPID_SEED_BITS 64
6865
uint8_t vpid_seed[VPID_SEED_BITS / 8];

core/vcpu.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,20 +2053,6 @@ static void vcpu_exit_fpu_state(struct vcpu_t *vcpu)
20532053
// http://wiki.osdev.org/X86-64_Instruction_Encoding
20542054
#define INSTR_MAX_LEN 15
20552055

2056-
static bool qemu_support_fastmmio(struct vcpu_t *vcpu)
2057-
{
2058-
struct vm_t *vm = vcpu->vm;
2059-
2060-
return vm->features & VM_FEATURES_FASTMMIO_BASIC;
2061-
}
2062-
2063-
static bool qemu_support_fastmmio_extra(struct vcpu_t *vcpu)
2064-
{
2065-
struct vm_t *vm = vcpu->vm;
2066-
2067-
return vm->features & VM_FEATURES_FASTMMIO_EXTRA;
2068-
}
2069-
20702056
static bool is_mmio_address(struct vcpu_t *vcpu, paddr_t gpa)
20712057
{
20722058
paddr_t hpa;
@@ -4168,23 +4154,6 @@ int vcpu_pause(struct vcpu_t *vcpu)
41684154
return 0;
41694155
}
41704156

4171-
int vcpu_takeoff(struct vcpu_t *vcpu)
4172-
{
4173-
int cpu_id;
4174-
hax_cpumap_t targets;
4175-
4176-
// Don't change the sequence unless you are sure
4177-
if (vcpu->is_running) {
4178-
cpu_id = vcpu->cpu_id;
4179-
assert(cpu_id != hax_cpuid());
4180-
targets = cpu2cpumap(cpu_id);
4181-
// If not considering Windows XP, definitely we don't need this
4182-
hax_smp_call_function(&targets, _vcpu_take_off, NULL);
4183-
}
4184-
4185-
return 0;
4186-
}
4187-
41884157
int vcpu_unpause(struct vcpu_t *vcpu)
41894158
{
41904159
vcpu->paused = 0;

core/vm.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,6 @@ static int valid_vm_mid(int vm_id)
6767
return (vm_id >= 0) && (vm_id < VM_MID_BIT);
6868
}
6969

70-
int hax_vm_set_qemuversion(struct vm_t *vm, struct hax_qemu_version *ver)
71-
{
72-
if (ver->cur_version >= 0x2) {
73-
vm->features |= VM_FEATURES_FASTMMIO_BASIC;
74-
if (ver->cur_version >= 0x4) {
75-
vm->features |= VM_FEATURES_FASTMMIO_EXTRA;
76-
}
77-
}
78-
return 0;
79-
}
80-
8170
uint64_t vm_get_eptp(struct vm_t *vm)
8271
{
8372
uint64_t eptp_value;

docs/api.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -345,24 +345,7 @@ and its presence requires `va` to be set to 0.
345345
* Error codes:
346346
* `STATUS_INVALID_PARAMETER` (Windows): The input buffer provided by the
347347
caller is smaller than the size of `struct hax_set_ram_info`, or any of the
348-
input parameters .
349-
350-
#### HAX\_VM\_IOCTL\_NOTIFY\_QEMU\_VERSION
351-
TODO: Describe
352-
353-
* Since: API v2
354-
* Parameter: `struct hax_qemu_version qversion`, where
355-
```
356-
struct hax_qemu_version {
357-
uint32_t cur_version;
358-
uint32_t least_version;
359-
} __attribute__ ((__packed__));
360-
```
361-
* (Input) `cur_version`:
362-
* (Input) `least_version`:
363-
* Error codes:
364-
* `STATUS_INVALID_PARAMETER` (Windows): The input buffer provided by the
365-
caller is smaller than the size of `struct hax_qemu_version`.
348+
input parameters.
366349

367350
### VCPU IOCTLs
368351
#### HAX\_VCPU\_IOCTL\_SETUP\_TUNNEL

include/darwin/hax_interface_mac.h

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,21 @@
3333

3434
#include <mach/mach_types.h>
3535

36-
/* The mac specific interface to qemu because of mac's
37-
* special handling like hax tunnel allocation etc */
38-
/* HAX model level ioctl */
39-
#define HAX_IOCTL_VERSION _IOWR(0, 0x20, struct hax_module_version)
40-
#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, uint32_t)
41-
#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, uint32_t)
42-
#define HAX_IOCTL_CAPABILITY _IOR(0, 0x23, struct hax_capabilityinfo)
43-
#define HAX_IOCTL_SET_MEMLIMIT _IOWR(0, 0x24, struct hax_set_memlimit)
44-
45-
// Only for backward compatibility with old Qemu.
46-
#define HAX_VM_IOCTL_VCPU_CREATE_ORIG _IOR(0, 0x80, int)
47-
48-
#define HAX_VM_IOCTL_VCPU_CREATE _IOWR(0, 0x80, uint32_t)
49-
#define HAX_VM_IOCTL_ALLOC_RAM _IOWR(0, 0x81, struct hax_alloc_ram_info)
50-
#define HAX_VM_IOCTL_SET_RAM _IOWR(0, 0x82, struct hax_set_ram_info)
51-
#define HAX_VM_IOCTL_VCPU_DESTROY _IOR(0, 0x83, uint32_t)
52-
#define HAX_VM_IOCTL_ADD_RAMBLOCK _IOW(0, 0x85, struct hax_ramblock_info)
53-
#define HAX_VM_IOCTL_SET_RAM2 _IOWR(0, 0x86, struct hax_set_ram_info2)
54-
#define HAX_VM_IOCTL_PROTECT_RAM _IOWR(0, 0x87, struct hax_protect_ram_info)
55-
56-
#define HAX_VCPU_IOCTL_RUN _IO(0, 0xc0)
57-
#define HAX_VCPU_IOCTL_SET_MSRS _IOWR(0, 0xc1, struct hax_msr_data)
58-
#define HAX_VCPU_IOCTL_GET_MSRS _IOWR(0, 0xc2, struct hax_msr_data)
59-
60-
#define HAX_VCPU_IOCTL_SET_FPU _IOW(0, 0xc3, struct fx_layout)
61-
#define HAX_VCPU_IOCTL_GET_FPU _IOR(0, 0xc4, struct fx_layout)
62-
63-
#define HAX_VCPU_IOCTL_SETUP_TUNNEL _IOWR(0, 0xc5, struct hax_tunnel_info)
64-
#define HAX_VCPU_IOCTL_INTERRUPT _IOWR(0, 0xc6, uint32_t)
65-
#define HAX_VCPU_IOCTL_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
66-
#define HAX_VCPU_IOCTL_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)
67-
68-
/* API 2.0 */
69-
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)
70-
71-
#define HAX_VCPU_IOCTL_DEBUG _IOW(0, 0xc9, struct hax_debug_t)
36+
#define HAX_IOCTL_GROUP 'H'
37+
38+
#define HAX_IOCTL_HAX_IO(code, type) \
39+
_IO(HAX_IOCTL_GROUP, code)
40+
#define HAX_IOCTL_HAX_IOR(code, type) \
41+
_IOR(HAX_IOCTL_GROUP, code, type)
42+
#define HAX_IOCTL_HAX_IOW(code, type) \
43+
_IOW(HAX_IOCTL_GROUP, code, type)
44+
#define HAX_IOCTL_HAX_IOWR(code, type) \
45+
_IOWR(HAX_IOCTL_GROUP, code, type)
46+
47+
#define HAX_LEGACY_IOCTL(access, code_posix, code_windows, type) \
48+
HAX_IOCTL_##access(code_posix, type)
49+
#define HAX_IOCTL(access, code, type) \
50+
HAX_IOCTL_##access(code, type)
7251

7352
#define HAX_KERNEL64_CS 0x80
7453
#define HAX_KERNEL32_CS 0x08

include/hax_interface.h

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,124 @@
4949
#include "windows/hax_interface_windows.h"
5050
#endif
5151

52+
#define HAX_IOCTL_PLATFORM 0x40
53+
#define HAX_IOCTL_EXTENSION 0x80
54+
55+
/* Legacy API
56+
* TODO: Remove all legacy calls after grace period (2020-01-01).
57+
*/
58+
#define HAX_IOCTL_VERSION__LEGACY \
59+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x20, 0x900, struct hax_module_version)
60+
#define HAX_IOCTL_CREATE_VM__LEGACY \
61+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x21, 0x901, uint32_t)
62+
#define HAX_IOCTL_DESTROY_VM__LEGACY \
63+
HAX_LEGACY_IOCTL(HAX_IOW, 0x22, 0x902, uint32_t)
64+
#define HAX_IOCTL_CAPABILITY__LEGACY \
65+
HAX_LEGACY_IOCTL(HAX_IOR, 0x23, 0x910, struct hax_capabilityinfo)
66+
#define HAX_IOCTL_SET_MEMLIMIT__LEGACY \
67+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x24, 0x911, struct hax_set_memlimit)
68+
69+
#define HAX_VM_IOCTL_VCPU_CREATE__LEGACY \
70+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x80, 0x902, uint32_t)
71+
#define HAX_VM_IOCTL_ALLOC_RAM__LEGACY \
72+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x81, 0x903, struct hax_alloc_ram_info)
73+
#define HAX_VM_IOCTL_SET_RAM__LEGACY \
74+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x82, 0x904, struct hax_set_ram_info)
75+
#define HAX_VM_IOCTL_VCPU_DESTROY__LEGACY \
76+
HAX_LEGACY_IOCTL(HAX_IOR, 0x83, 0x905, uint32_t)
77+
#define HAX_VM_IOCTL_ADD_RAMBLOCK__LEGACY \
78+
HAX_LEGACY_IOCTL(HAX_IOW, 0x85, 0x913, struct hax_ramblock_info)
79+
#define HAX_VM_IOCTL_SET_RAM2__LEGACY \
80+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x86, 0x914, struct hax_set_ram_info2)
81+
#define HAX_VM_IOCTL_PROTECT_RAM__LEGACY \
82+
HAX_LEGACY_IOCTL(HAX_IOWR, 0x87, 0x915, struct hax_protect_ram_info)
83+
84+
#define HAX_VCPU_IOCTL_RUN__LEGACY \
85+
HAX_LEGACY_IOCTL(HAX_IO, 0xc0, 0x906, HAX_UNUSED)
86+
#define HAX_VCPU_IOCTL_SETUP_TUNNEL__LEGACY \
87+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc5, 0x90b, struct hax_tunnel_info)
88+
#define HAX_VCPU_IOCTL_GET_REGS__LEGACY \
89+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc8, 0x90e, struct vcpu_state_t)
90+
#define HAX_VCPU_IOCTL_SET_REGS__LEGACY \
91+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc7, 0x90d, struct vcpu_state_t)
92+
#define HAX_VCPU_IOCTL_GET_FPU__LEGACY \
93+
HAX_LEGACY_IOCTL(HAX_IOR, 0xc4, 0x90a, struct fx_layout)
94+
#define HAX_VCPU_IOCTL_SET_FPU__LEGACY \
95+
HAX_LEGACY_IOCTL(HAX_IOW, 0xc3, 0x909, struct fx_layout)
96+
#define HAX_VCPU_IOCTL_GET_MSRS__LEGACY \
97+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc2, 0x908, struct hax_msr_data)
98+
#define HAX_VCPU_IOCTL_SET_MSRS__LEGACY \
99+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc1, 0x907, struct hax_msr_data)
100+
#define HAX_VCPU_IOCTL_INTERRUPT__LEGACY \
101+
HAX_LEGACY_IOCTL(HAX_IOWR, 0xc6, 0x90c, uint32_t)
102+
103+
// API 2.0
104+
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION__LEGACY \
105+
HAX_LEGACY_IOCTL(HAX_IOW, 0x84, 0x910, struct hax_qemu_version)
106+
#define HAX_VCPU_IOCTL_DEBUG__LEGACY \
107+
HAX_LEGACY_IOCTL(HAX_IOW, 0xc9, 0x916, struct hax_debug_t)
108+
109+
/* API
110+
* ===
111+
* Each platform generates their own IOCTL-value by using the macro
112+
* HAX_IOCTL(access, code, type) with the following arguments:
113+
* - access: Arguments usage from userland perspective.
114+
* - HAX_IO: Driver ignores user arguments.
115+
* - HAX_IOR: Driver writes user arguments (read by user).
116+
* - HAX_IOW: Driver reads user arguments (written by user).
117+
* - HAX_IOWR: Driver reads+writes user arguments (written+read by user).
118+
* - code: Sequential number in range 0x00-0x3F, and maskable via:
119+
* - HAX_IOCTL_PLATFORM (0x40) Platform-specific ioctl.
120+
* - HAX_IOCTL_EXTENSION (0x80) Extension-specific ioctl.
121+
* - type: User argument type.
122+
*/
123+
#define HAX_IOCTL_VERSION \
124+
HAX_IOCTL(HAX_IOWR, 0x00, struct hax_module_version)
125+
#define HAX_IOCTL_CREATE_VM \
126+
HAX_IOCTL(HAX_IOWR, 0x01, uint32_t)
127+
#define HAX_IOCTL_DESTROY_VM \
128+
HAX_IOCTL(HAX_IOW, 0x02, uint32_t)
129+
#define HAX_IOCTL_CAPABILITY \
130+
HAX_IOCTL(HAX_IOR, 0x03, struct hax_capabilityinfo)
131+
#define HAX_IOCTL_SET_MEMLIMIT \
132+
HAX_IOCTL(HAX_IOWR, 0x04, struct hax_set_memlimit)
133+
134+
#define HAX_VM_IOCTL_VCPU_CREATE \
135+
HAX_IOCTL(HAX_IOWR, 0x00, uint32_t)
136+
#define HAX_VM_IOCTL_ALLOC_RAM \
137+
HAX_IOCTL(HAX_IOWR, 0x01, struct hax_alloc_ram_info)
138+
#define HAX_VM_IOCTL_SET_RAM \
139+
HAX_IOCTL(HAX_IOWR, 0x02, struct hax_set_ram_info)
140+
#define HAX_VM_IOCTL_VCPU_DESTROY \
141+
HAX_IOCTL(HAX_IOR, 0x03, uint32_t)
142+
#define HAX_VM_IOCTL_ADD_RAMBLOCK \
143+
HAX_IOCTL(HAX_IOW, 0x04, struct hax_ramblock_info)
144+
#define HAX_VM_IOCTL_SET_RAM2 \
145+
HAX_IOCTL(HAX_IOWR, 0x05, struct hax_set_ram_info2)
146+
#define HAX_VM_IOCTL_PROTECT_RAM \
147+
HAX_IOCTL(HAX_IOWR, 0x06, struct hax_protect_ram_info)
148+
149+
#define HAX_VCPU_IOCTL_RUN \
150+
HAX_IOCTL(HAX_IO, 0x00, HAX_UNUSED)
151+
#define HAX_VCPU_IOCTL_SETUP_TUNNEL \
152+
HAX_IOCTL(HAX_IOWR, 0x01, struct hax_tunnel_info)
153+
#define HAX_VCPU_IOCTL_GET_REGS \
154+
HAX_IOCTL(HAX_IOWR, 0x02, struct vcpu_state_t)
155+
#define HAX_VCPU_IOCTL_SET_REGS \
156+
HAX_IOCTL(HAX_IOWR, 0x03, struct vcpu_state_t)
157+
#define HAX_VCPU_IOCTL_GET_FPU \
158+
HAX_IOCTL(HAX_IOR, 0x04, struct fx_layout)
159+
#define HAX_VCPU_IOCTL_SET_FPU \
160+
HAX_IOCTL(HAX_IOW, 0x05, struct fx_layout)
161+
#define HAX_VCPU_IOCTL_GET_MSRS \
162+
HAX_IOCTL(HAX_IOWR, 0x06, struct hax_msr_data)
163+
#define HAX_VCPU_IOCTL_SET_MSRS \
164+
HAX_IOCTL(HAX_IOWR, 0x07, struct hax_msr_data)
165+
#define HAX_VCPU_IOCTL_INTERRUPT \
166+
HAX_IOCTL(HAX_IOWR, 0x08, uint32_t)
167+
#define HAX_VCPU_IOCTL_DEBUG \
168+
HAX_IOCTL(HAX_IOW, 0x09, struct hax_debug_t)
169+
52170
#include "vcpu_state.h"
53171

54172
struct vmx_msr {
@@ -262,6 +380,7 @@ struct hax_set_ram_info2 {
262380
// All accesses (R/W/X) are allowed
263381
#define HAX_RAM_PERM_RWX 0x7
264382
#define HAX_RAM_PERM_MASK 0x7
383+
265384
struct hax_protect_ram_info {
266385
uint64_t pa_start;
267386
uint64_t size;

include/linux/hax_interface_linux.h

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,21 @@
3434

3535
#include <asm/ioctl.h>
3636

37-
/* The mac specific interface to qemu because of mac's
38-
* special handling like hax tunnel allocation etc */
39-
/* HAX model level ioctl */
40-
#define HAX_IOCTL_VERSION _IOWR(0, 0x20, struct hax_module_version)
41-
#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, uint32_t)
42-
#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, uint32_t)
43-
#define HAX_IOCTL_CAPABILITY _IOR(0, 0x23, struct hax_capabilityinfo)
44-
#define HAX_IOCTL_SET_MEMLIMIT _IOWR(0, 0x24, struct hax_set_memlimit)
45-
46-
// Only for backward compatibility with old Qemu.
47-
#define HAX_VM_IOCTL_VCPU_CREATE_ORIG _IOR(0, 0x80, int)
48-
49-
#define HAX_VM_IOCTL_VCPU_CREATE _IOWR(0, 0x80, uint32_t)
50-
#define HAX_VM_IOCTL_ALLOC_RAM _IOWR(0, 0x81, struct hax_alloc_ram_info)
51-
#define HAX_VM_IOCTL_SET_RAM _IOWR(0, 0x82, struct hax_set_ram_info)
52-
#define HAX_VM_IOCTL_VCPU_DESTROY _IOR(0, 0x83, uint32_t)
53-
#define HAX_VM_IOCTL_ADD_RAMBLOCK _IOW(0, 0x85, struct hax_ramblock_info)
54-
#define HAX_VM_IOCTL_SET_RAM2 _IOWR(0, 0x86, struct hax_set_ram_info2)
55-
#define HAX_VM_IOCTL_PROTECT_RAM _IOWR(0, 0x87, struct hax_protect_ram_info)
56-
57-
#define HAX_VCPU_IOCTL_RUN _IO(0, 0xc0)
58-
#define HAX_VCPU_IOCTL_SET_MSRS _IOWR(0, 0xc1, struct hax_msr_data)
59-
#define HAX_VCPU_IOCTL_GET_MSRS _IOWR(0, 0xc2, struct hax_msr_data)
60-
61-
#define HAX_VCPU_IOCTL_SET_FPU _IOW(0, 0xc3, struct fx_layout)
62-
#define HAX_VCPU_IOCTL_GET_FPU _IOR(0, 0xc4, struct fx_layout)
63-
64-
#define HAX_VCPU_IOCTL_SETUP_TUNNEL _IOWR(0, 0xc5, struct hax_tunnel_info)
65-
#define HAX_VCPU_IOCTL_INTERRUPT _IOWR(0, 0xc6, uint32_t)
66-
#define HAX_VCPU_IOCTL_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
67-
#define HAX_VCPU_IOCTL_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)
68-
69-
/* API 2.0 */
70-
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)
71-
72-
#define HAX_VCPU_IOCTL_DEBUG _IOW(0, 0xc9, struct hax_debug_t)
37+
#define HAX_DEVICE_TYPE 'H'
38+
39+
#define HAX_IOCTL_HAX_IO(code, type) \
40+
_IO(HAX_DEVICE_TYPE, code)
41+
#define HAX_IOCTL_HAX_IOR(code, type) \
42+
_IOR(HAX_DEVICE_TYPE, code, type)
43+
#define HAX_IOCTL_HAX_IOW(code, type) \
44+
_IOW(HAX_DEVICE_TYPE, code, type)
45+
#define HAX_IOCTL_HAX_IOWR(code, type) \
46+
_IOWR(HAX_DEVICE_TYPE, code, type)
47+
48+
#define HAX_LEGACY_IOCTL(access, code_posix, code_windows, type) \
49+
HAX_IOCTL_##access(code_posix, type)
50+
#define HAX_IOCTL(access, code, type) \
51+
HAX_IOCTL_##access(code, type)
7352

7453
#define HAX_KERNEL64_CS 0x80
7554
#define HAX_KERNEL32_CS 0x08

include/windows/hax_interface_windows.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
#ifndef HAX_WINDOWS_HAX_INTERFACE_WINDOWS_H_
3232
#define HAX_WINDOWS_HAX_INTERFACE_WINDOWS_H_
3333

34+
#define HAX_DEVICE_TYPE 0x8000
35+
36+
#define HAX_LEGACY_IOCTL(access, code_posix, code_windows, type) \
37+
CTL_CODE(0x4000, code, METHOD_BUFFERED, FILE_ANY_ACCESS)
38+
#define HAX_IOCTL(access, code, type) \
39+
CTL_CODE(HAX_DEVICE_TYPE, (0x800 | code), METHOD_BUFFERED, FILE_ANY_ACCESS)
40+
3441
/*
3542
* This is for MAC compatible mode, so should not be used
3643
* But how can we make sure it is really not used??

0 commit comments

Comments
 (0)