Skip to content

Commit b4bc1c3

Browse files
committed
bios: Make sure PVH still works with "rom" feature
Without this change, QEMU/CloudHV will attempt to load the ROM into the memory region below 4GiB. But something (i.e. SeaBIOS) is already there. We just pick an arbitrary address. It doesn't actually matter where it gets loaded, as the ROM code isn't used when doing PVH boot. Signed-off-by: Joe Richey <[email protected]>
1 parent 83da786 commit b4bc1c3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

layout.ld

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
ENTRY(linux64_start)
22

3+
/* Loaders like to put stuff in low memory (< 1M), so we don't use it. */
4+
ram_min = 1M;
5+
/* ram32.s only maps the first 2 MiB, which must include our whole program. */
6+
ram_max = 2M;
7+
38
PHDRS
49
{
510
ram PT_LOAD FILEHDR PHDRS ;
611
note PT_NOTE ;
7-
rom PT_LOAD ;
12+
rom PT_LOAD AT(ram_max) ;
813
}
914

10-
/* Loaders like to put stuff in low memory (< 1M), so we don't use it. */
11-
ram_min = 1M;
12-
1315
SECTIONS
1416
{
1517
/* Mapping the program headers and note into RAM makes the file smaller. */
@@ -37,8 +39,7 @@ SECTIONS
3739
/* Our stack grows down and is page-aligned. TODO: Add stack guard pages. */
3840
.stack (NOLOAD) : ALIGN(4K) { . += 64K; }
3941
stack_start = .;
40-
/* ram32.s only maps the first 2 MiB, and that must include the stack. */
41-
ASSERT((. <= 2M), "Stack overflows initial identity-mapped memory region")
42+
ASSERT((. <= ram_max), "Stack overflows initial identity-mapped region")
4243

4344
/* This is correct because all of the code sections have alignment 16. */
4445
rom_size = ALIGN(SIZEOF(.gdt32), 16) + ALIGN(SIZEOF(.rom32), 16)

0 commit comments

Comments
 (0)