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

Commit

Permalink
Make VCPU ioctl naming consistent
Browse files Browse the repository at this point in the history
- The *DEBUG ioctl of VCPU devices was accidentally declared with a `HAX_IOCTL_VCPU_` prefix, not with the de-facto standard `HAX_VCPU_IOCTL_` prefix. This has been corrected.

- The *GET_REGS, *SET_REGS ioctls of VCPU devices were declared with the `HAX_VCPU_`, not `HAX_VCPU_IOCTL_`. This has been corrected.
  • Loading branch information
AlexAltea committed Nov 8, 2018
1 parent 2d7fa8b commit 6bebba6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ caller is smaller than the size of `struct vcpu_state_t`.
TODO: Describe

* Since: API v1
* Parameter: `struct vcpu_state_t regs` (q.v. `HAX_VCPU_SET_REGS`)
* Parameter: `struct vcpu_state_t regs` (q.v. `HAX_VCPU_IOCTL_SET_REGS`)
* (Output) `regs`:
* Error codes:
* `STATUS_INVALID_PARAMETER` (Windows): The output buffer provided by the
Expand Down
6 changes: 3 additions & 3 deletions include/darwin/hax_interface_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@

#define HAX_VCPU_IOCTL_SETUP_TUNNEL _IOWR(0, 0xc5, struct hax_tunnel_info)
#define HAX_VCPU_IOCTL_INTERRUPT _IOWR(0, 0xc6, uint32_t)
#define HAX_VCPU_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
#define HAX_VCPU_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)
#define HAX_VCPU_IOCTL_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
#define HAX_VCPU_IOCTL_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)

/* API 2.0 */
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)

#define HAX_IOCTL_VCPU_DEBUG _IOW(0, 0xc9, struct hax_debug_t)
#define HAX_VCPU_IOCTL_DEBUG _IOW(0, 0xc9, struct hax_debug_t)

#define HAX_KERNEL64_CS 0x80
#define HAX_KERNEL32_CS 0x08
Expand Down
6 changes: 3 additions & 3 deletions include/linux/hax_interface_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@

#define HAX_VCPU_IOCTL_SETUP_TUNNEL _IOWR(0, 0xc5, struct hax_tunnel_info)
#define HAX_VCPU_IOCTL_INTERRUPT _IOWR(0, 0xc6, uint32_t)
#define HAX_VCPU_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
#define HAX_VCPU_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)
#define HAX_VCPU_IOCTL_SET_REGS _IOWR(0, 0xc7, struct vcpu_state_t)
#define HAX_VCPU_IOCTL_GET_REGS _IOWR(0, 0xc8, struct vcpu_state_t)

/* API 2.0 */
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)

#define HAX_IOCTL_VCPU_DEBUG _IOW(0, 0xc9, struct hax_debug_t)
#define HAX_VCPU_IOCTL_DEBUG _IOW(0, 0xc9, struct hax_debug_t)

#define HAX_KERNEL64_CS 0x80
#define HAX_KERNEL32_CS 0x08
Expand Down
10 changes: 5 additions & 5 deletions platforms/darwin/com_intel_hax_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ static int hax_vcpu_ioctl(dev_t dev, ulong cmd, caddr_t data, int flag,
ret = vcpu_get_fpu(mvcpu2cvcpu(vcpu), fl);
break;
}
case HAX_VCPU_SET_REGS: {
case HAX_VCPU_IOCTL_SET_REGS: {
struct vcpu_state_t *vc_state;
vc_state = (struct vcpu_state_t *)data;
ret = vcpu_set_regs(mvcpu2cvcpu(vcpu), vc_state);
break;
}
case HAX_VCPU_GET_REGS: {
case HAX_VCPU_IOCTL_GET_REGS: {
struct vcpu_state_t *vc_state;
vc_state = (struct vcpu_state_t *)data;
ret = vcpu_get_regs(mvcpu2cvcpu(vcpu), vc_state);
Expand All @@ -229,7 +229,7 @@ static int hax_vcpu_ioctl(dev_t dev, ulong cmd, caddr_t data, int flag,
vcpu_interrupt(mvcpu2cvcpu(vcpu), vector);
break;
}
case HAX_IOCTL_VCPU_DEBUG: {
case HAX_VCPU_IOCTL_DEBUG: {
struct hax_debug_t *hax_debug;
hax_debug = (struct hax_debug_t *)data;
vcpu_debug(cvcpu, hax_debug);
Expand All @@ -243,8 +243,8 @@ static int hax_vcpu_ioctl(dev_t dev, ulong cmd, caddr_t data, int flag,
proc_name(pid, task_name, sizeof(task_name));
hax_error("Unknown vcpu ioctl 0x%lx, pid=%d ('%s')\n", cmd, pid,
task_name);
//printf("set regs ioctl %lx get regs %lx", HAX_VCPU_SET_REGS,
// HAX_VCPU_GET_REGS);
//printf("set regs ioctl %lx get regs %lx", HAX_VCPU_IOCTL_SET_REGS,
// HAX_VCPU_IOCTL_GET_REGS);
ret = -ENOSYS;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions platforms/linux/components.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd,
}
break;
}
case HAX_VCPU_SET_REGS: {
case HAX_VCPU_IOCTL_SET_REGS: {
struct vcpu_state_t vc_state;
if (copy_from_user(&vc_state, argp, sizeof(vc_state))) {
ret = -EFAULT;
Expand All @@ -417,7 +417,7 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd,
ret = vcpu_set_regs(cvcpu, &vc_state);
break;
}
case HAX_VCPU_GET_REGS: {
case HAX_VCPU_IOCTL_GET_REGS: {
struct vcpu_state_t vc_state;
ret = vcpu_get_regs(cvcpu, &vc_state);
if (copy_to_user(argp, &vc_state, sizeof(vc_state))) {
Expand All @@ -435,7 +435,7 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd,
vcpu_interrupt(cvcpu, vector);
break;
}
case HAX_IOCTL_VCPU_DEBUG: {
case HAX_VCPU_IOCTL_DEBUG: {
struct hax_debug_t hax_debug;
if (copy_from_user(&hax_debug, argp, sizeof(hax_debug))) {
ret = -EFAULT;
Expand Down
10 changes: 5 additions & 5 deletions platforms/windows/hax_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
infret = sizeof(struct fx_layout);
break;
}
case HAX_VCPU_SET_REGS: {
case HAX_VCPU_IOCTL_SET_REGS: {
struct vcpu_state_t *vc_state;
if(inBufLength < sizeof(struct vcpu_state_t)) {
ret = STATUS_INVALID_PARAMETER;
Expand All @@ -395,7 +395,7 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
ret = STATUS_UNSUCCESSFUL;
break;
}
case HAX_VCPU_GET_REGS: {
case HAX_VCPU_IOCTL_GET_REGS: {
struct vcpu_state_t *vc_state;
if(outBufLength < sizeof(struct vcpu_state_t)) {
ret = STATUS_INVALID_PARAMETER;
Expand All @@ -422,7 +422,7 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
vcpu_takeoff(cvcpu);
break;
}
case HAX_IOCTL_VCPU_DEBUG: {
case HAX_VCPU_IOCTL_DEBUG: {
if (inBufLength < sizeof(struct hax_debug_t)) {
ret = STATUS_INVALID_PARAMETER;
goto done;
Expand All @@ -433,8 +433,8 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
default:
hax_error("Unknow vcpu ioctl %lx\n",
irpSp->Parameters.DeviceIoControl.IoControlCode);
hax_info("set regs ioctl %lx get regs %lx", HAX_VCPU_SET_REGS,
HAX_VCPU_GET_REGS );
hax_info("set regs ioctl %lx get regs %lx", HAX_VCPU_IOCTL_SET_REGS,
HAX_VCPU_IOCTL_GET_REGS );
ret = STATUS_INVALID_PARAMETER;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions platforms/windows/hax_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ extern PDRIVER_OBJECT HaxDriverObject;
CTL_CODE(HAX_DEVICE_TYPE, 0x90b, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define HAX_VCPU_IOCTL_INTERRUPT \
CTL_CODE(HAX_DEVICE_TYPE, 0x90c, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define HAX_VCPU_SET_REGS \
#define HAX_VCPU_IOCTL_SET_REGS \
CTL_CODE(HAX_DEVICE_TYPE, 0x90d, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define HAX_VCPU_GET_REGS \
#define HAX_VCPU_IOCTL_GET_REGS \
CTL_CODE(HAX_DEVICE_TYPE, 0x90e, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define HAX_VCPU_IOCTL_KICKOFF \
CTL_CODE(HAX_DEVICE_TYPE, 0x90f, METHOD_BUFFERED, FILE_ANY_ACCESS)
Expand All @@ -163,7 +163,7 @@ extern PDRIVER_OBJECT HaxDriverObject;
#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION \
CTL_CODE(HAX_DEVICE_TYPE, 0x910, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define HAX_IOCTL_VCPU_DEBUG \
#define HAX_VCPU_IOCTL_DEBUG \
CTL_CODE(HAX_DEVICE_TYPE, 0x916, METHOD_BUFFERED, FILE_ANY_ACCESS)

#endif // HAX_WINDOWS_HAX_ENTRY_H_

0 comments on commit 6bebba6

Please sign in to comment.