From: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 6 of 6] Reorganize PowerPC makefiles and add an "exit" test that uses libcflat
Date: Tue, 15 Jan 2008 16:43:44 -0600 [thread overview]
Message-ID: <75481de4f07eab17035f.1200437024@basalt> (raw)
In-Reply-To: <patchbomb.1200437018@basalt>
# HG changeset patch
# User Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1200437012 21600
# Node ID 75481de4f07eab17035fb24f14417be2ee62ac10
# Parent d4c0de7599e4a4ae107044aa4f4c95dc50f9ce6a
Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
3 files changed, 92 insertions(+), 18 deletions(-)
user/config-powerpc.mak | 49 +++++++++++++++++++++++++++-----------------
user/test/powerpc/cstart.S | 38 ++++++++++++++++++++++++++++++++++
user/test/powerpc/exit.c | 23 ++++++++++++++++++++
diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak
--- a/user/config-powerpc.mak
+++ b/user/config-powerpc.mak
@@ -1,3 +1,4 @@ libcflat := test/lib/libcflat.a
+cstart := test/powerpc/cstart.o
libcflat := test/lib/libcflat.a
cflatobjs += \
@@ -5,27 +6,37 @@ cflatobjs += \
test/lib/powerpc/44x/map.o \
test/lib/powerpc/44x/tlbwe.o
+# these tests do not use libcflat
+simpletests := \
+ test/powerpc/spin.bin \
+ test/powerpc/io.bin \
+ test/powerpc/sprg.bin \
+ test/powerpc/44x/tlbsx.bin \
+ test/powerpc/44x/tlbwe_16KB.bin \
+ test/powerpc/44x/tlbwe_hole.bin \
+ test/powerpc/44x/tlbwe.bin
+
+# these tests use cstart.o, libcflat, and libgcc
+tests := \
+ test/powerpc/exit.bin
+
+all: kvmctl $(tests) $(simpletests)
+
CFLAGS += -m32
CFLAGS += -D__powerpc__
CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -Wa,-mregnames
+
+$(simpletests): %.bin: %.o
+ $(CC) $(LDFLAGS) -nostdlib $^ -o $*.elf
+ $(OBJCOPY) -O binary $*.elf $@
+
+$(tests): %.bin: $(cstart) %.o $(libcflat)
+ $(CC) $(LDFLAGS) -nostdlib -Wl,-Ttext,0 $^ $(libgcc) -o $*.elf
+ $(OBJCOPY) -O binary $*.elf $@
+
# for some reaons binutils hates tlbsx unless we say we're 405 :(
-CFLAGS += -Wa,-mregnames,-m405
-
-%.bin: %.o
- $(OBJCOPY) -O binary $^ $@
-
-testobjs := \
- io.bin \
- spin.bin \
- sprg.bin \
- 44x/tlbsx.bin \
- 44x/tlbwe_16KB.bin \
- 44x/tlbwe_hole.bin \
- 44x/tlbwe.bin
-
-tests := $(addprefix test/powerpc/, $(testobjs))
-
-all: kvmctl $(tests)
+test/powerpc/44x/tlbsx.bin: CFLAGS += -Wa,-m405
$(libcflat): LDFLAGS += -nostdlib
$(libcflat): CFLAGS += -ffreestanding -I test/lib -I test/lib/powerpc/44x
@@ -35,4 +46,6 @@ kvmctl_objs = main-ppc.o iotable.o ../li
kvmctl_objs = main-ppc.o iotable.o ../libkvm/libkvm.a
arch_clean:
- rm -f $(tests) $(cflatobjs)
+ $(RM) $(simpletests) $(tests) $(cflatobjs) $(libcflat) $(cstart)
+ $(RM) $(patsubst %.bin, %.elf, $(simpletests) $(tests))
+ $(RM) $(patsubst %.bin, %.o, $(simpletests) $(tests))
diff --git a/user/test/powerpc/cstart.S b/user/test/powerpc/cstart.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/cstart.S
@@ -0,0 +1,38 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2008
+ *
+ * Authors: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ */
+
+#define OUTPUT_VADDR 0xf0000000
+#define OUTPUT_PADDR 0xf0000000
+
+.globl _start
+_start:
+ /* In the future we might need to assign a stack and zero BSS here. */
+
+ /* Map the debug page 1:1. */
+ lis r3, OUTPUT_VADDR@h
+ ori r3, r3, OUTPUT_VADDR@l
+ lis r4, OUTPUT_PADDR@h
+ ori r4, r4, OUTPUT_PADDR@l
+ bl map
+
+ /* Call main() and pass return code to exit(). */
+ bl main
+ bl exit
+
+ b .
diff --git a/user/test/powerpc/exit.c b/user/test/powerpc/exit.c
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/exit.c
@@ -0,0 +1,23 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2008
+ *
+ * Authors: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ */
+
+int main(void)
+{
+ return 1;
+}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
prev parent reply other threads:[~2008-01-15 22:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-15 22:43 [PATCH 0 of 6] Enhance PowerPC unit tests Hollis Blanchard
2008-01-15 22:43 ` [PATCH 1 of 6] Move IO handling code to a separate file Hollis Blanchard
2008-01-16 8:16 ` Avi Kivity
2008-01-15 22:43 ` [PATCH 2 of 6] Register a debug MMIO handler, and implement putc() and exit() with it Hollis Blanchard
2008-01-15 22:43 ` [PATCH 3 of 6] Move FLATLIBS to config-x86-common.mak Hollis Blanchard
2008-01-15 22:43 ` [PATCH 4 of 6] Use "$(CC)" instead of "gcc" to find libgcc Hollis Blanchard
2008-01-15 22:43 ` [PATCH 5 of 6] Create libcflat for PowerPC Hollis Blanchard
2008-01-15 22:43 ` Hollis Blanchard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75481de4f07eab17035f.1200437024@basalt \
--to=hollisb-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox