From: Matthew Dillon Date: Thu, 11 Jul 2019 06:57:02 +0000 (-0700) Subject: kernel - Zen 2 - Make sure %fs's selector is loaded in AP bootstrap X-Git-Tag: v5.8.0rc1~1282 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1a923442efb8ded428689c89162631d739cf0548 kernel - Zen 2 - Make sure %fs's selector is loaded in AP bootstrap * Issue load_fs() in the AP bootstrap. It appears that Zen 2 handles %fs in a weird way when the selector isn't loaded, causing the first wrmsr(MSR_FSBASE) to quietly fail, and possibly others too. * For good measure, also issue load_ds() and load_es(). * Fixes DragonFlyBSD's boot on Zen 2. --- diff --git a/sys/platform/pc64/x86_64/mp_machdep.c b/sys/platform/pc64/x86_64/mp_machdep.c index 4a312d3b4d..af7d4eb4a4 100644 --- a/sys/platform/pc64/x86_64/mp_machdep.c +++ b/sys/platform/pc64/x86_64/mp_machdep.c @@ -136,6 +136,7 @@ int current_postcode; /** XXX FIXME: what system files declare these??? */ extern int naps; +extern int _udatasel; int64_t tsc0_offset; extern int64_t tsc_offsets[]; @@ -269,6 +270,10 @@ init_secondary(void) lidt(&r_idt_arr[mdcpu->mi.gd_cpuid]); + load_ds(_udatasel); + load_es(_udatasel); + load_fs(_udatasel); + #if 0 lldt(_default_ldt); mdcpu->gd_currentldt = _default_ldt;