vrp
vm_run(struct vm_run_params *vrp)
ret = vm_find(vrp->vrp_vm_id, &vm);
vcpu = vm_find_vcpu(vm, vrp->vrp_vcpu_id);
ret = copyin(vrp->vrp_exit, &vcpu->vc_exit, sizeof(struct vm_exit));
vcpu->vc_inject.vie_type = vrp->vrp_inject.vie_type;
vcpu->vc_inject.vie_vector = vrp->vrp_inject.vie_vector;
vcpu->vc_inject.vie_errorcode = vrp->vrp_inject.vie_errorcode;
vcpu_rv = vcpu_run_vmx(vcpu, vrp);
vcpu_rv = vcpu_run_svm(vcpu, vrp);
vrp->vrp_exit_reason = (vcpu_rv == 0) ? VM_EXIT_NONE
vrp->vrp_irqready = vcpu->vc_irqready;
ret = copyout(&vcpu->vc_exit, vrp->vrp_exit,
vrp->vrp_exit_reason = VM_EXIT_TERMINATED;
vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
if (vrp->vrp_intr_pending)
TRACEPOINT(vmm, guest_enter, vcpu, vrp);
TRACEPOINT(vmm, guest_exit, vcpu, vrp, exit_reason);
vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
if (vrp->vrp_intr_pending)
TRACEPOINT(vmm, guest_enter, vcpu, vrp);
TRACEPOINT(vmm, guest_exit, vcpu, vrp, exit_reason);
vm_resetcpu(struct vm_resetcpu_params *vrp)
error = vm_find(vrp->vrp_vm_id, &vm);
vrp->vrp_vm_id);
vcpu = vm_find_vcpu(vm, vrp->vrp_vcpu_id);
vrp->vrp_vcpu_id, vrp->vrp_vm_id);
if (vcpu_reset_regs(vcpu, &vrp->vrp_init_state)) {
struct veb_rule vr, *vrp;
vrp = pool_get(&veb_rule_pool, PR_WAITOK|PR_LIMITFAIL|PR_ZERO);
if (vrp == NULL) {
*vrp = vr;
TAILQ_INSERT_TAIL(&p->p_vrl, vrp, vr_entry);
vrp, vr_lentry[0]);
vrp, vr_lentry[1]);
pool_put(&veb_rule_pool, vrp);
struct vrp *prev, *vrp = NULL;
if ((vrp = calloc(1, sizeof(*vrp))) == NULL)
vrp->asid = asid;
vrp->afi = afi;
if (!ip_addr_parse(r->address, afi, fn, &vrp->addr)) {
maxlen = vrp->addr.prefixlen;
if (vrp->addr.prefixlen > maxlen) {
vrp->maxlength = maxlen;
if (ccr_vrp_cmp(vrp, prev) <= 0) {
if ((RB_INSERT(ccr_vrp_tree, &ccr->vrps, vrp)) != NULL) {
prev = vrp;
vrp = NULL;
free(vrp);
append_cached_vrp(STACK_OF(ROAIPAddress) *addresses, struct vrp *vrp)
num_bytes = (vrp->addr.prefixlen + 7) / 8;
num_bits = vrp->addr.prefixlen % 8;
if (!ASN1_BIT_STRING_set(ripa->address, vrp->addr.addr, num_bytes))
if (vrp->maxlength > vrp->addr.prefixlen) {
if (!ASN1_INTEGER_set_uint64(ripa->maxLength, vrp->maxlength))
struct vrp *prev, *vrp;
RB_FOREACH(vrp, ccr_vrp_tree, &ccr->vrps) {
if (prev == NULL || prev->asid != vrp->asid) {
if (!ASN1_INTEGER_set_uint64(rp->asID, vrp->asid))
if (prev == NULL || prev->asid != vrp->asid ||
prev->afi != vrp->afi) {
assert(vrp->afi == AFI_IPV4 || vrp->afi == AFI_IPV6);
afibuf[1] = vrp->afi;
append_cached_vrp(ripaf->addresses, vrp);
prev = vrp;
struct vrp *vrp;
if ((vrp = calloc(1, sizeof(*vrp))) == NULL)
vrp->asid = roa->asid;
vrp->afi = roa->ips[i].afi;
vrp->addr = roa->ips[i].addr;
vrp->maxlength = roa->ips[i].maxlength;
if (RB_INSERT(ccr_vrp_tree, tree, vrp) != NULL)
free(vrp);
ccr_vrp_cmp(const struct vrp *a, const struct vrp *b)
RB_GENERATE(ccr_vrp_tree, vrp, entry, ccr_vrp_cmp);
struct vrp *vrp, *tmp_vrp;
RB_FOREACH_SAFE(vrp, ccr_vrp_tree, vrps, tmp_vrp) {
RB_REMOVE(ccr_vrp_tree, vrps, vrp);
free(vrp);
RB_ENTRY(vrp) entry;
RB_HEAD(vrp_tree, vrp);
RB_PROTOTYPE(vrp_tree, vrp, entry, vrpcmp);
RB_HEAD(ccr_vrp_tree, vrp);
RB_PROTOTYPE(ccr_vrp_tree, vrp, entry, ccr_vrp_cmp);
struct vrp *vrp;
RB_FOREACH(vrp, vrp_tree, &vd->vrps) {
ip_addr_print(&vrp->addr, vrp->afi, ipbuf, sizeof(ipbuf));
if (vrp->maxlength > vrp->addr.prefixlen) {
"maxlen %u ", vrp->maxlength);
ipbuf, maxlenbuf, vrp->asid, (long long)vrp->expires) < 0)
struct vrp *v;
struct vrp *v;
struct vrp *v;
struct vrp *v, *tv;
struct vrp *vrp;
RB_FOREACH(vrp, ccr_vrp_tree, &ccr->vrps) {
ip_addr_print(&vrp->addr, vrp->afi, buf, sizeof(buf));
json_do_int("asn", vrp->asid);
if (vrp->maxlength)
json_do_int("maxlen", vrp->maxlength);
if (vrp->maxlength)
printf("-%hhu", vrp->maxlength);
printf(" AS %u\n", vrp->asid);
struct vrp *v, *found;
vrpcmp(struct vrp *a, struct vrp *b)
RB_GENERATE(vrp_tree, vrp, entry, vrpcmp);
vcpu_exit(struct vm_run_params *vrp)
vcpu_exit_pci(struct vm_run_params *vrp)
vcpu_exit_fw_cfg(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_fw_cfg_dma(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_i8253_misc(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_i8253(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_i8259(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_elcr(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
vcpu_exit_mc146818(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
uint8_t vcpu_exit_mc146818(struct vm_run_params *vrp);
vcpu_exit_com(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
intr = vcpu_process_com_data(vei, vrp->vrp_vm_id,
vrp->vrp_vcpu_id);
pci_handle_address_reg(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
pci_handle_io(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
pci_handle_data_reg(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
struct vm_resetcpu_params vrp;
memset(&vrp, 0, sizeof(vrp));
vrp.vrp_vm_id = vmid;
vrp.vrp_vcpu_id = vcpu_id;
memcpy(&vrp.vrp_init_state, vrs, sizeof(struct vcpu_reg_state));
if (ioctl(env->vmd_fd, VMM_IOC_RESETCPU, &vrp) == -1)
struct vm_run_params **vrp;
vrp = calloc(vmc->vmc_ncpus, sizeof(struct vm_run_params *));
if (vrp == NULL) {
vrp[i] = malloc(sizeof(struct vm_run_params));
if (vrp[i] == NULL) {
vrp[i]->vrp_exit = malloc(sizeof(struct vm_exit));
if (vrp[i]->vrp_exit == NULL) {
vrp[i]->vrp_vm_id = vm->vm_vmmid;
vrp[i]->vrp_vcpu_id = i;
ret = pthread_create(&tid[i], NULL, vcpu_run_loop, vrp[i]);
struct vm_run_params *vrp = (struct vm_run_params *)arg;
uint32_t n = vrp->vrp_vcpu_id;
if (vrp->vrp_irqready && intr_pending(current_vm)) {
vrp->vrp_inject.vie_vector = intr_ack(current_vm);
vrp->vrp_inject.vie_type = VCPU_INJECT_INTR;
vrp->vrp_inject.vie_type = VCPU_INJECT_NONE;
vrp->vrp_intr_pending = intr_pending(current_vm);
if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) == -1) {
if (vrp->vrp_exit_reason == VM_EXIT_TERMINATED) {
if (vrp->vrp_exit_reason != VM_EXIT_NONE) {
ret = vcpu_exit(vrp);
vcpu_exit_inout(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
intr = ioports_map[vei->vei.vei_port](vrp);
vcpu_assert_irq(vrp->vrp_vm_id, vrp->vrp_vcpu_id, intr);
vcpu_exit(struct vm_run_params *vrp)
switch (vrp->vrp_exit_reason) {
ret = vcpu_exit_eptviolation(vrp);
vcpu_exit_inout(vrp);
vcpu_halt(vrp->vrp_vcpu_id);
log_debug("unknown exit reason 0x%x", vrp->vrp_exit_reason);
vcpu_exit_eptviolation(struct vm_run_params *vrp)
struct vm_exit *ve = vrp->vrp_exit;
vcpu_exit_pci(struct vm_run_params *vrp)
struct vm_exit *vei = vrp->vrp_exit;
pci_handle_address_reg(vrp);
pci_handle_data_reg(vrp);
intr = pci_handle_io(vrp);