Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


build reorganization
Jack Lange [Mon, 6 Oct 2008 16:49:59 +0000 (11:49 -0500)]
304 files changed:
build/CreateIso.sh [new file with mode: 0755]
build/Makefile [new file with mode: 0644]
build/Makefile.MASTER.BACKUP [new file with mode: 0644]
build/NOTES-QEMU.TXT [moved from palacios/build/NOTES-QEMU.TXT with 100% similarity]
build/RunPuppy.sh [new file with mode: 0755]
build/RunXP.sh [new file with mode: 0755]
build/iso/boot/grub/menu.lst [moved from palacios/build/iso/boot/grub/menu.lst with 100% similarity]
build/iso/boot/grub/stage2_eltorito [moved from palacios/build/iso/boot/grub/stage2_eltorito with 100% similarity]
geekos/COPYING.geekos [moved from palacios/COPYING.geekos with 100% similarity]
geekos/LICENSE-klibc.geekos [moved from palacios/LICENSE-klibc.geekos with 100% similarity]
geekos/README [moved from palacios/README with 100% similarity]
geekos/build/.bochsrc [moved from palacios/build/.bochsrc with 100% similarity]
geekos/build/Makefile [new file with mode: 0644]
geekos/build/common/.ignore [moved from palacios/build/common/.ignore with 100% similarity]
geekos/build/geekos/.ignore [moved from palacios/build/geekos/.ignore with 100% similarity]
geekos/build/libc/.ignore [moved from palacios/build/libc/.ignore with 100% similarity]
geekos/build/net/.ignore [copied from palacios/build/net/.ignore with 100% similarity]
geekos/build/palacios/.ignore [copied from palacios/build/net/.ignore with 100% similarity]
geekos/build/tools/.ignore [moved from palacios/build/tools/.ignore with 100% similarity]
geekos/build/user/.ignore [moved from palacios/build/user/.ignore with 100% similarity]
geekos/include/geekos/argblock.h [moved from palacios/include/geekos/argblock.h with 100% similarity]
geekos/include/geekos/bget.h [moved from palacios/include/geekos/bget.h with 100% similarity]
geekos/include/geekos/blockdev.h [moved from palacios/include/geekos/blockdev.h with 100% similarity]
geekos/include/geekos/bootinfo.h [moved from palacios/include/geekos/bootinfo.h with 100% similarity]
geekos/include/geekos/cpu.h [moved from palacios/include/geekos/cpu.h with 100% similarity]
geekos/include/geekos/crc32.h [moved from palacios/include/geekos/crc32.h with 100% similarity]
geekos/include/geekos/debug.h [moved from palacios/include/geekos/debug.h with 100% similarity]
geekos/include/geekos/defs.h [moved from palacios/include/geekos/defs.h with 100% similarity]
geekos/include/geekos/errno.h [moved from palacios/include/geekos/errno.h with 100% similarity]
geekos/include/geekos/fileio.h [moved from palacios/include/geekos/fileio.h with 100% similarity]
geekos/include/geekos/fmtout.h [moved from palacios/include/geekos/fmtout.h with 100% similarity]
geekos/include/geekos/gdt.h [moved from palacios/include/geekos/gdt.h with 100% similarity]
geekos/include/geekos/ide.h [moved from palacios/include/geekos/ide.h with 100% similarity]
geekos/include/geekos/idt.h [moved from palacios/include/geekos/idt.h with 100% similarity]
geekos/include/geekos/int.h [moved from palacios/include/geekos/int.h with 100% similarity]
geekos/include/geekos/io.h [moved from palacios/include/geekos/io.h with 100% similarity]
geekos/include/geekos/io_defs.h [moved from palacios/include/geekos/io_defs.h with 100% similarity]
geekos/include/geekos/io_devs.h [moved from palacios/include/geekos/io_devs.h with 100% similarity]
geekos/include/geekos/irq.h [moved from palacios/include/geekos/irq.h with 100% similarity]
geekos/include/geekos/kassert.h [moved from palacios/include/geekos/kassert.h with 100% similarity]
geekos/include/geekos/keyboard.h [moved from palacios/include/geekos/keyboard.h with 100% similarity]
geekos/include/geekos/kthread.h [moved from palacios/include/geekos/kthread.h with 100% similarity]
geekos/include/geekos/ktypes.h [moved from palacios/include/geekos/ktypes.h with 100% similarity]
geekos/include/geekos/list.h [moved from palacios/include/geekos/list.h with 100% similarity]
geekos/include/geekos/list2.h [moved from palacios/include/geekos/list2.h with 100% similarity]
geekos/include/geekos/malloc.h [moved from palacios/include/geekos/malloc.h with 100% similarity]
geekos/include/geekos/mem.h [moved from palacios/include/geekos/mem.h with 100% similarity]
geekos/include/geekos/ne2k.h [moved from palacios/include/geekos/ne2k.h with 100% similarity]
geekos/include/geekos/net.h [moved from palacios/include/geekos/net.h with 100% similarity]
geekos/include/geekos/paging.h [moved from palacios/include/geekos/paging.h with 100% similarity]
geekos/include/geekos/pci.h [moved from palacios/include/geekos/pci.h with 100% similarity]
geekos/include/geekos/queue.h [moved from palacios/include/geekos/queue.h with 100% similarity]
geekos/include/geekos/range.h [moved from palacios/include/geekos/range.h with 100% similarity]
geekos/include/geekos/reboot.h [moved from palacios/include/geekos/reboot.h with 100% similarity]
geekos/include/geekos/ring_buffer.h [moved from palacios/include/geekos/ring_buffer.h with 100% similarity]
geekos/include/geekos/rtl8139.h [moved from palacios/include/geekos/rtl8139.h with 100% similarity]
geekos/include/geekos/screen.h [moved from palacios/include/geekos/screen.h with 100% similarity]
geekos/include/geekos/segment.h [moved from palacios/include/geekos/segment.h with 100% similarity]
geekos/include/geekos/serial.h [moved from palacios/include/geekos/serial.h with 100% similarity]
geekos/include/geekos/socket.h [moved from palacios/include/geekos/socket.h with 100% similarity]
geekos/include/geekos/string.h [moved from palacios/include/geekos/string.h with 100% similarity]
geekos/include/geekos/symbol.h [moved from palacios/include/geekos/symbol.h with 100% similarity]
geekos/include/geekos/synch.h [moved from palacios/include/geekos/synch.h with 100% similarity]
geekos/include/geekos/timer.h [moved from palacios/include/geekos/timer.h with 100% similarity]
geekos/include/geekos/trap.h [moved from palacios/include/geekos/trap.h with 100% similarity]
geekos/include/geekos/tss.h [moved from palacios/include/geekos/tss.h with 100% similarity]
geekos/include/geekos/vm.h [moved from palacios/include/geekos/vm.h with 100% similarity]
geekos/include/geekos/vmm_stubs.h [moved from palacios/include/geekos/vmm_stubs.h with 100% similarity]
geekos/include/libc/fmtout.h [moved from palacios/include/libc/fmtout.h with 100% similarity]
geekos/include/libc/string.h [moved from palacios/include/libc/string.h with 100% similarity]
geekos/include/lwip/arch/cc.h [moved from palacios/include/lwip/arch/cc.h with 100% similarity]
geekos/include/lwip/arch/perf.h [moved from palacios/include/lwip/arch/perf.h with 100% similarity]
geekos/include/lwip/arch/sys_arch.h [moved from palacios/include/lwip/arch/sys_arch.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/autoip.h [moved from palacios/include/lwip/ipv4/lwip/autoip.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/icmp.h [moved from palacios/include/lwip/ipv4/lwip/icmp.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/igmp.h [moved from palacios/include/lwip/ipv4/lwip/igmp.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/inet.h [moved from palacios/include/lwip/ipv4/lwip/inet.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/inet_chksum.h [moved from palacios/include/lwip/ipv4/lwip/inet_chksum.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/ip.h [moved from palacios/include/lwip/ipv4/lwip/ip.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/ip.h~ [moved from palacios/include/lwip/ipv4/lwip/ip.h~ with 100% similarity]
geekos/include/lwip/ipv4/lwip/ip_addr.h [moved from palacios/include/lwip/ipv4/lwip/ip_addr.h with 100% similarity]
geekos/include/lwip/ipv4/lwip/ip_frag.h [moved from palacios/include/lwip/ipv4/lwip/ip_frag.h with 100% similarity]
geekos/include/lwip/ipv6/lwip/icmp.h [moved from palacios/include/lwip/ipv6/lwip/icmp.h with 100% similarity]
geekos/include/lwip/ipv6/lwip/inet.h [moved from palacios/include/lwip/ipv6/lwip/inet.h with 100% similarity]
geekos/include/lwip/ipv6/lwip/ip.h [moved from palacios/include/lwip/ipv6/lwip/ip.h with 100% similarity]
geekos/include/lwip/ipv6/lwip/ip_addr.h [moved from palacios/include/lwip/ipv6/lwip/ip_addr.h with 100% similarity]
geekos/include/lwip/lwip/api.h [moved from palacios/include/lwip/lwip/api.h with 100% similarity]
geekos/include/lwip/lwip/api_msg.h [moved from palacios/include/lwip/lwip/api_msg.h with 100% similarity]
geekos/include/lwip/lwip/arch.h [moved from palacios/include/lwip/lwip/arch.h with 100% similarity]
geekos/include/lwip/lwip/debug.h [moved from palacios/include/lwip/lwip/debug.h with 100% similarity]
geekos/include/lwip/lwip/def.h [moved from palacios/include/lwip/lwip/def.h with 100% similarity]
geekos/include/lwip/lwip/dhcp.h [moved from palacios/include/lwip/lwip/dhcp.h with 100% similarity]
geekos/include/lwip/lwip/dns.h [moved from palacios/include/lwip/lwip/dns.h with 100% similarity]
geekos/include/lwip/lwip/err.h [moved from palacios/include/lwip/lwip/err.h with 100% similarity]
geekos/include/lwip/lwip/init.h [moved from palacios/include/lwip/lwip/init.h with 100% similarity]
geekos/include/lwip/lwip/mem.h [moved from palacios/include/lwip/lwip/mem.h with 100% similarity]
geekos/include/lwip/lwip/memp.h [moved from palacios/include/lwip/lwip/memp.h with 100% similarity]
geekos/include/lwip/lwip/memp_std.h [moved from palacios/include/lwip/lwip/memp_std.h with 100% similarity]
geekos/include/lwip/lwip/netbuf.h [moved from palacios/include/lwip/lwip/netbuf.h with 100% similarity]
geekos/include/lwip/lwip/netdb.h [moved from palacios/include/lwip/lwip/netdb.h with 100% similarity]
geekos/include/lwip/lwip/netif.h [moved from palacios/include/lwip/lwip/netif.h with 100% similarity]
geekos/include/lwip/lwip/netifapi.h [moved from palacios/include/lwip/lwip/netifapi.h with 100% similarity]
geekos/include/lwip/lwip/opt.h [moved from palacios/include/lwip/lwip/opt.h with 100% similarity]
geekos/include/lwip/lwip/pbuf.h [moved from palacios/include/lwip/lwip/pbuf.h with 100% similarity]
geekos/include/lwip/lwip/raw.h [moved from palacios/include/lwip/lwip/raw.h with 100% similarity]
geekos/include/lwip/lwip/sio.h [moved from palacios/include/lwip/lwip/sio.h with 100% similarity]
geekos/include/lwip/lwip/snmp.h [moved from palacios/include/lwip/lwip/snmp.h with 100% similarity]
geekos/include/lwip/lwip/snmp_asn1.h [moved from palacios/include/lwip/lwip/snmp_asn1.h with 100% similarity]
geekos/include/lwip/lwip/snmp_msg.h [moved from palacios/include/lwip/lwip/snmp_msg.h with 100% similarity]
geekos/include/lwip/lwip/snmp_structs.h [moved from palacios/include/lwip/lwip/snmp_structs.h with 100% similarity]
geekos/include/lwip/lwip/sockets.h [moved from palacios/include/lwip/lwip/sockets.h with 100% similarity]
geekos/include/lwip/lwip/stats.h [moved from palacios/include/lwip/lwip/stats.h with 100% similarity]
geekos/include/lwip/lwip/sys.h [moved from palacios/include/lwip/lwip/sys.h with 100% similarity]
geekos/include/lwip/lwip/tcp.h [moved from palacios/include/lwip/lwip/tcp.h with 100% similarity]
geekos/include/lwip/lwip/tcpip.h [moved from palacios/include/lwip/lwip/tcpip.h with 100% similarity]
geekos/include/lwip/lwip/udp.h [moved from palacios/include/lwip/lwip/udp.h with 100% similarity]
geekos/include/lwip/lwipopts.h [moved from palacios/include/lwip/lwipopts.h with 100% similarity]
geekos/include/lwip/netif/etharp.h [moved from palacios/include/lwip/netif/etharp.h with 100% similarity]
geekos/include/lwip/netif/loopif.h [moved from palacios/include/lwip/netif/loopif.h with 100% similarity]
geekos/include/lwip/netif/ppp_oe.h [moved from palacios/include/lwip/netif/ppp_oe.h with 100% similarity]
geekos/include/lwip/netif/slipif.h [moved from palacios/include/lwip/netif/slipif.h with 100% similarity]
geekos/include/uip/clock.h [moved from palacios/include/uip/clock.h with 100% similarity]
geekos/include/uip/lc-addrlabels.h [moved from palacios/include/uip/lc-addrlabels.h with 100% similarity]
geekos/include/uip/lc-switch.h [moved from palacios/include/uip/lc-switch.h with 100% similarity]
geekos/include/uip/lc.h [moved from palacios/include/uip/lc.h with 100% similarity]
geekos/include/uip/psock.h [moved from palacios/include/uip/psock.h with 100% similarity]
geekos/include/uip/pt.h [moved from palacios/include/uip/pt.h with 100% similarity]
geekos/include/uip/resolv.h [moved from palacios/include/uip/resolv.h with 100% similarity]
geekos/include/uip/timer.h [moved from palacios/include/uip/timer.h with 100% similarity]
geekos/include/uip/uip-conf.h [moved from palacios/include/uip/uip-conf.h with 100% similarity]
geekos/include/uip/uip-fw.h [moved from palacios/include/uip/uip-fw.h with 100% similarity]
geekos/include/uip/uip-neighbor.h [moved from palacios/include/uip/uip-neighbor.h with 100% similarity]
geekos/include/uip/uip-split.h [moved from palacios/include/uip/uip-split.h with 100% similarity]
geekos/include/uip/uip.h [moved from palacios/include/uip/uip.h with 100% similarity]
geekos/include/uip/uip_arch.h [moved from palacios/include/uip/uip_arch.h with 100% similarity]
geekos/include/uip/uip_arp.h [moved from palacios/include/uip/uip_arp.h with 100% similarity]
geekos/include/uip/uiplib.h [moved from palacios/include/uip/uiplib.h with 100% similarity]
geekos/include/uip/uipopt.h [moved from palacios/include/uip/uipopt.h with 100% similarity]
geekos/scripts/eipToFunction [new file with mode: 0755]
geekos/scripts/findaddr [new file with mode: 0755]
geekos/scripts/generate_vmcs_serialization.pl [new file with mode: 0755]
geekos/scripts/generrs [new file with mode: 0755]
geekos/scripts/hexify.pl [new file with mode: 0755]
geekos/scripts/kerninfo [new file with mode: 0755]
geekos/scripts/make_payload.pl [new file with mode: 0755]
geekos/scripts/mkcdisk [new file with mode: 0755]
geekos/scripts/mkuprog [new file with mode: 0755]
geekos/scripts/numsecs [new file with mode: 0755]
geekos/scripts/numsecs_per_track [new file with mode: 0755]
geekos/scripts/pad [new file with mode: 0755]
geekos/scripts/pcat [new file with mode: 0755]
geekos/scripts/pw [new file with mode: 0755]
geekos/scripts/scan [new file with mode: 0755]
geekos/scripts/vmcs_entries_to_asm.pl [new file with mode: 0755]
geekos/scripts/zerofile [new file with mode: 0755]
geekos/src/common/fmtout.c [moved from palacios/src/common/fmtout.c with 100% similarity]
geekos/src/common/memmove.c [moved from palacios/src/common/memmove.c with 100% similarity]
geekos/src/common/string.c [moved from palacios/src/common/string.c with 100% similarity]
geekos/src/geekos/README.txt [moved from palacios/src/geekos/README.txt with 100% similarity]
geekos/src/geekos/TODO [moved from palacios/src/geekos/TODO with 100% similarity]
geekos/src/geekos/bget.c [moved from palacios/src/geekos/bget.c with 100% similarity]
geekos/src/geekos/blockdev.c [moved from palacios/src/geekos/blockdev.c with 100% similarity]
geekos/src/geekos/bootsect.asm [moved from palacios/src/geekos/bootsect.asm with 100% similarity]
geekos/src/geekos/crc32.c [moved from palacios/src/geekos/crc32.c with 100% similarity]
geekos/src/geekos/debug.c [moved from palacios/src/geekos/debug.c with 100% similarity]
geekos/src/geekos/defs.asm [moved from palacios/src/geekos/defs.asm with 100% similarity]
geekos/src/geekos/depend.mak [moved from palacios/src/geekos/depend.mak with 100% similarity]
geekos/src/geekos/fd_boot.asm [moved from palacios/src/geekos/fd_boot.asm with 100% similarity]
geekos/src/geekos/gdt.c [moved from palacios/src/geekos/gdt.c with 100% similarity]
geekos/src/geekos/ide.c [moved from palacios/src/geekos/ide.c with 100% similarity]
geekos/src/geekos/idt.c [moved from palacios/src/geekos/idt.c with 100% similarity]
geekos/src/geekos/int.c [moved from palacios/src/geekos/int.c with 100% similarity]
geekos/src/geekos/io.c [moved from palacios/src/geekos/io.c with 100% similarity]
geekos/src/geekos/irq.c [moved from palacios/src/geekos/irq.c with 100% similarity]
geekos/src/geekos/keyboard.c [moved from palacios/src/geekos/keyboard.c with 100% similarity]
geekos/src/geekos/kthread.c [moved from palacios/src/geekos/kthread.c with 100% similarity]
geekos/src/geekos/lowlevel.asm [moved from palacios/src/geekos/lowlevel.asm with 99% similarity]
geekos/src/geekos/main.c [moved from palacios/src/geekos/main.c with 100% similarity]
geekos/src/geekos/malloc.c [moved from palacios/src/geekos/malloc.c with 100% similarity]
geekos/src/geekos/mem.c [moved from palacios/src/geekos/mem.c with 100% similarity]
geekos/src/geekos/ne2k.c [moved from palacios/src/geekos/ne2k.c with 100% similarity]
geekos/src/geekos/net.c [moved from palacios/src/geekos/net.c with 100% similarity]
geekos/src/geekos/paging.c [moved from palacios/src/geekos/paging.c with 100% similarity]
geekos/src/geekos/pci.c [moved from palacios/src/geekos/pci.c with 100% similarity]
geekos/src/geekos/queue.c [moved from palacios/src/geekos/queue.c with 100% similarity]
geekos/src/geekos/reboot.c [moved from palacios/src/geekos/reboot.c with 100% similarity]
geekos/src/geekos/ring_buffer.c [moved from palacios/src/geekos/ring_buffer.c with 100% similarity]
geekos/src/geekos/rtl8139.c [moved from palacios/src/geekos/rtl8139.c with 100% similarity]
geekos/src/geekos/screen.c [moved from palacios/src/geekos/screen.c with 100% similarity]
geekos/src/geekos/segment.c [moved from palacios/src/geekos/segment.c with 100% similarity]
geekos/src/geekos/serial.c [moved from palacios/src/geekos/serial.c with 100% similarity]
geekos/src/geekos/setup.asm [moved from palacios/src/geekos/setup.asm with 100% similarity]
geekos/src/geekos/socket.c [moved from palacios/src/geekos/socket.c with 100% similarity]
geekos/src/geekos/symbol.asm [moved from palacios/src/geekos/symbol.asm with 100% similarity]
geekos/src/geekos/synch.c [moved from palacios/src/geekos/synch.c with 100% similarity]
geekos/src/geekos/testvm.s [moved from palacios/src/geekos/testvm.s with 100% similarity]
geekos/src/geekos/timer.c [moved from palacios/src/geekos/timer.c with 100% similarity]
geekos/src/geekos/trap.c [moved from palacios/src/geekos/trap.c with 100% similarity]
geekos/src/geekos/tss.c [moved from palacios/src/geekos/tss.c with 100% similarity]
geekos/src/geekos/udivdi3.s [moved from palacios/src/geekos/udivdi3.s with 100% similarity]
geekos/src/geekos/util.asm [moved from palacios/src/geekos/util.asm with 100% similarity]
geekos/src/geekos/vm.c [moved from palacios/src/geekos/vm.c with 96% similarity]
geekos/src/geekos/vmm_stubs.c [moved from palacios/src/geekos/vmm_stubs.c with 100% similarity]
geekos/src/libc/compat.c [moved from palacios/src/libc/compat.c with 100% similarity]
geekos/src/lwip/api/api_lib.c [moved from palacios/src/lwip/api/api_lib.c with 100% similarity]
geekos/src/lwip/api/api_msg.c [moved from palacios/src/lwip/api/api_msg.c with 100% similarity]
geekos/src/lwip/api/err.c [moved from palacios/src/lwip/api/err.c with 100% similarity]
geekos/src/lwip/api/netbuf.c [moved from palacios/src/lwip/api/netbuf.c with 100% similarity]
geekos/src/lwip/api/netdb.c [moved from palacios/src/lwip/api/netdb.c with 100% similarity]
geekos/src/lwip/api/netifapi.c [moved from palacios/src/lwip/api/netifapi.c with 100% similarity]
geekos/src/lwip/api/sockets.c [moved from palacios/src/lwip/api/sockets.c with 100% similarity]
geekos/src/lwip/api/tcpip.c [moved from palacios/src/lwip/api/tcpip.c with 100% similarity]
geekos/src/lwip/arch/sys_arch.c [moved from palacios/src/lwip/arch/sys_arch.c with 100% similarity]
geekos/src/lwip/build/Makefile [moved from palacios/src/lwip/build/Makefile with 100% similarity]
geekos/src/lwip/core/dhcp.c [moved from palacios/src/lwip/core/dhcp.c with 100% similarity]
geekos/src/lwip/core/dns.c [moved from palacios/src/lwip/core/dns.c with 100% similarity]
geekos/src/lwip/core/init.c [moved from palacios/src/lwip/core/init.c with 100% similarity]
geekos/src/lwip/core/ipv4/autoip.c [moved from palacios/src/lwip/core/ipv4/autoip.c with 100% similarity]
geekos/src/lwip/core/ipv4/icmp.c [moved from palacios/src/lwip/core/ipv4/icmp.c with 100% similarity]
geekos/src/lwip/core/ipv4/igmp.c [moved from palacios/src/lwip/core/ipv4/igmp.c with 100% similarity]
geekos/src/lwip/core/ipv4/inet.c [moved from palacios/src/lwip/core/ipv4/inet.c with 100% similarity]
geekos/src/lwip/core/ipv4/inet_chksum.c [moved from palacios/src/lwip/core/ipv4/inet_chksum.c with 100% similarity]
geekos/src/lwip/core/ipv4/ip.c [moved from palacios/src/lwip/core/ipv4/ip.c with 100% similarity]
geekos/src/lwip/core/ipv4/ip_addr.c [moved from palacios/src/lwip/core/ipv4/ip_addr.c with 100% similarity]
geekos/src/lwip/core/ipv4/ip_frag.c [moved from palacios/src/lwip/core/ipv4/ip_frag.c with 100% similarity]
geekos/src/lwip/core/ipv6/README [moved from palacios/src/lwip/core/ipv6/README with 100% similarity]
geekos/src/lwip/core/ipv6/icmp6.c [moved from palacios/src/lwip/core/ipv6/icmp6.c with 100% similarity]
geekos/src/lwip/core/ipv6/inet6.c [moved from palacios/src/lwip/core/ipv6/inet6.c with 100% similarity]
geekos/src/lwip/core/ipv6/ip6.c [moved from palacios/src/lwip/core/ipv6/ip6.c with 100% similarity]
geekos/src/lwip/core/ipv6/ip6_addr.c [moved from palacios/src/lwip/core/ipv6/ip6_addr.c with 100% similarity]
geekos/src/lwip/core/mem.c [moved from palacios/src/lwip/core/mem.c with 100% similarity]
geekos/src/lwip/core/memp.c [moved from palacios/src/lwip/core/memp.c with 100% similarity]
geekos/src/lwip/core/netif.c [moved from palacios/src/lwip/core/netif.c with 100% similarity]
geekos/src/lwip/core/pbuf.c [moved from palacios/src/lwip/core/pbuf.c with 100% similarity]
geekos/src/lwip/core/raw.c [moved from palacios/src/lwip/core/raw.c with 100% similarity]
geekos/src/lwip/core/snmp/asn1_dec.c [moved from palacios/src/lwip/core/snmp/asn1_dec.c with 100% similarity]
geekos/src/lwip/core/snmp/asn1_enc.c [moved from palacios/src/lwip/core/snmp/asn1_enc.c with 100% similarity]
geekos/src/lwip/core/snmp/mib2.c [moved from palacios/src/lwip/core/snmp/mib2.c with 100% similarity]
geekos/src/lwip/core/snmp/mib_structs.c [moved from palacios/src/lwip/core/snmp/mib_structs.c with 100% similarity]
geekos/src/lwip/core/snmp/msg_in.c [moved from palacios/src/lwip/core/snmp/msg_in.c with 100% similarity]
geekos/src/lwip/core/snmp/msg_out.c [moved from palacios/src/lwip/core/snmp/msg_out.c with 100% similarity]
geekos/src/lwip/core/stats.c [moved from palacios/src/lwip/core/stats.c with 100% similarity]
geekos/src/lwip/core/sys.c [moved from palacios/src/lwip/core/sys.c with 100% similarity]
geekos/src/lwip/core/tcp.c [moved from palacios/src/lwip/core/tcp.c with 100% similarity]
geekos/src/lwip/core/tcp_in.c [moved from palacios/src/lwip/core/tcp_in.c with 100% similarity]
geekos/src/lwip/core/tcp_out.c [moved from palacios/src/lwip/core/tcp_out.c with 100% similarity]
geekos/src/lwip/core/udp.c [moved from palacios/src/lwip/core/udp.c with 100% similarity]
geekos/src/lwip/netif/FILES [moved from palacios/src/lwip/netif/FILES with 100% similarity]
geekos/src/lwip/netif/etharp.c [moved from palacios/src/lwip/netif/etharp.c with 100% similarity]
geekos/src/lwip/netif/ethernetif.c [moved from palacios/src/lwip/netif/ethernetif.c with 100% similarity]
geekos/src/lwip/netif/loopif.c [moved from palacios/src/lwip/netif/loopif.c with 100% similarity]
geekos/src/lwip/netif/ppp/auth.c [moved from palacios/src/lwip/netif/ppp/auth.c with 100% similarity]
geekos/src/lwip/netif/ppp/auth.h [moved from palacios/src/lwip/netif/ppp/auth.h with 100% similarity]
geekos/src/lwip/netif/ppp/chap.c [moved from palacios/src/lwip/netif/ppp/chap.c with 100% similarity]
geekos/src/lwip/netif/ppp/chap.h [moved from palacios/src/lwip/netif/ppp/chap.h with 100% similarity]
geekos/src/lwip/netif/ppp/chpms.c [moved from palacios/src/lwip/netif/ppp/chpms.c with 100% similarity]
geekos/src/lwip/netif/ppp/chpms.h [moved from palacios/src/lwip/netif/ppp/chpms.h with 100% similarity]
geekos/src/lwip/netif/ppp/fsm.c [moved from palacios/src/lwip/netif/ppp/fsm.c with 100% similarity]
geekos/src/lwip/netif/ppp/fsm.h [moved from palacios/src/lwip/netif/ppp/fsm.h with 100% similarity]
geekos/src/lwip/netif/ppp/ipcp.c [moved from palacios/src/lwip/netif/ppp/ipcp.c with 100% similarity]
geekos/src/lwip/netif/ppp/ipcp.h [moved from palacios/src/lwip/netif/ppp/ipcp.h with 100% similarity]
geekos/src/lwip/netif/ppp/lcp.c [moved from palacios/src/lwip/netif/ppp/lcp.c with 100% similarity]
geekos/src/lwip/netif/ppp/lcp.h [moved from palacios/src/lwip/netif/ppp/lcp.h with 100% similarity]
geekos/src/lwip/netif/ppp/magic.c [moved from palacios/src/lwip/netif/ppp/magic.c with 100% similarity]
geekos/src/lwip/netif/ppp/magic.h [moved from palacios/src/lwip/netif/ppp/magic.h with 100% similarity]
geekos/src/lwip/netif/ppp/md5.c [moved from palacios/src/lwip/netif/ppp/md5.c with 100% similarity]
geekos/src/lwip/netif/ppp/md5.h [moved from palacios/src/lwip/netif/ppp/md5.h with 100% similarity]
geekos/src/lwip/netif/ppp/pap.c [moved from palacios/src/lwip/netif/ppp/pap.c with 100% similarity]
geekos/src/lwip/netif/ppp/pap.h [moved from palacios/src/lwip/netif/ppp/pap.h with 100% similarity]
geekos/src/lwip/netif/ppp/ppp.c [moved from palacios/src/lwip/netif/ppp/ppp.c with 100% similarity]
geekos/src/lwip/netif/ppp/ppp.h [moved from palacios/src/lwip/netif/ppp/ppp.h with 100% similarity]
geekos/src/lwip/netif/ppp/ppp_oe.c [moved from palacios/src/lwip/netif/ppp/ppp_oe.c with 100% similarity]
geekos/src/lwip/netif/ppp/pppdebug.h [moved from palacios/src/lwip/netif/ppp/pppdebug.h with 100% similarity]
geekos/src/lwip/netif/ppp/randm.c [moved from palacios/src/lwip/netif/ppp/randm.c with 100% similarity]
geekos/src/lwip/netif/ppp/randm.h [moved from palacios/src/lwip/netif/ppp/randm.h with 100% similarity]
geekos/src/lwip/netif/ppp/vj.c [moved from palacios/src/lwip/netif/ppp/vj.c with 100% similarity]
geekos/src/lwip/netif/ppp/vj.h [moved from palacios/src/lwip/netif/ppp/vj.h with 100% similarity]
geekos/src/lwip/netif/ppp/vjbsdhdr.h [moved from palacios/src/lwip/netif/ppp/vjbsdhdr.h with 100% similarity]
geekos/src/lwip/netif/slipif.c [moved from palacios/src/lwip/netif/slipif.c with 100% similarity]
geekos/src/net/psock.c [moved from palacios/src/net/psock.c with 100% similarity]
geekos/src/net/resolv.c [moved from palacios/src/net/resolv.c with 100% similarity]
geekos/src/net/timer.c [moved from palacios/src/net/timer.c with 100% similarity]
geekos/src/net/uip-fw.c [moved from palacios/src/net/uip-fw.c with 100% similarity]
geekos/src/net/uip-neighbor.c [moved from palacios/src/net/uip-neighbor.c with 100% similarity]
geekos/src/net/uip-split.c [moved from palacios/src/net/uip-split.c with 100% similarity]
geekos/src/net/uip.c [moved from palacios/src/net/uip.c with 100% similarity]
geekos/src/net/uip_arp.c [moved from palacios/src/net/uip_arp.c with 100% similarity]
geekos/src/net/uiplib.c [moved from palacios/src/net/uiplib.c with 100% similarity]
palacios/build/Makefile
palacios/build/VM_linux_kernel [deleted file]
palacios/build/noboot.img [deleted file]
palacios/build/xed/.ignore [moved from palacios/build/net/.ignore with 100% similarity]
palacios/include/palacios/vmm.h
palacios/include/palacios/vmm_stddef.h [new file with mode: 0644]
palacios/include/palacios/vmm_string.h
palacios/include/palacios/vmm_types.h
palacios/include/xed/v3-xed-compat.h [new file with mode: 0644]
palacios/src/devices/cdrom.c
palacios/src/palacios/svm.c
palacios/src/palacios/svm_halt.c
palacios/src/palacios/svm_lowlevel.asm
palacios/src/palacios/vmm_lowlevel.asm
palacios/src/palacios/vmm_string.c
palacios/src/xed/v3-xed-compat.c [new file with mode: 0644]

diff --git a/build/CreateIso.sh b/build/CreateIso.sh
new file mode 100755 (executable)
index 0000000..538faa3
--- /dev/null
@@ -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 (file)
index 0000000..e346632
--- /dev/null
@@ -0,0 +1,203 @@
+# Makefile for GeekOS kernel, userspace, and tools
+#
+#  Northwestern University 
+# (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
+# (c) 2008, Peter Dinda <pdinda@northwestern.edu> 
+# (c) 2008, Lei Xia <xiaxlei@gmail.com>
+# (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+#
+# Based on GeekOS Makefile:
+# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
+# $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 (file)
index 0000000..b01fc50
--- /dev/null
@@ -0,0 +1,571 @@
+# Makefile for GeekOS kernel, userspace, and tools
+#
+#  Northwestern University 
+# (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
+# (c) 2008, Peter Dinda <pdinda@northwestern.edu> 
+# (c) 2008, Lei Xia <xiaxlei@gmail.com>
+# (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+#
+# Based on GeekOS Makefile:
+# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
+# $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/build/RunPuppy.sh b/build/RunPuppy.sh
new file mode 100755 (executable)
index 0000000..0b36f37
--- /dev/null
@@ -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 (executable)
index 0000000..b78ed47
--- /dev/null
@@ -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
similarity index 100%
rename from palacios/README
rename to geekos/README
diff --git a/geekos/build/Makefile b/geekos/build/Makefile
new file mode 100644 (file)
index 0000000..29c05b9
--- /dev/null
@@ -0,0 +1,363 @@
+# Makefile for GeekOS kernel, userspace, and tools
+#
+#  Northwestern University 
+# (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
+# (c) 2008, Peter Dinda <pdinda@northwestern.edu> 
+# (c) 2008, Lei Xia <xiaxlei@gmail.com>
+# (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+#
+# Based on GeekOS Makefile:
+# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
+# $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/geekos/scripts/eipToFunction b/geekos/scripts/eipToFunction
new file mode 100755 (executable)
index 0000000..98bffa6
--- /dev/null
@@ -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 <eip value>\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 (executable)
index 0000000..7b9b877
--- /dev/null
@@ -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 <storage map> <symbol name>\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 (executable)
index 0000000..747e2c6
--- /dev/null
@@ -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 <geekos/vmcs.h>\n";
+
+print SOURCE "#include <geekos/$file.h>\n";
+
+while (<STDIN>) {
+  if (/\#define\s+(\S+)\s+/) {
+    push @list, $1;
+    GenSerUnserCode($1);
+  }
+}
+
+GenPrintAllCode(@list);
+
+print HEADER "#endif\n";
+
+sub GenSerUnserCode {
+  my $name=shift;
+
+  print SOURCE <<END
+
+void    Set_$name(uint_t val) { VMCS_WRITE($name,val); }
+uint_t  Get_$name() { uint_t rc; VMCS_READ($name,&rc); return rc; }
+
+void    Print_$name() { PrintTrace("$name = %x\\n", Get_$name()); }
+
+END
+
+;
+  print HEADER <<END2
+
+void    Set_$name(uint_t val);
+uint_t  Get_$name();
+
+void    Print_$name();
+
+END2
+
+;
+
+}
+
+
+sub GenPrintAllCode  {
+  print SOURCE "void PrintTrace_VMCS_ALL() {\n";
+  while (my $name=shift) { 
+    print SOURCE "  PrintTrace_$name();\n";
+  }
+  print SOURCE "}\n";
+  print HEADER "void PrintTrace_VMCS_ALL();\n";
+}
diff --git a/geekos/scripts/generrs b/geekos/scripts/generrs
new file mode 100755 (executable)
index 0000000..1b76e81
--- /dev/null
@@ -0,0 +1,28 @@
+#! /usr/bin/perl
+
+# Script to process include/geekos/errno.h to produce a table
+# of error description strings that can be compiled and
+# linked into libc.
+
+use strict qw(refs vars);
+
+my @errs = ();
+my @syms = ();
+
+$errs[0] = 'No error';
+
+while (<>) {
+       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 (executable)
index 0000000..9a03bf3
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+
+$file = $ARGV[0];
+
+while(1) { 
+       open (FILE,">>$file");
+       $foo = <STDIN>; 
+       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 (executable)
index 0000000..9241e3a
--- /dev/null
@@ -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 <kernfile>\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 (executable)
index 0000000..f39ea9e
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+$magic = 0xf1e2d3c4;
+
+use FileHandle;
+
+if (scalar(@ARGV) != 2) {
+  print STDERR "usage: make_payload.pl <cfg-file> <out-file>\n";
+  exit 1;
+}
+
+my $config_file = shift @ARGV;
+my $out_file = shift @ARGV;
+
+open (CFGFILE, "$config_file");
+@cfg = <CFGFILE>;
+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 (executable)
index 0000000..d3f4477
--- /dev/null
@@ -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 <diskImage> <filenames>\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 (executable)
index 0000000..1581b4b
--- /dev/null
@@ -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 <filename> <progname> <entry addr>\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 (executable)
index 0000000..708a893
--- /dev/null
@@ -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 <filename>\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 (executable)
index 0000000..b875a89
--- /dev/null
@@ -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 (executable)
index 0000000..c1c5329
--- /dev/null
@@ -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 <filename> <multiple>\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 (executable)
index 0000000..d58f9fd
--- /dev/null
@@ -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 (executable)
index 0000000..7edc728
--- /dev/null
@@ -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 <filename> <offset>\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 (executable)
index 0000000..cbfe6dc
--- /dev/null
@@ -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 <filename> <word value in hex>\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 (executable)
index 0000000..04bea4f
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+
+$file = $ARGV[0];
+$ofile = $ARGV[1];
+
+open(INFILE, "$file");
+@lines = <INFILE>;
+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 (executable)
index 0000000..52e744a
--- /dev/null
@@ -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 <output file> <num sectors>\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();
similarity index 99%
rename from palacios/src/geekos/lowlevel.asm
rename to geekos/src/geekos/lowlevel.asm
index 30979de..2c64e8a 100644 (file)
@@ -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
similarity index 96%
rename from palacios/src/geekos/vm.c
rename to geekos/src/geekos/vm.c
index 169e93b..a951501 100644 (file)
@@ -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);
   
similarity index 100%
rename from palacios/src/net/uip.c
rename to geekos/src/net/uip.c
index b01fc50..551d9c3 100644 (file)
 #
 # 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 (file)
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 (file)
index 6d4f193..0000000
Binary files a/palacios/build/noboot.img and /dev/null differ
index b8728b4..17dd7eb 100644 (file)
     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 (file)
index 0000000..03bfbf9
--- /dev/null
@@ -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  <stddef.h>
+ */
+#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 <machine/ansi.h>
+#endif
+/* On FreeBSD 5, machine/ansi.h does not exist anymore... */
+#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
+#include <sys/_types.h>
+#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, <type/vxTypesBase.h> 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 <sys/types.h> 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 <sys/types.h> 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 <stdio.h> 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 <stddef.h> 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 <size_t>                     \
+                 (&reinterpret_cast <const volatile char &>    \
+                  (static_cast<TYPE *> (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 */
index c5cf8b8..60155a0 100644 (file)
@@ -34,7 +34,8 @@
 
 #ifdef __V3VEE__
 
-#include <stddef.h>
+#include <palacios/vmm_stddef.h>
+
 
 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 */
index c1cd312..96e5642 100644 (file)
@@ -21,6 +21,7 @@
 #define __VMM_TYPES_H
 
 #ifdef __V3VEE__
+#include <palacios/vmm_stddef.h>
 
 
 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 (file)
index 0000000..9a882da
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __V3_XED_COMPAT_H__
+#define __V3_XED_COMPAT_H__
+
+#include <palacios/vmm_stddef.h>
+
+
+/* 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
index 5c7f9c3..4a52bb4 100644 (file)
@@ -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;
 }
 
+
index 107a614..46d2e0d 100644 (file)
@@ -33,6 +33,7 @@
 #include <palacios/vm_guest_mem.h>
 
 #include <palacios/vmm_decoder.h>
+#include <palacios/vmm_string.h>
 
 
 
index 0975cc3..68261c3 100644 (file)
@@ -25,8 +25,7 @@
 
 #include <palacios/svm_halt.h>
 #include <palacios/vmm_intr.h>
-// 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);
     
     
index b9153d5..ac646b2 100644 (file)
@@ -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:
index 0f8c758..8b22b5d 100644 (file)
@@ -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
 
 
 
index 5d0d4fa..e98efd2 100644 (file)
  */
 
 
+
+#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 <palacios/vmm_string.h>
 #include <palacios/vmm.h>
 
@@ -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 (file)
index 0000000..2c66381
--- /dev/null
@@ -0,0 +1,44 @@
+#include <xed/v3-xed-compat.h>
+
+
+/* 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);
+   
+}