mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
libvmmapi: Move VM capability names to vmmapi_machdep.c
Add some missing entries while here. Reviewed by: corvink, jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D41000
This commit is contained in:
parent
e4656e10d1
commit
85efb31d50
|
@ -37,6 +37,21 @@
|
||||||
#include "vmmapi.h"
|
#include "vmmapi.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
const char *vm_capstrmap[] = {
|
||||||
|
[VM_CAP_HALT_EXIT] = "hlt_exit",
|
||||||
|
[VM_CAP_MTRAP_EXIT] = "mtrap_exit",
|
||||||
|
[VM_CAP_PAUSE_EXIT] = "pause_exit",
|
||||||
|
[VM_CAP_UNRESTRICTED_GUEST] = "unrestricted_guest",
|
||||||
|
[VM_CAP_ENABLE_INVPCID] = "enable_invpcid",
|
||||||
|
[VM_CAP_BPT_EXIT] = "bpt_exit",
|
||||||
|
[VM_CAP_RDPID] = "rdpid",
|
||||||
|
[VM_CAP_RDTSCP] = "rdtscp",
|
||||||
|
[VM_CAP_IPI_EXIT] = "ipi_exit",
|
||||||
|
[VM_CAP_MASK_HWINTR] = "mask_hwintr",
|
||||||
|
[VM_CAP_RFLAGS_TF] = "rflags_tf",
|
||||||
|
[VM_CAP_MAX] = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
vm_set_desc(struct vcpu *vcpu, int reg,
|
vm_set_desc(struct vcpu *vcpu, int reg,
|
||||||
uint64_t base, uint32_t limit, uint32_t access)
|
uint64_t base, uint32_t limit, uint32_t access)
|
||||||
|
|
|
@ -24,4 +24,6 @@ struct vcpu {
|
||||||
|
|
||||||
int vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg);
|
int vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg);
|
||||||
|
|
||||||
|
extern const char *vm_capstrmap[];
|
||||||
|
|
||||||
#endif /* !__VMMAPI_INTERNAL_H__ */
|
#endif /* !__VMMAPI_INTERNAL_H__ */
|
||||||
|
|
|
@ -711,27 +711,14 @@ vm_readwrite_kernemu_device(struct vcpu *vcpu, vm_paddr_t gpa,
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *capstrmap[] = {
|
|
||||||
[VM_CAP_HALT_EXIT] = "hlt_exit",
|
|
||||||
[VM_CAP_MTRAP_EXIT] = "mtrap_exit",
|
|
||||||
[VM_CAP_PAUSE_EXIT] = "pause_exit",
|
|
||||||
[VM_CAP_UNRESTRICTED_GUEST] = "unrestricted_guest",
|
|
||||||
[VM_CAP_ENABLE_INVPCID] = "enable_invpcid",
|
|
||||||
[VM_CAP_BPT_EXIT] = "bpt_exit",
|
|
||||||
[VM_CAP_RDPID] = "rdpid",
|
|
||||||
[VM_CAP_RDTSCP] = "rdtscp",
|
|
||||||
[VM_CAP_IPI_EXIT] = "ipi_exit",
|
|
||||||
[VM_CAP_MASK_HWINTR] = "mask_hwintr",
|
|
||||||
[VM_CAP_RFLAGS_TF] = "rflags_tf",
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
vm_capability_name2type(const char *capname)
|
vm_capability_name2type(const char *capname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < (int)nitems(capstrmap); i++) {
|
for (i = 0; i < VM_CAP_MAX; i++) {
|
||||||
if (strcmp(capstrmap[i], capname) == 0)
|
if (vm_capstrmap[i] != NULL &&
|
||||||
|
strcmp(vm_capstrmap[i], capname) == 0)
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,8 +728,8 @@ vm_capability_name2type(const char *capname)
|
||||||
const char *
|
const char *
|
||||||
vm_capability_type2name(int type)
|
vm_capability_type2name(int type)
|
||||||
{
|
{
|
||||||
if (type >= 0 && type < (int)nitems(capstrmap))
|
if (type >= 0 && type < VM_CAP_MAX)
|
||||||
return (capstrmap[type]);
|
return (vm_capstrmap[type]);
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue