1 | /*
|
---|
2 | * TOPPERS/JSP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Just Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000,2001 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | * Copyright (C) 2002 by Monami software, Limited Partners.
|
---|
9 | * Copyright (C) 2002 by MURANAKA Masaki
|
---|
10 | * Copyright (C) 2008- by Monami Software Limited Partnership, JAPAN
|
---|
11 | *
|
---|
12 | * ä¸è¨è使¨©è
|
---|
13 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
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 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
46 | * å
|
---|
47 | 責ãããã¨ï¼
|
---|
48 | *
|
---|
49 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
50 | ã
|
---|
51 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
52 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
53 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ã
|
---|
54 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
55 | *
|
---|
56 | * @(#) $Id: sys_support.S,v 1.1 2004/07/21 02:49:37 monaka Exp $
|
---|
57 | */
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * ã¿ã¼ã²ããã·ã¹ãã ä¾åã¢ã¸ã¥ã¼ã« ã¢ã»ã³ããªè¨èªé¨ï¼PC/ATç¨ï¼
|
---|
61 | */
|
---|
62 |
|
---|
63 | #define _MACRO_ONLY
|
---|
64 | #include "jsp_kernel.h"
|
---|
65 | #include "offset.h"
|
---|
66 |
|
---|
67 | /*
|
---|
68 | * ä½ã¬ãã«ã®ã¿ã¼ã²ããã·ã¹ãã ä¾åã®åæå
|
---|
69 | *
|
---|
70 | * ã¹ã¿ã¼ãã¢ããã¢ã¸ã¥ã¼ã«ã®ä¸ã§ï¼ã¡ã¢ãªã®åæåã®åã«å¼ã³åºãããï¼
|
---|
71 | */
|
---|
72 | .text
|
---|
73 | .globl hardware_init_hook
|
---|
74 | hardware_init_hook:
|
---|
75 | movl %cr0, %eax
|
---|
76 | andl $~0x60000000, %eax
|
---|
77 | movl %eax, %cr0 /* CD = 0, NW = 0 */
|
---|
78 | ret;
|
---|
79 |
|
---|
80 | #define CALL_HANDLER(x) incl nest; sti; call x; cli; decl nest
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * å²è¾¼ã¿ãã³ãã©ã®åºå
|
---|
84 | ¥å£å¦ç
|
---|
85 | *
|
---|
86 | * å²è¾¼ã¿çªå·ã%ecxã«å
|
---|
87 | ¥ãã¦å¼ã³åºãããã
|
---|
88 | */
|
---|
89 | .text
|
---|
90 | interrupt:
|
---|
91 | cld
|
---|
92 | cmpl $0, nest
|
---|
93 | jne interrupt_2 /* å
|
---|
94 | å´ã®ãã³ãã© */
|
---|
95 | /* å¤å´ã®ãã³ãã© */
|
---|
96 | movl %esp, %eax
|
---|
97 | movl STACKTOP, %esp
|
---|
98 | pushl %eax
|
---|
99 | interrupt_2:
|
---|
100 | pushl %ecx /* intno */
|
---|
101 | movl int_table(,%ecx,4), %eax
|
---|
102 | testl %eax, %eax
|
---|
103 | jz 0f
|
---|
104 | CALL_HANDLER(*%eax)
|
---|
105 | 0:
|
---|
106 | popl %eax /* intno */
|
---|
107 | testb $8, %al
|
---|
108 | jz 1f
|
---|
109 | movb $0x20, %al
|
---|
110 | outb %al, $0xa0 /* slave non-specific EOI */
|
---|
111 | 1:
|
---|
112 | movb $0x20, %al
|
---|
113 | outb %al, $0x20 /* master non-specific EOI */
|
---|
114 | cmpl $0, nest
|
---|
115 | jne interrupt_3
|
---|
116 | popl %eax
|
---|
117 | movl %eax, %esp
|
---|
118 | cmpl $0, reqflg
|
---|
119 | je interrupt_3
|
---|
120 | ret_int:
|
---|
121 | movl $0, reqflg
|
---|
122 | cmpl $0, enadsp
|
---|
123 | je ret_int_r
|
---|
124 | movl runtsk, %ebx
|
---|
125 | cmpl %ebx, schedtsk
|
---|
126 | je ret_int_r
|
---|
127 | movl %esp, TCB_esp(%ebx)
|
---|
128 | movl $ret_int_r, %eax
|
---|
129 | movl %eax, TCB_eip(%ebx)
|
---|
130 | jmp dispatch_loop
|
---|
131 | ret_int_r:
|
---|
132 | call calltex
|
---|
133 | interrupt_3:
|
---|
134 | popa
|
---|
135 | iret
|
---|
136 |
|
---|
137 | #define interrupt(intno) \
|
---|
138 | .global interrupt##intno ; \
|
---|
139 | interrupt##intno: ; \
|
---|
140 | pusha ; \
|
---|
141 | movl $intno, %ecx ; \
|
---|
142 | jmp interrupt
|
---|
143 |
|
---|
144 | interrupt(0)
|
---|
145 | interrupt(1)
|
---|
146 | interrupt(2)
|
---|
147 | interrupt(3)
|
---|
148 | interrupt(4)
|
---|
149 | interrupt(5)
|
---|
150 | interrupt(6)
|
---|
151 | interrupt(7)
|
---|
152 | interrupt(8)
|
---|
153 | interrupt(9)
|
---|
154 | interrupt(10)
|
---|
155 | interrupt(11)
|
---|
156 | interrupt(12)
|
---|
157 | interrupt(13)
|
---|
158 | interrupt(14)
|
---|
159 | interrupt(15)
|
---|