From b93a793533ad1cdc305a6108ac2537e67fac9e16 Mon Sep 17 00:00:00 2001 From: Jagannathan Raman Date: Mon, 3 Jun 2024 11:25:23 -0400 Subject: [PATCH] AMDSL: Add SKINIT reserved section and ensure SKL is 64KB long A section of size 0x740 must the carved out just after the measured portion of the SKL for the signature header, signature and public key. The .fill directive ensures we have enough space in there and the signing process does not crash into other sections. In addition, adding ". = 0xFFF4" is a preliminary approach to ensure that SKL is 64KB long. The extra missing 0xC bytes are produced by the .got.plt section. A cleaner approach might be to use ALIGN() linker directives. Signed-off-by: Jagannathan Raman --- head.S | 4 ++++ link.lds | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/head.S b/head.S index d212bb5..912ee62 100644 --- a/head.S +++ b/head.S @@ -313,6 +313,10 @@ gdt: .Lgdt_end: ENDDATA(gdt) + .section .skinit_reserved, "a", @progbits +GLOBAL(skinit_reserved) + .fill 0x740, 1, 0x00 + #ifdef __x86_64__ /* 64bit Pagetables, identity map of the first 4G of RAM. */ .section .bss.page_data, "aw", @nobits diff --git a/link.lds b/link.lds index f4fd3dc..46be0bd 100644 --- a/link.lds +++ b/link.lds @@ -49,6 +49,12 @@ SECTIONS _end_of_measured = .; + . = ALIGN(16); + + .skinit_reserved : { + *(.skinit_reserved) + } + .bss : { . = ALIGN(4096); _bss = .; @@ -73,6 +79,8 @@ SECTIONS *(.bootloader_data) } + . = 0xFFF4; + _end = .; /* This section is expected to be empty. */