boot.s 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. ! $Source: /cvsroot/tack/Ack/plat/linux386/boot.s,v $
  3. ! $State: Exp $
  4. ! $Revision: 1.3 $
  5. ! Declare segments (the order is important).
  6. .sect .text
  7. .sect .rom
  8. .sect .data
  9. .sect .bss
  10. .sect .text
  11. begtext:
  12. ! This code is placed at the beginning of the ELF executable and is the
  13. ! first thing that runs.
  14. !
  15. ! On entry, the stack looks like this:
  16. !
  17. ! sp+... NULL
  18. ! sp+8+(4*argc) env (X quads)
  19. ! sp+4+(4*argc) NULL
  20. ! sp+4 argv (argc quads)
  21. ! sp argc
  22. !
  23. ! The ACK actually expects:
  24. !
  25. ! sp+8 argc
  26. ! sp+4 ptr to argv
  27. ! sp ptr to env
  28. lwz r3, 0(sp) ! r3 = argc
  29. addi r4, sp, 4 ! r4 = argv
  30. rlwinm r5, r3, 32-2, 2, 31 ! shift left 2 bits
  31. add r5, r5, r4
  32. addi r5, r5, 8 ! r5 = env
  33. stwu r5, -4(sp)
  34. stwu r4, -4(sp)
  35. stwu r3, -4(sp)
  36. b __m_a_i_n
  37. ! Some magic data. All EM systems need these.
  38. .define _errno
  39. .comm _errno, 4 ! Posix errno storage
  40. .define .trppc, .ignmask
  41. .comm .trppc, 4 ! ptr to user trap handler
  42. .comm .ignmask, 4 ! user trap ignore mask
  43. .define .linenumber, .filename
  44. .comm .linenumber, 4 ! current linenumber (used for debugging)
  45. .comm .filename, 4 ! ptr to current filename (used for debugging)