Linux 2.6.26-rc5
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / s390 / kernel / head31.S
bloba816e2de32b957ce24af24a2e0f45163e3d8e4da
1 /*
2  * arch/s390/kernel/head31.S
3  *
4  * Copyright (C) IBM Corp. 2005,2006
5  *
6  *   Author(s): Hartmut Penner <hp@de.ibm.com>
7  *              Martin Schwidefsky <schwidefsky@de.ibm.com>
8  *              Rob van der Heij <rvdhei@iae.nl>
9  *              Heiko Carstens <heiko.carstens@de.ibm.com>
10  *
11  */
14 # startup-code at 0x10000, running in absolute addressing mode
15 # this is called either by the ipl loader or directly by PSW restart
16 # or linload or SALIPL
18         .org    0x10000
19 startup:basr    %r13,0                  # get base
20 .LPG0:  l       %r13,0f-.LPG0(%r13)
21         b       0(%r13)
22 0:      .long   startup_continue
25 # params at 10400 (setup.h)
27         .org    PARMAREA
28         .long   0,0                     # IPL_DEVICE
29         .long   0,0                     # INITRD_START
30         .long   0,0                     # INITRD_SIZE
32         .org    COMMAND_LINE
33         .byte   "root=/dev/ram0 ro"
34         .byte   0
36         .org    0x11000
38 startup_continue:
39         basr    %r13,0                  # get base
40 .LPG1:  mvi     __LC_AR_MODE_ID,0       # set ESA flag (mode 0)
41         lctl    %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
42         l       %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
43                                         # move IPL device to lowcore
44         mvc     __LC_IPLDEV(4),IPL_DEVICE-PARMAREA(%r12)
46 # Setup stack
48         l       %r15,.Linittu-.LPG1(%r13)
49         mvc     __LC_CURRENT(4),__TI_task(%r15)
50         ahi     %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
51         st      %r15,__LC_KERNEL_STACK  # set end of kernel stack
52         ahi     %r15,-96
53         xc      __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain
55 # Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
56 # and create a kernel NSS if the SAVESYS= parm is defined
58         l       %r14,.Lstartup_init-.LPG1(%r13)
59         basr    %r14,%r14
60         lpsw  .Lentry-.LPG1(13)         # jump to _stext in primary-space,
61                                         # virtual and never return ...
62         .align  8
63 .Lentry:.long   0x00080000,0x80000000 + _stext
64 .Lctl:  .long   0x04b50002              # cr0: various things
65         .long   0                       # cr1: primary space segment table
66         .long   .Lduct                  # cr2: dispatchable unit control table
67         .long   0                       # cr3: instruction authorization
68         .long   0                       # cr4: instruction authorization
69         .long   .Lduct                  # cr5: primary-aste origin
70         .long   0                       # cr6:  I/O interrupts
71         .long   0                       # cr7:  secondary space segment table
72         .long   0                       # cr8:  access registers translation
73         .long   0                       # cr9:  tracing off
74         .long   0                       # cr10: tracing off
75         .long   0                       # cr11: tracing off
76         .long   0                       # cr12: tracing off
77         .long   0                       # cr13: home space segment table
78         .long   0xc0000000              # cr14: machine check handling off
79         .long   0                       # cr15: linkage stack operations
80 .Lmchunk:.long  memory_chunk
81 .Lbss_bgn:  .long __bss_start
82 .Lbss_end:  .long _end
83 .Lparmaddr: .long PARMAREA
84 .Linittu:   .long init_thread_union
85 .Lstartup_init:
86             .long startup_init
87         .align  64
88 .Lduct: .long   0,0,0,0,.Lduald,0,0,0
89         .long   0,0,0,0,0,0,0,0
90         .align  128
91 .Lduald:.rept   8
92         .long   0x80000000,0,0,0        # invalid access-list entries
93         .endr
95         .org    0x12000
96         .globl  _ehead
97 _ehead:
98 #ifdef CONFIG_SHARED_KERNEL
99         .org    0x100000
100 #endif
103 # startup-code, running in absolute addressing mode
105         .globl  _stext
106 _stext: basr    %r13,0                  # get base
107 .LPG3:
108 # check control registers
109         stctl   %c0,%c15,0(%r15)
110         oi      2(%r15),0x40            # enable sigp emergency signal
111         oi      0(%r15),0x10            # switch on low address protection
112         lctl    %c0,%c15,0(%r15)
115         lam     0,15,.Laregs-.LPG3(%r13) # load access regs needed by uaccess
116         l       %r14,.Lstart-.LPG3(%r13)
117         basr    %r14,%r14               # call start_kernel
119 # We returned from start_kernel ?!? PANIK
121         basr    %r13,0
122         lpsw    .Ldw-.(%r13)            # load disabled wait psw
124         .align  8
125 .Ldw:   .long   0x000a0000,0x00000000
126 .Lstart:.long   start_kernel
127 .Laregs:.long   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0