Hi, I am studying how coreboot loads the SELF format payload. From load_payload_segments() in src/lib/self_boot.c, the SELF payload is not relocated to a range of free memory. Which means the SELF payload should pick proper "segment.load_addr" for each segment, otherwise the payload may corrupt the critical memory region. coreboot may not run in background when control is transferred to payload, but before that, 1. the coreboot code that does the payload loading 2. stack may overlap with segment.load_addr of payload.
Is my understanding correct?
If yes, is there a recommended memory map (where is stack, where is coreboot ramstage, where is payload)?
Thanks, Ray
ping.
-----Original Message----- From: Ni, Ray ray.ni@intel.com Sent: Saturday, September 18, 2021 12:43 AM To: coreboot@coreboot.org Subject: [coreboot] Question on loading SELF payload
Hi, I am studying how coreboot loads the SELF format payload. From load_payload_segments() in src/lib/self_boot.c, the SELF payload is not relocated to a range of free memory. Which means the SELF payload should pick proper "segment.load_addr" for each segment, otherwise the payload may corrupt the critical memory region. coreboot may not run in background when control is transferred to payload, but before that,
- the coreboot code that does the payload loading
- stack
may overlap with segment.load_addr of payload.
Is my understanding correct?
If yes, is there a recommended memory map (where is stack, where is coreboot ramstage, where is payload)?
Thanks, Ray
coreboot mailing list -- coreboot@coreboot.org To unsubscribe send an email to coreboot-leave@coreboot.org
Hi Ray,
Am Fr., 17. Sept. 2021 um 18:43 Uhr schrieb Ni, Ray ray.ni@intel.com:
If yes, is there a recommended memory map (where is stack, where is coreboot ramstage, where is payload)?
ramstage is relocatable these days: romstage/postcar loads it near the top of memory. ramstage's stack is kept in the ramstage's .bss section so close to the top of memory, too.
Payloads aren't relocatable (some relocate themselves, but that happens after coreboot finished, so no conflict there) so they're loaded to a fixed address. This is usually a relatively low address (16MB, for example) as there can be little assumption about the available amount of memory.
So as long as RAM is a bit larger than payload size + ramstage size + 16MB (and that's normally the case these days) there's no risk of overlap.
Patrick