1
/* startup.S - Startup code for the MIPS. */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2009 Free Software Foundation, Inc.
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.
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.
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/>.
20
#include <grub/symbol.h>
21
#include <grub/offsets.h>
22
#include <grub/machine/memory.h>
23
#include <grub/offsets.h>
30
.globl __start, _start, start
40
. = _start + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE
43
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE
50
/* Parse arguments. Has to be done before relocation.
51
So need to do it in asm. */
52
#ifdef GRUB_MACHINE_MIPS_YEELOONG
58
/* $a2 has the environment. */
60
beq $t0, $zero, argdone
65
beq $t1, $zero, argdone
67
#define DO_PARSE(str, reg) \
68
addiu $t2, $s0, (str-base);\
76
DO_PARSE (busclockstr, $s2)
77
DO_PARSE (cpuclockstr, $s3)
78
DO_PARSE (memsizestr, $s4)
79
DO_PARSE (highmemsizestr, $s5)
98
addiu $t3, $t3, 0xffff
101
/* Substract '0' from digit. */
102
addiu $t5, $t5, 0xffd0
105
addiu $t4, $t5, 0xfff7
108
/* Multiply $v0 by 10 with bitshifts. */
119
busclockstr: .asciiz "busclock="
120
cpuclockstr: .asciiz "cpuclock="
121
memsizestr: .asciiz "memsize="
122
highmemsizestr: .asciiz "highmemsize="
126
/* Copy the decompressor. */
128
addiu $t1, $t1, %lo(base)
129
lui $t3, %hi(__bss_start)
130
addiu $t3, $t3, %lo(__bss_start)
141
/* Clean out its BSS. */
142
lui $t1, %hi(__bss_start)
143
addiu $t1, $t1, %lo(__bss_start)
145
addiu $t2, $t2, %lo(_end)
154
/* Decompress the payload. */
155
lui $a0, %hi(__bss_start)
156
addiu $a0, $a0, %lo(__bss_start)
158
addiu $t0, $t0, %lo(base)
162
lui $a1, %hi(GRUB_MACHINE_LINK_ADDR)
163
addiu $a1, %lo(GRUB_MACHINE_LINK_ADDR)
164
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
165
lw $a3, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
168
/* $a0 contains source compressed address, $a1 is destination,
169
$a2 is compressed size, $a3 is uncompressed size.
173
lui $sp, %hi(_start - 256)
175
bal EXT_C(grub_decompress_core)
176
addiu $sp, $sp, %lo(_start - 256)
181
#include "../../kern/mips/cache_flush.S"
183
lui $t1, %hi(GRUB_MACHINE_LINK_ADDR)
184
addiu $t1, %lo(GRUB_MACHINE_LINK_ADDR)