diff --git a/.gitignore b/.gitignore index 2405a80..c4d4f7a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.o *.flat *.elf +*.raw .pc patches .stgit-* diff --git a/COPYRIGHT b/COPYRIGHT index b9d975f..2cc47a9 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,10 +1,5 @@ -Copyright (C) 2006 Qumranet. -Copyright (C) 2007-2017 by various contributors (see source files for details) - -The kvm-unit-tests are free software; the whole package can be redistributed -and/or modified under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -Many files in this directory and its subdirectories are also licensed under -the less restrictive GNU LGPL, version 2, or other compatible licenses. See -the individual files for details. +There are two parts unit-test: + - guest based unit test. This is inherited from kvm-unit-test and inherit the kvm-unit-test + license. + - host base unit test. This is free software and can be redistributed and/or modified under + BSD license. diff --git a/README b/README deleted file mode 120000 index 42061c0..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -README.md \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..44fc4e5 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +This is the unit-test for ACRN project. We have two type of unit-test: + - guest side. The unit-test will be run as a ACRN guest + - host side. The uni-test will be run at ACRN host side. diff --git a/guest/COPYRIGHT b/guest/COPYRIGHT new file mode 100644 index 0000000..b9d975f --- /dev/null +++ b/guest/COPYRIGHT @@ -0,0 +1,10 @@ +Copyright (C) 2006 Qumranet. +Copyright (C) 2007-2017 by various contributors (see source files for details) + +The kvm-unit-tests are free software; the whole package can be redistributed +and/or modified under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +Many files in this directory and its subdirectories are also licensed under +the less restrictive GNU LGPL, version 2, or other compatible licenses. See +the individual files for details. diff --git a/MAINTAINERS b/guest/MAINTAINERS similarity index 100% rename from MAINTAINERS rename to guest/MAINTAINERS diff --git a/Makefile b/guest/Makefile similarity index 96% rename from Makefile rename to guest/Makefile index 7c0f8e2..abfe2a7 100644 --- a/Makefile +++ b/guest/Makefile @@ -101,6 +101,8 @@ all: directories $(shell cd $(SRCDIR) && git rev-parse --verify --short=8 HEAD > standalone: all @scripts/mkstandalone.sh +stitched: $(TEST_DIR)/stitched.raw + install: standalone mkdir -p $(DESTDIR) install tests/* $(DESTDIR) @@ -114,7 +116,7 @@ libfdt_clean: $(LIBFDT_objdir)/.*.d distclean: clean libfdt_clean - $(RM) lib/asm config.mak $(TEST_DIR)-run msr.out cscope.* build-head + $(RM) $(TEST_DIR)-run msr.out cscope.* build-head $(RM) -r tests logs logs.old cscope: cscope_dirs = lib lib/libfdt lib/linux $(TEST_DIR) $(ARCH_LIBDIRS) lib/asm-generic @@ -123,3 +125,6 @@ cscope: find -L $(cscope_dirs) -maxdepth 1 \ -name '*.[chsS]' -exec realpath --relative-base=$(PWD) {} \; | sort -u > ./cscope.files cscope -bk + +unit: all + x86/run x86/$(file).flat diff --git a/guest/README b/guest/README new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/guest/README @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/guest/README.md similarity index 100% rename from README.md rename to guest/README.md diff --git a/api/api-sample.cc b/guest/api/api-sample.cc similarity index 100% rename from api/api-sample.cc rename to guest/api/api-sample.cc diff --git a/api/dirty-log-perf.cc b/guest/api/dirty-log-perf.cc similarity index 100% rename from api/dirty-log-perf.cc rename to guest/api/dirty-log-perf.cc diff --git a/api/dirty-log.cc b/guest/api/dirty-log.cc similarity index 100% rename from api/dirty-log.cc rename to guest/api/dirty-log.cc diff --git a/api/exception.cc b/guest/api/exception.cc similarity index 100% rename from api/exception.cc rename to guest/api/exception.cc diff --git a/api/exception.hh b/guest/api/exception.hh similarity index 100% rename from api/exception.hh rename to guest/api/exception.hh diff --git a/api/identity.cc b/guest/api/identity.cc similarity index 100% rename from api/identity.cc rename to guest/api/identity.cc diff --git a/api/identity.hh b/guest/api/identity.hh similarity index 100% rename from api/identity.hh rename to guest/api/identity.hh diff --git a/api/kvmxx.cc b/guest/api/kvmxx.cc similarity index 100% rename from api/kvmxx.cc rename to guest/api/kvmxx.cc diff --git a/api/kvmxx.hh b/guest/api/kvmxx.hh similarity index 100% rename from api/kvmxx.hh rename to guest/api/kvmxx.hh diff --git a/api/memmap.cc b/guest/api/memmap.cc similarity index 100% rename from api/memmap.cc rename to guest/api/memmap.cc diff --git a/api/memmap.hh b/guest/api/memmap.hh similarity index 100% rename from api/memmap.hh rename to guest/api/memmap.hh diff --git a/arm/Makefile b/guest/arm/Makefile similarity index 100% rename from arm/Makefile rename to guest/arm/Makefile diff --git a/arm/Makefile.arm b/guest/arm/Makefile.arm similarity index 100% rename from arm/Makefile.arm rename to guest/arm/Makefile.arm diff --git a/arm/Makefile.arm64 b/guest/arm/Makefile.arm64 similarity index 100% rename from arm/Makefile.arm64 rename to guest/arm/Makefile.arm64 diff --git a/arm/Makefile.common b/guest/arm/Makefile.common similarity index 100% rename from arm/Makefile.common rename to guest/arm/Makefile.common diff --git a/arm/cstart.S b/guest/arm/cstart.S similarity index 100% rename from arm/cstart.S rename to guest/arm/cstart.S diff --git a/arm/cstart64.S b/guest/arm/cstart64.S similarity index 100% rename from arm/cstart64.S rename to guest/arm/cstart64.S diff --git a/arm/flat.lds b/guest/arm/flat.lds similarity index 100% rename from arm/flat.lds rename to guest/arm/flat.lds diff --git a/arm/gic.c b/guest/arm/gic.c similarity index 100% rename from arm/gic.c rename to guest/arm/gic.c diff --git a/arm/pci-test.c b/guest/arm/pci-test.c similarity index 100% rename from arm/pci-test.c rename to guest/arm/pci-test.c diff --git a/arm/pmu.c b/guest/arm/pmu.c similarity index 100% rename from arm/pmu.c rename to guest/arm/pmu.c diff --git a/arm/psci.c b/guest/arm/psci.c similarity index 100% rename from arm/psci.c rename to guest/arm/psci.c diff --git a/arm/run b/guest/arm/run similarity index 100% rename from arm/run rename to guest/arm/run diff --git a/arm/selftest.c b/guest/arm/selftest.c similarity index 100% rename from arm/selftest.c rename to guest/arm/selftest.c diff --git a/arm/sieve.c b/guest/arm/sieve.c similarity index 100% rename from arm/sieve.c rename to guest/arm/sieve.c diff --git a/arm/spinlock-test.c b/guest/arm/spinlock-test.c similarity index 100% rename from arm/spinlock-test.c rename to guest/arm/spinlock-test.c diff --git a/arm/timer.c b/guest/arm/timer.c similarity index 100% rename from arm/timer.c rename to guest/arm/timer.c diff --git a/arm/unittests.cfg b/guest/arm/unittests.cfg similarity index 100% rename from arm/unittests.cfg rename to guest/arm/unittests.cfg diff --git a/guest/config.mak b/guest/config.mak new file mode 100644 index 0000000..c3ed4e1 --- /dev/null +++ b/guest/config.mak @@ -0,0 +1,21 @@ +SRCDIR=${shell pwd} +PREFIX=/usr/local +HOST=x86_64 +ARCH=x86_64 +ARCH_NAME=x86_64 +PROCESSOR=x86_64 +CC=gcc +CXX=g++ +LD=ld +OBJCOPY=objcopy +OBJDUMP=objdump +AR=ar +ADDR2LINE=addr2line +API= +TEST_DIR=x86 +FIRMWARE= +ENDIAN= +PRETTY_PRINT_STACKS=yes +ENVIRON_DEFAULT=yes +ERRATATXT=errata.txt +U32_LONG_FMT= diff --git a/configure b/guest/configure similarity index 100% rename from configure rename to guest/configure diff --git a/errata.txt b/guest/errata.txt similarity index 100% rename from errata.txt rename to guest/errata.txt diff --git a/lib/abort.c b/guest/lib/abort.c similarity index 100% rename from lib/abort.c rename to guest/lib/abort.c diff --git a/lib/alloc.c b/guest/lib/alloc.c similarity index 100% rename from lib/alloc.c rename to guest/lib/alloc.c diff --git a/lib/alloc.h b/guest/lib/alloc.h similarity index 100% rename from lib/alloc.h rename to guest/lib/alloc.h diff --git a/lib/alloc_page.c b/guest/lib/alloc_page.c similarity index 100% rename from lib/alloc_page.c rename to guest/lib/alloc_page.c diff --git a/lib/alloc_page.h b/guest/lib/alloc_page.h similarity index 100% rename from lib/alloc_page.h rename to guest/lib/alloc_page.h diff --git a/lib/alloc_phys.c b/guest/lib/alloc_phys.c similarity index 100% rename from lib/alloc_phys.c rename to guest/lib/alloc_phys.c diff --git a/lib/alloc_phys.h b/guest/lib/alloc_phys.h similarity index 100% rename from lib/alloc_phys.h rename to guest/lib/alloc_phys.h diff --git a/lib/argv.c b/guest/lib/argv.c similarity index 100% rename from lib/argv.c rename to guest/lib/argv.c diff --git a/lib/argv.h b/guest/lib/argv.h similarity index 100% rename from lib/argv.h rename to guest/lib/argv.h diff --git a/lib/arm/.gitignore b/guest/lib/arm/.gitignore similarity index 100% rename from lib/arm/.gitignore rename to guest/lib/arm/.gitignore diff --git a/lib/arm/asm-offsets.c b/guest/lib/arm/asm-offsets.c similarity index 100% rename from lib/arm/asm-offsets.c rename to guest/lib/arm/asm-offsets.c diff --git a/lib/arm/asm/arch_gicv3.h b/guest/lib/arm/asm/arch_gicv3.h similarity index 100% rename from lib/arm/asm/arch_gicv3.h rename to guest/lib/arm/asm/arch_gicv3.h diff --git a/lib/arm/asm/barrier.h b/guest/lib/arm/asm/barrier.h similarity index 100% rename from lib/arm/asm/barrier.h rename to guest/lib/arm/asm/barrier.h diff --git a/lib/arm/asm/bitops.h b/guest/lib/arm/asm/bitops.h similarity index 100% rename from lib/arm/asm/bitops.h rename to guest/lib/arm/asm/bitops.h diff --git a/lib/arm/asm/cpumask.h b/guest/lib/arm/asm/cpumask.h similarity index 100% rename from lib/arm/asm/cpumask.h rename to guest/lib/arm/asm/cpumask.h diff --git a/lib/arm/asm/delay.h b/guest/lib/arm/asm/delay.h similarity index 100% rename from lib/arm/asm/delay.h rename to guest/lib/arm/asm/delay.h diff --git a/lib/arm/asm/gic-v2.h b/guest/lib/arm/asm/gic-v2.h similarity index 100% rename from lib/arm/asm/gic-v2.h rename to guest/lib/arm/asm/gic-v2.h diff --git a/lib/arm/asm/gic-v3.h b/guest/lib/arm/asm/gic-v3.h similarity index 100% rename from lib/arm/asm/gic-v3.h rename to guest/lib/arm/asm/gic-v3.h diff --git a/lib/arm/asm/gic.h b/guest/lib/arm/asm/gic.h similarity index 100% rename from lib/arm/asm/gic.h rename to guest/lib/arm/asm/gic.h diff --git a/lib/arm/asm/io.h b/guest/lib/arm/asm/io.h similarity index 100% rename from lib/arm/asm/io.h rename to guest/lib/arm/asm/io.h diff --git a/lib/arm/asm/mmu-api.h b/guest/lib/arm/asm/mmu-api.h similarity index 100% rename from lib/arm/asm/mmu-api.h rename to guest/lib/arm/asm/mmu-api.h diff --git a/lib/arm/asm/mmu.h b/guest/lib/arm/asm/mmu.h similarity index 100% rename from lib/arm/asm/mmu.h rename to guest/lib/arm/asm/mmu.h diff --git a/lib/arm/asm/page.h b/guest/lib/arm/asm/page.h similarity index 100% rename from lib/arm/asm/page.h rename to guest/lib/arm/asm/page.h diff --git a/lib/arm/asm/pci.h b/guest/lib/arm/asm/pci.h similarity index 100% rename from lib/arm/asm/pci.h rename to guest/lib/arm/asm/pci.h diff --git a/lib/arm/asm/pgtable-hwdef.h b/guest/lib/arm/asm/pgtable-hwdef.h similarity index 100% rename from lib/arm/asm/pgtable-hwdef.h rename to guest/lib/arm/asm/pgtable-hwdef.h diff --git a/lib/arm/asm/pgtable.h b/guest/lib/arm/asm/pgtable.h similarity index 100% rename from lib/arm/asm/pgtable.h rename to guest/lib/arm/asm/pgtable.h diff --git a/lib/arm/asm/processor.h b/guest/lib/arm/asm/processor.h similarity index 100% rename from lib/arm/asm/processor.h rename to guest/lib/arm/asm/processor.h diff --git a/lib/arm/asm/psci.h b/guest/lib/arm/asm/psci.h similarity index 100% rename from lib/arm/asm/psci.h rename to guest/lib/arm/asm/psci.h diff --git a/lib/arm/asm/ptrace.h b/guest/lib/arm/asm/ptrace.h similarity index 100% rename from lib/arm/asm/ptrace.h rename to guest/lib/arm/asm/ptrace.h diff --git a/lib/arm/asm/setup.h b/guest/lib/arm/asm/setup.h similarity index 100% rename from lib/arm/asm/setup.h rename to guest/lib/arm/asm/setup.h diff --git a/lib/arm/asm/smp.h b/guest/lib/arm/asm/smp.h similarity index 100% rename from lib/arm/asm/smp.h rename to guest/lib/arm/asm/smp.h diff --git a/lib/arm/asm/spinlock.h b/guest/lib/arm/asm/spinlock.h similarity index 100% rename from lib/arm/asm/spinlock.h rename to guest/lib/arm/asm/spinlock.h diff --git a/lib/arm/asm/stack.h b/guest/lib/arm/asm/stack.h similarity index 100% rename from lib/arm/asm/stack.h rename to guest/lib/arm/asm/stack.h diff --git a/lib/arm/asm/sysreg.h b/guest/lib/arm/asm/sysreg.h similarity index 100% rename from lib/arm/asm/sysreg.h rename to guest/lib/arm/asm/sysreg.h diff --git a/lib/arm/asm/thread_info.h b/guest/lib/arm/asm/thread_info.h similarity index 100% rename from lib/arm/asm/thread_info.h rename to guest/lib/arm/asm/thread_info.h diff --git a/lib/arm/bitops.c b/guest/lib/arm/bitops.c similarity index 100% rename from lib/arm/bitops.c rename to guest/lib/arm/bitops.c diff --git a/lib/arm/delay.c b/guest/lib/arm/delay.c similarity index 100% rename from lib/arm/delay.c rename to guest/lib/arm/delay.c diff --git a/lib/arm/eabi_compat.c b/guest/lib/arm/eabi_compat.c similarity index 100% rename from lib/arm/eabi_compat.c rename to guest/lib/arm/eabi_compat.c diff --git a/lib/arm/gic-v2.c b/guest/lib/arm/gic-v2.c similarity index 100% rename from lib/arm/gic-v2.c rename to guest/lib/arm/gic-v2.c diff --git a/lib/arm/gic-v3.c b/guest/lib/arm/gic-v3.c similarity index 100% rename from lib/arm/gic-v3.c rename to guest/lib/arm/gic-v3.c diff --git a/lib/arm/gic.c b/guest/lib/arm/gic.c similarity index 100% rename from lib/arm/gic.c rename to guest/lib/arm/gic.c diff --git a/lib/arm/io.c b/guest/lib/arm/io.c similarity index 100% rename from lib/arm/io.c rename to guest/lib/arm/io.c diff --git a/lib/arm/io.h b/guest/lib/arm/io.h similarity index 100% rename from lib/arm/io.h rename to guest/lib/arm/io.h diff --git a/lib/arm/mmu.c b/guest/lib/arm/mmu.c similarity index 100% rename from lib/arm/mmu.c rename to guest/lib/arm/mmu.c diff --git a/lib/arm/processor.c b/guest/lib/arm/processor.c similarity index 100% rename from lib/arm/processor.c rename to guest/lib/arm/processor.c diff --git a/lib/arm/psci.c b/guest/lib/arm/psci.c similarity index 100% rename from lib/arm/psci.c rename to guest/lib/arm/psci.c diff --git a/lib/arm/setup.c b/guest/lib/arm/setup.c similarity index 100% rename from lib/arm/setup.c rename to guest/lib/arm/setup.c diff --git a/lib/arm/smp.c b/guest/lib/arm/smp.c similarity index 100% rename from lib/arm/smp.c rename to guest/lib/arm/smp.c diff --git a/lib/arm/spinlock.c b/guest/lib/arm/spinlock.c similarity index 100% rename from lib/arm/spinlock.c rename to guest/lib/arm/spinlock.c diff --git a/lib/arm/stack.c b/guest/lib/arm/stack.c similarity index 100% rename from lib/arm/stack.c rename to guest/lib/arm/stack.c diff --git a/lib/arm64/.gitignore b/guest/lib/arm64/.gitignore similarity index 100% rename from lib/arm64/.gitignore rename to guest/lib/arm64/.gitignore diff --git a/lib/arm64/asm-offsets.c b/guest/lib/arm64/asm-offsets.c similarity index 100% rename from lib/arm64/asm-offsets.c rename to guest/lib/arm64/asm-offsets.c diff --git a/lib/arm64/asm/arch_gicv3.h b/guest/lib/arm64/asm/arch_gicv3.h similarity index 100% rename from lib/arm64/asm/arch_gicv3.h rename to guest/lib/arm64/asm/arch_gicv3.h diff --git a/lib/arm64/asm/barrier.h b/guest/lib/arm64/asm/barrier.h similarity index 100% rename from lib/arm64/asm/barrier.h rename to guest/lib/arm64/asm/barrier.h diff --git a/lib/arm64/asm/bitops.h b/guest/lib/arm64/asm/bitops.h similarity index 100% rename from lib/arm64/asm/bitops.h rename to guest/lib/arm64/asm/bitops.h diff --git a/lib/arm64/asm/cpumask.h b/guest/lib/arm64/asm/cpumask.h similarity index 100% rename from lib/arm64/asm/cpumask.h rename to guest/lib/arm64/asm/cpumask.h diff --git a/lib/arm64/asm/delay.h b/guest/lib/arm64/asm/delay.h similarity index 100% rename from lib/arm64/asm/delay.h rename to guest/lib/arm64/asm/delay.h diff --git a/lib/arm64/asm/esr.h b/guest/lib/arm64/asm/esr.h similarity index 100% rename from lib/arm64/asm/esr.h rename to guest/lib/arm64/asm/esr.h diff --git a/lib/arm64/asm/gic-v2.h b/guest/lib/arm64/asm/gic-v2.h similarity index 100% rename from lib/arm64/asm/gic-v2.h rename to guest/lib/arm64/asm/gic-v2.h diff --git a/lib/arm64/asm/gic-v3.h b/guest/lib/arm64/asm/gic-v3.h similarity index 100% rename from lib/arm64/asm/gic-v3.h rename to guest/lib/arm64/asm/gic-v3.h diff --git a/lib/arm64/asm/gic.h b/guest/lib/arm64/asm/gic.h similarity index 100% rename from lib/arm64/asm/gic.h rename to guest/lib/arm64/asm/gic.h diff --git a/lib/arm64/asm/io.h b/guest/lib/arm64/asm/io.h similarity index 100% rename from lib/arm64/asm/io.h rename to guest/lib/arm64/asm/io.h diff --git a/lib/arm64/asm/mmu-api.h b/guest/lib/arm64/asm/mmu-api.h similarity index 100% rename from lib/arm64/asm/mmu-api.h rename to guest/lib/arm64/asm/mmu-api.h diff --git a/lib/arm64/asm/mmu.h b/guest/lib/arm64/asm/mmu.h similarity index 100% rename from lib/arm64/asm/mmu.h rename to guest/lib/arm64/asm/mmu.h diff --git a/lib/arm64/asm/page.h b/guest/lib/arm64/asm/page.h similarity index 100% rename from lib/arm64/asm/page.h rename to guest/lib/arm64/asm/page.h diff --git a/lib/arm64/asm/pci.h b/guest/lib/arm64/asm/pci.h similarity index 100% rename from lib/arm64/asm/pci.h rename to guest/lib/arm64/asm/pci.h diff --git a/lib/arm64/asm/pgtable-hwdef.h b/guest/lib/arm64/asm/pgtable-hwdef.h similarity index 100% rename from lib/arm64/asm/pgtable-hwdef.h rename to guest/lib/arm64/asm/pgtable-hwdef.h diff --git a/lib/arm64/asm/pgtable.h b/guest/lib/arm64/asm/pgtable.h similarity index 100% rename from lib/arm64/asm/pgtable.h rename to guest/lib/arm64/asm/pgtable.h diff --git a/lib/arm64/asm/processor.h b/guest/lib/arm64/asm/processor.h similarity index 100% rename from lib/arm64/asm/processor.h rename to guest/lib/arm64/asm/processor.h diff --git a/lib/arm64/asm/psci.h b/guest/lib/arm64/asm/psci.h similarity index 100% rename from lib/arm64/asm/psci.h rename to guest/lib/arm64/asm/psci.h diff --git a/lib/arm64/asm/ptrace.h b/guest/lib/arm64/asm/ptrace.h similarity index 100% rename from lib/arm64/asm/ptrace.h rename to guest/lib/arm64/asm/ptrace.h diff --git a/lib/arm64/asm/setup.h b/guest/lib/arm64/asm/setup.h similarity index 100% rename from lib/arm64/asm/setup.h rename to guest/lib/arm64/asm/setup.h diff --git a/lib/arm64/asm/smp.h b/guest/lib/arm64/asm/smp.h similarity index 100% rename from lib/arm64/asm/smp.h rename to guest/lib/arm64/asm/smp.h diff --git a/lib/arm64/asm/spinlock.h b/guest/lib/arm64/asm/spinlock.h similarity index 100% rename from lib/arm64/asm/spinlock.h rename to guest/lib/arm64/asm/spinlock.h diff --git a/lib/arm64/asm/stack.h b/guest/lib/arm64/asm/stack.h similarity index 100% rename from lib/arm64/asm/stack.h rename to guest/lib/arm64/asm/stack.h diff --git a/lib/arm64/asm/sysreg.h b/guest/lib/arm64/asm/sysreg.h similarity index 100% rename from lib/arm64/asm/sysreg.h rename to guest/lib/arm64/asm/sysreg.h diff --git a/lib/arm64/asm/thread_info.h b/guest/lib/arm64/asm/thread_info.h similarity index 100% rename from lib/arm64/asm/thread_info.h rename to guest/lib/arm64/asm/thread_info.h diff --git a/lib/arm64/processor.c b/guest/lib/arm64/processor.c similarity index 100% rename from lib/arm64/processor.c rename to guest/lib/arm64/processor.c diff --git a/lib/arm64/spinlock.c b/guest/lib/arm64/spinlock.c similarity index 100% rename from lib/arm64/spinlock.c rename to guest/lib/arm64/spinlock.c diff --git a/guest/lib/asm b/guest/lib/asm new file mode 120000 index 0000000..1603718 --- /dev/null +++ b/guest/lib/asm @@ -0,0 +1 @@ +x86/asm \ No newline at end of file diff --git a/lib/asm-generic/atomic.h b/guest/lib/asm-generic/atomic.h similarity index 100% rename from lib/asm-generic/atomic.h rename to guest/lib/asm-generic/atomic.h diff --git a/lib/asm-generic/barrier.h b/guest/lib/asm-generic/barrier.h similarity index 100% rename from lib/asm-generic/barrier.h rename to guest/lib/asm-generic/barrier.h diff --git a/lib/asm-generic/io.h b/guest/lib/asm-generic/io.h similarity index 100% rename from lib/asm-generic/io.h rename to guest/lib/asm-generic/io.h diff --git a/lib/asm-generic/page.h b/guest/lib/asm-generic/page.h similarity index 100% rename from lib/asm-generic/page.h rename to guest/lib/asm-generic/page.h diff --git a/lib/asm-generic/pci-host-bridge.h b/guest/lib/asm-generic/pci-host-bridge.h similarity index 100% rename from lib/asm-generic/pci-host-bridge.h rename to guest/lib/asm-generic/pci-host-bridge.h diff --git a/lib/asm-generic/pci.h b/guest/lib/asm-generic/pci.h similarity index 100% rename from lib/asm-generic/pci.h rename to guest/lib/asm-generic/pci.h diff --git a/lib/asm-generic/spinlock.h b/guest/lib/asm-generic/spinlock.h similarity index 100% rename from lib/asm-generic/spinlock.h rename to guest/lib/asm-generic/spinlock.h diff --git a/lib/auxinfo.c b/guest/lib/auxinfo.c similarity index 100% rename from lib/auxinfo.c rename to guest/lib/auxinfo.c diff --git a/lib/auxinfo.h b/guest/lib/auxinfo.h similarity index 100% rename from lib/auxinfo.h rename to guest/lib/auxinfo.h diff --git a/lib/bitops.h b/guest/lib/bitops.h similarity index 100% rename from lib/bitops.h rename to guest/lib/bitops.h diff --git a/lib/chr-testdev.c b/guest/lib/chr-testdev.c similarity index 100% rename from lib/chr-testdev.c rename to guest/lib/chr-testdev.c diff --git a/lib/chr-testdev.h b/guest/lib/chr-testdev.h similarity index 100% rename from lib/chr-testdev.h rename to guest/lib/chr-testdev.h diff --git a/lib/devicetree.c b/guest/lib/devicetree.c similarity index 100% rename from lib/devicetree.c rename to guest/lib/devicetree.c diff --git a/lib/devicetree.h b/guest/lib/devicetree.h similarity index 100% rename from lib/devicetree.h rename to guest/lib/devicetree.h diff --git a/lib/errata.h b/guest/lib/errata.h similarity index 100% rename from lib/errata.h rename to guest/lib/errata.h diff --git a/lib/getchar.c b/guest/lib/getchar.c similarity index 100% rename from lib/getchar.c rename to guest/lib/getchar.c diff --git a/lib/kbuild.h b/guest/lib/kbuild.h similarity index 100% rename from lib/kbuild.h rename to guest/lib/kbuild.h diff --git a/lib/libcflat.h b/guest/lib/libcflat.h similarity index 100% rename from lib/libcflat.h rename to guest/lib/libcflat.h diff --git a/lib/libfdt/Makefile.libfdt b/guest/lib/libfdt/Makefile.libfdt similarity index 100% rename from lib/libfdt/Makefile.libfdt rename to guest/lib/libfdt/Makefile.libfdt diff --git a/lib/libfdt/README b/guest/lib/libfdt/README similarity index 100% rename from lib/libfdt/README rename to guest/lib/libfdt/README diff --git a/lib/libfdt/fdt.c b/guest/lib/libfdt/fdt.c similarity index 100% rename from lib/libfdt/fdt.c rename to guest/lib/libfdt/fdt.c diff --git a/lib/libfdt/fdt.h b/guest/lib/libfdt/fdt.h similarity index 100% rename from lib/libfdt/fdt.h rename to guest/lib/libfdt/fdt.h diff --git a/lib/libfdt/fdt_empty_tree.c b/guest/lib/libfdt/fdt_empty_tree.c similarity index 100% rename from lib/libfdt/fdt_empty_tree.c rename to guest/lib/libfdt/fdt_empty_tree.c diff --git a/lib/libfdt/fdt_ro.c b/guest/lib/libfdt/fdt_ro.c similarity index 100% rename from lib/libfdt/fdt_ro.c rename to guest/lib/libfdt/fdt_ro.c diff --git a/lib/libfdt/fdt_rw.c b/guest/lib/libfdt/fdt_rw.c similarity index 100% rename from lib/libfdt/fdt_rw.c rename to guest/lib/libfdt/fdt_rw.c diff --git a/lib/libfdt/fdt_strerror.c b/guest/lib/libfdt/fdt_strerror.c similarity index 100% rename from lib/libfdt/fdt_strerror.c rename to guest/lib/libfdt/fdt_strerror.c diff --git a/lib/libfdt/fdt_sw.c b/guest/lib/libfdt/fdt_sw.c similarity index 100% rename from lib/libfdt/fdt_sw.c rename to guest/lib/libfdt/fdt_sw.c diff --git a/lib/libfdt/fdt_wip.c b/guest/lib/libfdt/fdt_wip.c similarity index 100% rename from lib/libfdt/fdt_wip.c rename to guest/lib/libfdt/fdt_wip.c diff --git a/lib/libfdt/libfdt.h b/guest/lib/libfdt/libfdt.h similarity index 100% rename from lib/libfdt/libfdt.h rename to guest/lib/libfdt/libfdt.h diff --git a/lib/libfdt/libfdt_env.h b/guest/lib/libfdt/libfdt_env.h similarity index 100% rename from lib/libfdt/libfdt_env.h rename to guest/lib/libfdt/libfdt_env.h diff --git a/lib/libfdt/libfdt_internal.h b/guest/lib/libfdt/libfdt_internal.h similarity index 100% rename from lib/libfdt/libfdt_internal.h rename to guest/lib/libfdt/libfdt_internal.h diff --git a/lib/libfdt/version.lds b/guest/lib/libfdt/version.lds similarity index 100% rename from lib/libfdt/version.lds rename to guest/lib/libfdt/version.lds diff --git a/lib/linux/const.h b/guest/lib/linux/const.h similarity index 100% rename from lib/linux/const.h rename to guest/lib/linux/const.h diff --git a/lib/linux/pci_regs.h b/guest/lib/linux/pci_regs.h similarity index 100% rename from lib/linux/pci_regs.h rename to guest/lib/linux/pci_regs.h diff --git a/lib/linux/psci.h b/guest/lib/linux/psci.h similarity index 100% rename from lib/linux/psci.h rename to guest/lib/linux/psci.h diff --git a/lib/pci-edu.c b/guest/lib/pci-edu.c similarity index 100% rename from lib/pci-edu.c rename to guest/lib/pci-edu.c diff --git a/lib/pci-edu.h b/guest/lib/pci-edu.h similarity index 100% rename from lib/pci-edu.h rename to guest/lib/pci-edu.h diff --git a/lib/pci-host-generic.c b/guest/lib/pci-host-generic.c similarity index 100% rename from lib/pci-host-generic.c rename to guest/lib/pci-host-generic.c diff --git a/lib/pci-host-generic.h b/guest/lib/pci-host-generic.h similarity index 100% rename from lib/pci-host-generic.h rename to guest/lib/pci-host-generic.h diff --git a/lib/pci-testdev.c b/guest/lib/pci-testdev.c similarity index 100% rename from lib/pci-testdev.c rename to guest/lib/pci-testdev.c diff --git a/lib/pci.c b/guest/lib/pci.c similarity index 100% rename from lib/pci.c rename to guest/lib/pci.c diff --git a/lib/pci.h b/guest/lib/pci.h similarity index 100% rename from lib/pci.h rename to guest/lib/pci.h diff --git a/lib/powerpc/.gitignore b/guest/lib/powerpc/.gitignore similarity index 100% rename from lib/powerpc/.gitignore rename to guest/lib/powerpc/.gitignore diff --git a/lib/powerpc/asm/handlers.h b/guest/lib/powerpc/asm/handlers.h similarity index 100% rename from lib/powerpc/asm/handlers.h rename to guest/lib/powerpc/asm/handlers.h diff --git a/lib/powerpc/asm/hcall.h b/guest/lib/powerpc/asm/hcall.h similarity index 100% rename from lib/powerpc/asm/hcall.h rename to guest/lib/powerpc/asm/hcall.h diff --git a/lib/powerpc/asm/ppc_asm.h b/guest/lib/powerpc/asm/ppc_asm.h similarity index 100% rename from lib/powerpc/asm/ppc_asm.h rename to guest/lib/powerpc/asm/ppc_asm.h diff --git a/lib/powerpc/asm/processor.h b/guest/lib/powerpc/asm/processor.h similarity index 100% rename from lib/powerpc/asm/processor.h rename to guest/lib/powerpc/asm/processor.h diff --git a/lib/powerpc/asm/rtas.h b/guest/lib/powerpc/asm/rtas.h similarity index 100% rename from lib/powerpc/asm/rtas.h rename to guest/lib/powerpc/asm/rtas.h diff --git a/lib/powerpc/asm/setup.h b/guest/lib/powerpc/asm/setup.h similarity index 100% rename from lib/powerpc/asm/setup.h rename to guest/lib/powerpc/asm/setup.h diff --git a/lib/powerpc/asm/smp.h b/guest/lib/powerpc/asm/smp.h similarity index 100% rename from lib/powerpc/asm/smp.h rename to guest/lib/powerpc/asm/smp.h diff --git a/lib/powerpc/asm/stack.h b/guest/lib/powerpc/asm/stack.h similarity index 100% rename from lib/powerpc/asm/stack.h rename to guest/lib/powerpc/asm/stack.h diff --git a/lib/powerpc/handlers.c b/guest/lib/powerpc/handlers.c similarity index 100% rename from lib/powerpc/handlers.c rename to guest/lib/powerpc/handlers.c diff --git a/lib/powerpc/hcall.c b/guest/lib/powerpc/hcall.c similarity index 100% rename from lib/powerpc/hcall.c rename to guest/lib/powerpc/hcall.c diff --git a/lib/powerpc/io.c b/guest/lib/powerpc/io.c similarity index 100% rename from lib/powerpc/io.c rename to guest/lib/powerpc/io.c diff --git a/lib/powerpc/io.h b/guest/lib/powerpc/io.h similarity index 100% rename from lib/powerpc/io.h rename to guest/lib/powerpc/io.h diff --git a/lib/powerpc/processor.c b/guest/lib/powerpc/processor.c similarity index 100% rename from lib/powerpc/processor.c rename to guest/lib/powerpc/processor.c diff --git a/lib/powerpc/rtas.c b/guest/lib/powerpc/rtas.c similarity index 100% rename from lib/powerpc/rtas.c rename to guest/lib/powerpc/rtas.c diff --git a/lib/powerpc/setup.c b/guest/lib/powerpc/setup.c similarity index 100% rename from lib/powerpc/setup.c rename to guest/lib/powerpc/setup.c diff --git a/lib/powerpc/smp.c b/guest/lib/powerpc/smp.c similarity index 100% rename from lib/powerpc/smp.c rename to guest/lib/powerpc/smp.c diff --git a/lib/ppc64/.gitignore b/guest/lib/ppc64/.gitignore similarity index 100% rename from lib/ppc64/.gitignore rename to guest/lib/ppc64/.gitignore diff --git a/lib/ppc64/asm-offsets.c b/guest/lib/ppc64/asm-offsets.c similarity index 100% rename from lib/ppc64/asm-offsets.c rename to guest/lib/ppc64/asm-offsets.c diff --git a/lib/ppc64/asm/barrier.h b/guest/lib/ppc64/asm/barrier.h similarity index 100% rename from lib/ppc64/asm/barrier.h rename to guest/lib/ppc64/asm/barrier.h diff --git a/lib/ppc64/asm/bitops.h b/guest/lib/ppc64/asm/bitops.h similarity index 100% rename from lib/ppc64/asm/bitops.h rename to guest/lib/ppc64/asm/bitops.h diff --git a/lib/ppc64/asm/handlers.h b/guest/lib/ppc64/asm/handlers.h similarity index 100% rename from lib/ppc64/asm/handlers.h rename to guest/lib/ppc64/asm/handlers.h diff --git a/lib/ppc64/asm/hcall.h b/guest/lib/ppc64/asm/hcall.h similarity index 100% rename from lib/ppc64/asm/hcall.h rename to guest/lib/ppc64/asm/hcall.h diff --git a/lib/ppc64/asm/io.h b/guest/lib/ppc64/asm/io.h similarity index 100% rename from lib/ppc64/asm/io.h rename to guest/lib/ppc64/asm/io.h diff --git a/lib/ppc64/asm/page.h b/guest/lib/ppc64/asm/page.h similarity index 100% rename from lib/ppc64/asm/page.h rename to guest/lib/ppc64/asm/page.h diff --git a/lib/ppc64/asm/ppc_asm.h b/guest/lib/ppc64/asm/ppc_asm.h similarity index 100% rename from lib/ppc64/asm/ppc_asm.h rename to guest/lib/ppc64/asm/ppc_asm.h diff --git a/lib/ppc64/asm/processor.h b/guest/lib/ppc64/asm/processor.h similarity index 100% rename from lib/ppc64/asm/processor.h rename to guest/lib/ppc64/asm/processor.h diff --git a/lib/ppc64/asm/ptrace.h b/guest/lib/ppc64/asm/ptrace.h similarity index 100% rename from lib/ppc64/asm/ptrace.h rename to guest/lib/ppc64/asm/ptrace.h diff --git a/lib/ppc64/asm/rtas.h b/guest/lib/ppc64/asm/rtas.h similarity index 100% rename from lib/ppc64/asm/rtas.h rename to guest/lib/ppc64/asm/rtas.h diff --git a/lib/ppc64/asm/setup.h b/guest/lib/ppc64/asm/setup.h similarity index 100% rename from lib/ppc64/asm/setup.h rename to guest/lib/ppc64/asm/setup.h diff --git a/lib/ppc64/asm/smp.h b/guest/lib/ppc64/asm/smp.h similarity index 100% rename from lib/ppc64/asm/smp.h rename to guest/lib/ppc64/asm/smp.h diff --git a/lib/ppc64/asm/spinlock.h b/guest/lib/ppc64/asm/spinlock.h similarity index 100% rename from lib/ppc64/asm/spinlock.h rename to guest/lib/ppc64/asm/spinlock.h diff --git a/lib/ppc64/asm/stack.h b/guest/lib/ppc64/asm/stack.h similarity index 100% rename from lib/ppc64/asm/stack.h rename to guest/lib/ppc64/asm/stack.h diff --git a/lib/printf.c b/guest/lib/printf.c similarity index 100% rename from lib/printf.c rename to guest/lib/printf.c diff --git a/lib/report.c b/guest/lib/report.c similarity index 100% rename from lib/report.c rename to guest/lib/report.c diff --git a/lib/s390x/.gitignore b/guest/lib/s390x/.gitignore similarity index 100% rename from lib/s390x/.gitignore rename to guest/lib/s390x/.gitignore diff --git a/lib/s390x/asm-offsets.c b/guest/lib/s390x/asm-offsets.c similarity index 100% rename from lib/s390x/asm-offsets.c rename to guest/lib/s390x/asm-offsets.c diff --git a/lib/s390x/asm/arch_def.h b/guest/lib/s390x/asm/arch_def.h similarity index 100% rename from lib/s390x/asm/arch_def.h rename to guest/lib/s390x/asm/arch_def.h diff --git a/lib/s390x/asm/barrier.h b/guest/lib/s390x/asm/barrier.h similarity index 100% rename from lib/s390x/asm/barrier.h rename to guest/lib/s390x/asm/barrier.h diff --git a/lib/s390x/asm/bitops.h b/guest/lib/s390x/asm/bitops.h similarity index 100% rename from lib/s390x/asm/bitops.h rename to guest/lib/s390x/asm/bitops.h diff --git a/lib/s390x/asm/cpacf.h b/guest/lib/s390x/asm/cpacf.h similarity index 100% rename from lib/s390x/asm/cpacf.h rename to guest/lib/s390x/asm/cpacf.h diff --git a/lib/s390x/asm/facility.h b/guest/lib/s390x/asm/facility.h similarity index 100% rename from lib/s390x/asm/facility.h rename to guest/lib/s390x/asm/facility.h diff --git a/lib/s390x/asm/float.h b/guest/lib/s390x/asm/float.h similarity index 100% rename from lib/s390x/asm/float.h rename to guest/lib/s390x/asm/float.h diff --git a/lib/s390x/asm/interrupt.h b/guest/lib/s390x/asm/interrupt.h similarity index 100% rename from lib/s390x/asm/interrupt.h rename to guest/lib/s390x/asm/interrupt.h diff --git a/lib/s390x/asm/io.h b/guest/lib/s390x/asm/io.h similarity index 100% rename from lib/s390x/asm/io.h rename to guest/lib/s390x/asm/io.h diff --git a/lib/s390x/asm/mem.h b/guest/lib/s390x/asm/mem.h similarity index 100% rename from lib/s390x/asm/mem.h rename to guest/lib/s390x/asm/mem.h diff --git a/lib/s390x/asm/page.h b/guest/lib/s390x/asm/page.h similarity index 100% rename from lib/s390x/asm/page.h rename to guest/lib/s390x/asm/page.h diff --git a/lib/s390x/asm/pgtable.h b/guest/lib/s390x/asm/pgtable.h similarity index 100% rename from lib/s390x/asm/pgtable.h rename to guest/lib/s390x/asm/pgtable.h diff --git a/lib/s390x/asm/spinlock.h b/guest/lib/s390x/asm/spinlock.h similarity index 100% rename from lib/s390x/asm/spinlock.h rename to guest/lib/s390x/asm/spinlock.h diff --git a/lib/s390x/asm/stack.h b/guest/lib/s390x/asm/stack.h similarity index 100% rename from lib/s390x/asm/stack.h rename to guest/lib/s390x/asm/stack.h diff --git a/lib/s390x/interrupt.c b/guest/lib/s390x/interrupt.c similarity index 100% rename from lib/s390x/interrupt.c rename to guest/lib/s390x/interrupt.c diff --git a/lib/s390x/io.c b/guest/lib/s390x/io.c similarity index 100% rename from lib/s390x/io.c rename to guest/lib/s390x/io.c diff --git a/lib/s390x/mmu.c b/guest/lib/s390x/mmu.c similarity index 100% rename from lib/s390x/mmu.c rename to guest/lib/s390x/mmu.c diff --git a/lib/s390x/mmu.h b/guest/lib/s390x/mmu.h similarity index 100% rename from lib/s390x/mmu.h rename to guest/lib/s390x/mmu.h diff --git a/lib/s390x/sclp-ascii.c b/guest/lib/s390x/sclp-ascii.c similarity index 100% rename from lib/s390x/sclp-ascii.c rename to guest/lib/s390x/sclp-ascii.c diff --git a/lib/s390x/sclp.c b/guest/lib/s390x/sclp.c similarity index 100% rename from lib/s390x/sclp.c rename to guest/lib/s390x/sclp.c diff --git a/lib/s390x/sclp.h b/guest/lib/s390x/sclp.h similarity index 100% rename from lib/s390x/sclp.h rename to guest/lib/s390x/sclp.h diff --git a/lib/s390x/stack.c b/guest/lib/s390x/stack.c similarity index 100% rename from lib/s390x/stack.c rename to guest/lib/s390x/stack.c diff --git a/lib/setjmp.h b/guest/lib/setjmp.h similarity index 100% rename from lib/setjmp.h rename to guest/lib/setjmp.h diff --git a/lib/stack.c b/guest/lib/stack.c similarity index 100% rename from lib/stack.c rename to guest/lib/stack.c diff --git a/lib/stack.h b/guest/lib/stack.h similarity index 100% rename from lib/stack.h rename to guest/lib/stack.h diff --git a/lib/string.c b/guest/lib/string.c similarity index 100% rename from lib/string.c rename to guest/lib/string.c diff --git a/lib/string.h b/guest/lib/string.h similarity index 100% rename from lib/string.h rename to guest/lib/string.h diff --git a/lib/util.c b/guest/lib/util.c similarity index 100% rename from lib/util.c rename to guest/lib/util.c diff --git a/lib/util.h b/guest/lib/util.h similarity index 100% rename from lib/util.h rename to guest/lib/util.h diff --git a/lib/virtio-mmio.c b/guest/lib/virtio-mmio.c similarity index 100% rename from lib/virtio-mmio.c rename to guest/lib/virtio-mmio.c diff --git a/lib/virtio-mmio.h b/guest/lib/virtio-mmio.h similarity index 100% rename from lib/virtio-mmio.h rename to guest/lib/virtio-mmio.h diff --git a/lib/virtio.c b/guest/lib/virtio.c similarity index 100% rename from lib/virtio.c rename to guest/lib/virtio.c diff --git a/lib/virtio.h b/guest/lib/virtio.h similarity index 100% rename from lib/virtio.h rename to guest/lib/virtio.h diff --git a/lib/vmalloc.c b/guest/lib/vmalloc.c similarity index 100% rename from lib/vmalloc.c rename to guest/lib/vmalloc.c diff --git a/lib/vmalloc.h b/guest/lib/vmalloc.h similarity index 100% rename from lib/vmalloc.h rename to guest/lib/vmalloc.h diff --git a/lib/x86/acpi.c b/guest/lib/x86/acpi.c similarity index 100% rename from lib/x86/acpi.c rename to guest/lib/x86/acpi.c diff --git a/lib/x86/acpi.h b/guest/lib/x86/acpi.h similarity index 100% rename from lib/x86/acpi.h rename to guest/lib/x86/acpi.h diff --git a/lib/x86/apic-defs.h b/guest/lib/x86/apic-defs.h similarity index 100% rename from lib/x86/apic-defs.h rename to guest/lib/x86/apic-defs.h diff --git a/lib/x86/apic.c b/guest/lib/x86/apic.c similarity index 100% rename from lib/x86/apic.c rename to guest/lib/x86/apic.c diff --git a/lib/x86/apic.h b/guest/lib/x86/apic.h similarity index 100% rename from lib/x86/apic.h rename to guest/lib/x86/apic.h diff --git a/lib/x86/asm/barrier.h b/guest/lib/x86/asm/barrier.h similarity index 100% rename from lib/x86/asm/barrier.h rename to guest/lib/x86/asm/barrier.h diff --git a/lib/x86/asm/bitops.h b/guest/lib/x86/asm/bitops.h similarity index 100% rename from lib/x86/asm/bitops.h rename to guest/lib/x86/asm/bitops.h diff --git a/lib/x86/asm/io.h b/guest/lib/x86/asm/io.h similarity index 100% rename from lib/x86/asm/io.h rename to guest/lib/x86/asm/io.h diff --git a/lib/x86/asm/page.h b/guest/lib/x86/asm/page.h similarity index 100% rename from lib/x86/asm/page.h rename to guest/lib/x86/asm/page.h diff --git a/lib/x86/asm/pci.h b/guest/lib/x86/asm/pci.h similarity index 100% rename from lib/x86/asm/pci.h rename to guest/lib/x86/asm/pci.h diff --git a/lib/x86/asm/spinlock.h b/guest/lib/x86/asm/spinlock.h similarity index 100% rename from lib/x86/asm/spinlock.h rename to guest/lib/x86/asm/spinlock.h diff --git a/lib/x86/asm/stack.h b/guest/lib/x86/asm/stack.h similarity index 100% rename from lib/x86/asm/stack.h rename to guest/lib/x86/asm/stack.h diff --git a/lib/x86/atomic.c b/guest/lib/x86/atomic.c similarity index 100% rename from lib/x86/atomic.c rename to guest/lib/x86/atomic.c diff --git a/lib/x86/atomic.h b/guest/lib/x86/atomic.h similarity index 100% rename from lib/x86/atomic.h rename to guest/lib/x86/atomic.h diff --git a/lib/x86/delay.c b/guest/lib/x86/delay.c similarity index 100% rename from lib/x86/delay.c rename to guest/lib/x86/delay.c diff --git a/lib/x86/delay.h b/guest/lib/x86/delay.h similarity index 100% rename from lib/x86/delay.h rename to guest/lib/x86/delay.h diff --git a/lib/x86/desc.c b/guest/lib/x86/desc.c similarity index 100% rename from lib/x86/desc.c rename to guest/lib/x86/desc.c diff --git a/lib/x86/desc.h b/guest/lib/x86/desc.h similarity index 100% rename from lib/x86/desc.h rename to guest/lib/x86/desc.h diff --git a/lib/x86/fake-apic.h b/guest/lib/x86/fake-apic.h similarity index 100% rename from lib/x86/fake-apic.h rename to guest/lib/x86/fake-apic.h diff --git a/lib/x86/fault_test.c b/guest/lib/x86/fault_test.c similarity index 100% rename from lib/x86/fault_test.c rename to guest/lib/x86/fault_test.c diff --git a/lib/x86/fault_test.h b/guest/lib/x86/fault_test.h similarity index 100% rename from lib/x86/fault_test.h rename to guest/lib/x86/fault_test.h diff --git a/lib/x86/fwcfg.c b/guest/lib/x86/fwcfg.c similarity index 95% rename from lib/x86/fwcfg.c rename to guest/lib/x86/fwcfg.c index c52b445..b175266 100644 --- a/lib/x86/fwcfg.c +++ b/guest/lib/x86/fwcfg.c @@ -41,5 +41,5 @@ uint64_t fwcfg_get_u64(unsigned index) unsigned fwcfg_get_nb_cpus(void) { - return fwcfg_get_u16(FW_CFG_NB_CPUS); + return 2; } diff --git a/lib/x86/fwcfg.h b/guest/lib/x86/fwcfg.h similarity index 100% rename from lib/x86/fwcfg.h rename to guest/lib/x86/fwcfg.h diff --git a/lib/x86/intel-iommu.c b/guest/lib/x86/intel-iommu.c similarity index 100% rename from lib/x86/intel-iommu.c rename to guest/lib/x86/intel-iommu.c diff --git a/lib/x86/intel-iommu.h b/guest/lib/x86/intel-iommu.h similarity index 100% rename from lib/x86/intel-iommu.h rename to guest/lib/x86/intel-iommu.h diff --git a/lib/x86/io.c b/guest/lib/x86/io.c similarity index 100% rename from lib/x86/io.c rename to guest/lib/x86/io.c diff --git a/lib/x86/isr.c b/guest/lib/x86/isr.c similarity index 100% rename from lib/x86/isr.c rename to guest/lib/x86/isr.c diff --git a/lib/x86/isr.h b/guest/lib/x86/isr.h similarity index 100% rename from lib/x86/isr.h rename to guest/lib/x86/isr.h diff --git a/lib/x86/msr.h b/guest/lib/x86/msr.h similarity index 100% rename from lib/x86/msr.h rename to guest/lib/x86/msr.h diff --git a/lib/x86/processor.h b/guest/lib/x86/processor.h similarity index 100% rename from lib/x86/processor.h rename to guest/lib/x86/processor.h diff --git a/lib/x86/setjmp32.S b/guest/lib/x86/setjmp32.S similarity index 100% rename from lib/x86/setjmp32.S rename to guest/lib/x86/setjmp32.S diff --git a/lib/x86/setjmp64.S b/guest/lib/x86/setjmp64.S similarity index 100% rename from lib/x86/setjmp64.S rename to guest/lib/x86/setjmp64.S diff --git a/lib/x86/setup.c b/guest/lib/x86/setup.c similarity index 93% rename from lib/x86/setup.c rename to guest/lib/x86/setup.c index ff7c8d3..d445005 100644 --- a/lib/x86/setup.c +++ b/guest/lib/x86/setup.c @@ -9,6 +9,7 @@ #include "fwcfg.h" #include "alloc_phys.h" +extern char bss_start; extern char edata; struct mbi_bootinfo { @@ -42,6 +43,11 @@ u32 initrd_size; static char env[ENV_SIZE]; +void bss_init(void) +{ + memset(&bss_start, 0, &edata - &bss_start); +} + void setup_multiboot(struct mbi_bootinfo *bootinfo) { struct mbi_module *mods; diff --git a/lib/x86/smp.c b/guest/lib/x86/smp.c similarity index 100% rename from lib/x86/smp.c rename to guest/lib/x86/smp.c diff --git a/lib/x86/smp.h b/guest/lib/x86/smp.h similarity index 100% rename from lib/x86/smp.h rename to guest/lib/x86/smp.h diff --git a/lib/x86/stack.c b/guest/lib/x86/stack.c similarity index 100% rename from lib/x86/stack.c rename to guest/lib/x86/stack.c diff --git a/lib/x86/usermode.c b/guest/lib/x86/usermode.c similarity index 100% rename from lib/x86/usermode.c rename to guest/lib/x86/usermode.c diff --git a/lib/x86/usermode.h b/guest/lib/x86/usermode.h similarity index 100% rename from lib/x86/usermode.h rename to guest/lib/x86/usermode.h diff --git a/lib/x86/vm.c b/guest/lib/x86/vm.c similarity index 100% rename from lib/x86/vm.c rename to guest/lib/x86/vm.c diff --git a/lib/x86/vm.h b/guest/lib/x86/vm.h similarity index 100% rename from lib/x86/vm.h rename to guest/lib/x86/vm.h diff --git a/powerpc/.gitignore b/guest/powerpc/.gitignore similarity index 100% rename from powerpc/.gitignore rename to guest/powerpc/.gitignore diff --git a/powerpc/Makefile b/guest/powerpc/Makefile similarity index 100% rename from powerpc/Makefile rename to guest/powerpc/Makefile diff --git a/powerpc/Makefile.common b/guest/powerpc/Makefile.common similarity index 100% rename from powerpc/Makefile.common rename to guest/powerpc/Makefile.common diff --git a/powerpc/Makefile.ppc64 b/guest/powerpc/Makefile.ppc64 similarity index 100% rename from powerpc/Makefile.ppc64 rename to guest/powerpc/Makefile.ppc64 diff --git a/powerpc/boot_rom.S b/guest/powerpc/boot_rom.S similarity index 100% rename from powerpc/boot_rom.S rename to guest/powerpc/boot_rom.S diff --git a/powerpc/cstart64.S b/guest/powerpc/cstart64.S similarity index 100% rename from powerpc/cstart64.S rename to guest/powerpc/cstart64.S diff --git a/powerpc/emulator.c b/guest/powerpc/emulator.c similarity index 100% rename from powerpc/emulator.c rename to guest/powerpc/emulator.c diff --git a/powerpc/flat.lds b/guest/powerpc/flat.lds similarity index 100% rename from powerpc/flat.lds rename to guest/powerpc/flat.lds diff --git a/powerpc/reloc64.c b/guest/powerpc/reloc64.c similarity index 100% rename from powerpc/reloc64.c rename to guest/powerpc/reloc64.c diff --git a/powerpc/rtas.c b/guest/powerpc/rtas.c similarity index 100% rename from powerpc/rtas.c rename to guest/powerpc/rtas.c diff --git a/powerpc/run b/guest/powerpc/run similarity index 100% rename from powerpc/run rename to guest/powerpc/run diff --git a/powerpc/selftest.c b/guest/powerpc/selftest.c similarity index 100% rename from powerpc/selftest.c rename to guest/powerpc/selftest.c diff --git a/powerpc/spapr.h b/guest/powerpc/spapr.h similarity index 100% rename from powerpc/spapr.h rename to guest/powerpc/spapr.h diff --git a/powerpc/spapr_hcall.c b/guest/powerpc/spapr_hcall.c similarity index 100% rename from powerpc/spapr_hcall.c rename to guest/powerpc/spapr_hcall.c diff --git a/powerpc/sprs.c b/guest/powerpc/sprs.c similarity index 100% rename from powerpc/sprs.c rename to guest/powerpc/sprs.c diff --git a/powerpc/tm.c b/guest/powerpc/tm.c similarity index 100% rename from powerpc/tm.c rename to guest/powerpc/tm.c diff --git a/powerpc/unittests.cfg b/guest/powerpc/unittests.cfg similarity index 100% rename from powerpc/unittests.cfg rename to guest/powerpc/unittests.cfg diff --git a/run_tests.sh b/guest/run_tests.sh similarity index 100% rename from run_tests.sh rename to guest/run_tests.sh diff --git a/s390x/Makefile b/guest/s390x/Makefile similarity index 100% rename from s390x/Makefile rename to guest/s390x/Makefile diff --git a/s390x/cmm.c b/guest/s390x/cmm.c similarity index 100% rename from s390x/cmm.c rename to guest/s390x/cmm.c diff --git a/s390x/cstart64.S b/guest/s390x/cstart64.S similarity index 100% rename from s390x/cstart64.S rename to guest/s390x/cstart64.S diff --git a/s390x/diag10.c b/guest/s390x/diag10.c similarity index 100% rename from s390x/diag10.c rename to guest/s390x/diag10.c diff --git a/s390x/emulator.c b/guest/s390x/emulator.c similarity index 100% rename from s390x/emulator.c rename to guest/s390x/emulator.c diff --git a/s390x/flat.lds b/guest/s390x/flat.lds similarity index 100% rename from s390x/flat.lds rename to guest/s390x/flat.lds diff --git a/s390x/gs.c b/guest/s390x/gs.c similarity index 100% rename from s390x/gs.c rename to guest/s390x/gs.c diff --git a/s390x/iep.c b/guest/s390x/iep.c similarity index 100% rename from s390x/iep.c rename to guest/s390x/iep.c diff --git a/s390x/intercept.c b/guest/s390x/intercept.c similarity index 100% rename from s390x/intercept.c rename to guest/s390x/intercept.c diff --git a/s390x/pfmf.c b/guest/s390x/pfmf.c similarity index 100% rename from s390x/pfmf.c rename to guest/s390x/pfmf.c diff --git a/s390x/run b/guest/s390x/run similarity index 100% rename from s390x/run rename to guest/s390x/run diff --git a/s390x/selftest.c b/guest/s390x/selftest.c similarity index 100% rename from s390x/selftest.c rename to guest/s390x/selftest.c diff --git a/s390x/sieve.c b/guest/s390x/sieve.c similarity index 100% rename from s390x/sieve.c rename to guest/s390x/sieve.c diff --git a/s390x/skey.c b/guest/s390x/skey.c similarity index 100% rename from s390x/skey.c rename to guest/s390x/skey.c diff --git a/s390x/sthyi.c b/guest/s390x/sthyi.c similarity index 100% rename from s390x/sthyi.c rename to guest/s390x/sthyi.c diff --git a/s390x/sthyi.h b/guest/s390x/sthyi.h similarity index 100% rename from s390x/sthyi.h rename to guest/s390x/sthyi.h diff --git a/s390x/unittests.cfg b/guest/s390x/unittests.cfg similarity index 100% rename from s390x/unittests.cfg rename to guest/s390x/unittests.cfg diff --git a/s390x/vector.c b/guest/s390x/vector.c similarity index 100% rename from s390x/vector.c rename to guest/s390x/vector.c diff --git a/scripts/arch-run.bash b/guest/scripts/arch-run.bash similarity index 100% rename from scripts/arch-run.bash rename to guest/scripts/arch-run.bash diff --git a/scripts/asm-offsets.mak b/guest/scripts/asm-offsets.mak similarity index 100% rename from scripts/asm-offsets.mak rename to guest/scripts/asm-offsets.mak diff --git a/scripts/common.bash b/guest/scripts/common.bash similarity index 100% rename from scripts/common.bash rename to guest/scripts/common.bash diff --git a/scripts/git.difforder b/guest/scripts/git.difforder similarity index 100% rename from scripts/git.difforder rename to guest/scripts/git.difforder diff --git a/guest/scripts/mkcasetable.sh b/guest/scripts/mkcasetable.sh new file mode 100755 index 0000000..b940c43 --- /dev/null +++ b/guest/scripts/mkcasetable.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +output=$1 +shift 1 + +cat < $output +#include "stitched.h" + +EOF + +IFS=$'\n' tests=($(sort <<< "$*")) +unset IFS + +for test in ${tests[*]}; do + echo "extern int main_$test(int ac, char **av);" >> $output +done + +cat <> $output + +struct unit_test unit_tests[] = { +EOF + +for test in ${tests[*]}; do + echo "{ .name = \"$test\", .fn = main_$test }," >> $output +done + +cat <> $output +{ .name = NULL, .fn = NULL }, +}; +EOF diff --git a/scripts/mkstandalone.sh b/guest/scripts/mkstandalone.sh similarity index 100% rename from scripts/mkstandalone.sh rename to guest/scripts/mkstandalone.sh diff --git a/scripts/pretty_print_stacks.py b/guest/scripts/pretty_print_stacks.py similarity index 100% rename from scripts/pretty_print_stacks.py rename to guest/scripts/pretty_print_stacks.py diff --git a/scripts/runtime.bash b/guest/scripts/runtime.bash similarity index 100% rename from scripts/runtime.bash rename to guest/scripts/runtime.bash diff --git a/guest/x86/.gitignore b/guest/x86/.gitignore new file mode 100644 index 0000000..93a8bea --- /dev/null +++ b/guest/x86/.gitignore @@ -0,0 +1 @@ +case_table.c \ No newline at end of file diff --git a/x86/Makefile b/guest/x86/Makefile similarity index 100% rename from x86/Makefile rename to guest/x86/Makefile diff --git a/x86/Makefile.common b/guest/x86/Makefile.common similarity index 62% rename from x86/Makefile.common rename to guest/x86/Makefile.common index e612dbe..c1da835 100644 --- a/x86/Makefile.common +++ b/guest/x86/Makefile.common @@ -35,11 +35,11 @@ KEEP_FRAME_POINTER := y libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) -# We want to keep intermediate file: %.elf and %.o -.PRECIOUS: %.elf %.o +# We want to keep intermediate file: %.elf and %.o +.PRECIOUS: %.elf %.o $(TEST_DIR)/%_prelink.o FLATLIBS = lib/libcflat.a $(libgcc) -%.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) +%.elf: %_prelink.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \ $(filter %.o, $^) $(FLATLIBS) @chmod a-x $@ @@ -48,6 +48,13 @@ FLATLIBS = lib/libcflat.a $(libgcc) $(OBJCOPY) -O elf32-i386 $^ $@ @chmod a-x $@ +%.raw: %.elf + $(OBJCOPY) -O binary $^ $@.tmp + dd if=/dev/zero of=$@ bs=1 count=$(shell echo $$((0x`readelf -S $< | grep "\.text" | grep -E -o "[0-9a-f]{16}"` - 0x400000))) + dd if=$@.tmp of=$@ conv=notrunc oflag=append + @rm $@.tmp + @chmod a-x $@ + tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \ $(TEST_DIR)/smptest.flat $(TEST_DIR)/port80.flat \ $(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \ @@ -68,6 +75,27 @@ endif test_cases: $(tests-common) $(tests) $(tests-api) +unstitched-test-cases = $(TEST_DIR)/realmode.flat +stitched-test-cases = $(filter-out $(unstitched-test-cases),$(tests-common) $(tests)) +case_table.o = $(TEST_DIR)/case_table.o +stitched.o = $(TEST_DIR)/stitched.o + +$(case_table.o:.o=.c): + scripts/mkcasetable.sh $@ $(patsubst $(TEST_DIR)/%.flat,%,$(stitched-test-cases)) + +$(TEST_DIR)/stitched.elf: $(stitched-test-cases:.flat=_prelink.o) $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) $(case_table.o) $(stitched.o) + $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \ + $(filter %.o, $^) $(FLATLIBS) + @chmod a-x $@ + +$(TEST_DIR)/%_prelink.o: $(TEST_DIR)/%.o + $(LD) -r -o $@ $^ + @$(OBJCOPY) \ + --keep-global-symbol=main \ + --add-symbol main_$*=.text:0x`nm $@ | grep "T main" | egrep -o "[0-9a-f]{16}"`,function,global \ + --weaken-symbol=main \ + $@ + $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o @@ -75,18 +103,21 @@ $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o $(TEST_DIR)/realmode.o: bits = 32 -$(TEST_DIR)/kvmclock_test.elf: $(TEST_DIR)/kvmclock.o +$(TEST_DIR)/kvmclock_test_prelink.o: $(TEST_DIR)/kvmclock.o + +$(TEST_DIR)/hyperv_synic_prelink.o: $(TEST_DIR)/hyperv.o -$(TEST_DIR)/hyperv_synic.elf: $(TEST_DIR)/hyperv.o +$(TEST_DIR)/hyperv_stimer_prelink.o: $(TEST_DIR)/hyperv.o -$(TEST_DIR)/hyperv_stimer.elf: $(TEST_DIR)/hyperv.o +$(TEST_DIR)/hyperv_connections_prelink.o: $(TEST_DIR)/hyperv.o -$(TEST_DIR)/hyperv_connections.elf: $(TEST_DIR)/hyperv.o +$(TEST_DIR)/vmx_prelink.o: $(TEST_DIR)/vmx_tests.o arch_clean: $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \ $(TEST_DIR)/.*.d lib/x86/.*.d \ - $(tests-api) api/*.o api/*.a api/.*.d + $(tests-api) api/*.o api/*.a api/.*.d \ + $(case_table.o:.o=.c) api/%.o: CXXFLAGS += -m32 -std=gnu++11 diff --git a/x86/Makefile.i386 b/guest/x86/Makefile.i386 similarity index 100% rename from x86/Makefile.i386 rename to guest/x86/Makefile.i386 diff --git a/x86/Makefile.x86_64 b/guest/x86/Makefile.x86_64 similarity index 84% rename from x86/Makefile.x86_64 rename to guest/x86/Makefile.x86_64 index 51f9b80..2540096 100644 --- a/x86/Makefile.x86_64 +++ b/guest/x86/Makefile.x86_64 @@ -17,11 +17,8 @@ tests += $(TEST_DIR)/syscall.flat tests += $(TEST_DIR)/svm.flat tests += $(TEST_DIR)/vmx.flat tests += $(TEST_DIR)/tscdeadline_latency.flat -tests += $(TEST_DIR)/intel-iommu.flat +tests += $(TEST_DIR)/intel_iommu.flat tests += $(TEST_DIR)/vmware_backdoors.flat +tests += $(TEST_DIR)/hyperv_clock.flat include $(SRCDIR)/$(TEST_DIR)/Makefile.common - -$(TEST_DIR)/hyperv_clock.elf: $(TEST_DIR)/hyperv_clock.o - -$(TEST_DIR)/vmx.elf: $(TEST_DIR)/vmx_tests.o diff --git a/x86/README b/guest/x86/README similarity index 100% rename from x86/README rename to guest/x86/README diff --git a/x86/access.c b/guest/x86/access.c similarity index 100% rename from x86/access.c rename to guest/x86/access.c diff --git a/x86/apic.c b/guest/x86/apic.c similarity index 98% rename from x86/apic.c rename to guest/x86/apic.c index c976e8d..ac93f2c 100644 --- a/x86/apic.c +++ b/guest/x86/apic.c @@ -15,7 +15,7 @@ static void test_lapic_existence(void) lvr = apic_read(APIC_LVR); printf("apic version: %x\n", lvr); - report("apic existence", (u16)lvr == 0x14); + report("apic existence", (u16)lvr == 16); } #define TSC_DEADLINE_TIMER_VECTOR 0xef @@ -109,8 +109,12 @@ static void verify_disabled_apic_mmio(void) volatile u32 *lvr = (volatile u32 *)(APIC_DEFAULT_PHYS_BASE + APIC_LVR); volatile u32 *tpr = (volatile u32 *)(APIC_DEFAULT_PHYS_BASE + APIC_TASKPRI); u32 cr8 = read_cr8(); + void *apic_base = (void *)APIC_DEFAULT_PHYS_BASE; + u32 offset; + + for (offset = 0; offset < PAGE_SIZE; offset+=16) + *(volatile u64 *)(apic_base + offset) = 0xffffffffffffffff; - memset((void *)APIC_DEFAULT_PHYS_BASE, 0xff, PAGE_SIZE); report("*0xfee00030: %x", *lvr == ~0, *lvr); report("CR8: %lx", read_cr8() == cr8, read_cr8()); write_cr8(cr8 ^ MAX_TPR); diff --git a/x86/asyncpf.c b/guest/x86/asyncpf.c similarity index 100% rename from x86/asyncpf.c rename to guest/x86/asyncpf.c diff --git a/x86/cmpxchg8b.c b/guest/x86/cmpxchg8b.c similarity index 100% rename from x86/cmpxchg8b.c rename to guest/x86/cmpxchg8b.c diff --git a/x86/cstart.S b/guest/x86/cstart.S old mode 100644 new mode 100755 similarity index 94% rename from x86/cstart.S rename to guest/x86/cstart.S index 143317e..a36f1a4 --- a/x86/cstart.S +++ b/guest/x86/cstart.S @@ -77,7 +77,7 @@ idt_descr: .code32 mb_magic = 0x1BADB002 -mb_flags = 0x0 +mb_flags = 0x2 # multiboot header .long mb_magic, mb_flags, 0 - (mb_magic + mb_flags) @@ -94,13 +94,13 @@ MSR_GS_BASE = 0xc0000101 .globl start start: + mov $stacktop, %esp push %ebx call setup_multiboot call setup_libcflat mov mb_cmdline(%ebx), %eax mov %eax, __args call __setup_args - mov $stacktop, %esp setup_percpu_area call prepare_32 jmpl $8, $start32 @@ -145,6 +145,12 @@ ap_start32: jmp 1b start32: + mov $0x10, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + mov %ax, %ss call load_tss call mask_pic_interrupts call enable_apic @@ -166,6 +172,10 @@ load_tss: shr $24, %eax mov %eax, %ebx shl $3, %ebx + movl $0, tss_descr+8(%ebx) + movl $0, tss_descr+12(%ebx) + movl $0x00008900, tss_descr+4(%ebx) + movl $0x0000ffff, tss_descr(%ebx) mov $((tss_end - tss) / max_cpus), %edx imul %edx add $tss, %eax diff --git a/x86/cstart64.S b/guest/x86/cstart64.S old mode 100644 new mode 100755 similarity index 94% rename from x86/cstart64.S rename to guest/x86/cstart64.S index 21db10f..4d498bc --- a/x86/cstart64.S +++ b/guest/x86/cstart64.S @@ -12,7 +12,7 @@ ipi_vector = 0x20 max_cpus = 64 -.bss +.section stack . = . + 4096 * max_cpus .align 16 @@ -102,7 +102,7 @@ pt_root: .quad ptl4 .code32 mb_magic = 0x1BADB002 -mb_flags = 0x0 +mb_flags = 0x2 # multiboot header .long mb_magic, mb_flags, 0 - (mb_magic + mb_flags) @@ -148,6 +148,12 @@ switch_to_5level: prepare_64: lgdt gdt64_desc + mov $0x10, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + mov %ax, %ss enter_long_mode: mov %cr4, %eax @@ -220,6 +226,7 @@ ap_start64: jmp 1b start64: + call bss_init call load_tss call mask_pic_interrupts call enable_apic @@ -263,6 +270,10 @@ load_tss: shr $24, %eax mov %eax, %ebx shl $4, %ebx + movl $0, tss_descr+8(%rbx) + movl $0, tss_descr+12(%rbx) + movl $0x00008900, tss_descr+4(%rbx) + movl $0x0000ffff, tss_descr(%rbx) mov $((tss_end - tss) / max_cpus), %edx imul %edx add $tss, %rax diff --git a/x86/debug.c b/guest/x86/debug.c similarity index 100% rename from x86/debug.c rename to guest/x86/debug.c diff --git a/x86/emulator.c b/guest/x86/emulator.c similarity index 100% rename from x86/emulator.c rename to guest/x86/emulator.c diff --git a/x86/eventinj.c b/guest/x86/eventinj.c similarity index 100% rename from x86/eventinj.c rename to guest/x86/eventinj.c diff --git a/x86/flat.lds b/guest/x86/flat.lds similarity index 74% rename from x86/flat.lds rename to guest/x86/flat.lds index a278b56..90d4fb0 100644 --- a/x86/flat.lds +++ b/guest/x86/flat.lds @@ -13,9 +13,16 @@ SECTIONS . = ALIGN(16); .rodata : { *(.rodata) } . = ALIGN(16); + .stack : { *(stack) } + . = ALIGN(16); + bss_start = .; .bss : { *(.bss) } . = ALIGN(4K); edata = .; + + /DISCARD/ : { + *(.comment .comment.* .note .note.*) + } } ENTRY(start) diff --git a/x86/hypercall.c b/guest/x86/hypercall.c similarity index 100% rename from x86/hypercall.c rename to guest/x86/hypercall.c diff --git a/x86/hyperv.c b/guest/x86/hyperv.c similarity index 100% rename from x86/hyperv.c rename to guest/x86/hyperv.c diff --git a/x86/hyperv.h b/guest/x86/hyperv.h similarity index 100% rename from x86/hyperv.h rename to guest/x86/hyperv.h diff --git a/x86/hyperv_clock.c b/guest/x86/hyperv_clock.c similarity index 100% rename from x86/hyperv_clock.c rename to guest/x86/hyperv_clock.c diff --git a/x86/hyperv_connections.c b/guest/x86/hyperv_connections.c similarity index 100% rename from x86/hyperv_connections.c rename to guest/x86/hyperv_connections.c diff --git a/x86/hyperv_stimer.c b/guest/x86/hyperv_stimer.c similarity index 100% rename from x86/hyperv_stimer.c rename to guest/x86/hyperv_stimer.c diff --git a/x86/hyperv_synic.c b/guest/x86/hyperv_synic.c similarity index 100% rename from x86/hyperv_synic.c rename to guest/x86/hyperv_synic.c diff --git a/x86/idt_test.c b/guest/x86/idt_test.c similarity index 100% rename from x86/idt_test.c rename to guest/x86/idt_test.c diff --git a/x86/init.c b/guest/x86/init.c similarity index 100% rename from x86/init.c rename to guest/x86/init.c diff --git a/x86/intel-iommu.c b/guest/x86/intel_iommu.c similarity index 100% rename from x86/intel-iommu.c rename to guest/x86/intel_iommu.c diff --git a/x86/ioapic.c b/guest/x86/ioapic.c similarity index 100% rename from x86/ioapic.c rename to guest/x86/ioapic.c diff --git a/x86/ioram.h b/guest/x86/ioram.h similarity index 100% rename from x86/ioram.h rename to guest/x86/ioram.h diff --git a/x86/kvmclock.c b/guest/x86/kvmclock.c similarity index 100% rename from x86/kvmclock.c rename to guest/x86/kvmclock.c diff --git a/x86/kvmclock.h b/guest/x86/kvmclock.h similarity index 100% rename from x86/kvmclock.h rename to guest/x86/kvmclock.h diff --git a/x86/kvmclock_test.c b/guest/x86/kvmclock_test.c similarity index 100% rename from x86/kvmclock_test.c rename to guest/x86/kvmclock_test.c diff --git a/x86/memory.c b/guest/x86/memory.c similarity index 100% rename from x86/memory.c rename to guest/x86/memory.c diff --git a/x86/msr.c b/guest/x86/msr.c similarity index 100% rename from x86/msr.c rename to guest/x86/msr.c diff --git a/x86/pcid.c b/guest/x86/pcid.c similarity index 100% rename from x86/pcid.c rename to guest/x86/pcid.c diff --git a/x86/pku.c b/guest/x86/pku.c similarity index 100% rename from x86/pku.c rename to guest/x86/pku.c diff --git a/x86/pmu.c b/guest/x86/pmu.c similarity index 100% rename from x86/pmu.c rename to guest/x86/pmu.c diff --git a/x86/port80.c b/guest/x86/port80.c similarity index 100% rename from x86/port80.c rename to guest/x86/port80.c diff --git a/x86/realmode.c b/guest/x86/realmode.c similarity index 100% rename from x86/realmode.c rename to guest/x86/realmode.c diff --git a/x86/realmode.lds b/guest/x86/realmode.lds similarity index 100% rename from x86/realmode.lds rename to guest/x86/realmode.lds diff --git a/x86/rmap_chain.c b/guest/x86/rmap_chain.c similarity index 100% rename from x86/rmap_chain.c rename to guest/x86/rmap_chain.c diff --git a/x86/run b/guest/x86/run similarity index 89% rename from x86/run rename to guest/x86/run index 1ac91f1..598eaa3 100755 --- a/x86/run +++ b/guest/x86/run @@ -15,6 +15,8 @@ ACCEL=$(get_qemu_accelerator) || qemu=$(search_qemu_binary) || exit $? +cpu_info = Nehalem,+sse,+avx,+xsave,+sse2,+sse3,+mpx,+fpu,level=13 + if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; then echo "No Qemu test device support found" @@ -38,6 +40,7 @@ else fi command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" +command+=" -smp cpus=4 -m 1024M $cpu_info" command+=" -machine accel=$ACCEL -kernel" command="$(timeout_cmd) $command" diff --git a/x86/s3.c b/guest/x86/s3.c similarity index 100% rename from x86/s3.c rename to guest/x86/s3.c diff --git a/x86/setjmp.c b/guest/x86/setjmp.c similarity index 100% rename from x86/setjmp.c rename to guest/x86/setjmp.c diff --git a/x86/sieve.c b/guest/x86/sieve.c similarity index 100% rename from x86/sieve.c rename to guest/x86/sieve.c diff --git a/x86/smap.c b/guest/x86/smap.c similarity index 100% rename from x86/smap.c rename to guest/x86/smap.c diff --git a/x86/smptest.c b/guest/x86/smptest.c similarity index 100% rename from x86/smptest.c rename to guest/x86/smptest.c diff --git a/guest/x86/stitched.c b/guest/x86/stitched.c new file mode 100644 index 0000000..54e7111 --- /dev/null +++ b/guest/x86/stitched.c @@ -0,0 +1,33 @@ +#include "stitched.h" + +int main(int ac, char **av) +{ + struct unit_test *ut; + + if (ac > 0) { + ut = unit_tests; + while (ut->fn != NULL) { + if (strcmp(av[0], ut->name) == 0) { + printf("Run test %s\n", av[0]); + return ut->fn(ac, av); + } else { + ut++; + } + } + + printf("No test found for %s\n", av[0]); + } + + /* Print the list of available tests */ + printf("Available tests:\n"); + + ut = unit_tests; + while (ut->fn != NULL) { + printf("\t%s\n", ut->name); + ut++; + } + + printf("End of available tests\n"); + + return 0; +} diff --git a/guest/x86/stitched.h b/guest/x86/stitched.h new file mode 100644 index 0000000..fe4aa05 --- /dev/null +++ b/guest/x86/stitched.h @@ -0,0 +1,13 @@ +#ifndef __MAIN_H +#define __MAIN_H + +#include "libcflat.h" + +struct unit_test { + const char *name; + int (*fn)(int ac, char **av); +}; + +extern struct unit_test unit_tests[]; + +#endif diff --git a/x86/svm.c b/guest/x86/svm.c similarity index 100% rename from x86/svm.c rename to guest/x86/svm.c diff --git a/x86/svm.h b/guest/x86/svm.h similarity index 100% rename from x86/svm.h rename to guest/x86/svm.h diff --git a/x86/syscall.c b/guest/x86/syscall.c similarity index 100% rename from x86/syscall.c rename to guest/x86/syscall.c diff --git a/x86/taskswitch.c b/guest/x86/taskswitch.c similarity index 100% rename from x86/taskswitch.c rename to guest/x86/taskswitch.c diff --git a/x86/taskswitch2.c b/guest/x86/taskswitch2.c similarity index 100% rename from x86/taskswitch2.c rename to guest/x86/taskswitch2.c diff --git a/x86/tsc.c b/guest/x86/tsc.c similarity index 100% rename from x86/tsc.c rename to guest/x86/tsc.c diff --git a/x86/tsc_adjust.c b/guest/x86/tsc_adjust.c similarity index 100% rename from x86/tsc_adjust.c rename to guest/x86/tsc_adjust.c diff --git a/x86/tscdeadline_latency.c b/guest/x86/tscdeadline_latency.c similarity index 100% rename from x86/tscdeadline_latency.c rename to guest/x86/tscdeadline_latency.c diff --git a/x86/types.h b/guest/x86/types.h similarity index 100% rename from x86/types.h rename to guest/x86/types.h diff --git a/x86/umip.c b/guest/x86/umip.c similarity index 100% rename from x86/umip.c rename to guest/x86/umip.c diff --git a/x86/unittests.cfg b/guest/x86/unittests.cfg similarity index 100% rename from x86/unittests.cfg rename to guest/x86/unittests.cfg diff --git a/x86/vmexit.c b/guest/x86/vmexit.c similarity index 100% rename from x86/vmexit.c rename to guest/x86/vmexit.c diff --git a/x86/vmware_backdoors.c b/guest/x86/vmware_backdoors.c similarity index 100% rename from x86/vmware_backdoors.c rename to guest/x86/vmware_backdoors.c diff --git a/x86/vmx.c b/guest/x86/vmx.c similarity index 100% rename from x86/vmx.c rename to guest/x86/vmx.c diff --git a/x86/vmx.h b/guest/x86/vmx.h similarity index 100% rename from x86/vmx.h rename to guest/x86/vmx.h diff --git a/x86/vmx_tests.c b/guest/x86/vmx_tests.c similarity index 100% rename from x86/vmx_tests.c rename to guest/x86/vmx_tests.c diff --git a/x86/xsave.c b/guest/x86/xsave.c similarity index 100% rename from x86/xsave.c rename to guest/x86/xsave.c diff --git a/lib/arm/asm/asm-offsets.h b/lib/arm/asm/asm-offsets.h deleted file mode 100644 index d370ee3..0000000 --- a/lib/arm/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/lib/arm64/asm/asm-offsets.h b/lib/arm64/asm/asm-offsets.h deleted file mode 100644 index d370ee3..0000000 --- a/lib/arm64/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/lib/generated/.gitignore b/lib/generated/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/lib/generated/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/lib/ppc64/asm/asm-offsets.h b/lib/ppc64/asm/asm-offsets.h deleted file mode 100644 index d370ee3..0000000 --- a/lib/ppc64/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/lib/s390x/asm/asm-offsets.h b/lib/s390x/asm/asm-offsets.h deleted file mode 100644 index a6d7af8..0000000 --- a/lib/s390x/asm/asm-offsets.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2017 Red Hat Inc - * - * Authors: - * David Hildenbrand - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License version 2. - */ -#include