Dear coreboot community,

I am looking for feedback on the following topic.

x86 Pre-memory stages do not support the `.data' section and as a result
developers are required to include runtime initialization code instead
of relying on C global variable definition.

To illustrate the impact of this lack of .data section support, here
are two limitations I personally ran into:
1. The inclusion of libgfxinit in romstage last year has required some
   changes in libgfxinit to ensure data is initialized at runtime. In
   addition, we had to manually map some .data symbols in the _bss
   region.
2. CBFS cache is currently not supported in pre-memory stages and
   enabling it would require to add an initialization function and
   find a generic spot to call it.

Instead of going though these workarounds and as it was suggested on
[[RFC] VGA Text mode in romstage] last year, I believe we could add
support for a `.data' section. I have been working on a solution for
eXecute-In-Place (XIP) pre-memory stages (`bootblock', `verstage' and
`romstage') which deliver good results
(cf. <https://review.coreboot.org/c/coreboot/+/77289>).

In short this patch:
1. creates a new ELF segment to hold the `.data' section
2. creates a `.data' section with its Virtual Memory Address (VMA)
   within Cache-as-RAM (CAR) boundaries and its Load Memory Address
   (LMA) following the .text section (at `_etext').

cbfstools is also updated:
- To process this new segment and `.data' section
- To place the .data section content right after the
  code (cf. `parse_elf_to_xip_stage' function)

At the moment, this patch makes cbfstool detects the presence of the
segment automatically and assume this is a "data" segment. But we
could add a new parameter to make this new behavior less automatic if
you think this would be better.

This patch also adds a piece of assembly code (or C-code for
bootblock) to copy the `.data' section content to Cache-As-RAM at
runtime.

Regards,

-- 
*Jeremy*
/One Emacs to rule them all/


[[RFC] VGA Text mode in romstage] 
<https://mail.coreboot.org/hyperkitty/list/coreboot@coreboot.org/thread/2DYBF6OAUT4N4HHQVP6ZCCFDVC757TD6/#IE3FUVSZO7K4SKH3FLY7PPLLFNJNVU5Z>
_______________________________________________
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org

Reply via email to