2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
24 //#include <geekos/mem.h>
25 //#include <geekos/malloc.h>
33 void * Allocate_VMM_Pages(int num_pages);
34 void Free_VMM_Page(void * page);
36 void * VMM_Malloc(unsigned int size);
37 void VMM_Free(void * addr);
39 void * Identity(void *addr);
42 int hook_irq_stub(struct guest_info * info, int irq);
45 int geekos_hook_interrupt(struct guest_info * info, uint_t irq);
47 unsigned int get_cpu_khz();
49 void Init_Stubs(struct guest_info * info);
55 * stubs called by geekos....
58 void send_key_to_vmm(unsigned char status, unsigned char scancode);
59 void send_mouse_to_vmm(unsigned char packet[3]);
60 void send_tick_to_vmm(unsigned int period_us);
65 # define do_div(n,base) ({ \
66 uint32_t __base = (base); \
68 __rem = ((uint64_t)(n)) % __base; \
69 (n) = ((uint64_t)(n)) / __base; \
76 * do_div() is NOT a C function. It wants to return
77 * two values (the quotient and the remainder), but
78 * since that doesn't work very well in C, what it
81 * - modifies the 64-bit dividend _in_place_
82 * - returns the 32-bit remainder
84 * This ends up being the most efficient "calling
87 #define do_div(n,base) ({ \
88 unsigned long __upper, __low, __high, __mod, __base; \
90 asm("":"=a" (__low), "=d" (__high):"A" (n)); \
93 __upper = __high % (__base); \
94 __high = __high / (__base); \
96 asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
97 asm("":"=A" (n):"a" (__low),"d" (__high)); \