Subversion Repositories Kolibri OS

Rev

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

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