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: cpu_config.c,v 1.14 2007/07/27 11:28:44 honda Exp $
|
---|
51 | */
|
---|
52 |
|
---|
53 | #include "jsp_kernel.h"
|
---|
54 | #include "cpu_config.h"
|
---|
55 |
|
---|
56 | UW exception_count;
|
---|
57 |
|
---|
58 | UW exception_registers[40];
|
---|
59 |
|
---|
60 | FP exc_table[TMAX_CORE_EXCNO] =
|
---|
61 | {
|
---|
62 | (FP)_start,
|
---|
63 | (FP)Breakpoint_exception,
|
---|
64 | (FP)InstructionBusError_exception,
|
---|
65 | (FP)Watchpoint_exception,
|
---|
66 | (FP)DataBusError_exception,
|
---|
67 | (FP)DivideByZero_exception,
|
---|
68 | (FP)Interrupt_exception,
|
---|
69 | (FP)SystemCall_exception
|
---|
70 | };
|
---|
71 |
|
---|
72 | void dump_registers()
|
---|
73 | {
|
---|
74 | syslog(LOG_EMERG, "r0 : 0x%08x, r1 : 0x%08x, r2 : 0x%08x, r3 : 0x%08x",
|
---|
75 | exception_registers[0], exception_registers[1], exception_registers[2], exception_registers[3]);
|
---|
76 | syslog(LOG_EMERG, "r4 : 0x%08x, r5 : 0x%08x, r6 : 0x%08x, r7 : 0x%08x",
|
---|
77 | exception_registers[4], exception_registers[5], exception_registers[6], exception_registers[7]);
|
---|
78 | syslog(LOG_EMERG, "r8 : 0x%08x, r9 : 0x%08x, r10 : 0x%08x, r11 : 0x%08x",
|
---|
79 | exception_registers[8], exception_registers[9], exception_registers[10], exception_registers[11]);
|
---|
80 | syslog(LOG_EMERG, "r12 : 0x%08x, r13 : 0x%08x, r14 : 0x%08x, r15 : 0x%08x",
|
---|
81 | exception_registers[12], exception_registers[13], exception_registers[14], exception_registers[15]);
|
---|
82 | syslog(LOG_EMERG, "r16 : 0x%08x, r17 : 0x%08x, r18 : 0x%08x, r19 : 0x%08x",
|
---|
83 | exception_registers[16], exception_registers[17], exception_registers[18], exception_registers[19]);
|
---|
84 | syslog(LOG_EMERG, "r20 : 0x%08x, r21 : 0x%08x, r22 : 0x%08x, r23 : 0x%08x",
|
---|
85 | exception_registers[20], exception_registers[21], exception_registers[22], exception_registers[23]);
|
---|
86 | syslog(LOG_EMERG, "r24 : 0x%08x, r25 : 0x%08x, r26 : 0x%08x, r27 : 0x%08x",
|
---|
87 | exception_registers[24], exception_registers[25], exception_registers[26], exception_registers[27]);
|
---|
88 | syslog(LOG_EMERG, "sp : 0x%08x, ra : 0x%08x, ea : 0x%08x, ba : 0x%08x",
|
---|
89 | exception_registers[28], exception_registers[29], exception_registers[30], exception_registers[31]);
|
---|
90 |
|
---|
91 | syslog(LOG_EMERG, "ie : 0x%08x, im : 0x%08x, ip : 0x%08x, icc : 0x%08x",
|
---|
92 | exception_registers[32], exception_registers[33], exception_registers[34], exception_registers[35]);
|
---|
93 | syslog(LOG_EMERG, "dcc : 0x%08x, cc : 0x%08x, cfg : 0x%08x, eba : 0x%08x",
|
---|
94 | exception_registers[36], exception_registers[37], exception_registers[38], exception_registers[39]);
|
---|
95 | }
|
---|
96 |
|
---|
97 | void Breakpoint_exception()
|
---|
98 | {
|
---|
99 | syslog(LOG_EMERG, "Breakpoint Exception occurs.");
|
---|
100 | dump_registers();
|
---|
101 | while(1);
|
---|
102 | }
|
---|
103 |
|
---|
104 | void InstructionBusError_exception()
|
---|
105 | {
|
---|
106 | syslog(LOG_EMERG, "InstructionBusError Exception occurs.");
|
---|
107 | dump_registers();
|
---|
108 | while(1);
|
---|
109 | }
|
---|
110 |
|
---|
111 | void Watchpoint_exception()
|
---|
112 | {
|
---|
113 | syslog(LOG_EMERG, "Watchpoint Exception occurs.");
|
---|
114 | dump_registers();
|
---|
115 | while(1);
|
---|
116 | }
|
---|
117 |
|
---|
118 | void DataBusError_exception()
|
---|
119 | {
|
---|
120 | syslog(LOG_EMERG, "DataBusError Exception occurs.");
|
---|
121 | dump_registers();
|
---|
122 | while(1);
|
---|
123 | }
|
---|
124 |
|
---|
125 | void DivideByZero_exception()
|
---|
126 | {
|
---|
127 | syslog(LOG_EMERG, "DivideByZero Exception occurs.");
|
---|
128 | dump_registers();
|
---|
129 | while(1);
|
---|
130 | }
|
---|
131 |
|
---|
132 | void Interrupt_exception()
|
---|
133 | {
|
---|
134 | syslog(LOG_EMERG, "Interrupt Exception occurs.");
|
---|
135 | dump_registers();
|
---|
136 | while(1);
|
---|
137 | }
|
---|
138 |
|
---|
139 | void SystemCall_exception()
|
---|
140 | {
|
---|
141 | syslog(LOG_EMERG, "SystemCall Exception occurs.");
|
---|
142 | dump_registers();
|
---|
143 | while(1);
|
---|
144 | }
|
---|
145 |
|
---|
146 | void cpu_initialize(void)
|
---|
147 | {
|
---|
148 | exception_count = 1;
|
---|
149 | }
|
---|
150 |
|
---|
151 | void cpu_terminate(void)
|
---|
152 | {
|
---|
153 |
|
---|
154 | }
|
---|