X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fvm.c;h=1b46b2f9650cef7c9602868189f964e3f743b2d7;hb=624d18dad00545964d9074ebd3fc35def3589f48;hp=3666486ac15428b9855d3fe98d7283e3557e916d;hpb=639fdba00d36b2a60fad3d28703459354cf8744f;p=palacios.git diff --git a/palacios/src/geekos/vm.c b/palacios/src/geekos/vm.c index 3666486..1b46b2f 100644 --- a/palacios/src/geekos/vm.c +++ b/palacios/src/geekos/vm.c @@ -5,21 +5,21 @@ #include #include +#include #include #include #include #include +#include #include #include #include +#include #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" @@ -31,7 +31,7 @@ inline void VM_Out_Byte(ushort_t port, uchar_t value) /* * 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; @@ -46,6 +46,7 @@ inline uchar_t VM_In_Byte(ushort_t port) + int IO_Read(ushort_t port, void * dst, uint_t length, void * priv_data) { if (length != 1) { @@ -182,7 +183,7 @@ int RunVMM(struct Boot_Info * bootInfo) { 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); @@ -190,6 +191,7 @@ int RunVMM(struct Boot_Info * bootInfo) { /* 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; @@ -313,16 +315,27 @@ int RunVMM(struct Boot_Info * bootInfo) { 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 * 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), 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)); }