|
36 | 36 | #include <handle_system_kvm_get_supported_cpuid.h> |
37 | 37 | #include <handle_system_kvm_get_vcpu_mmap_size.h> |
38 | 38 | #include <handle_vcpu_kvm_get_fpu.h> |
| 39 | +#include <handle_vcpu_kvm_get_lapic.h> |
39 | 40 | #include <handle_vcpu_kvm_get_mp_state.h> |
40 | 41 | #include <handle_vcpu_kvm_get_msrs.h> |
41 | 42 | #include <handle_vcpu_kvm_get_regs.h> |
42 | 43 | #include <handle_vcpu_kvm_get_sregs.h> |
43 | 44 | #include <handle_vcpu_kvm_get_tsc_khz.h> |
44 | 45 | #include <handle_vcpu_kvm_run.h> |
45 | 46 | #include <handle_vcpu_kvm_set_fpu.h> |
| 47 | +#include <handle_vcpu_kvm_set_lapic.h> |
46 | 48 | #include <handle_vcpu_kvm_set_mp_state.h> |
47 | 49 | #include <handle_vcpu_kvm_set_msrs.h> |
48 | 50 | #include <handle_vcpu_kvm_set_regs.h> |
@@ -1029,10 +1031,27 @@ dispatch_vcpu_kvm_get_fpu( |
1029 | 1031 | } |
1030 | 1032 |
|
1031 | 1033 | static long |
1032 | | -dispatch_vcpu_kvm_get_lapic(struct kvm_lapic_state *const ioctl_args) |
| 1034 | +dispatch_vcpu_kvm_get_lapic( |
| 1035 | + struct shim_vcpu_t const *const vcpu, |
| 1036 | + struct kvm_lapic_state *const user_args) |
1033 | 1037 | { |
1034 | | - (void)ioctl_args; |
1035 | | - return -EINVAL; |
| 1038 | + struct kvm_lapic_state mut_args; |
| 1039 | + |
| 1040 | + if (NULL == user_args) { |
| 1041 | + bferror("user_args are null"); |
| 1042 | + return -EINVAL; |
| 1043 | + } |
| 1044 | + |
| 1045 | + if (handle_vcpu_kvm_get_lapic(vcpu, &mut_args)) { |
| 1046 | + bferror("handle_vcpu_kvm_get_lapic failed"); |
| 1047 | + return -EINVAL; |
| 1048 | + } |
| 1049 | + |
| 1050 | + if (platform_copy_to_user(user_args, &mut_args, sizeof(mut_args))) { |
| 1051 | + bferror("platform_copy_to_user failed"); |
| 1052 | + return -EINVAL; |
| 1053 | + } |
| 1054 | + return 0; |
1036 | 1055 | } |
1037 | 1056 |
|
1038 | 1057 | static long |
@@ -1283,10 +1302,28 @@ dispatch_vcpu_kvm_set_guest_debug(struct kvm_guest_debug *const ioctl_args) |
1283 | 1302 | } |
1284 | 1303 |
|
1285 | 1304 | static long |
1286 | | -dispatch_vcpu_kvm_set_lapic(struct kvm_lapic_state *const ioctl_args) |
| 1305 | +dispatch_vcpu_kvm_set_lapic( |
| 1306 | + struct shim_vcpu_t const *const vcpu, |
| 1307 | + struct kvm_lapic_state *const user_args) |
1287 | 1308 | { |
1288 | | - (void)ioctl_args; |
1289 | | - return -EINVAL; |
| 1309 | + struct kvm_lapic_state mut_args; |
| 1310 | + |
| 1311 | + if (NULL == user_args) { |
| 1312 | + bferror("user_args are null"); |
| 1313 | + return -EINVAL; |
| 1314 | + } |
| 1315 | + |
| 1316 | + if (platform_copy_from_user(&mut_args, user_args, sizeof(mut_args))) { |
| 1317 | + bferror("platform_copy_from_user failed"); |
| 1318 | + return -EINVAL; |
| 1319 | + } |
| 1320 | + |
| 1321 | + if (handle_vcpu_kvm_set_lapic(vcpu, &mut_args)) { |
| 1322 | + bferror("handle_vcpu_kvm_set_lapic failed"); |
| 1323 | + return -EINVAL; |
| 1324 | + } |
| 1325 | + |
| 1326 | + return 0; |
1290 | 1327 | } |
1291 | 1328 |
|
1292 | 1329 | static long |
@@ -1504,7 +1541,7 @@ dev_unlocked_ioctl_vcpu( |
1504 | 1541 |
|
1505 | 1542 | case KVM_GET_LAPIC: { |
1506 | 1543 | return dispatch_vcpu_kvm_get_lapic( |
1507 | | - (struct kvm_lapic_state *)ioctl_args); |
| 1544 | + pmut_mut_vcpu, (struct kvm_lapic_state *)ioctl_args); |
1508 | 1545 | } |
1509 | 1546 |
|
1510 | 1547 | case KVM_GET_MP_STATE: { |
@@ -1601,7 +1638,7 @@ dev_unlocked_ioctl_vcpu( |
1601 | 1638 |
|
1602 | 1639 | case KVM_SET_LAPIC: { |
1603 | 1640 | return dispatch_vcpu_kvm_set_lapic( |
1604 | | - (struct kvm_lapic_state *)ioctl_args); |
| 1641 | + pmut_mut_vcpu, (struct kvm_lapic_state *)ioctl_args); |
1605 | 1642 | } |
1606 | 1643 |
|
1607 | 1644 | case KVM_SET_MP_STATE: { |
|
0 commit comments