@@ -351,10 +351,12 @@ cs32_switch:
351
351
jmp *%edi
352
352
353
353
/*
354
- * Entry point for TrenchBoot Secure Launch on Intel TXT platforms.
354
+ * Entry point for TrenchBoot Secure Launch, common for Intel TXT and
355
+ * AMD Secure Startup, but state is slightly different.
355
356
*
357
+ * On Intel:
356
358
* CPU is in 32b protected mode with paging disabled. On entry:
357
- * - %ebx = %eip = MLE entry point,
359
+ * - %ebx = %eip = this entry point,
358
360
* - stack pointer is undefined,
359
361
* - CS is flat 4GB code segment,
360
362
* - DS, ES, SS, FS and GS are undefined.
@@ -368,13 +370,34 @@ cs32_switch:
368
370
* - trying to enter real mode results in reset
369
371
* - APs must be brought up by MONITOR or GETSEC[WAKEUP], depending on
370
372
* which is supported by a given SINIT ACM
373
+ *
374
+ * On AMD (as implemented by TrenchBoot's SKL):
375
+ * CPU is in 32b protected mode with paging disabled. On entry:
376
+ * - %ebx = %eip = this entry point,
377
+ * - %ebp holds base address of SKL
378
+ * - stack pointer is treated as undefined for parity with TXT,
379
+ * - CS is flat 4GB code segment,
380
+ * - DS, ES, SS are flat 4GB data segments, but treated as undefined for
381
+ * parity with TXT.
382
+ *
383
+ * Additional restrictions:
384
+ * - interrupts (including NMIs and SMIs) are disabled and must be
385
+ * enabled later
386
+ * - APs must be brought up by SIPI without an INIT
371
387
*/
372
388
slaunch_stub_entry:
373
389
/* Calculate the load base address. */
374
390
mov %ebx , %esi
375
391
sub $sym_offs(slaunch_stub_entry), %esi
376
392
377
- /* Mark Secure Launch boot protocol and jump to common entry. */
393
+ /* On AMD, %ebp holds the base address of SLB, save it for later. */
394
+ mov %ebp , %ebx
395
+
396
+ /*
397
+ * Mark Secure Launch boot protocol and jump to common entry. Note that
398
+ * all general purpose registers except %ebx and %esi are clobbered
399
+ * between here and .Lslaunch_proto.
400
+ */
378
401
mov $SLAUNCH_BOOTLOADER_MAGIC, %eax
379
402
jmp .Lset_stack
380
403
@@ -497,10 +520,12 @@ __start:
497
520
sub $8 , %esp
498
521
499
522
push %esp /* pointer to output structure */
523
+ push %ebx /* Slaunch parameter on AMD */
500
524
lea sym_offs(__2M_rwdata_end), %ecx /* end of target image */
501
525
lea sym_offs(_start), %edx /* target base address */
502
526
mov %esi , %eax /* load base address */
503
- /* slaunch_early_tests(load/eax, tgt/edx, tgt_end/ecx, ret/stk) using fastcall. */
527
+ /* slaunch_early_tests(load/eax, tgt/edx, tgt_end/ecx,
528
+ slaunch/stk, ret/stk) using fastcall. */
504
529
call slaunch_early_tests
505
530
506
531
/* Move outputs of slaunch_early_tests() from stack into registers. */
0 commit comments