2
* Copyright (c) 2007 Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
4
*****************************************************************************
5
* Permission is hereby granted, free of charge, to any person obtaining a copy
6
* of this software and associated documentation files (the "Software"), to
7
* deal in the Software without restriction, including without limitation the
8
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
* sell copies of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
* DEALINGS IN THE SOFTWARE.
36
* Allocate kernel stack area.
37
* This is used for stack pointer (goes down from kstack+PAGE_SIZE) and
38
* RSE (goes up from kstack).
40
.section .data.start,"aw"
43
kstack: .space KSTACK_PAGES * PAGE_SIZE
49
* r28 points to the address of the boot parameter area, given
50
* from the bootloader.
51
* Execution reaches here in physical mode.
55
.save rp, r0 // terminate unwind chain with a NULL rp
58
alloc loc0=ar.pfs,0,1,1,0
66
* Initialize mini-os region registers:
67
* Currently only region registers 5 and 7 are used for addressing.
68
* rr[5] : virtual kernel address space
69
* rr[7] : directly mapped physically addresses.
71
movl r2=0<<IA64_RR_IDX_POS
72
movl r3=1<<IA64_RR_IDX_POS
77
movl r2=2<<IA64_RR_IDX_POS
78
movl r3=3<<IA64_RR_IDX_POS
83
movl r2=4<<IA64_RR_IDX_POS
84
movl r3=6<<IA64_RR_IDX_POS
89
// Wired memory for kernel data and text.
90
movl r2=IA64_RR_VAL(KERNEL_TR_PAGE_SIZE,0)
91
movl r3=5<<IA64_RR_IDX_POS // region 5
96
* Region 7 addresses are only for directly mapped physically
99
movl r2=IA64_RR_VAL(PTE_PS_16K,0)
100
movl r3=7<<IA64_RR_IDX_POS // region 7
105
* Setup protection keys for region 5 and 7.
107
mov r2=(IA64_KEY_REG5 << IA64_PKR_KEY) | IA64_PKR_VALID
108
mov r3=(IA64_KEY_REG7 << IA64_PKR_KEY) | IA64_PKR_VALID
111
mov pkr[r0]=r2 /* Region 5 */
112
mov pkr[r14]=r3 /* Region 7 */
115
* Now pin mappings into the TLB for kernel text and data
117
mov r18=(KERNEL_TR_PAGE_SIZE<<IA64_ITIR_PS)| \
118
(IA64_KEY_REG5<<IA64_ITIR_KEY)
119
movl r17=KERNEL_START
123
mov r16=IA64_TR_KERNEL
125
movl r18=PTE_KERNEL_ATTR
127
dep r2=0,r3,0,KERNEL_TR_PAGE_SIZE
139
/* Switch into virtual mode */
150
1: /* now we are in virtual mode */
152
movl r3=ia64_trap_table
157
movl r2=IA64_FPSR_DEFAULT
158
movl r3=IA64_DCR_DEFAULT
167
movl r5=KSTACK_PAGES * PAGE_SIZE - 16
168
mov ar.rsc=0 // place RSE in enforced lazy mode
170
loadrs // clear the dirty partition
172
mov ar.bspstore=r2 // establish the new RSE stack
175
mov ar.rsc=IA64_RSE_EAGER // place RSE in eager mode
178
movl r2=ia64_boot_paramP
179
mov r3=7 // make address virtual region 7.
183
// save the address of the boot param area
184
// passed by the bootloader
188
/* Set xsi base. I use here XSI_BASE. */
189
#define FW_HYPERCALL_SET_SHARED_INFO_VA 0x600
190
mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
196
* I set up here the pointer to the global start_info structure.
197
* This structure will be initialized in arch_init().
199
movl out0=start_info_union
200
// Prepare out0 - the pointer to start_info_t.
203
add r15=START_INFO_PFN,r14 // add offset to XSI_BASE
205
START_INFO_PFN_ld r14=[r15] // load the start_info_pfn
208
#if defined(BIG_ENDIAN)
209
mux1 r14=r14,@rev // swap because mini-os is in BE
212
shl r15=r14,PAGE_SHIFT_XEN_16K // pfn << PAGE_SHIFT_XEN_16K
213
shl r16=r16,IA64_RR_IDX_POS // (7<<IA64_RR_IDX_POS)
215
or out0=r16, r15 // make a region 7 address
221
br.call.sptk.many rp=start_kernel
229
br.sptk.many self // endless loop