void arch_init_events(void) { debug_port = bind_virq(VIRQ_DEBUG, (evtchn_handler_t)virq_debug, 0); if(debug_port == -1) BUG(); unmask_evtchn(debug_port); }
static int xenoprof_setup(void) { int ret; if ( (ret = map_xenoprof_buffer(MAX_XENOPROF_SAMPLES)) ) return ret; if ( (ret = bind_virq()) ) { release_buffer_array(xenoprof_buf, nbuf); return ret; } if (xenoprof_is_primary) { /* Define dom0 as an active domain if not done yet */ if (!active_defined) { domid_t domid; ret = HYPERVISOR_xenoprof_op( XENOPROF_reset_active_list, NULL); if (ret) goto err; domid = 0; ret = HYPERVISOR_xenoprof_op( XENOPROF_set_active, &domid); if (ret) goto err; active_defined = 1; } if (oprofile_backtrace_depth > 0) { ret = HYPERVISOR_xenoprof_op(XENOPROF_set_backtrace, &oprofile_backtrace_depth); if (ret) oprofile_backtrace_depth = 0; } ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, NULL); if (ret) goto err; xenoprof_arch_counter(); ret = HYPERVISOR_xenoprof_op(XENOPROF_setup_events, NULL); if (ret) goto err; } ret = HYPERVISOR_xenoprof_op(XENOPROF_enable_virq, NULL); if (ret) goto err; xenoprof_enabled = 1; return 0; err: unbind_virq(); release_buffer_array(xenoprof_buf, nbuf); return ret; }
static int xenoprof_setup(void) { int ret; int i; ret = bind_virq(); if (ret) return ret; if (is_primary) { struct xenoprof_counter counter; /* Define dom0 as an active domain if not done yet */ if (!active_defined) { domid_t domid; ret = HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL); if (ret) goto err; domid = 0; ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid); if (ret) goto err; active_defined = 1; } ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, NULL); if (ret) goto err; for (i=0; i<num_events; i++) { counter.ind = i; counter.count = (uint64_t)counter_config[i].count; counter.enabled = (uint32_t)counter_config[i].enabled; counter.event = (uint32_t)counter_config[i].event; counter.kernel = (uint32_t)counter_config[i].kernel; counter.user = (uint32_t)counter_config[i].user; counter.unit_mask = (uint64_t)counter_config[i].unit_mask; HYPERVISOR_xenoprof_op(XENOPROF_counter, &counter); } ret = HYPERVISOR_xenoprof_op(XENOPROF_setup_events, NULL); if (ret) goto err; } ret = HYPERVISOR_xenoprof_op(XENOPROF_enable_virq, NULL); if (ret) goto err; xenoprof_enabled = 1; return 0; err: unbind_virq(); return ret; }
evtchn_port_or_error_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq) { evtchn_port_t port; int i; assert(get_current() == main_thread); i = port_alloc(xce_handle); if (i == -1) return -1; printf("xc_evtchn_bind_virq(%d)", virq); port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)xce_handle); if (port < 0) { errno = -port; return -1; } files[xce_handle].evtchn.ports[i].bound = 1; files[xce_handle].evtchn.ports[i].port = port; unmask_evtchn(port); return port; }
void time_init(void) { printk("Initialising timer interface\n"); bind_virq(VIRQ_TIMER, &timer_handler); bind_virq(VIRQ_DOM_TIMER, &dom_timer_handler); }