Skip to content

Map BIOS stage-4 at lower address to avoid conflicts with the kernel #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions bios/stage-2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ mod vesa;
/// We use this partition type to store the second bootloader stage;
const BOOTLOADER_SECOND_STAGE_PARTITION_TYPE: u8 = 0x20;

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

static mut DISK_BUFFER: AlignedArrayBuffer<0x4000> = AlignedArrayBuffer {
buffer: [0; 0x4000],
Expand Down
3 changes: 2 additions & 1 deletion bios/stage-4/stage-4-link.ld
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ENTRY(_start)

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

.start : {
*(.start)
Expand Down