This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13 #define _GNU_SOURCE
14 #include <fcntl.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <sys/ioctl.h>
19
20 #include "test_util.h"
21
22 #include "kvm_util.h"
23 #include "processor.h"
24
25 #define VCPU_ID 5
26
27 int main(int argc, char *argv[])
28 {
29 struct kvm_sregs sregs;
30 struct kvm_vm *vm;
31 int rc;
32
33
34 setbuf(stdout, NULL);
35
36
37 vm = vm_create_default(VCPU_ID, 0, NULL);
38
39 vcpu_sregs_get(vm, VCPU_ID, &sregs);
40 sregs.apic_base = 1 << 10;
41 rc = _vcpu_sregs_set(vm, VCPU_ID, &sregs);
42 TEST_ASSERT(rc, "Set IA32_APIC_BASE to %llx (invalid)",
43 sregs.apic_base);
44 sregs.apic_base = 1 << 11;
45 rc = _vcpu_sregs_set(vm, VCPU_ID, &sregs);
46 TEST_ASSERT(!rc, "Couldn't set IA32_APIC_BASE to %llx (valid)",
47 sregs.apic_base);
48
49 kvm_vm_free(vm);
50
51 return 0;
52 }