diff --git a/lib/libvmmapi/aarch64/vmmapi_machdep.c b/lib/libvmmapi/aarch64/vmmapi_machdep.c index 8ce867a26dfc..c9b463ba4c1f 100644 --- a/lib/libvmmapi/aarch64/vmmapi_machdep.c +++ b/lib/libvmmapi/aarch64/vmmapi_machdep.c @@ -55,6 +55,8 @@ const cap_ioctl_t vm_ioctl_cmds[] = { VM_MD_IOCTLS, #if __has_feature(capabilities) VM_GET_CHERI_CAPABILITY_TAG, + VM_GET_REGISTER_CHERI_CAPABILITY_TAG, + VM_GET_REGISTER_CHERI_CAPABILITY_TAG_SET, #endif }; size_t vm_ioctl_ncmds = nitems(vm_ioctl_cmds); diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 8ce4a1223c5d..d5e595665e41 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -650,6 +650,23 @@ vm_get_register(struct vcpu *vcpu, int reg, uintcap_t *ret_val) return (error); } +#if __has_feature(capabilities) +int +vm_get_register_cheri_capability_tag(struct vcpu *vcpu, int reg, uint8_t *tagp) +{ + struct vm_register_cheri_capability_tag vmreg; + int error; + + bzero(&vmreg, sizeof(vmreg)); + vmreg.regnum = reg; + + error = vcpu_ioctl(vcpu, VM_GET_REGISTER_CHERI_CAPABILITY_TAG, &vmreg); + if (error == 0) + *tagp = vmreg.tag; + return (error); +} +#endif + int vm_set_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uintcap_t *regvals) @@ -682,6 +699,25 @@ vm_get_register_set(struct vcpu *vcpu, unsigned int count, return (error); } +#if __has_feature(capabilities) +int +vm_get_register_cheri_capability_tag_set(struct vcpu *vcpu, unsigned int count, + const int *regnums, uint8_t *tags) +{ + struct vm_register_cheri_capability_tag_set vmtagset; + int error; + + bzero(&vmtagset, sizeof(vmtagset)); + vmtagset.count = count; + vmtagset.regnums = regnums; + vmtagset.tags = tags; + + error = vcpu_ioctl(vcpu, VM_GET_REGISTER_CHERI_CAPABILITY_TAG_SET, + &vmtagset); + return (error); +} +#endif + int vm_run(struct vcpu *vcpu, struct vm_run *vmrun) { diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index d0fe29e40c08..99d50293085f 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -152,10 +152,18 @@ int vm_get_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *seg_desc); #endif int vm_set_register(struct vcpu *vcpu, int reg, uintcap_t val); int vm_get_register(struct vcpu *vcpu, int reg, uintcap_t *retval); +#if __has_feature(capabilities) +int vm_get_register_cheri_capability_tag(struct vcpu *vcpu, int reg, + uint8_t *tagp); +#endif int vm_set_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uintcap_t *regvals); int vm_get_register_set(struct vcpu *vcpu, unsigned int count, const int *regnums, uintcap_t *regvals); +#if __has_feature(capabilities) +int vm_get_register_cheri_capability_tag_set(struct vcpu *vcpu, + unsigned int count, const int *regnums, uint8_t *tags); +#endif int vm_run(struct vcpu *vcpu, struct vm_run *vmrun); int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); int vm_reinit(struct vmctx *ctx);