Rev 479 | Rev 521 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 479 | Rev 506 | ||
---|---|---|---|
1 | $Revision: 479 $ |
1 | $Revision: 506 $ |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
3 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; MenuetOS process management, protected ring3 ;; |
8 | ;; MenuetOS process management, protected ring3 ;; |
9 | ;; ;; |
9 | ;; ;; |
10 | ;; Distributed under GPL. See file COPYING for details. ;; |
10 | ;; Distributed under GPL. See file COPYING for details. ;; |
11 | ;; Copyright 2003 Ville Turjanmaa ;; |
11 | ;; Copyright 2003 Ville Turjanmaa ;; |
12 | ;; ;; |
12 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14 | 14 | ||
15 | align 4 |
15 | align 4 |
16 | idtreg: |
16 | idtreg: |
17 | dw 8*0x41-1 |
17 | dw 8*0x41-1 |
18 | dd idts+8 |
18 | dd idts+8 |
19 | 19 | ||
20 | build_interrupt_table: |
20 | build_interrupt_table: |
21 | 21 | ||
22 | mov edi, idts+8 |
22 | mov edi, idts+8 |
23 | mov esi, sys_int |
23 | mov esi, sys_int |
24 | mov ecx, 0x40 |
24 | mov ecx, 0x40 |
25 | @@: |
25 | @@: |
26 | lodsd |
26 | lodsd |
27 | mov [edi], ax ; lower part of offset |
27 | mov [edi], ax ; lower part of offset |
28 | mov [edi+2], word os_code ; segment selector |
28 | mov [edi+2], word os_code ; segment selector |
29 | mov ax, word 10001110b shl 8 ; type: interrupt gate |
29 | mov ax, word 10001110b shl 8 ; type: interrupt gate |
30 | mov [edi+4], eax |
30 | mov [edi+4], eax |
31 | add edi, 8 |
31 | add edi, 8 |
32 | loop @b |
32 | loop @b |
33 | 33 | ||
34 | ;mov edi,8*0x40+idts+8 |
34 | ;mov edi,8*0x40+idts+8 |
35 | mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16) |
35 | mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16) |
36 | mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000) |
36 | mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000) |
37 | ; type: trap gate |
37 | ; type: trap gate |
38 | ret |
38 | ret |
39 | 39 | ||
40 | iglobal |
40 | iglobal |
41 | sys_int: |
41 | sys_int: |
42 | dd e0,debug_exc,e2,e3 |
42 | dd e0,debug_exc,e2,e3 |
43 | dd e4,e5,e6,e7 |
43 | dd e4,e5,e6,e7 |
44 | dd e8,e9,e10,e11 |
44 | dd e8,e9,e10,e11 |
45 | dd e12,e13,page_fault_handler,e15 |
45 | dd e12,e13,page_fault_handler,e15 |
46 | 46 | ||
47 | dd except_16, e17,e18, except_19 |
47 | dd except_16, e17,e18, except_19 |
48 | times 12 dd unknown_interrupt |
48 | times 12 dd unknown_interrupt |
49 | 49 | ||
50 | dd irq0 , irq_serv.irq_1, p_irq2 , p_irq3 ;irq_serv.irq_3 |
50 | dd irq0 , irq_serv.irq_1, p_irq2 , p_irq3 ;irq_serv.irq_3 |
51 | dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7 |
51 | dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7 |
52 | dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 |
52 | dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 |
53 | dd irq_serv.irq_11,irq_serv.irq_12,irqD ,p_irq14,p_irq15 |
53 | dd irq_serv.irq_11,irq_serv.irq_12,irqD ,p_irq14,p_irq15 |
54 | 54 | ||
55 | times 16 dd unknown_interrupt |
55 | times 16 dd unknown_interrupt |
56 | 56 | ||
57 | dd i40 |
57 | dd i40 |
58 | endg |
58 | endg |
59 | 59 | ||
60 | macro save_ring3_context |
60 | macro save_ring3_context |
61 | { |
61 | { |
62 | pushad |
62 | pushad |
63 | } |
63 | } |
64 | macro restore_ring3_context |
64 | macro restore_ring3_context |
65 | { |
65 | { |
66 | popad |
66 | popad |
67 | } |
67 | } |
68 | 68 | ||
69 | ; simply return control to interrupted process |
69 | ; simply return control to interrupted process |
70 | unknown_interrupt: |
70 | unknown_interrupt: |
71 | iret |
71 | iret |
72 | 72 | ||
73 | macro exc_wo_code [num] |
73 | macro exc_wo_code [num] |
74 | { |
74 | { |
75 | forward |
75 | forward |
76 | e#num : |
76 | e#num : |
77 | save_ring3_context |
77 | save_ring3_context |
78 | mov bl, num |
78 | mov bl, num |
79 | jmp exc_c |
79 | jmp exc_c |
80 | } |
80 | } |
81 | 81 | ||
82 | macro exc_w_code [num] |
82 | macro exc_w_code [num] |
83 | { |
83 | { |
84 | forward |
84 | forward |
85 | e#num : |
85 | e#num : |
86 | add esp, 4 |
86 | add esp, 4 |
87 | save_ring3_context |
87 | save_ring3_context |
88 | mov bl, num |
88 | mov bl, num |
89 | jmp exc_c |
89 | jmp exc_c |
90 | } |
90 | } |
91 | 91 | ||
92 | exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 18 |
92 | exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 18 |
93 | exc_w_code 8, 10, 11, 12, 13, 14, 17 |
93 | exc_w_code 8, 10, 11, 12, 13, 14, 17 |
94 | 94 | ||
95 | exc_c: |
95 | exc_c: |
96 | mov ax, app_data ;èñêëþ÷åíèå |
96 | mov ax, app_data ;èñêëþ÷åíèå |
97 | mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè |
97 | mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè |
98 | mov es, ax ;â ðåãèñòðû |
98 | mov es, ax ;â ðåãèñòðû |
99 | 99 | ||
100 | ; test if debugging |
100 | ; test if debugging |
101 | cli |
101 | cli |
102 | mov eax, [current_slot] |
102 | mov eax, [current_slot] |
103 | mov eax, [eax+APPDATA.debugger_slot] |
103 | mov eax, [eax+APPDATA.debugger_slot] |
104 | test eax, eax |
104 | test eax, eax |
105 | jnz .debug |
105 | jnz .debug |
106 | sti |
106 | sti |
107 | ; not debuggee => say error and terminate |
107 | ; not debuggee => say error and terminate |
108 | add esp, 0x20 ;28h |
108 | add esp, 0x20 ;28h |
109 | movzx eax, bl |
109 | movzx eax, bl |
110 | mov [error_interrupt], eax |
110 | mov [error_interrupt], eax |
111 | call show_error_parameters |
111 | call show_error_parameters |
112 | 112 | ||
113 | mov edx, [TASK_BASE] |
113 | mov edx, [TASK_BASE] |
114 | mov [edx + TASKDATA.state], byte 4 |
114 | mov [edx + TASKDATA.state], byte 4 |
115 | 115 | ||
116 | jmp change_task |
116 | jmp change_task |
117 | 117 | ||
118 | .debug: |
118 | .debug: |
119 | ; we are debugged process, notify debugger and suspend ourself |
119 | ; we are debugged process, notify debugger and suspend ourself |
120 | ; eax=debugger PID |
120 | ; eax=debugger PID |
121 | cld |
121 | cld |
122 | movzx ecx, bl |
122 | movzx ecx, bl |
123 | push ecx |
123 | push ecx |
124 | mov ecx, [TASK_BASE] |
124 | mov ecx, [TASK_BASE] |
125 | push dword [ecx+TASKDATA.pid] ; PID of current process |
125 | push dword [ecx+TASKDATA.pid] ; PID of current process |
126 | push 12 |
126 | push 12 |
127 | pop ecx |
127 | pop ecx |
128 | push 1 ; 1=exception |
128 | push 1 ; 1=exception |
129 | call debugger_notify |
129 | call debugger_notify |
130 | pop ecx |
130 | pop ecx |
131 | pop ecx |
131 | pop ecx |
132 | pop ecx |
132 | pop ecx |
133 | mov edx, [TASK_BASE] |
133 | mov edx, [TASK_BASE] |
134 | mov byte [edx+TASKDATA.state], 1 ; suspended |
134 | mov byte [edx+TASKDATA.state], 1 ; suspended |
135 | call change_task |
135 | call change_task |
136 | restore_ring3_context |
136 | restore_ring3_context |
137 | iretd |
137 | iretd |
138 | 138 | ||
139 | writehex: |
139 | writehex: |
140 | pusha |
140 | pusha |
141 | 141 | ||
142 | mov edi, [write_error_to] |
142 | mov edi, [write_error_to] |
143 | mov esi, 8 |
143 | mov esi, 8 |
144 | @@: |
144 | @@: |
145 | mov ecx, eax |
145 | mov ecx, eax |
146 | and ecx, 0xf |
146 | and ecx, 0xf |
147 | 147 | ||
148 | mov cl,[ecx+hexletters] |
148 | mov cl,[ecx+hexletters] |
149 | mov [edi],cl |
149 | mov [edi],cl |
150 | dec edi |
150 | dec edi |
151 | 151 | ||
152 | shr eax,4 |
152 | shr eax,4 |
153 | dec esi |
153 | dec esi |
154 | jnz @b |
154 | jnz @b |
155 | 155 | ||
156 | popa |
156 | popa |
157 | ret |
157 | ret |
158 | 158 | ||
159 | iglobal |
159 | iglobal |
160 | hexletters db '0123456789ABCDEF' |
160 | hexletters db '0123456789ABCDEF' |
161 | 161 | ||
162 | error_interrupt dd -1 |
162 | error_interrupt dd -1 |
163 | 163 | ||
164 | process_error db 'K : Process - forced terminate INT: 00000000',13,10,0 |
164 | process_error db 'K : Process - forced terminate INT: 00000000',13,10,0 |
165 | process_pid db 'K : Process - forced terminate PID: 00000000',13,10,0 |
165 | process_pid db 'K : Process - forced terminate PID: 00000000',13,10,0 |
166 | process_eip db 'K : Process - forced terminate EIP: 00000000',13,10,0 |
166 | process_eip db 'K : Process - forced terminate EIP: 00000000',13,10,0 |
167 | system_error db 'K : Kernel error',13,10,0 |
167 | system_error db 'K : Kernel error',13,10,0 |
168 | endg |
168 | endg |
169 | 169 | ||
170 | uglobal |
170 | uglobal |
171 | write_error_to dd 0x0 |
171 | write_error_to dd 0x0 |
172 | endg |
172 | endg |
173 | 173 | ||
174 | show_error_parameters: |
174 | show_error_parameters: |
175 | 175 | ||
176 | mov [write_error_to],process_pid+43 |
176 | mov [write_error_to],process_pid+43 |
177 | mov eax,[CURRENT_TASK] |
177 | mov eax,[CURRENT_TASK] |
178 | shl eax, 5 |
178 | shl eax, 5 |
179 | mov eax,[CURRENT_TASK+TASKDATA.pid+eax] |
179 | mov eax,[CURRENT_TASK+TASKDATA.pid+eax] |
180 | call writehex |
180 | call writehex |
181 | 181 | ||
182 | mov [write_error_to],process_error+43 |
182 | mov [write_error_to],process_error+43 |
183 | mov eax,[error_interrupt] |
183 | mov eax,[error_interrupt] |
184 | call writehex |
184 | call writehex |
185 | 185 | ||
186 | cmp dword [esp+4+4], os_code ; CS |
186 | cmp dword [esp+4+4], os_code ; CS |
187 | jnz @f |
187 | jnz @f |
188 | mov esi,system_error |
188 | ;mov esi,system_error |
189 | call sys_msg_board_str |
189 | ;call sys_msg_board_str |
- | 190 | DEBUGF 1,"%s",system_error |
|
190 | @@: |
191 | @@: |
191 | mov eax, [esp+4] ; EIP |
192 | mov eax, [esp+4] ; EIP |
192 | 193 | ||
193 | mov [write_error_to],process_eip+43 |
194 | mov [write_error_to],process_eip+43 |
194 | call writehex |
195 | call writehex |
195 | 196 | ||
196 | mov esi,process_error |
197 | ;mov esi,process_error |
- | 198 | ;call sys_msg_board_str |
|
197 | call sys_msg_board_str |
199 | DEBUGF 1,"%s",process_error |
198 | 200 | ||
199 | mov esi,process_pid |
201 | ;mov esi,process_pid |
- | 202 | ;call sys_msg_board_str |
|
200 | call sys_msg_board_str |
203 | DEBUGF 1,"%s",process_pid |
201 | 204 | ||
202 | mov esi,process_eip |
205 | ;mov esi,process_eip |
- | 206 | ;call sys_msg_board_str |
|
203 | call sys_msg_board_str |
207 | DEBUGF 1,"%s",process_eip |
204 | 208 | ||
205 | ret |
209 | ret |
206 | 210 | ||
207 | 211 | ||
208 | 212 | ||
209 | ; irq1 -> hid/keyboard.inc |
213 | ; irq1 -> hid/keyboard.inc |
210 | 214 | ||
211 | 215 | ||
212 | macro irqh [num] |
216 | macro irqh [num] |
213 | { |
217 | { |
214 | forward |
218 | forward |
215 | p_irq#num : |
219 | p_irq#num : |
216 | save_ring3_context |
220 | save_ring3_context |
217 | mov edi, num |
221 | mov edi, num |
218 | jmp irq_c |
222 | jmp irq_c |
219 | } |
223 | } |
220 | 224 | ||
221 | irqh 2,5,7,8,9,10,11 |
225 | irqh 2,5,7,8,9,10,11 |
222 | 226 | ||
223 | irq_c: |
227 | irq_c: |
224 | mov ax, app_data ;os_data |
228 | mov ax, app_data ;os_data |
225 | mov ds, ax |
229 | mov ds, ax |
226 | mov es, ax |
230 | mov es, ax |
227 | call irqhandler |
231 | call irqhandler |
228 | restore_ring3_context |
232 | restore_ring3_context |
229 | iret |
233 | iret |
230 | 234 | ||
231 | p_irq6: |
235 | p_irq6: |
232 | save_ring3_context |
236 | save_ring3_context |
233 | mov ax, app_data ;os_data |
237 | mov ax, app_data ;os_data |
234 | mov ds, ax |
238 | mov ds, ax |
235 | mov es, ax |
239 | mov es, ax |
236 | call fdc_irq |
240 | call fdc_irq |
237 | call ready_for_next_irq |
241 | call ready_for_next_irq |
238 | restore_ring3_context |
242 | restore_ring3_context |
239 | iret |
243 | iret |
240 | 244 | ||
241 | p_irq3: |
245 | p_irq3: |
242 | save_ring3_context |
246 | save_ring3_context |
243 | mov ax, app_data ;os_data |
247 | mov ax, app_data ;os_data |
244 | mov ds, ax |
248 | mov ds, ax |
245 | mov es, ax |
249 | mov es, ax |
246 | cmp [com2_mouse_detected],0 |
250 | cmp [com2_mouse_detected],0 |
247 | je old_irq3_handler |
251 | je old_irq3_handler |
248 | mov esi, com2_mouse |
252 | mov esi, com2_mouse |
249 | mov dx, 2F8h ;[COMPortBaseAddr] |
253 | mov dx, 2F8h ;[COMPortBaseAddr] |
250 | call check_mouse_data_com |
254 | call check_mouse_data_com |
251 | jmp p_irq3_1 |
255 | jmp p_irq3_1 |
252 | old_irq3_handler: |
256 | old_irq3_handler: |
253 | mov edi,3 |
257 | mov edi,3 |
254 | call irqhandler |
258 | call irqhandler |
255 | p_irq3_1: |
259 | p_irq3_1: |
256 | restore_ring3_context |
260 | restore_ring3_context |
257 | iret |
261 | iret |
258 | 262 | ||
259 | p_irq4: |
263 | p_irq4: |
260 | save_ring3_context |
264 | save_ring3_context |
261 | mov ax, app_data ;os_data |
265 | mov ax, app_data ;os_data |
262 | mov ds, ax |
266 | mov ds, ax |
263 | mov es, ax |
267 | mov es, ax |
264 | cmp [com1_mouse_detected],0 |
268 | cmp [com1_mouse_detected],0 |
265 | je old_irq4_handler |
269 | je old_irq4_handler |
266 | mov esi, com1_mouse |
270 | mov esi, com1_mouse |
267 | mov dx, 3F8h ;[COMPortBaseAddr] |
271 | mov dx, 3F8h ;[COMPortBaseAddr] |
268 | call check_mouse_data_com |
272 | call check_mouse_data_com |
269 | jmp p_irq4_1 |
273 | jmp p_irq4_1 |
270 | old_irq4_handler: |
274 | old_irq4_handler: |
271 | mov edi,4 |
275 | mov edi,4 |
272 | call irqhandler |
276 | call irqhandler |
273 | p_irq4_1: |
277 | p_irq4_1: |
274 | restore_ring3_context |
278 | restore_ring3_context |
275 | iret |
279 | iret |
276 | 280 | ||
277 | p_irq14: |
281 | p_irq14: |
278 | save_ring3_context |
282 | save_ring3_context |
279 | mov ax, app_data ;os_data |
283 | mov ax, app_data ;os_data |
280 | mov ds, ax |
284 | mov ds, ax |
281 | mov es, ax |
285 | mov es, ax |
282 | call [irq14_func] |
286 | call [irq14_func] |
283 | call ready_for_next_irq_1 |
287 | call ready_for_next_irq_1 |
284 | restore_ring3_context |
288 | restore_ring3_context |
285 | iret |
289 | iret |
286 | p_irq15: |
290 | p_irq15: |
287 | save_ring3_context |
291 | save_ring3_context |
288 | mov ax, app_data ;os_data |
292 | mov ax, app_data ;os_data |
289 | mov ds, ax |
293 | mov ds, ax |
290 | mov es, ax |
294 | mov es, ax |
291 | call [irq15_func] |
295 | call [irq15_func] |
292 | call ready_for_next_irq_1 |
296 | call ready_for_next_irq_1 |
293 | restore_ring3_context |
297 | restore_ring3_context |
294 | iret |
298 | iret |
295 | 299 | ||
296 | ready_for_next_irq: |
300 | ready_for_next_irq: |
297 | mov [check_idle_semaphore],5 |
301 | mov [check_idle_semaphore],5 |
298 | mov al, 0x20 |
302 | mov al, 0x20 |
299 | out 0x20, al |
303 | out 0x20, al |
300 | ret |
304 | ret |
301 | 305 | ||
302 | ready_for_next_irq_1: |
306 | ready_for_next_irq_1: |
303 | mov [check_idle_semaphore],5 |
307 | mov [check_idle_semaphore],5 |
304 | mov al, 0x20 |
308 | mov al, 0x20 |
305 | out 0xa0,al |
309 | out 0xa0,al |
306 | out 0x20, al |
310 | out 0x20, al |
307 | ret |
311 | ret |
308 | 312 | ||
309 | irqD: |
313 | irqD: |
310 | save_ring3_context |
314 | save_ring3_context |
311 | mov ax, app_data ;os_data |
315 | mov ax, app_data ;os_data |
312 | mov ds, ax |
316 | mov ds, ax |
313 | mov es, ax |
317 | mov es, ax |
314 | 318 | ||
315 | mov dx,0xf0 |
319 | mov dx,0xf0 |
316 | mov al,0 |
320 | mov al,0 |
317 | out dx,al |
321 | out dx,al |
318 | 322 | ||
319 | mov dx,0xa0 |
323 | mov dx,0xa0 |
320 | mov al,0x20 |
324 | mov al,0x20 |
321 | out dx,al |
325 | out dx,al |
322 | mov dx,0x20 |
326 | mov dx,0x20 |
323 | out dx,al |
327 | out dx,al |
324 | 328 | ||
325 | restore_ring3_context |
329 | restore_ring3_context |
326 | 330 | ||
327 | iret |
331 | iret |
328 | 332 | ||
329 | 333 | ||
330 | irqhandler: |
334 | irqhandler: |
331 | 335 | ||
332 | push edi |
336 | push edi |
333 | 337 | ||
334 | mov esi,edi ; 1 |
338 | mov esi,edi ; 1 |
335 | shl esi,6 ; 1 |
339 | shl esi,6 ; 1 |
336 | add esi,irq00read ; 1 |
340 | add esi,irq00read ; 1 |
337 | shl edi,12 ; 1 |
341 | shl edi,12 ; 1 |
338 | add edi,IRQ_SAVE |
342 | add edi,IRQ_SAVE |
339 | mov ecx,16 |
343 | mov ecx,16 |
340 | 344 | ||
341 | mov [check_idle_semaphore],5 |
345 | mov [check_idle_semaphore],5 |
342 | 346 | ||
343 | irqnewread: |
347 | irqnewread: |
344 | dec ecx |
348 | dec ecx |
345 | js irqover |
349 | js irqover |
346 | 350 | ||
347 | mov dx,[esi] ; 2+ |
351 | mov dx,[esi] ; 2+ |
348 | 352 | ||
349 | cmp dx,0 ; 1 |
353 | cmp dx,0 ; 1 |
350 | jz irqover |
354 | jz irqover |
351 | cmp [esi+3],byte 1 ; 2 ; byte read |
355 | cmp [esi+3],byte 1 ; 2 ; byte read |
352 | jne noirqbyte ; 4-11 |
356 | jne noirqbyte ; 4-11 |
353 | 357 | ||
354 | in al,dx |
358 | in al,dx |
355 | 359 | ||
356 | mov edx,[edi] |
360 | mov edx,[edi] |
357 | cmp edx,4000 |
361 | cmp edx,4000 |
358 | je irqfull |
362 | je irqfull |
359 | mov ebx,edi |
363 | mov ebx,edi |
360 | add ebx,0x10 |
364 | add ebx,0x10 |
361 | add ebx,edx |
365 | add ebx,edx |
362 | mov [ebx],al |
366 | mov [ebx],al |
363 | inc edx |
367 | inc edx |
364 | mov [edi],edx |
368 | mov [edi],edx |
365 | 369 | ||
366 | add esi,4 |
370 | add esi,4 |
367 | jmp irqnewread |
371 | jmp irqnewread |
368 | 372 | ||
369 | noirqbyte: |
373 | noirqbyte: |
370 | 374 | ||
371 | 375 | ||
372 | cmp [esi+3],byte 2 ; word read |
376 | cmp [esi+3],byte 2 ; word read |
373 | jne noirqword |
377 | jne noirqword |
374 | 378 | ||
375 | in ax,dx |
379 | in ax,dx |
376 | 380 | ||
377 | mov edx,[edi] |
381 | mov edx,[edi] |
378 | cmp edx,4000 |
382 | cmp edx,4000 |
379 | je irqfull |
383 | je irqfull |
380 | mov ebx,edi |
384 | mov ebx,edi |
381 | add ebx,0x10 |
385 | add ebx,0x10 |
382 | add ebx,edx |
386 | add ebx,edx |
383 | mov [ebx],ax |
387 | mov [ebx],ax |
384 | add edx,2 |
388 | add edx,2 |
385 | mov [edi],edx |
389 | mov [edi],edx |
386 | add esi,4 |
390 | add esi,4 |
387 | jmp irqnewread |
391 | jmp irqnewread |
388 | 392 | ||
389 | noirqword: |
393 | noirqword: |
390 | irqfull: |
394 | irqfull: |
391 | irqover: |
395 | irqover: |
392 | 396 | ||
393 | mov al,0x20 ; ready for next irq |
397 | mov al,0x20 ; ready for next irq |
394 | out 0x20,al |
398 | out 0x20,al |
395 | 399 | ||
396 | pop ebx |
400 | pop ebx |
397 | cmp ebx,7 |
401 | cmp ebx,7 |
398 | jbe noa0 |
402 | jbe noa0 |
399 | out 0xa0,al |
403 | out 0xa0,al |
400 | noa0: |
404 | noa0: |
401 | 405 | ||
402 | ret |
406 | ret |
403 | 407 | ||
404 | 408 | ||
405 | 409 | ||
406 | set_application_table_status: |
410 | set_application_table_status: |
407 | push eax |
411 | push eax |
408 | 412 | ||
409 | mov eax,[CURRENT_TASK] |
413 | mov eax,[CURRENT_TASK] |
410 | shl eax, 5 |
414 | shl eax, 5 |
411 | add eax,CURRENT_TASK+TASKDATA.pid |
415 | add eax,CURRENT_TASK+TASKDATA.pid |
412 | mov eax,[eax] |
416 | mov eax,[eax] |
413 | 417 | ||
414 | mov [application_table_status],eax |
418 | mov [application_table_status],eax |
415 | 419 | ||
416 | pop eax |
420 | pop eax |
417 | 421 | ||
418 | ret |
422 | ret |
419 | 423 | ||
420 | 424 | ||
421 | clear_application_table_status: |
425 | clear_application_table_status: |
422 | push eax |
426 | push eax |
423 | 427 | ||
424 | mov eax,[CURRENT_TASK] |
428 | mov eax,[CURRENT_TASK] |
425 | shl eax, 5 |
429 | shl eax, 5 |
426 | add eax,CURRENT_TASK+TASKDATA.pid |
430 | add eax,CURRENT_TASK+TASKDATA.pid |
427 | mov eax,[eax] |
431 | mov eax,[eax] |
428 | 432 | ||
429 | cmp eax,[application_table_status] |
433 | cmp eax,[application_table_status] |
430 | jne apptsl1 |
434 | jne apptsl1 |
431 | mov [application_table_status],0 |
435 | mov [application_table_status],0 |
432 | apptsl1: |
436 | apptsl1: |
433 | 437 | ||
434 | pop eax |
438 | pop eax |
435 | 439 | ||
436 | ret |
440 | ret |
437 | 441 | ||
438 | sys_resize_app_memory: |
442 | sys_resize_app_memory: |
439 | ; eax = 1 - resize |
443 | ; eax = 1 - resize |
440 | ; ebx = new amount of memory |
444 | ; ebx = new amount of memory |
441 | 445 | ||
442 | cmp eax,1 |
446 | cmp eax,1 |
443 | jne .no_application_mem_resize |
447 | jne .no_application_mem_resize |
444 | 448 | ||
445 | stdcall new_mem_resize, ebx |
449 | stdcall new_mem_resize, ebx |
446 | mov [esp+36], eax |
450 | mov [esp+36], eax |
447 | ret |
451 | ret |
448 | 452 | ||
449 | .no_application_mem_resize: |
453 | .no_application_mem_resize: |
450 | ret |
454 | ret |
451 | 455 | ||
452 | sys_threads: |
456 | sys_threads: |
453 | 457 | ||
454 | ; eax=1 create thread |
458 | ; eax=1 create thread |
455 | ; |
459 | ; |
456 | ; ebx=thread start |
460 | ; ebx=thread start |
457 | ; ecx=thread stack value |
461 | ; ecx=thread stack value |
458 | ; |
462 | ; |
459 | ; on return : eax = pid |
463 | ; on return : eax = pid |
460 | jmp new_sys_threads |
464 | jmp new_sys_threads |
461 | 465 | ||
462 | iglobal |
466 | iglobal |
463 | process_terminating db 'K : Process - terminating',13,10,0 |
467 | process_terminating db 'K : Process - terminating',13,10,0 |
464 | process_terminated db 'K : Process - done',13,10,0 |
468 | process_terminated db 'K : Process - done',13,10,0 |
465 | msg_obj_destroy db 'K : destroy app object',13,10,0 |
469 | msg_obj_destroy db 'K : destroy app object',13,10,0 |
466 | endg |
470 | endg |
467 | 471 | ||
468 | ; param |
472 | ; param |
469 | ; esi= slot |
473 | ; esi= slot |
470 | 474 | ||
471 | terminate: ; terminate application |
475 | terminate: ; terminate application |
472 | 476 | ||
473 | .slot equ esp ;locals |
477 | .slot equ esp ;locals |
474 | 478 | ||
475 | push esi ;save .slot |
479 | push esi ;save .slot |
476 | 480 | ||
477 | shl esi, 8 |
481 | shl esi, 8 |
478 | cmp [SLOT_BASE+esi+APPDATA.dir_table], 0 |
482 | cmp [SLOT_BASE+esi+APPDATA.dir_table], 0 |
479 | jne @F |
483 | jne @F |
480 | add esp, 4 |
484 | add esp, 4 |
481 | ret |
485 | ret |
482 | @@: |
486 | @@: |
483 | mov esi,process_terminating |
487 | ;mov esi,process_terminating |
484 | call sys_msg_board_str |
488 | ;call sys_msg_board_str |
- | 489 | DEBUGF 1,"%s",process_terminating |
|
485 | @@: |
490 | @@: |
486 | cli |
491 | cli |
487 | cmp [application_table_status],0 |
492 | cmp [application_table_status],0 |
488 | je term9 |
493 | je term9 |
489 | sti |
494 | sti |
490 | call change_task |
495 | call change_task |
491 | jmp @b |
496 | jmp @b |
492 | term9: |
497 | term9: |
493 | call set_application_table_status |
498 | call set_application_table_status |
494 | 499 | ||
495 | mov esi, [.slot] |
500 | mov esi, [.slot] |
496 | shl esi,8 |
501 | shl esi,8 |
497 | add esi, SLOT_BASE+APP_OBJ_OFFSET |
502 | add esi, SLOT_BASE+APP_OBJ_OFFSET |
498 | @@: |
503 | @@: |
499 | mov eax, [esi+APPOBJ.fd] |
504 | mov eax, [esi+APPOBJ.fd] |
500 | test eax, eax |
505 | test eax, eax |
501 | jz @F |
506 | jz @F |
502 | 507 | ||
503 | cmp eax, esi |
508 | cmp eax, esi |
504 | je @F |
509 | je @F |
505 | 510 | ||
506 | push esi |
511 | push esi |
507 | call [eax+APPOBJ.destroy] |
512 | call [eax+APPOBJ.destroy] |
508 | mov esi, msg_obj_destroy |
513 | ;mov esi, msg_obj_destroy |
509 | call sys_msg_board_str |
514 | ;call sys_msg_board_str |
- | 515 | DEBUGF 1,"%s",msg_obj_destroy |
|
510 | pop esi |
516 | pop esi |
511 | jmp @B |
517 | jmp @B |
512 | @@: |
518 | @@: |
513 | mov eax, [.slot] |
519 | mov eax, [.slot] |
514 | shl eax, 8 |
520 | shl eax, 8 |
515 | mov eax,[SLOT_BASE+eax+APPDATA.dir_table] |
521 | mov eax,[SLOT_BASE+eax+APPDATA.dir_table] |
516 | stdcall destroy_app_space, eax |
522 | stdcall destroy_app_space, eax |
517 | 523 | ||
518 | mov esi, [.slot] |
524 | mov esi, [.slot] |
519 | cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 |
525 | cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 |
520 | jne @F |
526 | jne @F |
521 | 527 | ||
522 | mov [fpu_owner],1 |
528 | mov [fpu_owner],1 |
523 | mov eax, [256+SLOT_BASE+APPDATA.fpu_state] |
529 | mov eax, [256+SLOT_BASE+APPDATA.fpu_state] |
524 | clts |
530 | clts |
525 | bt [cpu_caps], CAPS_SSE |
531 | bt [cpu_caps], CAPS_SSE |
526 | jnc .no_SSE |
532 | jnc .no_SSE |
527 | fxrstor [eax] |
533 | fxrstor [eax] |
528 | jmp @F |
534 | jmp @F |
529 | .no_SSE: |
535 | .no_SSE: |
530 | fnclex |
536 | fnclex |
531 | frstor [eax] |
537 | frstor [eax] |
532 | @@: |
538 | @@: |
533 | 539 | ||
534 | mov [KEY_COUNT],byte 0 ; empty keyboard buffer |
540 | mov [KEY_COUNT],byte 0 ; empty keyboard buffer |
535 | mov [BTN_COUNT],byte 0 ; empty button buffer |
541 | mov [BTN_COUNT],byte 0 ; empty button buffer |
536 | 542 | ||
537 | 543 | ||
538 | ; remove defined hotkeys |
544 | ; remove defined hotkeys |
539 | mov eax, hotkey_list |
545 | mov eax, hotkey_list |
540 | .loop: |
546 | .loop: |
541 | cmp [eax+8], esi |
547 | cmp [eax+8], esi |
542 | jnz .cont |
548 | jnz .cont |
543 | mov ecx, [eax] |
549 | mov ecx, [eax] |
544 | jecxz @f |
550 | jecxz @f |
545 | push dword [eax+12] |
551 | push dword [eax+12] |
546 | pop dword [ecx+12] |
552 | pop dword [ecx+12] |
547 | @@: |
553 | @@: |
548 | mov ecx, [eax+12] |
554 | mov ecx, [eax+12] |
549 | push dword [eax] |
555 | push dword [eax] |
550 | pop dword [ecx] |
556 | pop dword [ecx] |
551 | xor ecx, ecx |
557 | xor ecx, ecx |
552 | mov [eax], ecx |
558 | mov [eax], ecx |
553 | mov [eax+4], ecx |
559 | mov [eax+4], ecx |
554 | mov [eax+8], ecx |
560 | mov [eax+8], ecx |
555 | mov [eax+12], ecx |
561 | mov [eax+12], ecx |
556 | .cont: |
562 | .cont: |
557 | add eax, 16 |
563 | add eax, 16 |
558 | cmp eax, hotkey_list+256*16 |
564 | cmp eax, hotkey_list+256*16 |
559 | jb .loop |
565 | jb .loop |
560 | ; remove hotkeys in buffer |
566 | ; remove hotkeys in buffer |
561 | mov eax, hotkey_buffer |
567 | mov eax, hotkey_buffer |
562 | .loop2: |
568 | .loop2: |
563 | cmp [eax], esi |
569 | cmp [eax], esi |
564 | jnz .cont2 |
570 | jnz .cont2 |
565 | and dword [eax+4], 0 |
571 | and dword [eax+4], 0 |
566 | and dword [eax], 0 |
572 | and dword [eax], 0 |
567 | .cont2: |
573 | .cont2: |
568 | add eax, 8 |
574 | add eax, 8 |
569 | cmp eax, hotkey_buffer+120*8 |
575 | cmp eax, hotkey_buffer+120*8 |
570 | jb .loop2 |
576 | jb .loop2 |
571 | 577 | ||
572 | mov ecx,esi ; remove buttons |
578 | mov ecx,esi ; remove buttons |
573 | bnewba2: |
579 | bnewba2: |
574 | mov edi,[BTN_ADDR] |
580 | mov edi,[BTN_ADDR] |
575 | mov eax,edi |
581 | mov eax,edi |
576 | cld |
582 | cld |
577 | movzx ebx,word [edi] |
583 | movzx ebx,word [edi] |
578 | inc bx |
584 | inc bx |
579 | bnewba: |
585 | bnewba: |
580 | dec bx |
586 | dec bx |
581 | jz bnmba |
587 | jz bnmba |
582 | add eax,0x10 |
588 | add eax,0x10 |
583 | cmp cx,[eax] |
589 | cmp cx,[eax] |
584 | jnz bnewba |
590 | jnz bnewba |
585 | pusha |
591 | pusha |
586 | mov ecx,ebx |
592 | mov ecx,ebx |
587 | inc ecx |
593 | inc ecx |
588 | shl ecx,4 |
594 | shl ecx,4 |
589 | mov ebx,eax |
595 | mov ebx,eax |
590 | add eax,0x10 |
596 | add eax,0x10 |
591 | call memmove |
597 | call memmove |
592 | dec dword [edi] |
598 | dec dword [edi] |
593 | popa |
599 | popa |
594 | jmp bnewba2 |
600 | jmp bnewba2 |
595 | bnmba: |
601 | bnmba: |
596 | 602 | ||
597 | pusha ; save window coordinates for window restoring |
603 | pusha ; save window coordinates for window restoring |
598 | cld |
604 | cld |
599 | shl esi,5 |
605 | shl esi,5 |
600 | add esi,window_data |
606 | add esi,window_data |
601 | mov eax,[esi+WDATA.box.left] |
607 | mov eax,[esi+WDATA.box.left] |
602 | mov [dlx],eax |
608 | mov [dlx],eax |
603 | add eax,[esi+WDATA.box.width] |
609 | add eax,[esi+WDATA.box.width] |
604 | mov [dlxe],eax |
610 | mov [dlxe],eax |
605 | mov eax,[esi+WDATA.box.top] |
611 | mov eax,[esi+WDATA.box.top] |
606 | mov [dly],eax |
612 | mov [dly],eax |
607 | add eax,[esi+WDATA.box.height] |
613 | add eax,[esi+WDATA.box.height] |
608 | mov [dlye],eax |
614 | mov [dlye],eax |
609 | 615 | ||
610 | xor eax, eax |
616 | xor eax, eax |
611 | mov [esi+WDATA.box.left],eax |
617 | mov [esi+WDATA.box.left],eax |
612 | mov [esi+WDATA.box.width],eax |
618 | mov [esi+WDATA.box.width],eax |
613 | mov [esi+WDATA.box.top],eax |
619 | mov [esi+WDATA.box.top],eax |
614 | mov [esi+WDATA.box.height],eax |
620 | mov [esi+WDATA.box.height],eax |
615 | mov [esi+WDATA.cl_workarea],eax |
621 | mov [esi+WDATA.cl_workarea],eax |
616 | mov [esi+WDATA.cl_titlebar],eax |
622 | mov [esi+WDATA.cl_titlebar],eax |
617 | mov [esi+WDATA.cl_frames],eax |
623 | mov [esi+WDATA.cl_frames],eax |
618 | mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn |
624 | mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn |
619 | lea edi, [esi-window_data+draw_data] |
625 | lea edi, [esi-window_data+draw_data] |
620 | mov ecx,32/4 |
626 | mov ecx,32/4 |
621 | rep stosd |
627 | rep stosd |
622 | popa |
628 | popa |
623 | 629 | ||
624 | ; debuggee test |
630 | ; debuggee test |
625 | pushad |
631 | pushad |
626 | mov edi, esi |
632 | mov edi, esi |
627 | shl edi, 5 |
633 | shl edi, 5 |
628 | mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] |
634 | mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] |
629 | test eax, eax |
635 | test eax, eax |
630 | jz .nodebug |
636 | jz .nodebug |
631 | push 8 |
637 | push 8 |
632 | pop ecx |
638 | pop ecx |
633 | push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID |
639 | push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID |
634 | push 2 |
640 | push 2 |
635 | call debugger_notify |
641 | call debugger_notify |
636 | pop ecx |
642 | pop ecx |
637 | pop ecx |
643 | pop ecx |
638 | .nodebug: |
644 | .nodebug: |
639 | popad |
645 | popad |
640 | 646 | ||
641 | mov ebx, [.slot] |
647 | mov ebx, [.slot] |
642 | shl ebx, 8 |
648 | shl ebx, 8 |
643 | mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] |
649 | mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] |
644 | 650 | ||
645 | stdcall kernel_free, ebx |
651 | stdcall kernel_free, ebx |
646 | 652 | ||
647 | mov edi, [.slot] |
653 | mov edi, [.slot] |
648 | shl edi,8 |
654 | shl edi,8 |
649 | add edi,SLOT_BASE |
655 | add edi,SLOT_BASE |
650 | 656 | ||
651 | mov eax, [edi+APPDATA.io_map] |
657 | mov eax, [edi+APPDATA.io_map] |
652 | cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) |
658 | cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) |
653 | je @F |
659 | je @F |
654 | call free_page |
660 | call free_page |
655 | @@: |
661 | @@: |
656 | mov eax, [edi+APPDATA.io_map+4] |
662 | mov eax, [edi+APPDATA.io_map+4] |
657 | cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) |
663 | cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) |
658 | je @F |
664 | je @F |
659 | call free_page |
665 | call free_page |
660 | @@: |
666 | @@: |
661 | mov eax, 0x20202020 |
667 | mov eax, 0x20202020 |
662 | stosd |
668 | stosd |
663 | stosd |
669 | stosd |
664 | stosd |
670 | stosd |
665 | mov ecx,244/4 |
671 | mov ecx,244/4 |
666 | xor eax, eax |
672 | xor eax, eax |
667 | rep stosd |
673 | rep stosd |
668 | 674 | ||
669 | ; activate window |
675 | ; activate window |
670 | movzx eax, word [WIN_STACK + esi*2] |
676 | movzx eax, word [WIN_STACK + esi*2] |
671 | cmp eax, [TASK_COUNT] |
677 | cmp eax, [TASK_COUNT] |
672 | jne .dont_activate |
678 | jne .dont_activate |
673 | pushad |
679 | pushad |
674 | .check_next_window: |
680 | .check_next_window: |
675 | dec eax |
681 | dec eax |
676 | cmp eax, 1 |
682 | cmp eax, 1 |
677 | jbe .nothing_to_activate |
683 | jbe .nothing_to_activate |
678 | lea esi, [WIN_POS+eax*2] |
684 | lea esi, [WIN_POS+eax*2] |
679 | movzx edi, word [esi] ; edi = process |
685 | movzx edi, word [esi] ; edi = process |
680 | shl edi, 5 |
686 | shl edi, 5 |
681 | cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots |
687 | cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots |
682 | je .check_next_window |
688 | je .check_next_window |
683 | add edi, window_data |
689 | add edi, window_data |
684 | ; \begin{diamond}[19.09.2006] |
690 | ; \begin{diamond}[19.09.2006] |
685 | ; skip minimized windows |
691 | ; skip minimized windows |
686 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
692 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
687 | jnz .check_next_window |
693 | jnz .check_next_window |
688 | ; \end{diamond} |
694 | ; \end{diamond} |
689 | call waredraw |
695 | call waredraw |
690 | .nothing_to_activate: |
696 | .nothing_to_activate: |
691 | popad |
697 | popad |
692 | .dont_activate: |
698 | .dont_activate: |
693 | 699 | ||
694 | push esi ; remove hd1 & cd & flp reservation |
700 | push esi ; remove hd1 & cd & flp reservation |
695 | shl esi, 5 |
701 | shl esi, 5 |
696 | mov esi, [esi+CURRENT_TASK+TASKDATA.pid] |
702 | mov esi, [esi+CURRENT_TASK+TASKDATA.pid] |
697 | cmp [hd1_status], esi |
703 | cmp [hd1_status], esi |
698 | jnz @f |
704 | jnz @f |
699 | call free_hd_channel |
705 | call free_hd_channel |
700 | mov [hd1_status], 0 |
706 | mov [hd1_status], 0 |
701 | @@: |
707 | @@: |
702 | cmp [cd_status], esi |
708 | cmp [cd_status], esi |
703 | jnz @f |
709 | jnz @f |
704 | call free_cd_channel |
710 | call free_cd_channel |
705 | mov [cd_status], 0 |
711 | mov [cd_status], 0 |
706 | @@: |
712 | @@: |
707 | cmp [flp_status], esi |
713 | cmp [flp_status], esi |
708 | jnz @f |
714 | jnz @f |
709 | mov [flp_status], 0 |
715 | mov [flp_status], 0 |
710 | @@: |
716 | @@: |
711 | pop esi |
717 | pop esi |
712 | 718 | ||
713 | pusha ; remove all irq reservations |
719 | pusha ; remove all irq reservations |
714 | mov eax,esi |
720 | mov eax,esi |
715 | shl eax, 5 |
721 | shl eax, 5 |
716 | mov eax,[eax+CURRENT_TASK+TASKDATA.pid] |
722 | mov eax,[eax+CURRENT_TASK+TASKDATA.pid] |
717 | mov edi,irq_owner |
723 | mov edi,irq_owner |
718 | mov ecx,16 |
724 | mov ecx,16 |
719 | newirqfree: |
725 | newirqfree: |
720 | scasd |
726 | scasd |
721 | jne nofreeirq |
727 | jne nofreeirq |
722 | mov [edi-4],dword 0 |
728 | mov [edi-4],dword 0 |
723 | nofreeirq: |
729 | nofreeirq: |
724 | loop newirqfree |
730 | loop newirqfree |
725 | popa |
731 | popa |
726 | 732 | ||
727 | pusha ; remove all port reservations |
733 | pusha ; remove all port reservations |
728 | mov edx,esi |
734 | mov edx,esi |
729 | shl edx, 5 |
735 | shl edx, 5 |
730 | add edx,CURRENT_TASK |
736 | add edx,CURRENT_TASK |
731 | mov edx,[edx+TASKDATA.pid] |
737 | mov edx,[edx+TASKDATA.pid] |
732 | 738 | ||
733 | rmpr0: |
739 | rmpr0: |
734 | 740 | ||
735 | mov esi,[RESERVED_PORTS] |
741 | mov esi,[RESERVED_PORTS] |
736 | 742 | ||
737 | cmp esi,0 |
743 | cmp esi,0 |
738 | je rmpr9 |
744 | je rmpr9 |
739 | 745 | ||
740 | rmpr3: |
746 | rmpr3: |
741 | 747 | ||
742 | mov edi,esi |
748 | mov edi,esi |
743 | shl edi,4 |
749 | shl edi,4 |
744 | add edi,RESERVED_PORTS |
750 | add edi,RESERVED_PORTS |
745 | 751 | ||
746 | cmp edx,[edi] |
752 | cmp edx,[edi] |
747 | je rmpr4 |
753 | je rmpr4 |
748 | 754 | ||
749 | dec esi |
755 | dec esi |
750 | jnz rmpr3 |
756 | jnz rmpr3 |
751 | 757 | ||
752 | jmp rmpr9 |
758 | jmp rmpr9 |
753 | 759 | ||
754 | rmpr4: |
760 | rmpr4: |
755 | 761 | ||
756 | mov ecx,256 |
762 | mov ecx,256 |
757 | sub ecx,esi |
763 | sub ecx,esi |
758 | shl ecx,4 |
764 | shl ecx,4 |
759 | 765 | ||
760 | mov esi,edi |
766 | mov esi,edi |
761 | add esi,16 |
767 | add esi,16 |
762 | cld |
768 | cld |
763 | rep movsb |
769 | rep movsb |
764 | 770 | ||
765 | dec dword [RESERVED_PORTS] |
771 | dec dword [RESERVED_PORTS] |
766 | 772 | ||
767 | jmp rmpr0 |
773 | jmp rmpr0 |
768 | 774 | ||
769 | rmpr9: |
775 | rmpr9: |
770 | 776 | ||
771 | popa |
777 | popa |
772 | mov edi,esi ; do not run this process slot |
778 | mov edi,esi ; do not run this process slot |
773 | shl edi, 5 |
779 | shl edi, 5 |
774 | mov [edi+CURRENT_TASK + TASKDATA.state],byte 9 |
780 | mov [edi+CURRENT_TASK + TASKDATA.state],byte 9 |
775 | ; debugger test - terminate all debuggees |
781 | ; debugger test - terminate all debuggees |
776 | mov eax, 2 |
782 | mov eax, 2 |
777 | mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot |
783 | mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot |
778 | .xd0: |
784 | .xd0: |
779 | cmp eax, [TASK_COUNT] |
785 | cmp eax, [TASK_COUNT] |
780 | ja .xd1 |
786 | ja .xd1 |
781 | cmp dword [ecx], esi |
787 | cmp dword [ecx], esi |
782 | jnz @f |
788 | jnz @f |
783 | and dword [ecx], 0 |
789 | and dword [ecx], 0 |
784 | pushad |
790 | pushad |
785 | xchg eax, ebx |
791 | xchg eax, ebx |
786 | mov eax, 2 |
792 | mov eax, 2 |
787 | call sys_system |
793 | call sys_system |
788 | popad |
794 | popad |
789 | @@: |
795 | @@: |
790 | inc eax |
796 | inc eax |
791 | add ecx, 0x100 |
797 | add ecx, 0x100 |
792 | jmp .xd0 |
798 | jmp .xd0 |
793 | .xd1: |
799 | .xd1: |
794 | ; call systest |
800 | ; call systest |
795 | sti ; .. and life goes on |
801 | sti ; .. and life goes on |
796 | 802 | ||
797 | mov eax, [dlx] |
803 | mov eax, [dlx] |
798 | mov ebx, [dly] |
804 | mov ebx, [dly] |
799 | mov ecx, [dlxe] |
805 | mov ecx, [dlxe] |
800 | mov edx, [dlye] |
806 | mov edx, [dlye] |
801 | call calculatescreen |
807 | call calculatescreen |
802 | xor eax, eax |
808 | xor eax, eax |
803 | xor esi, esi |
809 | xor esi, esi |
804 | call redrawscreen |
810 | call redrawscreen |
805 | 811 | ||
806 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
812 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
807 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
813 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
808 | 814 | ||
809 | mov [application_table_status],0 |
815 | mov [application_table_status],0 |
810 | mov esi,process_terminated |
816 | ;mov esi,process_terminated |
811 | call sys_msg_board_str |
817 | ;call sys_msg_board_str |
- | 818 | DEBUGF 1,"%s",process_terminated |
|
812 | add esp, 4 |
819 | add esp, 4 |
813 | ret |
820 | ret |
814 | restore .slot |
821 | restore .slot |
815 | 822 | ||
816 | iglobal |
823 | iglobal |
817 | boot_sched_1 db 'Building gdt tss pointer',0 |
824 | boot_sched_1 db 'Building gdt tss pointer',0 |
818 | boot_sched_2 db 'Building IDT table',0 |
825 | boot_sched_2 db 'Building IDT table',0 |
819 | endg |
826 | endg |
820 | 827 | ||
821 | 828 | ||
822 | build_scheduler: |
829 | build_scheduler: |
823 | 830 | ||
824 | mov esi,boot_sched_1 |
831 | mov esi,boot_sched_1 |
825 | call boot_log |
832 | call boot_log |
826 | ; call build_process_gdt_tss_pointer |
833 | ; call build_process_gdt_tss_pointer |
827 | 834 | ||
828 | ; mov esi,boot_sched_2 |
835 | ; mov esi,boot_sched_2 |
829 | ; call boot_log |
836 | ; call boot_log |
830 | 837 | ||
831 | ret |
838 | ret |