khypervisor
v1
|
00001 #include "scheduler.h" 00002 #include "hvmm_trace.h" 00003 #include "sched_policy.h" 00004 00005 void scheduler_schedule(void) 00006 { 00007 /* Switch request, actually performed at trap exit */ 00008 context_switchto(sched_policy_determ_next()); 00009 } 00010 00011 void scheduler_test_switch_to_next_guest(void *pdata){ 00012 struct arch_regs *regs = pdata; 00013 #if 0 /* ignore message due to flood log message */ 00014 uint64_t pct = read_cntpct(); 00015 uint32_t tval = read_cnthp_tval(); 00016 00017 uart_print( "cntpct:"); uart_print_hex64(pct); uart_print("\n\r"); 00018 uart_print( "cnth_tval:"); uart_print_hex32(tval); uart_print("\n\r"); 00019 #endif 00020 00021 /* Note: As of context_switchto() and context_perform_switch() are available, 00022 no need to test if trapped from Hyp mode. 00023 context_perform_switch() takes care of it 00024 */ 00025 /* Test guest context switch */ 00026 if ( (regs->cpsr & 0x1F) != 0x1A ) { 00027 scheduler_schedule(); 00028 } 00029 } 00030 00031 void extra_timer_callback(void *pdata) 00032 { 00033 00034 } 00035 00036 void scheduler_test_scheduling(){ 00037 void scheduler_test_switch_to_next_guest(void *pdata); 00038 timer_init(timer_sched); 00039 /* 100Mhz -> 1 count == 10ns at RTSM_VE_CA15, fast model*/ 00040 timer_set_interval(timer_sched, 100000); 00041 timer_add_callback(timer_sched, &scheduler_test_switch_to_next_guest); 00042 timer_start(timer_sched); 00043 00044 00045 timer_add_callback(timer_sched, &extra_timer_callback); 00046 } 00047