Skip to content

Commit 093a338

Browse files
authored
Merge pull request #337 from rust-osdev/fix-stage-4-panic
Map BIOS stage-4 at lower address to avoid conflicts with the kernel
2 parents 1181a01 + 713a219 commit 093a338

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: bios/stage-2/src/main.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ mod vesa;
2424
/// We use this partition type to store the second bootloader stage;
2525
const BOOTLOADER_SECOND_STAGE_PARTITION_TYPE: u8 = 0x20;
2626

27-
const STAGE_3_DST: *mut u8 = 0x0010_0000 as *mut u8; // 1MiB (typically 14MiB accessible here)
28-
const STAGE_4_DST: *mut u8 = 0x0020_0000 as *mut u8; // 2MiB (typically still 13MiB accessible here)
29-
const KERNEL_DST: *mut u8 = 0x0100_0000 as *mut u8; // 16MiB
27+
// 1MiB (typically 14MiB accessible here)
28+
const STAGE_3_DST: *mut u8 = 0x0010_0000 as *mut u8;
29+
// must match the start address in bios/stage-4/stage-4-link.ld
30+
const STAGE_4_DST: *mut u8 = 0x0013_0000 as *mut u8;
31+
// 16MiB
32+
const KERNEL_DST: *mut u8 = 0x0100_0000 as *mut u8;
3033

3134
static mut DISK_BUFFER: AlignedArrayBuffer<0x4000> = AlignedArrayBuffer {
3235
buffer: [0; 0x4000],

Diff for: bios/stage-4/stage-4-link.ld

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
ENTRY(_start)
22

33
SECTIONS {
4-
. = 0x00200000;
4+
# must match STAGE_4_DST address in bios/stage-2/src/main.rs
5+
. = 0x00130000;
56

67
.start : {
78
*(.start)

0 commit comments

Comments
 (0)