2 # Copyright (c) 2005 Jakub Jermar
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # - Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # - Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # - The name of the author may not be used to endorse or promote products
15 # derived from this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <arch/register.h>
30 #include <arch/mm/page.h>
31 #include <arch/mm/asid.h>
34 #define RR_MASK (0xFFFFFFFF00000002)
38 #define KERNEL_TRANSLATION_I 0x0010000000000661
39 #define KERNEL_TRANSLATION_D 0x0010000000000661
41 .section K_TEXT_START, "ax"
43 .global kernel_image_start
49 # Fill TR.i and TR.d using Region Register #VRN_KERNEL
51 movl r8=(VRN_KERNEL<<VRN_SHIFT)
55 movl r10=((RID_KERNEL<<RID_SHIFT)|(KERNEL_PAGE_WIDTH<<PS_SHIFT))
59 movl r8=(VRN_KERNEL<<VRN_SHIFT)
61 movl r10=(KERNEL_PAGE_WIDTH<<PS_SHIFT)
63 movl r10=(KERNEL_TRANSLATION_I)
65 movl r10=(KERNEL_TRANSLATION_D)
72 movl r10=(PSR_DT_MASK|PSR_RT_MASK|PSR_IT_MASK|PSR_IC_MASK) /* Enable paging */
84 * Return From Interupt is the only the way to fill upper half word of PSR.
95 # switch to register bank 1
98 # initialize register stack
100 movl r8=(VRN_KERNEL<<VRN_SHIFT) ;;
104 # initialize memory stack to some sane value
107 add r12 = - 16, r12 /* allocate a scratch area on the stack */
109 # initialize gp (Global Pointer) register
110 movl r1 = _hardcoded_load_address
113 * Initialize hardcoded_* variables.
115 movl r14 = _hardcoded_ktext_size
116 movl r15 = _hardcoded_kdata_size
117 movl r16 = _hardcoded_load_address ;;
118 addl r17 = @gprel(hardcoded_ktext_size), gp
119 addl r18 = @gprel(hardcoded_kdata_size), gp
120 addl r19 = @gprel(hardcoded_load_address), gp
126 ssm (1<<19);; /* Disable f32 - f127 */
130 br.call.sptk.many b0 = arch_pre_main
134 br.call.sptk.many b0=b1