Subversion Repositories Kolibri OS

Rev

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

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