Make kernel code pages read-only.
[pintos-anon] / src / threads / kernel.lds.S
1 #include "threads/loader.h"
2
3 OUTPUT_FORMAT("elf32-i386")
4 OUTPUT_ARCH("i386")
5 ENTRY(start)                    /* Kernel starts at "start" symbol. */
6 SECTIONS
7 {
8   /* Specifies the virtual address for the kernel base. */
9   . = LOADER_PHYS_BASE + LOADER_KERN_BASE;
10
11   _start = .;
12
13   /* Kernel starts with code, followed by read-only data and writable data. */
14   .text : { *(.start) *(.text) } = 0x90
15   .rodata : { *(.rodata) *(.rodata.*) . = ALIGN(0x1000); }
16   _end_kernel_text = .;
17   .data : { *(.data) }
18
19   /* BSS (zero-initialized data) is after everything else. */
20   _start_bss = .;
21   .bss : { *(.bss) }
22   _end_bss = .;
23
24   _end = .;
25 }