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 <machine/vmparam.h>
37 #include "opt_platform.h"
39 /* Locate the per-CPU data structure */
40 #define GET_CPUINFO(r) \
44 * Compiled KERNBASE location and the kernel load address
47 .set kernbase, KERNBASE
59 #define TMPSTKSZ 8192 /* 8K temporary stack */
64 #define TRAPSTKSZ 4096 /* 4k trap stack */
74 * Main kernel entry point.
79 /* Figure out where we are */
82 .long _GLOBAL_OFFSET_TABLE_-.
86 /* Set up temporary stack pointer */
89 addi %r1,%r1,(8+TMPSTKSZ-40)
98 lwz %r3,0(%r30) /* _DYNAMIC in %r3 */
100 lwz %r4,4(%r30) /* GOT pointer */
102 lwz %r4,4(%r4) /* got[0] is _DYNAMIC link addr */
103 subf %r4,%r4,%r3 /* subtract to calculate relocbase */
115 /* Set stack pointer to new value and branch to mi_startup */
121 /* mi_startup() does not return */
124 #include <powerpc/aim/trap_subr32.S>