| 2194 | } |
| 2195 | |
| 2196 | static int |
| 2197 | svm_getreg(void *arg, int vcpu, int ident, uint64_t *val) |
| 2198 | { |
| 2199 | struct svm_softc *svm_sc; |
| 2200 | register_t *reg; |
| 2201 | |
| 2202 | svm_sc = arg; |
| 2203 | |
| 2204 | if (ident == VM_REG_GUEST_INTR_SHADOW) { |
| 2205 | return (svm_get_intr_shadow(svm_sc, vcpu, val)); |
| 2206 | } |
| 2207 | |
| 2208 | if (vmcb_read(svm_sc, vcpu, ident, val) == 0) { |
| 2209 | return (0); |
| 2210 | } |
| 2211 | |
| 2212 | reg = swctx_regptr(svm_get_guest_regctx(svm_sc, vcpu), ident); |
| 2213 | |
| 2214 | if (reg != NULL) { |
| 2215 | *val = *reg; |
| 2216 | return (0); |
| 2217 | } |
| 2218 | |
| 2219 | VCPU_CTR1(svm_sc->vm, vcpu, "svm_getreg: unknown register %#x", ident); |
| 2220 | return (EINVAL); |
| 2221 | } |
| 2222 | |
| 2223 | static int |
| 2224 | svm_setreg(void *arg, int vcpu, int ident, uint64_t val) |
no test coverage detected