Subversion Repositories Kolibri OS

Rev

Rev 76 | Rev 115 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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