#include <geekos/vm.h>
#include <geekos/screen.h>
+#include <devices/generic.h>
#include <devices/nvram.h>
#include <devices/timer.h>
#include <devices/simple_pic.h>
#include <devices/8259a.h>
+#include <devices/8254.h>
#include <devices/keyboard.h>
#include <palacios/vmm_intr.h>
#include <palacios/vmm_dev_mgr.h>
+#include <palacios/vmm_time.h>
#define SPEAKER_PORT 0x61
-
-
-
-inline void VM_Out_Byte(ushort_t port, uchar_t value)
+static inline void VM_Out_Byte(ushort_t port, uchar_t value)
{
__asm__ __volatile__ (
"outb %b0, %w1"
/*
* Read a byte from an I/O port.
*/
-inline uchar_t VM_In_Byte(ushort_t port)
+static inline uchar_t VM_In_Byte(ushort_t port)
{
uchar_t value;
+
int IO_Read(ushort_t port, void * dst, uint_t length, void * priv_data) {
if (length != 1) {
os_hooks.paddr_to_vaddr = &Identity;
os_hooks.hook_interrupt = &hook_irq_stub;
os_hooks.ack_irq = &ack_irq;
-
+ os_hooks.get_cpu_khz = &get_cpu_khz;
Init_VMM(&os_hooks, &vmm_ops);
/* MOVE THIS TO AN INIT GUEST ROUTINE */
init_shadow_map(&(vm_info.mem_map));
init_shadow_page_state(&(vm_info.shdw_pg_state));
+ v3_init_time(&(vm_info.time_state));
vm_info.page_mode = SHADOW_PAGING;
vm_info.cpu_mode = REAL;
print_shadow_map(&(vm_info.mem_map));
hook_io_port(&(vm_info.io_map), 0x61, &IO_Read, &IO_Write, NULL);
- hook_io_port(&(vm_info.io_map), 0x05, &IO_Read, &IO_Write_to_Serial, NULL);
+ //hook_io_port(&(vm_info.io_map), 0x05, &IO_Read, &IO_Write_to_Serial, NULL);
hook_io_port(&(vm_info.io_map), 0x400, &IO_Read, &IO_Write_to_Serial, NULL);
hook_io_port(&(vm_info.io_map), 0x403, &IO_Read, &IO_Write_to_Serial, NULL);
{
+
struct vm_device * nvram = create_nvram();
//struct vm_device * timer = create_timer();
struct vm_device * pic = create_pic();
struct vm_device * keyboard = create_keyboard();
+ struct vm_device * pit = create_pit();
+
+ //generic_port_range_type range = {0,1024} ; // hook first 1024 ports if not already hooked
+
+ //struct vm_device * generic = create_generic(&range,1,NULL,0,NULL,0);
+
attach_device(&(vm_info), nvram);
//attach_device(&(vm_info), timer);
attach_device(&(vm_info), pic);
+ attach_device(&(vm_info), pit);
attach_device(&(vm_info), keyboard);
+ // Important that this be attached last!
+ //attach_device(&(vm_info), generic);
+
PrintDebugDevMgr(&(vm_info.dev_mgr));
}