Skip to content

Commit 10effc4

Browse files
committed
Revert rewrite because it does not zero bss correctly
This reverts commit 3d78371.
1 parent 3d78371 commit 10effc4

File tree

8 files changed

+220
-418
lines changed

8 files changed

+220
-418
lines changed

Cargo.lock

Lines changed: 26 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ panic = "abort"
1919

2020
[profile.release]
2121
panic = "abort"
22-
lto = false
23-
debug = true
22+
lto = true

linker.ld

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,17 @@ SECTIONS {
77
. += 512;
88
/* page tables */
99
. = ALIGN(0x1000);
10-
__page_table_start = .;
1110
_p4 = .;
1211
. += 0x1000;
1312
_p3 = .;
1413
. += 0x1000;
1514
_p2 = .;
1615
. += 0x1000;
17-
_p1 = .;
18-
. += 0x1000;
19-
__page_table_end = .;
20-
__bootloader_start = .;
2116
_memory_map = .;
2217
. += 0x1000;
2318

24-
_stack_start = .;
19+
/* bootloader */
2520
. = 0x7c00;
26-
_stack_end = .;
27-
2821
.bootloader :
2922
{
3023
/* first stage */
@@ -46,6 +39,5 @@ SECTIONS {
4639
. += 512; /* kernel info block */
4740
_kernel_info_block_end = .;
4841

49-
__bootloader_end = .;
5042
_kernel_start_addr = .;
5143
}

src/context_switch.s

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
.code64
33

44
# Expected arguments:
5-
# - boot info ptr in `rdi`
5+
# - p4 address in `rdi`
66
# - entry point address in `rsi`
77
# - stack pointer in `rdx`
8+
# - boot info ptr in `rcx`
89
context_switch:
10+
# load new P4 table
11+
mov cr3, rdi
912

1013
# load stack pointer
1114
mov rsp, rdx
1215

16+
mov rdi, rcx
17+
1318
# jump to entry point
1419
jmp rsi
1520
context_switch_spin:

0 commit comments

Comments
 (0)