_kernel_library_header.s 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. | Kernel Library Header
  2. | The format of this header is documented in ProgFormat.txt of the DoorsOS
  3. | developer version.
  4. .xdef __kernel_library_header_AND_NOT___preos_headers,__kernel_entry_point,__kernel_fixed_header_end,__ld_insert_kernel_libs,__ld_insert_kernel_rom_calls,__ld_insert_kernel_ram_calls,__ld_insert_kernel_relocs,__bss_handle
  5. | Fixed kernel program header.
  6. .section _stl1, "d"
  7. __kernel_library_header:
  8. | This is the kernel program entry point.
  9. __kernel_entry_point:
  10. | This is not actually a real bsr: The library stub will clear the return
  11. | address from the stack. This may also be a bra.w, but maybe some kernels
  12. | rely on the bsr.w.
  13. bsr.w __kernel_library_stub
  14. __kernel_library_signature:
  15. .ascii "68kL"
  16. __kernel_reloc_count_pos:
  17. .word 0
  18. __kernel_comment_pos:
  19. .word _comment-__kernel_entry_point
  20. __kernel_main_pos:
  21. .word 0
  22. __kernel_exit_pos:
  23. .word _exit-__kernel_entry_point
  24. __kernel_flags_pos:
  25. .byte __ld_file_version
  26. .byte __ld_kernel_flags
  27. __kernel_bss_handle_pos:
  28. __bss_handle:
  29. .word 0
  30. __kernel_bss_table_pos:
  31. .word __ld_kernel_bss_table-__kernel_entry_point
  32. __kernel_export_table_pos:
  33. .word __ld_kernel_export_table-__kernel_entry_point
  34. __kernel_extra_pos:
  35. .word _extraram-__kernel_entry_point
  36. __kernel_fixed_header_end:
  37. | Kernel library import table.
  38. .section _stl2, "d"
  39. __kernel_lib_table:
  40. __kernel_lib_count_pos:
  41. .word __ld_referenced_lib_count
  42. __ld_insert_kernel_libs:
  43. | The format for the library table is as follows:
  44. | For each library...
  45. | 8 bytes: name
  46. | 1 byte: 0
  47. | 1 byte: minimum version
  48. | For each library...
  49. | 2 bytes: function import count - 1
  50. | For each imported function...
  51. | 2 bytes: function index in the library
  52. | For each reloc...
  53. | 2 bytes: offset into the program
  54. | 2 bytes: 0
  55. | ROM call import table.
  56. .section _stl3, "d"
  57. __kernel_rom_call_table:
  58. __kernel_has_rom_calls_pos:
  59. .word __ld_has_rom_calls
  60. __ld_insert_kernel_rom_calls:
  61. | The format for the ROM call table is as follows:
  62. | ROM call count - 1
  63. | For each ROM call used...
  64. | 2 bytes: ROM call number
  65. | For each reloc...
  66. | 2 bytes: offset into the program
  67. | 2 bytes: 0
  68. | RAM call import table.
  69. .section _stl4, "d"
  70. __kernel_ram_call_table:
  71. __kernel_has_ram_calls_pos:
  72. .word __ld_has_ram_calls
  73. __ld_insert_kernel_ram_calls:
  74. | The format for the RAM call table is as follows:
  75. | RAM call count - 1
  76. | For each RAM call used...
  77. | 2 bytes: RAM call number
  78. | Bit 14: extra RAM address
  79. | Bit 15: 2-byte references (instead of 4)
  80. | For each reloc...
  81. | 2 bytes: offset into the program
  82. | 2 bytes: 0
  83. | Relocation table.
  84. .section _stl5, "d"
  85. __kernel_reloc_table:
  86. __ld_insert_kernel_relocs:
  87. | The format for the reloc table is as follows:
  88. | For each reloc...
  89. | 2 bytes: offset into the program
  90. | 2 bytes: 0