Subversion Repositories Kolibri OS

Rev

Rev 15 | Rev 70 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                            ;;
  3. ;;                   SYSTEM CALL ENTRY                        ;;
  4. ;;                                                            ;;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. align 32
  8. i40:
  9.       push  ds es
  10.       pushad
  11.       cld
  12.  
  13.       mov   ax,word os_data
  14.       mov   ds,ax
  15.       mov   es,ax
  16.  
  17.       ; for syscall trace function
  18.       call  save_registers
  19.  
  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
  27.  
  28.       ; enable interupts  -  a task switch or an IRQ _CAN_ interrupt i40 handler
  29.       sti
  30.       push  eax
  31.       and   edi,0xff
  32.       call  dword [servetable+edi*4]
  33.       pop   eax
  34.       cli
  35.      
  36.       popad
  37.       pop   es ds
  38.       iretd
  39.  
  40. align 4
  41. save_registers:
  42.       mov   esi, [0x3010]
  43.       mov   eax, [esi+0x4] ; load PID
  44.       lea   esi, [esp+4]
  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
  89.       dd syscall_system          ; 18-Shutdown,KillApp,WindowActivate
  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
  101.       dd syscall_readhd          ; 30-ReadHd
  102.       dd syscall_starthdapp      ; 31-StartHdApp
  103.       dd syscall_delramdiskfile  ; 32-DelRamdiskFile
  104.       dd syscall_writeramdiskfile; 33-WriteRamdiskFile
  105.       dd read_floppy_file        ; 34-ReadFloppyDrive
  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
  120.       dd syscall_appints         ; 49-AppInts
  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
  127.       dd write_to_hd             ; 56-Write a file to hd
  128.       dd delete_from_hd          ; 57-Delete a file from hd
  129.       dd file_system             ; 58-Common file system interface
  130.       dd sys_trace               ; 59-System call trace
  131.       dd new_sys_ipc             ; 60-Inter Process Communication
  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
  139.       dd sys_internal_services   ; 68-Some internal services
  140.       dd sys_debug_services      ; 69-Debug
  141.  
  142.   times 255 - ( ($-servetable) /4 )  dd undefined_syscall
  143.  
  144.       dd sys_end                 ; -1-end application
  145. endg
  146.