aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/boot
diff options
context:
space:
mode:
authorOlaf Hering <olh@suse.de>2005-10-28 20:46:48 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-29 01:10:12 -0400
commita4497235f00d811943831c9d76995d36c4ffab2d (patch)
tree7731fe28f9b5b98a94f9182766a20eb862e6f5cf /arch/ppc64/boot
parentafbe8c4bb0155f533d6e57edd269c93e2f23c2fa (diff)
[PATCH] ppc64 boot: make the zImage relocateable
Make the zImage relocateable. So yaboot could just load and run any ELF binary, without worrying about its load address. Signed-off-by: Olaf Hering <olh@suse.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Anton Blanchard <anton@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/boot')
-rw-r--r--arch/ppc64/boot/Makefile2
-rw-r--r--arch/ppc64/boot/crt0.S29
-rw-r--r--arch/ppc64/boot/zImage.lds4
3 files changed, 33 insertions, 2 deletions
diff --git a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
index f8f35999e1a6..9e19351f3dfa 100644
--- a/arch/ppc64/boot/Makefile
+++ b/arch/ppc64/boot/Makefile
@@ -22,7 +22,7 @@
22 22
23 23
24HOSTCC := gcc 24HOSTCC := gcc
25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem $(shell $(CROSS32CC) -print-file-name=include) 25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem $(shell $(CROSS32CC) -print-file-name=include) -fPIC
26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
27BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds 27BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds
28OBJCOPYFLAGS := contents,alloc,load,readonly,data 28OBJCOPYFLAGS := contents,alloc,load,readonly,data
diff --git a/arch/ppc64/boot/crt0.S b/arch/ppc64/boot/crt0.S
index da6618a865c9..5788a453a7a2 100644
--- a/arch/ppc64/boot/crt0.S
+++ b/arch/ppc64/boot/crt0.S
@@ -14,9 +14,38 @@
14 .text 14 .text
15 .globl _start 15 .globl _start
16_start: 16_start:
17 bl reloc_offset
18
19reloc_offset:
20 mflr r0
21 lis r9,reloc_offset@ha
22 addi r9,r9,reloc_offset@l
23 subf. r0,r9,r0
24 beq clear_caches
25
26reloc_got2:
27 lis r9,__got2_start@ha
28 addi r9,r9,__got2_start@l
29 lis r8,__got2_end@ha
30 addi r8,r8,__got2_end@l
31 subf. r8,r9,r8
32 beq clear_caches
33 srwi. r8,r8,2
34 mtctr r8
35 add r9,r0,r9
36reloc_got2_loop:
37 lwz r8,0(r9)
38 add r8,r8,r0
39 stw r8,0(r9)
40 addi r9,r9,4
41 bdnz reloc_got2_loop
42
43clear_caches:
17 lis r9,_start@h 44 lis r9,_start@h
45 add r9,r0,r9
18 lis r8,_etext@ha 46 lis r8,_etext@ha
19 addi r8,r8,_etext@l 47 addi r8,r8,_etext@l
48 add r8,r0,r8
201: dcbf r0,r9 491: dcbf r0,r9
21 icbi r0,r9 50 icbi r0,r9
22 addi r9,r9,0x20 51 addi r9,r9,0x20
diff --git a/arch/ppc64/boot/zImage.lds b/arch/ppc64/boot/zImage.lds
index fb465a4d89b5..79d62c733ec0 100644
--- a/arch/ppc64/boot/zImage.lds
+++ b/arch/ppc64/boot/zImage.lds
@@ -13,7 +13,9 @@ SECTIONS
13 *(.rodata*) 13 *(.rodata*)
14 *(.data*) 14 *(.data*)
15 *(.sdata*) 15 *(.sdata*)
16 *(.got*) 16 __got2_start = .;
17 *(.got2)
18 __got2_end = .;
17 } 19 }
18 20
19 . = ALIGN(4096); 21 . = ALIGN(4096);