Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2024 08:15:06 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b7ea2b69ef66 - main - amd64 la57_trampoline: disable EFER.LME around setting CR4.LA57
Message-ID:  <202409160815.48G8F6Kc027143@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

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

commit b7ea2b69ef666ee8cdc6dcc814d610df0a7f0999
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-11 00:39:30 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-09-16 08:09:38 +0000

    amd64 la57_trampoline: disable EFER.LME around setting CR4.LA57
    
    Changing paging mode while LME is set seems to be not allowed.
    
    Sponsored by:   Advanced Micro Devices (AMD)
    Sponsored by:   jThe FreeBSD Foundation
    MFC after:      1 week
---
 sys/amd64/amd64/locore.S | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S
index 86db0f76b22b..9a991402cdc2 100644
--- a/sys/amd64/amd64/locore.S
+++ b/sys/amd64/amd64/locore.S
@@ -114,11 +114,21 @@ l1:	movl	$(3<<3),%eax
 	andl	$~CR0_PG,%eax
 	movl	%eax,%cr0
 
+	movl	$MSR_EFER,%ecx
+	rdmsr
+	andl	$~EFER_LME,%eax
+	wrmsr
+
 	movl	%cr4,%eax
 	orl	$CR4_LA57,%eax
 	movl	%eax,%cr4
 
 	movl	%edi,%cr3
+
+	rdmsr
+	orl	$EFER_LME,%eax
+	wrmsr
+
 	movl	%ebp,%cr0
 	jmp	1f
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409160815.48G8F6Kc027143>