]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/powerpc/kboot/kerneltramp.S
Re-sync loader.mk and ficl.mk to where they should be
[FreeBSD/FreeBSD.git] / sys / boot / powerpc / kboot / kerneltramp.S
1 /*
2  * This is the analog to the kexec "purgatory" code
3  *
4  * The goal here is to call the actual kernel entry point with the arguments it
5  * expects when kexec calls into it with no arguments. The value of the kernel
6  * entry point and arguments r3-r7 are copied into the trampoline text (which
7  * can be executed from any address) at bytes 8-32. kexec begins execution
8  * of APs at 0x60 bytes past the entry point, executing in a copy relocated
9  * to the absolute address 0x60. Here we implement a loop waiting on the release
10  * of a lock by the kernel at 0x40.
11  * 
12  * $FreeBSD$
13  */
14
15 #include <machine/asm.h>
16
17         .globl  CNAME(kerneltramp),CNAME(szkerneltramp)
18 CNAME(kerneltramp):
19         mflr %r9
20         bl 2f
21         .space 24       /* branch address, r3-r7 */
22
23 . = kerneltramp + 0x40  /* AP spinlock */
24         .long 0
25
26 . = kerneltramp + 0x60  /* AP entry point */
27         li      %r3,0x40
28 1:      lwz     %r1,0(%r3)
29         cmpwi   %r1,0
30         beq     1b
31
32         /* Jump into CPU reset */
33         li      %r0,0x100
34         icbi    0,%r0
35         isync
36         sync
37         ba      0x100
38
39 2:                      /* Continuation of kerneltramp */
40         mflr    %r8
41         mtlr    %r9
42         lwz     %r3,0(%r8)
43         mtctr   %r3
44         lwz     %r3,4(%r8)
45         lwz     %r4,8(%r8)
46         lwz     %r5,12(%r8)
47         lwz     %r6,16(%r8)
48         lwz     %r7,20(%r8)
49         bctr
50         
51 endkerneltramp:
52
53         .data
54 CNAME(szkerneltramp):
55         .long endkerneltramp - CNAME(kerneltramp)