-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmomonados.ld
More file actions
59 lines (50 loc) · 1.42 KB
/
Copy pathmomonados.ld
File metadata and controls
59 lines (50 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* momonados.ld — Linker script for mOMonadOS
*
* Load address 0x200000: matches the default x86_64-unknown-none VirtAddr
* and is within 32-bit address space so multiboot1 can place us here.
*
* Section order:
* .multiboot — multiboot1 magic (must be in first 8KB of first LOAD)
* .text.boot32 — 32-bit entry stub (sets up page tables + enters long mode)
* .text — normal 64-bit kernel code
* .rodata — read-only data
* .data — read-write data
* .bss — zero-initialized (includes boot page tables + kernel heap)
*/
ENTRY(_start)
SECTIONS {
. = 0x200000;
/* PVH ELF note — QEMU reads this to find the 32-bit entry for 64-bit ELFs */
.note.Xen : {
KEEP(*(.note.Xen))
}
/* 32-bit bootstrap: page tables + long-mode transition */
.text.boot32 : {
KEEP(*(.text.boot32))
}
/* 64-bit kernel code */
.text : ALIGN(16) {
*(.text .text.*)
}
/* Read-only data */
.rodata : ALIGN(4096) {
*(.rodata .rodata.*)
}
/* Initialized writable data */
.data : ALIGN(4096) {
*(.data .data.*)
}
/* Zero-initialized: kernel BSS + boot page tables + heap/stack */
.bss : ALIGN(4096) {
*(.bss .bss.*)
*(.bss.boot)
*(COMMON)
}
/DISCARD/ : {
*(.comment)
*(.note.gnu*)
*(.note.ABI-tag)
*(.eh_frame*)
*(.debug*)
}
}