EMILE/second/enter_kernelPPC.S

89 lines
1.2 KiB
ArmAsm
Raw Normal View History

2005-05-10 22:03:52 +00:00
/*
*
* (c) 2005 Laurent Vivier <LaurentVivier@wanadoo.fr>
2005-05-12 05:47:26 +00:00
* from BootX, (c) Benjamin Herrenschmidt
2005-05-10 22:03:52 +00:00
*
*/
.chip 68020
2005-05-12 21:05:36 +00:00
.equ PC, 0x00FC
2005-05-12 05:47:26 +00:00
.equ GPR, 0x0100
.equ FPR, 0x0200
#define pc %sp@(PC)
#define gpr(a) %sp@(GPR + 8 * a + 4)
#define fpr0(a) %sp@(FPR + 8 * a)
#define fpr1(a) %sp@(FPR + 8 * a + 4)
.macro copy_GPR from=0, to=31
move.l %a1@+, gpr(\from)
.if \to-\from
copy_GPR "(\from+1)",\to
.endif
.endm
.macro copy_FPR from=0, to=31
move.l %a1@+, fpr0(\from)
move.l %a1@+, fpr1(\from)
.if \to-\from
copy_FPR "(\from+1)",\to
.endif
.endm
2005-05-12 21:05:36 +00:00
2005-05-10 22:03:52 +00:00
.align 4
.global enter_kernelPPC
enter_kernelPPC:
2005-05-13 22:02:12 +00:00
link.w %fp,#0
2005-05-10 22:03:52 +00:00
/* get physical start address of kernel */
move.l 8(%fp), %a0
/* get PPC registers values */
2005-05-10 22:03:52 +00:00
move.l 12(%fp), %a1
2005-05-10 22:03:52 +00:00
2005-05-12 05:47:26 +00:00
/* prepare stack */
move.l %sp, %d0
andi.l #0xFFFFFC00, %d0
move.l %d0, %sp
move.l #0x00BF, %d0
loop:
clr.l -(%sp)
dbra %d0, loop
/* Initialize PPC registers */
/* set up program counter */
/* PC */
move.l %a1@+, pc
/* GPR */
copy_GPR
/* FPR */
copy_FPR
2005-05-10 22:03:52 +00:00
2005-05-12 05:47:26 +00:00
/* Switch to PPC */
2005-05-10 22:03:52 +00:00
2005-05-12 05:47:26 +00:00
move.l #0x47617279, %a0 /* 'Gary' */
move.l #0x05051956, %a1
move.l #0x0000C000, %d0
moveq #0, %d2
reset
2005-05-10 22:03:52 +00:00
2005-05-13 22:02:12 +00:00
move.l %sp,-(%sp)
2005-05-12 05:47:26 +00:00
wait:
dc.w 0xFE03
beq wait
2005-05-13 22:02:12 +00:00
unlk %fp
2005-05-10 22:03:52 +00:00
rts