kernel.ld 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* VESA real-mode stage at 0x7E00, then kernel_main follows. */
  2. ENTRY(_vesa_stage)
  3. SECTIONS
  4. {
  5. . = 0x7E00;
  6. .text : AT(0x7E00) {
  7. *(.text.stage2)
  8. *(.text .text.*)
  9. }
  10. .rodata : { *(.rodata .rodata.*) }
  11. .data : { *(.data .data.*) }
  12. .bss : {
  13. __bss_start = .;
  14. *(.bss .bss.*) *(COMMON)
  15. __bss_end = .;
  16. }
  17. /* Bootstrap/protected-mode stack: inside the image's RAM footprint
  18. * (NOLOAD, so it costs no file bytes), which means its address travels
  19. * with the kernel instead of being a fixed one that kernel growth has
  20. * to be scheduled around. It must sit *after* __bss_end: the BSS clear
  21. * would otherwise wipe the stack kernel_main is running on. */
  22. .stack (NOLOAD) : {
  23. . = ALIGN(16);
  24. __boot_stack_bottom = .;
  25. . += 0x2000; /* 8 KB */
  26. __boot_stack_top = .;
  27. }
  28. _end = .;
  29. }
  30. /* The legacy stage now copies each rootfs chunk straight to PACK_HIGH_ADDR,
  31. * so the old 0x60000..0x9FBFF low staging gap is no longer used. BSS and
  32. * the boot stack may occupy that range. Keep the kernel end below 0x90000
  33. * so the top of the low-memory gap and the EBDA stay untouched. */
  34. ASSERT(_end <= 0x90000, "Kernel too large: would reach the top of the low-memory gap");