|
|
1.1 ! root 1: /* ! 2: * Copyright (C) 2007-2011 Free Software Foundation ! 3: * ! 4: * This program is free software ; you can redistribute it and/or modify ! 5: * it under the terms of the GNU General Public License as published by ! 6: * the Free Software Foundation ; either version 2 of the License, or ! 7: * (at your option) any later version. ! 8: * ! 9: * This program is distributed in the hope that it will be useful, ! 10: * but WITHOUT ANY WARRANTY ; without even the implied warranty of ! 11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 12: * GNU General Public License for more details. ! 13: * ! 14: * You should have received a copy of the GNU General Public License ! 15: * along with the program ; if not, write to the Free Software ! 16: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! 17: */ ! 18: ! 19: #include <sys/types.h> ! 20: #include <string.h> ! 21: #include <mach/xen.h> ! 22: #include <machine/xen.h> ! 23: #include <machine/ipl.h> ! 24: #include <xen/block.h> ! 25: #include <xen/console.h> ! 26: #include <xen/grant.h> ! 27: #include <xen/net.h> ! 28: #include <xen/store.h> ! 29: #include <xen/time.h> ! 30: #include "xen.h" ! 31: #include "evt.h" ! 32: ! 33: void hyp_debug() ! 34: { ! 35: panic("debug"); ! 36: } ! 37: ! 38: void hyp_init(void) ! 39: { ! 40: hyp_grant_init(); ! 41: hyp_store_init(); ! 42: evtchn_port_t port = hyp_event_channel_bind_virq(VIRQ_DEBUG, 0); ! 43: hyp_evt_handler(port, hyp_debug, 0, SPL7); ! 44: } ! 45: ! 46: void hyp_dev_init(void) ! 47: { ! 48: /* these depend on hyp_init() and working threads */ ! 49: hyp_block_init(); ! 50: hyp_net_init(); ! 51: } ! 52: ! 53: void _hyp_halt(void) ! 54: { ! 55: hyp_halt(); ! 56: } ! 57: ! 58: void _hyp_todo(unsigned long from) ! 59: { ! 60: printf("TODO: at %lx\n",from); ! 61: hyp_halt(); ! 62: } ! 63: ! 64: extern int int_mask[]; ! 65: void hyp_idle(void) ! 66: { ! 67: int cpu = 0; ! 68: hyp_shared_info.vcpu_info[cpu].evtchn_upcall_mask = 0xff; ! 69: barrier(); ! 70: /* Avoid blocking if there are pending events */ ! 71: if (!hyp_shared_info.vcpu_info[cpu].evtchn_upcall_pending && ! 72: !hyp_shared_info.evtchn_pending[cpu]) ! 73: hyp_block(); ! 74: while (1) { ! 75: hyp_shared_info.vcpu_info[cpu].evtchn_upcall_mask = 0x00; ! 76: barrier(); ! 77: if (!hyp_shared_info.vcpu_info[cpu].evtchn_upcall_pending && ! 78: !hyp_shared_info.evtchn_pending[cpu]) ! 79: /* Didn't miss any event, can return to threads. */ ! 80: break; ! 81: hyp_shared_info.vcpu_info[cpu].evtchn_upcall_mask = 0xff; ! 82: hyp_c_callback(NULL,NULL); ! 83: } ! 84: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.