Subversion Repositories Kolibri OS

Rev

Rev 75 | Rev 114 | 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
3 halyavin 35
 
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]
43
      mov   eax, [esi+0x4] ; 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
 
60
label save_syscall_data dword at 0x5000
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
1 ha 90
      dd syscall_startapp        ; 19-StartApp
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,.
98
      dd sys_wss                 ; 27-SetWssMainVol and SetWssCdVol
99
      dd sys_sb16II              ; 28-SetSb16
100
      dd sys_date                ; 29-GetDate
75 diamond 101
;      dd syscall_readhd          ; 30-ReadHd - obsolete 
102
      dd undefined_syscall       ; 30-reserved
103
;      dd syscall_starthdapp      ; 31-StartHdApp - obsolete 
104
      dd undefined_syscall       ; 31-reserved
1 ha 105
      dd syscall_delramdiskfile  ; 32-DelRamdiskFile
106
      dd syscall_writeramdiskfile; 33-WriteRamdiskFile
75 diamond 107
;      dd read_floppy_file        ; 34-ReadFloppyDrive - obsolete 
108
      dd undefined_syscall       ; 34-reserved
1 ha 109
      dd syscall_getpixel        ; 35-GetPixel
110
      dd syscall_readstring      ; 36-ReadString (not yet ready)
111
      dd readmousepos            ; 37-GetMousePosition_ScreenRelative,.
112
      dd syscall_drawline        ; 38-DrawLine
113
      dd sys_getbackground       ; 39-GetBackgroundSize,ReadBgrData,.
114
      dd set_app_param           ; 40-WantEvents
115
      dd syscall_getirqowner     ; 41-GetIrqOwner
116
      dd get_irq_data            ; 42-ReadIrqData
117
      dd sys_outport             ; 43-SendDeviceData
118
      dd sys_programirq          ; 44-ProgramIrqs
119
      dd reserve_free_irq        ; 45-ReserveIrq and FreeIrq
120
      dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
121
      dd display_number          ; 47-WriteNum
122
      dd display_settings        ; 48-SetRedrawType and SetButtonType
76 mario79 123
      dd sys_apm                 ; 49-Advanced Power Management (APM)
1 ha 124
      dd random_shaped_window    ; 50-Window shape & scale
125
      dd syscall_threads         ; 51-Threads
126
      dd stack_driver_stat       ; 52-Stack driver status
127
      dd socket                  ; 53-Socket interface
128
      dd user_events             ; 54-User events
129
      dd sound_interface         ; 55-Sound interface
130
      dd write_to_hd             ; 56-Write a file to hd
75 diamond 131
;      dd delete_from_hd          ; 57-Delete a file from hd - obsolete 
132
      dd undefined_syscall       ; 57-reserved
1 ha 133
      dd file_system             ; 58-Common file system interface
134
      dd sys_trace               ; 59-System call trace
135
      dd new_sys_ipc             ; 60-Inter Process Communication
136
      dd sys_gs                  ; 61-Direct graphics access
137
      dd sys_pci                 ; 62-PCI functions
138
      dd sys_msg_board           ; 63-System message board
139
      dd sys_resize_app_memory   ; 64-Resize application memory usage
140
      dd undefined_syscall       ; 65-UTF
141
      dd sys_process_def         ; 66-Process definitions - keyboard
142
      dd sys_window_move         ; 67-Window move or resize
143
      dd sys_internal_services   ; 68-Some internal services
40 halyavin 144
      dd sys_debug_services      ; 69-Debug
72 diamond 145
      dd file_system_lfn         ; 70-Common file system interface, version 2
1 ha 146
 
147
  times 255 - ( ($-servetable) /4 )  dd undefined_syscall
148
 
149
      dd sys_end                 ; -1-end application
150
endg