MCPcopy Create free account
hub / github.com/F-Stack/f-stack / svm_setreg

Function svm_setreg

freebsd/amd64/vmm/amd/svm.c:2223–2262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2221}
2222
2223static int
2224svm_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
2264static int
2265svm_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc)

Callers 3

svm_write_eferFunction · 0.85
svm_vmexitFunction · 0.85
svm_snapshot_regFunction · 0.85

Calls 4

svm_modify_intr_shadowFunction · 0.85
vmcb_writeFunction · 0.85
swctx_regptrFunction · 0.85
svm_get_guest_regctxFunction · 0.85

Tested by

no test coverage detected