Changeset View
Changeset View
Standalone View
Standalone View
lib/libvmmapi/vmmapi.c
| Show First 20 Lines • Show All 1,729 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| int dummy; | int dummy; | ||||
| dummy = 0; | dummy = 0; | ||||
| return (ioctl(ctx->fd, VM_RESTORE_TIME, &dummy)); | return (ioctl(ctx->fd, VM_RESTORE_TIME, &dummy)); | ||||
| } | } | ||||
| int | int | ||||
| vm_get_dirty_page_list(struct vmctx *ctx, char *page_list, size_t num_pages, bool is_all_dirty) | |||||
| { | |||||
| struct vm_get_dirty_page_list list; | |||||
| bzero(&list, sizeof(struct vm_get_dirty_page_list)); | |||||
| list.page_list = (uint8_t *)page_list; | |||||
| list.num_pages = num_pages; | |||||
| list.is_all_dirty = is_all_dirty; | |||||
| list.lowmem_start = 0; | |||||
| list.lowmem_end = ctx->lowmem; | |||||
| list.highmem_start = ctx->highmem != 0 ? 4 * GB : -1; | |||||
| list.highmem_end = ctx->highmem != 0 ? 4 * GB + ctx->highmem : -1; | |||||
| madvise(ctx->baseaddr, ctx->lowmem, MADV_WILLNEED); | |||||
| if (ctx->highmem != 0) | |||||
| madvise(ctx->baseaddr + 4 * GB, ctx->highmem, MADV_WILLNEED); | |||||
| return (ioctl(ctx->fd, VM_GET_DIRTY_PAGE_LIST, &list)); | |||||
| } | |||||
| int | |||||
| vm_set_topology(struct vmctx *ctx, | vm_set_topology(struct vmctx *ctx, | ||||
| uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) | uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) | ||||
| { | { | ||||
| struct vm_cpu_topology topology; | struct vm_cpu_topology topology; | ||||
| bzero(&topology, sizeof (struct vm_cpu_topology)); | bzero(&topology, sizeof (struct vm_cpu_topology)); | ||||
| topology.sockets = sockets; | topology.sockets = sockets; | ||||
| topology.cores = cores; | topology.cores = cores; | ||||
| Show All 37 Lines | static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT, | ||||
| VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, | VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, | ||||
| VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, | VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, | ||||
| VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, | VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, | ||||
| VM_GLA2GPA_NOFAULT, | VM_GLA2GPA_NOFAULT, | ||||
| VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU, | VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU, | ||||
| VM_SET_INTINFO, VM_GET_INTINFO, | VM_SET_INTINFO, VM_GET_INTINFO, | ||||
| VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, | VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, | ||||
| VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY, | VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY, | ||||
| VM_SNAPSHOT_REQ, VM_RESTORE_TIME | VM_SNAPSHOT_REQ, VM_RESTORE_TIME, VM_GET_DIRTY_PAGE_LIST | ||||
| }; | }; | ||||
| int | int | ||||
| vm_limit_rights(struct vmctx *ctx) | vm_limit_rights(struct vmctx *ctx) | ||||
| { | { | ||||
| cap_rights_t rights; | cap_rights_t rights; | ||||
| size_t ncmds; | size_t ncmds; | ||||
| Show All 37 Lines | |||||