Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/amd/vmcb.h
Show First 20 Lines • Show All 203 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define VMCB_ACCESS(o, w) (0x80000000 | (((w) & 0xF) << 16) | \ | #define VMCB_ACCESS(o, w) (0x80000000 | (((w) & 0xF) << 16) | \ | ||||
((o) & 0xFFF)) | ((o) & 0xFFF)) | ||||
#define VMCB_ACCESS_OK(v) ((v) & 0x80000000 ) | #define VMCB_ACCESS_OK(v) ((v) & 0x80000000 ) | ||||
#define VMCB_ACCESS_BYTES(v) (((v) >> 16) & 0xF) | #define VMCB_ACCESS_BYTES(v) (((v) >> 16) & 0xF) | ||||
#define VMCB_ACCESS_OFFSET(v) ((v) & 0xFFF) | #define VMCB_ACCESS_OFFSET(v) ((v) & 0xFFF) | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
struct vm_snapshot_meta; | |||||
pmooney_pfmooney.com: Rather than requiring forward definitions here and in the other headers (vlapic, vhpet, etc)… | |||||
darius.mihaim_gmail.comUnsubmitted Done Inline ActionsForward declarations were seemed like the preferred implementation. Including headers may be problematic, especially if those include other headers. darius.mihaim_gmail.com: Forward declarations were seemed like the preferred implementation. Including headers may be… | |||||
pmooney_pfmooney.comUnsubmitted Not Done Inline ActionsI strongly disagree. Practically everywhere else, shared types declarations are pulled in via headers. What about this situation makes it so complicated that doing so isn't feasible? pmooney_pfmooney.com: I strongly disagree. Practically everywhere else, shared types declarations are pulled in via… | |||||
cemUnsubmitted Not Done Inline ActionsForward declarations are used extensively in FreeBSD when the header only needs to reference the pointer type. I guess I don’t understand why you strongly disagree with using them appropriately. cem: Forward declarations are used extensively in FreeBSD when the header only needs to reference… | |||||
/* VMCB save state area segment format */ | /* VMCB save state area segment format */ | ||||
struct vmcb_segment { | struct vmcb_segment { | ||||
uint16_t selector; | uint16_t selector; | ||||
uint16_t attrib; | uint16_t attrib; | ||||
uint32_t limit; | uint32_t limit; | ||||
uint64_t base; | uint64_t base; | ||||
} __attribute__ ((__packed__)); | } __attribute__ ((__packed__)); | ||||
CTASSERT(sizeof(struct vmcb_segment) == 16); | CTASSERT(sizeof(struct vmcb_segment) == 16); | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
CTASSERT(sizeof(struct vmcb) == PAGE_SIZE); | CTASSERT(sizeof(struct vmcb) == PAGE_SIZE); | ||||
CTASSERT(offsetof(struct vmcb, state) == 0x400); | CTASSERT(offsetof(struct vmcb, state) == 0x400); | ||||
int vmcb_read(struct svm_softc *sc, int vcpu, int ident, uint64_t *retval); | int vmcb_read(struct svm_softc *sc, int vcpu, int ident, uint64_t *retval); | ||||
int vmcb_write(struct svm_softc *sc, int vcpu, int ident, uint64_t val); | int vmcb_write(struct svm_softc *sc, int vcpu, int ident, uint64_t val); | ||||
int vmcb_setdesc(void *arg, int vcpu, int ident, struct seg_desc *desc); | int vmcb_setdesc(void *arg, int vcpu, int ident, struct seg_desc *desc); | ||||
int vmcb_getdesc(void *arg, int vcpu, int ident, struct seg_desc *desc); | int vmcb_getdesc(void *arg, int vcpu, int ident, struct seg_desc *desc); | ||||
int vmcb_seg(struct vmcb *vmcb, int ident, struct vmcb_segment *seg); | int vmcb_seg(struct vmcb *vmcb, int ident, struct vmcb_segment *seg); | ||||
int vmcb_getany(struct svm_softc *sc, int vcpu, int ident, uint64_t *val); | |||||
int vmcb_setany(struct svm_softc *sc, int vcpu, int ident, uint64_t val); | |||||
int vmcb_snapshot_desc(void *arg, int vcpu, int reg, | |||||
struct vm_snapshot_meta *meta); | |||||
int vmcb_snapshot_any(struct svm_softc *sc, int vcpu, int ident, | |||||
struct vm_snapshot_meta *meta); | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _VMCB_H_ */ | #endif /* _VMCB_H_ */ |
Rather than requiring forward definitions here and in the other headers (vlapic, vhpet, etc) for struct vm_snapshot_meta, why not include machine/vmm_snapshot.h? It's required for the function implementation anyways.