PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/syslinux-4.05/core/layout.inc

#
Pascal | 171 lines | 162 code | 9 blank | 0 comment | 3 complexity | c2a862ab6d23cb639713f22201a52af4 MD5 | raw file
Possible License(s): GPL-2.0, MIT, LGPL-3.0, BSD-3-Clause
  1. ; -----------------------------------------------------------------------
  2. ;
  3. ; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
  4. ; Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
  5. ;
  6. ; This program is free software; you can redistribute it and/or modify
  7. ; it under the terms of the GNU General Public License as published by
  8. ; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
  9. ; Bostom MA 02111-1307, USA; either version 2 of the License, or
  10. ; (at your option) any later version; incorporated herein by reference.
  11. ;
  12. ; -----------------------------------------------------------------------
  13. ;
  14. ; layout.inc
  15. ;
  16. ; Memory layout of segments
  17. ;
  18. ; Default to 16-bit code
  19. bits 16
  20. ; Memory below 0800h is reserved for the BIOS and the MBR.
  21. BSS_START equ 0800h
  22. ; Text starts at the load address of 07C00h.
  23. TEXT_START equ 7C00h
  24. ;
  25. ; 16-bit stack layout
  26. ;
  27. ; PXELINUX: There are apparently some AMI BIOSes in the field which
  28. ; put their BEV stack somewhere below 7C00h (and therefore don't
  29. ; handle localboot properly), so avoid that immediate memory region.
  30. ; The range that is known to be bad is approximately 75E8..7C00; the
  31. ; lower bound is tight.
  32. ;
  33. global STACK_LEN, STACK_TOP, STACK_BASE
  34. STACK_LEN equ 4096
  35. %if IS_PXELINUX
  36. STACK_TOP equ 7000h
  37. %else
  38. STACK_TOP equ 7c00h
  39. %endif
  40. STACK_BASE equ STACK_TOP - STACK_LEN
  41. ; The secondary BSS section, above the text; we really wish we could
  42. ; just make it follow .bcopy32 or hang off the end,
  43. ; but it doesn't seem to work that way.
  44. LATEBSS_START equ 0B800h
  45. ;
  46. ; 32-bit stack layout
  47. ;
  48. global STACK32_LEN
  49. STACK32_LEN equ 64*1024
  50. section .stack nobits write align=4096
  51. resb STACK32_LEN
  52. ;
  53. ; The various sections and their relationship
  54. ;
  55. ; Use .earlybss for things that MUST be in low memory.
  56. section .earlybss nobits write
  57. section .config write progbits align=4
  58. section .replacestub exec write progbits align=16
  59. section .gentextnr exec write nobits align=16
  60. ; Use .bss16 for things that doesn't have to be in low memory;
  61. ; .earlybss should be used for things that absolutely have
  62. ; to be below 0x7c00.
  63. section .bss16 write nobits align=16
  64. %if 0 ; IS_PXELINUX
  65. ; Warning here: RBFG build 22 randomly overwrites
  66. ; memory location [0x5680,0x576c), possibly more. It
  67. ; seems that it gets confused and screws up the
  68. ; pointer to its own internal packet buffer and starts
  69. ; writing a received ARP packet into low memory.
  70. section .rbfg write nobits
  71. RBFG_brainfuck: resb 2048 ; Bigger than an Ethernet packet...
  72. %endif
  73. section .init exec write progbits align=1
  74. section .text16 exec write progbits align=1
  75. section .textnr exec nowrite progbits align=1
  76. section .bcopyxx.text exec nowrite progbits align=16
  77. section .bcopyxx.data noexec write progbits align=16
  78. section .data16 noexec write progbits align=16
  79. section .adv write nobits align=512
  80. ; .uibss contains bss data which is guaranteed to be
  81. ; safe to clobber during the loading of the image. This
  82. ; is because while loading the primary image we will clobber
  83. ; the spillover from the last fractional sector load.
  84. section .uibss write nobits align=16
  85. ; Symbols from linker script
  86. %macro SECINFO 1
  87. extern __%1_start, __%1_lma, __%1_end
  88. extern __%1_len, __%1_dwords
  89. %endmacro
  90. SECINFO bss16
  91. SECINFO uibss
  92. SECINFO config
  93. SECINFO replacestub
  94. SECINFO bcopyxx
  95. SECINFO pm_code
  96. SECINFO high_clear
  97. SECINFO bss
  98. extern free_high_memory
  99. global _start
  100. section .text16
  101. ;
  102. ; Segment assignments in the bottom 640K
  103. ; Keep the low-memory footprint as small as possible... overrun is a hard
  104. ; failure!
  105. ;
  106. serial_buf_size equ 4096 ; Should be a power of 2
  107. ;
  108. ; Contents of aux_seg
  109. ;
  110. extern aux_seg ; Actual segment assigned by linker
  111. struc aux
  112. .fontbuf resb 8192
  113. .serial resb serial_buf_size
  114. alignb 4096 ; Align the next segment to 4K
  115. endstruc
  116. section .auxseg write nobits align=16
  117. auxseg resb aux_size
  118. ;
  119. ; Transfer buffer segment: guaranteed to be aligned 64K, used for disk I/O
  120. ; One symbol for the segment number, one for the absolute address
  121. ;
  122. extern xfer_buf_seg
  123. section .xfer_buf write nobits align=65536
  124. global core_xfer_buf
  125. core_xfer_buf resb 65536
  126. ;
  127. ; Segment for the real mode code (needed as long as we have a in-kernel
  128. ; loader and/or COM16 support.
  129. ; One symbol for the segment number, one for the absolute address
  130. ;
  131. extern real_mode_seg
  132. section .real_mode write nobits align=65536
  133. global core_real_mode
  134. core_real_mode resb 65536
  135. comboot_seg equ real_mode_seg ; COMBOOT image loading zone
  136. ;
  137. ; At the very end, the lowmem heap
  138. ;
  139. extern __lowmem_heap
  140. min_lowmem_heap equ 65536
  141. section .text16