4 * BIOS start code for Open Hack'Ware.
6 * Copyright (C) 2004-2005 Jocelyn Mayer (l_indien@magic.fr)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 /* Save our stack pointer */
31 lis r11, saved_params@h ;
32 ori r11, r11, saved_params@l ;
34 /* Fill space from _bss_start to _ram_start with zeroes */
35 lis r11, _bss_start@h ;
36 ori r11, r11, _bss_start@l ;
37 lis r12, _ram_start@h ;
38 ori r12, r12, _ram_start@l ;
50 /* Now, we have a real C environment: call main */
52 /* If we return, stop */
64 .long 0x00000000 /* OF stack */
65 .long 0x00000000 /* client stack */
66 .long 0x00000000 /* client link */
71 .globl transfer_handler
73 /* Build a new stack room and launch loaded image
74 * void transfer_handler (void *residual, void *load_addr,
75 * void *OF_entry, void *bootinfos,
76 * void *cmdline, void *unused,
77 * void *nip, void *stack_base);
89 /* Skip frame pointer */
94 /* Should never return, but who knows... */
99 /* Save the stack pointer and get our own one */
100 lis r11, saved_params@h ;
101 ori r11, r11, saved_params@l ;
107 lis r11, saved_params@h ;
108 ori r11, r11, saved_params@l ;
117 /* uint32_t mfmsr (void); */
122 /* void mtmsr (uint32_t msr); */
123 lis r0, _mtmsr_rfi@h ;
124 ori r0, r0, _mtmsr_rfi@l ;
132 /* void MMU_on (void); */
146 /* void MMU_off (void); */
151 andi. r3, r3, 0xFFCF ;
160 /* uint32_t mfpvr (void); */
166 /* void mftb (uint32_t *tb); */
170 /* No need to save lr */
187 /* uint32_t inb (uint16_t port); */
190 lis r11, isa_io_base@h ;
191 ori r11, r11, isa_io_base@l ;
202 /* void outb (uint16_t port, uint32_t val); */
205 lis r11, isa_io_base@h ;
206 ori r11, r11, isa_io_base@l ;
217 /* uint32_t inw (uint16_t port); */
220 lis r11, isa_io_base@h ;
221 ori r11, r11, isa_io_base@l ;
232 /* void outw (uint16_t port, uint32_t val); */
235 lis r11, isa_io_base@h ;
236 ori r11, r11, isa_io_base@l ;
247 /* uint32_t inl (uint16_t port); */
250 lis r11, isa_io_base@h ;
251 ori r11, r11, isa_io_base@l ;
262 /* void outl (uint16_t port, uint32_t val); */
265 lis r11, isa_io_base@h ;
266 ori r11, r11, isa_io_base@l ;
283 /* uint16_t ldswap16 (uint16_t *addr); */
289 /* void stswap16 (void *addr, uint16_t val); */
295 /* uint32_t ldswap32 (uint32_t *addr); */
301 /* void stswap32 (void *addr, uint32_t val); */
307 /* void mul64 (uint32_t *ret, uint32_t a, uint32_t b); */
316 /* void add64 (uint32_t *ret, uint32_t *a, uint32_t *b); */
335 /* int setjmp (jmp_buf env); */
338 /* save lr, ctr, xer and ccr */
353 /* void longjmp (jmp_buf env, int val); */
354 /* Let's pretend env is our stack */
356 /* Be sure we won't return 0 */
361 /* Store return value in jmp_buf */
363 /* restore lr, ctr, xer and ccr */
372 /* Restore r2 to r31 */
374 /* Restore r0 (could forget it...) */