summaryrefslogtreecommitdiff
path: root/kernel/kernel.ld
blob: ab294ee125afc233907a795b0c32672998866619 (plain)
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
OUTPUT_ARCH("i386")
OUTPUT_FORMAT("elf32-i386")
ENTRY(entry)

addr_phys = 0x00100000;
addr_virt = 0xc0000000;

addr_virt_end = ADDR(.bss) + SIZEOF(.bss);
addr_load_virt_end = LOADADDR(.bss) + SIZEOF(.bss);

SECTIONS {
	
	.text_low addr_phys : {
		LONG(0x1badb002);
		LONG(0x00000003);
		LONG(-0x1badb002 -0x00000003);
		
		kernel/entry.o(.text)
		kernel/entry.o(.rodata*)
	}
	
	. = ALIGN(0x1000);
	.data_low : {
		kernel/entry.o(.data)
	}
	
	. = ALIGN(0x1000);
	.bss_low : {
		entry_pagedir = .; . += 0x1000;
		entry_pagetable_low = .; . += 0x1000;
		entry_pagetable_high = .; . += 0x1000;
		entry_stack = .; . += 0x1000; entry_stack_top = .;
	
		kernel/entry.o(.bss)
	}
	
	addr_load_virt = ALIGN(0x1000);
	
	.text addr_virt : AT(addr_load_virt) {
		magic_text = .; LONG(0x0f00ba02);
		*(.text)
		*(.rodata*)
	}
	
	. = ALIGN(0x1000);
	.data : {
		magic_data = .; LONG(0x0f00ba03);
		*(.data)
		*(.ctors)
	}
	
	. = ALIGN(0x1000);
	.bss : {
		*(.bss)
		*(COMMON)
	}
	
}