4 * Copyright (C) 2010-2016 Nathan Whitehorn
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/syscall.h>
32 #include <machine/trap.h>
33 #include <machine/param.h>
34 #include <machine/spr.h>
35 #include <machine/asm.h>
36 #include "opt_platform.h"
38 /* Locate the per-CPU data structure */
39 #define GET_CPUINFO(r) \
43 * Compiled KERNBASE location and the kernel load address
46 .set kernbase, KERNBASE
58 #define TMPSTKSZ 8192 /* 8K temporary stack */
67 * Main kernel entry point.
72 /* Figure out where we are */
75 .long _GLOBAL_OFFSET_TABLE_-.
79 /* Set up temporary stack pointer */
82 addi %r1,%r1,(8+TMPSTKSZ-32)
90 lwz %r3,0(%r30) /* _DYNAMIC in %r3 */
92 lwz %r4,4(%r30) /* GOT pointer */
94 lwz %r4,4(%r4) /* got[0] is _DYNAMIC link addr */
95 subf %r4,%r4,%r3 /* subtract to calculate relocbase */
106 /* Set stack pointer to new value and branch to mi_startup */
112 /* mi_startup() does not return */
115 #include <powerpc/aim/trap_subr32.S>