Skip to content

Commit f1f5457

Browse files
committed
Remove alignment and assert maximum executable size
Only 480.5 KiB of memory are usable for the second stage in real mode. If the executable becomes larger than that, we override the Extended BIOS Data Area.
1 parent c8a0c04 commit f1f5457

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

bios/second_stage/second-stage-link.ld

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,33 @@ SECTIONS {
66
.start : {
77
*(.start)
88
}
9-
.text : ALIGN(512) {
9+
.text : {
1010
*(.text .text.*)
1111
}
12-
.rodata : ALIGN(512) {
12+
.rodata : {
1313
*(.rodata .rodata.*)
1414
}
15-
.bss : ALIGN(512) {
15+
.data : {
16+
*(.data .data.*)
17+
}
18+
.bss : {
1619
*(.bss .bss.*)
1720
}
18-
.data : ALIGN(512) {
19-
*(.data .data.*)
21+
.eh_frame : {
22+
*(.eh_frame .eh_frame.*)
23+
}
24+
.eh_frame_hdr : {
25+
*(.eh_frame_hdr .eh_frame_hdr.*)
2026
}
2127

2228
. = ALIGN(512);
2329

2430
_second_stage_end = .;
31+
32+
. = 0x0007FFFF - 2;
33+
.end_marker :
34+
{
35+
SHORT(0xdead) /* magic number for bootable disk */
36+
}
37+
. = 0x7c00 + 512;
2538
}

0 commit comments

Comments
 (0)