Subversion Repositories Kolibri OS

Rev

Rev 566 | Rev 656 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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