@@ -354,10 +354,12 @@ cs32_switch:
354
354
jmp *%edi
355
355
356
356
/*
357
- * Entry point for TrenchBoot Secure Launch on Intel TXT platforms.
357
+ * Entry point for TrenchBoot Secure Launch, common for Intel TXT and
358
+ * AMD Secure Startup, but state is slightly different.
358
359
*
360
+ * On Intel:
359
361
* CPU is in 32b protected mode with paging disabled. On entry:
360
- * - %ebx = %eip = MLE entry point,
362
+ * - %ebx = %eip = this entry point,
361
363
* - stack pointer is undefined,
362
364
* - CS is flat 4GB code segment,
363
365
* - DS, ES, SS, FS and GS are undefined according to TXT SDG, but this
@@ -375,13 +377,34 @@ cs32_switch:
375
377
* - trying to enter real mode results in reset
376
378
* - APs must be brought up by MONITOR or GETSEC[WAKEUP], depending on
377
379
* which is supported by a given SINIT ACM
380
+ *
381
+ * On AMD (as implemented by TrenchBoot's SKL):
382
+ * CPU is in 32b protected mode with paging disabled. On entry:
383
+ * - %ebx = %eip = this entry point,
384
+ * - %ebp holds base address of SKL
385
+ * - stack pointer is treated as undefined for parity with TXT,
386
+ * - CS is flat 4GB code segment,
387
+ * - DS, ES, SS are flat 4GB data segments, but treated as undefined for
388
+ * parity with TXT.
389
+ *
390
+ * Additional restrictions:
391
+ * - interrupts (including NMIs and SMIs) are disabled and must be
392
+ * enabled later
393
+ * - APs must be brought up by SIPI without an INIT
378
394
*/
379
395
slaunch_stub_entry:
380
396
/* Calculate the load base address. */
381
397
mov %ebx , %esi
382
398
sub $sym_offs(slaunch_stub_entry), %esi
383
399
384
- /* Mark Secure Launch boot protocol and jump to common entry. */
400
+ /* On AMD, %ebp holds the base address of SLB, save it for later. */
401
+ mov %ebp , %ebx
402
+
403
+ /*
404
+ * Mark Secure Launch boot protocol and jump to common entry. Note that
405
+ * all general purpose registers except %ebx and %esi are clobbered
406
+ * between here and .Lslaunch_proto.
407
+ */
385
408
mov $SLAUNCH_BOOTLOADER_MAGIC, %eax
386
409
jmp .Lset_stack
387
410
@@ -508,15 +531,18 @@ __start:
508
531
sub $8 , %esp
509
532
510
533
push %esp /* pointer to output structure */
534
+ push %ebx /* Slaunch parameter on AMD */
511
535
lea sym_offs(__2M_rwdata_end), %ecx /* end of target image */
512
536
lea sym_offs(_start), %edx /* target base address */
513
537
mov %esi , %eax /* load base address */
514
538
/*
515
- * slaunch_early_tests(load/eax, tgt/edx, tgt_end/ecx, ret/stk) using
516
- * fastcall calling convention.
539
+ * slaunch_early_tests(load/eax, tgt/edx, tgt_end/ecx,
540
+ * slaunch/stk, ret/stk)
541
+ *
542
+ * Uses fastcall calling convention.
517
543
*/
518
544
call slaunch_early_tests
519
- add $4 , %esp /* pop the fourth parameter */
545
+ add $8 , %esp /* pop last two parameters */
520
546
521
547
/* Move outputs of slaunch_early_tests() from stack into registers. */
522
548
pop %eax /* physical MBI address */
0 commit comments