From nobody Mon Sep 16 08:15:07 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X6d4r3B7Mz5WkXl; Mon, 16 Sep 2024 08:15:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X6d4q6gPGz4RrR; Mon, 16 Sep 2024 08:15:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726474507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A8uxeFsQZTxcGBeiq2ixsjHWd0P0Xlg5nru41gwz3hs=; b=YLeMsDQlQW+24q3bSU2DsiWKO/du57/wZPdyRNUp5jPqNFJDP//XIsdHZi34jkOCFqInk7 wCZQUXXpgaOdHzlczDZO16nzIE0wYgBhw4t+B2D/WGOw1HCniTZfv3VGNgUlk5FpgJU8gU x42yIWoFGYcoFFvG3hzkLmunqOaapQ4f1OMTtHjUo6AShuXRZtKPRuXL42FF5sCWrsVxAm A2h+efJ1QtizOaGYNbcguSU1sd0uet9Tai4WA/UAYuyHdM6UTbMCEmGQC3GYqpRNaHO1wF eXbfNegKJS3MEW+JRTW1mjSRCLwHpspDoTMgYfh0+nOZu1XW1cMV9hUNpZkZRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726474507; a=rsa-sha256; cv=none; b=OnKRKI93O1Q5dEHn69WlZxIneJWb8F9+j91aDvqZHbbhuNQLF8Qg8RL9Gn0EPtnm9ebzMA p+Olp2MWOXn3CBKyGaLOFdOtXpvs5OsB+Wz7FeO59a4zAiesYXkYI2HsODbEWFtD9Xl79J 4fg3QVxKxlythwYBRLmJq63gD+qgn0umWOfEvWxIBiKlYpQI5NPpWH7a6nnOlVbYOG46vY 3t3eft2LGBamsaNtmou0ByTTi670vSba9KFmIvu0LoH46bNgKjh/tO8spx1YCg8fbDcead UKxvXgm9Bl8a0fE65Ds0jULpf0cvVH21TiRuhMNjiy3Dd+h1PBo2vlcOEZjmhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726474507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A8uxeFsQZTxcGBeiq2ixsjHWd0P0Xlg5nru41gwz3hs=; b=JiYJsp/wo5ElA5wULYFd24Vft61hN4UjUY2/BR/Rwg7aMYKj2H/8Qq7izBH6Do5ll9NOYD jmdP9gkvuAWGFoGfMk0HyW/odnZFJSzNlZc7Ilv1aLcJ4HU0v03FMiYrT5w8esBVWy52n1 +KEpiC4h8S2W7plDnXvB8qRfuXQ+MuyDmgHD4x5llLRXBD4jxfTuzqjmBHqVSlnUiciV6Y RLqhoNLAcZRlu07fOOFE2NI48zLV9IvAeSxutWjtQcDyT7ORfcK8Jj9DRXtAkZfsfhAWD7 dM7cvo9uMz/re9SI8j7gijRwOkli9uJoUOrDGb+iUoNH5d3IEIONCyKvdWMdaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X6d4q6HbWzmtw; Mon, 16 Sep 2024 08:15:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48G8F79j027209; Mon, 16 Sep 2024 08:15:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48G8F7UI027206; Mon, 16 Sep 2024 08:15:07 GMT (envelope-from git) Date: Mon, 16 Sep 2024 08:15:07 GMT Message-Id: <202409160815.48G8F7UI027206@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1be58e67eb24 - main - amd64 la57_trampoline: turn off global pages and PCID before turning off paging List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1be58e67eb24024bc808357771579d396679ecb0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1be58e67eb24024bc808357771579d396679ecb0 commit 1be58e67eb24024bc808357771579d396679ecb0 Author: Konstantin Belousov AuthorDate: 2024-09-12 02:42:23 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-16 08:10:16 +0000 amd64 la57_trampoline: turn off global pages and PCID before turning off paging SDM is explicit that having CR4.PCID=1 while toggling CR3.PG causes #GP. To be safe and to avoid some more effects, also turn off CR4.PGE. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/locore.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 9a991402cdc2..d05f38dbba05 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -94,6 +94,8 @@ ENTRY(la57_trampoline) movq %rsp,%r11 movq %rbx,%r10 movq %rbp,%r9 + movq %cr4,%r8 + orl $CR4_LA57,%r8d leaq la57_trampoline_end(%rip),%rsp movq %cr0,%rbp @@ -110,6 +112,10 @@ ENTRY(la57_trampoline) l1: movl $(3<<3),%eax movl %eax,%ss + movl %cr4,%eax + andl $~(CR4_PGE | CR4_PCIDE),%eax + movl %eax,%cr4 + movl %ebp,%eax andl $~CR0_PG,%eax movl %eax,%cr0 @@ -140,6 +146,7 @@ l1: movl $(3<<3),%eax l2: movq %r11,%rsp movq %r10,%rbx movq %r9,%rbp + movq %r8,%cr4 retq .p2align 4,0 ENTRY(la57_trampoline_gdt_desc)