1 | /*
|
---|
2 | * TOPPERS/JSP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Just Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | *
|
---|
9 | * ä¸è¨è使¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
11 | * ã«ãã£ã¦å
|
---|
12 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
13 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
14 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
15 | å¸ï¼ä»¥ä¸ï¼
|
---|
16 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
17 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
18 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
19 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
20 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
21 | * ç¨ã§ããå½¢ã§åé
|
---|
22 | å¸ããå ´åã«ã¯ï¼åé
|
---|
23 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
24 | * è
|
---|
25 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
26 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
27 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
28 | * ç¨ã§ããªãå½¢ã§åé
|
---|
29 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
30 | * ã¨ï¼
|
---|
31 | * (a) åé
|
---|
32 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
33 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
34 | * 使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
35 | * (b) åé
|
---|
36 | å¸ã®å½¢æ
|
---|
37 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
38 | * å ±åãããã¨ï¼
|
---|
39 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
40 | * 害ãããï¼ä¸è¨è使¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
42 | 責ãããã¨ï¼
|
---|
43 | *
|
---|
44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
45 | ã
|
---|
46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
47 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
48 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
49 | *
|
---|
50 | * @(#) $Id: start.S,v 1.14 2007/07/27 11:28:44 honda Exp $
|
---|
51 | */
|
---|
52 |
|
---|
53 | #define _MACRO_ONLY
|
---|
54 |
|
---|
55 | #include "jsp_kernel.h"
|
---|
56 |
|
---|
57 | .section ".boot","ax"
|
---|
58 | .global reset
|
---|
59 | reset:
|
---|
60 | _reset_handler:
|
---|
61 | xor r0, r0, r0
|
---|
62 | wcsr IE, r0
|
---|
63 | mvhi r1, hi(_reset_handler)
|
---|
64 | ori r1, r1, lo(_reset_handler)
|
---|
65 | wcsr EBA, r1
|
---|
66 | calli _start
|
---|
67 | nop
|
---|
68 | nop
|
---|
69 | _breakpoint_handler:
|
---|
70 | sw (sp+0), ra
|
---|
71 | calli _save_all
|
---|
72 | ori r1, r0, 1
|
---|
73 | calli _process_exception
|
---|
74 | bi _restore_all_and_bret
|
---|
75 | nop
|
---|
76 | nop
|
---|
77 | nop
|
---|
78 | _instruction_bus_error_handler:
|
---|
79 | sw (sp+0), ra
|
---|
80 | calli _save_all
|
---|
81 | ori r1, r0, 2
|
---|
82 | calli _process_exception
|
---|
83 | bi _restore_all_and_eret
|
---|
84 | nop
|
---|
85 | nop
|
---|
86 | nop
|
---|
87 | _watchpoint_handler:
|
---|
88 | sw (sp+0), ra
|
---|
89 | calli _save_all
|
---|
90 | ori r1, r0, 3
|
---|
91 | calli _process_exception
|
---|
92 | bi _restore_all_and_bret
|
---|
93 | nop
|
---|
94 | nop
|
---|
95 | nop
|
---|
96 | _data_bus_error_handler:
|
---|
97 | sw (sp+0), ra
|
---|
98 | calli _save_all
|
---|
99 | ori r1, r0, 4
|
---|
100 | calli _process_exception
|
---|
101 | bi _restore_all_and_eret
|
---|
102 | nop
|
---|
103 | nop
|
---|
104 | nop
|
---|
105 | _divide_by_zero_handler:
|
---|
106 | sw (sp+0), ra
|
---|
107 | calli _save_all
|
---|
108 | ori r1, r0, 5
|
---|
109 | calli _process_exception
|
---|
110 | bi _restore_all_and_eret
|
---|
111 | nop
|
---|
112 | nop
|
---|
113 | nop
|
---|
114 | _interrupt_handler:
|
---|
115 | sw (sp+0), ra
|
---|
116 | calli _save_all
|
---|
117 | ori r1, r0, 6
|
---|
118 | calli _process_exception
|
---|
119 | bi _restore_all_and_eret
|
---|
120 | nop
|
---|
121 | nop
|
---|
122 | nop
|
---|
123 | _system_call_handler:
|
---|
124 | sw (sp+0), ra
|
---|
125 | calli _save_all
|
---|
126 | ori r1, r0, 7
|
---|
127 | calli _process_exception
|
---|
128 | bi _restore_all_and_eret
|
---|
129 | nop
|
---|
130 | nop
|
---|
131 | nop
|
---|
132 |
|
---|
133 | .global _start
|
---|
134 | _start:
|
---|
135 | /* Clear r0 */
|
---|
136 | xor r0, r0, r0
|
---|
137 | /* Initialize the cache */
|
---|
138 | wcsr icc, r1
|
---|
139 | nop
|
---|
140 | nop
|
---|
141 | nop
|
---|
142 | nop
|
---|
143 | wcsr dcc, r1
|
---|
144 | nop
|
---|
145 | nop
|
---|
146 | nop
|
---|
147 | nop
|
---|
148 | /* clear the interrupt */
|
---|
149 | wcsr ie, r0
|
---|
150 | wcsr im, r0
|
---|
151 | mvhi r1, 0xFFFF
|
---|
152 | ori r1, r1, 0xFFFF
|
---|
153 | wcsr ip, r1
|
---|
154 | /* Setup stack and global pointer */
|
---|
155 | mvhi sp, hi(_fstack)
|
---|
156 | ori sp, sp, lo(_fstack)
|
---|
157 | mvhi gp, hi(_gp)
|
---|
158 | ori gp, gp, lo(_gp)
|
---|
159 | /* Clear BSS */
|
---|
160 | mvhi r1, hi(_fbss)
|
---|
161 | ori r1, r1, lo(_fbss)
|
---|
162 | mvhi r3, hi(_ebss)
|
---|
163 | ori r3, r3, lo(_ebss)
|
---|
164 | clear_bss:
|
---|
165 | be r1, r3, start_kernel
|
---|
166 | sw (r1+0), r0
|
---|
167 | addi r1, r1, 4
|
---|
168 | bi clear_bss
|
---|
169 | start_kernel:
|
---|
170 | calli kernel_start
|
---|