git: e15374508381 - main - amd64: Set MSR_KGSBASE to 0 during AP startup

Mark Johnston markj at FreeBSD.org
Thu Jul 29 14:49:13 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1537450838134daaf584d1f17e661673b2c4c76

commit e1537450838134daaf584d1f17e661673b2c4c76
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-07-29 14:14:05 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-07-29 14:14:05 +0000

    amd64: Set MSR_KGSBASE to 0 during AP startup
    
    There is no reason to initialize it to anything else, and this matches
    initialization of the BSP.  No functional change intended.
    
    Reviewed by:    kib
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D31336
---
 sys/amd64/amd64/mp_machdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index df0270c543e6..86a5d78c8a8e 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -262,8 +262,8 @@ init_secondary(void)
 	lgdt(&ap_gdt);			/* does magic intra-segment return */
 
 	wrmsr(MSR_FSBASE, 0);		/* User value */
-	wrmsr(MSR_GSBASE, (u_int64_t)pc);
-	wrmsr(MSR_KGSBASE, (u_int64_t)pc);	/* XXX User value while we're in the kernel */
+	wrmsr(MSR_GSBASE, (uint64_t)pc);
+	wrmsr(MSR_KGSBASE, 0);		/* User value */
 	fix_cpuid();
 
 	lidt(&r_idt);


More information about the dev-commits-src-main mailing list