Attention is currently required from: Raul Rangel, Patrick Rudolph. Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/63725 )
Change subject: cpu/x86/64bit: Generate static page tables from an assembly file ......................................................................
Patch Set 3:
(4 comments)
File src/cpu/x86/64bit/pt.S:
PS3:
I wonder if we can customize this at some point. I would love to catch writing to invalid pointers. That might require updating this at runtime though so we can add CBMEM.
Yes! So the idea is to get to 64bit C code with a simple identity page and then once we know the memory and program layout generate more sophisticated paging that would indeed disallow access to most of memory outside cbmem and set the NX bit to only execute inside the program.
https://review.coreboot.org/c/coreboot/+/63725/comment/a5686aa7_3b948fdb PS3, Line 27: .quad _GEN_PAGE(0x200000 * 0)
Can you use a macro to reduce the duplication?
I'll try.
https://review.coreboot.org/c/coreboot/+/63725/comment/df753fb2_6ffe7055 PS3, Line 2074: 2047
Ah, I guess that's 4 GiB mapped.
That's indeed the last page covering [4G - 2M, 4G]
File src/cpu/x86/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/63725/comment/f61f81a4_f89d72a6 PS3, Line 7: CONFIG_ARCH_BOOTBLOCK_X86_64
Should we add lines for all the different stages instead of assuming?
ARCH_BOOTBLOCK_X86_64 ARCH_VERSTAGE_X86_64 ARCH_ROMSTAGE_X86_64 ARCH_RAMSTAGE_X86_64
No the makefile inclusion happens only once. You'd effectively include it 4 times doing that. Maybe a different Kconfig param can be created to have ARCH_STAGE_X86_64 when at least one stage is 64bit, but at the moment ARCH_BOOTBLOCK_X86_64 covers all use cases.