MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / sh / kernel / head.S
blobb254501a1ca3a6941081be9e54cbebdb01b883bd
1 /* $Id: head.S,v 1.7 2003/09/01 17:58:19 lethal Exp $
2  *
3  *  arch/sh/kernel/head.S
4  *
5  *  Copyright (C) 1999, 2000  Niibe Yutaka & Kaz Kojima
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file "COPYING" in the main directory of this archive
9  * for more details.
10  *
11  * Head.S contains the SH exception handlers and startup code.
12  */
13 #include <linux/linkage.h>
14 #include <asm/thread_info.h>
16 #ifdef CONFIG_CPU_SH4A
17 #define SYNCO()         synco
19 #define PREFI(label, reg)       \
20         mov.l   label, reg;     \
21         prefi   @reg
22 #else
23 #define SYNCO()
24 #define PREFI(label, reg)
25 #endif
27         .section        .empty_zero_page, "aw"
28 ENTRY(empty_zero_page)
29         .long   1               /* MOUNT_ROOT_RDONLY */
30         .long   0               /* RAMDISK_FLAGS */
31         .long   0x0200          /* ORIG_ROOT_DEV */
32         .long   1               /* LOADER_TYPE */
33         .long   0x00360000      /* INITRD_START */
34         .long   0x000a0000      /* INITRD_SIZE */
35         .long   0
36         .balign 256,0,256
37         /* Command line goes here */
38 #ifdef CONFIG_CMDLINE_BOOL
39         .ascii  CONFIG_CMDLINE "\0"
40 #endif
41         .balign 4096,0,4096
42         .text   
44  * Condition at the entry of _stext:
45  *
46  *   BSC has already been initialized.
47  *   INTC may or may not be initialized.
48  *   VBR may or may not be initialized.
49  *   MMU may or may not be initialized.
50  *   Cache may or may not be initialized.
51  *   Hardware (including on-chip modules) may or may not be initialized. 
52  *
53  */
54 ENTRY(_stext)
55         !                       Initialize Status Register
56         mov.l   1f, r0          ! MD=1, RB=0, BL=0, IMASK=0xF
57         ldc     r0, sr
58         !                       Initialize global interrupt mask
59         mov     #0, r0
60         ldc     r0, r6_bank
62         /*
63          * Prefetch if possible to reduce cache miss penalty.
64          *
65          * We do this early on for SH-4A as a micro-optimization,
66          * as later on we will have speculative execution enabled
67          * and this will become less of an issue.
68          */
69         PREFI(5f, r0)
70         PREFI(6f, r0)
72         !
73         mov.l   2f, r0
74         mov     r0, r15         ! Set initial r15 (stack pointer)
75         mov     #(THREAD_SIZE >> 8), r1
76         shll8   r1              ! r1 = THREAD_SIZE
77         sub     r1, r0          !
78         ldc     r0, r7_bank     ! ... and initial thread_info
80 #if defined(CONFIG_SH_CONCAT_FS)
81         ! move the fs to after the bss
82         mov.l   7f, r0
83         jsr @r0
84         nop
85 #endif
87         !                       Clear BSS area
88         mov.l   3f, r1
89         add     #4, r1
90         mov.l   4f, r2
91         mov     #0, r0
92 9:      cmp/hs  r2, r1
93         bf/s    9b              ! while (r1 < r2)
94          mov.l  r0,@-r2
96         !                       Additional CPU initialization
97         mov.l   6f, r0
98         jsr     @r0
99          nop
101         SYNCO()                 ! Wait for pending instructions..
103         !                       Start kernel
104         mov.l   5f, r0
105         jmp     @r0
106          nop
108         .balign 4
109 1:      .long   0x400080F0              ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF
110 2:      .long   init_thread_union+THREAD_SIZE
111 3:      .long   __bss_start
112 4:      .long   _end
113 5:      .long   start_kernel
114 6:      .long   sh_cpu_init
115 #if defined(CONFIG_SH_CONCAT_FS)
116 7:  .long   copy_romfs
117 #endif