From 6bebba668951f04aad4eb312ca474f6f75110b42 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Thu, 8 Nov 2018 15:21:23 +0100 Subject: [PATCH] Make VCPU ioctl naming consistent - 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. --- docs/api.md | 2 +- include/darwin/hax_interface_mac.h | 6 +++--- include/linux/hax_interface_linux.h | 6 +++--- platforms/darwin/com_intel_hax_ui.c | 10 +++++----- platforms/linux/components.c | 6 +++--- platforms/windows/hax_entry.c | 10 +++++----- platforms/windows/hax_entry.h | 6 +++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/api.md b/docs/api.md index b3f6f283..fd14ebe3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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 diff --git a/include/darwin/hax_interface_mac.h b/include/darwin/hax_interface_mac.h index 43a9719d..d6b6b692 100644 --- a/include/darwin/hax_interface_mac.h +++ b/include/darwin/hax_interface_mac.h @@ -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 diff --git a/include/linux/hax_interface_linux.h b/include/linux/hax_interface_linux.h index ecb13fd0..a41d29e2 100644 --- a/include/linux/hax_interface_linux.h +++ b/include/linux/hax_interface_linux.h @@ -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 diff --git a/platforms/darwin/com_intel_hax_ui.c b/platforms/darwin/com_intel_hax_ui.c index edd2faa6..13911b0d 100644 --- a/platforms/darwin/com_intel_hax_ui.c +++ b/platforms/darwin/com_intel_hax_ui.c @@ -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); @@ -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); @@ -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; } diff --git a/platforms/linux/components.c b/platforms/linux/components.c index c6bf7ba8..9472bf6a 100644 --- a/platforms/linux/components.c +++ b/platforms/linux/components.c @@ -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; @@ -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))) { @@ -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; diff --git a/platforms/windows/hax_entry.c b/platforms/windows/hax_entry.c index 952a7773..df471c5a 100644 --- a/platforms/windows/hax_entry.c +++ b/platforms/windows/hax_entry.c @@ -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; @@ -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; @@ -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; @@ -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; } diff --git a/platforms/windows/hax_entry.h b/platforms/windows/hax_entry.h index 52613f7d..7e5f44c6 100644 --- a/platforms/windows/hax_entry.h +++ b/platforms/windows/hax_entry.h @@ -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) @@ -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_