blob: d2f2ace56cd34df5e1203a85ce5248e763e3133a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * NOTE: this code runs in 32 bit mode and is packaged as ELF32.
10 */
11
Olaf Heringdecd3002005-08-08 13:24:38 +100012#include "ppc_asm.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14 .text
Olaf Hering67a1b682005-10-28 17:46:49 -070015 .globl _zimage_start
16_zimage_start:
Olaf Hering68643cf2005-11-17 22:09:02 +010017 bl 1f
Olaf Heringa4497232005-10-28 17:46:48 -070018
Olaf Hering68643cf2005-11-17 22:09:02 +0100191:
Olaf Heringa4497232005-10-28 17:46:48 -070020 mflr r0
Olaf Hering68643cf2005-11-17 22:09:02 +010021 lis r9,1b@ha
22 addi r9,r9,1b@l
Olaf Heringa4497232005-10-28 17:46:48 -070023 subf. r0,r9,r0
Olaf Hering68643cf2005-11-17 22:09:02 +010024 beq 3f
Olaf Heringa4497232005-10-28 17:46:48 -070025
Olaf Heringa4497232005-10-28 17:46:48 -070026 lis r9,__got2_start@ha
27 addi r9,r9,__got2_start@l
28 lis r8,__got2_end@ha
29 addi r8,r8,__got2_end@l
30 subf. r8,r9,r8
Olaf Hering68643cf2005-11-17 22:09:02 +010031 beq 3f
Olaf Heringa4497232005-10-28 17:46:48 -070032 srwi. r8,r8,2
33 mtctr r8
34 add r9,r0,r9
Olaf Hering68643cf2005-11-17 22:09:02 +0100352:
Olaf Heringa4497232005-10-28 17:46:48 -070036 lwz r8,0(r9)
37 add r8,r8,r0
38 stw r8,0(r9)
39 addi r9,r9,4
Olaf Hering68643cf2005-11-17 22:09:02 +010040 bdnz 2b
Olaf Heringa4497232005-10-28 17:46:48 -070041
Olaf Hering68643cf2005-11-17 22:09:02 +0100423:
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 lis r9,_start@h
Olaf Heringa4497232005-10-28 17:46:48 -070044 add r9,r0,r9
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 lis r8,_etext@ha
46 addi r8,r8,_etext@l
Olaf Heringa4497232005-10-28 17:46:48 -070047 add r8,r0,r8
Olaf Hering68643cf2005-11-17 22:09:02 +0100484: dcbf r0,r9
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 icbi r0,r9
50 addi r9,r9,0x20
51 cmplwi 0,r9,8
Olaf Hering68643cf2005-11-17 22:09:02 +010052 blt 4b
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 sync
54 isync
55
Olaf Hering7e658112005-10-28 17:46:50 -070056 mr r6,r1
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 b start
58