[363] | 1 | /*
|
---|
| 2 | * TOPPERS/JSP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Just Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2006-2010 by Witz Corporation, JAPAN
|
---|
| 7 | *
|
---|
| 8 | * The above copyright holders grant permission gratis to use,
|
---|
| 9 | * duplicate, modify, or redistribute (hereafter called use) this
|
---|
| 10 | * software (including the one made by modifying this software),
|
---|
| 11 | * provided that the following four conditions (1) through (4) are
|
---|
| 12 | * satisfied.
|
---|
| 13 | *
|
---|
| 14 | * (1) When this software is used in the form of source code, the above
|
---|
| 15 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
| 16 | * below must be retained in the source code without modification.
|
---|
| 17 | *
|
---|
| 18 | * (2) When this software is redistributed in the forms usable for the
|
---|
| 19 | * development of other software, such as in library form, the above
|
---|
| 20 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
| 21 | * below must be shown without modification in the document provided
|
---|
| 22 | * with the redistributed software, such as the user manual.
|
---|
| 23 | *
|
---|
| 24 | * (3) When this software is redistributed in the forms unusable for the
|
---|
| 25 | * development of other software, such as the case when the software
|
---|
| 26 | * is embedded in a piece of equipment, either of the following two
|
---|
| 27 | * conditions must be satisfied:
|
---|
| 28 | *
|
---|
| 29 | * (a) The above copyright notice, this use conditions, and the
|
---|
| 30 | * disclaimer shown below must be shown without modification in
|
---|
| 31 | * the document provided with the redistributed software, such as
|
---|
| 32 | * the user manual.
|
---|
| 33 | *
|
---|
| 34 | * (b) How the software is to be redistributed must be reported to the
|
---|
| 35 | * TOPPERS Project according to the procedure described
|
---|
| 36 | * separately.
|
---|
| 37 | *
|
---|
| 38 | * (4) The above copyright holders and the TOPPERS Project are exempt
|
---|
| 39 | * from responsibility for any type of damage directly or indirectly
|
---|
| 40 | * caused from the use of this software and are indemnified by any
|
---|
| 41 | * users or end users of this software from any and all causes of
|
---|
| 42 | * action whatsoever.
|
---|
| 43 | *
|
---|
| 44 | * THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
|
---|
| 45 | * THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
|
---|
| 46 | * INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
|
---|
| 47 | * PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
|
---|
| 48 | * TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
|
---|
| 49 | * INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
|
---|
| 50 | *
|
---|
| 51 | * ä¸è¨èä½æ¨©è
|
---|
| 52 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 53 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»
|
---|
| 54 | * åé
|
---|
| 55 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 56 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½æ¨©
|
---|
| 57 | * 表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼ã¹
|
---|
| 58 | * ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 59 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
| 60 | * ã§ããå½¢ã§åé
|
---|
| 61 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 62 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 63 | ã
|
---|
| 64 | * ãã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿
|
---|
| 65 | * 証è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 66 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
| 67 | * ã§ããªãå½¢ã§åé
|
---|
| 68 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
| 69 | * (a) åé
|
---|
| 70 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 71 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½
|
---|
| 72 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 73 | * (b) åé
|
---|
| 74 | å¸ã®å½¢æ
|
---|
| 75 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«å ±
|
---|
| 76 | * åãããã¨ï¼
|
---|
| 77 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害
|
---|
| 78 | * ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 79 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 80 | 責ãããã¨ï¼ã¾ãï¼
|
---|
| 81 | * æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãçç±ã«åºã¥
|
---|
| 82 | * ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 83 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 84 | 責ãããã¨ï¼
|
---|
| 85 | *
|
---|
| 86 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 87 | ãã
|
---|
| 88 | * ã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®çã«å¯¾ã
|
---|
| 89 | * ãé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨
|
---|
| 90 | * ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè²
|
---|
| 91 | * ããªãï¼
|
---|
| 92 | *
|
---|
| 93 | * @(#) $Id: cpu_config.h,v 1.1 2006/04/10 08:19:25 honda Exp $
|
---|
| 94 | */
|
---|
| 95 |
|
---|
| 96 | /*
|
---|
| 97 | * ããã»ããµä¾åã¢ã¸ã¥ã¼ã«ï¼TLCS-900L1ç¨ï¼
|
---|
| 98 | *
|
---|
| 99 | * ãã®ã¤ã³ã¯ã«ã¼ããã¡ã¤ã«ã¯ï¼t_config.h ã®ã¿ããã¤ã³ã¯ã«ã¼ããããï¼
|
---|
| 100 | * ä»ã®ãã¡ã¤ã«ããç´æ¥ã¤ã³ã¯ã«ã¼ããã¦ã¯ãªããªãï¼
|
---|
| 101 | */
|
---|
| 102 |
|
---|
| 103 | #ifndef _CPU_CONFIG_H_
|
---|
| 104 | #define _CPU_CONFIG_H_
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | * ã«ã¼ãã«ã®å
|
---|
| 108 | é¨èå¥åã®ãªãã¼ã
|
---|
| 109 | */
|
---|
| 110 | #include <cpu_rename.h>
|
---|
| 111 |
|
---|
| 112 | /*
|
---|
| 113 | * ããã»ããµã®ç¹æ®å½ä»¤ã®ã¤ã³ã©ã¤ã³é¢æ°å®ç¾©
|
---|
| 114 | */
|
---|
| 115 | #ifndef _MACRO_ONLY
|
---|
| 116 | #include <cpu_insn.h>
|
---|
| 117 | #endif /* _MACRO_ONLY */
|
---|
| 118 |
|
---|
| 119 | /*
|
---|
| 120 | * chg_ipm/get_ipm ããµãã¼ããããã©ããã®å®ç¾©
|
---|
| 121 | */
|
---|
| 122 | #define SUPPORT_CHG_IPM
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | * TCB ä¸ã®ãã£ã¼ã«ãã®ãããå¹
|
---|
| 126 | ã®å®ç¾©
|
---|
| 127 | *
|
---|
| 128 | * cpu_context.h ã«å
|
---|
| 129 | ¥ããæ¹ãã¨ã¬ã¬ã³ãã ãï¼åç
|
---|
| 130 | §ã®ä¾åæ§ã®é¢ä¿ã§ï¼
|
---|
| 131 | * cpu_context.h ã«ã¯å
|
---|
| 132 | ¥ããããªãï¼
|
---|
| 133 | */
|
---|
| 134 | #define TBIT_TCB_TSTAT 8 /* tstat ãã£ã¼ã«ãã®ãããå¹
|
---|
| 135 | */
|
---|
| 136 | #define TBIT_TCB_PRIORITY 4 /* priority ãã£ã¼ã«ãã®ãããå¹
|
---|
| 137 | */
|
---|
| 138 |
|
---|
| 139 | #ifndef _MACRO_ONLY
|
---|
| 140 | /*
|
---|
| 141 | * ã¿ã¹ã¯ã³ã³ããã¹ããããã¯ã®å®ç¾©
|
---|
| 142 | */
|
---|
| 143 | typedef struct task_context_block {
|
---|
| 144 | VP xsp; /* ã¹ã¿ãã¯ãã¤ã³ã¿ */
|
---|
| 145 | FP pc; /* ããã°ã©ã ã«ã¦ã³ã¿ */
|
---|
| 146 | } CTXB;
|
---|
| 147 |
|
---|
| 148 | /*
|
---|
| 149 | * å²è¾¼ã¿/CPUä¾å¤ãã¹ãã«ã¦ã³ã¿
|
---|
| 150 | */
|
---|
| 151 | extern UINT intcnt;
|
---|
| 152 |
|
---|
| 153 | /*
|
---|
| 154 | * å²è¾¼ã¿ãã¹ã¯æä½ã©ã¤ãã©ãª
|
---|
| 155 | *
|
---|
| 156 | * å²è¾¼ã¿ãã¹ã¯ï¼intmaskï¼ã¯ï¼IPMï¼Interrupt Priority Maskï¼ã12ããã
|
---|
| 157 | * å·¦ã«ã·ãããããã®ã§ããï¼
|
---|
| 158 | */
|
---|
| 159 |
|
---|
| 160 | /*
|
---|
| 161 | * ç¾å¨ã®å²è¾¼ã¿ãã¹ã¯ã®èªåºã
|
---|
| 162 | */
|
---|
| 163 | #pragma inline current_intmask
|
---|
| 164 | UH
|
---|
| 165 | current_intmask()
|
---|
| 166 | {
|
---|
| 167 | return(current_sr() & 0x7000);
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | /*
|
---|
| 171 | * å²è¾¼ã¿ãã¹ã¯ã®è¨å®
|
---|
| 172 | */
|
---|
| 173 | #pragma inline set_intmask
|
---|
| 174 | void
|
---|
| 175 | set_intmask(UH intmask)
|
---|
| 176 | {
|
---|
| 177 | set_sr((current_sr() & ~0x7000) | intmask);
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | /*
|
---|
| 181 | * ã·ã¹ãã ç¶æ
|
---|
| 182 | åç
|
---|
| 183 | §
|
---|
| 184 | */
|
---|
| 185 |
|
---|
| 186 | #pragma inline sense_context
|
---|
| 187 | BOOL
|
---|
| 188 | sense_context()
|
---|
| 189 | {
|
---|
| 190 | Asm(" ldc hl, intnest");
|
---|
| 191 | return __HL;
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | #pragma inline sense_lock
|
---|
| 195 | BOOL
|
---|
| 196 | sense_lock()
|
---|
| 197 | {
|
---|
| 198 | return(current_intmask() == 0x7000);
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 | #define t_sense_lock sense_lock
|
---|
| 202 | #define i_sense_lock sense_lock
|
---|
| 203 |
|
---|
| 204 | /*
|
---|
| 205 | * CPUããã¯ã¨ãã®è§£é¤ï¼ã¿ã¹ã¯ã³ã³ããã¹ãç¨ï¼
|
---|
| 206 | *
|
---|
| 207 | * task_intmask ã¯ï¼chg_ipm ããµãã¼ãããããã®å¤æ°ï¼chg_ipm ããµãã¼
|
---|
| 208 | * ãããªãå ´åã«ã¯ï¼task_intmask ã常㫠0 ã«ãªã£ã¦ããã¨èããã°ããï¼
|
---|
| 209 | */
|
---|
| 210 |
|
---|
| 211 | #ifdef SUPPORT_CHG_IPM
|
---|
| 212 | extern UH task_intmask; /* ã¿ã¹ã¯ã³ã³ããã¹ãã§ã®å²è¾¼ã¿ãã¹ã¯ */
|
---|
| 213 | #endif /* SUPPORT_CHG_IPM */
|
---|
| 214 |
|
---|
| 215 | #pragma inline t_lock_cpu
|
---|
| 216 | void
|
---|
| 217 | t_lock_cpu()
|
---|
| 218 | {
|
---|
| 219 | disint();
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | #pragma inline t_unlock_cpu
|
---|
| 223 | void
|
---|
| 224 | t_unlock_cpu()
|
---|
| 225 | {
|
---|
| 226 | #ifdef SUPPORT_CHG_IPM
|
---|
| 227 | /*
|
---|
| 228 | * t_unlock_cpu ãå¼ã³åºãããã®ã¯ CPUããã¯ç¶æ
|
---|
| 229 | ã®ã¿ã§ããã
|
---|
| 230 | * ãï¼å¦çã®éä¸ã§ task_intmask ãæ¸ãæãããã¨ã¯ãªãï¼
|
---|
| 231 | */
|
---|
| 232 | set_intmask(task_intmask);
|
---|
| 233 | #else /* SUPPORT_CHG_IPM */
|
---|
| 234 | enaint();
|
---|
| 235 | #endif /* SUPPORT_CHG_IPM */
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 | /*
|
---|
| 239 | * CPUããã¯ã¨ãã®è§£é¤ï¼éã¿ã¹ã¯ã³ã³ããã¹ãç¨ï¼
|
---|
| 240 | */
|
---|
| 241 |
|
---|
| 242 | extern UH int_intmask; /* éã¿ã¹ã¯ã³ã³ããã¹ãã§ã®å²è¾¼ã¿ãã¹ã¯ */
|
---|
| 243 |
|
---|
| 244 | #pragma inline i_lock_cpu
|
---|
| 245 | void
|
---|
| 246 | i_lock_cpu()
|
---|
| 247 | {
|
---|
| 248 | UH intmask;
|
---|
| 249 |
|
---|
| 250 | /*
|
---|
| 251 | * ä¸æå¤æ° intmask ã使ã£ã¦ããã®ã¯ï¼current_intmask() ãå¼
|
---|
| 252 | * ãã ç´å¾ã«å²è¾¼ã¿ãçºçãï¼èµ·åãããå²è¾¼ã¿ãã³ãã©å
|
---|
| 253 | ã§
|
---|
| 254 | * int_intmask ãå¤æ´ãããå¯è½æ§ãããããã§ããï¼
|
---|
| 255 | */
|
---|
| 256 | intmask = current_intmask();
|
---|
| 257 | disint();
|
---|
| 258 | int_intmask = intmask;
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | #pragma inline i_unlock_cpu
|
---|
| 262 | void
|
---|
| 263 | i_unlock_cpu()
|
---|
| 264 | {
|
---|
| 265 | set_intmask(int_intmask);
|
---|
| 266 | }
|
---|
| 267 |
|
---|
| 268 | /*
|
---|
| 269 | * ã¿ã¹ã¯ãã£ã¹ãããã£
|
---|
| 270 | */
|
---|
| 271 |
|
---|
| 272 | /*
|
---|
| 273 | * æé«åªå
|
---|
| 274 | é ä½ã¿ã¹ã¯ã¸ã®ãã£ã¹ãããï¼cpu_support.asmï¼
|
---|
| 275 | *
|
---|
| 276 | * dispatch ã¯ï¼ã¿ã¹ã¯ã³ã³ããã¹ãããå¼ã³åºããããµã¼ãã¹ã³ã¼ã«å¦ç
|
---|
| 277 | * å
|
---|
| 278 | ã§ï¼CPUããã¯ç¶æ
|
---|
| 279 | ã§å¼ã³åºããªããã°ãªããªãï¼
|
---|
| 280 | */
|
---|
| 281 | extern void dispatch(void);
|
---|
| 282 |
|
---|
| 283 | /*
|
---|
| 284 | * ç¾å¨ã®ã³ã³ããã¹ããæ¨ã¦ã¦ãã£ã¹ãããï¼cpu_support.asmï¼
|
---|
| 285 | *
|
---|
| 286 | * exit_and_dispatch ã¯ï¼CPUããã¯ç¶æ
|
---|
| 287 | ã§å¼ã³åºããªããã°ãªããªãï¼
|
---|
| 288 | */
|
---|
| 289 | extern void exit_and_dispatch(void);
|
---|
| 290 |
|
---|
| 291 | /*
|
---|
| 292 | * å²è¾¼ã¿ãã³ãã©ï¼CPUä¾å¤ãã³ãã©ã®è¨å®
|
---|
| 293 | */
|
---|
| 294 |
|
---|
| 295 | /*
|
---|
| 296 | * å²è¾¼ã¿ãã³ãã©ã®è¨å®
|
---|
| 297 | *
|
---|
| 298 | * ãã¯ãã«çªå· inhno ã®å²è¾¼ã¿ãã³ãã©ã®èµ·åçªå°ã inthdr ã«è¨å®ããï¼
|
---|
| 299 | * å²è¾¼ã¿ãã³ãã©ãç»é²ãããã¯ã¿ãã¼ãã«ã¯ROMä¸ã«åã,
|
---|
| 300 | * ããã«æ¸ãè¾¼ã. ãã®ããããã§ã¯ä½ãããªãï¼
|
---|
| 301 | */
|
---|
| 302 |
|
---|
| 303 | #pragma inline define_inh
|
---|
| 304 | void
|
---|
| 305 | define_inh(INHNO inhno, FP inthdr)
|
---|
| 306 | {
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | /*
|
---|
| 310 | * CPUä¾å¤ãã³ãã©ã®è¨å®
|
---|
| 311 | *
|
---|
| 312 | * ãã¯ãã«çªå· excno ã®CPUä¾å¤ãã³ãã©ã®èµ·åçªå°ã exchdr ã«è¨å®ããï¼
|
---|
| 313 | * å²è¾¼ã¿ãã³ãã©ãç»é²ãããã¯ã¿ãã¼ãã«ã¯ROMä¸ã«åã,
|
---|
| 314 | * ããã«æ¸ãè¾¼ã. ãã®ããããã§ã¯ä½ãããªãï¼
|
---|
| 315 | */
|
---|
| 316 | #pragma inline define_exc
|
---|
| 317 | void
|
---|
| 318 | define_exc(EXCNO excno, FP exchdr)
|
---|
| 319 | {
|
---|
| 320 | }
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | /*
|
---|
| 324 | * å²è¾¼ã¿ãã³ãã©ï¼CPUä¾å¤ãã³ãã©ã®åºå
|
---|
| 325 | ¥å£å¦ç
|
---|
| 326 | */
|
---|
| 327 |
|
---|
| 328 | /*
|
---|
| 329 | * å²è¾¼ã¿ãã³ãã©ã®å
|
---|
| 330 | ¥å£å¦çã®çæãã¯ã
|
---|
| 331 | *
|
---|
| 332 | * å²è¾¼ã¿çºçæã®ã¹ã¿ãã¯ã®åãæ¿ããã½ããã¦ã§ã¢ã§å®ç¾ããï¼ãã®ããï¼
|
---|
| 333 | * å²è¾¼ã¿ãã³ãã©å
|
---|
| 334 | ¥ãå£ã«ã¦å²è¾¼ã¿ç¦æ¢å¦çãè¡ãï¼ãªãï¼å²è¾¼ã¿çºçãã
|
---|
| 335 | * å²è¾¼ã¿ç¦æ¢ãè¡ãã¾ã§ã®éã«å¤éå²è¾¼ã¿ãçºçããã¨ï¼å¤éå²è¾¼ã¿ã§ãã
|
---|
| 336 | * ãã¨ãã½ããã¦ã§ã¢ã§æ¤ç¥ã§ããªãããï¼æåã«çºçããå²è¾¼ã¿å¦çãå®
|
---|
| 337 | * è¡ããªãã¾ã¾ã¿ã¹ã¯ãã£ã¹ãããããå¯è½æ§ãããï¼ãã®å¤éå²è¾¼ã¿ãæ¤
|
---|
| 338 | * ç¥ããããã«ãã¼ãã¦ã§ã¢ INTNEST ã¬ã¸ã¹ã¿ãå©ç¨ããï¼
|
---|
| 339 | *
|
---|
| 340 | * TLCS-900 Family C Compiler ã§ã¯ XIZ ã¬ã¸ã¹ã¿ä»¥å¤ã¯å
|
---|
| 341 | ¨ã¦ã¹ã¯ã©ããã¬
|
---|
| 342 | * ã¸ã¹ã¿ã§ããï¼ãªãï¼å
|
---|
| 343 | ¥ãå£å¦çã§ä½¿ç¨ããã¹ã¯ã©ããã¬ã¸ã¹ã¿ã®ã¿ãã
|
---|
| 344 | * ãã§ä¿æãï¼æ®ãã¯å²è¾¼ã¿å
|
---|
| 345 | ±éå¦çã§ä¿æããï¼
|
---|
| 346 | *
|
---|
| 347 | * ãããä¿®æ£ããå ´åã¯ï¼ä¸ã®CPUä¾å¤ãã³ãã©å
|
---|
| 348 | ¥å£å¦ççæãã¯ããåæ§ã«
|
---|
| 349 | * ä¿®æ£ãããã¨ï¼
|
---|
| 350 | */
|
---|
| 351 | #define INTHDR_ENTRY(inthdr) \
|
---|
| 352 | extern void _kernel_interrupt(void); \
|
---|
| 353 | extern void inthdr##(void); \
|
---|
| 354 | void inthdr##_entry(void) \
|
---|
| 355 | { \
|
---|
| 356 | Asm(" push xwa "); /* 使ç¨ããã¹ã¯ã©ããã¬ã¸ã¹ã¿ãä¿å */ \
|
---|
| 357 | Asm(" push sr"); /* å²è¾¼ã¿çºçæã®IFFãåå¾ */ \
|
---|
| 358 | Asm(" pop wa"); \
|
---|
| 359 | Asm(" ei 7"); /* å²è¾¼ã¿ç¦æ¢ */ \
|
---|
| 360 | Asm(" push xhl "); /* 使ç¨ããã¹ã¯ã©ããã¬ã¸ã¹ã¿ãä¿å */ \
|
---|
| 361 | Asm(" ld xhl, _" #inthdr ); /* ã¦ã¼ã¶ãã³ãã©ãã¤ã³ã¿ãåå¾ */ \
|
---|
| 362 | Asm(" jp __kernel_interrupt" ); /* å²è¾¼ã¿å
|
---|
| 363 | ±éå¦ç㸠*/ \
|
---|
| 364 | }
|
---|
| 365 | /*
|
---|
| 366 | * ä¸è¨ãä¿®æ£ããå ´åã¯ï¼ä¸ã®CPUä¾å¤ãã³ãã©å
|
---|
| 367 | ¥å£å¦ççæãã¯ããåæ§ã«
|
---|
| 368 | * ä¿®æ£ãããã¨ï¼
|
---|
| 369 | */
|
---|
| 370 |
|
---|
| 371 |
|
---|
| 372 | #define INT_ENTRY(inthdr) inthdr##_entry
|
---|
| 373 |
|
---|
| 374 | /*
|
---|
| 375 | * CPUä¾å¤ãã³ãã©ã®åºå
|
---|
| 376 | ¥å£å¦çã®çæãã¯ã
|
---|
| 377 | *
|
---|
| 378 | * CPUä¾å¤ãã³ãã©ã¯ï¼éã¿ã¹ã¯ã³ã³ããã¹ãã§å®è¡ããï¼
|
---|
| 379 | * CPUä¾å¤ãã³ãã©ã¯ï¼å²è¾¼ã¿ãã³ãã©ã¨åçå¦çã¨ããï¼
|
---|
| 380 | * ãªãï¼ä¾å¤ãã³ãã©ã®å¼æ°åãç°ãªãããï¼åçå¦çã®ãã¯ããå¥é
|
---|
| 381 | * çæããï¼
|
---|
| 382 | *
|
---|
| 383 | * ãããä¿®æ£ããå ´åã¯ï¼ä¸ã®å²è¾¼ã¿ãã³ãã©å
|
---|
| 384 | ¥å£å¦ççæãã¯ããåæ§ã«
|
---|
| 385 | * ä¿®æ£ãããã¨ï¼
|
---|
| 386 | */
|
---|
| 387 |
|
---|
| 388 | #define EXCHDR_ENTRY(exchdr) \
|
---|
| 389 | extern void _kernel_interrupt(void); \
|
---|
| 390 | extern void exchdr##(VP p_excinf); \
|
---|
| 391 | void exchdr##_entry(void) \
|
---|
| 392 | { \
|
---|
| 393 | Asm(" push xwa "); /* 使ç¨ããã¹ã¯ã©ããã¬ã¸ã¹ã¿ãä¿å */ \
|
---|
| 394 | Asm(" push sr"); /* å²è¾¼ã¿çºçæã®IFFãåå¾ */ \
|
---|
| 395 | Asm(" pop wa"); \
|
---|
| 396 | Asm(" ei 7"); /* å²è¾¼ã¿ç¦æ¢ */ \
|
---|
| 397 | Asm(" push xhl "); /* 使ç¨ããã¹ã¯ã©ããã¬ã¸ã¹ã¿ãä¿å */ \
|
---|
| 398 | Asm(" ld xhl, _" #exchdr ); /* ã¦ã¼ã¶ãã³ãã©ãã¤ã³ã¿ãåå¾ */ \
|
---|
| 399 | Asm(" jp __kernel_interrupt" ); /* å²è¾¼ã¿å
|
---|
| 400 | ±éå¦ç㸠*/ \
|
---|
| 401 | }
|
---|
| 402 | /*
|
---|
| 403 | * ãããä¿®æ£ããå ´åã¯ï¼ä¸ã®å²è¾¼ã¿ãã³ãã©å
|
---|
| 404 | ¥å£å¦ççæãã¯ããåæ§ã«
|
---|
| 405 | * ä¿®æ£ãããã¨ï¼
|
---|
| 406 | */
|
---|
| 407 |
|
---|
| 408 | #define EXC_ENTRY(exchdr) exchdr##_entry
|
---|
| 409 |
|
---|
| 410 |
|
---|
| 411 | /*
|
---|
| 412 | * CPUä¾å¤ã®çºçããæã®ã·ã¹ãã ç¶æ
|
---|
| 413 | ã®åç
|
---|
| 414 | §
|
---|
| 415 | */
|
---|
| 416 |
|
---|
| 417 | /*
|
---|
| 418 | * CPUä¾å¤ã®çºçããæã®ã³ã³ããã¹ãã®åç
|
---|
| 419 | §
|
---|
| 420 | */
|
---|
| 421 | #pragma inline exc_sense_context
|
---|
| 422 | BOOL
|
---|
| 423 | exc_sense_context(VP p_excinf)
|
---|
| 424 | {
|
---|
| 425 | Asm(" ldc hl, intnest");
|
---|
| 426 | return ( __HL > 1 );
|
---|
| 427 | }
|
---|
| 428 |
|
---|
| 429 | /*
|
---|
| 430 | * CPUä¾å¤ã®çºçããæã®CPUããã¯ç¶æ
|
---|
| 431 | ã®åç
|
---|
| 432 | §
|
---|
| 433 | */
|
---|
| 434 | #pragma inline exc_sense_lock
|
---|
| 435 | BOOL
|
---|
| 436 | exc_sense_lock(VP p_excinf)
|
---|
| 437 | {
|
---|
| 438 | return ((*((UH *) p_excinf) & 0x7000) == 0x7000);
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | /*
|
---|
| 442 | * ããã»ããµä¾åã®åæå
|
---|
| 443 | */
|
---|
| 444 | extern void cpu_initialize(void);
|
---|
| 445 |
|
---|
| 446 | /*
|
---|
| 447 | * ããã»ããµä¾åã®çµäºæå¦ç
|
---|
| 448 | */
|
---|
| 449 | extern void cpu_terminate(void);
|
---|
| 450 |
|
---|
| 451 | #endif /* _MACRO_ONLY */
|
---|
| 452 | #endif /* _CPU_CONFIG_H_ */
|
---|