Subversion Repositories Kolibri OS

Rev

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

Rev 5593 Rev 5599
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 5593 $
8
$Revision: 5599 $
9
 
9
 
10
 
10
 
Line 11... Line 11...
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
12
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
 
14
 
-
 
15
 
15
 
16
align 32
16
align 32
17
irq0:
17
irq0:
18
        pushad
18
        pushad
19
        mov     ax, app_data
19
        Mov     ds, ax, app_data
20
        mov     ds, ax
Line 99... Line 100...
99
        xchg    esi, [current_slot]
100
        xchg    esi, [current_slot]
100
; set new stack after saving old
101
; set new stack after saving old
101
        mov     [esi+APPDATA.saved_esp], esp
102
        mov     [esi+APPDATA.saved_esp], esp
102
        mov     esp, [ebx+APPDATA.saved_esp]
103
        mov     esp, [ebx+APPDATA.saved_esp]
103
; set new thread io-map
104
; set new thread io-map
-
 
105
        mov     eax, [ebx+APPDATA.io_map]
104
        Mov     dword [page_tabs+((tss._io_map_0 and -4096) shr 10)],eax,[ebx+APPDATA.io_map]
106
        mov     dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], eax
-
 
107
        mov     eax, [ebx+APPDATA.io_map+4]
105
        Mov     dword [page_tabs+((tss._io_map_1 and -4096) shr 10)],eax,[ebx+APPDATA.io_map+4]
108
        mov     dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], eax
106
; set new thread memory-map
109
; set new thread memory-map
107
        mov     eax, [ebx+APPDATA.process]
110
        mov     eax, [ebx+APPDATA.process]
108
        cmp     eax, [current_process]
111
        cmp     eax, [current_process]
109
        je      @f
112
        je      @f
110
        mov     [current_process], eax
113
        mov     [current_process], eax
111
        mov     eax, [eax+PROC.pdt_0_phys]
114
        mov     eax, [eax+PROC.pdt_0_phys]
112
        mov     cr3, eax
115
        mov     cr3, eax
113
@@:
116
@@:
114
; set tss.esp0
117
; set tss.esp0
Line 115... Line 118...
115
 
118
 
-
 
119
        mov     eax, [ebx+APPDATA.saved_esp0]
Line 116... Line 120...
116
        Mov     [tss._esp0],eax,[ebx+APPDATA.saved_esp0]
120
        mov     [tss._esp0], eax
Line 117... Line 121...
117
 
121
 
118
        mov     edx, [ebx+APPDATA.tls_base]
122
        mov     edx, [ebx+APPDATA.tls_base]
Line 124... Line 128...
124
 
128
 
125
        mov     dx, app_tls
129
        mov     dx, app_tls
Line 126... Line 130...
126
        mov     fs, dx
130
        mov     fs, dx
127
 
131
 
-
 
132
; set gs selector unconditionally
128
; set gs selector unconditionally
133
        Mov     ax, graph_data
129
        Mov     gs,ax,graph_data
134
        Mov     gs, ax
130
      ; set CR0.TS
135
      ; set CR0.TS
131
        cmp     bh, byte[fpu_owner] ;bh == incoming task (new)
136
        cmp     bh, byte[fpu_owner] ;bh == incoming task (new)
132
        clts                        ;clear a task switch flag
137
        clts                        ;clear a task switch flag
Line 278... Line 283...
278
      ; state == 5
283
      ; state == 5
279
        pushad  ; more freedom for [APPDATA.wait_test]
284
        pushad  ; more freedom for [APPDATA.wait_test]
280
        call    [ebx+APPDATA.wait_test]
285
        call    [ebx+APPDATA.wait_test]
281
        mov     [esp+28], eax
286
        mov     [esp+28], eax
282
        popad
287
        popad
283
        or      eax, eax
288
        test    eax, eax
284
        jnz     @f
289
        jnz     @f
285
      ; testing for timeout
290
      ; testing for timeout
286
        mov     eax, [timer_ticks]
291
        mov     eax, [timer_ticks]
287
        sub     eax, [ebx+APPDATA.wait_begin]
292
        sub     eax, [ebx+APPDATA.wait_begin]
288
        cmp     eax, [ebx+APPDATA.wait_timeout]
293
        cmp     eax, [ebx+APPDATA.wait_timeout]