Implement a proper block layer with partition support.
[pintos-anon] / src / threads / kernel.lds.S
index b5426e034b8c9c9662fe53c67908b95728a5e9e5..19082d5d3896111dae63de572d7ef5649e8220d3 100644 (file)
@@ -1,21 +1,30 @@
-#include "loader.h"
+#include "threads/loader.h"
 
 OUTPUT_FORMAT("elf32-i386")
 OUTPUT_ARCH("i386")
-ENTRY(start)
+ENTRY(start)                   /* Kernel starts at "start" symbol. */
 SECTIONS
 {
-  . = LOADER_PHYS_BASE + LOADER_KERN_BASE;
+  /* Specify the kernel base address. */
+  _start = LOADER_PHYS_BASE + LOADER_KERN_BASE;
 
-  _start = .;
+  /* Make room for the ELF headers. */
+  . = _start + SIZEOF_HEADERS;
 
-  .text : { *(.text) } = 0x9090
-  .rodata : { *(.rodata) *(.rodata.*) }
-  .data : { *(.data) }
+  /* Kernel starts with code, followed by read-only data and writable data. */
+  .text : { *(.start) *(.text) } = 0x90
+  .rodata : { *(.rodata) *(.rodata.*) 
+             . = ALIGN(0x1000); 
+             _end_kernel_text = .; }
+  .data : { *(.data) 
+           _signature = .; LONG(0xaa55aa55) }
 
+  /* BSS (zero-initialized data) is after everything else. */
   _start_bss = .;
   .bss : { *(.bss) }
   _end_bss = .;
 
   _end = .;
+
+  ASSERT (_end - _start <= 512K, "Kernel image is too big.")
 }