ia64/xen-unstable

changeset 12935:6f6a37ee8b97

[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@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Wed Oct 04 17:17:41 2006 -0500 (2006-10-04)
parents 8515e163f1df
children 94a2909a7f20
files .hgignore xen/arch/powerpc/Makefile xen/arch/powerpc/boot/boot32.S xen/arch/powerpc/boot/start.S xen/arch/powerpc/start.S
line diff
     1.1 --- a/.hgignore	Tue Oct 03 18:23:21 2006 -0500
     1.2 +++ b/.hgignore	Wed Oct 04 17:17:41 2006 -0500
     1.3 @@ -218,7 +218,7 @@
     1.4  ^xen/arch/powerpc/dom0\.bin$
     1.5  ^xen/arch/powerpc/asm-offsets\.s$
     1.6  ^xen/arch/powerpc/firmware$
     1.7 -^xen/arch/powerpc/firmware_image$
     1.8 +^xen/arch/powerpc/firmware_image.bin$
     1.9  ^xen/arch/powerpc/xen\.lds$
    1.10  ^xen/arch/powerpc/.xen-syms$
    1.11  ^xen/arch/powerpc/xen-syms.S$
     2.1 --- a/xen/arch/powerpc/Makefile	Tue Oct 03 18:23:21 2006 -0500
     2.2 +++ b/xen/arch/powerpc/Makefile	Wed Oct 04 17:17:41 2006 -0500
     2.3 @@ -54,11 +54,6 @@ PPC_C_WARNINGS += -Wundef -Wmissing-prot
     2.4  PPC_C_WARNINGS += -Wshadow
     2.5  CFLAGS += $(PPC_C_WARNINGS)
     2.6  
     2.7 -LINK=0x400000
     2.8 -boot32_link_base = $(LINK)
     2.9 -xen_link_offset  = 100
    2.10 -xen_link_base    = $(patsubst %000,%$(xen_link_offset),$(LINK))
    2.11 -
    2.12  #
    2.13  # The following flags are fed to gcc in order to link several
    2.14  # objects into a single ELF segment and to not link in any additional
    2.15 @@ -69,17 +64,9 @@ OMAGIC = -N -nodefaultlibs -nostartfiles
    2.16  firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
    2.17  	$(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
    2.18  
    2.19 -firmware_image: firmware
    2.20 +firmware_image.bin: firmware
    2.21  	$(CROSS_COMPILE)objcopy --output-target=binary $< $@
    2.22  
    2.23 -firmware_image.o: firmware_image
    2.24 -	$(CROSS_COMPILE)objcopy --input-target=binary \
    2.25 -		--output-target=elf64-powerpc \
    2.26 -		--binary-architecture=powerpc \
    2.27 -		--redefine-sym _binary_$<_start=$(@:%.o=%)_start \
    2.28 -		--redefine-sym _binary_$<_end=$(@:%.o=%)_end \
    2.29 -		--redefine-sym _binary_$<_size=$(@:%.o=%)_size  $< $@
    2.30 -
    2.31  #
    2.32  # Hacks for included C files
    2.33  #
    2.34 @@ -93,10 +80,7 @@ IMAGENAME = xen
    2.35  CMDLINE = ""
    2.36  boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
    2.37  
    2.38 -start.o: boot/start.S
    2.39 -	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
    2.40 -
    2.41 -TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
    2.42 +TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,0x400000,-T,xen.lds
    2.43  TARGET_OPTS += start.o $(ALL_OBJS)
    2.44  
    2.45  .xen-syms: start.o $(ALL_OBJS) xen.lds
    2.46 @@ -119,22 +103,12 @@ xen-syms.o: xen-syms.S
    2.47  $(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
    2.48  	$(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
    2.49  
    2.50 -$(TARGET).bin: $(TARGET)-syms
    2.51 -	$(CROSS_COMPILE)objcopy --output-target=binary $< $@
    2.52 -
    2.53 -$(TARGET).bin.o: $(TARGET).bin
    2.54 -	$(CROSS_COMPILE)objcopy --input-target=binary \
    2.55 +# our firmware only loads 32-bit ELF files
    2.56 +$(TARGET): $(TARGET)-syms
    2.57 +	$(CROSS_COMPILE)objcopy \
    2.58 +		--input-target=elf64-powerpc \
    2.59  		--output-target=elf32-powerpc \
    2.60 -		--binary-architecture=powerpc  $< $@
    2.61 -
    2.62 -boot32.o: boot/boot32.S
    2.63 -	$(CC) -m32 -Wa,-a32,-mppc64bridge \
    2.64 -		-D__ASSEMBLY__ -D__BRIDGE64__ $(CFLAGS) -c $< -o $@
    2.65 -
    2.66 -$(TARGET): boot32.o $(TARGET).bin.o
    2.67 -	$(CC) -m32 -N -Wl,-melf32ppclinux -static -nostdlib \
    2.68 -		-Wl,-Ttext,$(boot32_link_base)  -Wl,-Tdata,$(xen_link_base) \
    2.69 -		$(CFLAGS) $^ -o $@
    2.70 +		$^ $@
    2.71  
    2.72  asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
    2.73  	$(CC) $(CFLAGS) -S -o $@ $<
    2.74 @@ -147,4 +121,4 @@ dom0.bin: $(DOM0_IMAGE)
    2.75  
    2.76  clean::
    2.77  	$(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
    2.78 -	rm -f firmware firmware_image dom0.bin .xen-syms
    2.79 +	rm -f firmware firmware_image.bin dom0.bin .xen-syms
     3.1 --- a/xen/arch/powerpc/boot/boot32.S	Tue Oct 03 18:23:21 2006 -0500
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,75 +0,0 @@
     3.4 -/*
     3.5 - * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation
     3.6 - *
     3.7 - * This program is free software; you can redistribute it and/or modify
     3.8 - * it under the terms of the GNU General Public License as published by
     3.9 - * the Free Software Foundation; either version 2 of the License, or
    3.10 - * (at your option) any later version.
    3.11 - * 
    3.12 - * This program is distributed in the hope that it will be useful,
    3.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 - * GNU General Public License for more details.
    3.16 - * 
    3.17 - * You should have received a copy of the GNU General Public License
    3.18 - * along with this program; if not, write to the Free Software
    3.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    3.20 - *
    3.21 - */
    3.22 -	
    3.23 -### 32 bit strapping code so Of will like us
    3.24 -	.section	".text"
    3.25 -	.align 3
    3.26 -	.globl _start
    3.27 -		
    3.28 -_start:
    3.29 -	## Double word align the MSR value below
    3.30 -	nop
    3.31 -	bl _real_start
    3.32 -	## static value for MSR
    3.33 -	.llong 0x9000000000001000
    3.34 -
    3.35 -	## see also docs/reference/ppc/msr.txt
    3.36 -##bit C  Hex               Name Desc
    3.37 -##  0 63 80000000 00000000 SF   64-bit Mode
    3.38 -##  3 60 10000000 00000000 HV   Hypervisor State iff PR = 0 in hypervisor state.
    3.39 -## 51 12 00000000 00001000 ME   Machine Check Enable
    3.40 -
    3.41 -_real_start:		
    3.42 -	# pass the original msr as argument to hype_init
    3.43 -	mfmsr   8
    3.44 -
    3.45 -	## Set PC
    3.46 -	li	21, 0
    3.47 -	oris	21, 21, _hype64@h
    3.48 -	ori	21, 21, _hype64@l
    3.49 -#ifdef __BRIDGE64__
    3.50 -	## In 64bit we use rfid to switch from 32bit to 64 bit
    3.51 -	mtsrr0	21
    3.52 -
    3.53 -	## Set MSR
    3.54 -	mflr	21
    3.55 -	ld	22, 0(21)
    3.56 -	mtsrr1	22
    3.57 -	bl __leap
    3.58 -	/* should never return */
    3.59 -	trap
    3.60 -__leap:		
    3.61 -	rfid
    3.62 -#else
    3.63 -	mtctr 21
    3.64 -	bctrl
    3.65 -	/* should never return */
    3.66 -	trap
    3.67 -#endif
    3.68 -
    3.69 -	
    3.70 -_real_end:
    3.71 -	.data
    3.72 -	.align 3
    3.73 -	## Hypervisor starts here, at the first data address
    3.74 -	## linker magic positions _hype64 0x100 after _start
    3.75 -	## hype/ppc64/Makefile.isa 
    3.76 -_hype64:		
    3.77 -
    3.78 -
     4.1 --- a/xen/arch/powerpc/boot/start.S	Tue Oct 03 18:23:21 2006 -0500
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,51 +0,0 @@
     4.4 -/*
     4.5 - * Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation
     4.6 - *
     4.7 - * This program is free software; you can redistribute it and/or modify
     4.8 - * it under the terms of the GNU General Public License as published by
     4.9 - * the Free Software Foundation; either version 2 of the License, or
    4.10 - * (at your option) any later version.
    4.11 - * 
    4.12 - * This program is distributed in the hope that it will be useful,
    4.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.15 - * GNU General Public License for more details.
    4.16 - * 
    4.17 - * You should have received a copy of the GNU General Public License
    4.18 - * along with this program; if not, write to the Free Software
    4.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    4.20 - *
    4.21 - */
    4.22 -
    4.23 -#include <asm/config.h>
    4.24 -#include <asm/processor.h>
    4.25 -#include <asm/page.h>
    4.26 -
    4.27 -    .globl _start
    4.28 -_start:
    4.29 -    /* load up the stack */
    4.30 -    SET_REG_TO_LABEL(r1, cpu0_stack)
    4.31 -
    4.32 -    /* call the init function */
    4.33 -    LOADADDR(r21,__start_xen_ppc)
    4.34 -
    4.35 -#ifdef __PPC64__
    4.36 -    ld r2, 8(r21)
    4.37 -    ld r21, 0(r21)
    4.38 -#endif
    4.39 -    mtctr r21
    4.40 -    bctrl
    4.41 -    /* should never return */
    4.42 -    trap
    4.43 -
    4.44 -    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
    4.45 -     * in a Linux signal trampoline, and it begins groping for a struct
    4.46 -     * rt_sigframe on the stack. Naturally, this fails miserably for our
    4.47 -     * backtrace. To work around this behavior, we must make certain that our
    4.48 -     * stack is always above our text, e.g. in the data section. */
    4.49 -    .data /* DO NOT REMOVE; see GDB note above */
    4.50 -    .align 4
    4.51 -cpu0_stack_bottom:
    4.52 -    .space STACK_SIZE
    4.53 -cpu0_stack:
    4.54 -    .space STACK_FRAME_OVERHEAD
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/xen/arch/powerpc/start.S	Wed Oct 04 17:17:41 2006 -0500
     5.3 @@ -0,0 +1,62 @@
     5.4 +/*
     5.5 + * This program is free software; you can redistribute it and/or modify
     5.6 + * it under the terms of the GNU General Public License as published by
     5.7 + * the Free Software Foundation; either version 2 of the License, or
     5.8 + * (at your option) any later version.
     5.9 + * 
    5.10 + * This program is distributed in the hope that it will be useful,
    5.11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.13 + * GNU General Public License for more details.
    5.14 + * 
    5.15 + * You should have received a copy of the GNU General Public License
    5.16 + * along with this program; if not, write to the Free Software
    5.17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    5.18 + *
    5.19 + * Copyright (C) 2005, 2006 IBM Corp.
    5.20 + *
    5.21 + * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    5.22 + *          Hollis Blanchard <hollisb@us.ibm.com>
    5.23 + *
    5.24 + */
    5.25 +
    5.26 +#include <asm/config.h>
    5.27 +#include <asm/msr.h>
    5.28 +#include <asm/processor.h>
    5.29 +#include <asm/page.h>
    5.30 +
    5.31 +    .globl _start
    5.32 +_start:
    5.33 +    /* pass the original MSR along */
    5.34 +    mfmsr r8
    5.35 +
    5.36 +    /* set initial MSR */
    5.37 +    li r22, 0
    5.38 +    ori r22, r22, (MSR_SF | MSR_HV) >> 48
    5.39 +    sldi r22, r22, 48
    5.40 +    mtmsrd r22
    5.41 +
    5.42 +_start64:
    5.43 +    /* load up the stack */
    5.44 +    SET_REG_TO_LABEL(r1, cpu0_stack)
    5.45 +
    5.46 +    /* call the init function */
    5.47 +    LOADADDR(r21,__start_xen_ppc)
    5.48 +    ld r2, 8(r21)
    5.49 +    ld r21, 0(r21)
    5.50 +    mtctr r21
    5.51 +    bctrl
    5.52 +    /* should never return */
    5.53 +    trap
    5.54 +
    5.55 +    /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are
    5.56 +     * in a Linux signal trampoline, and it begins groping for a struct
    5.57 +     * rt_sigframe on the stack. Naturally, this fails miserably for our
    5.58 +     * backtrace. To work around this behavior, we must make certain that our
    5.59 +     * stack is always above our text, e.g. in the data section. */
    5.60 +    .data /* DO NOT REMOVE; see GDB note above */
    5.61 +    .align 4
    5.62 +cpu0_stack_bottom:
    5.63 +    .space STACK_SIZE
    5.64 +cpu0_stack:
    5.65 +    .space STACK_FRAME_OVERHEAD