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