# Makefile for GeekOS kernel, userspace, and tools
# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $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".
#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
#
#
# 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
#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
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
$(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
# 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 $@
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)
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
#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)
* Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu>
* Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
* Copyright (c) 2004, Iulian Neamtiu <neamtiu@cs.umd.edu>
- * $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".
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;
#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);
//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");
* GeekOS timer interrupt support
* Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
* Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
- * $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".
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;
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);
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);
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");
return vmcs;
}
-
-