Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1 ha 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                            ;;
3
;;                   SYSTEM CALL ENTRY                        ;;
4
;;                                                            ;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 poddubny 6
 
1 ha 7
align 32
8
i40:
15 poddubny 9
      push  ds es
3 halyavin 10
      pushad
40 halyavin 11
      cld
3 halyavin 12
 
13
      mov   ax,word os_data
14
      mov   ds,ax
15
      mov   es,ax
1 ha 16
 
17
      ; for syscall trace function
18
      call  save_registers
19
 
15 poddubny 20
      ; load all registers in crossed order
21
      mov   edi,[esp+28] ; eax
22
      mov   eax,[esp+16] ; ebx
23
      mov   ebx,[esp+24] ; ecx
24
      mov   ecx,[esp+20] ; edx
25
      mov   edx,[esp+4]  ; esi
26
      mov   esi,[esp+0]  ; edi
6 poddubny 27
 
1 ha 28
      ; enable interupts  -  a task switch or an IRQ _CAN_ interrupt i40 handler
29
      sti
15 poddubny 30
      push  eax
31
      and   edi,0xff
32
      call  dword [servetable+edi*4]
33
      pop   eax
1 ha 34
      cli
164 serge 35
 
3 halyavin 36
      popad
15 poddubny 37
      pop   es ds
3 halyavin 38
      iretd
1 ha 39
 
40
align 4
41
save_registers:
6 poddubny 42
      mov   esi, [0x3010]
115 poddubny 43
      mov   eax, [esi+TASKDATA.pid] ; load PID
15 poddubny 44
      lea   esi, [esp+4]
1 ha 45
      inc   [save_syscall_count]
46
      mov   edi,[save_syscall_count]
47
      and   edi,0xF
48
      shl   edi,6
49
      add   edi,save_syscall_data+32
50
      mov   [edi-32],eax
51
      mov   ecx,32 / 4
52
      cld
53
      rep   movsd
54
      ret
55
 
56
uglobal
57
  save_syscall_count  dd 0x0
58
endg
59
 
164 serge 60
;label save_syscall_data dword at 0x5000
1 ha 61
 
62
 
63
iglobal
64
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65
  ;; SYSTEM FUNCTIONS TABLE ;;
66
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
 
68
  align 4
69
  servetable:
70
 
71
      dd sys_drawwindow          ; 0-DrawWindow
72
      dd syscall_setpixel        ; 1-SetPixel
73
      dd sys_getkey              ; 2-GetKey
74
      dd sys_clock               ; 3-GetTime
75
      dd syscall_writetext       ; 4-WriteText
76
      dd delay_hs                ; 5-DelayHs
77
      dd syscall_openramdiskfile ; 6-OpenRamdiskFile
78
      dd syscall_putimage        ; 7-PutImage
79
      dd sys_button              ; 8-DefineButton
80
      dd sys_cpuusage            ; 9-GetProcessInfo
81
      dd sys_waitforevent        ; 10-WaitForEvent
82
      dd sys_getevent            ; 11-CheckForEvent
83
      dd sys_redrawstat          ; 12-BeginDraw and EndDraw
84
      dd syscall_drawrect        ; 13-DrawRect
85
      dd syscall_getscreensize   ; 14-GetScreenSize
86
      dd sys_background          ; 15-bgr
87
      dd sys_cachetodiskette     ; 16-FlushFloppyCache
88
      dd sys_getbutton           ; 17-GetButton
75 diamond 89
      dd sys_system              ; 18-System Services
147 diamond 90
      dd undefined_syscall       ; 19-reserved
1 ha 91
      dd sys_midi                ; 20-ResetMidi and OutputMidi
92
      dd sys_setup               ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
93
      dd sys_settime             ; 22-setting date,time,clock and alarm-clock
94
      dd sys_wait_event_timeout  ; 23-TimeOutWaitForEvent
95
      dd syscall_cdaudio         ; 24-PlayCdTrack,StopCd and GetCdPlaylist
96
      dd sys_sb16                ; 25-SetSb16
97
      dd sys_getsetup            ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
277 diamond 98
      dd undefined_syscall       ; 27-reserved
1 ha 99
      dd sys_sb16II              ; 28-SetSb16
100
      dd sys_date                ; 29-GetDate
75 diamond 101
      dd undefined_syscall       ; 30-reserved
102
      dd undefined_syscall       ; 31-reserved
1 ha 103
      dd syscall_delramdiskfile  ; 32-DelRamdiskFile
104
      dd syscall_writeramdiskfile; 33-WriteRamdiskFile
75 diamond 105
      dd undefined_syscall       ; 34-reserved
1 ha 106
      dd syscall_getpixel        ; 35-GetPixel
107
      dd syscall_readstring      ; 36-ReadString (not yet ready)
108
      dd readmousepos            ; 37-GetMousePosition_ScreenRelative,.
109
      dd syscall_drawline        ; 38-DrawLine
110
      dd sys_getbackground       ; 39-GetBackgroundSize,ReadBgrData,.
111
      dd set_app_param           ; 40-WantEvents
112
      dd syscall_getirqowner     ; 41-GetIrqOwner
113
      dd get_irq_data            ; 42-ReadIrqData
114
      dd sys_outport             ; 43-SendDeviceData
115
      dd sys_programirq          ; 44-ProgramIrqs
116
      dd reserve_free_irq        ; 45-ReserveIrq and FreeIrq
117
      dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
118
      dd display_number          ; 47-WriteNum
119
      dd display_settings        ; 48-SetRedrawType and SetButtonType
76 mario79 120
      dd sys_apm                 ; 49-Advanced Power Management (APM)
1 ha 121
      dd random_shaped_window    ; 50-Window shape & scale
122
      dd syscall_threads         ; 51-Threads
123
      dd stack_driver_stat       ; 52-Stack driver status
124
      dd socket                  ; 53-Socket interface
125
      dd user_events             ; 54-User events
126
      dd sound_interface         ; 55-Sound interface
202 diamond 127
      dd undefined_syscall       ; 56-reserved
75 diamond 128
      dd undefined_syscall       ; 57-reserved
1 ha 129
      dd file_system             ; 58-Common file system interface
130
      dd sys_trace               ; 59-System call trace
164 serge 131
      dd sys_IPC                 ; 60-Inter Process Communication
1 ha 132
      dd sys_gs                  ; 61-Direct graphics access
133
      dd sys_pci                 ; 62-PCI functions
134
      dd sys_msg_board           ; 63-System message board
135
      dd sys_resize_app_memory   ; 64-Resize application memory usage
136
      dd undefined_syscall       ; 65-UTF
137
      dd sys_process_def         ; 66-Process definitions - keyboard
138
      dd sys_window_move         ; 67-Window move or resize
164 serge 139
      dd new_services            ; 68-Some internal services
40 halyavin 140
      dd sys_debug_services      ; 69-Debug
72 diamond 141
      dd file_system_lfn         ; 70-Common file system interface, version 2
114 mikedld 142
      dd syscall_windowsettings  ; 71-Window settings
1 ha 143
 
144
  times 255 - ( ($-servetable) /4 )  dd undefined_syscall
145
 
146
      dd sys_end                 ; -1-end application
147
endg