Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ; Header for Linux program
  2.         format ELF executable 3
  3.         entry start
  4. ; for system calls
  5. include 'unistd.inc'
  6. macro __mov a,b
  7. {
  8. if b eq
  9. else if ~(b eqtype 1)
  10.         mov     a, b
  11. else if b = 0
  12.         xor     a, a
  13. else if (b < 0x80) & (b >= -0x80)
  14.         push    b
  15.         pop     a
  16. else
  17.         mov     a, b
  18. end if
  19. }
  20. macro kercall a,b,c,d,e,f,g
  21. {
  22.         __mov   eax, a
  23.         __mov   ebx, b
  24.         __mov   ecx, c
  25.         __mov   edx, d
  26.         __mov   esi, e
  27.         __mov   edi, f
  28.         __mov   ebp, g
  29.         int     0x80
  30. }
  31. macro stdcall func,[arg]
  32. {
  33. reverse
  34.         pushd   arg
  35. common
  36.         call    func
  37. }
  38. PROT_READ       = 0x1           ; page can be read
  39. PROT_WRITE      = 0x2           ; page can be written
  40. PROT_EXEC       = 0x4           ; page can be executed
  41. PROT_SEM        = 0x8           ; page may be used for atomic ops
  42. PROT_NONE       = 0x0           ; page can not be accessed
  43. PROT_GROWSDOWN  = 0x01000000    ; mprotect flag: extend change to start of growsdown vma
  44. PROT_GROWSUP    = 0x02000000    ; mprotect flag: extend change to end of growsup vma
  45.  
  46. MAP_SHARED      = 0x01          ; Share changes
  47. MAP_PRIVATE     = 0x02          ; Changes are private
  48. MAP_TYPE        = 0x0f          ; Mask for type of mapping
  49. MAP_FIXED       = 0x10          ; Interpret addr exactly
  50. MAP_ANONYMOUS   = 0x20          ; don't use a file
  51.  
  52. O_ACCMODE       = 00000003
  53. O_RDONLY        = 00000000
  54. O_WRONLY        = 00000001
  55. O_RDWR          = 00000002
  56. O_CREAT         = 00000100      ; not fcntl
  57. O_EXCL          = 00000200      ; not fcntl
  58. O_NOCTTY        = 00000400      ; not fcntl
  59. O_TRUNC         = 00001000      ; not fcntl
  60. O_APPEND        = 00002000
  61. O_NONBLOCK      = 00004000
  62. O_DSYNC         = 00010000      ; used to be O_SYNC, see below
  63. FASYNC          = 00020000      ; fcntl, for BSD compatibility
  64. O_DIRECT        = 00040000      ; direct disk access hint
  65. O_LARGEFILE     = 00100000
  66. O_DIRECTORY     = 00200000      ; must be a directory
  67. O_NOFOLLOW      = 00400000      ; don't follow links
  68. O_NOATIME       = 01000000
  69. O_CLOEXEC       = 02000000      ; set close_on_exec
  70. __O_SYNC        = 04000000
  71. O_SYNC          = (__O_SYNC + O_DSYNC)
  72. O_NDELAY        = O_NONBLOCK
  73. segment readable executable
  74.