Subversion Repositories Kolibri OS

Rev

Rev 434 | Rev 477 | 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 10... Line 10...
10
;;                                                            ;;
10
;;                                                            ;;
11
;;                   SYSTEM CALL ENTRY                        ;;
11
;;                   SYSTEM CALL ENTRY                        ;;
12
;;                                                            ;;
12
;;                                                            ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 14... Line 14...
14
 
14
 
15
align 32
15
align 16
16
i40:
16
i40:
17
; diamond, 27.03.2007: handler does not require disabled interrupts
17
; diamond, 27.03.2007: handler does not require disabled interrupts
18
;                      so interrupts remain enabled when calling int 0x40
-
 
19
      push  ds es
18
;                      so interrupts remain enabled when calling int 0x40
20
      pushad
19
      pushad
Line 21... Line 20...
21
      cld
20
      cld
22
 
21
 
23
      mov   ax,word os_data
22
 ;     mov   ax, word app_data
Line 24... Line 23...
24
      mov   ds,ax
23
 ;     mov   ds, ax
25
      mov   es,ax
24
 ;     mov   es, ax
26
 
25
 
27
      ; load all registers in crossed order
26
      ; load all registers in crossed order
Line 36... Line 35...
36
;      sti
35
;      sti
37
      push  eax
36
      push  eax
38
      and   edi,0xff
37
      and   edi,0xff
39
      call  dword [servetable+edi*4]
38
      call  dword [servetable+edi*4]
40
      pop   eax
39
      pop   eax
41
;      cli
-
 
Line 42... Line 40...
42
 
40
 
43
      popad
-
 
44
      pop   es ds
41
      popad
Line 45... Line 42...
45
      iretd
42
      iretd
46
 
43
 
Line 65... Line 62...
65
     ;   mov     eax, [ss:CURRENT_TASK]
62
     ;   mov     eax, [ss:CURRENT_TASK]
66
     ;   shl     eax, 8
63
     ;   shl     eax, 8
67
     ;   mov     eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
64
     ;   mov     eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
68
     ;   lea     esp, [eax + RING0_STACK_SIZE]           ; configure ESP
65
     ;   lea     esp, [eax + RING0_STACK_SIZE]           ; configure ESP
69
     ;   mov     eax, [ss:sysenter_stack - 4]            ; eax - original eax, from app
66
     ;   mov     eax, [ss:sysenter_stack - 4]            ; eax - original eax, from app
70
        mov     esp, [ss:CURRENT_RING0_ESP]
67
        mov     esp, [ss:tss._esp0]
Line 71... Line 68...
71
 
68
 
72
	sti
69
	sti
73
	;------------------
-
 
74
	push	ds es
70
    ;------------------
75
	pushad
71
	pushad
Line 76... Line -...
76
	cld
-
 
77
 
-
 
78
	mov	ax, word os_data
-
 
79
	mov	ds, ax
-
 
80
	mov	es, ax
72
	cld
81
 
73
 
82
        mov     eax, ebx
74
        mov     eax, ebx
83
        mov     ebx, ecx
75
        mov     ebx, ecx
84
        mov     ecx, edx
76
        mov     ecx, edx
Line 90... Line 82...
90
	and	edi, 0xff
82
	and	edi, 0xff
91
	call	dword [servetable + edi * 4]
83
	call	dword [servetable + edi * 4]
92
	pop	eax
84
	pop	eax
Line 93... Line 85...
93
 
85
 
94
	popad
-
 
95
	pop	es ds
86
	popad
96
	;------------------
87
	;------------------
97
	mov	edx, [SYSENTER_VAR]		; eip
88
        mov     edx, [SYSENTER_VAR]       ; eip
98
	mov	ecx, [SYSENTER_VAR + 4]	; esp
89
        mov     ecx, [SYSENTER_VAR + 4]   ; esp
Line 103... Line 94...
103
;;                     SYSCALL ENTRY                          ;;
94
;;                     SYSCALL ENTRY                          ;;
104
;;                                                            ;;
95
;;                                                            ;;
105
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106
align 32
97
align 32
107
syscall_entry:
98
syscall_entry:
108
 
-
 
109
  ;     cli                 syscall clear IF
99
  ;     cli                 syscall clear IF
110
        xchg    esp, [ss:CURRENT_RING0_ESP]
100
        xchg    esp, [ss:tss._esp0]
111
        push    ecx
101
        push    ecx
112
        lea     ecx, [esp+4]
102
        lea     ecx, [esp+4]
113
        xchg    ecx, [ss:CURRENT_RING0_ESP]
103
        xchg    ecx, [ss:tss._esp0]
114
        sti
104
        sti
115
        push    ecx
105
        push    ecx
116
        mov     ecx, [ecx]
106
        mov     ecx, [ecx]
Line 117... Line 107...
117
 
107
 
Line 121... Line 111...
121
  ;      mov     eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
111
  ;      mov     eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
122
  ;      lea     esp, [eax + RING0_STACK_SIZE]           ; configure ESP
112
  ;      lea     esp, [eax + RING0_STACK_SIZE]           ; configure ESP
123
  ;      mov     eax, [ss:sysenter_stack - 4]            ; eax - original eax, from app
113
  ;      mov     eax, [ss:sysenter_stack - 4]            ; eax - original eax, from app
Line 124... Line 114...
124
 
114
 
125
	;------------------
-
 
126
	push	ds es
115
	;------------------
127
	pushad
116
	pushad
Line 128... Line 117...
128
	cld
117
	cld
129
 
118
 
130
	mov	ax, word os_data
119
  ;      mov     ax, word app_data
Line 131... Line 120...
131
	mov	ds, ax
120
  ;      mov     ds, ax
132
	mov	es, ax
121
  ;      mov     es, ax
133
 
122
 
134
        mov     eax, ebx
123
        mov     eax, ebx
Line 142... Line 131...
142
	and	edi, 0xff
131
	and	edi, 0xff
143
	call	dword [servetable + edi * 4]
132
	call	dword [servetable + edi * 4]
144
	pop	eax
133
	pop	eax
Line 145... Line 134...
145
 
134
 
146
	popad
-
 
147
	pop	es ds
135
	popad
Line 148... Line 136...
148
	;------------------
136
	;------------------
149
 
137
 
150
        mov     ecx, [ss:esp+4]
138
        mov     ecx, [ss:esp+4]
151
        pop     esp
-
 
152
        sysret
139
        pop     esp
153
 
140
	sysret
154
iglobal
141
iglobal
155
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
142
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;