Changeset View
Changeset View
Standalone View
Standalone View
lib/libvmmapi/vmmapi.h
Show All 27 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _VMMAPI_H_ | #ifndef _VMMAPI_H_ | ||||
#define _VMMAPI_H_ | #define _VMMAPI_H_ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/cpuset.h> | #include <sys/cpuset.h> | ||||
#include <machine/vmm.h> | |||||
#include <machine/vmm_dev.h> | #include <machine/vmm_dev.h> | ||||
jhb: Why is vmm.h needed? | |||||
Done Inline ActionsBecause w/o that compiling produces a lot errors: $ cc vmopen.c In file included from vmopen.c:3: In file included from /usr/include/vmmapi.h:37: /usr/include/machine/vmm_dev.h:61:13: error: use of undeclared identifier 'VM_MAX_SUFFIXLEN' char name[VM_MAX_SUFFIXLEN + 1]; ^ /usr/include/machine/vmm_dev.h:80:18: error: field has incomplete type 'struct seg_desc' struct seg_desc desc; ... I guess including "vmmapi.h" should self sufficient to be compiled. gusev.vitaliy_gmail.com: Because w/o that compiling produces a lot errors:
```
$ cc vmopen.c
In file included from… | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
/* | /* | ||||
* API version for out-of-tree consumers like grub-bhyve for making compile | * API version for out-of-tree consumers like grub-bhyve for making compile | ||||
* time decisions. | * time decisions. | ||||
*/ | */ | ||||
#define VMMAPI_VERSION 0103 /* 2 digit major followed by 2 digit minor */ | #define VMMAPI_VERSION 0103 /* 2 digit major followed by 2 digit minor */ | ||||
Show All 26 Lines | |||||
*/ | */ | ||||
enum { | enum { | ||||
VM_SYSMEM, | VM_SYSMEM, | ||||
VM_BOOTROM, | VM_BOOTROM, | ||||
VM_FRAMEBUFFER, | VM_FRAMEBUFFER, | ||||
VM_PCIROM, | VM_PCIROM, | ||||
}; | }; | ||||
/* | /* | ||||
Done Inline ActionsI think we typically leave a blank line after this and before __END_DECLS in other headers. jhb: I think we typically leave a blank line after this and before __END_DECLS in other headers. | |||||
Done Inline ActionsWill do, thanks. gusev.vitaliy_gmail.com: Will do, thanks. | |||||
* Get the length and name of the memory segment identified by 'segid'. | * Get the length and name of the memory segment identified by 'segid'. | ||||
* Note that system memory segments are identified with a nul name. | * Note that system memory segments are identified with a nul name. | ||||
* | * | ||||
* Returns 0 on success and non-zero otherwise. | * Returns 0 on success and non-zero otherwise. | ||||
*/ | */ | ||||
int vm_get_memseg(struct vmctx *ctx, int ident, size_t *lenp, char *name, | int vm_get_memseg(struct vmctx *ctx, int ident, size_t *lenp, char *name, | ||||
size_t namesiz); | size_t namesiz); | ||||
Show All 24 Lines | |||||
int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid, | int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid, | ||||
vm_ooffset_t segoff, size_t len, int prot); | vm_ooffset_t segoff, size_t len, int prot); | ||||
int vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len); | int vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len); | ||||
int vm_create(const char *name); | int vm_create(const char *name); | ||||
int vm_get_device_fd(struct vmctx *ctx); | int vm_get_device_fd(struct vmctx *ctx); | ||||
struct vmctx *vm_open(const char *name); | struct vmctx *vm_open(const char *name); | ||||
void vm_close(struct vmctx *ctx); | |||||
void vm_destroy(struct vmctx *ctx); | void vm_destroy(struct vmctx *ctx); | ||||
int vm_parse_memsize(const char *optarg, size_t *memsize); | int vm_parse_memsize(const char *optarg, size_t *memsize); | ||||
int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s); | int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s); | ||||
void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len); | void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len); | ||||
/* inverse operation to vm_map_gpa - extract guest address from host pointer */ | /* inverse operation to vm_map_gpa - extract guest address from host pointer */ | ||||
vm_paddr_t vm_rev_map_gpa(struct vmctx *ctx, void *addr); | vm_paddr_t vm_rev_map_gpa(struct vmctx *ctx, void *addr); | ||||
int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num); | int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num); | ||||
int vm_gla2gpa(struct vmctx *, int vcpuid, struct vm_guest_paging *paging, | int vm_gla2gpa(struct vmctx *, int vcpuid, struct vm_guest_paging *paging, | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |
Why is vmm.h needed?