Subversion Repositories Kolibri OS

Rev

Rev 6 | Rev 9 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 8
Line 33... Line 33...
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
Line 37... Line -...
37
 
-
 
38
graph_data_l:
-
 
39
 
-
 
40
        dw     0x3ff
-
 
41
        dw     0x0000
-
 
42
        db     0x00
-
 
43
        dw     11010000b *256 +11110010b
-
 
44
        db     0x00
-
 
45
 
-
 
46
tss0_l:
-
 
47
      times (max_processes+10) dd 0,0
-
 
48
 
-
 
49
tss0i_l:
-
 
50
      times 0x41 dq 0 ;(256+10) dd 0,0
-
 
51
 
37
 
52
app_code_l:
38
app_code_l:
53
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
39
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
54
      dw 0
40
      dw 0
55
      db 0
41
      db 0
Line 61... Line 47...
61
      dw 0
47
      dw 0
62
      db 0
48
      db 0
63
      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)
64
      db std_application_base_address shr 24
50
      db std_application_base_address shr 24
Line -... Line 51...
-
 
51
 
-
 
52
graph_data_l:
-
 
53
 
-
 
54
        dw     0x3ff
-
 
55
        dw     0x0000
-
 
56
        db     0x00
-
 
57
        dw     11010000b *256 +11110010b
-
 
58
        db     0x00
-
 
59
 
-
 
60
tss0_l:
Line 65... Line 61...
65
 
61
      times (max_processes+10) dd 0,0
Line 66... Line 62...
66
 
62
 
67
gdte:
63
gdte:
68
 
64
 
69
 
-
 
70
 
65
 
71
idtreg:
-
 
Line -... Line 66...
-
 
66
 
-
 
67
idtreg:
-
 
68
     dw   8*0x41-1
-
 
69
     dd   idts+8
-
 
70
label idts at 0xB100-8
-
 
71
 
-
 
72
 
-
 
73
 
-
 
74
uglobal
-
 
75
 tss_sceleton:
-
 
76
  l.back   dw 0,0
-
 
77
  l.esp0   dd 0
-
 
78
  l.ss0    dw 0,0
-
 
79
  l.esp1   dd 0
-
 
80
  l.ss1    dw 0,0
-
 
81
  l.esp2   dd 0
-
 
82
  l.ss2    dw 0,0
-
 
83
  l.cr3    dd 0
-
 
84
  l.eip    dd 0
-
 
85
  l.eflags dd 0
-
 
86
  l.eax    dd 0
-
 
87
  l.ecx    dd 0
-
 
88
  l.edx    dd 0
-
 
89
  l.ebx    dd 0
-
 
90
  l.esp    dd 0
-
 
91
  l.ebp    dd 0
-
 
92
  l.esi    dd 0
-
 
93
  l.edi    dd 0
-
 
94
  l.es     dw 0,0
-
 
95
  l.cs     dw 0,0
-
 
96
  l.ss     dw 0,0
-
 
97
  l.ds     dw 0,0
72
     dw   8*0x41-1
98
  l.fs     dw 0,0
Line 73... Line 99...
73
     dd   idts+8
99
  l.gs     dw 0,0
74
 
100
  l.ldt    dw 0,0
75
label idts at 0xB100-8
101
  l.trap   dw 0
Line 97... Line 123...
97
        ret
123
        ret
Line 98... Line 124...
98
 
124
 
Line 99... Line -...
99
 
-
 
100
build_interrupt_table:
-
 
101
 
-
 
102
        mov  [l.eflags],dword 0x11002
-
 
103
        mov  [l.ss0], int_data
-
 
104
        ;mov  [l.ss1], ring1_data
-
 
105
        ;mov  [l.ss2], ring2_data
-
 
106
        mov  [l.esp0], 0x52000
-
 
107
        mov  [l.esp1], 0x53000
-
 
108
        mov  [l.esp2], 0x54000
-
 
109
 
-
 
110
        mov  eax,cr3
-
 
111
        mov  [l.cr3],eax
-
 
112
        mov  [l.cs],int_code
-
 
113
        mov  [l.ss],int_data
-
 
114
        mov  [l.ds],int_data
-
 
115
        mov  [l.es],int_data
-
 
116
        mov  [l.fs],int_data
-
 
117
        mov  [l.gs],int_data
-
 
118
 
-
 
119
        mov  eax,sys_int
-
 
120
        mov  [l.esp],0x720000
-
 
121
        mov  edi,0x290000
-
 
122
 
-
 
123
     newint:
-
 
124
        push edi
-
 
125
        mov  ebx,[eax]
-
 
126
        mov  [l.eip],ebx
-
 
127
        mov  esi,tss_sceleton
-
 
128
        mov  ecx,120/4
-
 
129
        cld
-
 
130
        rep  movsd
-
 
131
        pop  edi
-
 
132
 
-
 
133
        add  edi,128
-
 
134
        add  [l.esp],1024
-
 
135
        add  eax,4
-
 
136
 
-
 
137
        cmp  eax,sys_int+4*0x40 ;0x60
-
 
138
        jbe  newint  ;jb
-
 
139
 
-
 
140
;;
-
 
141
 
-
 
142
        mov    esi,boot_sched_3_2
-
 
143
        call   boot_log
-
 
144
 
-
 
145
        mov    ecx,0x290000
-
 
146
        mov    edi,0
-
 
147
      setgdtl2i:
-
 
148
        mov    [edi+gdts+ tss0i +0], word 128
-
 
149
        mov    [edi+gdts+ tss0i +2], cx
-
 
150
        mov    eax,ecx
-
 
151
        shr    eax,16
-
 
152
        mov    [edi+gdts+ tss0i +4], al
-
 
153
        mov    [edi+gdts+ tss0i +7], ah
-
 
154
        mov    [edi+gdts+ tss0i +5], word 01010000b *256 +11101001b
-
 
155
        add    ecx,128
-
 
156
        add    edi,8
-
 
157
        cmp    edi,8*0x40 ;0x60
-
 
158
        jbe    setgdtl2i
-
 
159
 
-
 
160
;;
-
 
161
 
-
 
162
        mov    esi,boot_sched_3_3
-
 
163
        call   boot_log
-
 
164
 
-
 
165
        mov    edi,0
-
 
166
        mov    edx,tss0i
-
 
167
     @@:
-
 
168
        mov    [edi+idts+ 8 +0], word 0
-
 
169
        mov    [edi+idts+ 8 +2], dx
-
 
170
        mov    [edi+idts+ 8 +4], word 10000101b*256 ; task gate DPL=0
-
 
171
        mov    [edi+idts+ 8 +6], word 0
-
 
172
        add    edx,8
-
 
173
        add    edi,8
-
 
174
 
-
 
175
        cmp    edi,8*0x40
-
 
176
        jb     @b
125
 
177
        
126
build_interrupt_table:
178
    ; Exceptions
127
 
179
        mov    edi, idts+8
128
        mov    edi, idts+8
180
        mov    esi, sys_int
129
        mov    esi, sys_int
181
        mov    ecx, 32
130
        mov    ecx, 0x40
182
     @@:
131
     @@:
183
        mov    eax, [esi]
132
        mov    eax, [esi]
Line 188... Line 137...
188
        mov    [edi+6], ax
137
        mov    [edi+6], ax
189
        add    esi, 4
138
        add    esi, 4
190
        add    edi, 8
139
        add    edi, 8
191
        dec    ecx
140
        dec    ecx
192
        jnz    @b
141
        jnz    @b
193
 
142
        
194
        ret
-
 
195
 
-
 
196
build_syscall_interrupt_table:
-
 
197
 
-
 
198
        ;mov    dx,tss0sys
-
 
199
        mov    edi,8*0x40+idts+8
143
        ;mov    edi,8*0x40+idts+8
200
        mov    [edi + 0], word (i40 and ((1 shl 16)-1))
144
        mov    [edi + 0], word (i40 and ((1 shl 16)-1))
201
        mov    [edi + 2], word os_code
145
        mov    [edi + 2], word os_code
202
        mov    [edi + 4], word 11101110b*256
146
        mov    [edi + 4], word 11101110b*256
203
        mov    [edi + 6], word (i40 shr 16)
147
        mov    [edi + 6], word (i40 shr 16)        
Line 204... Line 148...
204
 
148
 
Line 205... Line 149...
205
        ret
149
        ret
206
 
150
 
207
 
151
 
208
 
-
 
209
iglobal
-
 
210
  sys_int:
152
 
211
    dd   s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,sa,sb,sc,sd,se,sf
-
 
212
 
-
 
213
    dd   s10        ,s11      ;  ,i_unknown12,i_unknown13
153
iglobal
Line 214... Line 154...
214
;    dd   i_unknown14,i_unknown15,i_unknown16,i_unknown17
154
  sys_int:
215
;    dd   i_unknown18,i_unknown19,i_unknown1a,i_unknown1b
155
    dd   e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
Line 216... Line -...
216
;    dd   i_unknown1c,i_unknown1d,i_unknown1e,i_unknown1f
-
 
217
    times 14 dd unknown_interrupt
-
 
218
 
-
 
219
    dd   irq0  ,irq1  ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
-
 
220
    dd   p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD  ,p_irq14,p_irq15
156
    dd   e16,e17
Line 221... Line 157...
221
 
157
    times 14 dd unknown_interrupt
222
    ;dd   i_unknown30,i_unknown31,i_unknown32,i_unknown33
158
 
Line 223... Line -...
223
    ;dd   i_unknown34,i_unknown35,i_unknown36,i_unknown37
-
 
224
    ;dd   i_unknown38,i_unknown39,i_unknown3a,i_unknown3b
-
 
225
    ;dd   i_unknown3c,i_unknown3d,i_unknown3e,i_unknown3f
-
 
226
    times 16 dd unknown_interrupt
-
 
227
 
-
 
228
    dd   i40
-
 
229
endg
-
 
230
 
-
 
231
uglobal
-
 
232
 tss_sceleton:
-
 
233
  l.back   dw 0,0
-
 
234
  l.esp0   dd 0
-
 
235
  l.ss0    dw 0,0
-
 
236
  l.esp1   dd 0
-
 
237
  l.ss1    dw 0,0
-
 
238
  l.esp2   dd 0
-
 
239
  l.ss2    dw 0,0
-
 
240
  l.cr3    dd 0
-
 
241
  l.eip    dd 0
-
 
242
  l.eflags dd 0
-
 
243
  l.eax    dd 0
-
 
244
  l.ecx    dd 0
-
 
245
  l.edx    dd 0
-
 
246
  l.ebx    dd 0
-
 
247
  l.esp    dd 0
-
 
248
  l.ebp    dd 0
-
 
249
  l.esi    dd 0
-
 
250
  l.edi    dd 0
-
 
251
  l.es     dw 0,0
-
 
252
  l.cs     dw 0,0
-
 
253
  l.ss     dw 0,0
-
 
254
  l.ds     dw 0,0
-
 
255
  l.fs     dw 0,0
-
 
256
  l.gs     dw 0,0
-
 
257
  l.ldt    dw 0,0
-
 
258
  l.trap   dw 0
-
 
259
  l.io     dw 0
-
 
260
endg
-
 
261
 
-
 
262
s0:
-
 
263
        mov   ax, os_data
-
 
264
        mov   ds, ax
-
 
265
        mov   es, ax
-
 
266
 
-
 
267
        mov   [error_interrupt],0x0
-
 
268
        mov   [error_interrupt_entry],dword s0
-
 
269
 
-
 
270
        call  show_error_parameters
-
 
271
 
-
 
272
        mov   edx,[0x3010]
-
 
273
        mov   [edx+0xa],byte 4
-
 
274
 
-
 
275
        jmp   change_task
-
 
276
 
-
 
277
 
-
 
278
s1:
-
 
279
        mov   ax, os_data
-
 
280
        mov   ds, ax
-
 
281
        mov   es, ax
-
 
282
 
-
 
283
        mov   [error_interrupt],0x1
-
 
284
        mov   [error_interrupt_entry],dword s1
-
 
285
 
-
 
286
        call  show_error_parameters
-
 
287
 
-
 
288
        mov   edx,[0x3010]
-
 
289
        mov   [edx+0xa],byte 4
-
 
290
 
-
 
291
        jmp   change_task
-
 
292
 
-
 
293
s2:
-
 
294
        mov   ax, os_data
-
 
295
        mov   ds, ax
-
 
296
        mov   es, ax
-
 
297
 
-
 
298
        mov   [error_interrupt],0x2
-
 
299
        mov   [error_interrupt_entry],dword s2
-
 
300
 
-
 
301
        call  show_error_parameters
-
 
302
 
-
 
303
        mov   edx,[0x3010]
-
 
304
        mov   [edx+0xa],byte 4
-
 
305
 
-
 
306
        jmp   change_task
159
    dd   irq0  ,irq1  ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
307
 
-
 
308
s3:
-
 
309
        mov   ax, os_data
-
 
310
        mov   ds, ax
-
 
311
        mov   es, ax
-
 
312
 
-
 
313
        mov   [error_interrupt],0x3
-
 
314
        mov   [error_interrupt_entry],dword s3
-
 
315
 
-
 
316
        call  show_error_parameters
-
 
317
 
-
 
318
        mov   edx,[0x3010]
-
 
319
        mov   [edx+0xa],byte 4
-
 
320
 
160
    dd   p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD  ,p_irq14,p_irq15
321
        jmp   change_task
-
 
322
 
-
 
323
s4:
-
 
324
        mov   ax, os_data
-
 
325
        mov   ds, ax
-
 
326
        mov   es, ax
-
 
327
 
-
 
328
        mov   [error_interrupt],0x4
-
 
329
        mov   [error_interrupt_entry],dword s4
-
 
330
 
-
 
331
        call  show_error_parameters
-
 
332
 
-
 
333
        mov   edx,[0x3010]
161
 
334
        mov   [edx+0xa],byte 4
-
 
335
 
-
 
336
        jmp   change_task
-
 
337
 
-
 
338
s5:
-
 
339
        mov   ax, os_data
-
 
340
        mov   ds, ax
-
 
341
        mov   es, ax
-
 
Line -... Line 162...
-
 
162
    times 16 dd unknown_interrupt
-
 
163
 
-
 
164
    dd   i40
-
 
165
endg
-
 
166
 
342
 
167
; simply return control to interrupted process
-
 
168
unknown_interrupt:
Line -... Line 169...
-
 
169
     iret
343
        mov   [error_interrupt],0x5
170
 
344
        mov   [error_interrupt_entry],dword s5
171
macro exceptions [num]
345
 
172
{
346
        call  show_error_parameters
173
  forward
Line 347... Line 174...
347
 
174
  e#num :
348
        mov   edx,[0x3010]
175
  	mov bl, num
349
        mov   [edx+0xa],byte 4
-
 
350
 
176
  	jmp exc_c
351
        jmp   change_task
177
}
352
 
178
 
353
s6:
179
exceptions 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
354
        mov   ax, os_data
180
exc_c:
355
        mov   ds, ax
181
        mov   ax, os_data
Line 356... Line 182...
356
        mov   es, ax
182
        mov   ds, ax
357
 
183
        mov   es, ax
358
        mov   [error_interrupt],0x6
184
 
Line 359... Line 185...
359
        mov   [error_interrupt_entry],dword s6
185
        movzx eax, bl        
360
 
186
        mov   [error_interrupt], eax
361
        call  show_error_parameters
187
        call  show_error_parameters
Line 362... Line 188...
362
 
188
        
363
        mov   edx,[0x3010]
189
        mov   edx, [0x3010]
Line 404... Line 230...
404
iglobal
230
iglobal
405
  prev_user_of_fpu dd 1
231
  prev_user_of_fpu dd 1
406
endg
232
endg
Line 407... Line -...
407
 
-
 
408
 
-
 
409
s8:
-
 
410
        add   esp, 4 ; zero on the stack!
-
 
411
        mov   ax, os_data
-
 
412
        mov   ds, ax
-
 
413
        mov   es, ax
-
 
414
 
-
 
415
        mov   [error_interrupt],0x8
-
 
416
        mov   [error_interrupt_entry],dword s8
-
 
417
 
-
 
418
        call  show_error_parameters
-
 
419
 
-
 
420
        mov   edx,[0x3010]
-
 
421
        mov   [edx+0xa],byte 4
-
 
422
 
-
 
423
        jmp   change_task
-
 
424
 
-
 
425
s9:
-
 
426
        mov   ax, os_data
-
 
427
        mov   ds, ax
-
 
428
        mov   es, ax
-
 
429
 
-
 
430
        mov   [error_interrupt],0x9
-
 
431
        mov   [error_interrupt_entry],dword s9
-
 
432
 
-
 
433
        call  show_error_parameters
-
 
434
 
-
 
435
        mov   edx,[0x3010]
-
 
436
        mov   [edx+0xa],byte 4
-
 
437
 
-
 
438
        jmp   change_task
-
 
439
 
-
 
440
; Invalid TSS
-
 
441
sa:
-
 
442
        add   esp, 4 ; error code
-
 
443
        mov   ax, os_data
-
 
444
        mov   ds, ax
-
 
445
        mov   es, ax
-
 
446
 
-
 
447
        mov   [error_interrupt],0xa
-
 
448
        mov   [error_interrupt_entry],dword sa
-
 
449
 
-
 
450
        call  show_error_parameters
-
 
451
 
-
 
452
        mov   edx,[0x3010]
-
 
453
        mov   [edx+0xa],byte 4
-
 
454
 
-
 
455
        jmp   change_task
-
 
456
 
-
 
457
; Segment not present
-
 
458
sb:
-
 
459
	add   esp, 4
-
 
460
        mov   ax, os_data
-
 
461
        mov   ds, ax
-
 
462
        mov   es, ax
-
 
463
 
-
 
464
        mov   [error_interrupt],0xb
-
 
465
        mov   [error_interrupt_entry],dword sb
-
 
466
 
-
 
467
        call  show_error_parameters
-
 
468
 
-
 
469
        mov   edx,[0x3010]
-
 
470
        mov   [edx+0xa],byte 4
-
 
471
 
-
 
472
        jmp   change_task
-
 
473
 
-
 
474
; Stack fault exception
-
 
475
sc:
-
 
476
	add   esp, 4
-
 
477
        mov   ax, os_data
-
 
478
        mov   ds, ax
-
 
479
        mov   es, ax
-
 
480
 
-
 
481
        mov   [error_interrupt],0xc
-
 
482
        mov   [error_interrupt_entry],dword sc
-
 
483
 
-
 
484
        call  show_error_parameters
-
 
485
 
-
 
486
        mov   edx,[0x3010]
-
 
487
        mov   [edx+0xa],byte 4
-
 
488
 
-
 
489
        jmp   change_task
-
 
490
 
-
 
491
; General Protection Fault
-
 
492
sd:
-
 
493
	add   esp, 4
-
 
494
        mov   ax, os_data
-
 
495
        mov   ds, ax
-
 
496
        mov   es, ax
-
 
497
 
-
 
498
        mov   [error_interrupt],0xd
-
 
499
        mov   [error_interrupt_entry],dword sd
-
 
500
 
-
 
501
        call  show_error_parameters
-
 
502
 
-
 
503
        mov   edx,[0x3010]
-
 
504
        mov   [edx+0xa],byte 4
-
 
505
 
-
 
506
        jmp   change_task
-
 
507
 
-
 
508
; Page-Fault Exception
-
 
509
se:
-
 
510
	add   esp, 4
-
 
511
        mov   ax, os_data
-
 
512
        mov   ds, ax
-
 
513
        mov   es, ax
-
 
514
 
-
 
515
        mov   [error_interrupt],0xe
-
 
516
        mov   [error_interrupt_entry],dword se
-
 
517
 
-
 
518
        call  show_error_parameters
-
 
519
 
-
 
520
        mov   edx,[0x3010]
-
 
521
        mov   [edx+0xa],byte 4
-
 
522
 
-
 
523
        jmp   change_task
-
 
524
 
-
 
525
; ??
-
 
526
sf:
-
 
527
        mov   ax, os_data
-
 
528
        mov   ds, ax
-
 
529
        mov   es, ax
-
 
530
 
-
 
531
        mov   [error_interrupt],0xf
-
 
532
        mov   [error_interrupt_entry],dword sf
-
 
533
 
-
 
534
        call  show_error_parameters
-
 
535
 
-
 
536
        mov   edx,[0x3010]
-
 
537
        mov   [edx+0xa],byte 4
-
 
538
 
-
 
539
        jmp   change_task
-
 
540
 
-
 
541
; x87 FPU Floating-Point Error
-
 
542
s10:
-
 
543
        mov   ax, os_data
-
 
544
        mov   ds, ax
-
 
545
        mov   es, ax
-
 
546
 
-
 
547
        mov   [error_interrupt],0x10
-
 
548
        mov   [error_interrupt_entry],dword s10
-
 
549
 
-
 
550
        call  show_error_parameters
-
 
551
 
-
 
552
        mov   edx,[0x3010]
-
 
553
        mov   [edx+0xa],byte 4
-
 
554
 
-
 
555
        jmp   change_task
-
 
556
 
-
 
557
; Alignment Check Exception
-
 
558
s11:
-
 
559
	add   esp, 4
-
 
560
        mov   ax, os_data
-
 
561
        mov   ds, ax
-
 
562
        mov   es, ax
-
 
563
 
-
 
564
        mov   [error_interrupt],0x11
-
 
565
        mov   [error_interrupt_entry],dword s11
-
 
566
 
-
 
567
        call  show_error_parameters
-
 
568
 
-
 
569
        mov   edx,[0x3010]
-
 
570
        mov   [edx+0xa],byte 4
-
 
571
 
-
 
Line 572... Line 233...
572
        jmp   change_task
233
 
573
 
-
 
574
 
234
 
-
 
235
 
-
 
236
 
-
 
237
 
-
 
238
writehex:
-
 
239
      pusha
-
 
240
      
Line 575... Line -...
575
 
-
 
576
 
-
 
577
writehex:
-
 
578
 
-
 
579
      pusha
-
 
580
 
-
 
581
      mov  ecx,eax
-
 
582
      mov  ax,word [printerrorat]
-
 
583
      shl  eax,16
-
 
584
      mov  ax,[esp+32+4]
-
 
585
      sub  ax,60
-
 
586
      mov  edx,1
241
      mov  edi, [write_error_to]
587
      mov  esi,8
-
 
588
      mov  ebx,0xffffff
-
 
589
    whl1:
-
 
590
      push ecx
-
 
591
      and  ecx,0xf
242
      mov  esi, 8
592
      add  ecx,hexletters
243
    @@:
Line 593... Line -...
593
      mov  edi,1
-
 
594
 
244
      mov  ecx, eax
595
      mov  cl,[ecx]
-
 
596
      mov  edi,[write_error_to]
245
      and  ecx, 0xf
597
      mov  [edi],cl
246
 
Line 598... Line 247...
598
      dec  [write_error_to]
247
      mov  cl,[ecx+hexletters]
599
 
248
      mov  [edi],cl
Line 600... Line 249...
600
      pop  ecx
249
      dec  edi
601
      shr  ecx,4
250
 
Line 602... Line 251...
602
      sub  eax,6*65536
251
      shr  eax,4
603
      dec  esi
-
 
604
      jnz  whl1
-
 
605
 
-
 
Line 606... Line 252...
606
      popa
252
      dec  esi
607
      ret
253
      jnz  @b
608
 
254
 
609
iglobal
255
      popa
Line 636... Line 282...
636
        mov    eax,[error_interrupt]
282
        mov    eax,[error_interrupt]
637
        call   writehex
283
        call   writehex
Line 638... Line 284...
638
        
284
        
639
        mov    eax,[0x3000]
285
        mov    eax,[0x3000]
640
        shl    eax,8
286
        shl    eax,8
641
        cmp    [0x80000+eax+0xB0],dword 0
287
        cmp    [0x80000+eax+0xB0],byte 0
Line 642... Line 288...
642
        jnz    .system_error
288
        jnz    .system_error
643
 
289
 
644
        mov    eax,[0x3000]
290
        mov    eax,[0x3000]
Line 670... Line 316...
670
 
316
 
Line 671... Line -...
671
 
-
 
672
 
-
 
673
; irq1  ->  hid/keyboard.inc
-
 
674
 
-
 
675
p_irq2:
-
 
676
 
-
 
677
     call  restore_caller
-
 
678
 
-
 
679
     mov   edi,2               ; 1
-
 
680
     call  irqhandler          ; 2/5
-
 
681
 
-
 
682
     call  return_to_caller
-
 
Line 683... Line -...
683
 
-
 
684
     jmp   p_irq2
-
 
685
 
-
 
686
p_irq3:
317
 
687
 
-
 
688
     call  restore_caller
-
 
689
 
-
 
690
     mov   edi,3
-
 
691
     call  irqhandler
318
 
692
 
319
; irq1  ->  hid/keyboard.inc
693
     call  return_to_caller
-
 
694
 
-
 
695
     jmp   p_irq3
-
 
696
 
-
 
697
p_irq4:
-
 
698
 
-
 
699
     call  restore_caller
-
 
700
 
-
 
701
     mov   edi,4
-
 
702
     call  irqhandler
-
 
703
 
320
 
704
     call  return_to_caller
-
 
705
 
-
 
706
     jmp   p_irq4
-
 
707
 
321
 
708
p_irq5:
-
 
709
 
-
 
710
     call  restore_caller
-
 
711
 
-
 
712
     mov   edi,5
-
 
713
     call  irqhandler
-
 
714
 
-
 
715
     call  return_to_caller
-
 
716
 
-
 
717
     jmp   p_irq5
-
 
718
 
-
 
719
p_irq6:
-
 
720
 
322
macro irqhh [num]
721
     call  restore_caller
-
 
722
 
-
 
723
     call  fdc_irq
-
 
724
 
-
 
725
     mov   edi,6
323
{
726
     call  irqhandler
-
 
727
 
-
 
728
     call  return_to_caller
-
 
729
 
-
 
730
     jmp   p_irq6
324
  forward
731
 
-
 
732
p_irq7:
-
 
733
 
325
  p_irq#num :
734
     call  restore_caller
326
     pushad
735
 
-
 
736
     mov   edi,7
-
 
737
     call  irqhandler
327
     mov   edi, num
738
 
328
     jmp   irq_c
739
     call  return_to_caller
-
 
740
 
-
 
741
     jmp   p_irq7
-
 
742
 
329
}
743
p_irq8:
-
 
744
 
-
 
745
     call  restore_caller
-
 
746
 
-
 
747
     mov   edi,8
-
 
748
     call  irqhandler
-
 
749
 
-
 
750
     call  return_to_caller
-
 
751
 
330
 
752
     jmp   p_irq8
-
 
753
 
331
irqhh 2,3,4,5,6,7,8,9,10,11,12,14,15
754
p_irq9:
-
 
755
 
-
 
756
     call  restore_caller
-
 
757
 
-
 
758
     mov   edi,9
-
 
759
     call  irqhandler
-
 
760
 
-
 
761
     call  return_to_caller
-
 
762
 
-
 
763
     jmp   p_irq9
-
 
764
 
332
 
765
p_irq10:
333
 irq_c:
766
 
-
 
767
     call  restore_caller
-
 
768
 
-
 
769
     mov   edi,10
-
 
770
     call  irqhandler
-
 
771
 
-
 
772
     call  return_to_caller
-
 
773
 
-
 
774
     jmp   p_irq10
-
 
775
 
334
     push  ds es
776
p_irq11:
-
 
777
 
-
 
778
     call  restore_caller
-
 
779
 
-
 
780
     mov   edi,11
-
 
781
     call  irqhandler
-
 
782
 
-
 
783
     call  return_to_caller
-
 
784
 
-
 
785
     jmp   p_irq11
-
 
786
 
335
     mov   ax, os_data
787
p_irq12:
-
 
788
 
-
 
789
      call  restore_caller
-
 
790
 
-
 
791
      mov   edi,12
336
     mov   ds, ax
792
      call  irqhandler
337
     mov   es, ax
793
 
338
     call  irqhandler
-
 
339
     pop   es ds
-
 
340
     popad
794
      call  return_to_caller
341
     iret
-
 
342
  	
-
 
343
irqD:
795
 
344
     pushad
796
      jmp   p_irq12
345
     push  ds es
797
 
346
     mov   ax, os_data
798
irqD:
347
     mov   ds, ax
Line 799... Line 348...
799
     call   restore_caller
348
     mov   es, ax
800
 
349
     
801
     mov   dx,0xf0
350
     mov   dx,0xf0
802
     mov   al,0
351
     mov   al,0
803
     out   dx,al
352
     out   dx,al
804
 
-
 
805
     mov   dx,0xa0
-
 
806
     mov   al,0x20
-
 
807
     out   dx,al
-
 
808
     mov   dx,0x20
-
 
809
     out   dx,al
-
 
810
 
-
 
811
     call  return_to_caller
-
 
812
 
-
 
Line 813... Line 353...
813
     jmp   irqD
353
 
814
     
-
 
815
 
-
 
816
p_irq14:
-
 
817
 
-
 
818
     call  restore_caller
-
 
819
     
-
 
820
     mov   edi,14
-
 
821
     call  irqhandler
-
 
822
 
-
 
823
     call  return_to_caller
-
 
824
 
354
     mov   dx,0xa0
825
     jmp   p_irq14
-
 
826
 
-
 
827
p_irq15:
-
 
828
 
-
 
829
     call  restore_caller
-
 
830
 
-
 
831
     mov   edi,15
-
 
832
     call  irqhandler
-
 
833
 
-
 
834
     call  return_to_caller
-
 
835
 
-
 
836
     jmp   p_irq15
-
 
837
 
-
 
838
 
-
 
839
 
-
 
840
align 4
355
     mov   al,0x20
841
restore_caller:
-
 
842
 
-
 
843
      mov    edi,[0x3000]
-
 
Line 844... Line -...
844
      shl    edi, 3
-
 
845
      mov    [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
846
 
-
 
847
      ret
-
 
848
 
-
 
849
align 4
-
 
850
return_to_caller:
-
 
851
 
-
 
Line 852... Line -...
852
      mov   ebx,[0x3000]
-
 
Line 853... Line 356...
853
      shl   bx,3
356
     out   dx,al
854
      add   bx,tss0;t
357
     mov   dx,0x20
855
      mov   [tss_irq12],bx
358
     out   dx,al     
Line 934... Line 437...
934
   noa0:
437
   noa0:
Line 935... Line 438...
935
 
438
 
Line 936... Line -...
936
     ret
-
 
937
 
-
 
938
 
-
 
939
; simply return control to interrupted process
-
 
940
unknown_interrupt:
-
 
941
     iret
-
 
Line 942... Line 439...
942
 
439
     ret
943
 
440
 
Line 944... Line 441...
944
 
441
 
945
 
-
 
946
set_application_table_status:
442
 
947
        push eax
443
set_application_table_status:
948
 
444
        push eax
Line 949... Line 445...
949
        mov  eax,[0x3000]
445
 
Line 961... Line 457...
961
 
457
 
962
clear_application_table_status:
458
clear_application_table_status:
Line 963... Line 459...
963
        push eax
459
        push eax
964
 
-
 
965
        mov  eax,[0x3000]
460
 
966
        ;imul eax,32
461
        mov  eax,[0x3000]
967
        shl  eax, 5
462
        shl  eax, 5
Line 968... Line 463...
968
        add  eax,0x3000+4
463
        add  eax,0x3000+4
Line 1354... Line 849...
1354
;draw_present db 0
849
;draw_present db 0
1355
;* end code - fix error redraw for terminate (2) - Mario79
850
;* end code - fix error redraw for terminate (2) - Mario79
Line 1356... Line 851...
1356
 
851
 
1357
iglobal
852
iglobal
1358
  boot_sched_1    db   'Building gdt tss pointer',0
853
  boot_sched_1    db   'Building gdt tss pointer',0
1359
  ;boot_sched_2    db   'Building gdt gate pointer',0
-
 
1360
  boot_sched_3    db   'Building interrupt table - TSS',0
-
 
1361
  boot_sched_3_2  db   'Building interrupt table - GDT',0
-
 
1362
  boot_sched_3_3  db   'Building interrupt table - IDT',0
-
 
1363
  boot_sched_4    db   'Building syscall interrupt table',0
854
  boot_sched_2    db   'Building IDT table',0
Line 1364... Line 855...
1364
endg
855
endg
Line 1365... Line 856...
1365
 
856
 
1366
 
857
 
1367
build_scheduler:
858
build_scheduler:
Line 1368... Line 859...
1368
 
859
 
1369
        mov    esi,boot_sched_1
-
 
1370
        call   boot_log
-
 
1371
        call   build_process_gdt_tss_pointer
-
 
1372
 
-
 
1373
;        mov    esi,boot_sched_2
860
        mov    esi,boot_sched_1
1374
;        call   boot_log
861
        call   boot_log
Line 1375... Line -...
1375
;        call   build_process_gdt_gate_pointer
-
 
1376
 
-
 
1377
        mov    esi,boot_sched_3
-
 
1378
        call   boot_log
-
 
1379
        call   build_interrupt_table
862
        call   build_process_gdt_tss_pointer