From: Jack Lange Date: Fri, 26 Sep 2008 19:56:14 +0000 (-0500) Subject: removed references to GeekOS and added some namespace changes, X-Git-Tag: 1.0~3^2~26 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=091d8b1fcfc3a766f6603d4c1c69d9f8f4bf3031 removed references to GeekOS and added some namespace changes, waiting to move debug functions from geekos to a virtual device --- diff --git a/palacios/include/palacios/vmm_io.h b/palacios/include/palacios/vmm_io.h index b1e211c..827d7e7 100644 --- a/palacios/include/palacios/vmm_io.h +++ b/palacios/include/palacios/vmm_io.h @@ -5,6 +5,7 @@ #define __VMM_IO_H +#ifdef __V3VEE__ #include #include @@ -24,7 +25,6 @@ int v3_hook_io_port(struct guest_info * info, uint_t port, -#ifdef __V3VEE__ struct vmm_io_hook; @@ -65,6 +65,19 @@ struct vmm_io_hook * v3_get_io_hook(struct vmm_io_map * io_map, uint_t port); void PrintDebugIOMap(struct vmm_io_map * io_map); + + +void v3_outb(ushort_t port, uchar_t value); +uchar_t v3_inb(ushort_t port); + +void v3_outw(ushort_t port, ushort_t value); +ushort_t v3_inw(ushort_t port); + +void v3_outdw(ushort_t port, uint_t value); +uint_t v3_indw(ushort_t port); + + + #endif // !__V3VEE__ diff --git a/palacios/include/palacios/vmm_types.h b/palacios/include/palacios/vmm_types.h index 623446f..cd837f4 100644 --- a/palacios/include/palacios/vmm_types.h +++ b/palacios/include/palacios/vmm_types.h @@ -4,9 +4,10 @@ #ifndef __VMM_TYPES_H #define __VMM_TYPES_H -#include +#ifdef __V3VEE__ +//#include + -/* typedef signed char schar_t; typedef unsigned char uchar_t; @@ -24,7 +25,7 @@ typedef unsigned long ulong_t; typedef unsigned long size_t; -*/ + @@ -38,3 +39,5 @@ typedef int sint32_t; typedef ulong_t addr_t; #endif + +#endif diff --git a/palacios/src/devices/generic.c b/palacios/src/devices/generic.c index 3734a56..20ff37f 100644 --- a/palacios/src/devices/generic.c +++ b/palacios/src/devices/generic.c @@ -4,7 +4,7 @@ #include #include #include -#include + @@ -96,17 +96,17 @@ int generic_write_port_passthrough(ushort_t port, switch (length) { case 1: - Out_Byte(port,((uchar_t*)src)[0]); + v3_outb(port,((uchar_t*)src)[0]); break; case 2: - Out_Word(port,((ushort_t*)src)[0]); + v3_outw(port,((ushort_t*)src)[0]); break; case 4: - Out_DWord(port,((uint_t*)src)[0]); + v3_outdw(port,((uint_t*)src)[0]); break; default: for (i = 0; i < length; i++) { - Out_Byte(port, ((uchar_t*)src)[i]); + v3_outb(port, ((uchar_t*)src)[i]); } } //switch length #ifdef RAMDISK_BOOT @@ -140,17 +140,17 @@ int generic_read_port_passthrough(ushort_t port, switch (length) { case 1: - ((uchar_t*)src)[0] = In_Byte(port); + ((uchar_t*)src)[0] = v3_inb(port); break; case 2: - ((ushort_t*)src)[0] = In_Word(port); + ((ushort_t*)src)[0] = v3_inw(port); break; case 4: - ((uint_t*)src)[0] = In_DWord(port); + ((uint_t*)src)[0] = v3_indw(port); break; default: for (i = 0; i < length; i++) { - ((uchar_t*)src)[i] = In_Byte(port); + ((uchar_t*)src)[i] = v3_inb(port); } }//switch length #ifdef RAMDISK_BOOT diff --git a/palacios/src/devices/keyboard.c b/palacios/src/devices/keyboard.c index 73bd992..bc11458 100644 --- a/palacios/src/devices/keyboard.c +++ b/palacios/src/devices/keyboard.c @@ -2,7 +2,6 @@ /* (c) 2008, The V3VEE Project */ #include -#include #include #include @@ -751,7 +750,7 @@ int keyboard_read_delay(ushort_t port, { if (length == 1) { - *((uchar_t*)dest) = In_Byte(port); + *((uchar_t*)dest) = v3_inb(port); PrintDebug("keyboard: read of 0x%x from 80h\n", *((uchar_t*)dest)); diff --git a/palacios/src/geekos/vm.c b/palacios/src/geekos/vm.c index 1744208..ebd4146 100644 --- a/palacios/src/geekos/vm.c +++ b/palacios/src/geekos/vm.c @@ -228,14 +228,14 @@ int RunVMM(struct Boot_Info * bootInfo) { PrintBoth("Configured guest\n"); - v3_hook_io_port(vm_info, 0x61, &IO_Read, &IO_Write, NULL); + //v3_hook_io_port(&vm_info, 0x05, &IO_Read, &IO_Write_to_Serial, NULL); - - v3_hook_io_port(vm_info, 0x400, &IO_Read, &IO_Write_to_Serial, NULL); - v3_hook_io_port(vm_info, 0x401, &IO_Read, &IO_Write_to_Serial, NULL); - v3_hook_io_port(vm_info, 0x402, &IO_Read, &IO_BOCHS_info, NULL); - v3_hook_io_port(vm_info, 0x403, &IO_Read, &IO_BOCHS_debug, NULL); + //v3_hook_io_port(vm_info, 0x61, &IO_Read, &IO_Write, NULL); + //v3_hook_io_port(vm_info, 0x400, &IO_Read, &IO_Write_to_Serial, NULL); + //v3_hook_io_port(vm_info, 0x401, &IO_Read, &IO_Write_to_Serial, NULL); + //v3_hook_io_port(vm_info, 0x402, &IO_Read, &IO_BOCHS_info, NULL); + //v3_hook_io_port(vm_info, 0x403, &IO_Read, &IO_BOCHS_debug, NULL); (vmm_ops).init_guest(vm_info); diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index ccd4a63..e4b973f 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -324,75 +324,3 @@ int config_guest(struct guest_info * info, void * config_ptr) { return 0; } - - - - - - - - - - - - - - - - - - - - - - -#if 0 - - - if (0) { - - // add_shared_mem_range(&(vm_info.mem_layout), 0, 0x800000, 0x10000); - // add_shared_mem_range(&(vm_info.mem_layout), 0, 0x1000000, 0); - - rip = (ulong_t)(void*)&BuzzVM; - // rip -= 0x10000; - // rip = (addr_t)(void*)&exit_test; - // rip -= 0x2000; - vm_info.rip = rip; - rsp = (addr_t)Alloc_Page(); - - vm_info.vm_regs.rsp = (rsp +4092 );// - 0x2000; - - - } else if (0) { - //add_shared_mem_range(&(vm_info.mem_layout), 0x0, 0x1000, 0x100000); - // add_shared_mem_range(&(vm_info.mem_layout), 0x0, 0x100000, 0x0); - - /* - shadow_region_t *ent = Malloc(sizeof(shadow_region_t));; - init_shadow_region_physical(ent,0,0x100000,GUEST_REGION_PHYSICAL_MEMORY, - 0x100000, HOST_REGION_PHYSICAL_MEMORY); - add_shadow_region(&(vm_info.mem_map),ent); - */ - - add_shadow_region_passthrough(&vm_info, 0x0, 0x100000, 0x100000); - - v3_hook_io_port(&vm_info, 0x61, &IO_Read, &IO_Write, NULL); - v3_hook_io_port(&vm_info, 0x05, &IO_Read, &IO_Write_to_Serial, NULL); - - - - /* - vm_info.cr0 = 0; - vm_info.cs.base=0xf000; - vm_info.cs.limit=0xffff; - */ - //vm_info.rip = 0xfff0; - - vm_info.rip = 0; - vm_info.vm_regs.rsp = 0x0; - } else { - - } - -#endif diff --git a/palacios/src/palacios/vmm_io.c b/palacios/src/palacios/vmm_io.c index a73fae4..52945ad 100644 --- a/palacios/src/palacios/vmm_io.c +++ b/palacios/src/palacios/vmm_io.c @@ -14,6 +14,10 @@ #endif +static int default_write(ushort_t port, void *src, uint_t length, void * priv_data); +static int default_read(ushort_t port, void * dst, uint_t length, void * priv_data); + + void init_vmm_io_map(struct guest_info * info) { struct vmm_io_map * io_map = &(info->io_map); io_map->num_ports = 0; @@ -89,50 +93,7 @@ static int remove_io_hook(struct vmm_io_map * io_map, struct vmm_io_hook * io_ho -/* FIX ME */ -static int default_write(ushort_t port, void *src, uint_t length, void * priv_data) { - /* - - if (length == 1) { - __asm__ __volatile__ ( - "outb %b0, %w1" - : - : "a" (*dst), "Nd" (port) - ); - } else if (length == 2) { - __asm__ __volatile__ ( - "outw %b0, %w1" - : - : "a" (*dst), "Nd" (port) - ); - } else if (length == 4) { - __asm__ __volatile__ ( - "outw %b0, %w1" - : - : "a" (*dst), "Nd" (port) - ); - } - */ - return 0; -} - -static int default_read(ushort_t port, void * dst, uint_t length, void * priv_data) -{ - - /* - uchar_t value; - - __asm__ __volatile__ ( - "inb %w1, %b0" - : "=a" (value) - : "Nd" (port) - ); - - return value; - */ - return 0; -} int v3_hook_io_port(struct guest_info * info, uint_t port, int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data), @@ -202,3 +163,130 @@ void PrintDebugIOMap(struct vmm_io_map * io_map) { PrintDebug("IO Port: %hu (Read=%x) (Write=%x)\n", iter->port, iter->read, iter->write); } } + + + +/* + * Write a byte to an I/O port. + */ +void v3_outb(ushort_t port, uchar_t value) { + __asm__ __volatile__ ( + "outb %b0, %w1" + : + : "a" (value), "Nd" (port) + ); +} + +/* + * Read a byte from an I/O port. + */ +uchar_t v3_inb(ushort_t port) { + uchar_t value; + + __asm__ __volatile__ ( + "inb %w1, %b0" + : "=a" (value) + : "Nd" (port) + ); + + return value; +} + +/* + * Write a word to an I/O port. + */ +void v3_outw(ushort_t port, ushort_t value) { + __asm__ __volatile__ ( + "outw %w0, %w1" + : + : "a" (value), "Nd" (port) + ); +} + +/* + * Read a word from an I/O port. + */ +ushort_t v3_inw(ushort_t port) { + ushort_t value; + + __asm__ __volatile__ ( + "inw %w1, %w0" + : "=a" (value) + : "Nd" (port) + ); + + return value; +} + +/* + * Write a double word to an I/O port. + */ +void v3_outdw(ushort_t port, uint_t value) { + __asm__ __volatile__ ( + "outl %0, %1" + : + : "a" (value), "Nd" (port) + ); +} + +/* + * Read a double word from an I/O port. + */ +uint_t v3_indw(ushort_t port) { + uint_t value; + + __asm__ __volatile__ ( + "inl %1, %0" + : "=a" (value) + : "Nd" (port) + ); + + return value; +} + + + + +/* FIX ME */ +static int default_write(ushort_t port, void *src, uint_t length, void * priv_data) { + /* + + if (length == 1) { + __asm__ __volatile__ ( + "outb %b0, %w1" + : + : "a" (*dst), "Nd" (port) + ); + } else if (length == 2) { + __asm__ __volatile__ ( + "outw %b0, %w1" + : + : "a" (*dst), "Nd" (port) + ); + } else if (length == 4) { + __asm__ __volatile__ ( + "outw %b0, %w1" + : + : "a" (*dst), "Nd" (port) + ); + } + */ + return 0; +} + +static int default_read(ushort_t port, void * dst, uint_t length, void * priv_data) { + + /* + uchar_t value; + + __asm__ __volatile__ ( + "inb %w1, %b0" + : "=a" (value) + : "Nd" (port) + ); + + return value; + */ + + return 0; +}