Subversion Repositories Kolibri OS

Rev

Rev 744 | Rev 752 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
593 mikedld 8
$Revision: 750 $
9
 
671 Ghost 10
; Old style system call converter
11
align 16
12
cross_order:
13
	; load all registers in crossed order
14
	mov	eax, ebx
15
	mov	ebx, ecx
16
	mov	ecx, edx
17
	mov	edx, esi
18
	mov	esi, edi
19
	mov	edi, [esp+28 + 4]
20
	and	edi,0xff
21
	call	dword [servetable+edi*4]
22
	ret
593 mikedld 23
 
671 Ghost 24
 
1 ha 25
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26
;;                                                            ;;
27
;;                   SYSTEM CALL ENTRY                        ;;
28
;;                                                            ;;
29
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 poddubny 30
 
671 Ghost 31
 
465 serge 32
align 16
1 ha 33
i40:
671 Ghost 34
	pushad
35
	cld
36
	and	eax, 0xff
37
	call	dword [servetable2 + eax * 4]
38
	popad
39
	iretd
375 Ghost 40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41
;;                                                            ;;
42
;;                     SYSENTER ENTRY                         ;;
43
;;                                                            ;;
44
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45
 
46
align 32
47
sysenter_entry:
48
	; Настраиваем стек
742 Rus 49
	mov	esp, [ss:tss._esp0]
375 Ghost 50
	sti
477 Ghost 51
	push	ebp			; save app esp + 4
52
	mov	ebp, [ebp]		; ebp - original ebp
53
	;------------------
375 Ghost 54
	pushad
55
	cld
56
 
671 Ghost 57
	and	eax, 0xff
58
	call	dword [servetable2 + eax * 4]
375 Ghost 59
 
60
	popad
61
	;------------------
477 Ghost 62
	xchg	ecx, [ss:esp]		; в вершин стека - app ecx, ecx - app esp + 4
63
	sub	ecx, 4
64
	xchg	edx, [ecx]		; edx - return point, & save original edx
65
	push	edx
66
	mov	edx, [ss:esp + 4]
67
	mov	[ecx + 4], edx		; save original ecx
68
	pop	edx
375 Ghost 69
	sysexit
70
 
71
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72
;;                                                            ;;
73
;;                     SYSCALL ENTRY                          ;;
74
;;                                                            ;;
75
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76
align 32
77
syscall_entry:
412 serge 78
  ;     cli                 syscall clear IF
742 Rus 79
	xchg	esp, [ss:tss._esp0]
80
	push	ecx
81
	lea	ecx, [esp+4]
82
	xchg	ecx, [ss:tss._esp0]
83
	sti
84
	push	ecx
85
	mov	ecx, [ecx]
375 Ghost 86
	;------------------
87
	pushad
88
	cld
89
 
671 Ghost 90
	and	eax, 0xff
91
	call	dword [servetable2 + eax * 4]
375 Ghost 92
 
93
	popad
94
	;------------------
742 Rus 95
	mov	ecx, [ss:esp+4]
96
	pop	esp
465 serge 97
	sysret
1 ha 98
iglobal
99
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
100
  ;; SYSTEM FUNCTIONS TABLE ;;
101
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102
 
103
  align 4
104
  servetable:
105
 
671 Ghost 106
      dd 0
107
      dd 0
108
      dd 0
109
      dd 0
110
      dd 0
111
      dd 0
112
      dd 0
113
      dd 0
114
      dd 0
115
      dd 0
116
      dd 0
684 diamond 117
      dd 0
118
      dd 0
119
      dd 0
120
      dd 0
121
      dd 0
122
      dd 0
123
      dd 0
124
      dd 0
125
      dd 0
742 Rus 126
      dd sys_midi		 ; 20-ResetMidi and OutputMidi
127
      dd sys_setup		 ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
128
      dd sys_settime		 ; 22-setting date,time,clock and alarm-clock
671 Ghost 129
      dd 0
742 Rus 130
      dd syscall_cdaudio	 ; 24-PlayCdTrack,StopCd and GetCdPlaylist
131
      dd sys_sb16		 ; 25-SetSb16
132
      dd sys_getsetup		 ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
671 Ghost 133
      dd 0
742 Rus 134
      dd sys_sb16II		 ; 28-SetSb16
671 Ghost 135
      dd 0
742 Rus 136
      dd sys_current_directory	 ; 30-Get/SetCurrentDirectory
671 Ghost 137
      dd 0
1 ha 138
      dd syscall_delramdiskfile  ; 32-DelRamdiskFile
139
      dd syscall_writeramdiskfile; 33-WriteRamdiskFile
671 Ghost 140
      dd 0
141
      dd 0
142
      dd 0
742 Rus 143
      dd readmousepos		 ; 37-GetMousePosition_ScreenRelative,.
144
      dd syscall_drawline	 ; 38-DrawLine
145
      dd sys_getbackground	 ; 39-GetBackgroundSize,ReadBgrData,.
671 Ghost 146
      dd 0
742 Rus 147
      dd 0
744 Ghost 148
      dd 0	     ; 42-ReadIrqData
742 Rus 149
      dd sys_outport		 ; 43-SendDeviceData
150
      dd sys_programirq 	 ; 44-ProgramIrqs
151
      dd reserve_free_irq	 ; 45-ReserveIrq and FreeIrq
1 ha 152
      dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
742 Rus 153
      dd display_number 	 ; 47-WriteNum
154
      dd display_settings	 ; 48-SetRedrawType and SetButtonType
155
      dd sys_apm		 ; 49-Advanced Power Management (APM)
156
      dd random_shaped_window	 ; 50-Window shape & scale
157
      dd syscall_threads	 ; 51-Threads
158
      dd stack_driver_stat	 ; 52-Stack driver status
159
      dd socket 		 ; 53-Socket interface
671 Ghost 160
      dd 0
742 Rus 161
      dd sound_interface	 ; 55-Sound interface
671 Ghost 162
      dd 0
742 Rus 163
      dd sys_pcibios		 ; 57-PCI BIOS32
164
      dd file_system		 ; 58-Common file system interface
671 Ghost 165
      dd 0
742 Rus 166
      dd sys_IPC		 ; 60-Inter Process Communication
167
      dd sys_gs 		 ; 61-Direct graphics access
168
      dd sys_pci		 ; 62-PCI functions
169
      dd sys_msg_board		 ; 63-System message board
170
      dd sys_resize_app_memory	 ; 64-Resize application memory usage
283 diamond 171
      dd syscall_putimage_palette; 65-PutImagePalette
742 Rus 172
      dd sys_process_def	 ; 66-Process definitions - keyboard
173
      dd sys_window_move	 ; 67-Window move or resize
174
      dd new_services		 ; 68-Some internal services
175
      dd sys_debug_services	 ; 69-Debug
176
      dd file_system_lfn	 ; 70-Common file system interface, version 2
114 mikedld 177
      dd syscall_windowsettings  ; 71-Window settings
742 Rus 178
      dd sys_sendwindowmsg	 ; 72-Send window message
1 ha 179
 
671 Ghost 180
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
181
  ;; NEW SYSTEM FUNCTIONS TABLE ;;
182
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
183
  align 4
184
  servetable2:
1 ha 185
 
742 Rus 186
      dd sys_drawwindow 	 ; 0-DrawWindow
187
      dd syscall_setpixel	 ; 1-SetPixel
188
      dd sys_getkey		 ; 2-GetKey
189
      dd sys_clock		 ; 3-GetTime
190
      dd syscall_writetext	 ; 4-WriteText
191
      dd delay_hs		 ; 5-DelayHs
684 diamond 192
      dd syscall_openramdiskfile ; 6-OpenRamdiskFile
742 Rus 193
      dd syscall_putimage	 ; 7-PutImage
194
      dd sys_button		 ; 8-DefineButton
195
      dd sys_cpuusage		 ; 9-GetProcessInfo
196
      dd sys_waitforevent	 ; 10-WaitForEvent
197
      dd sys_getevent		 ; 11-CheckForEvent
198
      dd sys_redrawstat 	 ; 12-BeginDraw and EndDraw
199
      dd syscall_drawrect	 ; 13-DrawRect
200
      dd syscall_getscreensize	 ; 14-GetScreenSize
201
      dd sys_background 	 ; 15-bgr
202
      dd sys_cachetodiskette	 ; 16-FlushFloppyCache
203
      dd sys_getbutton		 ; 17-GetButton
204
      dd sys_system		 ; 18-System Services
205
      dd paleholder		 ; 19-reserved
206
      dd cross_order		 ; 20-ResetMidi and OutputMidi
207
      dd cross_order		 ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
208
      dd cross_order		 ; 22-setting date,time,clock and alarm-clock
671 Ghost 209
      dd sys_wait_event_timeout  ; 23-TimeOutWaitForEvent
742 Rus 210
      dd cross_order		 ; 24-PlayCdTrack,StopCd and GetCdPlaylist
211
      dd cross_order		 ; 25-SetSb16
212
      dd cross_order		 ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
213
      dd undefined_syscall	 ; 27-reserved
214
      dd cross_order		 ; 28-SetSb16
215
      dd sys_date		 ; 29-GetDate
216
      dd cross_order		 ; 30-Get/SetCurrentDirectory
217
      dd undefined_syscall	 ; 31-reserved
218
      dd cross_order		 ; 32-DelRamdiskFile
219
      dd cross_order		 ; 33-WriteRamdiskFile
220
      dd undefined_syscall	 ; 34-reserved
221
      dd syscall_getpixel	 ; 35-GetPixel
222
      dd undefined_syscall	 ; 36-reserved
223
      dd cross_order		 ; 37-GetMousePosition_ScreenRelative,.
224
      dd cross_order		 ; 38-DrawLine
225
      dd cross_order		 ; 39-GetBackgroundSize,ReadBgrData,.
226
      dd set_app_param		 ; 40-WantEvents
227
      dd syscall_getirqowner	 ; 41-GetIrqOwner
228
      dd get_irq_data		 ; 42-ReadIrqData
229
      dd cross_order		 ; 43-SendDeviceData
230
      dd cross_order		 ; 44-ProgramIrqs
231
      dd cross_order		 ; 45-ReserveIrq and FreeIrq
232
      dd cross_order		 ; 46-ReservePortArea and FreePortArea
233
      dd cross_order		 ; 47-WriteNum
234
      dd cross_order		 ; 48-SetRedrawType and SetButtonType
235
      dd cross_order		 ; 49-Advanced Power Management (APM)
236
      dd cross_order		 ; 50-Window shape & scale
237
      dd cross_order		 ; 51-Threads
238
      dd cross_order		 ; 52-Stack driver status
239
      dd cross_order		 ; 53-Socket interface
240
      dd undefined_syscall	 ; 54-reserved
241
      dd cross_order		 ; 55-Sound interface
242
      dd undefined_syscall	 ; 56-reserved
243
      dd cross_order		 ; 57-PCI BIOS32
244
      dd cross_order		 ; 58-Common file system interface
245
      dd undefined_syscall	 ; 59-reserved
246
      dd cross_order		 ; 60-Inter Process Communication
247
      dd cross_order		 ; 61-Direct graphics access
248
      dd cross_order		 ; 62-PCI functions
249
      dd cross_order		 ; 63-System message board
250
      dd cross_order		 ; 64-Resize application memory usage
251
      dd cross_order		 ; 65-PutImagePalette
252
      dd cross_order		 ; 66-Process definitions - keyboard
253
      dd cross_order		 ; 67-Window move or resize
254
      dd cross_order		 ; 68-Some internal services
255
      dd cross_order		 ; 69-Debug
256
      dd cross_order		 ; 70-Common file system interface, version 2
257
      dd cross_order		 ; 71-Window settings
258
      dd cross_order		 ; 72-Send window message
671 Ghost 259
	times 255 - ( ($-servetable2) /4 )  dd undefined_syscall
742 Rus 260
      dd sys_end		 ; -1-end application
671 Ghost 261
 
1 ha 262
endg