[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [POWERPC][XEN] Remove boot wrapper, and extensive Makefile simplifications.



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 6f6a37ee8b9754bbe09b2d87705dfcc5039c3825
# Parent  8515e163f1dfde374dbeee1ad843f218f124ea1f
[POWERPC][XEN] Remove boot wrapper, and extensive Makefile simplifications.
Instead of embedding the 64-bit Xen image inside a 32-bit "boot wrapper", we
can just use objcopy. This combines boot32.S and start.S, and removes the boot/
subdirectory entirely.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/arch/powerpc/boot/boot32.S |   75 -----------------------------------------
 xen/arch/powerpc/boot/start.S  |   51 ---------------------------
 .hgignore                      |    2 -
 xen/arch/powerpc/Makefile      |   42 ++++------------------
 xen/arch/powerpc/start.S       |   62 +++++++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+), 161 deletions(-)

diff -r 8515e163f1df -r 6f6a37ee8b97 .hgignore
--- a/.hgignore Tue Oct 03 18:23:21 2006 -0500
+++ b/.hgignore Wed Oct 04 17:17:41 2006 -0500
@@ -218,7 +218,7 @@
 ^xen/arch/powerpc/dom0\.bin$
 ^xen/arch/powerpc/asm-offsets\.s$
 ^xen/arch/powerpc/firmware$
-^xen/arch/powerpc/firmware_image$
+^xen/arch/powerpc/firmware_image.bin$
 ^xen/arch/powerpc/xen\.lds$
 ^xen/arch/powerpc/.xen-syms$
 ^xen/arch/powerpc/xen-syms.S$
diff -r 8515e163f1df -r 6f6a37ee8b97 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Tue Oct 03 18:23:21 2006 -0500
+++ b/xen/arch/powerpc/Makefile Wed Oct 04 17:17:41 2006 -0500
@@ -54,11 +54,6 @@ PPC_C_WARNINGS += -Wshadow
 PPC_C_WARNINGS += -Wshadow
 CFLAGS += $(PPC_C_WARNINGS)
 
-LINK=0x400000
-boot32_link_base = $(LINK)
-xen_link_offset  = 100
-xen_link_base    = $(patsubst %000,%$(xen_link_offset),$(LINK))
-
 #
 # The following flags are fed to gcc in order to link several
 # objects into a single ELF segment and to not link in any additional
@@ -69,16 +64,8 @@ firmware: of_handler/built_in.o $(TARGET
 firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
        $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
 
-firmware_image: firmware
+firmware_image.bin: firmware
        $(CROSS_COMPILE)objcopy --output-target=binary $< $@
-
-firmware_image.o: firmware_image
-       $(CROSS_COMPILE)objcopy --input-target=binary \
-               --output-target=elf64-powerpc \
-               --binary-architecture=powerpc \
-               --redefine-sym _binary_$<_start=$(@:%.o=%)_start \
-               --redefine-sym _binary_$<_end=$(@:%.o=%)_end \
-               --redefine-sym _binary_$<_size=$(@:%.o=%)_size  $< $@
 
 #
 # Hacks for included C files
@@ -93,10 +80,7 @@ CMDLINE = ""
 CMDLINE = ""
 boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
 
-start.o: boot/start.S
-       $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
-
-TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
+TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,0x400000,-T,xen.lds
 TARGET_OPTS += start.o $(ALL_OBJS)
 
 .xen-syms: start.o $(ALL_OBJS) xen.lds
@@ -119,22 +103,12 @@ xen-syms.o: xen-syms.S
 $(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
        $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
 
-$(TARGET).bin: $(TARGET)-syms
-       $(CROSS_COMPILE)objcopy --output-target=binary $< $@
-
-$(TARGET).bin.o: $(TARGET).bin
-       $(CROSS_COMPILE)objcopy --input-target=binary \
+# our firmware only loads 32-bit ELF files
+$(TARGET): $(TARGET)-syms
+       $(CROSS_COMPILE)objcopy \
+               --input-target=elf64-powerpc \
                --output-target=elf32-powerpc \
-               --binary-architecture=powerpc  $< $@
-
-boot32.o: boot/boot32.S
-       $(CC) -m32 -Wa,-a32,-mppc64bridge \
-               -D__ASSEMBLY__ -D__BRIDGE64__ $(CFLAGS) -c $< -o $@
-
-$(TARGET): boot32.o $(TARGET).bin.o
-       $(CC) -m32 -N -Wl,-melf32ppclinux -static -nostdlib \
-               -Wl,-Ttext,$(boot32_link_base)  -Wl,-Tdata,$(xen_link_base) \
-               $(CFLAGS) $^ -o $@
+               $^ $@
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
        $(CC) $(CFLAGS) -S -o $@ $<
@@ -147,4 +121,4 @@ dom0.bin: $(DOM0_IMAGE)
 
 clean::
        $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
-       rm -f firmware firmware_image dom0.bin .xen-syms
+       rm -f firmware firmware_image.bin dom0.bin .xen-syms
diff -r 8515e163f1df -r 6f6a37ee8b97 xen/arch/powerpc/start.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/start.S  Wed Oct 04 17:17:41 2006 -0500
@@ -0,0 +1,62 @@
+/*
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ * 
+ * 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Copyright (C) 2005, 2006 IBM Corp.
+ *
+ * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
+ *          Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *
+ */
+
+#include <asm/config.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
+#include <asm/page.h>
+
+    .globl _start
+_start:
+    /* pass the original MSR along */
+    mfmsr r8
+
+    /* set initial MSR */
+    li r22, 0
+    ori r22, r22, (MSR_SF | MSR_HV) >> 48
+    sldi r22, r22, 48
+    mtmsrd r22
+
+_start64:
+    /* load up the stack */
+    SET_REG_TO_LABEL(r1, cpu0_stack)
+
+    /* call the init function */
+    LOADADDR(r21,__start_xen_ppc)
+    ld r2, 8(r21)
+    ld r21, 0(r21)
+    mtctr r21
+    bctrl
+    /* should never return */
+    trap
+
+    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
+     * in a Linux signal trampoline, and it begins groping for a struct
+     * rt_sigframe on the stack. Naturally, this fails miserably for our
+     * backtrace. To work around this behavior, we must make certain that our
+     * stack is always above our text, e.g. in the data section. */
+    .data /* DO NOT REMOVE; see GDB note above */
+    .align 4
+cpu0_stack_bottom:
+    .space STACK_SIZE
+cpu0_stack:
+    .space STACK_FRAME_OVERHEAD
diff -r 8515e163f1df -r 6f6a37ee8b97 xen/arch/powerpc/boot/boot32.S
--- a/xen/arch/powerpc/boot/boot32.S    Tue Oct 03 18:23:21 2006 -0500
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
- *
- * This program 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 of the License, or
- * (at your option) any later version.
- * 
- * 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */
-       
-### 32 bit strapping code so Of will like us
-       .section        ".text"
-       .align 3
-       .globl _start
-               
-_start:
-       ## Double word align the MSR value below
-       nop
-       bl _real_start
-       ## static value for MSR
-       .llong 0x9000000000001000
-
-       ## see also docs/reference/ppc/msr.txt
-##bit C  Hex               Name Desc
-##  0 63 80000000 00000000 SF   64-bit Mode
-##  3 60 10000000 00000000 HV   Hypervisor State iff PR = 0 in hypervisor 
state.
-## 51 12 00000000 00001000 ME   Machine Check Enable
-
-_real_start:           
-       # pass the original msr as argument to hype_init
-       mfmsr   8
-
-       ## Set PC
-       li      21, 0
-       oris    21, 21, _hype64@h
-       ori     21, 21, _hype64@l
-#ifdef __BRIDGE64__
-       ## In 64bit we use rfid to switch from 32bit to 64 bit
-       mtsrr0  21
-
-       ## Set MSR
-       mflr    21
-       ld      22, 0(21)
-       mtsrr1  22
-       bl __leap
-       /* should never return */
-       trap
-__leap:                
-       rfid
-#else
-       mtctr 21
-       bctrl
-       /* should never return */
-       trap
-#endif
-
-       
-_real_end:
-       .data
-       .align 3
-       ## Hypervisor starts here, at the first data address
-       ## linker magic positions _hype64 0x100 after _start
-       ## hype/ppc64/Makefile.isa 
-_hype64:               
-
-
diff -r 8515e163f1df -r 6f6a37ee8b97 xen/arch/powerpc/boot/start.S
--- a/xen/arch/powerpc/boot/start.S     Tue Oct 03 18:23:21 2006 -0500
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2005 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
- *
- * This program 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 of the License, or
- * (at your option) any later version.
- * 
- * 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */
-
-#include <asm/config.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-
-    .globl _start
-_start:
-    /* load up the stack */
-    SET_REG_TO_LABEL(r1, cpu0_stack)
-
-    /* call the init function */
-    LOADADDR(r21,__start_xen_ppc)
-
-#ifdef __PPC64__
-    ld r2, 8(r21)
-    ld r21, 0(r21)
-#endif
-    mtctr r21
-    bctrl
-    /* should never return */
-    trap
-
-    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
-     * in a Linux signal trampoline, and it begins groping for a struct
-     * rt_sigframe on the stack. Naturally, this fails miserably for our
-     * backtrace. To work around this behavior, we must make certain that our
-     * stack is always above our text, e.g. in the data section. */
-    .data /* DO NOT REMOVE; see GDB note above */
-    .align 4
-cpu0_stack_bottom:
-    .space STACK_SIZE
-cpu0_stack:
-    .space STACK_FRAME_OVERHEAD

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.