| 2221 | } |
| 2222 | |
| 2223 | static int |
| 2224 | svm_setreg(void *arg, int vcpu, int ident, uint64_t val) |
| 2225 | { |
| 2226 | struct svm_softc *svm_sc; |
| 2227 | register_t *reg; |
| 2228 | |
| 2229 | svm_sc = arg; |
| 2230 | |
| 2231 | if (ident == VM_REG_GUEST_INTR_SHADOW) { |
| 2232 | return (svm_modify_intr_shadow(svm_sc, vcpu, val)); |
| 2233 | } |
| 2234 | |
| 2235 | /* Do not permit user write access to VMCB fields by offset. */ |
| 2236 | if (!VMCB_ACCESS_OK(ident)) { |
| 2237 | if (vmcb_write(svm_sc, vcpu, ident, val) == 0) { |
| 2238 | return (0); |
| 2239 | } |
| 2240 | } |
| 2241 | |
| 2242 | reg = swctx_regptr(svm_get_guest_regctx(svm_sc, vcpu), ident); |
| 2243 | |
| 2244 | if (reg != NULL) { |
| 2245 | *reg = val; |
| 2246 | return (0); |
| 2247 | } |
| 2248 | |
| 2249 | if (ident == VM_REG_GUEST_ENTRY_INST_LENGTH) { |
| 2250 | /* Ignore. */ |
| 2251 | return (0); |
| 2252 | } |
| 2253 | |
| 2254 | /* |
| 2255 | * XXX deal with CR3 and invalidate TLB entries tagged with the |
| 2256 | * vcpu's ASID. This needs to be treated differently depending on |
| 2257 | * whether 'running' is true/false. |
| 2258 | */ |
| 2259 | |
| 2260 | VCPU_CTR1(svm_sc->vm, vcpu, "svm_setreg: unknown register %#x", ident); |
| 2261 | return (EINVAL); |
| 2262 | } |
| 2263 | |
| 2264 | static int |
| 2265 | svm_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc) |
no test coverage detected