2007-03-26 14:18:08 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2007-07-27 15:52:03 +02:00
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; SYSTEM CALL ENTRY ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2005-10-13 19:50:36 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
align 16
|
2005-10-06 19:56:22 +02:00
|
|
|
|
i40:
|
2007-03-28 16:51:04 +02:00
|
|
|
|
; diamond, 27.03.2007: handler does not require disabled interrupts
|
|
|
|
|
; so interrupts remain enabled when calling int 0x40
|
2005-10-10 18:57:18 +02:00
|
|
|
|
pushad
|
2006-01-25 14:19:21 +01:00
|
|
|
|
cld
|
2005-10-10 18:57:18 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov ax, word app_data
|
|
|
|
|
; mov ds, ax
|
|
|
|
|
; mov es, ax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2005-10-28 18:16:47 +02:00
|
|
|
|
; load all registers in crossed order
|
2007-02-02 16:09:14 +01:00
|
|
|
|
mov eax, ebx
|
|
|
|
|
mov ebx, ecx
|
|
|
|
|
mov ecx, edx
|
|
|
|
|
mov edx, esi
|
|
|
|
|
mov esi, edi
|
|
|
|
|
mov edi, [esp+28]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
|
2007-03-28 16:51:04 +02:00
|
|
|
|
; sti
|
2005-10-28 18:16:47 +02:00
|
|
|
|
push eax
|
|
|
|
|
and edi,0xff
|
|
|
|
|
call dword [servetable+edi*4]
|
|
|
|
|
pop eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2005-10-10 18:57:18 +02:00
|
|
|
|
popad
|
|
|
|
|
iretd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2007-02-25 15:20:50 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; SYSENTER ENTRY ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
align 32
|
|
|
|
|
sysenter_entry:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esp, [ss:tss._esp0]
|
2007-02-25 15:20:50 +01:00
|
|
|
|
sti
|
2007-05-07 14:54:32 +02:00
|
|
|
|
push ebp ; save app esp + 4
|
|
|
|
|
mov ebp, [ebp] ; ebp - original ebp
|
|
|
|
|
;------------------
|
2007-02-25 15:20:50 +01:00
|
|
|
|
pushad
|
|
|
|
|
cld
|
|
|
|
|
|
|
|
|
|
mov eax, ebx
|
|
|
|
|
mov ebx, ecx
|
|
|
|
|
mov ecx, edx
|
|
|
|
|
mov edx, esi
|
|
|
|
|
mov esi, edi
|
|
|
|
|
mov edi, [esp + 28]
|
|
|
|
|
|
|
|
|
|
push eax
|
|
|
|
|
and edi, 0xff
|
|
|
|
|
call dword [servetable + edi * 4]
|
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
;------------------
|
2007-05-07 14:54:32 +02:00
|
|
|
|
xchg ecx, [ss:esp] ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - app ecx, ecx - app esp + 4
|
|
|
|
|
sub ecx, 4
|
|
|
|
|
xchg edx, [ecx] ; edx - return point, & save original edx
|
|
|
|
|
push edx
|
|
|
|
|
mov edx, [ss:esp + 4]
|
|
|
|
|
mov [ecx + 4], edx ; save original ecx
|
|
|
|
|
pop edx
|
2007-02-25 15:20:50 +01:00
|
|
|
|
sysexit
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; SYSCALL ENTRY ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
align 32
|
|
|
|
|
syscall_entry:
|
2007-03-10 17:04:35 +01:00
|
|
|
|
; cli syscall clear IF
|
2007-04-18 08:37:14 +02:00
|
|
|
|
xchg esp, [ss:tss._esp0]
|
2007-03-28 16:51:04 +02:00
|
|
|
|
push ecx
|
|
|
|
|
lea ecx, [esp+4]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
xchg ecx, [ss:tss._esp0]
|
2007-03-28 16:51:04 +02:00
|
|
|
|
sti
|
|
|
|
|
push ecx
|
|
|
|
|
mov ecx, [ecx]
|
2007-03-10 17:04:35 +01:00
|
|
|
|
|
|
|
|
|
; mov [ss:sysenter_stack - 4], eax
|
|
|
|
|
; mov eax, [ss:CURRENT_TASK]
|
|
|
|
|
; shl eax, 8
|
|
|
|
|
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
|
|
|
|
|
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
|
|
|
|
|
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
|
|
|
|
|
|
2007-02-25 15:20:50 +01:00
|
|
|
|
;------------------
|
|
|
|
|
pushad
|
|
|
|
|
cld
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov ax, word app_data
|
|
|
|
|
; mov ds, ax
|
|
|
|
|
; mov es, ax
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
|
|
|
|
mov eax, ebx
|
|
|
|
|
mov ebx, ecx
|
|
|
|
|
mov ecx, edx
|
|
|
|
|
mov edx, esi
|
|
|
|
|
mov esi, edi
|
|
|
|
|
mov edi, [esp + 28]
|
|
|
|
|
|
|
|
|
|
push eax
|
|
|
|
|
and edi, 0xff
|
|
|
|
|
call dword [servetable + edi * 4]
|
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
;------------------
|
2007-03-10 17:04:35 +01:00
|
|
|
|
|
2007-03-28 16:51:04 +02:00
|
|
|
|
mov ecx, [ss:esp+4]
|
|
|
|
|
pop esp
|
2007-04-18 08:37:14 +02:00
|
|
|
|
sysret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
iglobal
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; SYSTEM FUNCTIONS TABLE ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
servetable:
|
|
|
|
|
|
|
|
|
|
dd sys_drawwindow ; 0-DrawWindow
|
|
|
|
|
dd syscall_setpixel ; 1-SetPixel
|
|
|
|
|
dd sys_getkey ; 2-GetKey
|
|
|
|
|
dd sys_clock ; 3-GetTime
|
|
|
|
|
dd syscall_writetext ; 4-WriteText
|
|
|
|
|
dd delay_hs ; 5-DelayHs
|
|
|
|
|
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
|
|
|
|
dd syscall_putimage ; 7-PutImage
|
|
|
|
|
dd sys_button ; 8-DefineButton
|
|
|
|
|
dd sys_cpuusage ; 9-GetProcessInfo
|
|
|
|
|
dd sys_waitforevent ; 10-WaitForEvent
|
|
|
|
|
dd sys_getevent ; 11-CheckForEvent
|
|
|
|
|
dd sys_redrawstat ; 12-BeginDraw and EndDraw
|
|
|
|
|
dd syscall_drawrect ; 13-DrawRect
|
|
|
|
|
dd syscall_getscreensize ; 14-GetScreenSize
|
|
|
|
|
dd sys_background ; 15-bgr
|
|
|
|
|
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
|
|
|
|
dd sys_getbutton ; 17-GetButton
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dd sys_system ; 18-System Services
|
2007-02-25 15:20:50 +01:00
|
|
|
|
dd paleholder;undefined_syscall ; 19-reserved
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd sys_midi ; 20-ResetMidi and OutputMidi
|
|
|
|
|
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
|
|
|
|
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
|
|
|
|
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
|
|
|
|
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
|
|
|
|
dd sys_sb16 ; 25-SetSb16
|
|
|
|
|
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
2007-01-17 15:43:18 +01:00
|
|
|
|
dd undefined_syscall ; 27-reserved
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd sys_sb16II ; 28-SetSb16
|
|
|
|
|
dd sys_date ; 29-GetDate
|
2007-05-24 13:27:05 +02:00
|
|
|
|
dd sys_current_directory ; 30-Get/SetCurrentDirectory
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dd undefined_syscall ; 31-reserved
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd syscall_delramdiskfile ; 32-DelRamdiskFile
|
|
|
|
|
dd syscall_writeramdiskfile; 33-WriteRamdiskFile
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dd undefined_syscall ; 34-reserved
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd syscall_getpixel ; 35-GetPixel
|
|
|
|
|
dd syscall_readstring ; 36-ReadString (not yet ready)
|
|
|
|
|
dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
|
|
|
|
|
dd syscall_drawline ; 38-DrawLine
|
|
|
|
|
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
|
|
|
|
|
dd set_app_param ; 40-WantEvents
|
|
|
|
|
dd syscall_getirqowner ; 41-GetIrqOwner
|
|
|
|
|
dd get_irq_data ; 42-ReadIrqData
|
|
|
|
|
dd sys_outport ; 43-SendDeviceData
|
|
|
|
|
dd sys_programirq ; 44-ProgramIrqs
|
|
|
|
|
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
|
|
|
|
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
|
|
|
|
dd display_number ; 47-WriteNum
|
|
|
|
|
dd display_settings ; 48-SetRedrawType and SetButtonType
|
2006-05-06 16:34:30 +02:00
|
|
|
|
dd sys_apm ; 49-Advanced Power Management (APM)
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd random_shaped_window ; 50-Window shape & scale
|
|
|
|
|
dd syscall_threads ; 51-Threads
|
|
|
|
|
dd stack_driver_stat ; 52-Stack driver status
|
|
|
|
|
dd socket ; 53-Socket interface
|
|
|
|
|
dd user_events ; 54-User events
|
|
|
|
|
dd sound_interface ; 55-Sound interface
|
2006-10-31 17:11:04 +01:00
|
|
|
|
dd undefined_syscall ; 56-reserved
|
2007-07-23 19:50:42 +02:00
|
|
|
|
dd sys_pcibios ; 57-reserved
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd file_system ; 58-Common file system interface
|
2007-02-28 11:51:05 +01:00
|
|
|
|
dd undefined_syscall ; 59-reserved
|
2006-10-06 08:09:41 +02:00
|
|
|
|
dd sys_IPC ; 60-Inter Process Communication
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd sys_gs ; 61-Direct graphics access
|
|
|
|
|
dd sys_pci ; 62-PCI functions
|
|
|
|
|
dd sys_msg_board ; 63-System message board
|
|
|
|
|
dd sys_resize_app_memory ; 64-Resize application memory usage
|
2007-01-19 16:02:33 +01:00
|
|
|
|
dd syscall_putimage_palette; 65-PutImagePalette
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dd sys_process_def ; 66-Process definitions - keyboard
|
|
|
|
|
dd sys_window_move ; 67-Window move or resize
|
2006-10-06 08:09:41 +02:00
|
|
|
|
dd new_services ; 68-Some internal services
|
2006-01-25 14:19:21 +01:00
|
|
|
|
dd sys_debug_services ; 69-Debug
|
2006-04-27 08:12:46 +02:00
|
|
|
|
dd file_system_lfn ; 70-Common file system interface, version 2
|
2006-08-03 21:30:32 +02:00
|
|
|
|
dd syscall_windowsettings ; 71-Window settings
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
times 255 - ( ($-servetable) /4 ) dd undefined_syscall
|
|
|
|
|
|
|
|
|
|
dd sys_end ; -1-end application
|
|
|
|
|
endg
|