diff --git a/head.S b/head.S index 912ee62..02b17c0 100644 --- a/head.S +++ b/head.S @@ -270,7 +270,7 @@ GLOBAL(_entry) */ /* Linux expects Zero Page address in %esi, it is already there */ /* Multiboot2 expects MBI address in %ebx and magic number in %eax */ - mov %esi, %ebx + mov %edi, %ebx mov $MULTIBOOT2_BOOTLOADER_MAGIC, %eax /* Simple payload expects argument on stack followed by return address */ push %esi diff --git a/include/slrt.h b/include/slrt.h index 7648052..a547140 100644 --- a/include/slrt.h +++ b/include/slrt.h @@ -31,8 +31,8 @@ * Common SLRT Table Header */ struct slr_entry_hdr { - u16 tag; - u16 size; + u32 tag; + u32 size; } __packed; /* @@ -62,7 +62,7 @@ struct slr_bl_context { */ struct slr_entry_dl_info { struct slr_entry_hdr hdr; - u32 dce_size; + u64 dce_size; u64 dce_base; u64 dlme_size; u64 dlme_base; @@ -77,11 +77,24 @@ struct slr_entry_dl_info { struct slr_entry_log_info { struct slr_entry_hdr hdr; u16 format; - u16 reserved[3]; + u16 reserved; u32 size; u64 addr; } __packed; +/* + * AMD SKINIT Info table + */ +struct slr_entry_amd_info { + struct slr_entry_hdr hdr; + u64 next; + u32 type; + u32 len; + u64 slrt_size; + u64 slrt_base; + u64 boot_params_base; +} __packed; + /* Secure Kernel Loader */ extern struct slr_table bootloader_data; diff --git a/main.c b/main.c index 352c601..baf07f7 100644 --- a/main.c +++ b/main.c @@ -255,13 +255,27 @@ typedef struct { static asm_return_t amdsl_launch() { struct slr_entry_dl_info *dl_info; + struct slr_entry_amd_info *amd_info; + struct tpm *tpm; asm_return_t ret; + print("Enter amdsl_launch()\n"); + + tpm = enable_tpm(); + tpm_request_locality(tpm, 2); + event_log_init(tpm); + + print("TPM enabled and logging initialized\n"); + dl_info = next_entry_with_tag(NULL, SLR_ENTRY_DL_INFO); + amd_info = next_entry_with_tag(NULL, SLR_ENTRY_AMD_INFO); if ( dl_info == NULL + || amd_info == NULL || dl_info->hdr.size != sizeof(*dl_info) || end_of_slrt() < _p(&dl_info[1]) + || amd_info->hdr.size != sizeof(*amd_info) + || end_of_slrt() < _p(&amd_info[1]) || dl_info->dlme_base >= 0x100000000ULL || dl_info->dlme_base + dl_info->dlme_size >= 0x100000000ULL || dl_info->dlme_entry >= dl_info->dlme_size @@ -290,7 +304,7 @@ static asm_return_t amdsl_launch() } ret.dlme_entry = _p(dl_info->dlme_base + dl_info->dlme_entry); - ret.dlme_arg = _p(dl_info->bl_context.context); + ret.dlme_arg = _p(amd_info->boot_params_base); /* End of the line, off to the protected mode entry into the kernel */ print("dlme_entry:\n");