/root/src/xen/xen/arch/x86/x86_64/domain.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * arch/x86/x86_64/domain.c |
3 | | * |
4 | | */ |
5 | | |
6 | | #include <xen/types.h> |
7 | | #include <xen/guest_access.h> |
8 | | #include <xen/hypercall.h> |
9 | | #include <compat/vcpu.h> |
10 | | |
11 | | #define xen_vcpu_get_physid vcpu_get_physid |
12 | | CHECK_vcpu_get_physid; |
13 | | #undef xen_vcpu_get_physid |
14 | | |
15 | | int |
16 | | arch_compat_vcpu_op( |
17 | | int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) |
18 | 0 | { |
19 | 0 | int rc = -ENOSYS; |
20 | 0 |
|
21 | 0 | switch ( cmd ) |
22 | 0 | { |
23 | 0 | case VCPUOP_register_runstate_memory_area: |
24 | 0 | { |
25 | 0 | struct compat_vcpu_register_runstate_memory_area area; |
26 | 0 | struct compat_vcpu_runstate_info info; |
27 | 0 |
|
28 | 0 | area.addr.p = 0; |
29 | 0 |
|
30 | 0 | rc = -EFAULT; |
31 | 0 | if ( copy_from_guest(&area.addr.h, arg, 1) ) |
32 | 0 | break; |
33 | 0 |
|
34 | 0 | if ( area.addr.h.c != area.addr.p || |
35 | 0 | !compat_handle_okay(area.addr.h, 1) ) |
36 | 0 | break; |
37 | 0 |
|
38 | 0 | rc = 0; |
39 | 0 | guest_from_compat_handle(v->runstate_guest.compat, area.addr.h); |
40 | 0 |
|
41 | 0 | if ( v == current ) |
42 | 0 | { |
43 | 0 | XLAT_vcpu_runstate_info(&info, &v->runstate); |
44 | 0 | } |
45 | 0 | else |
46 | 0 | { |
47 | 0 | struct vcpu_runstate_info runstate; |
48 | 0 |
|
49 | 0 | vcpu_runstate_get(v, &runstate); |
50 | 0 | XLAT_vcpu_runstate_info(&info, &runstate); |
51 | 0 | } |
52 | 0 | __copy_to_guest(v->runstate_guest.compat, &info, 1); |
53 | 0 |
|
54 | 0 | break; |
55 | 0 | } |
56 | 0 |
|
57 | 0 | case VCPUOP_get_physid: |
58 | 0 | rc = arch_do_vcpu_op(cmd, v, arg); |
59 | 0 | break; |
60 | 0 | } |
61 | 0 |
|
62 | 0 | return rc; |
63 | 0 | } |
64 | | |
65 | | /* |
66 | | * Local variables: |
67 | | * mode: C |
68 | | * c-file-style: "BSD" |
69 | | * c-basic-offset: 4 |
70 | | * tab-width: 4 |
71 | | * indent-tabs-mode: nil |
72 | | * End: |
73 | | */ |