From nobody Tue Nov 03 09:02:12 2026 X-Original-To: dev-commits-src-branches@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 4jJjJ4305sz6yPrx for ; Tue, 03 Nov 2026 09:02:12 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jJjJ41P6Hz4KVP for ; Tue, 03 Nov 2026 09:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793696532; 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=qroKuRbkGSPYudO+E+UzMzIj5F67fRQu+TRy/L7cbhY=; b=ceF5qUDYHK1NQqIwJl0BQFSNwL07GFXQkQPQEw03lWo4kFJMiW6wnP0PtSZtqoOkQ9ZmkI MJTitUGg0yadzkj0FygUwgMxY6p0T5peTPY4kxo/Nr3JWuwGTdzCJQsXjqlhj1b2GVid5Q 9iJKasSTD1UovY2+KNn8zGQj90c2HCW+qS5jxu+AipzAJ6ejoAMq6r54zN4hsKeYIVuXln pD63EJm90PrkB/3I7fwOju6sfnB5cQcIRKw5e3MSbwJsHQ/SKpPDDBMcwTrD2Eu/ATBu40 P1H81MbC+JFsbnHfiTM84fi3D+fTW0EllTRsC8GXyVvQhHSm5pVZ53MPBL3AxQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793696532; b=VCmzgqE8jEnYGktAud1eQ4NRx8ytuNo9tohVTV43KyMeRFAMsEwMRItCH9Lbnlg7HN4CjN JFvT6aHFY6Q4K/BFX67C471H59Nj6DjRJlRKolC3JeMB616FvmpV7xnh5jEGAVe3RU4Hd1 QMpNVqlNxGBble7hQdqyvP/zKiSSmpJE3Fym5W4hcKBjF+R+cr865+lRAePDxMdcK6E4oQ AkyJCtzop7zSLMSkxiwZgJF9SV14I2zcAxT/q9/kqeOe/8275dE/8PKRAkz+bG4GYhXGQW GmytBVZ5bIrQHZxbgd9t/APlozC7ZXEpyRWaQNvjJwGhLOZMzXO57EtqV4EFLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793696532; 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=qroKuRbkGSPYudO+E+UzMzIj5F67fRQu+TRy/L7cbhY=; b=RsDCQyF2Jc0UJEgJC6ZM04D24JIAKoPWTEMnSM/o+QxfrXFt2wmAmE12aSuX3oC3s6Yt3Q bGsMYdj7WflpGSejza/7diKIk0qnkjOQtjCKxH8DXVyHju02U5bAu5vlQV3XQ3jINwz0vG LNPbjULFo8mVSIWbc7RL7OpvTZXipauHT2x0grDvVNj2EsjWmSeeBKSq5DxJHAdDK5oGuK De0CzLq0sz/H500ipNPdaeN1k448kCtKD4DVhKQLrmH6egbk1mlEm5iwRdht0K1OvOwCKG +kXFWUKijobtTOYy9IUEjGUwN3FW8FrnCu/COWTsGdRG++vHnLpAiedm2Vqa4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jJjJ413DKz1PBV for ; Tue, 03 Nov 2026 09:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44a1d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Nov 2026 09:02:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d5d2aee87319 - stable/15 - amd64 resumectx(): restore FRED state before loading %cr4 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/stable/15 X-Git-Reftype: branch X-Git-Commit: d5d2aee87319a677896277a994ee4f57f665a94d Auto-Submitted: auto-generated Date: Tue, 03 Nov 2026 09:02:12 +0000 Message-Id: <6ae9a314.44a1d.1567ccf1@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d5d2aee87319a677896277a994ee4f57f665a94d commit d5d2aee87319a677896277a994ee4f57f665a94d Author: Konstantin Belousov AuthorDate: 2026-10-28 14:05:50 +0000 Commit: Konstantin Belousov CommitDate: 2026-11-03 09:01:15 +0000 amd64 resumectx(): restore FRED state before loading %cr4 (cherry picked from commit 2fd12bf2dd9c1cf997ce2505bc2af10572ca70e2) --- sys/amd64/amd64/cpu_switch.S | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index a9a8ad3da872..5c76114b747e 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -467,22 +467,10 @@ ENTRY(resumectx) movl PCB_SFMASK(%rdi),%eax wrmsr - /* Restore CR0, CR2, CR4 and CR3. */ - movq PCB_CR0(%rdi),%rax - movq %rax,%cr0 - movq PCB_CR2(%rdi),%rax - movq %rax,%cr2 - movq PCB_CR4(%rdi),%rax - movq %rax,%cr4 - movq PCB_CR3(%rdi),%rax - movq %rax,%cr3 - - /* Restore descriptor tables. */ + /* Restore FRED state before reloading %cr4. */ cmpb $0,fred - jne 1f - lidt PCB_IDT(%rdi) - jmp 2f -1: movl $MSR_FRED_RSP0,%ecx + je 1f + movl $MSR_FRED_RSP0,%ecx movl PCB_FRED_RSP0(%rdi),%eax movl 4 + PCB_FRED_RSP0(%rdi),%edx wrmsr @@ -506,7 +494,22 @@ ENTRY(resumectx) movl PCB_FRED_CONFIG(%rdi),%eax movl 4 + PCB_FRED_CONFIG(%rdi),%edx wrmsr -2: lldt PCB_LDT(%rdi) +1: + /* Restore CR0, CR2, CR4 and CR3. */ + movq PCB_CR0(%rdi),%rax + movq %rax,%cr0 + movq PCB_CR2(%rdi),%rax + movq %rax,%cr2 + movq PCB_CR4(%rdi),%rax + movq %rax,%cr4 + movq PCB_CR3(%rdi),%rax + movq %rax,%cr3 + + /* Restore descriptor tables. */ + cmpb $0,fred + jne 1f + lidt PCB_IDT(%rdi) +1: lldt PCB_LDT(%rdi) #define SDT_SYSTSS 9 #define SDT_SYSBSY 11