Subversion Repositories Kolibri OS

Rev

Rev 434 | Rev 473 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 434 Rev 465
Line 1... Line 1...
1
$Revision: 434 $
1
$Revision: 465 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
Line 15... Line 15...
15
align 4
15
align 4
16
idtreg:
16
idtreg:
17
     dw   8*0x41-1
17
     dw   8*0x41-1
18
     dd   idts+8
18
     dd   idts+8
Line 19... Line -...
19
 
-
 
20
build_process_gdt_tss_pointer:
-
 
21
 
-
 
22
        mov    ecx,tss_data
-
 
23
        mov    edi,0
-
 
24
      setgdtl2:
-
 
25
        mov    [edi+gdts+ tss0 +0], word tss_step
-
 
26
        mov    [edi+gdts+ tss0 +2], cx
-
 
27
        mov    eax,ecx
-
 
28
        shr    eax,16
-
 
29
        mov    [edi+gdts+ tss0 +4], al
-
 
30
        mov    [edi+gdts+ tss0 +7], ah
-
 
31
        mov    [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
32
        add    ecx,tss_step
-
 
33
        add    edi,8
-
 
34
        cmp    edi,8*(max_processes+5)
-
 
35
        jbe    setgdtl2
-
 
36
 
-
 
37
        ret
-
 
38
 
19
 
Line 39... Line 20...
39
build_interrupt_table:
20
build_interrupt_table:
40
 
21
 
41
        mov    edi, idts+8
22
        mov    edi, idts+8
Line 65... Line 46...
65
 
46
 
66
    dd except_16, e17,e18, except_19
47
    dd except_16, e17,e18, except_19
Line 67... Line 48...
67
    times 12 dd unknown_interrupt
48
    times 12 dd unknown_interrupt
68
 
49
 
69
    dd   irq0  , irq_serv.irq_1, p_irq2 , p_irq3     ;irq_serv.irq_3
50
    dd   irq0  , irq_serv.irq_1, p_irq2 , p_irq3     ;irq_serv.irq_3
70
    dd   p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
51
    dd   irq_serv.irq_4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
Line 71... Line 52...
71
    dd   irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
52
    dd   irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
Line 72... Line 53...
72
    dd   irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
53
    dd   irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
73
 
54
 
Line 74... Line 55...
74
    times 16 dd unknown_interrupt
55
    times 16 dd unknown_interrupt
75
 
56
 
76
    dd   i40
-
 
77
endg
57
    dd   i40
78
 
58
endg
79
macro save_ring3_context
59
 
80
{
60
macro save_ring3_context
81
    push    ds es
61
{
82
    pushad
-
 
83
}
62
    pushad
Line 84... Line 63...
84
macro restore_ring3_context
63
}
85
{
64
macro restore_ring3_context
86
    popad
65
{
Line 112... Line 91...
112
 
91
 
113
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 18
92
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 18
Line 114... Line 93...
114
exc_w_code 8, 10, 11, 12, 13, 14, 17
93
exc_w_code 8, 10, 11, 12, 13, 14, 17
115
 
94
 
116
exc_c:
95
exc_c:
117
        mov   ax, os_data
96
        mov   ax, app_data  ;èñêëþ÷åíèå
Line 118... Line 97...
118
        mov   ds, ax
97
        mov   ds, ax        ;çàãðóçèì ïðàâèëüíûå çíà÷åíè
119
        mov   es, ax
98
        mov   es, ax        ;â ðåãèñòðû
120
 
99
 
121
; test if debugging
-
 
122
        cli
100
; test if debugging
123
        mov   eax, [CURRENT_TASK]
101
        cli
124
        shl   eax, 8
102
        mov   eax, [current_slot]
125
        mov   eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
103
        mov   eax, [eax+APPDATA.debugger_slot]
126
        test  eax, eax
104
        test  eax, eax
127
        jnz   .debug
105
        jnz   .debug
128
        sti
106
        sti
129
; not debuggee => say error and terminate
107
; not debuggee => say error and terminate
130
        add   esp, 28h
108
        add   esp, 0x20  ;28h
Line 131... Line 109...
131
        movzx eax, bl
109
        movzx eax, bl
Line 241... Line 219...
241
}
219
}
Line 242... Line 220...
242
 
220
 
Line 243... Line 221...
243
irqh 2,5,7,8,9,10,11
221
irqh 2,5,7,8,9,10,11
244
 
222
 
245
 irq_c:
223
irq_c:
246
     mov   ax, os_data
224
     mov   ax, app_data  ;os_data
247
     mov   ds, ax
225
     mov   ds, ax
248
     mov   es, ax
226
     mov   es, ax
249
     call  irqhandler
227
     call  irqhandler
Line 250... Line 228...
250
     restore_ring3_context
228
     restore_ring3_context
251
     iret
229
     iret
252
 
230
 
253
p_irq6:
231
p_irq6:
254
     save_ring3_context
232
     save_ring3_context
255
     mov   ax, os_data
233
     mov   ax, app_data  ;os_data
256
     mov   ds, ax
234
     mov   ds, ax
257
     mov   es, ax
235
     mov   es, ax
258
     call  fdc_irq
236
     call  fdc_irq
Line 259... Line 237...
259
     call  ready_for_next_irq
237
     call  ready_for_next_irq
260
     restore_ring3_context
238
     restore_ring3_context
261
     iret
239
     iret
262
 
240
 
263
p_irq3:
241
p_irq3:
264
     save_ring3_context
242
     save_ring3_context
265
     mov   ax, os_data
243
     mov   ax, app_data  ;os_data
266
     mov   ds, ax
244
     mov   ds, ax
Line 276... Line 254...
276
     restore_ring3_context
254
     restore_ring3_context
277
     iret
255
     iret
Line 278... Line 256...
278
 
256
 
279
p_irq4:
257
p_irq4:
280
     save_ring3_context
258
     save_ring3_context
281
     mov   ax, os_data
259
     mov   ax, app_data  ;os_data
282
     mov   ds, ax
260
     mov   ds, ax
283
     mov   es, ax
261
     mov   es, ax
284
     cmp   [com1_mouse_detected],0
262
     cmp   [com1_mouse_detected],0
285
     je    old_irq4_handler
263
     je    old_irq4_handler
Line 292... Line 270...
292
     restore_ring3_context
270
     restore_ring3_context
293
     iret
271
     iret
Line 294... Line 272...
294
 
272
 
295
p_irq12:
273
p_irq12:
296
     save_ring3_context
274
     save_ring3_context
297
     mov   ax, os_data
275
     mov   ax, app_data  ;os_data
298
     mov   ds, ax
276
     mov   ds, ax
299
     mov   es, ax
277
     mov   es, ax
300
     call  check_mouse_data_ps2
278
     call  check_mouse_data_ps2
301
     restore_ring3_context
279
     restore_ring3_context
Line 302... Line 280...
302
     iret
280
     iret
303
 
281
 
304
p_irq14:
282
p_irq14:
305
        save_ring3_context
283
        save_ring3_context
306
        mov     ax, os_data
284
        mov     ax, app_data  ;os_data
307
        mov     ds, ax
285
        mov     ds, ax
308
        mov     es, ax
286
        mov     es, ax
309
        call    [irq14_func]
287
        call    [irq14_func]
310
        call    ready_for_next_irq_1
288
        call    ready_for_next_irq_1
311
        restore_ring3_context
289
        restore_ring3_context
312
        iret
290
        iret
313
p_irq15:
291
p_irq15:
314
        save_ring3_context
292
        save_ring3_context
315
        mov     ax, os_data
293
        mov     ax, app_data  ;os_data
316
        mov     ds, ax
294
        mov     ds, ax
317
        mov     es, ax
295
        mov     es, ax
318
        call    [irq15_func]
296
        call    [irq15_func]
Line 333... Line 311...
333
     out   0x20, al
311
     out   0x20, al
334
     ret
312
     ret
Line 335... Line 313...
335
 
313
 
336
irqD:
314
irqD:
337
     save_ring3_context
315
     save_ring3_context
338
     mov   ax, os_data
316
     mov   ax, app_data  ;os_data
339
     mov   ds, ax
317
     mov   ds, ax
Line 340... Line 318...
340
     mov   es, ax
318
     mov   es, ax
341
 
319
 
Line 672... Line 650...
672
           stdcall kernel_free, ebx
650
           stdcall kernel_free, ebx
Line 673... Line 651...
673
 
651
 
674
           mov edi, [.slot]
652
           mov edi, [.slot]
675
           shl edi,8
653
           shl edi,8
-
 
654
           add edi,SLOT_BASE
-
 
655
 
-
 
656
           mov eax, [edi+APPDATA.io_map]
-
 
657
           cmp eax, (tss._io_map_0-OS_BASE+PG_MAP)
-
 
658
           je @F
-
 
659
           call free_page
-
 
660
@@:
-
 
661
           mov eax, [edi+APPDATA.io_map+4]
-
 
662
           cmp eax, (tss._io_map_1-OS_BASE+PG_MAP)
-
 
663
           je @F
-
 
664
           call free_page
676
           add edi,SLOT_BASE
665
@@:
677
           mov eax, 0x20202020
666
           mov eax, 0x20202020
678
           stosd
667
           stosd
679
           stosd
668
           stosd
680
           stosd
669
           stosd
Line 835... Line 824...
835
endg
824
endg
Line 836... Line 825...
836
 
825
 
Line 837... Line 826...
837
 
826
 
838
build_scheduler:
827
build_scheduler:
839
 
828
 
Line 840... Line 829...
840
;        mov    esi,boot_sched_1
829
        mov    esi,boot_sched_1
841
;        call   boot_log
830
        call   boot_log
842
        call   build_process_gdt_tss_pointer
-
 
Line 843... Line 831...
843
 
831
  ;      call   build_process_gdt_tss_pointer