| 1 |
/* startup.S - Startup code for the PowerPC. */ |
| 2 |
/* |
| 3 |
* GRUB -- GRand Unified Bootloader |
| 4 |
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc. |
| 5 |
* |
| 6 |
* GRUB is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* GRUB is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <grub/symbol.h> |
| 21 |
#include <grub/offsets.h> |
| 22 |
|
| 23 |
.extern __bss_start |
| 24 |
.extern _end |
| 25 |
|
| 26 |
.text |
| 27 |
.align 2 |
| 28 |
.globl start, _start |
| 29 |
start: |
| 30 |
_start: |
| 31 |
li 2, 0 |
| 32 |
li 13, 0 |
| 33 |
|
| 34 |
/* Stage1 won't zero BSS for us. In other cases, why not do it again? */ |
| 35 |
lis 6, (__bss_start - 4)@h |
| 36 |
ori 6, 6, (__bss_start - 4)@l |
| 37 |
|
| 38 |
2: stb 2, 4(6) |
| 39 |
addi 6, 6, 1 |
| 40 |
andi. 7, 6, 3 |
| 41 |
cmpi 0, 1, 7, 0 |
| 42 |
bne 2b |
| 43 |
|
| 44 |
lis 7, (_end - 4)@h |
| 45 |
ori 7, 7, (_end - 4)@l |
| 46 |
subf 7, 6, 7 |
| 47 |
subi 8, 7, 1 |
| 48 |
andi. 8, 8, 3 |
| 49 |
addi 8, 8, 1 |
| 50 |
sub 7, 7, 8 |
| 51 |
|
| 52 |
srwi 7, 7, 2 /* We store 4 bytes at a time. */ |
| 53 |
mtctr 7 |
| 54 |
2: stwu 2, 4(6) /* We know r2 is already 0 from above. */ |
| 55 |
bdnz 2b |
| 56 |
|
| 57 |
mtctr 8 |
| 58 |
2: stb 2, 4(6) /* We know r2 is already 0 from above. */ |
| 59 |
addi 6, 6, 1 |
| 60 |
bdnz 2b |
| 61 |
|
| 62 |
/* Store r5 in grub_ieee1275_entry_fn. */ |
| 63 |
lis 9, grub_ieee1275_entry_fn@ha |
| 64 |
stw 5, grub_ieee1275_entry_fn@l(9) |
| 65 |
|
| 66 |
bl grub_main |
| 67 |
1: b 1b |