Subversion Repositories Kolibri OS

Rev

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

Rev 23 Rev 33
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 32
10
align 32
11
 
11
 
12
; GDT TABLE
12
; GDT TABLE
13
 
13
 
14
gdts:
14
gdts:
15
 
15
 
16
        dw     gdte-$-1
16
        dw     gdte-$-1
17
        dd     gdts
17
        dd     gdts
18
        dw     0
18
        dw     0
19
 
19
 
20
int_code_l:
20
int_code_l:
21
os_code_l:
21
os_code_l:
22
 
22
 
23
        dw     0xffff
23
        dw     0xffff
24
        dw     0x0000
24
        dw     0x0000
25
        db     0x00
25
        db     0x00
26
        dw     11011111b *256 +10011010b
26
        dw     11011111b *256 +10011010b
27
        db     0x00
27
        db     0x00
28
 
28
 
29
int_data_l:
29
int_data_l:
30
os_data_l:
30
os_data_l:
31
 
31
 
32
        dw     0xffff
32
        dw     0xffff
33
        dw     0x0000
33
        dw     0x0000
34
        db     0x00
34
        db     0x00
35
        dw     11011111b *256 +10010010b
35
        dw     11011111b *256 +10010010b
36
        db     0x00
36
        db     0x00
37
 
37
 
38
app_code_l:
38
app_code_l:
39
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
39
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
40
      dw 0
40
      dw 0
41
      db 0
41
      db 0
42
      dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
42
      dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
43
      db std_application_base_address shr 24
43
      db std_application_base_address shr 24
44
 
44
 
45
app_data_l:
45
app_data_l:
46
      dw (0x80000000-std_application_base_address) shr 12 and 0xffff
46
      dw (0x80000000-std_application_base_address) shr 12 and 0xffff
47
      dw 0
47
      dw 0
48
      db 0
48
      db 0
49
      dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
49
      dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
50
      db std_application_base_address shr 24
50
      db std_application_base_address shr 24
51
 
51
 
52
graph_data_l:
52
graph_data_l:
53
 
53
 
54
        dw     0x3ff
54
        dw     0x3ff
55
        dw     0x0000
55
        dw     0x0000
56
        db     0x00
56
        db     0x00
57
        dw     11010000b *256 +11110010b
57
        dw     11010000b *256 +11110010b
58
        db     0x00
58
        db     0x00
59
 
59
 
60
tss0_l:
60
tss0_l:
61
      times (max_processes+10) dd 0,0
61
      times (max_processes+10) dd 0,0
62
 
62
 
63
gdte:
63
gdte:
64
 
64
 
65
 
65
 
66
 
66
 
67
idtreg:
67
idtreg:
68
     dw   8*0x41-1
68
     dw   8*0x41-1
69
     dd   idts+8
69
     dd   idts+8
70
label idts at 0xB100-8
70
label idts at 0xB100-8
71
 
71
 
72
 
72
 
73
 
73
 
74
uglobal
74
uglobal
75
 tss_sceleton:
75
 tss_sceleton:
76
  l.back   dw 0,0
76
  l.back   dw 0,0
77
  l.esp0   dd 0
77
  l.esp0   dd 0
78
  l.ss0    dw 0,0
78
  l.ss0    dw 0,0
79
  l.esp1   dd 0
79
  l.esp1   dd 0
80
  l.ss1    dw 0,0
80
  l.ss1    dw 0,0
81
  l.esp2   dd 0
81
  l.esp2   dd 0
82
  l.ss2    dw 0,0
82
  l.ss2    dw 0,0
83
  l.cr3    dd 0
83
  l.cr3    dd 0
84
  l.eip    dd 0
84
  l.eip    dd 0
85
  l.eflags dd 0
85
  l.eflags dd 0
86
  l.eax    dd 0
86
  l.eax    dd 0
87
  l.ecx    dd 0
87
  l.ecx    dd 0
88
  l.edx    dd 0
88
  l.edx    dd 0
89
  l.ebx    dd 0
89
  l.ebx    dd 0
90
  l.esp    dd 0
90
  l.esp    dd 0
91
  l.ebp    dd 0
91
  l.ebp    dd 0
92
  l.esi    dd 0
92
  l.esi    dd 0
93
  l.edi    dd 0
93
  l.edi    dd 0
94
  l.es     dw 0,0
94
  l.es     dw 0,0
95
  l.cs     dw 0,0
95
  l.cs     dw 0,0
96
  l.ss     dw 0,0
96
  l.ss     dw 0,0
97
  l.ds     dw 0,0
97
  l.ds     dw 0,0
98
  l.fs     dw 0,0
98
  l.fs     dw 0,0
99
  l.gs     dw 0,0
99
  l.gs     dw 0,0
100
  l.ldt    dw 0,0
100
  l.ldt    dw 0,0
101
  l.trap   dw 0
101
  l.trap   dw 0
102
  l.io     dw 0
102
  l.io     dw 0
103
endg
103
endg
104
 
104
 
105
 
105
 
106
build_process_gdt_tss_pointer:
106
build_process_gdt_tss_pointer:
107
 
107
 
108
        mov    ecx,tss_data
108
        mov    ecx,tss_data
109
        mov    edi,0
109
        mov    edi,0
110
      setgdtl2:
110
      setgdtl2:
111
        mov    [edi+gdts+ tss0 +0], word tss_step
111
        mov    [edi+gdts+ tss0 +0], word tss_step
112
        mov    [edi+gdts+ tss0 +2], cx
112
        mov    [edi+gdts+ tss0 +2], cx
113
        mov    eax,ecx
113
        mov    eax,ecx
114
        shr    eax,16
114
        shr    eax,16
115
        mov    [edi+gdts+ tss0 +4], al
115
        mov    [edi+gdts+ tss0 +4], al
116
        mov    [edi+gdts+ tss0 +7], ah
116
        mov    [edi+gdts+ tss0 +7], ah
117
        mov    [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
117
        mov    [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
118
        add    ecx,tss_step
118
        add    ecx,tss_step
119
        add    edi,8
119
        add    edi,8
120
        cmp    edi,8*(max_processes+5)
120
        cmp    edi,8*(max_processes+5)
121
        jbe    setgdtl2
121
        jbe    setgdtl2
122
 
122
 
123
        ret
123
        ret
124
 
124
 
125
 
125
 
126
build_interrupt_table:
126
build_interrupt_table:
127
 
127
 
128
        mov    edi, idts+8
128
        mov    edi, idts+8
129
        mov    esi, sys_int
129
        mov    esi, sys_int
130
        mov    ecx, 0x40
130
        mov    ecx, 0x40
131
     @@:
131
     @@:
132
        mov    eax, [esi]
132
        mov    eax, [esi]
133
        mov    [edi],   ax           ; lower part of offset
133
        mov    [edi],   ax           ; lower part of offset
134
        mov    [edi+2], word os_code ; segment selector
134
        mov    [edi+2], word os_code ; segment selector
135
        shr    eax, 16
135
        shr    eax, 16
136
        mov    [edi+4], word 10001110b shl 8 ; interrupt descriptor
136
        mov    [edi+4], word 10001110b shl 8 ; interrupt descriptor
137
        mov    [edi+6], ax
137
        mov    [edi+6], ax
138
        add    esi, 4
138
        add    esi, 4
139
        add    edi, 8
139
        add    edi, 8
140
        dec    ecx
140
        dec    ecx
141
        jnz    @b
141
        jnz    @b
142
        
142
        
143
        ;mov    edi,8*0x40+idts+8
143
        ;mov    edi,8*0x40+idts+8
144
        mov    [edi + 0], word (i40 and ((1 shl 16)-1))
144
        mov    [edi + 0], word (i40 and ((1 shl 16)-1))
145
        mov    [edi + 2], word os_code
145
        mov    [edi + 2], word os_code
146
        mov    [edi + 4], word 11101110b*256
146
        mov    [edi + 4], word 11101110b*256
147
        mov    [edi + 6], word (i40 shr 16)
147
        mov    [edi + 6], word (i40 shr 16)
148
 
148
 
149
        ret
149
        ret
150
 
150
 
151
 
151
 
152
 
152
 
153
iglobal
153
iglobal
154
  sys_int:
154
  sys_int:
155
    dd   e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
155
    dd   e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
156
    dd   e16,e17
156
    dd   e16,e17
157
    times 14 dd unknown_interrupt
157
    times 14 dd unknown_interrupt
158
 
158
 
159
    dd   irq0  ,irq1  ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
159
    dd   irq0  ,irq1  ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
160
    dd   p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD  ,p_irq14,p_irq15
160
    dd   p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD  ,p_irq14,p_irq15
161
 
161
 
162
    times 16 dd unknown_interrupt
162
    times 16 dd unknown_interrupt
163
 
163
 
164
    dd   i40
164
    dd   i40
165
endg
165
endg
166
 
166
 
167
; simply return control to interrupted process
167
; simply return control to interrupted process
168
unknown_interrupt:
168
unknown_interrupt:
169
     iret
169
     iret
170
 
170
 
171
macro exc_wo_code [num]
171
macro exc_wo_code [num]
172
{
172
{
173
  forward
173
  forward
174
  e#num :
174
  e#num :
175
      mov bl, num
175
      mov bl, num
176
      jmp exc_c
176
      jmp exc_c
177
}
177
}
178
 
178
 
179
macro exc_w_code [num]
179
macro exc_w_code [num]
180
{
180
{
181
  forward
181
  forward
182
  e#num :
182
  e#num :
183
      add esp, 4
183
      add esp, 4
184
      mov bl, num
184
      mov bl, num
185
      jmp exc_c
185
      jmp exc_c
186
}
186
}
187
 
187
 
188
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
188
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
189
exc_w_code 8, 10, 11, 12, 13, 14, 17
189
exc_w_code 8, 10, 11, 12, 13, 14, 17
190
 
190
 
191
exc_c:
191
exc_c:
192
        mov   ax, os_data
192
        mov   ax, os_data
193
        mov   ds, ax
193
        mov   ds, ax
194
        mov   es, ax
194
        mov   es, ax
195
 
195
 
196
        movzx eax, bl        
196
        movzx eax, bl        
197
        mov   [error_interrupt], eax
197
        mov   [error_interrupt], eax
198
        call  show_error_parameters
198
        call  show_error_parameters
199
        
199
        
200
        mov   edx, [0x3010]
200
        mov   edx, [0x3010]
201
        mov   [edx + 0xA], byte 4
201
        mov   [edx + 0xA], byte 4
202
        
202
        
203
        jmp   change_task
203
        jmp   change_task
204
 
204
 
205
 
205
 
206
;;;;;;;;;;;;;;;;;;;;;;;
206
;;;;;;;;;;;;;;;;;;;;;;;
207
;; FPU ERROR HANDLER ;;
207
;; FPU ERROR HANDLER ;;
208
;;;;;;;;;;;;;;;;;;;;;;;
208
;;;;;;;;;;;;;;;;;;;;;;;
209
 
209
 
210
align 4
210
align 4
211
e7:
211
e7:
212
        clts
212
        clts
213
          
213
          
214
        push  eax
214
        push  eax
215
        push  ds es
215
        push  ds es
216
        
216
        
217
        mov   ax, os_data
217
        mov   ax, os_data
218
        mov   ds, ax
218
        mov   ds, ax
219
        mov   es, ax
219
        mov   es, ax
220
        
220
        
221
        mov   eax, [prev_user_of_fpu]
221
        mov   eax, [prev_user_of_fpu]
222
        shl   eax, 8
222
        shl   eax, 8
223
        add   eax, 0x80000 + 0x10
223
        add   eax, 0x80000 + 0x10
224
        fsave [eax]
224
        fsave [eax]
225
        
225
        
226
        mov   eax, [0x3000]
226
        mov   eax, [0x3000]
227
        mov   [prev_user_of_fpu], eax
227
        mov   [prev_user_of_fpu], eax
228
        shl   eax, 8
228
        shl   eax, 8
229
        add   eax, 0x80000
229
        add   eax, 0x80000
230
        cmp   [eax + 0x7f], byte 0
230
        cmp   [eax + 0x7f], byte 0
231
        je    @f
231
        je    @f
232
        frstor [eax+0x10]
232
        frstor [eax+0x10]
233
     @@:
233
     @@:
234
        mov   [eax + 0x7f], byte 1
234
        mov   [eax + 0x7f], byte 1
235
        
235
        
236
        pop   es ds
236
        pop   es ds
237
        pop   eax
237
        pop   eax
238
        
238
        
239
        iret
239
        iret
240
        
240
        
241
iglobal
241
iglobal
242
  prev_user_of_fpu dd 1
242
  prev_user_of_fpu dd 1
243
endg
243
endg
244
 
244
 
245
 
245
 
246
writehex:
246
writehex:
247
      pusha
247
      pusha
248
      
248
      
249
      mov  edi, [write_error_to]
249
      mov  edi, [write_error_to]
250
      mov  esi, 8
250
      mov  esi, 8
251
    @@:
251
    @@:
252
      mov  ecx, eax
252
      mov  ecx, eax
253
      and  ecx, 0xf
253
      and  ecx, 0xf
254
 
254
 
255
      mov  cl,[ecx+hexletters]
255
      mov  cl,[ecx+hexletters]
256
      mov  [edi],cl
256
      mov  [edi],cl
257
      dec  edi
257
      dec  edi
258
 
258
 
259
      shr  eax,4
259
      shr  eax,4
260
      dec  esi
260
      dec  esi
261
      jnz  @b
261
      jnz  @b
262
 
262
 
263
      popa
263
      popa
264
      ret
264
      ret
265
 
265
 
266
iglobal
266
iglobal
267
  hexletters  db '0123456789ABCDEF'
267
  hexletters  db '0123456789ABCDEF'
268
 
268
 
269
  error_interrupt         dd  -1
269
  error_interrupt         dd  -1
270
 
270
 
271
  process_error  db 'K : Process - forced terminate INT: 00000000',13,10,0
271
  process_error  db 'K : Process - forced terminate INT: 00000000',13,10,0
272
  process_pid    db 'K : Process - forced terminate PID: 00000000',13,10,0
272
  process_pid    db 'K : Process - forced terminate PID: 00000000',13,10,0
273
  process_eip    db 'K : Process - forced terminate EIP: 00000000',13,10,0
273
  process_eip    db 'K : Process - forced terminate EIP: 00000000',13,10,0
274
  system_error   db 'K : Kernel error',13,10,0
274
  system_error   db 'K : Kernel error',13,10,0
275
endg
275
endg
276
 
276
 
277
uglobal
277
uglobal
278
  write_error_to  dd  0x0
278
  write_error_to  dd  0x0
279
endg
279
endg
280
 
280
 
281
show_error_parameters:
281
show_error_parameters:
282
        
282
        
283
        mov    [write_error_to],process_pid+43
283
        mov    [write_error_to],process_pid+43
284
        mov    eax,[0x3000]
284
        mov    eax,[0x3000]
285
        shl    eax, 5
285
        shl    eax, 5
286
        mov    eax,[0x3000+4+eax]
286
        mov    eax,[0x3000+4+eax]
287
        call   writehex
287
        call   writehex
288
        
288
        
289
        mov    [write_error_to],process_error+43
289
        mov    [write_error_to],process_error+43
290
        mov    eax,[error_interrupt]
290
        mov    eax,[error_interrupt]
291
        call   writehex
291
        call   writehex
292
 
292
 
293
        cmp    dword [esp+4+4], os_code ; CS
293
        cmp    dword [esp+4+4], os_code ; CS
294
        jnz    @f
294
        jnz    @f
295
        mov    esi,system_error
295
        mov    esi,system_error
296
        call   sys_msg_board_str
296
        call   sys_msg_board_str
297
      @@:
297
      @@:
298
        mov    eax, [esp+4] ; EIP
298
        mov    eax, [esp+4] ; EIP
299
 
299
 
300
        mov    [write_error_to],process_eip+43
300
        mov    [write_error_to],process_eip+43
301
        call   writehex
301
        call   writehex
302
 
302
 
303
        mov    esi,process_error
303
        mov    esi,process_error
304
        call   sys_msg_board_str
304
        call   sys_msg_board_str
305
 
305
 
306
        mov    esi,process_pid
306
        mov    esi,process_pid
307
        call   sys_msg_board_str
307
        call   sys_msg_board_str
308
 
308
 
309
        mov    esi,process_eip
309
        mov    esi,process_eip
310
        call   sys_msg_board_str
310
        call   sys_msg_board_str
311
 
311
 
312
        ret
312
        ret
313
 
313
 
314
 
314
 
315
 
315
 
316
; irq1  ->  hid/keyboard.inc
316
; irq1  ->  hid/keyboard.inc
317
 
317
 
318
 
318
 
319
macro irqh [num]
319
macro irqh [num]
320
{
320
{
321
  forward
321
  forward
322
  p_irq#num :
322
  p_irq#num :
323
     pushad
323
     pushad
324
     mov   edi, num
324
     mov   edi, num
325
     jmp   irq_c
325
     jmp   irq_c
326
}
326
}
327
 
327
 
328
irqh 2,3,4,5,7,8,9,10,11,12,14,15
328
irqh 2,5,7,8,9,10,11,14,15
329
 
329
 
330
 irq_c:
330
 irq_c:
331
     push  ds es
331
     push  ds es
332
     mov   ax, os_data
332
     mov   ax, os_data
333
     mov   ds, ax
333
     mov   ds, ax
334
     mov   es, ax
334
     mov   es, ax
335
     call  irqhandler
335
     call  irqhandler
336
     pop   es ds
336
     pop   es ds
337
     popad
337
     popad
338
     iret
338
     iret
339
 
339
 
340
p_irq6:
340
p_irq6:
341
     pushad
341
     pushad
342
     push  ds es
342
     push  ds es
343
     mov   ax, os_data
343
     mov   ax, os_data
344
     mov   ds, ax
344
     mov   ds, ax
345
     mov   es, ax
345
     mov   es, ax
346
     call  fdc_irq
346
     call  fdc_irq
-
 
347
     call  ready_for_next_irq
-
 
348
     pop   es ds
-
 
349
     popad
-
 
350
     iret
-
 
351
 
-
 
352
p_irq3:
-
 
353
     pushad
347
 
354
     push  ds es
348
     mov    [check_idle_semaphore],5
355
     mov   ax, os_data
349
     mov   al, 0x20
356
     mov   ds, ax
-
 
357
     mov   es, ax
-
 
358
     call  check_mouse_data_com2
-
 
359
     pop   es ds
-
 
360
     popad
-
 
361
     iret
-
 
362
 
-
 
363
p_irq4:
-
 
364
     pushad
-
 
365
     push  ds es
-
 
366
     mov   ax, os_data
-
 
367
     mov   ds, ax
-
 
368
     mov   es, ax
-
 
369
     call  check_mouse_data_com1
-
 
370
     pop   es ds
-
 
371
     popad
-
 
372
     iret
-
 
373
 
-
 
374
p_irq12:
-
 
375
     pushad
-
 
376
     push  ds es
-
 
377
     mov   ax, os_data
-
 
378
     mov   ds, ax
350
     out   0x20, al
379
     mov   es, ax
351
 
380
     call  check_mouse_data_ps2
352
     pop   es ds
381
     pop   es ds
353
     popad
382
     popad
354
     iret
383
     iret
-
 
384
 
-
 
385
ready_for_next_irq:
-
 
386
     mov    [check_idle_semaphore],5
-
 
387
     mov   al, 0x20
-
 
388
     out   0x20, al
-
 
389
     ret
-
 
390
 
-
 
391
ready_for_next_irq_1:
-
 
392
     mov    [check_idle_semaphore],5
-
 
393
     mov   al, 0x20
-
 
394
     out    0xa0,al
-
 
395
     out   0x20, al
-
 
396
     ret
355
 
397
 
356
irqD:
398
irqD:
357
     pushad
399
     pushad
358
     push  ds es
400
     push  ds es
359
     mov   ax, os_data
401
     mov   ax, os_data
360
     mov   ds, ax
402
     mov   ds, ax
361
     mov   es, ax
403
     mov   es, ax
362
     
404
     
363
     mov   dx,0xf0
405
     mov   dx,0xf0
364
     mov   al,0
406
     mov   al,0
365
     out   dx,al
407
     out   dx,al
366
 
408
 
367
     mov   dx,0xa0
409
     mov   dx,0xa0
368
     mov   al,0x20
410
     mov   al,0x20
369
     out   dx,al
411
     out   dx,al
370
     mov   dx,0x20
412
     mov   dx,0x20
371
     out   dx,al     
413
     out   dx,al     
372
     
414
     
373
     pop   es ds
415
     pop   es ds
374
     popad
416
     popad
375
     iret
417
     iret
376
 
418
 
377
 
419
 
378
irqhandler:
420
irqhandler:
379
 
421
 
380
     push   edi
422
     push   edi
381
 
423
 
382
     mov    esi,edi          ; 1
424
     mov    esi,edi          ; 1
383
     shl    esi,6            ; 1
425
     shl    esi,6            ; 1
384
     add    esi,irq00read    ; 1
426
     add    esi,irq00read    ; 1
385
     shl    edi,12           ; 1
427
     shl    edi,12           ; 1
386
     add    edi,0x2E0000
428
     add    edi,0x2E0000
387
 
429
 
388
     mov    [check_idle_semaphore],5
430
     mov    [check_idle_semaphore],5
389
 
431
 
390
   irqnewread:
432
   irqnewread:
391
 
433
 
392
     mov    dx,[esi]         ; 2+
434
     mov    dx,[esi]         ; 2+
393
 
435
 
394
     cmp    dx,0             ; 1
436
     cmp    dx,0             ; 1
395
     jz     irqover
437
     jz     irqover
396
     cmp    [esi+3],byte 1   ; 2     ; byte read
438
     cmp    [esi+3],byte 1   ; 2     ; byte read
397
     jne    noirqbyte        ; 4-11
439
     jne    noirqbyte        ; 4-11
398
 
440
 
399
     in     al,dx
441
     in     al,dx
400
 
442
 
401
     mov    edx,[edi]
443
     mov    edx,[edi]
402
     cmp    edx,4000
444
     cmp    edx,4000
403
     je     irqfull
445
     je     irqfull
404
     mov    ebx,edi
446
     mov    ebx,edi
405
     add    ebx,0x10
447
     add    ebx,0x10
406
     add    ebx,edx
448
     add    ebx,edx
407
     mov    [ebx],al
449
     mov    [ebx],al
408
     inc    edx
450
     inc    edx
409
     mov    [edi],edx
451
     mov    [edi],edx
410
 
452
 
411
     add    esi,4
453
     add    esi,4
412
     jmp    irqnewread
454
     jmp    irqnewread
413
 
455
 
414
   noirqbyte:
456
   noirqbyte:
415
 
457
 
416
 
458
 
417
     cmp    [esi+3],byte 2     ; word read
459
     cmp    [esi+3],byte 2     ; word read
418
     jne    noirqword
460
     jne    noirqword
419
 
461
 
420
     in     ax,dx
462
     in     ax,dx
421
 
463
 
422
     mov    edx,[edi]
464
     mov    edx,[edi]
423
     cmp    edx,4000
465
     cmp    edx,4000
424
     je     irqfull
466
     je     irqfull
425
     mov    ebx,edi
467
     mov    ebx,edi
426
     add    ebx,0x10
468
     add    ebx,0x10
427
     add    ebx,edx
469
     add    ebx,edx
428
     mov    [ebx],ax
470
     mov    [ebx],ax
429
     add    edx,2
471
     add    edx,2
430
     mov    [edi],edx
472
     mov    [edi],edx
431
     add    esi,4
473
     add    esi,4
432
     jmp    irqnewread
474
     jmp    irqnewread
433
 
475
 
434
   noirqword:
476
   noirqword:
435
   irqfull:
477
   irqfull:
436
   irqover:
478
   irqover:
437
 
479
 
438
     mov    al,0x20            ; ready for next irq
480
     mov    al,0x20            ; ready for next irq
439
     out    0x20,al
481
     out    0x20,al
440
 
482
 
441
     pop    ebx
483
     pop    ebx
442
     cmp    ebx,7
484
     cmp    ebx,7
443
     jbe    noa0
485
     jbe    noa0
444
     out    0xa0,al
486
     out    0xa0,al
445
   noa0:
487
   noa0:
446
 
488
 
447
     ret
489
     ret
448
 
490
 
449
 
491
 
450
 
492
 
451
set_application_table_status:
493
set_application_table_status:
452
        push eax
494
        push eax
453
 
495
 
454
        mov  eax,[0x3000]
496
        mov  eax,[0x3000]
455
        shl  eax, 5
497
        shl  eax, 5
456
        add  eax,0x3000+4
498
        add  eax,0x3000+4
457
        mov  eax,[eax]
499
        mov  eax,[eax]
458
 
500
 
459
        mov  [application_table_status],eax
501
        mov  [application_table_status],eax
460
 
502
 
461
        pop  eax
503
        pop  eax
462
 
504
 
463
        ret
505
        ret
464
 
506
 
465
 
507
 
466
clear_application_table_status:
508
clear_application_table_status:
467
        push eax
509
        push eax
468
 
510
 
469
        mov  eax,[0x3000]
511
        mov  eax,[0x3000]
470
        shl  eax, 5
512
        shl  eax, 5
471
        add  eax,0x3000+4
513
        add  eax,0x3000+4
472
        mov  eax,[eax]
514
        mov  eax,[eax]
473
 
515
 
474
        cmp  eax,[application_table_status]
516
        cmp  eax,[application_table_status]
475
        jne  apptsl1
517
        jne  apptsl1
476
        mov  [application_table_status],0
518
        mov  [application_table_status],0
477
      apptsl1:
519
      apptsl1:
478
 
520
 
479
        pop  eax
521
        pop  eax
480
 
522
 
481
        ret
523
        ret
482
 
524
 
483
 
525
 
484
 
526
 
485
sys_resize_app_memory:
527
sys_resize_app_memory:
486
        ; eax = 1 - resize
528
        ; eax = 1 - resize
487
        ;     ebx = new amount of memory
529
        ;     ebx = new amount of memory
488
 
530
 
489
        cmp    eax,1
531
        cmp    eax,1
490
        jne    .no_application_mem_resize
532
        jne    .no_application_mem_resize
491
        
533
        
492
        jmp    new_mem_resize ;resize for new type of processes
534
        jmp    new_mem_resize ;resize for new type of processes
493
 
535
 
494
 
536
 
495
     .no_application_mem_resize:
537
     .no_application_mem_resize:
496
 
538
 
497
        ret
539
        ret
498
 
540
 
499
 
541
 
500
 
542
 
501
get_app_params:
543
get_app_params:
502
 
544
 
503
    push eax
545
    push eax
504
 
546
 
505
    cmp  [0x90000+6],word '00'
547
    cmp  [0x90000+6],word '00'
506
    jne  no_00_header
548
    jne  no_00_header
507
 
549
 
508
    mov  eax,[0x90000+12]
550
    mov  eax,[0x90000+12]
509
    mov  [app_start],eax
551
    mov  [app_start],eax
510
    mov  eax,[0x90000+16]
552
    mov  eax,[0x90000+16]
511
    mov  [app_i_end],eax
553
    mov  [app_i_end],eax
512
    mov  eax,[0x90000+20]
554
    mov  eax,[0x90000+20]
513
    mov  [app_mem],eax
555
    mov  [app_mem],eax
514
    shr  eax,1
556
    shr  eax,1
515
    sub  eax,0x10
557
    sub  eax,0x10
516
    mov  [app_esp],eax
558
    mov  [app_esp],eax
517
    mov  eax,[0x90000+24]
559
    mov  eax,[0x90000+24]
518
    mov  [app_i_param],eax
560
    mov  [app_i_param],eax
519
    mov  [app_i_icon],dword 0
561
    mov  [app_i_icon],dword 0
520
 
562
 
521
    pop  eax
563
    pop  eax
522
    mov  esi,1
564
    mov  esi,1
523
    ret
565
    ret
524
 
566
 
525
  no_00_header:
567
  no_00_header:
526
 
568
 
527
 
569
 
528
    cmp  [0x90000+6],word '01'
570
    cmp  [0x90000+6],word '01'
529
    jne  no_01_header
571
    jne  no_01_header
530
 
572
 
531
    mov  eax,[0x90000+12]
573
    mov  eax,[0x90000+12]
532
    mov  [app_start],eax
574
    mov  [app_start],eax
533
    mov  eax,[0x90000+16]
575
    mov  eax,[0x90000+16]
534
    mov  [app_i_end],eax
576
    mov  [app_i_end],eax
535
    mov  eax,[0x90000+20]
577
    mov  eax,[0x90000+20]
536
    mov  [app_mem],eax
578
    mov  [app_mem],eax
537
    mov  eax,[0x90000+24]
579
    mov  eax,[0x90000+24]
538
    mov  [app_esp],eax
580
    mov  [app_esp],eax
539
    mov  eax,[0x90000+28]
581
    mov  eax,[0x90000+28]
540
    mov  [app_i_param],eax
582
    mov  [app_i_param],eax
541
    mov  eax,[0x90000+32]
583
    mov  eax,[0x90000+32]
542
    mov  [app_i_icon],eax
584
    mov  [app_i_icon],eax
543
 
585
 
544
    pop  eax
586
    pop  eax
545
    mov  esi,1
587
    mov  esi,1
546
    ret
588
    ret
547
 
589
 
548
   no_01_header:
590
   no_01_header:
549
 
591
 
550
    pop  eax
592
    pop  eax
551
    mov  esi,0
593
    mov  esi,0
552
    ret
594
    ret
553
 
595
 
554
 
596
 
555
start_application_fl:
597
start_application_fl:
556
    jmp new_start_application_fl
598
    jmp new_start_application_fl
557
 
599
 
558
;************************************************************************
600
;************************************************************************
559
 
601
 
560
start_application_floppy:
602
start_application_floppy:
561
    jmp  new_start_application_floppy
603
    jmp  new_start_application_floppy
562
 
604
 
563
;********************************************************************
605
;********************************************************************
564
 
606
 
565
start_application_hd:
607
start_application_hd:
566
    jmp   new_start_application_hd
608
    jmp   new_start_application_hd
567
 
609
 
568
uglobal
610
uglobal
569
  new_process_place  dd  0x0
611
  new_process_place  dd  0x0
570
  app_start    dd  0x0
612
  app_start    dd  0x0
571
  app_i_end    dd  0x0
613
  app_i_end    dd  0x0
572
  app_mem      dd  0x0
614
  app_mem      dd  0x0
573
  app_esp      dd  0x0
615
  app_esp      dd  0x0
574
  app_i_param  dd  0x0
616
  app_i_param  dd  0x0
575
  app_i_icon   dd  0x0
617
  app_i_icon   dd  0x0
576
  app_mem_pos  dd  0x0
618
  app_mem_pos  dd  0x0
577
  appl_path        dd 0x0
619
  appl_path        dd 0x0
578
  appl_path_size   dd 0x0         
620
  appl_path_size   dd 0x0         
579
endg
621
endg
580
 
622
 
581
iglobal
623
iglobal
582
  hd_app_string      db  'HDAPP       '
624
  hd_app_string      db  'HDAPP       '
583
  process_loading    db 'K : Process - loading ',13,10,0
625
  process_loading    db 'K : Process - loading ',13,10,0
584
  process_running    db 'K : Process - done',13,10,0
626
  process_running    db 'K : Process - done',13,10,0
585
  first_gdt_search   dd 0x2
627
  first_gdt_search   dd 0x2
586
endg
628
endg
587
 
629
 
588
 
630
 
589
sys_threads:
631
sys_threads:
590
 
632
 
591
; eax=1 create thread
633
; eax=1 create thread
592
;
634
;
593
;   ebx=thread start
635
;   ebx=thread start
594
;   ecx=thread stack value
636
;   ecx=thread stack value
595
;
637
;
596
; on return : eax = pid
638
; on return : eax = pid
597
jmp new_sys_threads
639
jmp new_sys_threads
598
 
640
 
599
iglobal
641
iglobal
600
  process_terminating   db 'K : Process - terminating',13,10,0
642
  process_terminating   db 'K : Process - terminating',13,10,0
601
  process_terminated    db 'K : Process - done',13,10,0
643
  process_terminated    db 'K : Process - done',13,10,0
602
endg
644
endg
603
 
645
 
604
 
646
 
605
terminate: ; terminate application
647
terminate: ; terminate application
606
    push   esi
648
    push   esi
607
    mov    esi,process_terminating
649
    mov    esi,process_terminating
608
    call   sys_msg_board_str
650
    call   sys_msg_board_str
609
    pop    esi
651
    pop    esi
610
 
652
 
611
    cli
653
    cli
612
    cmp   [application_table_status],0
654
    cmp   [application_table_status],0
613
    je    term9
655
    je    term9
614
    sti
656
    sti
615
    call  change_task
657
    call  change_task
616
    jmp   terminate
658
    jmp   terminate
617
  term9:
659
  term9:
618
 
660
 
619
    call  set_application_table_status
661
    call  set_application_table_status
620
    
662
    
621
    mov    eax,esi
663
    mov    eax,esi
622
    call   dispose_app_cr3_table
664
    call   dispose_app_cr3_table
623
 
665
 
624
    cmp   [prev_user_of_fpu],esi   ; if user fpu last -> fpu user = 1
666
    cmp   [prev_user_of_fpu],esi   ; if user fpu last -> fpu user = 1
625
    jne   fpu_ok_1
667
    jne   fpu_ok_1
626
    mov   [prev_user_of_fpu],1
668
    mov   [prev_user_of_fpu],1
627
  fpu_ok_1:
669
  fpu_ok_1:
628
 
670
 
629
    mov   [0xf400],byte 0           ; empty keyboard buffer
671
    mov   [0xf400],byte 0           ; empty keyboard buffer
630
    mov   [0xf500],byte 0           ; empty button buffer
672
    mov   [0xf500],byte 0           ; empty button buffer
631
 
673
 
632
 
674
 
633
    mov   ecx,esi                 ; remove buttons
675
    mov   ecx,esi                 ; remove buttons
634
  bnewba2:
676
  bnewba2:
635
    mov   edi,[0xfe88]
677
    mov   edi,[0xfe88]
636
    mov   eax,edi
678
    mov   eax,edi
637
    cld
679
    cld
638
    movzx ebx,word [edi]
680
    movzx ebx,word [edi]
639
    inc   bx
681
    inc   bx
640
  bnewba:
682
  bnewba:
641
    dec   bx
683
    dec   bx
642
    jz    bnmba
684
    jz    bnmba
643
    add   eax,0x10
685
    add   eax,0x10
644
    cmp   cx,[eax]
686
    cmp   cx,[eax]
645
    jnz   bnewba
687
    jnz   bnewba
646
    pusha
688
    pusha
647
    mov   ecx,ebx
689
    mov   ecx,ebx
648
    inc   ecx
690
    inc   ecx
649
    shl   ecx,4
691
    shl   ecx,4
650
    mov   ebx,eax
692
    mov   ebx,eax
651
    add   eax,0x10
693
    add   eax,0x10
652
    call  memmove
694
    call  memmove
653
    dec   dword [edi]
695
    dec   dword [edi]
654
    popa
696
    popa
655
    jmp   bnewba2
697
    jmp   bnewba2
656
  bnmba:
698
  bnmba:
657
 
699
 
658
    pusha     ; save window coordinates for window restoring
700
    pusha     ; save window coordinates for window restoring
659
    cld
701
    cld
660
    shl   esi,5
702
    shl   esi,5
661
    add   esi,window_data
703
    add   esi,window_data
662
    mov   ax,[esi+0]
704
    mov   ax,[esi+0]
663
    mov   word [dlx],ax
705
    mov   word [dlx],ax
664
    mov   bx,[esi+8]
706
    mov   bx,[esi+8]
665
    add   ax,bx
707
    add   ax,bx
666
    mov   word [dlxe],ax
708
    mov   word [dlxe],ax
667
    mov   ax,[esi+4]
709
    mov   ax,[esi+4]
668
    mov   word [dly],ax
710
    mov   word [dly],ax
669
    mov   bx,[esi+12]
711
    mov   bx,[esi+12]
670
    add   ax,bx
712
    add   ax,bx
671
    mov   word [dlye],ax
713
    mov   word [dlye],ax
672
    mov   [esi+0],word 0
714
    mov   [esi+0],word 0
673
    mov   [esi+8],word 5
715
    mov   [esi+8],word 5
674
    mov   ax,[0xFE04]
716
    mov   ax,[0xFE04]
675
    mov   [esi+4],ax
717
    mov   [esi+4],ax
676
    mov   [esi+12],word 5
718
    mov   [esi+12],word 5
677
    xor   eax, eax
719
    xor   eax, eax
678
    mov   [esi+16],eax;dword 0
720
    mov   [esi+16],eax;dword 0
679
    mov   [esi+20],eax;dword 0
721
    mov   [esi+20],eax;dword 0
680
    mov   [esi+24],eax;dword 0
722
    mov   [esi+24],eax;dword 0
681
    mov   [esi+28],eax;dword 0
723
    mov   [esi+28],eax;dword 0
682
    popa
724
    popa
683
 
725
 
684
    pusha
726
    pusha
685
    mov   edi,esi
727
    mov   edi,esi
686
    shl   edi,5
728
    shl   edi,5
687
    add   edi,window_data
729
    add   edi,window_data
688
    mov   ecx,32/4
730
    mov   ecx,32/4
689
    xor   eax, eax
731
    xor   eax, eax
690
  ;  cld
732
  ;  cld
691
    rep   stosd
733
    rep   stosd
692
 
734
 
693
    mov   eax,[0xFE04]      ; set window to start from maxy+1
735
    mov   eax,[0xFE04]      ; set window to start from maxy+1
694
    add   eax,2
736
    add   eax,2
695
 
737
 
696
    mov   edi,esi
738
    mov   edi,esi
697
    shl   edi,5
739
    shl   edi,5
698
    add   edi,window_data
740
    add   edi,window_data
699
    mov   [edi+4],eax
741
    mov   [edi+4],eax
700
 
742
 
701
    popa
743
    popa
702
 
744
 
703
    pusha
745
    pusha
704
    mov   edi,esi
746
    mov   edi,esi
705
    shl   edi,5
747
    shl   edi,5
706
    add   edi,draw_data
748
    add   edi,draw_data
707
    mov   ecx,32/4
749
    mov   ecx,32/4
708
    xor   eax, eax
750
    xor   eax, eax
709
  ;  cld
751
  ;  cld
710
    rep   stosd
752
    rep   stosd
711
    popa
753
    popa
712
 
754
 
713
    pusha         ; at 0x80000+
755
    pusha         ; at 0x80000+
714
    mov   edi,esi
756
    mov   edi,esi
715
    shl   edi,8
757
    shl   edi,8
716
    add   edi,0x80000
758
    add   edi,0x80000
717
    mov   ecx,256/4
759
    mov   ecx,256/4
718
    xor   eax, eax
760
    xor   eax, eax
719
  ;  cld
761
  ;  cld
720
    rep   stosd
762
    rep   stosd
721
    popa
763
    popa
722
 
764
 
723
    pusha          ; name to spaces
765
    pusha          ; name to spaces
724
    mov   edi,esi
766
    mov   edi,esi
725
    shl   edi,8
767
    shl   edi,8
726
    add   edi,0x80000
768
    add   edi,0x80000
727
    mov   ecx,11
769
    mov   ecx,11
728
    mov   eax,' '
770
    mov   eax,' '
729
  ;  cld
771
  ;  cld
730
    rep   stosb
772
    rep   stosb
731
    popa
773
    popa
732
 
774
 
733
    pusha                ; C000 --> C400
775
    pusha                ; C000 --> C400
734
    mov   eax, 0xc000
776
    mov   eax, 0xc000
735
    mov   esi, 0
777
    mov   esi, 0
736
  nlc40:
778
  nlc40:
737
    add   eax, 2
779
    add   eax, 2
738
    inc   esi
780
    inc   esi
739
    cmp   esi, [0x3004]
781
    cmp   esi, [0x3004]
740
    jae   nlc41
782
    jae   nlc41
741
    movzx ecx, word [eax]
783
    movzx ecx, word [eax]
742
    mov   [0xC400 + ecx*2], si
784
    mov   [0xC400 + ecx*2], si
743
    jmp   nlc40
785
    jmp   nlc40
744
  nlc41:
786
  nlc41:
745
    popa
787
    popa
746
 
788
 
747
    pusha ; remove hd1 reservation
789
    pusha ; remove hd1 reservation
748
    mov   edx,esi
790
    mov   edx,esi
749
    shl   edx, 5 ;imul  edx,0x20
791
    shl   edx, 5 ;imul  edx,0x20
750
    add   edx,0x3000
792
    add   edx,0x3000
751
    mov   edx,[edx+4]
793
    mov   edx,[edx+4]
752
    cmp   [hd1_status],edx
794
    cmp   [hd1_status],edx
753
    jne   no_hd1_s_remove
795
    jne   no_hd1_s_remove
754
    mov   [hd1_status],0
796
    mov   [hd1_status],0
755
  no_hd1_s_remove:
797
  no_hd1_s_remove:
756
    popa
798
    popa
757
 
799
 
758
    pusha ; remove all irq reservations
800
    pusha ; remove all irq reservations
759
    mov   edx,esi
801
    mov   edx,esi
760
    shl   edx, 5 ;imul  edx,0x20
802
    shl   edx, 5 ;imul  edx,0x20
761
    add   edx,0x3000
803
    add   edx,0x3000
762
    mov   edx,[edx+4]
804
    mov   edx,[edx+4]
763
    mov   edi,irq_owner
805
    mov   edi,irq_owner
764
    mov   ecx,16
806
    mov   ecx,16
765
  newirqfree:
807
  newirqfree:
766
    cmp   [edi],edx
808
    cmp   [edi],edx
767
    jne   nofreeirq
809
    jne   nofreeirq
768
    mov   [edi],dword 0
810
    mov   [edi],dword 0
769
  nofreeirq:
811
  nofreeirq:
770
    add    edi,4
812
    add    edi,4
771
    loop   newirqfree
813
    loop   newirqfree
772
    popa
814
    popa
773
 
815
 
774
 
816
 
775
    pusha                     ; remove all port reservations
817
    pusha                     ; remove all port reservations
776
 
-
 
-
 
818
    mov   [deleted_process],esi
777
    mov   edx,esi
819
    mov   edx,esi
778
    shl   edx, 5 ;imul  edx,0x20
820
    shl   edx, 5 ;imul  edx,0x20
779
    add   edx,0x3000
821
    add   edx,0x3000
780
    mov   edx,[edx+4]
822
    mov   edx,[edx+4]
781
 
823
 
782
  rmpr0:
824
  rmpr0:
783
 
825
 
784
    mov   esi,[0x2d0000]
826
    mov   esi,[0x2d0000]
785
 
827
 
786
    cmp   esi,0
828
    cmp   esi,0
787
    je    rmpr9
829
    je    rmpr9
788
 
830
 
789
  rmpr3:
831
  rmpr3:
790
 
832
 
791
    mov   edi,esi
833
    mov   edi,esi
792
    shl   edi,4
834
    shl   edi,4
793
    add   edi,0x2d0000
835
    add   edi,0x2d0000
794
 
836
 
795
    cmp   edx,[edi]
837
    cmp   edx,[edi]
796
    je    rmpr4
838
    je    rmpr4
797
 
839
 
798
    dec   esi
840
    dec   esi
799
    jnz   rmpr3
841
    jnz   rmpr3
800
 
842
 
801
    jmp   rmpr9
843
    jmp   rmpr9
802
 
844
 
803
  rmpr4:
845
  rmpr4:
804
 
846
 
805
    mov   ecx,256
847
    mov   ecx,256
806
    sub   ecx,esi
848
    sub   ecx,esi
807
    shl   ecx,4
849
    shl   ecx,4
808
 
850
 
809
    mov   esi,edi
851
    mov   esi,edi
810
    add   esi,16
852
    add   esi,16
811
    cld
853
    cld
812
    rep   movsb
854
    rep   movsb
813
 
855
 
814
    dec   dword [0x2d0000]
856
    dec   dword [0x2d0000]
815
 
857
 
816
    jmp   rmpr0
858
    jmp   rmpr0
817
 
859
 
818
  rmpr9:
860
  rmpr9:
819
 
861
 
820
    popa
862
    popa
821
    mov  edi,esi         ; do not run this process slot
863
    mov  edi,esi         ; do not run this process slot
822
    shl  edi, 5
864
    shl  edi, 5
823
    mov  [edi+0x300A],byte 9
865
    mov  [edi+0x300A],byte 9
824
;    call  systest
866
;    call  systest
825
    sti  ; .. and life goes on
867
    sti  ; .. and life goes on
826
 
868
 
827
;    movzx eax,word [dlx]
869
;    movzx eax,word [dlx]
828
;    movzx ebx,word [dly]
870
;    movzx ebx,word [dly]
829
;    movzx ecx,word [dlxe]
871
;    movzx ecx,word [dlxe]
830
;    movzx edx,word [dlye]
872
;    movzx edx,word [dlye]
831
    call  calculatescreen
873
    call  calculatescreen
-
 
874
    cli
-
 
875
    mov  eax,[deleted_process]
-
 
876
    cmp  eax,[active_process]
-
 
877
    jne  no_activate_process
-
 
878
    call read_active_process_stack
-
 
879
  no_activate_process:
832
 
880
    sti
833
    xor   eax, eax
881
    xor   eax, eax
834
    xor   esi, esi
882
    xor   esi, esi
835
    call  redrawscreen
883
    call  redrawscreen
836
 
884
 
837
    mov   [0xfff4],byte 0  ; no mouse background
885
    mov   [0xfff4],byte 0  ; no mouse background
838
    mov   [0xfff5],byte 0  ; draw mouse
886
    mov   [0xfff5],byte 0  ; draw mouse
839
 
887
 
840
    mov   [application_table_status],0
888
    mov   [application_table_status],0
841
 
-
 
842
    mov   esi,process_terminated
889
    mov   esi,process_terminated
843
    call  sys_msg_board_str
890
    call  sys_msg_board_str
-
 
891
    ret
-
 
892
 
844
 
893
save_active_process_stack:
-
 
894
    cmp   [active_proc_stack_coun],0xa400+0x400-4
-
 
895
    jne   @f
-
 
896
    mov   [active_proc_stack_coun],0xa400-4
-
 
897
  @@:
-
 
898
    push  eax
-
 
899
    push  ebx
-
 
900
    mov   eax,[active_process]
-
 
901
    shl   eax,5
845
;* start code - fix error redraw for terminate (2) - Mario79
902
    add   eax,0x3000
846
;     cmp  [draw_present],1
903
    mov   [eax-twdw+31],byte 1
-
 
904
    add   [active_proc_stack_coun],4
-
 
905
    mov   eax,[active_process]
847
;     je  no_draw_background_temp
906
    mov   ebx,[active_proc_stack_coun]
-
 
907
    mov   [ebx],eax
-
 
908
    pop   ebx
-
 
909
    pop   eax
-
 
910
    ret
848
;     mov   [0xfff0],byte 1
911
 
-
 
912
read_active_process_stack:
-
 
913
    cmp   [active_proc_stack_coun],0xa400-4
-
 
914
    jne   @f
-
 
915
    mov   [active_proc_stack_coun],0xa400+0x400-4
-
 
916
  @@:
-
 
917
    push  eax
-
 
918
    push  ebx
-
 
919
    mov   ebx,[active_proc_stack_coun]
-
 
920
    mov   eax,[ebx]
-
 
921
    mov   [0xff01],eax     ; activate
849
;no_draw_background_temp:
922
    sub   [active_proc_stack_coun],4
-
 
923
    mov   [active_process_flag],1
-
 
924
    pop   ebx
850
;    mov   [draw_present],0
925
    pop   eax
851
    ret
-
 
852
;draw_present db 0
-
 
853
;* end code - fix error redraw for terminate (2) - Mario79
926
    ret
854
 
927
 
855
iglobal
928
iglobal
856
  boot_sched_1    db   'Building gdt tss pointer',0
929
  boot_sched_1    db   'Building gdt tss pointer',0
857
  boot_sched_2    db   'Building IDT table',0
930
  boot_sched_2    db   'Building IDT table',0
858
endg
931
endg
859
 
932
 
860
 
933
 
861
build_scheduler:
934
build_scheduler:
862
 
935
 
863
        mov    esi,boot_sched_1
936
        mov    esi,boot_sched_1
864
        call   boot_log
937
        call   boot_log
865
        call   build_process_gdt_tss_pointer
938
        call   build_process_gdt_tss_pointer
866
 
939
 
867
        mov    esi,boot_sched_2
940
        mov    esi,boot_sched_2
868
        call   boot_log
941
        call   boot_log
869
        call   build_interrupt_table
942
        call   build_interrupt_table
870
 
943
 
871
        ret
944
        ret