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

Commit 896c860

Browse files
authored
Merge pull request #279 from intel/cr8_revert
Revert "Add cr8 to hax ioctl interface"
2 parents 7f3aaab + ed33162 commit 896c860

File tree

9 files changed

+6
-30
lines changed

9 files changed

+6
-30
lines changed

core/include/hax_core_interface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int vcpu_put_fpu(struct vcpu_t *vcpu, struct fx_layout *fl);
4545
int vcpu_get_fpu(struct vcpu_t *vcpu, struct fx_layout *fl);
4646
int vcpu_set_regs(struct vcpu_t *vcpu, struct vcpu_state_t *vs);
4747
int vcpu_get_regs(struct vcpu_t *vcpu, struct vcpu_state_t *vs);
48-
int vcpu_get_state_size(struct vcpu_t *vcpu);
4948
void vcpu_debug(struct vcpu_t *vcpu, struct hax_debug_t *debug);
5049

5150
void * get_vcpu_host(struct vcpu_t *vcpu);

core/include/vcpu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ struct vcpu_t {
171171
struct vm_t *vm;
172172
struct hax_mmu *mmu;
173173
struct vcpu_state_t *state;
174-
uint64_t _cr8;
175174
struct hax_tunnel *tunnel;
176175
uint8_t *io_buf;
177176
struct hax_page *vmcs_page;
@@ -259,7 +258,6 @@ int vcpu_get_fpu(struct vcpu_t *vcpu, struct fx_layout *fl);
259258
int vcpu_put_fpu(struct vcpu_t *vcpu, struct fx_layout *fl);
260259
int vcpu_get_msr(struct vcpu_t *vcpu, uint64_t entry, uint64_t *val);
261260
int vcpu_put_msr(struct vcpu_t *vcpu, uint64_t entry, uint64_t val);
262-
int vcpu_get_state_size(struct vcpu_t *vcpu);
263261
void vcpu_debug(struct vcpu_t *vcpu, struct hax_debug_t *debug);
264262

265263
/* The declaration for OS wrapper code */

core/include/vm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ struct vm_t {
6060
uint64_t flags;
6161
#define VM_FEATURES_FASTMMIO_BASIC 0x1
6262
#define VM_FEATURES_FASTMMIO_EXTRA 0x2
63-
#define VM_FEATURES_CR8 0x4
6463
uint32_t features;
6564
int vm_id;
6665
#define VPID_SEED_BITS 64

core/vcpu.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,13 +3940,6 @@ static int _copy_desc(segment_desc_t *old, segment_desc_t *new)
39403940
return flags;
39413941
}
39423942

3943-
int vcpu_get_state_size(struct vcpu_t *vcpu)
3944-
{
3945-
if (vcpu->vm->features & VM_FEATURES_CR8)
3946-
return sizeof(struct vcpu_state_t);
3947-
return offsetof(struct vcpu_state_t, _cr8);
3948-
}
3949-
39503943
int vcpu_get_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate)
39513944
{
39523945
struct vcpu_state_t *state = vcpu->state;
@@ -3982,9 +3975,6 @@ int vcpu_get_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate)
39823975
_copy_desc(&state->_gdt, &ustate->_gdt);
39833976
_copy_desc(&state->_idt, &ustate->_idt);
39843977

3985-
if (vcpu->vm->features & VM_FEATURES_CR8)
3986-
ustate->_cr8 = state->_cr8;
3987-
39883978
return 0;
39893979
}
39903980

@@ -4110,9 +4100,6 @@ int vcpu_set_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate)
41104100
VMWRITE_DESC(vcpu, IDTR, state->_idt);
41114101
}
41124102

4113-
if (vcpu->vm->features & VM_FEATURES_CR8)
4114-
state->_cr8 = ustate->_cr8;
4115-
41164103
if ((vmcs_err = put_vmcs(vcpu, &flags))) {
41174104
vcpu_set_panic(vcpu);
41184105
hax_log(HAX_LOGPANIC, "put_vmcs failed on vcpu_set_regs: %x\n",

core/vm.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ int hax_vm_set_qemuversion(struct vm_t *vm, struct hax_qemu_version *ver)
7373
vm->features |= VM_FEATURES_FASTMMIO_BASIC;
7474
if (ver->cur_version >= 0x4) {
7575
vm->features |= VM_FEATURES_FASTMMIO_EXTRA;
76-
if (ver->cur_version >= 0x5) {
77-
vm->features |= VM_FEATURES_CR8;
78-
}
7976
}
8077
}
8178
return 0;

include/hax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// declaration
4040
struct vcpu_t;
4141

42-
#define HAX_CUR_VERSION 0x0005
42+
#define HAX_CUR_VERSION 0x0004
4343
#define HAX_COMPAT_VERSION 0x0001
4444

4545
/* TBD */

include/vcpu_state.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ struct vcpu_state_t {
188188
uint32_t _activity_state;
189189
uint32_t pad;
190190
interruptibility_state_t _interruptibility_state;
191-
192-
uint64_t _cr8;
193191
} PACKED;
194192

195193
void dump(void);

platforms/linux/components.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,7 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd,
411411
}
412412
case HAX_VCPU_SET_REGS: {
413413
struct vcpu_state_t vc_state;
414-
int size = vcpu_get_state_size(cvcpu);
415-
if (copy_from_user(&vc_state, argp, size)) {
414+
if (copy_from_user(&vc_state, argp, sizeof(vc_state))) {
416415
ret = -EFAULT;
417416
break;
418417
}
@@ -421,9 +420,8 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd,
421420
}
422421
case HAX_VCPU_GET_REGS: {
423422
struct vcpu_state_t vc_state;
424-
int size = vcpu_get_state_size(cvcpu);
425423
ret = vcpu_get_regs(cvcpu, &vc_state);
426-
if (copy_to_user(argp, &vc_state, size)) {
424+
if (copy_to_user(argp, &vc_state, sizeof(vc_state))) {
427425
ret = -EFAULT;
428426
break;
429427
}

platforms/windows/hax_entry.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
387387
}
388388
case HAX_VCPU_SET_REGS: {
389389
struct vcpu_state_t *vc_state;
390-
if (inBufLength < vcpu_get_state_size(cvcpu)) {
390+
if(inBufLength < sizeof(struct vcpu_state_t)) {
391391
ret = STATUS_INVALID_PARAMETER;
392392
goto done;
393393
}
@@ -398,15 +398,15 @@ NTSTATUS HaxVcpuControl(PDEVICE_OBJECT DeviceObject,
398398
}
399399
case HAX_VCPU_GET_REGS: {
400400
struct vcpu_state_t *vc_state;
401-
infret = vcpu_get_state_size(cvcpu);
402-
if (outBufLength < infret) {
401+
if(outBufLength < sizeof(struct vcpu_state_t)) {
403402
ret = STATUS_INVALID_PARAMETER;
404403
goto done;
405404

406405
}
407406
vc_state = (struct vcpu_state_t *)outBuf;
408407
// vcpu_get_regs() cannot fail
409408
vcpu_get_regs(cvcpu, vc_state);
409+
infret = sizeof(struct vcpu_state_t);
410410
break;
411411
}
412412
case HAX_VCPU_IOCTL_INTERRUPT: {

0 commit comments

Comments
 (0)