From: Jack Lange Date: Wed, 13 Feb 2008 23:52:22 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: JACK-WORKING-STATIC-GEEKOS~2 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=748e856fe4c5cc9b0b80d60db90af10ceb0247c8 *** empty log message *** --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index 87bc7df..a2b43d1 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -1,6 +1,6 @@ # Makefile for GeekOS kernel, userspace, and tools # Copyright (c) 2004,2005 David H. Hovemeyer -# $Revision: 1.6 $ +# $Revision: 1.7 $ # This is free software. You are permitted to use, # redistribute, and modify it as specified in the file "COPYING". @@ -54,7 +54,7 @@ VPATH := $(PROJECT_ROOT)/src #when -DNDEBUG is set the kassert functions are disabled #JRLDEBUG=-DNDEBUG -JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=1000 -DSERIAL_PRINT=1 +JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 # # @@ -85,7 +85,7 @@ VMM_SIZES = ../include/geekos/vmm_sizes.h # List of targets to build by default. # These targets encompass everything needed to boot # and run GeekOS. -ALL_TARGETS := fd.img VM_linux_kernel +ALL_TARGETS := fd.img vm_kernel # Kernel source files @@ -139,8 +139,8 @@ COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o) #TARGET_CC_PREFIX := i386-elf- # Target C compiler. gcc 2.95.2 or later should work. -#TARGET_CC := $(TARGET_CC_PREFIX)gcc -TARGET_CC := $(TARGET_CC_PREFIX)gcc34 -m32 +TARGET_CC := $(TARGET_CC_PREFIX)gcc +#TARGET_CC := $(TARGET_CC_PREFIX)gcc34 -m32 # Host C compiler. This is used to compile programs to execute on # the host platform, not the target (x86) platform. On x86/ELF @@ -164,8 +164,8 @@ TARGET_NM := $(TARGET_CC_PREFIX)nm TARGET_OBJCOPY := $(TARGET_CC_PREFIX)objcopy # Nasm (http://nasm.sourceforge.net) -#NASM := $(PROJECT_ROOT)/../devtools/bin/nasm -NASM := /opt/vmm-tools/bin/nasm +NASM := $(PROJECT_ROOT)/../devtools/bin/nasm +#NASM := /opt/vmm-tools/bin/nasm AS = as --32 @@ -254,10 +254,10 @@ geekos/test: geekos/test.o geekos/vmcs.o geekos/vmx_lowlevel.o $(CC) geekos/test.o geekos/vmcs.o geekos/vmx_lowlevel.o -o geekos/test # Standard floppy image - just boots the kernel -fd.img : geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin VM_linux_kernel +fd.img : geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin vm_kernel cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > _temp $(PAD) _temp 512 - cat _temp VM_linux_kernel > $@ + cat _temp vm_kernel > $@ # make ready to boot over PXE pxe: fd.img @@ -282,12 +282,12 @@ pxe-discovery-bjp600: fd.img # Floppy boot sector (first stage boot loader). -geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm VM_linux_kernel +geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm vm_kernel $(NASM) -f bin \ -I$(PROJECT_ROOT)/src/geekos/ \ -DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \ -DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \ - -DNUM_VM_KERNEL_SECTORS=`$(NUMSECS) VM_linux_kernel` \ + -DNUM_VM_KERNEL_SECTORS=`$(NUMSECS) vm_kernel` \ $(PROJECT_ROOT)/src/geekos/fd_boot.asm \ -o $@ @@ -323,7 +323,7 @@ generate_sizes: force echo "#define KERNEL_CORE_LENGTH (" `$(NUMSECS) geekos/kernel.bin` "*512)" >> $(VMM_SIZES) echo "#define KERNEL_END (KERNEL_LOAD_ADDRESS+KERNEL_CORE_LENGTH-1)" >> $(VMM_SIZES) - echo "#define VM_KERNEL_LENGTH (" `$(NUMSECS) VM_linux_kernel` "*512)" >> $(VMM_SIZES) + echo "#define VM_KERNEL_LENGTH (" `$(NUMSECS) vm_kernel` "*512)" >> $(VMM_SIZES) echo "#define VM_KERNEL_START (KERNEL_LOAD_ADDRESS + KERNEL_CORE_LENGTH)" >> $(VMM_SIZES) echo "#define VM_BOOT_PACKAGE_START (VM_KERNEL_START) " >> $(VMM_SIZES) echo "#define VM_BOOT_PACKAGE_END (VM_KERNEL_START+VM_KERNEL_LENGTH-1) " >> $(VMM_SIZES) @@ -342,9 +342,9 @@ get_kernel_size: make_show_sizes force: -VM_linux_kernel: force - $(PAD) VM_linux_kernel 512 - @echo "VM kernel lives at 0x100000 and is" `$(NUMSECS) VM_linux_kernel` "sectors long" +vm_kernel: force + $(PAD) vm_kernel 512 + @echo "VM kernel lives at 0x100000 and is" `$(NUMSECS) vm_kernel` "sectors long" # Clean build directories of generated files diff --git a/palacios/build/vm_kernel b/palacios/build/vm_kernel new file mode 100755 index 0000000..417ac70 Binary files /dev/null and b/palacios/build/vm_kernel differ diff --git a/palacios/include/geekos/vmm_sizes.h b/palacios/include/geekos/vmm_sizes.h index 5dbce4d..166096d 100644 --- a/palacios/include/geekos/vmm_sizes.h +++ b/palacios/include/geekos/vmm_sizes.h @@ -4,7 +4,7 @@ #define KERNEL_START (KERNEL_LOAD_ADDRESS) #define KERNEL_CORE_LENGTH ( 211 *512) #define KERNEL_END (KERNEL_LOAD_ADDRESS+KERNEL_CORE_LENGTH-1) -#define VM_KERNEL_LENGTH ( 1673 *512) +#define VM_KERNEL_LENGTH ( 97 *512) #define VM_KERNEL_START (KERNEL_LOAD_ADDRESS + KERNEL_CORE_LENGTH) #define VM_BOOT_PACKAGE_START (VM_KERNEL_START) #define VM_BOOT_PACKAGE_END (VM_KERNEL_START+VM_KERNEL_LENGTH-1) diff --git a/palacios/src/geekos/main.c b/palacios/src/geekos/main.c index f7d614a..3175861 100644 --- a/palacios/src/geekos/main.c +++ b/palacios/src/geekos/main.c @@ -3,7 +3,7 @@ * Copyright (c) 2001,2003,2004 David H. Hovemeyer * Copyright (c) 2003, Jeffrey K. Hollingsworth * Copyright (c) 2004, Iulian Neamtiu - * $Revision: 1.7 $ + * $Revision: 1.8 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -350,48 +350,16 @@ void Main(struct Boot_Info* bootInfo) spkr_thread = Start_Kernel_Thread(Buzzer, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false); -// Enable this to run the simple buzzer VM -#if 0 - - // Put the entry around 0x10000, where the geekos kernel used to live - vm.entry_ip=(uint_t)0x10000; - vm.exit_eip=0; - // Put the stack as the last thing in the VM partition - vm.guest_esp=(uint_t)START_OF_VM+VM_SIZE-1; - - memcpy(vm.entry_ip,MYBUZZVM_START,MYBUZZVM_LEN); - - SerialPrintLevel(1000,"VM-Launching MyBuzzVM after copy to 0x10000\n"); - - vm_thread = Start_Kernel_Thread(VM_Thread, (ulong_t)&vm,PRIORITY_NORMAL,false); -#else -#if 0 - - // write the hello VM down to where we would usually put - // vmxassist, and see if it can talk to us - vm.entry_ip=(uint_t)START_OF_VM+0xd000000; - vm.exit_eip=0; - // Put the stack as the last thing in the VM partition - vm.guest_esp=(uint_t)START_OF_VM+VM_SIZE-1; - - - memcpy((void*)(vm.entry_ip),Hello,200); // 200 should be plenty - - SerialPrintLevel(1000,"VM-Launching HelloVM after copy to 0xd000000\n"); - vm_thread = Start_Kernel_Thread(VM_Thread, (ulong_t)&vm,PRIORITY_NORMAL,false); - -#else // Try to launch a real VM - // First we will copy down VMXAssist, then we'll launch that - // and see if it can handle the system bios // We now map pages of physical memory into where we are going // to slap the vmxassist, bios, and vgabios code + /* pte_t template_pte; template_pte.present=1; @@ -407,7 +375,7 @@ void Main(struct Boot_Info* bootInfo) #define SEGLEN (1024*64) AllocateAndMapPagesForRange(START_OF_VM+0x100000, VM_KERNEL_LENGTH / 512, template_pte); - +*/ // Now we should be copying into actual memory //SerialPrintLevel(1000,"Copying VM code from %x to %x (%d bytes)\n", VM_KERNEL_START, START_OF_VM+0x100000,VM_KERNEL_LENGTH); @@ -416,19 +384,29 @@ void Main(struct Boot_Info* bootInfo) //SerialPrintLevel(1000, "VM copied\n"); // jump into vmxassist - vm.entry_ip=(uint_t)0x100000; + vm.entry_ip=(uint_t)0x00107fd0; vm.exit_eip=0; // Put the stack at 512K - vm.guest_esp=(uint_t)START_OF_VM+1024*512; - + vm.guest_esp=(uint_t)4096 + 8192 - 4; + *(unsigned int *)(vm.guest_esp) = 1024 * 1024; + vm.guest_esp -= 4; + *(unsigned int *)(vm.guest_esp) = 8; + vm.guest_esp -= 4; + *(unsigned int *)(vm.guest_esp) = vm.guest_esp + 4;; + vm.guest_esp -= 4; + *(unsigned int *)(vm.guest_esp) = vm.entry_ip; + // vm.guest_esp -= 4; + + + SerialMemDump((unsigned char *)vm.entry_ip, 512); + vm_thread = Start_Kernel_Thread(VM_Thread, (ulong_t)&vm,PRIORITY_NORMAL,false); SerialPrintLevel(1000,"Next: setup GDT\n"); -#endif -#endif + TODO("Write a Virtual Machine Monitor"); diff --git a/palacios/src/geekos/timer.c b/palacios/src/geekos/timer.c index cd89f86..d38ec74 100644 --- a/palacios/src/geekos/timer.c +++ b/palacios/src/geekos/timer.c @@ -2,7 +2,7 @@ * GeekOS timer interrupt support * Copyright (c) 2001,2003 David H. Hovemeyer * Copyright (c) 2003, Jeffrey K. Hollingsworth - * $Revision: 1.1 $ + * $Revision: 1.2 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -69,7 +69,7 @@ static void Timer_Interrupt_Handler(struct Interrupt_State* state) Begin_IRQ(state); - SerialPrintLevel(10,"Host Timer Interrupt Handler Running\n"); + SerialPrintLevel(1,"Host Timer Interrupt Handler Running\n"); /* Update global and per-thread number of ticks */ ++g_numTicks; diff --git a/palacios/src/geekos/vmx.c b/palacios/src/geekos/vmx.c index 4ce96e0..eb6c718 100644 --- a/palacios/src/geekos/vmx.c +++ b/palacios/src/geekos/vmx.c @@ -540,6 +540,8 @@ int Do_VMM(struct VMXRegs regs) vmcs_ptr_low += vmcs_ptr; + + SerialPrintLevel(100,"ret=%d\n", ret); SerialPrintLevel(100,"Revision: %x\n", *(uint_t *)(vmcs_ptr_low)); vmx_abort = *(uint_t*)(((char *)vmcs_ptr_low)+4); @@ -558,6 +560,9 @@ int Do_VMM(struct VMXRegs regs) return -1; } + + SerialPrint("Guest esp: 0x%x (%u)\n", vm->vmcs.guestStateArea.rsp, vm->vmcs.guestStateArea.rsp); + SerialPrintLevel(100,"VM Exit for reason: %d (%x)\n", vm->vmcs.exitInfoFields.reason & 0x00000fff, vm->vmcs.exitInfoFields.reason); @@ -758,6 +763,8 @@ int MyLaunch(struct VM *vm) int ret; int vmm_ret = 0; + SerialPrint("Guest ESP: 0x%x (%u)\n", guest_esp, guest_esp); + exit_eip=(uint_t)RunVMM; SerialPrintLevel(100,"Clear\n"); @@ -890,5 +897,3 @@ VMCS * CreateVMCS() { return vmcs; } - -