cp: allow prefixing all console messages with the guest name
[hvf.git] / cp / nucleus / ext.c
blob9512c34437e6db8f1b0523b2e316cba2e1daa0c4
1 /*
2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #include <interrupt.h>
9 #include <sched.h>
12 * This is the tick counter, it starts at 0 when we initialize the nucleus
14 volatile u64 ticks;
16 void set_timer(void)
18 u64 time = 1000 * 1000 * CLK_MICROSEC / HZ;
20 asm volatile(
21 "spt %0\n" /* set timer value */
22 : /* output */
23 : /* input */
24 "m" (time)
28 void __ext_int_handler(void)
30 if (*EXT_INT_CODE == 0x1005) {
32 * This is the timer, let's call the scheduler.
35 ticks++;
37 set_timer();
40 * No need to save the registers, the assembly stub that
41 * called this function already saved them at PSA_INT_GPR
43 if (!(ticks % SCHED_TICKS_PER_SLICE)) {
44 __schedule(EXT_INT_OLD_PSW, TASK_SLEEPING);
46 /* unreachable */
47 BUG();