From: Jack Lange Date: Mon, 6 Oct 2008 16:49:59 +0000 (-0500) Subject: build reorganization X-Git-Tag: 1.0~3^2~13 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=d38e1d6edeee83bfb1e3e3c6e2367faa5055bdfe build reorganization --- diff --git a/build/CreateIso.sh b/build/CreateIso.sh new file mode 100755 index 0000000..538faa3 --- /dev/null +++ b/build/CreateIso.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +make DEBUG_ALL=1 world +cp vmm.img iso +mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso + diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..e346632 --- /dev/null +++ b/build/Makefile @@ -0,0 +1,203 @@ +# Makefile for GeekOS kernel, userspace, and tools +# +# Northwestern University +# (c) 2008, Jack Lange +# (c) 2008, Peter Dinda +# (c) 2008, Lei Xia +# (c) 2008, The V3VEE Project +# +# Based on GeekOS Makefile: +# Copyright (c) 2004,2005 David H. Hovemeyer +# $Revision: 1.71 $ + + +# This is free software. You are permitted to use, +# redistribute, and modify it as specified in the file "COPYING". + +# Required software to build GeekOS: +# - GNU Make (http://www.gnu.org/software/make) +# - gcc 2.95.2 generating code for target (i386/ELF) and host platforms +# - nasm (http://nasm.sourceforge.net) +# - Perl5, AWK (any version), egrep +# +# Cygwin (http://cygwin.com) may be used to build GeekOS. +# Make sure that gcc, binutils, nasm, and perl are installed. + +# NOTES: +# - This makefile has been written carefully to work correctly +# with the -j (parallel make) option. I regularly use "make -j 2" +# to speed the build process on 2 processor systems. + + + + +# ---------------------------------------------------------------------- +# Configuration - +# Various options specifying how GeekOS should be built, +# what source files to build, which user programs to build, +# etc. This is generally the only section of the makefile +# that will need to be modified. +# ---------------------------------------------------------------------- +PROJECT_ROOT := .. +PALACIOS_BUILD_DIR := $(PROJECT_ROOT)/palacios/build +GEEKOS_BUILD_DIR := $(PROJECT_ROOT)/geekos/build +GUEST_ISO_DIR := /opt/vmm-tools/isos + +# List of targets to build by default. +# These targets encompass everything needed to boot +# and run GeekOS. +ALL_TARGETS := palacios geekos + +QEMU := /usr/local/qemu/bin/qemu-system-x86_64 + + + +#when -DNDEBUG is set the kassert functions are disabled +#JRLDEBUG=-DNDEBUG + +# DEBUG=1 means VMM_DEBUG, VMM_INFO, and VMM_TRACE are enabled +# as are SERIAL_PRINT_DEBUG +# +DEBUG_SECTIONS := DEBUG=1 + +ifeq ($(DEBUG_ALL),1) + DEBUG_SECTIONS:= $(DEBUG_SECTIONS) DEBUG_ALL=1 +endif + +ifeq ($(DEBUG_SHADOW_PAGING),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=1 +else +ifeq ($(DEBUG_SHADOW_PAGING),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_SHADOW_PAGING=0 +endif +endif + +ifeq ($(DEBUG_CTRL_REGS),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=1 +else +ifeq ($(DEBUG_CTRL_REGS),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_CTRL_REGS=0 +endif +endif + +ifeq ($(DEBUG_INTERRUPTS),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=1 +else +ifeq ($(DEBUG_INTERRUPTS),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_INTERRUPTS=0 +endif +endif + +ifeq ($(DEBUG_IO),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=1 +else +ifeq ($(DEBUG_IO),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_IO=0 +endif +endif + +ifeq ($(DEBUG_KEYBOARD),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=1 +else +ifeq ($(DEBUG_KEYBOARD),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_KEYBOARD=0 +endif +endif + +ifeq ($(DEBUG_PIC),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=1 +else +ifeq ($(DEBUG_PIC),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIC=0 +endif +endif + +ifeq ($(DEBUG_PIT),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=1 +else +ifeq ($(DEBUG_PIT),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_PIT=0 +endif +endif + +ifeq ($(DEBUG_NVRAM),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=1 +else +ifeq ($(DEBUG_NVRAM),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_NVRAM=0 +endif +endif + +ifeq ($(DEBUG_GENERIC),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=1 +else +ifeq ($(DEBUG_GENERIC),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_GENERIC=0 +endif +endif + +ifeq ($(DEBUG_EMULATOR),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=1 +else +ifeq ($(DEBUG_EMULATOR),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_EMULATOR=0 +endif +endif + +ifeq ($(DEBUG_RAMDISK),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=1 +else +ifeq ($(DEBUG_RAMDISK),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) DEBUG_RAMDISK=0 +endif +endif + + +# ---------------------------------------------------------------------- +# Targets - +# Specifies files to be built +# ---------------------------------------------------------------------- + +# Default target - see definition of ALL_TARGETS in Configuration section +all : $(ALL_TARGETS) + + + +palacios: + (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS) world) + + +geekos: + cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/ + cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/ + cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/ + (cd $(GEEKOS_BUILD_DIR) && make clean && make) + + + + +# make ready to boot over PXE +geekos-pxe: geekos + cp $(GEEKOS_BUILD_DIR)/vmm.img /tftpboot/vmm.img + +geekos-run: geekos + $(QEMU) -m 1024 -serial file:serial.out -cdrom $(GUEST_ISO_DIR)/puppy.iso -fda $(GEEKOS_BUILD_DIR)/vmm.img + +geekos-iso: geekos + cp $(GEEKOS_BUILD_DIR)/vmm.img iso/vmm.img + mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso + + + +force: + + + + +# Clean build directories of generated files +clean : + for d in $(GEEKOS_BUILD_DIR) $(PALACIOS_BUILD_DIR); do \ + (cd $$d && make clean); \ + done + + diff --git a/build/Makefile.MASTER.BACKUP b/build/Makefile.MASTER.BACKUP new file mode 100644 index 0000000..b01fc50 --- /dev/null +++ b/build/Makefile.MASTER.BACKUP @@ -0,0 +1,571 @@ +# Makefile for GeekOS kernel, userspace, and tools +# +# Northwestern University +# (c) 2008, Jack Lange +# (c) 2008, Peter Dinda +# (c) 2008, Lei Xia +# (c) 2008, The V3VEE Project +# +# Based on GeekOS Makefile: +# Copyright (c) 2004,2005 David H. Hovemeyer +# $Revision: 1.71 $ + + +# This is free software. You are permitted to use, +# redistribute, and modify it as specified in the file "COPYING". + +# Required software to build GeekOS: +# - GNU Make (http://www.gnu.org/software/make) +# - gcc 2.95.2 generating code for target (i386/ELF) and host platforms +# - nasm (http://nasm.sourceforge.net) +# - Perl5, AWK (any version), egrep +# +# Cygwin (http://cygwin.com) may be used to build GeekOS. +# Make sure that gcc, binutils, nasm, and perl are installed. + +# NOTES: +# - This makefile has been written carefully to work correctly +# with the -j (parallel make) option. I regularly use "make -j 2" +# to speed the build process on 2 processor systems. + + +# Base address of kernel +# +# Note: at top of memory minus three pages (GDT/TSS/IDT) +# minus maximum size +# +# +# Note that the code will initially load at 0x10000 +# +# The setup code needs to copy it up to this address and jump there +# +KERNEL_BASE_ADDR := 0x00100000 + +# Kernel entry point function +KERNEL_ENTRY = $(SYM_PFX)Main + + +PROJECT_ROOT := .. +VPATH := $(PROJECT_ROOT)/src + +#when -DNDEBUG is set the kassert functions are disabled +#JRLDEBUG=-DNDEBUG + +# DEBUG=1 means VMM_DEBUG, VMM_INFO, and VMM_TRACE are enabled +# as are SERIAL_PRINT_DEBUG +# +DEBUG=1 +DEBUG_SECTIONS= + +ifeq ($(DEBUG_ALL),1) + DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_IO -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_GENERIC -DDEBUG_RAMDISK +endif + +ifeq ($(DEBUG_SHADOW_PAGING),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING +else +ifeq ($(DEBUG_SHADOW_PAGING),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_SHADOW_PAGING +endif +endif + +ifeq ($(DEBUG_CTRL_REGS),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_CTRL_REGS +else +ifeq ($(DEBUG_CTRL_REGS),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_CTRL_REGS +endif +endif + +ifeq ($(DEBUG_INTERRUPTS),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_INTERRUPTS +else +ifeq ($(DEBUG_DEBUG_INTERRUPTS),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_INTERRUPTS +endif +endif + +ifeq ($(DEBUG_IO),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_IO +else +ifeq ($(DEBUG_IO),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_IO +endif +endif + +ifeq ($(DEBUG_KEYBOARD),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_KEYBOARD +else +ifeq ($(DEBUG_KEYBOARD),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_KEYBOARD +endif +endif + +ifeq ($(DEBUG_PIC),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_PIC +else +ifeq ($(DEBUG_PIC),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_PIC +endif +endif + +ifeq ($(DEBUG_PIT),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_PIT +else +ifeq ($(DEBUG_PIT),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_PIT +endif +endif + +ifeq ($(DEBUG_NVRAM),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_NVRAM +else +ifeq ($(DEBUG_NVRAM),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_NVRAM +endif +endif + +ifeq ($(DEBUG_GENERIC),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_GENERIC +else +ifeq ($(DEBUG_GENERIC),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_GENERIC +endif +endif + +ifeq ($(DEBUG_EMULATOR),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_EMULATOR +else +ifeq ($(DEBUG_EMULATOR),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_EMULATOR +endif +endif + +ifeq ($(DEBUG_RAMDISK),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_RAMDISK +else +ifeq ($(DEBUG_RAMDISK),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_RAMDISK +endif +endif + + +#DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DTEST_NE2K + +ifeq ($(DEBUG),1) + JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 -DVMM_DEBUG=1 -DVMM_INFO=1 -DVMM_TRACE=1 $(DEBUG_SECTIONS) + +else + JRLDEBUG= -DSERIAL_PRINT_DEBUG=0 -DSERIAL_PRINT_DEBUG_LEVEL=999999 -DSERIAL_PRINT=0 -DVMM_DEBUG=0 -DVMM_INFO=0 -DVMM_TRACE=0 +endif + + +# +# DECODER is the decoder that will be used +# currently we only support xed +# +DECODER=XED + +DECODER_FLAGS= +DECODER_SRCS= +DECODER_LIBS= + +ifeq ($(DECODER),XED) +DECODER_SRCS := vmm_xed.c +DECODER_FLAGS := -L../lib/xed +DECODER_LIBS := -lxed +else +# This is an error +endif + +# +#TCPSTACK, uIP is used currently +# +TCPSTACK=UIP + + + + +# +# This is wrong for current cygwin - no changes needed +# +# Figure out if we're compiling with cygwin, http://cygwin.com +# +# +#SYSTEM_NAME := $(shell uname -s) +#ifeq ($(findstring CYGWIN,$(SYSTEM_NAME)),CYGWIN) +#SYM_PFX := _ +#EXTRA_C_OPTS := -DNEED_UNDERSCORE -DGNU_WIN32 +#EXTRA_NASM_OPTS := -DNEED_UNDERSCORE +#NON_ELF_SYSTEM := yes +#EXTRA_CC_USER_OPTS := -Dmain=geekos_main +#endif + + + + +# ---------------------------------------------------------------------- +# Configuration - +# Various options specifying how GeekOS should be built, +# what source files to build, which user programs to build, +# etc. This is generally the only section of the makefile +# that will need to be modified. +# ---------------------------------------------------------------------- + +# List of targets to build by default. +# These targets encompass everything needed to boot +# and run GeekOS. +ALL_TARGETS := vmm.img vm_kernel + + +# Kernel source files +KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \ + blockdev.c ide.c ne2k.c \ + keyboard.c screen.c timer.c \ + mem.c crc32.c \ + gdt.c tss.c segment.c \ + bget.c malloc.c \ + synch.c kthread.c \ + serial.c reboot.c \ + paging.c \ + debug.c vmm_stubs.c vm.c pci.c\ + queue.c socket.c net.c ring_buffer.c \ + main.c + + +# Kernel object files built from C source files +KERNEL_C_OBJS := $(KERNEL_C_SRCS:%.c=geekos/%.o) + +# Kernel assembly files +KERNEL_ASM_SRCS := lowlevel.asm + +KERNEL_GAS_SRCS := testvm.s udivdi3.s + +# Kernel object files build from assembler source files +KERNEL_ASM_OBJS := $(KERNEL_ASM_SRCS:%.asm=geekos/%.o) + +KERNEL_GAS_OBJS := $(KERNEL_GAS_SRCS:%.s=geekos/%.o) + + +# All kernel object files +KERNEL_OBJS := $(KERNEL_C_OBJS) \ + $(KERNEL_ASM_OBJS) $(KERNEL_GAS_OBJS) + +# Common library source files. +# This library is linked into both the kernel and user programs. +# It provides string functions and generic printf()-style +# formatted output. +COMMON_C_SRCS := fmtout.c string.c memmove.c + +# Common library object files. +COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o) + +VMM_ASM_SRCS := svm_lowlevel.asm \ +# vmx_lowlevel.asm + +VMM_ASM_OBJS := $(VMM_ASM_SRCS:%.asm=palacios/%.o) + + +VMM_C_SRCS := vm_guest.c \ + svm.c svm_handler.c vmm.c vmm_util.c vmm_ctrl_regs.c \ + vmcb.c vmm_mem.c vmm_paging.c vmm_io.c vmm_debug.c svm_io.c \ + vmm_intr.c vmm_time.c \ + vmm_shadow_paging.c vm_guest_mem.c \ + vm_dev.c vmm_dev_mgr.c vmm_decoder.c \ + svm_halt.c svm_pause.c svm_wbinvd.c \ + vmm_config.c vmm_hashtable.c \ + vmm_string.c vmm_emulator.c vmm_queue.c\ + $(DECODER_SRCS) +# vmx.c vmcs_gen.c vmcs.c + +VMM_C_OBJS := $(VMM_C_SRCS:%.c=palacios/%.o) + +VMM_OBJS := $(VMM_C_OBJS) $(VMM_ASM_OBJS) + + + + +DEVICE_C_SRCS := generic.c keyboard.c nvram.c timer.c simple_pic.c 8259a.c 8254.c serial.c ramdisk.c cdrom.c + +DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o) + +DEVICE_OBJS := $(DEVICE_C_OBJS) + +V3LIBS := $(DECODER_LIBS) + + +TCPSTACK_C_SRCS := psock.c timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c resolv.c + +TCPSTACK_C_OBJS := $(TCPSTACK_C_SRCS:%.c=net/%.o) + +TCPSTACK_OBJS := $(TCPSTACK_C_OBJS) + + + + +# ---------------------------------------------------------------------- +# Tools - +# This section defines programs that are used to build GeekOS. +# ---------------------------------------------------------------------- + +# Uncomment if cross compiling +TARGET_CC_PREFIX := $(PROJECT_ROOT)/../devtools/i386/bin/i386-elf- +#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 + +# Host C compiler. This is used to compile programs to execute on +# the host platform, not the target (x86) platform. On x86/ELF +# systems, such as Linux and FreeBSD, it can generally be the same +# as the target C compiler. +HOST_CC := gcc + +# Target linker. GNU ld is probably to only one that will work. +TARGET_LD := $(TARGET_CC_PREFIX)ld -melf_i386 + +# Target archiver +TARGET_AR := $(TARGET_CC_PREFIX)ar + +# Target ranlib +TARGET_RANLIB := $(TARGET_CC_PREFIX)ranlib + +# Target nm +TARGET_NM := $(TARGET_CC_PREFIX)nm + +# Target objcopy +TARGET_OBJCOPY := $(TARGET_CC_PREFIX)objcopy + +# Nasm (http://nasm.sourceforge.net) +NASM := $(PROJECT_ROOT)/../devtools/bin/nasm +#NASM := /opt/vmm-tools/bin/nasm + +AS = as --32 + +# Tool to build PFAT filesystem images. +BUILDFAT := tools/builtFat.exe + +# Perl5 or later +PERL := perl + +# Pad a file so its size is a multiple of some unit (i.e., sector size) +PAD := $(PERL) $(PROJECT_ROOT)/scripts/pad + +# Create a file filled with zeroes. +ZEROFILE := $(PERL) $(PROJECT_ROOT)/scripts/zerofile + +# Calculate size of file in sectors +NUMSECS := $(PERL) $(PROJECT_ROOT)/scripts/numsecs + + +FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track + + +# ---------------------------------------------------------------------- +# Definitions - +# Options passed to the tools. +# ---------------------------------------------------------------------- + +# Flags used for all C source files +GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) $(BOOT_FLAGS) -fPIC +CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror + +# Flags used for kernel C source files +CC_KERNEL_OPTS := -g -DGEEKOS -I$(PROJECT_ROOT)/include + +# Flags used for VMM C source files +CC_VMM_OPTS := -g -I$(PROJECT_ROOT)/include -D__V3VEE__ -D__V3_32BIT__ $(DECODER_FLAGS) $(JRLDEBUG) + +# Flags used for VMM C ASM files +NASM_VMM_OPTS := -I$(PROJECT_ROOT)/src/palacios/ -f elf $(EXTRA_NASM_OPTS) + +# Flags user for kernel assembly files +NASM_KERNEL_OPTS := -I$(PROJECT_ROOT)/src/geekos/ -f elf $(EXTRA_NASM_OPTS) + +# Flags used for common library and libc source files +CC_USER_OPTS := -I$(PROJECT_ROOT)/include -I$(PROJECT_ROOT)/include/libc \ + $(EXTRA_CC_USER_OPTS) + +# Flags passed to objcopy program (strip unnecessary sections from kernel.exe) +OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment + +# ---------------------------------------------------------------------- +# Rules - +# Describes how to compile the source files. +# ---------------------------------------------------------------------- + +# Compilation of kernel C source files + +geekos/%.o : geekos/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o + + +# Compilation of kernel assembly source files +geekos/%.o : geekos/%.asm + $(NASM) $(NASM_KERNEL_OPTS) $< -o geekos/$*.o + +# Compilation of test VM +geekos/%.o : geekos/%.s + $(AS) $< -o geekos/$*.o + +geekos/%.o : geekos/%.S + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o + +# Compilation of common library C source files +common/%.o : common/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o common/$*.o + +palacios/%.o : palacios/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o palacios/$*.o + +palacios/%.o : palacios/%.asm + $(NASM) $(NASM_VMM_OPTS) $< -o palacios/$*.o + +devices/%.o : devices/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o devices/$*.o + +devices/%.o : devices/%.asm + $(NASM) $(NASM_VMM_OPTS) $< -o devices/$*.o + +net/%.o : net/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o net/$*.o + +# ---------------------------------------------------------------------- +# Targets - +# Specifies files to be built +# ---------------------------------------------------------------------- + +# Default target - see definition of ALL_TARGETS in Configuration section +all : $(ALL_TARGETS) + + +#geekos/vmx_lowlevel.o: $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm +# $(NASM) -O99 \ +# -f elf \ +# -I$(PROJECT_ROOT)/src/geekos/ \ +# $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm \ +# -o $@ + + +#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 + cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > _temp + $(PAD) _temp 512 + cp _temp fd.img + +vmm.img : fd.img + cp fd.img vmm.img + $(PAD) vmm.img 1474560 + +rombios_link: + ln -s -f ../src/vmboot/rombios/BIOS-bochs-latest rombios + +vgabios_link: + ln -s -f ../src/vmboot/vgabios/VGABIOS-lgpl-latest.bin vgabios + +force_rombios: rombios_link + (cd ../src/vmboot/rombios; make clean; make) + +force_vgabios: vgabios_link + (cd ../src/vmboot/vgabios; make clean; make) + +force_payload: force_rombios force_vgabios + ../scripts/make_payload.pl payload_layout.txt vm_kernel + +inter1: force_payload + -make clean + +world: inter1 vmm.img + +# make ready to boot over PXE +pxe: vmm.img + cp vmm.img /tftpboot/vmm.img + +run: vmm.img + /usr/local/qemu/bin/qemu-system-x86_64 -m 1024 -serial file:serial.out -cdrom puppy.iso -fda vmm.img + +iso: vmm.img + cp vmm.img iso/vmm.img + mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso + + + +# Floppy boot sector (first stage boot loader). +geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm + $(NASM) -f bin \ + -I$(PROJECT_ROOT)/src/geekos/ \ + -DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \ + -DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \ + -DSECTORS_PER_TRACK=`$(FD_SECTORS_PER_TRACK) geekos/kernel.bin geekos/setup.bin` \ + $(PROJECT_ROOT)/src/geekos/fd_boot.asm \ + -o $@ + +# Setup program (second stage boot loader). +geekos/setup.bin : geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/setup.asm + $(NASM) -f bin \ + -I$(PROJECT_ROOT)/src/geekos/ \ + -DENTRY_POINT=0x`egrep 'Main$$' geekos/kernel.syms |awk '{print $$1}'` \ + -DVMM_SIZE=`$(NUMSECS) geekos/kernel.bin` \ + $(PROJECT_ROOT)/src/geekos/setup.asm \ + -o $@ + $(PAD) $@ 2048 + +# Loadable (flat) kernel image. +geekos/kernel.bin : geekos/kernel.exe + $(TARGET_OBJCOPY) $(OBJCOPY_FLAGS) -S -O binary geekos/kernel.exe geekos/kernel.bin + $(PAD) $@ 512 + +# The kernel executable and symbol map. +geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(TCPSTACK_OBJS) vm_kernel + $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \ + $(DECODER_FLAGS) \ + $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(V3LIBS) $(TCPSTACK_OBJS) -b binary vm_kernel + $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms + + +force: + + +#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 +clean : + for d in geekos common libc user tools palacios devices net; do \ + (cd $$d && rm -f *); \ + done + + +# Build header file dependencies, so source files are recompiled when +# header files they depend on are modified. +depend : $(GENERATED_LIBC_SRCS) + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ + $(KERNEL_C_SRCS:%.c=$(PROJECT_ROOT)/src/geekos/%.c) \ + | $(PERL) -n -e 's,^(\S),geekos/$$1,;print' \ + > depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_USER_OPTS) \ + $(COMMON_C_SRCS:%.c=$(PROJECT_ROOT)/src/common/%.c) \ + | $(PERL) -n -e 's,^(\S),common/$$1,;print' \ + >> depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ + $(VMM_C_SRCS:%.c=$(PROJECT_ROOT)/src/palacios/%.c) \ + | $(PERL) -n -e 's,^(\S),palacios/$$1,;print' \ + >> depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ + $(DEVICE_C_SRCS:%.c=$(PROJECT_ROOT)/src/devices/%.c) \ + | $(PERL) -n -e 's,^(\S),devices/$$1,;print' \ + >> depend.mak + +# By default, there are no header file dependencies. +depend.mak : + touch $@ + +include depend.mak diff --git a/palacios/build/NOTES-QEMU.TXT b/build/NOTES-QEMU.TXT similarity index 100% rename from palacios/build/NOTES-QEMU.TXT rename to build/NOTES-QEMU.TXT diff --git a/build/RunPuppy.sh b/build/RunPuppy.sh new file mode 100755 index 0000000..0b36f37 --- /dev/null +++ b/build/RunPuppy.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/local/qemu/bin/qemu-system-x86_64 -serial file:serial.out -m 1024 -fda vmm.img -cdrom /opt/vmm-tools/isos/puppy.iso diff --git a/build/RunXP.sh b/build/RunXP.sh new file mode 100755 index 0000000..b78ed47 --- /dev/null +++ b/build/RunXP.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/local/qemu/bin/qemu-system-x86_64 -serial file:serial.out -m 1024 -fda vmm.img -cdrom /opt/vmm-tools/isos/winxp.iso diff --git a/palacios/build/iso/boot/grub/menu.lst b/build/iso/boot/grub/menu.lst similarity index 100% rename from palacios/build/iso/boot/grub/menu.lst rename to build/iso/boot/grub/menu.lst diff --git a/palacios/build/iso/boot/grub/stage2_eltorito b/build/iso/boot/grub/stage2_eltorito similarity index 100% rename from palacios/build/iso/boot/grub/stage2_eltorito rename to build/iso/boot/grub/stage2_eltorito diff --git a/palacios/COPYING.geekos b/geekos/COPYING.geekos similarity index 100% rename from palacios/COPYING.geekos rename to geekos/COPYING.geekos diff --git a/palacios/LICENSE-klibc.geekos b/geekos/LICENSE-klibc.geekos similarity index 100% rename from palacios/LICENSE-klibc.geekos rename to geekos/LICENSE-klibc.geekos diff --git a/palacios/README b/geekos/README similarity index 100% rename from palacios/README rename to geekos/README diff --git a/palacios/build/.bochsrc b/geekos/build/.bochsrc similarity index 100% rename from palacios/build/.bochsrc rename to geekos/build/.bochsrc diff --git a/geekos/build/Makefile b/geekos/build/Makefile new file mode 100644 index 0000000..29c05b9 --- /dev/null +++ b/geekos/build/Makefile @@ -0,0 +1,363 @@ +# Makefile for GeekOS kernel, userspace, and tools +# +# Northwestern University +# (c) 2008, Jack Lange +# (c) 2008, Peter Dinda +# (c) 2008, Lei Xia +# (c) 2008, The V3VEE Project +# +# Based on GeekOS Makefile: +# Copyright (c) 2004,2005 David H. Hovemeyer +# $Revision: 1.71 $ + + +# This is free software. You are permitted to use, +# redistribute, and modify it as specified in the file "COPYING". + +# Required software to build GeekOS: +# - GNU Make (http://www.gnu.org/software/make) +# - gcc 2.95.2 generating code for target (i386/ELF) and host platforms +# - nasm (http://nasm.sourceforge.net) +# - Perl5, AWK (any version), egrep +# +# Cygwin (http://cygwin.com) may be used to build GeekOS. +# Make sure that gcc, binutils, nasm, and perl are installed. + +# NOTES: +# - This makefile has been written carefully to work correctly +# with the -j (parallel make) option. I regularly use "make -j 2" +# to speed the build process on 2 processor systems. + + +# Base address of kernel +# +# Note: at top of memory minus three pages (GDT/TSS/IDT) +# minus maximum size +# +# +# Note that the code will initially load at 0x10000 +# +# The setup code needs to copy it up to this address and jump there +# +KERNEL_BASE_ADDR := 0x00100000 + +# Kernel entry point function +KERNEL_ENTRY = $(SYM_PFX)Main + + +PROJECT_ROOT := .. +V3_ROOT := $(PROJECT_ROOT)/../palacios +VPATH := $(PROJECT_ROOT)/src + + + +# +#TCPSTACK, uIP is used currently +# +TCPSTACK=UIP + + + + +# +# This is wrong for current cygwin - no changes needed +# +# Figure out if we're compiling with cygwin, http://cygwin.com +# +# +#SYSTEM_NAME := $(shell uname -s) +#ifeq ($(findstring CYGWIN,$(SYSTEM_NAME)),CYGWIN) +#SYM_PFX := _ +#EXTRA_C_OPTS := -DNEED_UNDERSCORE -DGNU_WIN32 +#EXTRA_NASM_OPTS := -DNEED_UNDERSCORE +#NON_ELF_SYSTEM := yes +#EXTRA_CC_USER_OPTS := -Dmain=geekos_main +#endif + + + + +# ---------------------------------------------------------------------- +# Configuration - +# Various options specifying how GeekOS should be built, +# what source files to build, which user programs to build, +# etc. This is generally the only section of the makefile +# that will need to be modified. +# ---------------------------------------------------------------------- + +# List of targets to build by default. +# These targets encompass everything needed to boot +# and run GeekOS. +ALL_TARGETS := vmm.img + + +# Kernel source files +KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \ + blockdev.c ide.c ne2k.c \ + keyboard.c screen.c timer.c \ + mem.c crc32.c \ + gdt.c tss.c segment.c \ + bget.c malloc.c \ + synch.c kthread.c \ + serial.c reboot.c \ + paging.c \ + debug.c vmm_stubs.c vm.c pci.c\ + queue.c socket.c net.c ring_buffer.c \ + main.c + + +# Kernel object files built from C source files +KERNEL_C_OBJS := $(KERNEL_C_SRCS:%.c=geekos/%.o) + +# Kernel assembly files +KERNEL_ASM_SRCS := lowlevel.asm + +KERNEL_GAS_SRCS := + +# Kernel object files build from assembler source files +KERNEL_ASM_OBJS := $(KERNEL_ASM_SRCS:%.asm=geekos/%.o) + +KERNEL_GAS_OBJS := $(KERNEL_GAS_SRCS:%.s=geekos/%.o) + + +# All kernel object files +KERNEL_OBJS := $(KERNEL_C_OBJS) \ + $(KERNEL_ASM_OBJS) $(KERNEL_GAS_OBJS) + +# Common library source files. +# This library is linked into both the kernel and user programs. +# It provides string functions and generic printf()-style +# formatted output. +COMMON_C_SRCS := fmtout.c string.c memmove.c + +# Common library object files. +COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o) + + + + +V3_LD_FLAGS := -L./palacios/ +#V3_LIBS := -lxed -lv3vee +V3_LIBS := ./palacios/libxed.a ./palacios/libv3vee.a ./palacios/libxed.a ./palacios/libv3vee.a + + + +TCPSTACK_C_SRCS := psock.c timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c resolv.c + +TCPSTACK_C_OBJS := $(TCPSTACK_C_SRCS:%.c=net/%.o) + +TCPSTACK_OBJS := $(TCPSTACK_C_OBJS) + + + + +# ---------------------------------------------------------------------- +# Tools - +# This section defines programs that are used to build GeekOS. +# ---------------------------------------------------------------------- + +# Uncomment if cross compiling +TARGET_CC_PREFIX := $(PROJECT_ROOT)/../devtools/i386/bin/i386-elf- +#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 + +# Host C compiler. This is used to compile programs to execute on +# the host platform, not the target (x86) platform. On x86/ELF +# systems, such as Linux and FreeBSD, it can generally be the same +# as the target C compiler. +HOST_CC := gcc + +# Target linker. GNU ld is probably to only one that will work. +TARGET_LD := $(TARGET_CC_PREFIX)ld -melf_i386 + +# Target archiver +TARGET_AR := $(TARGET_CC_PREFIX)ar + +# Target ranlib +TARGET_RANLIB := $(TARGET_CC_PREFIX)ranlib + +# Target nm +TARGET_NM := $(TARGET_CC_PREFIX)nm + +# Target objcopy +TARGET_OBJCOPY := $(TARGET_CC_PREFIX)objcopy + +# Nasm (http://nasm.sourceforge.net) +NASM := $(PROJECT_ROOT)/../devtools/bin/nasm +#NASM := /opt/vmm-tools/bin/nasm + +AS = as --32 + +# Tool to build PFAT filesystem images. +BUILDFAT := tools/builtFat.exe + +# Perl5 or later +PERL := perl + +# Pad a file so its size is a multiple of some unit (i.e., sector size) +PAD := $(PERL) $(PROJECT_ROOT)/scripts/pad + +# Create a file filled with zeroes. +ZEROFILE := $(PERL) $(PROJECT_ROOT)/scripts/zerofile + +# Calculate size of file in sectors +NUMSECS := $(PERL) $(PROJECT_ROOT)/scripts/numsecs + + +FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track + + +# ---------------------------------------------------------------------- +# Definitions - +# Options passed to the tools. +# ---------------------------------------------------------------------- + +# Flags used for all C source files +GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(BOOT_FLAGS) -fPIC +CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror + +# Flags used for kernel C source files +CC_KERNEL_OPTS := -g -DGEEKOS -I$(PROJECT_ROOT)/include -I$(V3_ROOT)/include + + +# Flags user for kernel assembly files +NASM_KERNEL_OPTS := -I$(PROJECT_ROOT)/src/geekos/ -f elf $(EXTRA_NASM_OPTS) + +# Flags used for common library and libc source files +CC_USER_OPTS := -I$(PROJECT_ROOT)/include -I$(PROJECT_ROOT)/include/libc \ + $(EXTRA_CC_USER_OPTS) -I$(V3_ROOT)/include + +# Flags passed to objcopy program (strip unnecessary sections from kernel.exe) +OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment + +# ---------------------------------------------------------------------- +# Rules - +# Describes how to compile the source files. +# ---------------------------------------------------------------------- + +# Compilation of kernel C source files + +geekos/%.o : geekos/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o + + +# Compilation of kernel assembly source files +geekos/%.o : geekos/%.asm + $(NASM) $(NASM_KERNEL_OPTS) $< -o geekos/$*.o + + +# Compilation of common library C source files +common/%.o : common/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o common/$*.o + + +net/%.o : net/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o net/$*.o + +# ---------------------------------------------------------------------- +# Targets - +# Specifies files to be built +# ---------------------------------------------------------------------- + +# Default target - see definition of ALL_TARGETS in Configuration section +all : $(ALL_TARGETS) + + +#geekos/vmx_lowlevel.o: $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm +# $(NASM) -O99 \ +# -f elf \ +# -I$(PROJECT_ROOT)/src/geekos/ \ +# $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm \ +# -o $@ + + +#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 + cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > _temp + $(PAD) _temp 512 + cp _temp fd.img + + +vmm.img: fd.img + cp fd.img vmm.img + $(PAD) vmm.img 1474560 + + + + + + +# Floppy boot sector (first stage boot loader). +geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm + $(NASM) -f bin \ + -I$(PROJECT_ROOT)/src/geekos/ \ + -DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \ + -DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \ + -DSECTORS_PER_TRACK=`$(FD_SECTORS_PER_TRACK) geekos/kernel.bin geekos/setup.bin` \ + $(PROJECT_ROOT)/src/geekos/fd_boot.asm \ + -o $@ + +# Setup program (second stage boot loader). +geekos/setup.bin : geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/setup.asm + $(NASM) -f bin \ + -I$(PROJECT_ROOT)/src/geekos/ \ + -DENTRY_POINT=0x`egrep 'Main$$' geekos/kernel.syms |awk '{print $$1}'` \ + -DVMM_SIZE=`$(NUMSECS) geekos/kernel.bin` \ + $(PROJECT_ROOT)/src/geekos/setup.asm \ + -o $@ + $(PAD) $@ 2048 + +# Loadable (flat) kernel image. +geekos/kernel.bin : geekos/kernel.exe + $(TARGET_OBJCOPY) $(OBJCOPY_FLAGS) -S -O binary geekos/kernel.exe geekos/kernel.bin + $(PAD) $@ 512 + +# The kernel executable and symbol map. +geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(TCPSTACK_OBJS) + $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \ + $(V3_LD_FLAGS) \ + $(KERNEL_OBJS) $(COMMON_C_OBJS) $(TCPSTACK_OBJS) $(V3_LIBS) -b binary ./palacios/vm_kernel + $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms + + +force: + + +#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 +clean : + for d in geekos common libc user tools net; do \ + (cd $$d && rm -f *); \ + done + + +# Build header file dependencies, so source files are recompiled when +# header files they depend on are modified. +depend : $(GENERATED_LIBC_SRCS) + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ + $(KERNEL_C_SRCS:%.c=$(PROJECT_ROOT)/src/geekos/%.c) \ + | $(PERL) -n -e 's,^(\S),geekos/$$1,;print' \ + > depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_USER_OPTS) \ + $(COMMON_C_SRCS:%.c=$(PROJECT_ROOT)/src/common/%.c) \ + | $(PERL) -n -e 's,^(\S),common/$$1,;print' \ + >> depend.mak + + +# By default, there are no header file dependencies. +depend.mak : + touch $@ + +include depend.mak diff --git a/palacios/build/common/.ignore b/geekos/build/common/.ignore similarity index 100% rename from palacios/build/common/.ignore rename to geekos/build/common/.ignore diff --git a/palacios/build/geekos/.ignore b/geekos/build/geekos/.ignore similarity index 100% rename from palacios/build/geekos/.ignore rename to geekos/build/geekos/.ignore diff --git a/palacios/build/libc/.ignore b/geekos/build/libc/.ignore similarity index 100% rename from palacios/build/libc/.ignore rename to geekos/build/libc/.ignore diff --git a/palacios/build/net/.ignore b/geekos/build/net/.ignore similarity index 100% copy from palacios/build/net/.ignore copy to geekos/build/net/.ignore diff --git a/palacios/build/net/.ignore b/geekos/build/palacios/.ignore similarity index 100% copy from palacios/build/net/.ignore copy to geekos/build/palacios/.ignore diff --git a/palacios/build/tools/.ignore b/geekos/build/tools/.ignore similarity index 100% rename from palacios/build/tools/.ignore rename to geekos/build/tools/.ignore diff --git a/palacios/build/user/.ignore b/geekos/build/user/.ignore similarity index 100% rename from palacios/build/user/.ignore rename to geekos/build/user/.ignore diff --git a/palacios/include/geekos/argblock.h b/geekos/include/geekos/argblock.h similarity index 100% rename from palacios/include/geekos/argblock.h rename to geekos/include/geekos/argblock.h diff --git a/palacios/include/geekos/bget.h b/geekos/include/geekos/bget.h similarity index 100% rename from palacios/include/geekos/bget.h rename to geekos/include/geekos/bget.h diff --git a/palacios/include/geekos/blockdev.h b/geekos/include/geekos/blockdev.h similarity index 100% rename from palacios/include/geekos/blockdev.h rename to geekos/include/geekos/blockdev.h diff --git a/palacios/include/geekos/bootinfo.h b/geekos/include/geekos/bootinfo.h similarity index 100% rename from palacios/include/geekos/bootinfo.h rename to geekos/include/geekos/bootinfo.h diff --git a/palacios/include/geekos/cpu.h b/geekos/include/geekos/cpu.h similarity index 100% rename from palacios/include/geekos/cpu.h rename to geekos/include/geekos/cpu.h diff --git a/palacios/include/geekos/crc32.h b/geekos/include/geekos/crc32.h similarity index 100% rename from palacios/include/geekos/crc32.h rename to geekos/include/geekos/crc32.h diff --git a/palacios/include/geekos/debug.h b/geekos/include/geekos/debug.h similarity index 100% rename from palacios/include/geekos/debug.h rename to geekos/include/geekos/debug.h diff --git a/palacios/include/geekos/defs.h b/geekos/include/geekos/defs.h similarity index 100% rename from palacios/include/geekos/defs.h rename to geekos/include/geekos/defs.h diff --git a/palacios/include/geekos/errno.h b/geekos/include/geekos/errno.h similarity index 100% rename from palacios/include/geekos/errno.h rename to geekos/include/geekos/errno.h diff --git a/palacios/include/geekos/fileio.h b/geekos/include/geekos/fileio.h similarity index 100% rename from palacios/include/geekos/fileio.h rename to geekos/include/geekos/fileio.h diff --git a/palacios/include/geekos/fmtout.h b/geekos/include/geekos/fmtout.h similarity index 100% rename from palacios/include/geekos/fmtout.h rename to geekos/include/geekos/fmtout.h diff --git a/palacios/include/geekos/gdt.h b/geekos/include/geekos/gdt.h similarity index 100% rename from palacios/include/geekos/gdt.h rename to geekos/include/geekos/gdt.h diff --git a/palacios/include/geekos/ide.h b/geekos/include/geekos/ide.h similarity index 100% rename from palacios/include/geekos/ide.h rename to geekos/include/geekos/ide.h diff --git a/palacios/include/geekos/idt.h b/geekos/include/geekos/idt.h similarity index 100% rename from palacios/include/geekos/idt.h rename to geekos/include/geekos/idt.h diff --git a/palacios/include/geekos/int.h b/geekos/include/geekos/int.h similarity index 100% rename from palacios/include/geekos/int.h rename to geekos/include/geekos/int.h diff --git a/palacios/include/geekos/io.h b/geekos/include/geekos/io.h similarity index 100% rename from palacios/include/geekos/io.h rename to geekos/include/geekos/io.h diff --git a/palacios/include/geekos/io_defs.h b/geekos/include/geekos/io_defs.h similarity index 100% rename from palacios/include/geekos/io_defs.h rename to geekos/include/geekos/io_defs.h diff --git a/palacios/include/geekos/io_devs.h b/geekos/include/geekos/io_devs.h similarity index 100% rename from palacios/include/geekos/io_devs.h rename to geekos/include/geekos/io_devs.h diff --git a/palacios/include/geekos/irq.h b/geekos/include/geekos/irq.h similarity index 100% rename from palacios/include/geekos/irq.h rename to geekos/include/geekos/irq.h diff --git a/palacios/include/geekos/kassert.h b/geekos/include/geekos/kassert.h similarity index 100% rename from palacios/include/geekos/kassert.h rename to geekos/include/geekos/kassert.h diff --git a/palacios/include/geekos/keyboard.h b/geekos/include/geekos/keyboard.h similarity index 100% rename from palacios/include/geekos/keyboard.h rename to geekos/include/geekos/keyboard.h diff --git a/palacios/include/geekos/kthread.h b/geekos/include/geekos/kthread.h similarity index 100% rename from palacios/include/geekos/kthread.h rename to geekos/include/geekos/kthread.h diff --git a/palacios/include/geekos/ktypes.h b/geekos/include/geekos/ktypes.h similarity index 100% rename from palacios/include/geekos/ktypes.h rename to geekos/include/geekos/ktypes.h diff --git a/palacios/include/geekos/list.h b/geekos/include/geekos/list.h similarity index 100% rename from palacios/include/geekos/list.h rename to geekos/include/geekos/list.h diff --git a/palacios/include/geekos/list2.h b/geekos/include/geekos/list2.h similarity index 100% rename from palacios/include/geekos/list2.h rename to geekos/include/geekos/list2.h diff --git a/palacios/include/geekos/malloc.h b/geekos/include/geekos/malloc.h similarity index 100% rename from palacios/include/geekos/malloc.h rename to geekos/include/geekos/malloc.h diff --git a/palacios/include/geekos/mem.h b/geekos/include/geekos/mem.h similarity index 100% rename from palacios/include/geekos/mem.h rename to geekos/include/geekos/mem.h diff --git a/palacios/include/geekos/ne2k.h b/geekos/include/geekos/ne2k.h similarity index 100% rename from palacios/include/geekos/ne2k.h rename to geekos/include/geekos/ne2k.h diff --git a/palacios/include/geekos/net.h b/geekos/include/geekos/net.h similarity index 100% rename from palacios/include/geekos/net.h rename to geekos/include/geekos/net.h diff --git a/palacios/include/geekos/paging.h b/geekos/include/geekos/paging.h similarity index 100% rename from palacios/include/geekos/paging.h rename to geekos/include/geekos/paging.h diff --git a/palacios/include/geekos/pci.h b/geekos/include/geekos/pci.h similarity index 100% rename from palacios/include/geekos/pci.h rename to geekos/include/geekos/pci.h diff --git a/palacios/include/geekos/queue.h b/geekos/include/geekos/queue.h similarity index 100% rename from palacios/include/geekos/queue.h rename to geekos/include/geekos/queue.h diff --git a/palacios/include/geekos/range.h b/geekos/include/geekos/range.h similarity index 100% rename from palacios/include/geekos/range.h rename to geekos/include/geekos/range.h diff --git a/palacios/include/geekos/reboot.h b/geekos/include/geekos/reboot.h similarity index 100% rename from palacios/include/geekos/reboot.h rename to geekos/include/geekos/reboot.h diff --git a/palacios/include/geekos/ring_buffer.h b/geekos/include/geekos/ring_buffer.h similarity index 100% rename from palacios/include/geekos/ring_buffer.h rename to geekos/include/geekos/ring_buffer.h diff --git a/palacios/include/geekos/rtl8139.h b/geekos/include/geekos/rtl8139.h similarity index 100% rename from palacios/include/geekos/rtl8139.h rename to geekos/include/geekos/rtl8139.h diff --git a/palacios/include/geekos/screen.h b/geekos/include/geekos/screen.h similarity index 100% rename from palacios/include/geekos/screen.h rename to geekos/include/geekos/screen.h diff --git a/palacios/include/geekos/segment.h b/geekos/include/geekos/segment.h similarity index 100% rename from palacios/include/geekos/segment.h rename to geekos/include/geekos/segment.h diff --git a/palacios/include/geekos/serial.h b/geekos/include/geekos/serial.h similarity index 100% rename from palacios/include/geekos/serial.h rename to geekos/include/geekos/serial.h diff --git a/palacios/include/geekos/socket.h b/geekos/include/geekos/socket.h similarity index 100% rename from palacios/include/geekos/socket.h rename to geekos/include/geekos/socket.h diff --git a/palacios/include/geekos/string.h b/geekos/include/geekos/string.h similarity index 100% rename from palacios/include/geekos/string.h rename to geekos/include/geekos/string.h diff --git a/palacios/include/geekos/symbol.h b/geekos/include/geekos/symbol.h similarity index 100% rename from palacios/include/geekos/symbol.h rename to geekos/include/geekos/symbol.h diff --git a/palacios/include/geekos/synch.h b/geekos/include/geekos/synch.h similarity index 100% rename from palacios/include/geekos/synch.h rename to geekos/include/geekos/synch.h diff --git a/palacios/include/geekos/timer.h b/geekos/include/geekos/timer.h similarity index 100% rename from palacios/include/geekos/timer.h rename to geekos/include/geekos/timer.h diff --git a/palacios/include/geekos/trap.h b/geekos/include/geekos/trap.h similarity index 100% rename from palacios/include/geekos/trap.h rename to geekos/include/geekos/trap.h diff --git a/palacios/include/geekos/tss.h b/geekos/include/geekos/tss.h similarity index 100% rename from palacios/include/geekos/tss.h rename to geekos/include/geekos/tss.h diff --git a/palacios/include/geekos/vm.h b/geekos/include/geekos/vm.h similarity index 100% rename from palacios/include/geekos/vm.h rename to geekos/include/geekos/vm.h diff --git a/palacios/include/geekos/vmm_stubs.h b/geekos/include/geekos/vmm_stubs.h similarity index 100% rename from palacios/include/geekos/vmm_stubs.h rename to geekos/include/geekos/vmm_stubs.h diff --git a/palacios/include/libc/fmtout.h b/geekos/include/libc/fmtout.h similarity index 100% rename from palacios/include/libc/fmtout.h rename to geekos/include/libc/fmtout.h diff --git a/palacios/include/libc/string.h b/geekos/include/libc/string.h similarity index 100% rename from palacios/include/libc/string.h rename to geekos/include/libc/string.h diff --git a/palacios/include/lwip/arch/cc.h b/geekos/include/lwip/arch/cc.h similarity index 100% rename from palacios/include/lwip/arch/cc.h rename to geekos/include/lwip/arch/cc.h diff --git a/palacios/include/lwip/arch/perf.h b/geekos/include/lwip/arch/perf.h similarity index 100% rename from palacios/include/lwip/arch/perf.h rename to geekos/include/lwip/arch/perf.h diff --git a/palacios/include/lwip/arch/sys_arch.h b/geekos/include/lwip/arch/sys_arch.h similarity index 100% rename from palacios/include/lwip/arch/sys_arch.h rename to geekos/include/lwip/arch/sys_arch.h diff --git a/palacios/include/lwip/ipv4/lwip/autoip.h b/geekos/include/lwip/ipv4/lwip/autoip.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/autoip.h rename to geekos/include/lwip/ipv4/lwip/autoip.h diff --git a/palacios/include/lwip/ipv4/lwip/icmp.h b/geekos/include/lwip/ipv4/lwip/icmp.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/icmp.h rename to geekos/include/lwip/ipv4/lwip/icmp.h diff --git a/palacios/include/lwip/ipv4/lwip/igmp.h b/geekos/include/lwip/ipv4/lwip/igmp.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/igmp.h rename to geekos/include/lwip/ipv4/lwip/igmp.h diff --git a/palacios/include/lwip/ipv4/lwip/inet.h b/geekos/include/lwip/ipv4/lwip/inet.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/inet.h rename to geekos/include/lwip/ipv4/lwip/inet.h diff --git a/palacios/include/lwip/ipv4/lwip/inet_chksum.h b/geekos/include/lwip/ipv4/lwip/inet_chksum.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/inet_chksum.h rename to geekos/include/lwip/ipv4/lwip/inet_chksum.h diff --git a/palacios/include/lwip/ipv4/lwip/ip.h b/geekos/include/lwip/ipv4/lwip/ip.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/ip.h rename to geekos/include/lwip/ipv4/lwip/ip.h diff --git a/palacios/include/lwip/ipv4/lwip/ip.h~ b/geekos/include/lwip/ipv4/lwip/ip.h~ similarity index 100% rename from palacios/include/lwip/ipv4/lwip/ip.h~ rename to geekos/include/lwip/ipv4/lwip/ip.h~ diff --git a/palacios/include/lwip/ipv4/lwip/ip_addr.h b/geekos/include/lwip/ipv4/lwip/ip_addr.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/ip_addr.h rename to geekos/include/lwip/ipv4/lwip/ip_addr.h diff --git a/palacios/include/lwip/ipv4/lwip/ip_frag.h b/geekos/include/lwip/ipv4/lwip/ip_frag.h similarity index 100% rename from palacios/include/lwip/ipv4/lwip/ip_frag.h rename to geekos/include/lwip/ipv4/lwip/ip_frag.h diff --git a/palacios/include/lwip/ipv6/lwip/icmp.h b/geekos/include/lwip/ipv6/lwip/icmp.h similarity index 100% rename from palacios/include/lwip/ipv6/lwip/icmp.h rename to geekos/include/lwip/ipv6/lwip/icmp.h diff --git a/palacios/include/lwip/ipv6/lwip/inet.h b/geekos/include/lwip/ipv6/lwip/inet.h similarity index 100% rename from palacios/include/lwip/ipv6/lwip/inet.h rename to geekos/include/lwip/ipv6/lwip/inet.h diff --git a/palacios/include/lwip/ipv6/lwip/ip.h b/geekos/include/lwip/ipv6/lwip/ip.h similarity index 100% rename from palacios/include/lwip/ipv6/lwip/ip.h rename to geekos/include/lwip/ipv6/lwip/ip.h diff --git a/palacios/include/lwip/ipv6/lwip/ip_addr.h b/geekos/include/lwip/ipv6/lwip/ip_addr.h similarity index 100% rename from palacios/include/lwip/ipv6/lwip/ip_addr.h rename to geekos/include/lwip/ipv6/lwip/ip_addr.h diff --git a/palacios/include/lwip/lwip/api.h b/geekos/include/lwip/lwip/api.h similarity index 100% rename from palacios/include/lwip/lwip/api.h rename to geekos/include/lwip/lwip/api.h diff --git a/palacios/include/lwip/lwip/api_msg.h b/geekos/include/lwip/lwip/api_msg.h similarity index 100% rename from palacios/include/lwip/lwip/api_msg.h rename to geekos/include/lwip/lwip/api_msg.h diff --git a/palacios/include/lwip/lwip/arch.h b/geekos/include/lwip/lwip/arch.h similarity index 100% rename from palacios/include/lwip/lwip/arch.h rename to geekos/include/lwip/lwip/arch.h diff --git a/palacios/include/lwip/lwip/debug.h b/geekos/include/lwip/lwip/debug.h similarity index 100% rename from palacios/include/lwip/lwip/debug.h rename to geekos/include/lwip/lwip/debug.h diff --git a/palacios/include/lwip/lwip/def.h b/geekos/include/lwip/lwip/def.h similarity index 100% rename from palacios/include/lwip/lwip/def.h rename to geekos/include/lwip/lwip/def.h diff --git a/palacios/include/lwip/lwip/dhcp.h b/geekos/include/lwip/lwip/dhcp.h similarity index 100% rename from palacios/include/lwip/lwip/dhcp.h rename to geekos/include/lwip/lwip/dhcp.h diff --git a/palacios/include/lwip/lwip/dns.h b/geekos/include/lwip/lwip/dns.h similarity index 100% rename from palacios/include/lwip/lwip/dns.h rename to geekos/include/lwip/lwip/dns.h diff --git a/palacios/include/lwip/lwip/err.h b/geekos/include/lwip/lwip/err.h similarity index 100% rename from palacios/include/lwip/lwip/err.h rename to geekos/include/lwip/lwip/err.h diff --git a/palacios/include/lwip/lwip/init.h b/geekos/include/lwip/lwip/init.h similarity index 100% rename from palacios/include/lwip/lwip/init.h rename to geekos/include/lwip/lwip/init.h diff --git a/palacios/include/lwip/lwip/mem.h b/geekos/include/lwip/lwip/mem.h similarity index 100% rename from palacios/include/lwip/lwip/mem.h rename to geekos/include/lwip/lwip/mem.h diff --git a/palacios/include/lwip/lwip/memp.h b/geekos/include/lwip/lwip/memp.h similarity index 100% rename from palacios/include/lwip/lwip/memp.h rename to geekos/include/lwip/lwip/memp.h diff --git a/palacios/include/lwip/lwip/memp_std.h b/geekos/include/lwip/lwip/memp_std.h similarity index 100% rename from palacios/include/lwip/lwip/memp_std.h rename to geekos/include/lwip/lwip/memp_std.h diff --git a/palacios/include/lwip/lwip/netbuf.h b/geekos/include/lwip/lwip/netbuf.h similarity index 100% rename from palacios/include/lwip/lwip/netbuf.h rename to geekos/include/lwip/lwip/netbuf.h diff --git a/palacios/include/lwip/lwip/netdb.h b/geekos/include/lwip/lwip/netdb.h similarity index 100% rename from palacios/include/lwip/lwip/netdb.h rename to geekos/include/lwip/lwip/netdb.h diff --git a/palacios/include/lwip/lwip/netif.h b/geekos/include/lwip/lwip/netif.h similarity index 100% rename from palacios/include/lwip/lwip/netif.h rename to geekos/include/lwip/lwip/netif.h diff --git a/palacios/include/lwip/lwip/netifapi.h b/geekos/include/lwip/lwip/netifapi.h similarity index 100% rename from palacios/include/lwip/lwip/netifapi.h rename to geekos/include/lwip/lwip/netifapi.h diff --git a/palacios/include/lwip/lwip/opt.h b/geekos/include/lwip/lwip/opt.h similarity index 100% rename from palacios/include/lwip/lwip/opt.h rename to geekos/include/lwip/lwip/opt.h diff --git a/palacios/include/lwip/lwip/pbuf.h b/geekos/include/lwip/lwip/pbuf.h similarity index 100% rename from palacios/include/lwip/lwip/pbuf.h rename to geekos/include/lwip/lwip/pbuf.h diff --git a/palacios/include/lwip/lwip/raw.h b/geekos/include/lwip/lwip/raw.h similarity index 100% rename from palacios/include/lwip/lwip/raw.h rename to geekos/include/lwip/lwip/raw.h diff --git a/palacios/include/lwip/lwip/sio.h b/geekos/include/lwip/lwip/sio.h similarity index 100% rename from palacios/include/lwip/lwip/sio.h rename to geekos/include/lwip/lwip/sio.h diff --git a/palacios/include/lwip/lwip/snmp.h b/geekos/include/lwip/lwip/snmp.h similarity index 100% rename from palacios/include/lwip/lwip/snmp.h rename to geekos/include/lwip/lwip/snmp.h diff --git a/palacios/include/lwip/lwip/snmp_asn1.h b/geekos/include/lwip/lwip/snmp_asn1.h similarity index 100% rename from palacios/include/lwip/lwip/snmp_asn1.h rename to geekos/include/lwip/lwip/snmp_asn1.h diff --git a/palacios/include/lwip/lwip/snmp_msg.h b/geekos/include/lwip/lwip/snmp_msg.h similarity index 100% rename from palacios/include/lwip/lwip/snmp_msg.h rename to geekos/include/lwip/lwip/snmp_msg.h diff --git a/palacios/include/lwip/lwip/snmp_structs.h b/geekos/include/lwip/lwip/snmp_structs.h similarity index 100% rename from palacios/include/lwip/lwip/snmp_structs.h rename to geekos/include/lwip/lwip/snmp_structs.h diff --git a/palacios/include/lwip/lwip/sockets.h b/geekos/include/lwip/lwip/sockets.h similarity index 100% rename from palacios/include/lwip/lwip/sockets.h rename to geekos/include/lwip/lwip/sockets.h diff --git a/palacios/include/lwip/lwip/stats.h b/geekos/include/lwip/lwip/stats.h similarity index 100% rename from palacios/include/lwip/lwip/stats.h rename to geekos/include/lwip/lwip/stats.h diff --git a/palacios/include/lwip/lwip/sys.h b/geekos/include/lwip/lwip/sys.h similarity index 100% rename from palacios/include/lwip/lwip/sys.h rename to geekos/include/lwip/lwip/sys.h diff --git a/palacios/include/lwip/lwip/tcp.h b/geekos/include/lwip/lwip/tcp.h similarity index 100% rename from palacios/include/lwip/lwip/tcp.h rename to geekos/include/lwip/lwip/tcp.h diff --git a/palacios/include/lwip/lwip/tcpip.h b/geekos/include/lwip/lwip/tcpip.h similarity index 100% rename from palacios/include/lwip/lwip/tcpip.h rename to geekos/include/lwip/lwip/tcpip.h diff --git a/palacios/include/lwip/lwip/udp.h b/geekos/include/lwip/lwip/udp.h similarity index 100% rename from palacios/include/lwip/lwip/udp.h rename to geekos/include/lwip/lwip/udp.h diff --git a/palacios/include/lwip/lwipopts.h b/geekos/include/lwip/lwipopts.h similarity index 100% rename from palacios/include/lwip/lwipopts.h rename to geekos/include/lwip/lwipopts.h diff --git a/palacios/include/lwip/netif/etharp.h b/geekos/include/lwip/netif/etharp.h similarity index 100% rename from palacios/include/lwip/netif/etharp.h rename to geekos/include/lwip/netif/etharp.h diff --git a/palacios/include/lwip/netif/loopif.h b/geekos/include/lwip/netif/loopif.h similarity index 100% rename from palacios/include/lwip/netif/loopif.h rename to geekos/include/lwip/netif/loopif.h diff --git a/palacios/include/lwip/netif/ppp_oe.h b/geekos/include/lwip/netif/ppp_oe.h similarity index 100% rename from palacios/include/lwip/netif/ppp_oe.h rename to geekos/include/lwip/netif/ppp_oe.h diff --git a/palacios/include/lwip/netif/slipif.h b/geekos/include/lwip/netif/slipif.h similarity index 100% rename from palacios/include/lwip/netif/slipif.h rename to geekos/include/lwip/netif/slipif.h diff --git a/palacios/include/uip/clock.h b/geekos/include/uip/clock.h similarity index 100% rename from palacios/include/uip/clock.h rename to geekos/include/uip/clock.h diff --git a/palacios/include/uip/lc-addrlabels.h b/geekos/include/uip/lc-addrlabels.h similarity index 100% rename from palacios/include/uip/lc-addrlabels.h rename to geekos/include/uip/lc-addrlabels.h diff --git a/palacios/include/uip/lc-switch.h b/geekos/include/uip/lc-switch.h similarity index 100% rename from palacios/include/uip/lc-switch.h rename to geekos/include/uip/lc-switch.h diff --git a/palacios/include/uip/lc.h b/geekos/include/uip/lc.h similarity index 100% rename from palacios/include/uip/lc.h rename to geekos/include/uip/lc.h diff --git a/palacios/include/uip/psock.h b/geekos/include/uip/psock.h similarity index 100% rename from palacios/include/uip/psock.h rename to geekos/include/uip/psock.h diff --git a/palacios/include/uip/pt.h b/geekos/include/uip/pt.h similarity index 100% rename from palacios/include/uip/pt.h rename to geekos/include/uip/pt.h diff --git a/palacios/include/uip/resolv.h b/geekos/include/uip/resolv.h similarity index 100% rename from palacios/include/uip/resolv.h rename to geekos/include/uip/resolv.h diff --git a/palacios/include/uip/timer.h b/geekos/include/uip/timer.h similarity index 100% rename from palacios/include/uip/timer.h rename to geekos/include/uip/timer.h diff --git a/palacios/include/uip/uip-conf.h b/geekos/include/uip/uip-conf.h similarity index 100% rename from palacios/include/uip/uip-conf.h rename to geekos/include/uip/uip-conf.h diff --git a/palacios/include/uip/uip-fw.h b/geekos/include/uip/uip-fw.h similarity index 100% rename from palacios/include/uip/uip-fw.h rename to geekos/include/uip/uip-fw.h diff --git a/palacios/include/uip/uip-neighbor.h b/geekos/include/uip/uip-neighbor.h similarity index 100% rename from palacios/include/uip/uip-neighbor.h rename to geekos/include/uip/uip-neighbor.h diff --git a/palacios/include/uip/uip-split.h b/geekos/include/uip/uip-split.h similarity index 100% rename from palacios/include/uip/uip-split.h rename to geekos/include/uip/uip-split.h diff --git a/palacios/include/uip/uip.h b/geekos/include/uip/uip.h similarity index 100% rename from palacios/include/uip/uip.h rename to geekos/include/uip/uip.h diff --git a/palacios/include/uip/uip_arch.h b/geekos/include/uip/uip_arch.h similarity index 100% rename from palacios/include/uip/uip_arch.h rename to geekos/include/uip/uip_arch.h diff --git a/palacios/include/uip/uip_arp.h b/geekos/include/uip/uip_arp.h similarity index 100% rename from palacios/include/uip/uip_arp.h rename to geekos/include/uip/uip_arp.h diff --git a/palacios/include/uip/uiplib.h b/geekos/include/uip/uiplib.h similarity index 100% rename from palacios/include/uip/uiplib.h rename to geekos/include/uip/uiplib.h diff --git a/palacios/include/uip/uipopt.h b/geekos/include/uip/uipopt.h similarity index 100% rename from palacios/include/uip/uipopt.h rename to geekos/include/uip/uipopt.h diff --git a/geekos/scripts/eipToFunction b/geekos/scripts/eipToFunction new file mode 100755 index 0000000..98bffa6 --- /dev/null +++ b/geekos/scripts/eipToFunction @@ -0,0 +1,42 @@ +#! /usr/bin/perl + +# Find the function name from the value of the EIP (instruction pointer) +# register from a Bochs crash report. Uses the kernel symbol +# map (kernel.syms) produced by compiling the kernel. + +use strict qw(refs vars); +use FileHandle; + +if (scalar(@ARGV) != 2){ + print STDERR "Usage: eipToFunction kernel.syms \n"; + print STDERR " eip value should be in hex\n"; + exit 1; +} + +my $syms = shift @ARGV; +my $eip = hex(shift @ARGV); + +my @text = (); + +my $fh = new FileHandle("<$syms"); +(defined $fh) || die "Couldn't open $syms: $!\n"; +while (<$fh>) { + #print $_; + if (/^([0-9A-Fa-f]+)\s+[Tt]\s+(\S+)\s*$/) { + push @text, [hex($1), $2]; + } +} +$fh->close(); +#print scalar(@text),"\n"; + +@text = sort { $a->[0] <=> $b->[0] } @text; + +my $last = undef; + +foreach my $entry (@text) { + last if ($eip < $entry->[0]); + $last = $entry; +} +printf("%s\n",(defined $last) ? $last->[1] : "not found"); + +# vim:ts=4 diff --git a/geekos/scripts/findaddr b/geekos/scripts/findaddr new file mode 100755 index 0000000..7b9b877 --- /dev/null +++ b/geekos/scripts/findaddr @@ -0,0 +1,26 @@ +#! /usr/bin/perl + +# Find the address of a symbol in the storage map. + +use strict qw(refs vars); +use FileHandle; + +if ( scalar(@ARGV) != 2 ) { + print "Usage: findaddr \n"; + exit 1; +} + +my $storage = shift @ARGV; +my $symbol = shift @ARGV; + +my $fh = new FileHandle("<$storage"); +(defined $fh) || die "Couldn't open storage map: $!\n"; + +while ( <$fh> ) { + if ( /^\s*(0x([0-9]|[a-f]|[A-F])+)\s+\Q$symbol\E\s*$/ ) { + print $1, "\n"; + last; + } +} + +$fh->close(); diff --git a/geekos/scripts/generate_vmcs_serialization.pl b/geekos/scripts/generate_vmcs_serialization.pl new file mode 100755 index 0000000..747e2c6 --- /dev/null +++ b/geekos/scripts/generate_vmcs_serialization.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl + +$#ARGV==0 or die "gimme a filename\n"; + +$file=shift; + +@list=(); + +open(HEADER,">$file.h"); +open(SOURCE,">$file.c"); + +print HEADER "#ifndef $file\n"; +print HEADER "#define $file\n"; +print HEADER "#include \n"; + +print SOURCE "#include \n"; + +while () { + if (/\#define\s+(\S+)\s+/) { + push @list, $1; + GenSerUnserCode($1); + } +} + +GenPrintAllCode(@list); + +print HEADER "#endif\n"; + +sub GenSerUnserCode { + my $name=shift; + + print SOURCE <) { + if (m,^#define\s*(\S+)\s*(-\d+)\s*/\*\s*(.*\S)\s*\*/\s*$,) { + $errs[- $2] = $3; + $syms[- $2] = $1; + } +} + +print "const char *__strerrTable[] = {\n"; +for (my $i = 0; $i < scalar(@errs); $i++) { + print " \"", $errs[$i], "\", /* ", $syms[$i], " */\n"; +} +print "};\n"; +print "const int __strerrTableSize = sizeof(__strerrTable) / sizeof(const char *);\n"; + +# vim:ts=4 diff --git a/geekos/scripts/hexify.pl b/geekos/scripts/hexify.pl new file mode 100755 index 0000000..9a03bf3 --- /dev/null +++ b/geekos/scripts/hexify.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +$file = $ARGV[0]; + +while(1) { + open (FILE,">>$file"); + $foo = ; + chomp $foo; + print FILE pack("C", hex("0x$foo")); + close FILE; +} + diff --git a/geekos/scripts/kerninfo b/geekos/scripts/kerninfo new file mode 100755 index 0000000..9241e3a --- /dev/null +++ b/geekos/scripts/kerninfo @@ -0,0 +1,38 @@ +#! /usr/bin/perl + +# A script to analyze the output of "objdump -h" on the +# kernel executable file. + +use strict qw(vars refs); +use FileHandle; + +my $kernfile = shift @ARGV; +(defined $kernfile) || die "usage: kernsize \n"; + +my $kern_fh = new FileHandle("<$kernfile"); +(defined $kern_fh) || die "can't open $kernfile: $!\n"; + +my $objdump_fh = new FileHandle("objdump -h $kernfile|"); +while ( <$objdump_fh> ) { + chop; + s/^\s+//; + my @fields = split(/\s+/, $_); + if ( $fields[0] =~ /^[0-9]$/ ) { +# print "text start is ", $fields[5], "\n" if $fields[0] eq '0'; + my $size = hex($fields[2]); + my $offset = hex($fields[5]); + + print $fields[0], " (", $fields[1], "): size=$size, offset=$offset\n"; + + printf("Word at beginning of section is %08x\n", ReadWord($kern_fh,$offset) ); + } +} +$objdump_fh->close(); + +sub ReadWord { + my ($fh, $offset) = @_; + seek $fh, $offset, SEEK_SET; + my $buf = 'X' x 4; + read $fh, $buf, 4; + return unpack('V',$buf); +} diff --git a/geekos/scripts/make_payload.pl b/geekos/scripts/make_payload.pl new file mode 100755 index 0000000..f39ea9e --- /dev/null +++ b/geekos/scripts/make_payload.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl + +$magic = 0xf1e2d3c4; + +use FileHandle; + +if (scalar(@ARGV) != 2) { + print STDERR "usage: make_payload.pl \n"; + exit 1; +} + +my $config_file = shift @ARGV; +my $out_file = shift @ARGV; + +open (CFGFILE, "$config_file"); +@cfg = ; +close CFGFILE; + +my $num_regions = 0; + +my @region_names = (); +my %region_map = {}; + +foreach $line (@cfg) { + chomp $line; + ($file, $dst) = split(/:/, $line); + push @region_names, $file; + $region_map{$file} = hex($dst); #unpack('N', pack("h8",$dst)); + print "" . hex($dst) . "\n"; + $num_regions++; +} + + + +my $fh = new FileHandle(">$out_file"); +binmode $fh; + +syswrite $fh, pack('L', $magic), 4; +syswrite $fh, pack('L', $num_regions), 4; + +foreach $file (@region_names) { + my $size = (-s $file); + + print "$file to " . $region_map{$file}. " ($size bytes)\n"; + syswrite $fh, pack('L', $size), 4; + syswrite $fh, pack('L', $region_map{$file}), 4; +} + + +my $file; +while (($file = shift @region_names)) { + my $in_fh = new FileHandle("<$file"); + (defined $in_fh) || die "Couldn't open $file: $!\n"; + binmode $in_fh; + + my $buf = chr(0) x 1024; + my $n; + while (($n = sysread($in_fh, $buf, 1024)) > 0) { + syswrite($fh, $buf, $n); + } + $in_fh->close(); +} + + +$fh->close(); diff --git a/geekos/scripts/mkcdisk b/geekos/scripts/mkcdisk new file mode 100755 index 0000000..d3f4477 --- /dev/null +++ b/geekos/scripts/mkcdisk @@ -0,0 +1,25 @@ +#! /usr/bin/perl + +# Build a binary image containing a pseudo fat filesystem with the listed files + +# $Revision: 1.1 $ +use FileHandle; + +if ( scalar(@ARGV) < 2 ) { + print STDERR "usage: mkuprog \n"; + exit 1; +} + + +$filename = shift @ARGV; +$filecount = scalar ( @ARGV ); + +$fh = new FileHandle(">$filename"); + +write + +while (scalar(@ARGV)) { + $filename = shift @ARGV; + + print "got file ", $filename, "\n"; +} diff --git a/geekos/scripts/mkuprog b/geekos/scripts/mkuprog new file mode 100755 index 0000000..1581b4b --- /dev/null +++ b/geekos/scripts/mkuprog @@ -0,0 +1,55 @@ +#! /usr/bin/perl + +# From a binary image containing a user program, generate +# C code initializing a User_Program struct. + +# $Revision: 1.1 $ + +use strict qw(refs vars); +use FileHandle; + +if ( scalar(@ARGV) != 3 ) { + print STDERR "usage: mkuprog \n"; + exit 1; +} + +my $filename = shift @ARGV; +my $progname = shift @ARGV; +my $entryAddr = shift @ARGV; + +my $fh = new FileHandle("<$filename"); +(defined $fh) || die "Couldn't open $filename: $!\n"; +binmode $fh; + +my $dataArrayName = $progname . "Data"; +my $structName = $progname . "Prog"; +print "const unsigned char $dataArrayName"."[] = {\n"; + +my $LINEWIDTH = 10; + +my $buf = chr(0) x $LINEWIDTH; +my $n; +my $size = 0; +while ( ($n = read( $fh, $buf, $LINEWIDTH )) > 0 ) { + $size += $n; + my $i; + print " "; + for ( $i = 0; $i < $n; $i++ ) { + my $c = ord( substr($buf, $i, 1) ); + printf( "0x%x,", $c ); + } + print "\n"; +} + +print "};\n"; + +$fh->close(); + +print << "END"; +const struct User_Program $structName = { + "$progname", + $size, + $entryAddr, + $dataArrayName +}; +END diff --git a/geekos/scripts/numsecs b/geekos/scripts/numsecs new file mode 100755 index 0000000..708a893 --- /dev/null +++ b/geekos/scripts/numsecs @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +# Find the number of 512-byte sectors needed to store +# given file. + +# $Revision: 1.1 $ + +use strict qw(refs vars); + +if ( scalar(@ARGV) != 1 ) { + print STDERR "Usage: numsecs \n"; + exit 1; +} + +my $filename = shift @ARGV; +my $size = (-s $filename ); +die "Couldn't get size of $filename: $!" if ( !defined $size ); + +my $result = int($size / 512); +my $remainder = $size % 512; +$result++ if ( $remainder > 0 ); + +print "$result\n"; diff --git a/geekos/scripts/numsecs_per_track b/geekos/scripts/numsecs_per_track new file mode 100755 index 0000000..b875a89 --- /dev/null +++ b/geekos/scripts/numsecs_per_track @@ -0,0 +1,30 @@ +#! /usr/bin/perl + +# Find the number of 512-byte sectors needed to store +# given file. + +# $Revision: 1.1 $ + +use strict qw(refs vars); + +my $sectors = 0; +my $filename = ""; + +foreach $filename (@ARGV) { + + my $size = (-s $filename ); + die "Couldn't get size of $filename: $!" if ( !defined $size ); + + my $result = int($size / 512); + my $remainder = $size % 512; + $result++ if ( $remainder > 0 ); + + $sectors += $result; +} + +if ($sectors <= 2879) { + print "18\n"; +} else { + print "36\n"; +} + diff --git a/geekos/scripts/pad b/geekos/scripts/pad new file mode 100755 index 0000000..c1c5329 --- /dev/null +++ b/geekos/scripts/pad @@ -0,0 +1,30 @@ +#! /usr/bin/perl + +# Pad a file with zero bytes to make its length +# an even multiple of some value. + +# $Revision: 1.1 $ + +use strict qw(refs vars); +use FileHandle; + +if ( scalar(@ARGV) != 2 ) { + print STDERR "usage: pad \n"; + exit 1; +} + +my $filename = shift @ARGV; +my $multiple = shift @ARGV; + +my $size = (-s $filename); +die "Couldn't get size of $filename: $!" if ( !defined $size ); + +my $num_pad = ($multiple - ($size % $multiple)) % $multiple; + +my $buf = chr(0) x $num_pad; + +my $fh = new FileHandle(">>$filename"); +die "Couldn't open $filename: $!" if ( !defined $fh ); +binmode $fh; +syswrite $fh, $buf, $num_pad, 0; +$fh->close(); diff --git a/geekos/scripts/pcat b/geekos/scripts/pcat new file mode 100755 index 0000000..d58f9fd --- /dev/null +++ b/geekos/scripts/pcat @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +# A version of cat written in perl. + +use strict qw(refs vars); +use FileHandle; + +binmode STDOUT; + +my $buf = chr(0) x 1024; + +my $file; +while ( ($file = shift @ARGV) ) { + my $fh = new FileHandle("<$file"); + (defined $fh) || die "Couldn't open $file: $!\n"; + binmode $fh; + + my $n; + while ( ($n = sysread($fh, $buf, 1024)) > 0 ) { + syswrite( STDOUT, $buf, $n ); + } + $fh->close(); +} diff --git a/geekos/scripts/pw b/geekos/scripts/pw new file mode 100755 index 0000000..7edc728 --- /dev/null +++ b/geekos/scripts/pw @@ -0,0 +1,24 @@ +#! /usr/bin/perl + +# Inspect a 32 word at a specified offset in a file. +# $Revision: 1.1 $ + +use strict qw(refs vars); +use FileHandle; + +my $filename = shift @ARGV; +my $offset = shift @ARGV; + +((defined $filename) && (defined $offset)) + || die "Usage: pw \n"; + +my $fh = new FileHandle("<$filename"); +printf( "%08x\n", ReadWord($fh, $offset) ); + +sub ReadWord { + my ($fh, $offset) = @_; + seek $fh, $offset, SEEK_SET; + my $buf = 'X' x 4; + read $fh, $buf, 4; + return unpack('V',$buf); +} diff --git a/geekos/scripts/scan b/geekos/scripts/scan new file mode 100755 index 0000000..cbfe6dc --- /dev/null +++ b/geekos/scripts/scan @@ -0,0 +1,29 @@ +#! /usr/bin/perl + +# Scan a file for a 32-bit word with a particular value. +# $Revision: 1.1 $ + +use strict qw(refs vars); +use FileHandle; + +my $filename = shift @ARGV; +my $word_value = shift @ARGV; + +((defined $filename) && (defined $word_value)) + || die "Usage: scan \n"; + +my $fh = new FileHandle("<$filename"); +my $val = hex($word_value); + +my $buf = ' ' x 4; + +my $offset = 0; +while ( read( $fh, $buf, 4) == 4 ) { + my $out = unpack "V", $buf; + if ( $out == $val ) { + print "Found value $word_value at offset $offset\n"; + exit; + } + $offset += 4; +} +print "Didn't find value $word_value\n"; diff --git a/geekos/scripts/vmcs_entries_to_asm.pl b/geekos/scripts/vmcs_entries_to_asm.pl new file mode 100755 index 0000000..04bea4f --- /dev/null +++ b/geekos/scripts/vmcs_entries_to_asm.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl + + +$file = $ARGV[0]; +$ofile = $ARGV[1]; + +open(INFILE, "$file"); +@lines = ; +close INFILE; + +open(OUTFILE, ">$ofile"); + + +print OUTFILE "\%ifndef VMCS_FIELDS_ASM\n\%define VMCS_FIELDS_ASM\n\n"; + +foreach $line (@lines) { + + if ($line =~ /\#define\s+(\S+)\s+(\S+)*/) { + print OUTFILE $1 . " equ " . $2 . "\n"; + } + +} + + +print OUTFILE "\n\%endif\n\n"; + +close OUTFILE; + + diff --git a/geekos/scripts/zerofile b/geekos/scripts/zerofile new file mode 100755 index 0000000..52e744a --- /dev/null +++ b/geekos/scripts/zerofile @@ -0,0 +1,31 @@ +#! /usr/bin/perl + +# This script is used for creating a file full of zeroes, +# which we use to create the hard disk image used by bochs. + +use strict qw(refs vars); +use FileHandle; +use IO::Seekable; + +if ( scalar(@ARGV) != 2 ) { + print "Usage: zerofile \n"; + exit 1; +} + +my $outfile = shift @ARGV; +my $numsecs = shift @ARGV; + +my $buf = chr(0) x 1; + +my $fh = new FileHandle(">$outfile"); +(defined $fh) || die "Couldn't open $outfile: $!\n"; +binmode $fh; + +if ( !sysseek( $fh, ($numsecs * 512) - 1, SEEK_SET ) ) { + die "Couldn't seek in $outfile: $!\n"; +} +if ( !syswrite( $fh, $buf, 1 ) ) { + die "Couldn't write to $outfile: $!\n"; +} + +$fh->close(); diff --git a/palacios/src/common/fmtout.c b/geekos/src/common/fmtout.c similarity index 100% rename from palacios/src/common/fmtout.c rename to geekos/src/common/fmtout.c diff --git a/palacios/src/common/memmove.c b/geekos/src/common/memmove.c similarity index 100% rename from palacios/src/common/memmove.c rename to geekos/src/common/memmove.c diff --git a/palacios/src/common/string.c b/geekos/src/common/string.c similarity index 100% rename from palacios/src/common/string.c rename to geekos/src/common/string.c diff --git a/palacios/src/geekos/README.txt b/geekos/src/geekos/README.txt similarity index 100% rename from palacios/src/geekos/README.txt rename to geekos/src/geekos/README.txt diff --git a/palacios/src/geekos/TODO b/geekos/src/geekos/TODO similarity index 100% rename from palacios/src/geekos/TODO rename to geekos/src/geekos/TODO diff --git a/palacios/src/geekos/bget.c b/geekos/src/geekos/bget.c similarity index 100% rename from palacios/src/geekos/bget.c rename to geekos/src/geekos/bget.c diff --git a/palacios/src/geekos/blockdev.c b/geekos/src/geekos/blockdev.c similarity index 100% rename from palacios/src/geekos/blockdev.c rename to geekos/src/geekos/blockdev.c diff --git a/palacios/src/geekos/bootsect.asm b/geekos/src/geekos/bootsect.asm similarity index 100% rename from palacios/src/geekos/bootsect.asm rename to geekos/src/geekos/bootsect.asm diff --git a/palacios/src/geekos/crc32.c b/geekos/src/geekos/crc32.c similarity index 100% rename from palacios/src/geekos/crc32.c rename to geekos/src/geekos/crc32.c diff --git a/palacios/src/geekos/debug.c b/geekos/src/geekos/debug.c similarity index 100% rename from palacios/src/geekos/debug.c rename to geekos/src/geekos/debug.c diff --git a/palacios/src/geekos/defs.asm b/geekos/src/geekos/defs.asm similarity index 100% rename from palacios/src/geekos/defs.asm rename to geekos/src/geekos/defs.asm diff --git a/palacios/src/geekos/depend.mak b/geekos/src/geekos/depend.mak similarity index 100% rename from palacios/src/geekos/depend.mak rename to geekos/src/geekos/depend.mak diff --git a/palacios/src/geekos/fd_boot.asm b/geekos/src/geekos/fd_boot.asm similarity index 100% rename from palacios/src/geekos/fd_boot.asm rename to geekos/src/geekos/fd_boot.asm diff --git a/palacios/src/geekos/gdt.c b/geekos/src/geekos/gdt.c similarity index 100% rename from palacios/src/geekos/gdt.c rename to geekos/src/geekos/gdt.c diff --git a/palacios/src/geekos/ide.c b/geekos/src/geekos/ide.c similarity index 100% rename from palacios/src/geekos/ide.c rename to geekos/src/geekos/ide.c diff --git a/palacios/src/geekos/idt.c b/geekos/src/geekos/idt.c similarity index 100% rename from palacios/src/geekos/idt.c rename to geekos/src/geekos/idt.c diff --git a/palacios/src/geekos/int.c b/geekos/src/geekos/int.c similarity index 100% rename from palacios/src/geekos/int.c rename to geekos/src/geekos/int.c diff --git a/palacios/src/geekos/io.c b/geekos/src/geekos/io.c similarity index 100% rename from palacios/src/geekos/io.c rename to geekos/src/geekos/io.c diff --git a/palacios/src/geekos/irq.c b/geekos/src/geekos/irq.c similarity index 100% rename from palacios/src/geekos/irq.c rename to geekos/src/geekos/irq.c diff --git a/palacios/src/geekos/keyboard.c b/geekos/src/geekos/keyboard.c similarity index 100% rename from palacios/src/geekos/keyboard.c rename to geekos/src/geekos/keyboard.c diff --git a/palacios/src/geekos/kthread.c b/geekos/src/geekos/kthread.c similarity index 100% rename from palacios/src/geekos/kthread.c rename to geekos/src/geekos/kthread.c diff --git a/palacios/src/geekos/lowlevel.asm b/geekos/src/geekos/lowlevel.asm similarity index 99% rename from palacios/src/geekos/lowlevel.asm rename to geekos/src/geekos/lowlevel.asm index 30979de..2c64e8a 100644 --- a/palacios/src/geekos/lowlevel.asm +++ b/geekos/src/geekos/lowlevel.asm @@ -167,13 +167,13 @@ EXPORT Get_PDBR EXPORT Flush_TLB ; CPUID functions -EXPORT cpuid_ecx -EXPORT cpuid_eax -EXPORT cpuid_edx +;EXPORT cpuid_ecx +;EXPORT cpuid_eax +;EXPORT cpuid_edx ; Utility Functions -EXPORT Set_MSR -EXPORT Get_MSR +;EXPORT Set_MSR +;EXPORT Get_MSR EXPORT Get_CR2 diff --git a/palacios/src/geekos/main.c b/geekos/src/geekos/main.c similarity index 100% rename from palacios/src/geekos/main.c rename to geekos/src/geekos/main.c diff --git a/palacios/src/geekos/malloc.c b/geekos/src/geekos/malloc.c similarity index 100% rename from palacios/src/geekos/malloc.c rename to geekos/src/geekos/malloc.c diff --git a/palacios/src/geekos/mem.c b/geekos/src/geekos/mem.c similarity index 100% rename from palacios/src/geekos/mem.c rename to geekos/src/geekos/mem.c diff --git a/palacios/src/geekos/ne2k.c b/geekos/src/geekos/ne2k.c similarity index 100% rename from palacios/src/geekos/ne2k.c rename to geekos/src/geekos/ne2k.c diff --git a/palacios/src/geekos/net.c b/geekos/src/geekos/net.c similarity index 100% rename from palacios/src/geekos/net.c rename to geekos/src/geekos/net.c diff --git a/palacios/src/geekos/paging.c b/geekos/src/geekos/paging.c similarity index 100% rename from palacios/src/geekos/paging.c rename to geekos/src/geekos/paging.c diff --git a/palacios/src/geekos/pci.c b/geekos/src/geekos/pci.c similarity index 100% rename from palacios/src/geekos/pci.c rename to geekos/src/geekos/pci.c diff --git a/palacios/src/geekos/queue.c b/geekos/src/geekos/queue.c similarity index 100% rename from palacios/src/geekos/queue.c rename to geekos/src/geekos/queue.c diff --git a/palacios/src/geekos/reboot.c b/geekos/src/geekos/reboot.c similarity index 100% rename from palacios/src/geekos/reboot.c rename to geekos/src/geekos/reboot.c diff --git a/palacios/src/geekos/ring_buffer.c b/geekos/src/geekos/ring_buffer.c similarity index 100% rename from palacios/src/geekos/ring_buffer.c rename to geekos/src/geekos/ring_buffer.c diff --git a/palacios/src/geekos/rtl8139.c b/geekos/src/geekos/rtl8139.c similarity index 100% rename from palacios/src/geekos/rtl8139.c rename to geekos/src/geekos/rtl8139.c diff --git a/palacios/src/geekos/screen.c b/geekos/src/geekos/screen.c similarity index 100% rename from palacios/src/geekos/screen.c rename to geekos/src/geekos/screen.c diff --git a/palacios/src/geekos/segment.c b/geekos/src/geekos/segment.c similarity index 100% rename from palacios/src/geekos/segment.c rename to geekos/src/geekos/segment.c diff --git a/palacios/src/geekos/serial.c b/geekos/src/geekos/serial.c similarity index 100% rename from palacios/src/geekos/serial.c rename to geekos/src/geekos/serial.c diff --git a/palacios/src/geekos/setup.asm b/geekos/src/geekos/setup.asm similarity index 100% rename from palacios/src/geekos/setup.asm rename to geekos/src/geekos/setup.asm diff --git a/palacios/src/geekos/socket.c b/geekos/src/geekos/socket.c similarity index 100% rename from palacios/src/geekos/socket.c rename to geekos/src/geekos/socket.c diff --git a/palacios/src/geekos/symbol.asm b/geekos/src/geekos/symbol.asm similarity index 100% rename from palacios/src/geekos/symbol.asm rename to geekos/src/geekos/symbol.asm diff --git a/palacios/src/geekos/synch.c b/geekos/src/geekos/synch.c similarity index 100% rename from palacios/src/geekos/synch.c rename to geekos/src/geekos/synch.c diff --git a/palacios/src/geekos/testvm.s b/geekos/src/geekos/testvm.s similarity index 100% rename from palacios/src/geekos/testvm.s rename to geekos/src/geekos/testvm.s diff --git a/palacios/src/geekos/timer.c b/geekos/src/geekos/timer.c similarity index 100% rename from palacios/src/geekos/timer.c rename to geekos/src/geekos/timer.c diff --git a/palacios/src/geekos/trap.c b/geekos/src/geekos/trap.c similarity index 100% rename from palacios/src/geekos/trap.c rename to geekos/src/geekos/trap.c diff --git a/palacios/src/geekos/tss.c b/geekos/src/geekos/tss.c similarity index 100% rename from palacios/src/geekos/tss.c rename to geekos/src/geekos/tss.c diff --git a/palacios/src/geekos/udivdi3.s b/geekos/src/geekos/udivdi3.s similarity index 100% rename from palacios/src/geekos/udivdi3.s rename to geekos/src/geekos/udivdi3.s diff --git a/palacios/src/geekos/util.asm b/geekos/src/geekos/util.asm similarity index 100% rename from palacios/src/geekos/util.asm rename to geekos/src/geekos/util.asm diff --git a/palacios/src/geekos/vm.c b/geekos/src/geekos/vm.c similarity index 96% rename from palacios/src/geekos/vm.c rename to geekos/src/geekos/vm.c index 169e93b..a951501 100644 --- a/palacios/src/geekos/vm.c +++ b/geekos/src/geekos/vm.c @@ -233,11 +233,12 @@ int RunVMM(struct Boot_Info * bootInfo) { Init_V3(&os_hooks, &vmm_ops); - extern char _binary_vm_kernel_start; - PrintBoth(" Guest Load Addr: 0x%x\n", &_binary_vm_kernel_start); - - config_data = &_binary_vm_kernel_start; + extern char _binary___palacios_vm_kernel_start; + PrintBoth(" Guest Load Addr: 0x%x\n", &_binary___palacios_vm_kernel_start); + + config_data = &_binary___palacios_vm_kernel_start; + vm_info = (vmm_ops).allocate_guest(); PrintBoth("Allocated Guest\n"); @@ -245,7 +246,7 @@ int RunVMM(struct Boot_Info * bootInfo) { (vmm_ops).config_guest(vm_info, config_data); PrintBoth("Configured guest\n"); - + //v3_hook_io_port(&vm_info, 0x05, &IO_Read, &IO_Write_to_Serial, NULL); diff --git a/palacios/src/geekos/vmm_stubs.c b/geekos/src/geekos/vmm_stubs.c similarity index 100% rename from palacios/src/geekos/vmm_stubs.c rename to geekos/src/geekos/vmm_stubs.c diff --git a/palacios/src/libc/compat.c b/geekos/src/libc/compat.c similarity index 100% rename from palacios/src/libc/compat.c rename to geekos/src/libc/compat.c diff --git a/palacios/src/lwip/api/api_lib.c b/geekos/src/lwip/api/api_lib.c similarity index 100% rename from palacios/src/lwip/api/api_lib.c rename to geekos/src/lwip/api/api_lib.c diff --git a/palacios/src/lwip/api/api_msg.c b/geekos/src/lwip/api/api_msg.c similarity index 100% rename from palacios/src/lwip/api/api_msg.c rename to geekos/src/lwip/api/api_msg.c diff --git a/palacios/src/lwip/api/err.c b/geekos/src/lwip/api/err.c similarity index 100% rename from palacios/src/lwip/api/err.c rename to geekos/src/lwip/api/err.c diff --git a/palacios/src/lwip/api/netbuf.c b/geekos/src/lwip/api/netbuf.c similarity index 100% rename from palacios/src/lwip/api/netbuf.c rename to geekos/src/lwip/api/netbuf.c diff --git a/palacios/src/lwip/api/netdb.c b/geekos/src/lwip/api/netdb.c similarity index 100% rename from palacios/src/lwip/api/netdb.c rename to geekos/src/lwip/api/netdb.c diff --git a/palacios/src/lwip/api/netifapi.c b/geekos/src/lwip/api/netifapi.c similarity index 100% rename from palacios/src/lwip/api/netifapi.c rename to geekos/src/lwip/api/netifapi.c diff --git a/palacios/src/lwip/api/sockets.c b/geekos/src/lwip/api/sockets.c similarity index 100% rename from palacios/src/lwip/api/sockets.c rename to geekos/src/lwip/api/sockets.c diff --git a/palacios/src/lwip/api/tcpip.c b/geekos/src/lwip/api/tcpip.c similarity index 100% rename from palacios/src/lwip/api/tcpip.c rename to geekos/src/lwip/api/tcpip.c diff --git a/palacios/src/lwip/arch/sys_arch.c b/geekos/src/lwip/arch/sys_arch.c similarity index 100% rename from palacios/src/lwip/arch/sys_arch.c rename to geekos/src/lwip/arch/sys_arch.c diff --git a/palacios/src/lwip/build/Makefile b/geekos/src/lwip/build/Makefile similarity index 100% rename from palacios/src/lwip/build/Makefile rename to geekos/src/lwip/build/Makefile diff --git a/palacios/src/lwip/core/dhcp.c b/geekos/src/lwip/core/dhcp.c similarity index 100% rename from palacios/src/lwip/core/dhcp.c rename to geekos/src/lwip/core/dhcp.c diff --git a/palacios/src/lwip/core/dns.c b/geekos/src/lwip/core/dns.c similarity index 100% rename from palacios/src/lwip/core/dns.c rename to geekos/src/lwip/core/dns.c diff --git a/palacios/src/lwip/core/init.c b/geekos/src/lwip/core/init.c similarity index 100% rename from palacios/src/lwip/core/init.c rename to geekos/src/lwip/core/init.c diff --git a/palacios/src/lwip/core/ipv4/autoip.c b/geekos/src/lwip/core/ipv4/autoip.c similarity index 100% rename from palacios/src/lwip/core/ipv4/autoip.c rename to geekos/src/lwip/core/ipv4/autoip.c diff --git a/palacios/src/lwip/core/ipv4/icmp.c b/geekos/src/lwip/core/ipv4/icmp.c similarity index 100% rename from palacios/src/lwip/core/ipv4/icmp.c rename to geekos/src/lwip/core/ipv4/icmp.c diff --git a/palacios/src/lwip/core/ipv4/igmp.c b/geekos/src/lwip/core/ipv4/igmp.c similarity index 100% rename from palacios/src/lwip/core/ipv4/igmp.c rename to geekos/src/lwip/core/ipv4/igmp.c diff --git a/palacios/src/lwip/core/ipv4/inet.c b/geekos/src/lwip/core/ipv4/inet.c similarity index 100% rename from palacios/src/lwip/core/ipv4/inet.c rename to geekos/src/lwip/core/ipv4/inet.c diff --git a/palacios/src/lwip/core/ipv4/inet_chksum.c b/geekos/src/lwip/core/ipv4/inet_chksum.c similarity index 100% rename from palacios/src/lwip/core/ipv4/inet_chksum.c rename to geekos/src/lwip/core/ipv4/inet_chksum.c diff --git a/palacios/src/lwip/core/ipv4/ip.c b/geekos/src/lwip/core/ipv4/ip.c similarity index 100% rename from palacios/src/lwip/core/ipv4/ip.c rename to geekos/src/lwip/core/ipv4/ip.c diff --git a/palacios/src/lwip/core/ipv4/ip_addr.c b/geekos/src/lwip/core/ipv4/ip_addr.c similarity index 100% rename from palacios/src/lwip/core/ipv4/ip_addr.c rename to geekos/src/lwip/core/ipv4/ip_addr.c diff --git a/palacios/src/lwip/core/ipv4/ip_frag.c b/geekos/src/lwip/core/ipv4/ip_frag.c similarity index 100% rename from palacios/src/lwip/core/ipv4/ip_frag.c rename to geekos/src/lwip/core/ipv4/ip_frag.c diff --git a/palacios/src/lwip/core/ipv6/README b/geekos/src/lwip/core/ipv6/README similarity index 100% rename from palacios/src/lwip/core/ipv6/README rename to geekos/src/lwip/core/ipv6/README diff --git a/palacios/src/lwip/core/ipv6/icmp6.c b/geekos/src/lwip/core/ipv6/icmp6.c similarity index 100% rename from palacios/src/lwip/core/ipv6/icmp6.c rename to geekos/src/lwip/core/ipv6/icmp6.c diff --git a/palacios/src/lwip/core/ipv6/inet6.c b/geekos/src/lwip/core/ipv6/inet6.c similarity index 100% rename from palacios/src/lwip/core/ipv6/inet6.c rename to geekos/src/lwip/core/ipv6/inet6.c diff --git a/palacios/src/lwip/core/ipv6/ip6.c b/geekos/src/lwip/core/ipv6/ip6.c similarity index 100% rename from palacios/src/lwip/core/ipv6/ip6.c rename to geekos/src/lwip/core/ipv6/ip6.c diff --git a/palacios/src/lwip/core/ipv6/ip6_addr.c b/geekos/src/lwip/core/ipv6/ip6_addr.c similarity index 100% rename from palacios/src/lwip/core/ipv6/ip6_addr.c rename to geekos/src/lwip/core/ipv6/ip6_addr.c diff --git a/palacios/src/lwip/core/mem.c b/geekos/src/lwip/core/mem.c similarity index 100% rename from palacios/src/lwip/core/mem.c rename to geekos/src/lwip/core/mem.c diff --git a/palacios/src/lwip/core/memp.c b/geekos/src/lwip/core/memp.c similarity index 100% rename from palacios/src/lwip/core/memp.c rename to geekos/src/lwip/core/memp.c diff --git a/palacios/src/lwip/core/netif.c b/geekos/src/lwip/core/netif.c similarity index 100% rename from palacios/src/lwip/core/netif.c rename to geekos/src/lwip/core/netif.c diff --git a/palacios/src/lwip/core/pbuf.c b/geekos/src/lwip/core/pbuf.c similarity index 100% rename from palacios/src/lwip/core/pbuf.c rename to geekos/src/lwip/core/pbuf.c diff --git a/palacios/src/lwip/core/raw.c b/geekos/src/lwip/core/raw.c similarity index 100% rename from palacios/src/lwip/core/raw.c rename to geekos/src/lwip/core/raw.c diff --git a/palacios/src/lwip/core/snmp/asn1_dec.c b/geekos/src/lwip/core/snmp/asn1_dec.c similarity index 100% rename from palacios/src/lwip/core/snmp/asn1_dec.c rename to geekos/src/lwip/core/snmp/asn1_dec.c diff --git a/palacios/src/lwip/core/snmp/asn1_enc.c b/geekos/src/lwip/core/snmp/asn1_enc.c similarity index 100% rename from palacios/src/lwip/core/snmp/asn1_enc.c rename to geekos/src/lwip/core/snmp/asn1_enc.c diff --git a/palacios/src/lwip/core/snmp/mib2.c b/geekos/src/lwip/core/snmp/mib2.c similarity index 100% rename from palacios/src/lwip/core/snmp/mib2.c rename to geekos/src/lwip/core/snmp/mib2.c diff --git a/palacios/src/lwip/core/snmp/mib_structs.c b/geekos/src/lwip/core/snmp/mib_structs.c similarity index 100% rename from palacios/src/lwip/core/snmp/mib_structs.c rename to geekos/src/lwip/core/snmp/mib_structs.c diff --git a/palacios/src/lwip/core/snmp/msg_in.c b/geekos/src/lwip/core/snmp/msg_in.c similarity index 100% rename from palacios/src/lwip/core/snmp/msg_in.c rename to geekos/src/lwip/core/snmp/msg_in.c diff --git a/palacios/src/lwip/core/snmp/msg_out.c b/geekos/src/lwip/core/snmp/msg_out.c similarity index 100% rename from palacios/src/lwip/core/snmp/msg_out.c rename to geekos/src/lwip/core/snmp/msg_out.c diff --git a/palacios/src/lwip/core/stats.c b/geekos/src/lwip/core/stats.c similarity index 100% rename from palacios/src/lwip/core/stats.c rename to geekos/src/lwip/core/stats.c diff --git a/palacios/src/lwip/core/sys.c b/geekos/src/lwip/core/sys.c similarity index 100% rename from palacios/src/lwip/core/sys.c rename to geekos/src/lwip/core/sys.c diff --git a/palacios/src/lwip/core/tcp.c b/geekos/src/lwip/core/tcp.c similarity index 100% rename from palacios/src/lwip/core/tcp.c rename to geekos/src/lwip/core/tcp.c diff --git a/palacios/src/lwip/core/tcp_in.c b/geekos/src/lwip/core/tcp_in.c similarity index 100% rename from palacios/src/lwip/core/tcp_in.c rename to geekos/src/lwip/core/tcp_in.c diff --git a/palacios/src/lwip/core/tcp_out.c b/geekos/src/lwip/core/tcp_out.c similarity index 100% rename from palacios/src/lwip/core/tcp_out.c rename to geekos/src/lwip/core/tcp_out.c diff --git a/palacios/src/lwip/core/udp.c b/geekos/src/lwip/core/udp.c similarity index 100% rename from palacios/src/lwip/core/udp.c rename to geekos/src/lwip/core/udp.c diff --git a/palacios/src/lwip/netif/FILES b/geekos/src/lwip/netif/FILES similarity index 100% rename from palacios/src/lwip/netif/FILES rename to geekos/src/lwip/netif/FILES diff --git a/palacios/src/lwip/netif/etharp.c b/geekos/src/lwip/netif/etharp.c similarity index 100% rename from palacios/src/lwip/netif/etharp.c rename to geekos/src/lwip/netif/etharp.c diff --git a/palacios/src/lwip/netif/ethernetif.c b/geekos/src/lwip/netif/ethernetif.c similarity index 100% rename from palacios/src/lwip/netif/ethernetif.c rename to geekos/src/lwip/netif/ethernetif.c diff --git a/palacios/src/lwip/netif/loopif.c b/geekos/src/lwip/netif/loopif.c similarity index 100% rename from palacios/src/lwip/netif/loopif.c rename to geekos/src/lwip/netif/loopif.c diff --git a/palacios/src/lwip/netif/ppp/auth.c b/geekos/src/lwip/netif/ppp/auth.c similarity index 100% rename from palacios/src/lwip/netif/ppp/auth.c rename to geekos/src/lwip/netif/ppp/auth.c diff --git a/palacios/src/lwip/netif/ppp/auth.h b/geekos/src/lwip/netif/ppp/auth.h similarity index 100% rename from palacios/src/lwip/netif/ppp/auth.h rename to geekos/src/lwip/netif/ppp/auth.h diff --git a/palacios/src/lwip/netif/ppp/chap.c b/geekos/src/lwip/netif/ppp/chap.c similarity index 100% rename from palacios/src/lwip/netif/ppp/chap.c rename to geekos/src/lwip/netif/ppp/chap.c diff --git a/palacios/src/lwip/netif/ppp/chap.h b/geekos/src/lwip/netif/ppp/chap.h similarity index 100% rename from palacios/src/lwip/netif/ppp/chap.h rename to geekos/src/lwip/netif/ppp/chap.h diff --git a/palacios/src/lwip/netif/ppp/chpms.c b/geekos/src/lwip/netif/ppp/chpms.c similarity index 100% rename from palacios/src/lwip/netif/ppp/chpms.c rename to geekos/src/lwip/netif/ppp/chpms.c diff --git a/palacios/src/lwip/netif/ppp/chpms.h b/geekos/src/lwip/netif/ppp/chpms.h similarity index 100% rename from palacios/src/lwip/netif/ppp/chpms.h rename to geekos/src/lwip/netif/ppp/chpms.h diff --git a/palacios/src/lwip/netif/ppp/fsm.c b/geekos/src/lwip/netif/ppp/fsm.c similarity index 100% rename from palacios/src/lwip/netif/ppp/fsm.c rename to geekos/src/lwip/netif/ppp/fsm.c diff --git a/palacios/src/lwip/netif/ppp/fsm.h b/geekos/src/lwip/netif/ppp/fsm.h similarity index 100% rename from palacios/src/lwip/netif/ppp/fsm.h rename to geekos/src/lwip/netif/ppp/fsm.h diff --git a/palacios/src/lwip/netif/ppp/ipcp.c b/geekos/src/lwip/netif/ppp/ipcp.c similarity index 100% rename from palacios/src/lwip/netif/ppp/ipcp.c rename to geekos/src/lwip/netif/ppp/ipcp.c diff --git a/palacios/src/lwip/netif/ppp/ipcp.h b/geekos/src/lwip/netif/ppp/ipcp.h similarity index 100% rename from palacios/src/lwip/netif/ppp/ipcp.h rename to geekos/src/lwip/netif/ppp/ipcp.h diff --git a/palacios/src/lwip/netif/ppp/lcp.c b/geekos/src/lwip/netif/ppp/lcp.c similarity index 100% rename from palacios/src/lwip/netif/ppp/lcp.c rename to geekos/src/lwip/netif/ppp/lcp.c diff --git a/palacios/src/lwip/netif/ppp/lcp.h b/geekos/src/lwip/netif/ppp/lcp.h similarity index 100% rename from palacios/src/lwip/netif/ppp/lcp.h rename to geekos/src/lwip/netif/ppp/lcp.h diff --git a/palacios/src/lwip/netif/ppp/magic.c b/geekos/src/lwip/netif/ppp/magic.c similarity index 100% rename from palacios/src/lwip/netif/ppp/magic.c rename to geekos/src/lwip/netif/ppp/magic.c diff --git a/palacios/src/lwip/netif/ppp/magic.h b/geekos/src/lwip/netif/ppp/magic.h similarity index 100% rename from palacios/src/lwip/netif/ppp/magic.h rename to geekos/src/lwip/netif/ppp/magic.h diff --git a/palacios/src/lwip/netif/ppp/md5.c b/geekos/src/lwip/netif/ppp/md5.c similarity index 100% rename from palacios/src/lwip/netif/ppp/md5.c rename to geekos/src/lwip/netif/ppp/md5.c diff --git a/palacios/src/lwip/netif/ppp/md5.h b/geekos/src/lwip/netif/ppp/md5.h similarity index 100% rename from palacios/src/lwip/netif/ppp/md5.h rename to geekos/src/lwip/netif/ppp/md5.h diff --git a/palacios/src/lwip/netif/ppp/pap.c b/geekos/src/lwip/netif/ppp/pap.c similarity index 100% rename from palacios/src/lwip/netif/ppp/pap.c rename to geekos/src/lwip/netif/ppp/pap.c diff --git a/palacios/src/lwip/netif/ppp/pap.h b/geekos/src/lwip/netif/ppp/pap.h similarity index 100% rename from palacios/src/lwip/netif/ppp/pap.h rename to geekos/src/lwip/netif/ppp/pap.h diff --git a/palacios/src/lwip/netif/ppp/ppp.c b/geekos/src/lwip/netif/ppp/ppp.c similarity index 100% rename from palacios/src/lwip/netif/ppp/ppp.c rename to geekos/src/lwip/netif/ppp/ppp.c diff --git a/palacios/src/lwip/netif/ppp/ppp.h b/geekos/src/lwip/netif/ppp/ppp.h similarity index 100% rename from palacios/src/lwip/netif/ppp/ppp.h rename to geekos/src/lwip/netif/ppp/ppp.h diff --git a/palacios/src/lwip/netif/ppp/ppp_oe.c b/geekos/src/lwip/netif/ppp/ppp_oe.c similarity index 100% rename from palacios/src/lwip/netif/ppp/ppp_oe.c rename to geekos/src/lwip/netif/ppp/ppp_oe.c diff --git a/palacios/src/lwip/netif/ppp/pppdebug.h b/geekos/src/lwip/netif/ppp/pppdebug.h similarity index 100% rename from palacios/src/lwip/netif/ppp/pppdebug.h rename to geekos/src/lwip/netif/ppp/pppdebug.h diff --git a/palacios/src/lwip/netif/ppp/randm.c b/geekos/src/lwip/netif/ppp/randm.c similarity index 100% rename from palacios/src/lwip/netif/ppp/randm.c rename to geekos/src/lwip/netif/ppp/randm.c diff --git a/palacios/src/lwip/netif/ppp/randm.h b/geekos/src/lwip/netif/ppp/randm.h similarity index 100% rename from palacios/src/lwip/netif/ppp/randm.h rename to geekos/src/lwip/netif/ppp/randm.h diff --git a/palacios/src/lwip/netif/ppp/vj.c b/geekos/src/lwip/netif/ppp/vj.c similarity index 100% rename from palacios/src/lwip/netif/ppp/vj.c rename to geekos/src/lwip/netif/ppp/vj.c diff --git a/palacios/src/lwip/netif/ppp/vj.h b/geekos/src/lwip/netif/ppp/vj.h similarity index 100% rename from palacios/src/lwip/netif/ppp/vj.h rename to geekos/src/lwip/netif/ppp/vj.h diff --git a/palacios/src/lwip/netif/ppp/vjbsdhdr.h b/geekos/src/lwip/netif/ppp/vjbsdhdr.h similarity index 100% rename from palacios/src/lwip/netif/ppp/vjbsdhdr.h rename to geekos/src/lwip/netif/ppp/vjbsdhdr.h diff --git a/palacios/src/lwip/netif/slipif.c b/geekos/src/lwip/netif/slipif.c similarity index 100% rename from palacios/src/lwip/netif/slipif.c rename to geekos/src/lwip/netif/slipif.c diff --git a/palacios/src/net/psock.c b/geekos/src/net/psock.c similarity index 100% rename from palacios/src/net/psock.c rename to geekos/src/net/psock.c diff --git a/palacios/src/net/resolv.c b/geekos/src/net/resolv.c similarity index 100% rename from palacios/src/net/resolv.c rename to geekos/src/net/resolv.c diff --git a/palacios/src/net/timer.c b/geekos/src/net/timer.c similarity index 100% rename from palacios/src/net/timer.c rename to geekos/src/net/timer.c diff --git a/palacios/src/net/uip-fw.c b/geekos/src/net/uip-fw.c similarity index 100% rename from palacios/src/net/uip-fw.c rename to geekos/src/net/uip-fw.c diff --git a/palacios/src/net/uip-neighbor.c b/geekos/src/net/uip-neighbor.c similarity index 100% rename from palacios/src/net/uip-neighbor.c rename to geekos/src/net/uip-neighbor.c diff --git a/palacios/src/net/uip-split.c b/geekos/src/net/uip-split.c similarity index 100% rename from palacios/src/net/uip-split.c rename to geekos/src/net/uip-split.c diff --git a/palacios/src/net/uip.c b/geekos/src/net/uip.c similarity index 100% rename from palacios/src/net/uip.c rename to geekos/src/net/uip.c diff --git a/palacios/src/net/uip_arp.c b/geekos/src/net/uip_arp.c similarity index 100% rename from palacios/src/net/uip_arp.c rename to geekos/src/net/uip_arp.c diff --git a/palacios/src/net/uiplib.c b/geekos/src/net/uiplib.c similarity index 100% rename from palacios/src/net/uiplib.c rename to geekos/src/net/uiplib.c diff --git a/palacios/build/Makefile b/palacios/build/Makefile index b01fc50..551d9c3 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -39,10 +39,8 @@ # # The setup code needs to copy it up to this address and jump there # -KERNEL_BASE_ADDR := 0x00100000 -# Kernel entry point function -KERNEL_ENTRY = $(SYM_PFX)Main + PROJECT_ROOT := .. @@ -173,15 +171,12 @@ DECODER_LIBS= ifeq ($(DECODER),XED) DECODER_SRCS := vmm_xed.c DECODER_FLAGS := -L../lib/xed -DECODER_LIBS := -lxed +DECODER_LIBS := $(PROJECT_ROOT)/lib/xed/libxed.a else # This is an error endif -# -#TCPSTACK, uIP is used currently -# -TCPSTACK=UIP + @@ -215,52 +210,14 @@ TCPSTACK=UIP # List of targets to build by default. # These targets encompass everything needed to boot # and run GeekOS. -ALL_TARGETS := vmm.img vm_kernel - - -# Kernel source files -KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \ - blockdev.c ide.c ne2k.c \ - keyboard.c screen.c timer.c \ - mem.c crc32.c \ - gdt.c tss.c segment.c \ - bget.c malloc.c \ - synch.c kthread.c \ - serial.c reboot.c \ - paging.c \ - debug.c vmm_stubs.c vm.c pci.c\ - queue.c socket.c net.c ring_buffer.c \ - main.c - - -# Kernel object files built from C source files -KERNEL_C_OBJS := $(KERNEL_C_SRCS:%.c=geekos/%.o) - -# Kernel assembly files -KERNEL_ASM_SRCS := lowlevel.asm - -KERNEL_GAS_SRCS := testvm.s udivdi3.s +ALL_TARGETS := vmm vm_kernel -# Kernel object files build from assembler source files -KERNEL_ASM_OBJS := $(KERNEL_ASM_SRCS:%.asm=geekos/%.o) -KERNEL_GAS_OBJS := $(KERNEL_GAS_SRCS:%.s=geekos/%.o) -# All kernel object files -KERNEL_OBJS := $(KERNEL_C_OBJS) \ - $(KERNEL_ASM_OBJS) $(KERNEL_GAS_OBJS) -# Common library source files. -# This library is linked into both the kernel and user programs. -# It provides string functions and generic printf()-style -# formatted output. -COMMON_C_SRCS := fmtout.c string.c memmove.c -# Common library object files. -COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o) - -VMM_ASM_SRCS := svm_lowlevel.asm \ +VMM_ASM_SRCS := svm_lowlevel.asm vmm_lowlevel.asm\ # vmx_lowlevel.asm VMM_ASM_OBJS := $(VMM_ASM_SRCS:%.asm=palacios/%.o) @@ -284,21 +241,24 @@ VMM_OBJS := $(VMM_C_OBJS) $(VMM_ASM_OBJS) +XED_C_SRCS := v3-xed-compat.c -DEVICE_C_SRCS := generic.c keyboard.c nvram.c timer.c simple_pic.c 8259a.c 8254.c serial.c ramdisk.c cdrom.c +XED_C_OBJS := $(XED_C_SRCS:%.c=xed/%.o) -DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o) +XED_GAS_SRCS := v3-udiv-compat.s -DEVICE_OBJS := $(DEVICE_C_OBJS) +XED_GAS_OBJS := $(XED_GAS_SRCS:%.s=xed/%.o) -V3LIBS := $(DECODER_LIBS) +XED_OBJS := $(XED_C_OBJS) $(XED_GAS_OBJS) -TCPSTACK_C_SRCS := psock.c timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c resolv.c +DEVICE_C_SRCS := generic.c keyboard.c nvram.c timer.c simple_pic.c 8259a.c 8254.c serial.c ramdisk.c cdrom.c -TCPSTACK_C_OBJS := $(TCPSTACK_C_SRCS:%.c=net/%.o) +DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o) -TCPSTACK_OBJS := $(TCPSTACK_C_OBJS) +DEVICE_OBJS := $(DEVICE_C_OBJS) + +V3LIBS := $(DECODER_LIBS) @@ -316,11 +276,6 @@ TARGET_CC_PREFIX := $(PROJECT_ROOT)/../devtools/i386/bin/i386-elf- 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 -# systems, such as Linux and FreeBSD, it can generally be the same -# as the target C compiler. -HOST_CC := gcc # Target linker. GNU ld is probably to only one that will work. TARGET_LD := $(TARGET_CC_PREFIX)ld -melf_i386 @@ -368,24 +323,18 @@ FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track # ---------------------------------------------------------------------- # Flags used for all C source files -GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) $(BOOT_FLAGS) -fPIC +GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) -fPIC #-fvisibility=hidden CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror -# Flags used for kernel C source files -CC_KERNEL_OPTS := -g -DGEEKOS -I$(PROJECT_ROOT)/include - # Flags used for VMM C source files CC_VMM_OPTS := -g -I$(PROJECT_ROOT)/include -D__V3VEE__ -D__V3_32BIT__ $(DECODER_FLAGS) $(JRLDEBUG) # Flags used for VMM C ASM files NASM_VMM_OPTS := -I$(PROJECT_ROOT)/src/palacios/ -f elf $(EXTRA_NASM_OPTS) -# Flags user for kernel assembly files -NASM_KERNEL_OPTS := -I$(PROJECT_ROOT)/src/geekos/ -f elf $(EXTRA_NASM_OPTS) -# Flags used for common library and libc source files -CC_USER_OPTS := -I$(PROJECT_ROOT)/include -I$(PROJECT_ROOT)/include/libc \ - $(EXTRA_CC_USER_OPTS) + + # Flags passed to objcopy program (strip unnecessary sections from kernel.exe) OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment @@ -395,26 +344,8 @@ OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment # Describes how to compile the source files. # ---------------------------------------------------------------------- -# Compilation of kernel C source files - -geekos/%.o : geekos/%.c - $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o - -# Compilation of kernel assembly source files -geekos/%.o : geekos/%.asm - $(NASM) $(NASM_KERNEL_OPTS) $< -o geekos/$*.o -# Compilation of test VM -geekos/%.o : geekos/%.s - $(AS) $< -o geekos/$*.o - -geekos/%.o : geekos/%.S - $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o - -# Compilation of common library C source files -common/%.o : common/%.c - $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o common/$*.o palacios/%.o : palacios/%.c $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o palacios/$*.o @@ -428,8 +359,13 @@ devices/%.o : devices/%.c devices/%.o : devices/%.asm $(NASM) $(NASM_VMM_OPTS) $< -o devices/$*.o -net/%.o : net/%.c - $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o net/$*.o + +xed/%.o : xed/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o xed/$*.o + +xed/%.o : xed/%.s + $(AS) $< -o xed/$*.o + # ---------------------------------------------------------------------- # Targets - @@ -451,15 +387,7 @@ all : $(ALL_TARGETS) #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 - cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > _temp - $(PAD) _temp 512 - cp _temp fd.img -vmm.img : fd.img - cp fd.img vmm.img - $(PAD) vmm.img 1474560 rombios_link: ln -s -f ../src/vmboot/rombios/BIOS-bochs-latest rombios @@ -479,67 +407,38 @@ force_payload: force_rombios force_vgabios inter1: force_payload -make clean -world: inter1 vmm.img +world: inter1 vmm -# make ready to boot over PXE -pxe: vmm.img - cp vmm.img /tftpboot/vmm.img +vmm: palacios/vmm.lib -run: vmm.img - /usr/local/qemu/bin/qemu-system-x86_64 -m 1024 -serial file:serial.out -cdrom puppy.iso -fda vmm.img -iso: vmm.img - cp vmm.img iso/vmm.img - mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o test.iso iso - -# Floppy boot sector (first stage boot loader). -geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm - $(NASM) -f bin \ - -I$(PROJECT_ROOT)/src/geekos/ \ - -DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \ - -DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \ - -DSECTORS_PER_TRACK=`$(FD_SECTORS_PER_TRACK) geekos/kernel.bin geekos/setup.bin` \ - $(PROJECT_ROOT)/src/geekos/fd_boot.asm \ - -o $@ - -# Setup program (second stage boot loader). -geekos/setup.bin : geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/setup.asm - $(NASM) -f bin \ - -I$(PROJECT_ROOT)/src/geekos/ \ - -DENTRY_POINT=0x`egrep 'Main$$' geekos/kernel.syms |awk '{print $$1}'` \ - -DVMM_SIZE=`$(NUMSECS) geekos/kernel.bin` \ - $(PROJECT_ROOT)/src/geekos/setup.asm \ - -o $@ - $(PAD) $@ 2048 - # Loadable (flat) kernel image. -geekos/kernel.bin : geekos/kernel.exe - $(TARGET_OBJCOPY) $(OBJCOPY_FLAGS) -S -O binary geekos/kernel.exe geekos/kernel.bin - $(PAD) $@ 512 +palacios/vmm.bin : palacios/vmm.lib + $(TARGET_OBJCOPY) $(OBJCOPY_FLAGS) -S -O binary palacios/vmm.lib palacios/vmm.bin + # The kernel executable and symbol map. -geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(TCPSTACK_OBJS) vm_kernel - $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \ - $(DECODER_FLAGS) \ - $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(V3LIBS) $(TCPSTACK_OBJS) -b binary vm_kernel - $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms +palacios/vmm.lib: $(VMM_OBJS) $(DEVICE_OBJS) $(XED_OBJS) vm_kernel +# $(TARGET_LD) -o palacios/vmm.lib \ +# $(DECODER_FLAGS) \ +# $(VMM_OBJS) $(DEVICE_OBJS) $(XED_OBJS) $(V3LIBS) -b binary vm_kernel +# $(TARGET_NM) palacios/vmm.lib > palacios/vmm.syms + $(TARGET_AR) rcs libv3vee.a \ + $(VMM_OBJS) $(DEVICE_OBJS) $(XED_OBJS) -force: +force: -#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 clean : - for d in geekos common libc user tools palacios devices net; do \ + for d in palacios devices; do \ (cd $$d && rm -f *); \ done @@ -547,14 +446,7 @@ clean : # Build header file dependencies, so source files are recompiled when # header files they depend on are modified. depend : $(GENERATED_LIBC_SRCS) - $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ - $(KERNEL_C_SRCS:%.c=$(PROJECT_ROOT)/src/geekos/%.c) \ - | $(PERL) -n -e 's,^(\S),geekos/$$1,;print' \ - > depend.mak - $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_USER_OPTS) \ - $(COMMON_C_SRCS:%.c=$(PROJECT_ROOT)/src/common/%.c) \ - | $(PERL) -n -e 's,^(\S),common/$$1,;print' \ - >> depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ $(VMM_C_SRCS:%.c=$(PROJECT_ROOT)/src/palacios/%.c) \ | $(PERL) -n -e 's,^(\S),palacios/$$1,;print' \ diff --git a/palacios/build/VM_linux_kernel b/palacios/build/VM_linux_kernel deleted file mode 100644 index ab2aec2..0000000 Binary files a/palacios/build/VM_linux_kernel and /dev/null differ diff --git a/palacios/build/noboot.img b/palacios/build/noboot.img deleted file mode 100644 index 6d4f193..0000000 Binary files a/palacios/build/noboot.img and /dev/null differ diff --git a/palacios/build/net/.ignore b/palacios/build/xed/.ignore similarity index 100% rename from palacios/build/net/.ignore rename to palacios/build/xed/.ignore diff --git a/palacios/include/palacios/vmm.h b/palacios/include/palacios/vmm.h index b8728b4..17dd7eb 100644 --- a/palacios/include/palacios/vmm.h +++ b/palacios/include/palacios/vmm.h @@ -148,6 +148,17 @@ ret; \ }) \ +#define V3_Yield(addr) \ + do { \ + extern struct vmm_os_hooks * os_hooks; \ + if ((os_hooks) && (os_hooks)->yield_cpu) { \ + (os_hooks)->yield_cpu(); \ + } \ + } while (0) \ + + + + /* ** */ @@ -223,7 +234,7 @@ struct vmm_os_hooks { void (*start_kernel_thread)(); // include pointer to function - + void (*yield_cpu)(); }; diff --git a/palacios/include/palacios/vmm_stddef.h b/palacios/include/palacios/vmm_stddef.h new file mode 100644 index 0000000..03bfbf9 --- /dev/null +++ b/palacios/include/palacios/vmm_stddef.h @@ -0,0 +1,426 @@ +/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* + * ISO C Standard: 7.17 Common definitions + */ +#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ + && !defined(__STDDEF_H__)) \ + || defined(__need_wchar_t) || defined(__need_size_t) \ + || defined(__need_ptrdiff_t) || defined(__need_NULL) \ + || defined(__need_wint_t) + +/* Any one of these symbols __need_* means that GNU libc + wants us just to define one data type. So don't define + the symbols that indicate this file's entire job has been done. */ +#if (!defined(__need_wchar_t) && !defined(__need_size_t) \ + && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ + && !defined(__need_wint_t)) +#define _STDDEF_H +#define _STDDEF_H_ +/* snaroff@next.com says the NeXT needs this. */ +#define _ANSI_STDDEF_H +/* Irix 5.1 needs this. */ +#define __STDDEF_H__ +#endif + +#ifndef __sys_stdtypes_h +/* This avoids lossage on SunOS but only if stdtypes.h comes first. + There's no way to win with the other order! Sun lossage. */ + +/* On 4.3bsd-net2, make sure ansi.h is included, so we have + one less case to deal with in the following. */ +#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) +#include +#endif +/* On FreeBSD 5, machine/ansi.h does not exist anymore... */ +#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +#include +#endif + +/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are + defined if the corresponding type is *not* defined. + FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */ +#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) +#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) +#define _SIZE_T +#endif +#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_) +#define _PTRDIFF_T +#endif +/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ + instead of _WCHAR_T_. */ +#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_) +#ifndef _BSD_WCHAR_T_ +#define _WCHAR_T +#endif +#endif +/* Undef _FOO_T_ if we are supposed to define foo_t. */ +#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#if defined (__need_size_t) || defined (_STDDEF_H_) +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#if defined (__need_wchar_t) || defined (_STDDEF_H_) +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */ + +/* Sequent's header files use _PTRDIFF_T_ in some conflicting way. + Just ignore it. */ +#if defined (__sequent__) && defined (_PTRDIFF_T_) +#undef _PTRDIFF_T_ +#endif + +/* On VxWorks, may have defined macros like + _TYPE_size_t which will typedef size_t. fixincludes patched the + vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is + not defined, and so that defining this macro defines _GCC_SIZE_T. + If we find that the macros are still defined at this point, we must + invoke them so that the type is defined as expected. */ +#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) +_TYPE_ptrdiff_t; +#undef _TYPE_ptrdiff_t +#endif +#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) +_TYPE_size_t; +#undef _TYPE_size_t +#endif +#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) +_TYPE_wchar_t; +#undef _TYPE_wchar_t +#endif + +/* In case nobody has defined these types, but we aren't running under + GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and + __WCHAR_TYPE__ have reasonable values. This can happen if the + parts of GCC is compiled by an older compiler, that actually + include gstddef.h, such as collect2. */ + +/* Signed type of difference of two pointers. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_ptrdiff_t) +#ifndef _PTRDIFF_T /* in case has defined it. */ +#ifndef _T_PTRDIFF_ +#ifndef _T_PTRDIFF +#ifndef __PTRDIFF_T +#ifndef _PTRDIFF_T_ +#ifndef _BSD_PTRDIFF_T_ +#ifndef ___int_ptrdiff_t_h +#ifndef _GCC_PTRDIFF_T +#define _PTRDIFF_T +#define _T_PTRDIFF_ +#define _T_PTRDIFF +#define __PTRDIFF_T +#define _PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ +#define ___int_ptrdiff_t_h +#define _GCC_PTRDIFF_T +#ifndef __PTRDIFF_TYPE__ +#define __PTRDIFF_TYPE__ long int +#endif +typedef __PTRDIFF_TYPE__ ptrdiff_t; +#endif /* _GCC_PTRDIFF_T */ +#endif /* ___int_ptrdiff_t_h */ +#endif /* _BSD_PTRDIFF_T_ */ +#endif /* _PTRDIFF_T_ */ +#endif /* __PTRDIFF_T */ +#endif /* _T_PTRDIFF */ +#endif /* _T_PTRDIFF_ */ +#endif /* _PTRDIFF_T */ + +/* If this symbol has done its job, get rid of it. */ +#undef __need_ptrdiff_t + +#endif /* _STDDEF_H or __need_ptrdiff_t. */ + +/* Unsigned type of `sizeof' something. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_size_t) +#ifndef __size_t__ /* BeOS */ +#ifndef __SIZE_T__ /* Cray Unicos/Mk */ +#ifndef _SIZE_T /* in case has defined it. */ +#ifndef _SYS_SIZE_T_H +#ifndef _T_SIZE_ +#ifndef _T_SIZE +#ifndef __SIZE_T +#ifndef _SIZE_T_ +#ifndef _BSD_SIZE_T_ +#ifndef _SIZE_T_DEFINED_ +#ifndef _SIZE_T_DEFINED +#ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */ +#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */ +#ifndef ___int_size_t_h +#ifndef _GCC_SIZE_T +#ifndef _SIZET_ +#ifndef __size_t +#define __size_t__ /* BeOS */ +#define __SIZE_T__ /* Cray Unicos/Mk */ +#define _SIZE_T +#define _SYS_SIZE_T_H +#define _T_SIZE_ +#define _T_SIZE +#define __SIZE_T +#define _SIZE_T_ +#define _BSD_SIZE_T_ +#define _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED +#define _BSD_SIZE_T_DEFINED_ /* Darwin */ +#define _SIZE_T_DECLARED /* FreeBSD 5 */ +#define ___int_size_t_h +#define _GCC_SIZE_T +#define _SIZET_ +#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +/* __size_t is a typedef on FreeBSD 5!, must not trash it. */ +#else +#define __size_t +#endif +#ifndef __SIZE_TYPE__ +#define __SIZE_TYPE__ long unsigned int +#endif +#if !(defined (__GNUG__) && defined (size_t)) +typedef __SIZE_TYPE__ size_t; +#ifdef __BEOS__ +typedef long ssize_t; +#endif /* __BEOS__ */ +#endif /* !(defined (__GNUG__) && defined (size_t)) */ +#endif /* __size_t */ +#endif /* _SIZET_ */ +#endif /* _GCC_SIZE_T */ +#endif /* ___int_size_t_h */ +#endif /* _SIZE_T_DECLARED */ +#endif /* _BSD_SIZE_T_DEFINED_ */ +#endif /* _SIZE_T_DEFINED */ +#endif /* _SIZE_T_DEFINED_ */ +#endif /* _BSD_SIZE_T_ */ +#endif /* _SIZE_T_ */ +#endif /* __SIZE_T */ +#endif /* _T_SIZE */ +#endif /* _T_SIZE_ */ +#endif /* _SYS_SIZE_T_H */ +#endif /* _SIZE_T */ +#endif /* __SIZE_T__ */ +#endif /* __size_t__ */ +#undef __need_size_t +#endif /* _STDDEF_H or __need_size_t. */ + + +/* Wide character type. + Locale-writers should change this as necessary to + be big enough to hold unique values not between 0 and 127, + and not (wchar_t) -1, for each defined multibyte character. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_wchar_t) +#ifndef __wchar_t__ /* BeOS */ +#ifndef __WCHAR_T__ /* Cray Unicos/Mk */ +#ifndef _WCHAR_T +#ifndef _T_WCHAR_ +#ifndef _T_WCHAR +#ifndef __WCHAR_T +#ifndef _WCHAR_T_ +#ifndef _BSD_WCHAR_T_ +#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */ +#ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */ +#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */ +#ifndef _WCHAR_T_DEFINED_ +#ifndef _WCHAR_T_DEFINED +#ifndef _WCHAR_T_H +#ifndef ___int_wchar_t_h +#ifndef __INT_WCHAR_T_H +#ifndef _GCC_WCHAR_T +#define __wchar_t__ /* BeOS */ +#define __WCHAR_T__ /* Cray Unicos/Mk */ +#define _WCHAR_T +#define _T_WCHAR_ +#define _T_WCHAR +#define __WCHAR_T +#define _WCHAR_T_ +#define _BSD_WCHAR_T_ +#define _WCHAR_T_DEFINED_ +#define _WCHAR_T_DEFINED +#define _WCHAR_T_H +#define ___int_wchar_t_h +#define __INT_WCHAR_T_H +#define _GCC_WCHAR_T +#define _WCHAR_T_DECLARED + +/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ + instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other + symbols in the _FOO_T_ family, stays defined even after its + corresponding type is defined). If we define wchar_t, then we + must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if + we undef _WCHAR_T_, then we must also define rune_t, since + headers like runetype.h assume that if machine/ansi.h is included, + and _BSD_WCHAR_T_ is not defined, then rune_t is available. + machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of + the same type." */ +#ifdef _BSD_WCHAR_T_ +#undef _BSD_WCHAR_T_ +#ifdef _BSD_RUNE_T_ +#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) +typedef _BSD_RUNE_T_ rune_t; +#define _BSD_WCHAR_T_DEFINED_ +#define _BSD_RUNE_T_DEFINED_ /* Darwin */ +#if defined (__FreeBSD__) && (__FreeBSD__ < 5) +/* Why is this file so hard to maintain properly? In constrast to + the comment above regarding BSD/386 1.1, on FreeBSD for as long + as the symbol has existed, _BSD_RUNE_T_ must not stay defined or + redundant typedefs will occur when stdlib.h is included after this file. */ +#undef _BSD_RUNE_T_ +#endif +#endif +#endif +#endif +/* FreeBSD 5 can't be handled well using "traditional" logic above + since it no longer defines _BSD_RUNE_T_ yet still desires to export + rune_t in some cases... */ +#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) +#if __BSD_VISIBLE +#ifndef _RUNE_T_DECLARED +typedef __rune_t rune_t; +#define _RUNE_T_DECLARED +#endif +#endif +#endif +#endif + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +#ifndef __cplusplus +typedef __WCHAR_TYPE__ wchar_t; +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif /* _WCHAR_T_DECLARED */ +#endif /* _BSD_RUNE_T_DEFINED_ */ +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif /* __WCHAR_T__ */ +#endif /* __wchar_t__ */ +#undef __need_wchar_t +#endif /* _STDDEF_H or __need_wchar_t. */ + +#if defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T + +#ifndef __WINT_TYPE__ +#define __WINT_TYPE__ unsigned int +#endif +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif + +/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. + are already defined. */ +/* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ +#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) +/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ + are probably typos and should be removed before 2.8 is released. */ +#ifdef _GCC_PTRDIFF_T_ +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#ifdef _GCC_SIZE_T_ +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#ifdef _GCC_WCHAR_T_ +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +/* The following ones are the real ones. */ +#ifdef _GCC_PTRDIFF_T +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#ifdef _GCC_SIZE_T +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#ifdef _GCC_WCHAR_T +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ */ + +#endif /* __sys_stdtypes_h */ + +/* A null pointer constant. */ + +#if defined (_STDDEF_H) || defined (__need_NULL) +#undef NULL /* in case has defined it. */ +#ifdef __GNUG__ +#define NULL __null +#else /* G++ */ +#ifndef __cplusplus +#define NULL ((void *)0) +#else /* C++ */ +#define NULL 0 +#endif /* C++ */ +#endif /* G++ */ +#endif /* NULL not defined and or need NULL. */ +#undef __need_NULL + +#ifdef _STDDEF_H + +/* Offset of member MEMBER in a struct of type TYPE. */ +#ifndef __cplusplus +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#else +/* The cast to "char &" below avoids problems with user-defined + "operator &", which can appear in a POD type. */ +#define offsetof(TYPE, MEMBER) \ + (__offsetof__ (reinterpret_cast \ + (&reinterpret_cast \ + (static_cast (0)->MEMBER)))) +#endif /* C++ */ +#endif /* _STDDEF_H was defined this time */ + +#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ + || __need_XXX was not defined before */ diff --git a/palacios/include/palacios/vmm_string.h b/palacios/include/palacios/vmm_string.h index c5cf8b8..60155a0 100644 --- a/palacios/include/palacios/vmm_string.h +++ b/palacios/include/palacios/vmm_string.h @@ -34,7 +34,8 @@ #ifdef __V3VEE__ -#include +#include + void* memset(void* s, int c, size_t n); void* memcpy(void *dst, const void* src, size_t n); @@ -45,6 +46,7 @@ size_t strnlen(const char *s, size_t maxlen); int strcmp(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t limit); char *strcat(char *s1, const char *s2); +char *strncat(char *s1, const char *s2, size_t limit); char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, size_t limit); char *strdup(const char *s1); @@ -57,6 +59,7 @@ char *strpbrk(const char *s, const char *accept); double ceil(double x); + #endif // !__V3VEE__ #endif /* STRING_H */ diff --git a/palacios/include/palacios/vmm_types.h b/palacios/include/palacios/vmm_types.h index c1cd312..96e5642 100644 --- a/palacios/include/palacios/vmm_types.h +++ b/palacios/include/palacios/vmm_types.h @@ -21,6 +21,7 @@ #define __VMM_TYPES_H #ifdef __V3VEE__ +#include typedef signed char schar_t; @@ -38,7 +39,7 @@ typedef unsigned long long ullong_t; typedef signed long slong_t; typedef unsigned long ulong_t; -typedef unsigned long size_t; +//typedef unsigned long size_t; #define false 0 diff --git a/palacios/include/xed/v3-xed-compat.h b/palacios/include/xed/v3-xed-compat.h new file mode 100644 index 0000000..9a882da --- /dev/null +++ b/palacios/include/xed/v3-xed-compat.h @@ -0,0 +1,29 @@ +#ifndef __V3_XED_COMPAT_H__ +#define __V3_XED_COMPAT_H__ + +#include + + +/* Definition of the control structure for streams +*/ +typedef struct file_struct { + short level; /* fill/empty level of buffer */ + unsigned flags; /* File status flags */ + char fd; /* File descriptor */ + unsigned char hold; /* Ungetc char if no buffer */ + short bsize; /* Buffer size */ + unsigned char *buffer; /* Data transfer buffer */ + unsigned char *curp; /* Current active pointer */ + unsigned istemp; /* Temporary file indicator */ + short token; /* Used for validity checking */ +} FILE; + + + +int fprintf(FILE *file, char *fmt, ...); +int printf(char *fmt, ...); +int fflush(FILE *stream); +void abort(void); + + +#endif diff --git a/palacios/src/devices/cdrom.c b/palacios/src/devices/cdrom.c index 5c7f9c3..4a52bb4 100644 --- a/palacios/src/devices/cdrom.c +++ b/palacios/src/devices/cdrom.c @@ -28,8 +28,9 @@ #endif -extern ulong_t g_ramdiskImage; -extern ulong_t s_ramdiskSize; + +ulong_t g_ramdiskImage; +ulong_t s_ramdiskSize; static void cdrom_init(struct cdrom_interface * cdrom) @@ -138,3 +139,4 @@ void init_cdrom(struct cdrom_interface *cdrom) return; } + diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 107a614..46d2e0d 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -33,6 +33,7 @@ #include #include +#include diff --git a/palacios/src/palacios/svm_halt.c b/palacios/src/palacios/svm_halt.c index 0975cc3..68261c3 100644 --- a/palacios/src/palacios/svm_halt.c +++ b/palacios/src/palacios/svm_halt.c @@ -25,8 +25,7 @@ #include #include -// From GeekOS -void Yield(void); + // @@ -52,7 +51,7 @@ int handle_svm_halt(struct guest_info * info) PrintDebug("GeekOS Yield\n"); rdtscll(yield_start); - Yield(); + V3_Yield(); rdtscll(yield_stop); diff --git a/palacios/src/palacios/svm_lowlevel.asm b/palacios/src/palacios/svm_lowlevel.asm index b9153d5..ac646b2 100644 --- a/palacios/src/palacios/svm_lowlevel.asm +++ b/palacios/src/palacios/svm_lowlevel.asm @@ -29,8 +29,6 @@ SVM_ERROR equ 0xFFFFFFFF SVM_SUCCESS equ 0x00000000 -EXPORT DisableInts -EXPORT EnableInts EXPORT exit_test @@ -115,16 +113,6 @@ SVM_HANDLER_HALT equ 0x2 ;CLGI equ db 0x0F,0x01,0xDD -align 8 -DisableInts: - cli - ret - -align 8 -EnableInts: - sti - ret - align 8 CLGI: diff --git a/palacios/src/palacios/vmm_lowlevel.asm b/palacios/src/palacios/vmm_lowlevel.asm index 0f8c758..8b22b5d 100644 --- a/palacios/src/palacios/vmm_lowlevel.asm +++ b/palacios/src/palacios/vmm_lowlevel.asm @@ -31,7 +31,14 @@ EXPORT GetIDTR EXPORT GetTR +; CPUID functions +EXPORT cpuid_ecx +EXPORT cpuid_eax +EXPORT cpuid_edx +; Utility Functions +EXPORT Set_MSR +EXPORT Get_MSR @@ -87,6 +94,105 @@ GetTR: ret +; +; cpuid_edx - return the edx register from cpuid +; +align 8 +cpuid_edx: + push ebp + mov ebp, esp + push edx + push ecx + push ebx + + mov eax, [ebp + 8] + cpuid + mov eax, edx + + pop ebx + pop ecx + pop edx + pop ebp + ret + + +; +; cpuid_ecx - return the ecx register from cpuid +; +align 8 +cpuid_ecx: + push ebp + mov ebp, esp + push edx + push ecx + push ebx + + mov eax, [ebp + 8] + cpuid + mov eax, ecx + + pop ebx + pop ecx + pop edx + pop ebp + ret + +; +; cpuid_eax - return the eax register from cpuid +; +align 8 +cpuid_eax: + push ebp + mov ebp, esp + push edx + push ecx + push ebx + + mov eax, [esp+4] + cpuid + + pop ebx + pop ecx + pop edx + pop ebp + ret + +; +; Set_MSR - Set the value of a given MSR +; +align 8 +Set_MSR: + push ebp + mov ebp, esp + pusha + mov eax, [ebp+16] + mov edx, [ebp+12] + mov ecx, [ebp+8] + wrmsr + popa + pop ebp + ret + + + +; +; Get_MSR - Get the value of a given MSR +; void Get_MSR(int MSR, void * high_byte, void * low_byte); +; +align 8 +Get_MSR: + push ebp + mov ebp, esp + pusha + mov ecx, [ebp+8] + rdmsr + mov ebx, [ebp+12] + mov [ebx], edx + mov ebx, [ebp+16] + mov [ebx], eax + popa + pop ebp + ret diff --git a/palacios/src/palacios/vmm_string.c b/palacios/src/palacios/vmm_string.c index 5d0d4fa..e98efd2 100644 --- a/palacios/src/palacios/vmm_string.c +++ b/palacios/src/palacios/vmm_string.c @@ -36,6 +36,26 @@ */ + +#define NEED_MEMSET 0 +#define NEED_MEMCPY 0 +#define NEED_MEMCMP 0 +#define NEED_STRLEN 0 +#define NEED_STRNLEN 0 +#define NEED_STRCMP 0 +#define NEED_STRNCMP 0 +#define NEED_STRCAT 0 +#define NEED_STRNCAT 0 +#define NEED_STRCPY 0 +#define NEED_STRNCPY 0 +#define NEED_STRDUP 0 +#define NEED_ATOI 0 +#define NEED_STRCHR 0 +#define NEED_STRRCHR 0 +#define NEED_STRPBRK 0 + + + #include #include @@ -50,7 +70,8 @@ double ceil(double x) { return (int)(x + e) + 1; } -#if 0 + +#if NEED_MEMSET void* memset(void* s, int c, size_t n) { unsigned char* p = (unsigned char*) s; @@ -62,8 +83,9 @@ void* memset(void* s, int c, size_t n) return s; } +#endif - +#if NEED_MEMCPY void* memcpy(void *dst, const void* src, size_t n) { unsigned char* d = (unsigned char*) dst; @@ -76,8 +98,10 @@ void* memcpy(void *dst, const void* src, size_t n) return dst; } +#endif +#if NEED_CMP int memcmp(const void *s1_, const void *s2_, size_t n) { const signed char *s1 = s1_, *s2 = s2_; @@ -92,7 +116,10 @@ int memcmp(const void *s1_, const void *s2_, size_t n) return 0; } +#endif + +#if NEED_STRLEN size_t strlen(const char* s) { size_t len = 0; @@ -100,7 +127,11 @@ size_t strlen(const char* s) ++len; return len; } +#endif + + +#if NEED_STRNLEN /* * This it a GNU extension. * It is like strlen(), but it will check at most maxlen @@ -116,7 +147,10 @@ size_t strnlen(const char *s, size_t maxlen) ++len; return len; } +#endif + +#if NEED_STRCMP int strcmp(const char* s1, const char* s2) { while (1) { @@ -127,7 +161,10 @@ int strcmp(const char* s1, const char* s2) ++s2; } } +#endif + +#if NEED_STRNCMP int strncmp(const char* s1, const char* s2, size_t limit) { size_t i = 0; @@ -143,7 +180,10 @@ int strncmp(const char* s1, const char* s2, size_t limit) /* limit reached and equal */ return 0; } +#endif + +#if NEED_STRCAT char *strcat(char *s1, const char *s2) { char *t1; @@ -155,7 +195,28 @@ char *strcat(char *s1, const char *s2) return t1; } +#endif + +#if NEED_STRNCAT +char *strncat(char *s1, const char *s2, size_t limit) +{ + size_t i = 0; + char *t1; + t1 = s1; + while (*s1) s1++; + while (i < limit) { + if(*s2 == '\0') break; + *s1++ = *s2++; + } + *s1 = '\0'; + return t1; +} +#endif + + + +#if NEED_STRCPY char *strcpy(char *dest, const char *src) { char *ret = dest; @@ -167,7 +228,10 @@ char *strcpy(char *dest, const char *src) return ret; } +#endif + +#if NEED_STRNCPY char *strncpy(char *dest, const char *src, size_t limit) { char *ret = dest; @@ -181,7 +245,11 @@ char *strncpy(char *dest, const char *src, size_t limit) return ret; } +#endif + + +#if NEED_STRDUP char *strdup(const char *s1) { char *ret; @@ -191,7 +259,12 @@ char *strdup(const char *s1) return ret; } +#endif + + + +#if NEED_ATOI int atoi(const char *buf) { int ret = 0; @@ -204,7 +277,10 @@ int atoi(const char *buf) return ret; } +#endif + +#if NEED_STRCHR char *strchr(const char *s, int c) { while (*s != '\0') { @@ -214,7 +290,10 @@ char *strchr(const char *s, int c) } return 0; } +#endif + +#if NEED_STRRCHR char *strrchr(const char *s, int c) { size_t len = strlen(s); @@ -227,7 +306,9 @@ char *strrchr(const char *s, int c) } return 0; } +#endif +#if NEED_STRPBRK char *strpbrk(const char *s, const char *accept) { size_t setLen = strlen(accept); @@ -243,5 +324,5 @@ char *strpbrk(const char *s, const char *accept) return 0; } - #endif + diff --git a/palacios/src/xed/v3-xed-compat.c b/palacios/src/xed/v3-xed-compat.c new file mode 100644 index 0000000..2c66381 --- /dev/null +++ b/palacios/src/xed/v3-xed-compat.c @@ -0,0 +1,44 @@ +#include + + +/* Standard I/O predefined streams +*/ +static FILE _streams = {0, 0, 0, 0, 0, NULL, NULL, 0, 0}; +FILE *stdin = (&_streams); +FILE *stdout = (&_streams); +FILE *stderr = (&_streams); + +int fprintf(FILE *file, char *fmt, ...) +{ + // PrintDebug("In fprintf!!\n"); + + return 0; + +} + +int printf(char *fmt, ...) +{ + // PrintDebug("In fprintf!!\n"); + + return 0; + +} + +int fflush(FILE *stream) +{ + //PrintDebug("In fflush!!\n"); + + return 0; +} + +void abort(void) +{ + //PrintDebug("Abort!!\n"); + + //__asm__ __volatile__("trap"); + //__builtin_unreached(); + + + while(1); + +}