Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. CATCH_NULL_CALL = 0
  2.  
  3. format ELF
  4. section '.text' executable
  5. public start
  6. EXTRN edata
  7. EXTRN __menuet__app_param_area
  8. EXTRN __menuet__app_path_area
  9. EXTRN __crt1_startup
  10. start:
  11. public __menuet__app_header
  12. public __menuet__memsize
  13. __menuet__app_header:
  14.  db 'MENUET01'
  15.  dd 0x01
  16. if CATCH_NULL_CALL
  17.  dd do_start
  18. else
  19.  dd __crt1_startup
  20. end if
  21.  dd edata
  22. __menuet__memsize:
  23.  dd 0x800000
  24.  dd app_stack
  25.  dd __menuet__app_param_area
  26.  dd __menuet__app_path_area
  27.  
  28. if CATCH_NULL_CALL
  29. do_start:
  30.         mov     byte [0], 0xE9
  31.         mov     dword [1], _libc_null_call-5
  32.  call __crt1_startup
  33. ; Handle exit if __crt1_startup returns (shouldn't happen)
  34.  mov eax,-1
  35.  int 0x40
  36. end if
  37.  
  38. if CATCH_NULL_CALL
  39. EXTRN __libc_null_call
  40.  
  41. _libc_null_call:
  42.     push eax
  43.     push ebx
  44.     push ecx
  45.     push edx
  46.     push esi
  47.     push edi
  48.     push ebp
  49.     call __libc_null_call
  50.     mov eax,-1
  51.     int 0x40
  52. end if
  53.  
  54. section '.bss' writeable
  55. rd 4096*4
  56. app_stack:
  57.