Rev 465 | Rev 479 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 465 | Rev 473 | ||
---|---|---|---|
1 | $Revision: 465 $ |
1 | $Revision: 473 $ |
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 irq_serv.irq_4 ,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,p_irq12,irqD ,p_irq14,p_irq15 |
53 | dd irq_serv.irq_11,p_irq12,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 | @@: |
190 | @@: |
191 | mov eax, [esp+4] ; EIP |
191 | mov eax, [esp+4] ; EIP |
192 | 192 | ||
193 | mov [write_error_to],process_eip+43 |
193 | mov [write_error_to],process_eip+43 |
194 | call writehex |
194 | call writehex |
195 | 195 | ||
196 | mov esi,process_error |
196 | mov esi,process_error |
197 | call sys_msg_board_str |
197 | call sys_msg_board_str |
198 | 198 | ||
199 | mov esi,process_pid |
199 | mov esi,process_pid |
200 | call sys_msg_board_str |
200 | call sys_msg_board_str |
201 | 201 | ||
202 | mov esi,process_eip |
202 | mov esi,process_eip |
203 | call sys_msg_board_str |
203 | call sys_msg_board_str |
204 | 204 | ||
205 | ret |
205 | ret |
206 | 206 | ||
207 | 207 | ||
208 | 208 | ||
209 | ; irq1 -> hid/keyboard.inc |
209 | ; irq1 -> hid/keyboard.inc |
210 | 210 | ||
211 | 211 | ||
212 | macro irqh [num] |
212 | macro irqh [num] |
213 | { |
213 | { |
214 | forward |
214 | forward |
215 | p_irq#num : |
215 | p_irq#num : |
216 | save_ring3_context |
216 | save_ring3_context |
217 | mov edi, num |
217 | mov edi, num |
218 | jmp irq_c |
218 | jmp irq_c |
219 | } |
219 | } |
220 | 220 | ||
221 | irqh 2,5,7,8,9,10,11 |
221 | irqh 2,5,7,8,9,10,11 |
222 | 222 | ||
223 | irq_c: |
223 | irq_c: |
224 | mov ax, app_data ;os_data |
224 | mov ax, app_data ;os_data |
225 | mov ds, ax |
225 | mov ds, ax |
226 | mov es, ax |
226 | mov es, ax |
227 | call irqhandler |
227 | call irqhandler |
228 | restore_ring3_context |
228 | restore_ring3_context |
229 | iret |
229 | iret |
230 | 230 | ||
231 | p_irq6: |
231 | p_irq6: |
232 | save_ring3_context |
232 | save_ring3_context |
233 | mov ax, app_data ;os_data |
233 | mov ax, app_data ;os_data |
234 | mov ds, ax |
234 | mov ds, ax |
235 | mov es, ax |
235 | mov es, ax |
236 | call fdc_irq |
236 | call fdc_irq |
237 | call ready_for_next_irq |
237 | call ready_for_next_irq |
238 | restore_ring3_context |
238 | restore_ring3_context |
239 | iret |
239 | iret |
240 | 240 | ||
241 | p_irq3: |
241 | p_irq3: |
242 | save_ring3_context |
242 | save_ring3_context |
243 | mov ax, app_data ;os_data |
243 | mov ax, app_data ;os_data |
244 | mov ds, ax |
244 | mov ds, ax |
245 | mov es, ax |
245 | mov es, ax |
246 | cmp [com2_mouse_detected],0 |
246 | cmp [com2_mouse_detected],0 |
247 | je old_irq3_handler |
247 | je old_irq3_handler |
- | 248 | mov esi, com2_mouse |
|
- | 249 | mov dx, 2F8h ;[COMPortBaseAddr] |
|
248 | call check_mouse_data_com2 |
250 | call check_mouse_data_com |
249 | jmp p_irq3_1 |
251 | jmp p_irq3_1 |
250 | old_irq3_handler: |
252 | old_irq3_handler: |
251 | mov edi,3 |
253 | mov edi,3 |
252 | call irqhandler |
254 | call irqhandler |
253 | p_irq3_1: |
255 | p_irq3_1: |
254 | restore_ring3_context |
256 | restore_ring3_context |
255 | iret |
257 | iret |
256 | 258 | ||
257 | p_irq4: |
259 | p_irq4: |
258 | save_ring3_context |
260 | save_ring3_context |
259 | mov ax, app_data ;os_data |
261 | mov ax, app_data ;os_data |
260 | mov ds, ax |
262 | mov ds, ax |
261 | mov es, ax |
263 | mov es, ax |
262 | cmp [com1_mouse_detected],0 |
264 | cmp [com1_mouse_detected],0 |
263 | je old_irq4_handler |
265 | je old_irq4_handler |
- | 266 | mov esi, com1_mouse |
|
- | 267 | mov dx, 3F8h ;[COMPortBaseAddr] |
|
264 | call check_mouse_data_com1 |
268 | call check_mouse_data_com |
265 | jmp p_irq4_1 |
269 | jmp p_irq4_1 |
266 | old_irq4_handler: |
270 | old_irq4_handler: |
267 | mov edi,4 |
271 | mov edi,4 |
268 | call irqhandler |
272 | call irqhandler |
269 | p_irq4_1: |
273 | p_irq4_1: |
270 | restore_ring3_context |
274 | restore_ring3_context |
271 | iret |
275 | iret |
272 | 276 | ||
273 | p_irq12: |
277 | p_irq12: |
274 | save_ring3_context |
278 | save_ring3_context |
275 | mov ax, app_data ;os_data |
279 | mov ax, app_data ;os_data |
276 | mov ds, ax |
280 | mov ds, ax |
277 | mov es, ax |
281 | mov es, ax |
278 | call check_mouse_data_ps2 |
282 | call check_mouse_data_ps2 |
279 | restore_ring3_context |
283 | restore_ring3_context |
280 | iret |
284 | iret |
281 | 285 | ||
282 | p_irq14: |
286 | p_irq14: |
283 | save_ring3_context |
287 | save_ring3_context |
284 | mov ax, app_data ;os_data |
288 | mov ax, app_data ;os_data |
285 | mov ds, ax |
289 | mov ds, ax |
286 | mov es, ax |
290 | mov es, ax |
287 | call [irq14_func] |
291 | call [irq14_func] |
288 | call ready_for_next_irq_1 |
292 | call ready_for_next_irq_1 |
289 | restore_ring3_context |
293 | restore_ring3_context |
290 | iret |
294 | iret |
291 | p_irq15: |
295 | p_irq15: |
292 | save_ring3_context |
296 | save_ring3_context |
293 | mov ax, app_data ;os_data |
297 | mov ax, app_data ;os_data |
294 | mov ds, ax |
298 | mov ds, ax |
295 | mov es, ax |
299 | mov es, ax |
296 | call [irq15_func] |
300 | call [irq15_func] |
297 | call ready_for_next_irq_1 |
301 | call ready_for_next_irq_1 |
298 | restore_ring3_context |
302 | restore_ring3_context |
299 | iret |
303 | iret |
300 | 304 | ||
301 | ready_for_next_irq: |
305 | ready_for_next_irq: |
302 | mov [check_idle_semaphore],5 |
306 | mov [check_idle_semaphore],5 |
303 | mov al, 0x20 |
307 | mov al, 0x20 |
304 | out 0x20, al |
308 | out 0x20, al |
305 | ret |
309 | ret |
306 | 310 | ||
307 | ready_for_next_irq_1: |
311 | ready_for_next_irq_1: |
308 | mov [check_idle_semaphore],5 |
312 | mov [check_idle_semaphore],5 |
309 | mov al, 0x20 |
313 | mov al, 0x20 |
310 | out 0xa0,al |
314 | out 0xa0,al |
311 | out 0x20, al |
315 | out 0x20, al |
312 | ret |
316 | ret |
313 | 317 | ||
314 | irqD: |
318 | irqD: |
315 | save_ring3_context |
319 | save_ring3_context |
316 | mov ax, app_data ;os_data |
320 | mov ax, app_data ;os_data |
317 | mov ds, ax |
321 | mov ds, ax |
318 | mov es, ax |
322 | mov es, ax |
319 | 323 | ||
320 | mov dx,0xf0 |
324 | mov dx,0xf0 |
321 | mov al,0 |
325 | mov al,0 |
322 | out dx,al |
326 | out dx,al |
323 | 327 | ||
324 | mov dx,0xa0 |
328 | mov dx,0xa0 |
325 | mov al,0x20 |
329 | mov al,0x20 |
326 | out dx,al |
330 | out dx,al |
327 | mov dx,0x20 |
331 | mov dx,0x20 |
328 | out dx,al |
332 | out dx,al |
329 | 333 | ||
330 | restore_ring3_context |
334 | restore_ring3_context |
331 | 335 | ||
332 | iret |
336 | iret |
333 | 337 | ||
334 | 338 | ||
335 | irqhandler: |
339 | irqhandler: |
336 | 340 | ||
337 | push edi |
341 | push edi |
338 | 342 | ||
339 | mov esi,edi ; 1 |
343 | mov esi,edi ; 1 |
340 | shl esi,6 ; 1 |
344 | shl esi,6 ; 1 |
341 | add esi,irq00read ; 1 |
345 | add esi,irq00read ; 1 |
342 | shl edi,12 ; 1 |
346 | shl edi,12 ; 1 |
343 | add edi,IRQ_SAVE |
347 | add edi,IRQ_SAVE |
344 | mov ecx,16 |
348 | mov ecx,16 |
345 | 349 | ||
346 | mov [check_idle_semaphore],5 |
350 | mov [check_idle_semaphore],5 |
347 | 351 | ||
348 | irqnewread: |
352 | irqnewread: |
349 | dec ecx |
353 | dec ecx |
350 | js irqover |
354 | js irqover |
351 | 355 | ||
352 | mov dx,[esi] ; 2+ |
356 | mov dx,[esi] ; 2+ |
353 | 357 | ||
354 | cmp dx,0 ; 1 |
358 | cmp dx,0 ; 1 |
355 | jz irqover |
359 | jz irqover |
356 | cmp [esi+3],byte 1 ; 2 ; byte read |
360 | cmp [esi+3],byte 1 ; 2 ; byte read |
357 | jne noirqbyte ; 4-11 |
361 | jne noirqbyte ; 4-11 |
358 | 362 | ||
359 | in al,dx |
363 | in al,dx |
360 | 364 | ||
361 | mov edx,[edi] |
365 | mov edx,[edi] |
362 | cmp edx,4000 |
366 | cmp edx,4000 |
363 | je irqfull |
367 | je irqfull |
364 | mov ebx,edi |
368 | mov ebx,edi |
365 | add ebx,0x10 |
369 | add ebx,0x10 |
366 | add ebx,edx |
370 | add ebx,edx |
367 | mov [ebx],al |
371 | mov [ebx],al |
368 | inc edx |
372 | inc edx |
369 | mov [edi],edx |
373 | mov [edi],edx |
370 | 374 | ||
371 | add esi,4 |
375 | add esi,4 |
372 | jmp irqnewread |
376 | jmp irqnewread |
373 | 377 | ||
374 | noirqbyte: |
378 | noirqbyte: |
375 | 379 | ||
376 | 380 | ||
377 | cmp [esi+3],byte 2 ; word read |
381 | cmp [esi+3],byte 2 ; word read |
378 | jne noirqword |
382 | jne noirqword |
379 | 383 | ||
380 | in ax,dx |
384 | in ax,dx |
381 | 385 | ||
382 | mov edx,[edi] |
386 | mov edx,[edi] |
383 | cmp edx,4000 |
387 | cmp edx,4000 |
384 | je irqfull |
388 | je irqfull |
385 | mov ebx,edi |
389 | mov ebx,edi |
386 | add ebx,0x10 |
390 | add ebx,0x10 |
387 | add ebx,edx |
391 | add ebx,edx |
388 | mov [ebx],ax |
392 | mov [ebx],ax |
389 | add edx,2 |
393 | add edx,2 |
390 | mov [edi],edx |
394 | mov [edi],edx |
391 | add esi,4 |
395 | add esi,4 |
392 | jmp irqnewread |
396 | jmp irqnewread |
393 | 397 | ||
394 | noirqword: |
398 | noirqword: |
395 | irqfull: |
399 | irqfull: |
396 | irqover: |
400 | irqover: |
397 | 401 | ||
398 | mov al,0x20 ; ready for next irq |
402 | mov al,0x20 ; ready for next irq |
399 | out 0x20,al |
403 | out 0x20,al |
400 | 404 | ||
401 | pop ebx |
405 | pop ebx |
402 | cmp ebx,7 |
406 | cmp ebx,7 |
403 | jbe noa0 |
407 | jbe noa0 |
404 | out 0xa0,al |
408 | out 0xa0,al |
405 | noa0: |
409 | noa0: |
406 | 410 | ||
407 | ret |
411 | ret |
408 | 412 | ||
409 | 413 | ||
410 | 414 | ||
411 | set_application_table_status: |
415 | set_application_table_status: |
412 | push eax |
416 | push eax |
413 | 417 | ||
414 | mov eax,[CURRENT_TASK] |
418 | mov eax,[CURRENT_TASK] |
415 | shl eax, 5 |
419 | shl eax, 5 |
416 | add eax,CURRENT_TASK+TASKDATA.pid |
420 | add eax,CURRENT_TASK+TASKDATA.pid |
417 | mov eax,[eax] |
421 | mov eax,[eax] |
418 | 422 | ||
419 | mov [application_table_status],eax |
423 | mov [application_table_status],eax |
420 | 424 | ||
421 | pop eax |
425 | pop eax |
422 | 426 | ||
423 | ret |
427 | ret |
424 | 428 | ||
425 | 429 | ||
426 | clear_application_table_status: |
430 | clear_application_table_status: |
427 | push eax |
431 | push eax |
428 | 432 | ||
429 | mov eax,[CURRENT_TASK] |
433 | mov eax,[CURRENT_TASK] |
430 | shl eax, 5 |
434 | shl eax, 5 |
431 | add eax,CURRENT_TASK+TASKDATA.pid |
435 | add eax,CURRENT_TASK+TASKDATA.pid |
432 | mov eax,[eax] |
436 | mov eax,[eax] |
433 | 437 | ||
434 | cmp eax,[application_table_status] |
438 | cmp eax,[application_table_status] |
435 | jne apptsl1 |
439 | jne apptsl1 |
436 | mov [application_table_status],0 |
440 | mov [application_table_status],0 |
437 | apptsl1: |
441 | apptsl1: |
438 | 442 | ||
439 | pop eax |
443 | pop eax |
440 | 444 | ||
441 | ret |
445 | ret |
442 | 446 | ||
443 | sys_resize_app_memory: |
447 | sys_resize_app_memory: |
444 | ; eax = 1 - resize |
448 | ; eax = 1 - resize |
445 | ; ebx = new amount of memory |
449 | ; ebx = new amount of memory |
446 | 450 | ||
447 | cmp eax,1 |
451 | cmp eax,1 |
448 | jne .no_application_mem_resize |
452 | jne .no_application_mem_resize |
449 | 453 | ||
450 | stdcall new_mem_resize, ebx |
454 | stdcall new_mem_resize, ebx |
451 | mov [esp+36], eax |
455 | mov [esp+36], eax |
452 | ret |
456 | ret |
453 | 457 | ||
454 | .no_application_mem_resize: |
458 | .no_application_mem_resize: |
455 | ret |
459 | ret |
456 | 460 | ||
457 | sys_threads: |
461 | sys_threads: |
458 | 462 | ||
459 | ; eax=1 create thread |
463 | ; eax=1 create thread |
460 | ; |
464 | ; |
461 | ; ebx=thread start |
465 | ; ebx=thread start |
462 | ; ecx=thread stack value |
466 | ; ecx=thread stack value |
463 | ; |
467 | ; |
464 | ; on return : eax = pid |
468 | ; on return : eax = pid |
465 | jmp new_sys_threads |
469 | jmp new_sys_threads |
466 | 470 | ||
467 | iglobal |
471 | iglobal |
468 | process_terminating db 'K : Process - terminating',13,10,0 |
472 | process_terminating db 'K : Process - terminating',13,10,0 |
469 | process_terminated db 'K : Process - done',13,10,0 |
473 | process_terminated db 'K : Process - done',13,10,0 |
470 | msg_obj_destroy db 'K : destroy app object',13,10,0 |
474 | msg_obj_destroy db 'K : destroy app object',13,10,0 |
471 | endg |
475 | endg |
472 | 476 | ||
473 | ; param |
477 | ; param |
474 | ; esi= slot |
478 | ; esi= slot |
475 | 479 | ||
476 | terminate: ; terminate application |
480 | terminate: ; terminate application |
477 | 481 | ||
478 | .slot equ esp ;locals |
482 | .slot equ esp ;locals |
479 | 483 | ||
480 | push esi ;save .slot |
484 | push esi ;save .slot |
481 | 485 | ||
482 | shl esi, 8 |
486 | shl esi, 8 |
483 | cmp [SLOT_BASE+esi+APPDATA.dir_table], 0 |
487 | cmp [SLOT_BASE+esi+APPDATA.dir_table], 0 |
484 | jne @F |
488 | jne @F |
485 | add esp, 4 |
489 | add esp, 4 |
486 | ret |
490 | ret |
487 | @@: |
491 | @@: |
488 | mov esi,process_terminating |
492 | mov esi,process_terminating |
489 | call sys_msg_board_str |
493 | call sys_msg_board_str |
490 | @@: |
494 | @@: |
491 | cli |
495 | cli |
492 | cmp [application_table_status],0 |
496 | cmp [application_table_status],0 |
493 | je term9 |
497 | je term9 |
494 | sti |
498 | sti |
495 | call change_task |
499 | call change_task |
496 | jmp @b |
500 | jmp @b |
497 | term9: |
501 | term9: |
498 | call set_application_table_status |
502 | call set_application_table_status |
499 | 503 | ||
500 | mov esi, [.slot] |
504 | mov esi, [.slot] |
501 | shl esi,8 |
505 | shl esi,8 |
502 | add esi, SLOT_BASE+APP_OBJ_OFFSET |
506 | add esi, SLOT_BASE+APP_OBJ_OFFSET |
503 | @@: |
507 | @@: |
504 | mov eax, [esi+APPOBJ.fd] |
508 | mov eax, [esi+APPOBJ.fd] |
505 | test eax, eax |
509 | test eax, eax |
506 | jz @F |
510 | jz @F |
507 | 511 | ||
508 | cmp eax, esi |
512 | cmp eax, esi |
509 | je @F |
513 | je @F |
510 | 514 | ||
511 | push esi |
515 | push esi |
512 | call [eax+APPOBJ.destroy] |
516 | call [eax+APPOBJ.destroy] |
513 | mov esi, msg_obj_destroy |
517 | mov esi, msg_obj_destroy |
514 | call sys_msg_board_str |
518 | call sys_msg_board_str |
515 | pop esi |
519 | pop esi |
516 | jmp @B |
520 | jmp @B |
517 | @@: |
521 | @@: |
518 | mov eax, [.slot] |
522 | mov eax, [.slot] |
519 | shl eax, 8 |
523 | shl eax, 8 |
520 | mov eax,[SLOT_BASE+eax+APPDATA.dir_table] |
524 | mov eax,[SLOT_BASE+eax+APPDATA.dir_table] |
521 | stdcall destroy_app_space, eax |
525 | stdcall destroy_app_space, eax |
522 | 526 | ||
523 | mov esi, [.slot] |
527 | mov esi, [.slot] |
524 | cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 |
528 | cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 |
525 | jne @F |
529 | jne @F |
526 | 530 | ||
527 | mov [fpu_owner],1 |
531 | mov [fpu_owner],1 |
528 | mov eax, [256+SLOT_BASE+APPDATA.fpu_state] |
532 | mov eax, [256+SLOT_BASE+APPDATA.fpu_state] |
529 | clts |
533 | clts |
530 | bt [cpu_caps], CAPS_SSE |
534 | bt [cpu_caps], CAPS_SSE |
531 | jnc .no_SSE |
535 | jnc .no_SSE |
532 | fxrstor [eax] |
536 | fxrstor [eax] |
533 | jmp @F |
537 | jmp @F |
534 | .no_SSE: |
538 | .no_SSE: |
535 | fnclex |
539 | fnclex |
536 | frstor [eax] |
540 | frstor [eax] |
537 | @@: |
541 | @@: |
538 | 542 | ||
539 | mov [KEY_COUNT],byte 0 ; empty keyboard buffer |
543 | mov [KEY_COUNT],byte 0 ; empty keyboard buffer |
540 | mov [BTN_COUNT],byte 0 ; empty button buffer |
544 | mov [BTN_COUNT],byte 0 ; empty button buffer |
541 | 545 | ||
542 | 546 | ||
543 | ; remove defined hotkeys |
547 | ; remove defined hotkeys |
544 | mov eax, hotkey_list |
548 | mov eax, hotkey_list |
545 | .loop: |
549 | .loop: |
546 | cmp [eax+8], esi |
550 | cmp [eax+8], esi |
547 | jnz .cont |
551 | jnz .cont |
548 | mov ecx, [eax] |
552 | mov ecx, [eax] |
549 | jecxz @f |
553 | jecxz @f |
550 | push dword [eax+12] |
554 | push dword [eax+12] |
551 | pop dword [ecx+12] |
555 | pop dword [ecx+12] |
552 | @@: |
556 | @@: |
553 | mov ecx, [eax+12] |
557 | mov ecx, [eax+12] |
554 | push dword [eax] |
558 | push dword [eax] |
555 | pop dword [ecx] |
559 | pop dword [ecx] |
556 | xor ecx, ecx |
560 | xor ecx, ecx |
557 | mov [eax], ecx |
561 | mov [eax], ecx |
558 | mov [eax+4], ecx |
562 | mov [eax+4], ecx |
559 | mov [eax+8], ecx |
563 | mov [eax+8], ecx |
560 | mov [eax+12], ecx |
564 | mov [eax+12], ecx |
561 | .cont: |
565 | .cont: |
562 | add eax, 16 |
566 | add eax, 16 |
563 | cmp eax, hotkey_list+256*16 |
567 | cmp eax, hotkey_list+256*16 |
564 | jb .loop |
568 | jb .loop |
565 | ; remove hotkeys in buffer |
569 | ; remove hotkeys in buffer |
566 | mov eax, hotkey_buffer |
570 | mov eax, hotkey_buffer |
567 | .loop2: |
571 | .loop2: |
568 | cmp [eax], esi |
572 | cmp [eax], esi |
569 | jnz .cont2 |
573 | jnz .cont2 |
570 | and dword [eax+4], 0 |
574 | and dword [eax+4], 0 |
571 | and dword [eax], 0 |
575 | and dword [eax], 0 |
572 | .cont2: |
576 | .cont2: |
573 | add eax, 8 |
577 | add eax, 8 |
574 | cmp eax, hotkey_buffer+120*8 |
578 | cmp eax, hotkey_buffer+120*8 |
575 | jb .loop2 |
579 | jb .loop2 |
576 | 580 | ||
577 | mov ecx,esi ; remove buttons |
581 | mov ecx,esi ; remove buttons |
578 | bnewba2: |
582 | bnewba2: |
579 | mov edi,[BTN_ADDR] |
583 | mov edi,[BTN_ADDR] |
580 | mov eax,edi |
584 | mov eax,edi |
581 | cld |
585 | cld |
582 | movzx ebx,word [edi] |
586 | movzx ebx,word [edi] |
583 | inc bx |
587 | inc bx |
584 | bnewba: |
588 | bnewba: |
585 | dec bx |
589 | dec bx |
586 | jz bnmba |
590 | jz bnmba |
587 | add eax,0x10 |
591 | add eax,0x10 |
588 | cmp cx,[eax] |
592 | cmp cx,[eax] |
589 | jnz bnewba |
593 | jnz bnewba |
590 | pusha |
594 | pusha |
591 | mov ecx,ebx |
595 | mov ecx,ebx |
592 | inc ecx |
596 | inc ecx |
593 | shl ecx,4 |
597 | shl ecx,4 |
594 | mov ebx,eax |
598 | mov ebx,eax |
595 | add eax,0x10 |
599 | add eax,0x10 |
596 | call memmove |
600 | call memmove |
597 | dec dword [edi] |
601 | dec dword [edi] |
598 | popa |
602 | popa |
599 | jmp bnewba2 |
603 | jmp bnewba2 |
600 | bnmba: |
604 | bnmba: |
601 | 605 | ||
602 | pusha ; save window coordinates for window restoring |
606 | pusha ; save window coordinates for window restoring |
603 | cld |
607 | cld |
604 | shl esi,5 |
608 | shl esi,5 |
605 | add esi,window_data |
609 | add esi,window_data |
606 | mov eax,[esi+WDATA.box.left] |
610 | mov eax,[esi+WDATA.box.left] |
607 | mov [dlx],eax |
611 | mov [dlx],eax |
608 | add eax,[esi+WDATA.box.width] |
612 | add eax,[esi+WDATA.box.width] |
609 | mov [dlxe],eax |
613 | mov [dlxe],eax |
610 | mov eax,[esi+WDATA.box.top] |
614 | mov eax,[esi+WDATA.box.top] |
611 | mov [dly],eax |
615 | mov [dly],eax |
612 | add eax,[esi+WDATA.box.height] |
616 | add eax,[esi+WDATA.box.height] |
613 | mov [dlye],eax |
617 | mov [dlye],eax |
614 | 618 | ||
615 | xor eax, eax |
619 | xor eax, eax |
616 | mov [esi+WDATA.box.left],eax |
620 | mov [esi+WDATA.box.left],eax |
617 | mov [esi+WDATA.box.width],eax |
621 | mov [esi+WDATA.box.width],eax |
618 | mov [esi+WDATA.box.top],eax |
622 | mov [esi+WDATA.box.top],eax |
619 | mov [esi+WDATA.box.height],eax |
623 | mov [esi+WDATA.box.height],eax |
620 | mov [esi+WDATA.cl_workarea],eax |
624 | mov [esi+WDATA.cl_workarea],eax |
621 | mov [esi+WDATA.cl_titlebar],eax |
625 | mov [esi+WDATA.cl_titlebar],eax |
622 | mov [esi+WDATA.cl_frames],eax |
626 | mov [esi+WDATA.cl_frames],eax |
623 | mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn |
627 | mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn |
624 | lea edi, [esi-window_data+draw_data] |
628 | lea edi, [esi-window_data+draw_data] |
625 | mov ecx,32/4 |
629 | mov ecx,32/4 |
626 | rep stosd |
630 | rep stosd |
627 | popa |
631 | popa |
628 | 632 | ||
629 | ; debuggee test |
633 | ; debuggee test |
630 | pushad |
634 | pushad |
631 | mov edi, esi |
635 | mov edi, esi |
632 | shl edi, 5 |
636 | shl edi, 5 |
633 | mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] |
637 | mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] |
634 | test eax, eax |
638 | test eax, eax |
635 | jz .nodebug |
639 | jz .nodebug |
636 | push 8 |
640 | push 8 |
637 | pop ecx |
641 | pop ecx |
638 | push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID |
642 | push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID |
639 | push 2 |
643 | push 2 |
640 | call debugger_notify |
644 | call debugger_notify |
641 | pop ecx |
645 | pop ecx |
642 | pop ecx |
646 | pop ecx |
643 | .nodebug: |
647 | .nodebug: |
644 | popad |
648 | popad |
645 | 649 | ||
646 | mov ebx, [.slot] |
650 | mov ebx, [.slot] |
647 | shl ebx, 8 |
651 | shl ebx, 8 |
648 | mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] |
652 | mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] |
649 | 653 | ||
650 | stdcall kernel_free, ebx |
654 | stdcall kernel_free, ebx |
651 | 655 | ||
652 | mov edi, [.slot] |
656 | mov edi, [.slot] |
653 | shl edi,8 |
657 | shl edi,8 |
654 | add edi,SLOT_BASE |
658 | add edi,SLOT_BASE |
655 | 659 | ||
656 | mov eax, [edi+APPDATA.io_map] |
660 | mov eax, [edi+APPDATA.io_map] |
657 | cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) |
661 | cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) |
658 | je @F |
662 | je @F |
659 | call free_page |
663 | call free_page |
660 | @@: |
664 | @@: |
661 | mov eax, [edi+APPDATA.io_map+4] |
665 | mov eax, [edi+APPDATA.io_map+4] |
662 | cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) |
666 | cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) |
663 | je @F |
667 | je @F |
664 | call free_page |
668 | call free_page |
665 | @@: |
669 | @@: |
666 | mov eax, 0x20202020 |
670 | mov eax, 0x20202020 |
667 | stosd |
671 | stosd |
668 | stosd |
672 | stosd |
669 | stosd |
673 | stosd |
670 | mov ecx,244/4 |
674 | mov ecx,244/4 |
671 | xor eax, eax |
675 | xor eax, eax |
672 | rep stosd |
676 | rep stosd |
673 | 677 | ||
674 | ; activate window |
678 | ; activate window |
675 | movzx eax, word [WIN_STACK + esi*2] |
679 | movzx eax, word [WIN_STACK + esi*2] |
676 | cmp eax, [TASK_COUNT] |
680 | cmp eax, [TASK_COUNT] |
677 | jne .dont_activate |
681 | jne .dont_activate |
678 | pushad |
682 | pushad |
679 | .check_next_window: |
683 | .check_next_window: |
680 | dec eax |
684 | dec eax |
681 | cmp eax, 1 |
685 | cmp eax, 1 |
682 | jbe .nothing_to_activate |
686 | jbe .nothing_to_activate |
683 | lea esi, [WIN_POS+eax*2] |
687 | lea esi, [WIN_POS+eax*2] |
684 | movzx edi, word [esi] ; edi = process |
688 | movzx edi, word [esi] ; edi = process |
685 | shl edi, 5 |
689 | shl edi, 5 |
686 | cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots |
690 | cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots |
687 | je .check_next_window |
691 | je .check_next_window |
688 | add edi, window_data |
692 | add edi, window_data |
689 | ; \begin{diamond}[19.09.2006] |
693 | ; \begin{diamond}[19.09.2006] |
690 | ; skip minimized windows |
694 | ; skip minimized windows |
691 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
695 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
692 | jnz .check_next_window |
696 | jnz .check_next_window |
693 | ; \end{diamond} |
697 | ; \end{diamond} |
694 | call waredraw |
698 | call waredraw |
695 | .nothing_to_activate: |
699 | .nothing_to_activate: |
696 | popad |
700 | popad |
697 | .dont_activate: |
701 | .dont_activate: |
698 | 702 | ||
699 | push esi ; remove hd1 & cd & flp reservation |
703 | push esi ; remove hd1 & cd & flp reservation |
700 | shl esi, 5 |
704 | shl esi, 5 |
701 | mov esi, [esi+CURRENT_TASK+TASKDATA.pid] |
705 | mov esi, [esi+CURRENT_TASK+TASKDATA.pid] |
702 | cmp [hd1_status], esi |
706 | cmp [hd1_status], esi |
703 | jnz @f |
707 | jnz @f |
704 | call free_hd_channel |
708 | call free_hd_channel |
705 | mov [hd1_status], 0 |
709 | mov [hd1_status], 0 |
706 | @@: |
710 | @@: |
707 | cmp [cd_status], esi |
711 | cmp [cd_status], esi |
708 | jnz @f |
712 | jnz @f |
709 | call free_cd_channel |
713 | call free_cd_channel |
710 | mov [cd_status], 0 |
714 | mov [cd_status], 0 |
711 | @@: |
715 | @@: |
712 | cmp [flp_status], esi |
716 | cmp [flp_status], esi |
713 | jnz @f |
717 | jnz @f |
714 | mov [flp_status], 0 |
718 | mov [flp_status], 0 |
715 | @@: |
719 | @@: |
716 | pop esi |
720 | pop esi |
717 | 721 | ||
718 | pusha ; remove all irq reservations |
722 | pusha ; remove all irq reservations |
719 | mov eax,esi |
723 | mov eax,esi |
720 | shl eax, 5 |
724 | shl eax, 5 |
721 | mov eax,[eax+CURRENT_TASK+TASKDATA.pid] |
725 | mov eax,[eax+CURRENT_TASK+TASKDATA.pid] |
722 | mov edi,irq_owner |
726 | mov edi,irq_owner |
723 | mov ecx,16 |
727 | mov ecx,16 |
724 | newirqfree: |
728 | newirqfree: |
725 | scasd |
729 | scasd |
726 | jne nofreeirq |
730 | jne nofreeirq |
727 | mov [edi-4],dword 0 |
731 | mov [edi-4],dword 0 |
728 | nofreeirq: |
732 | nofreeirq: |
729 | loop newirqfree |
733 | loop newirqfree |
730 | popa |
734 | popa |
731 | 735 | ||
732 | pusha ; remove all port reservations |
736 | pusha ; remove all port reservations |
733 | mov edx,esi |
737 | mov edx,esi |
734 | shl edx, 5 |
738 | shl edx, 5 |
735 | add edx,CURRENT_TASK |
739 | add edx,CURRENT_TASK |
736 | mov edx,[edx+TASKDATA.pid] |
740 | mov edx,[edx+TASKDATA.pid] |
737 | 741 | ||
738 | rmpr0: |
742 | rmpr0: |
739 | 743 | ||
740 | mov esi,[RESERVED_PORTS] |
744 | mov esi,[RESERVED_PORTS] |
741 | 745 | ||
742 | cmp esi,0 |
746 | cmp esi,0 |
743 | je rmpr9 |
747 | je rmpr9 |
744 | 748 | ||
745 | rmpr3: |
749 | rmpr3: |
746 | 750 | ||
747 | mov edi,esi |
751 | mov edi,esi |
748 | shl edi,4 |
752 | shl edi,4 |
749 | add edi,RESERVED_PORTS |
753 | add edi,RESERVED_PORTS |
750 | 754 | ||
751 | cmp edx,[edi] |
755 | cmp edx,[edi] |
752 | je rmpr4 |
756 | je rmpr4 |
753 | 757 | ||
754 | dec esi |
758 | dec esi |
755 | jnz rmpr3 |
759 | jnz rmpr3 |
756 | 760 | ||
757 | jmp rmpr9 |
761 | jmp rmpr9 |
758 | 762 | ||
759 | rmpr4: |
763 | rmpr4: |
760 | 764 | ||
761 | mov ecx,256 |
765 | mov ecx,256 |
762 | sub ecx,esi |
766 | sub ecx,esi |
763 | shl ecx,4 |
767 | shl ecx,4 |
764 | 768 | ||
765 | mov esi,edi |
769 | mov esi,edi |
766 | add esi,16 |
770 | add esi,16 |
767 | cld |
771 | cld |
768 | rep movsb |
772 | rep movsb |
769 | 773 | ||
770 | dec dword [RESERVED_PORTS] |
774 | dec dword [RESERVED_PORTS] |
771 | 775 | ||
772 | jmp rmpr0 |
776 | jmp rmpr0 |
773 | 777 | ||
774 | rmpr9: |
778 | rmpr9: |
775 | 779 | ||
776 | popa |
780 | popa |
777 | mov edi,esi ; do not run this process slot |
781 | mov edi,esi ; do not run this process slot |
778 | shl edi, 5 |
782 | shl edi, 5 |
779 | mov [edi+CURRENT_TASK + TASKDATA.state],byte 9 |
783 | mov [edi+CURRENT_TASK + TASKDATA.state],byte 9 |
780 | ; debugger test - terminate all debuggees |
784 | ; debugger test - terminate all debuggees |
781 | mov eax, 2 |
785 | mov eax, 2 |
782 | mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot |
786 | mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot |
783 | .xd0: |
787 | .xd0: |
784 | cmp eax, [TASK_COUNT] |
788 | cmp eax, [TASK_COUNT] |
785 | ja .xd1 |
789 | ja .xd1 |
786 | cmp dword [ecx], esi |
790 | cmp dword [ecx], esi |
787 | jnz @f |
791 | jnz @f |
788 | and dword [ecx], 0 |
792 | and dword [ecx], 0 |
789 | pushad |
793 | pushad |
790 | xchg eax, ebx |
794 | xchg eax, ebx |
791 | mov eax, 2 |
795 | mov eax, 2 |
792 | call sys_system |
796 | call sys_system |
793 | popad |
797 | popad |
794 | @@: |
798 | @@: |
795 | inc eax |
799 | inc eax |
796 | add ecx, 0x100 |
800 | add ecx, 0x100 |
797 | jmp .xd0 |
801 | jmp .xd0 |
798 | .xd1: |
802 | .xd1: |
799 | ; call systest |
803 | ; call systest |
800 | sti ; .. and life goes on |
804 | sti ; .. and life goes on |
801 | 805 | ||
802 | mov eax, [dlx] |
806 | mov eax, [dlx] |
803 | mov ebx, [dly] |
807 | mov ebx, [dly] |
804 | mov ecx, [dlxe] |
808 | mov ecx, [dlxe] |
805 | mov edx, [dlye] |
809 | mov edx, [dlye] |
806 | call calculatescreen |
810 | call calculatescreen |
807 | xor eax, eax |
811 | xor eax, eax |
808 | xor esi, esi |
812 | xor esi, esi |
809 | call redrawscreen |
813 | call redrawscreen |
810 | 814 | ||
811 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
815 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
812 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
816 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
813 | 817 | ||
814 | mov [application_table_status],0 |
818 | mov [application_table_status],0 |
815 | mov esi,process_terminated |
819 | mov esi,process_terminated |
816 | call sys_msg_board_str |
820 | call sys_msg_board_str |
817 | add esp, 4 |
821 | add esp, 4 |
818 | ret |
822 | ret |
819 | restore .slot |
823 | restore .slot |
820 | 824 | ||
821 | iglobal |
825 | iglobal |
822 | boot_sched_1 db 'Building gdt tss pointer',0 |
826 | boot_sched_1 db 'Building gdt tss pointer',0 |
823 | boot_sched_2 db 'Building IDT table',0 |
827 | boot_sched_2 db 'Building IDT table',0 |
824 | endg |
828 | endg |
825 | 829 | ||
826 | 830 | ||
827 | build_scheduler: |
831 | build_scheduler: |
828 | 832 | ||
829 | mov esi,boot_sched_1 |
833 | mov esi,boot_sched_1 |
830 | call boot_log |
834 | call boot_log |
831 | ; call build_process_gdt_tss_pointer |
835 | ; call build_process_gdt_tss_pointer |
832 | 836 | ||
833 | ; mov esi,boot_sched_2 |
837 | ; mov esi,boot_sched_2 |
834 | ; call boot_log |
838 | ; call boot_log |
835 | 839 | ||
836 | ret |
840 | ret |