Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2026 14:59:23 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 59d67f2868b1 - main - amd64/i386: Remove dead code to clear XSAVE header
Message-ID:  <6a1706cb.21e60.4bcaaba0@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhb:

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

commit 59d67f2868b17dc6ae897a3afd3ec4d96301e160
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-03-28 11:19:10 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-05-27 13:43:46 +0000

    amd64/i386: Remove dead code to clear XSAVE header
    
    If XSAVE is being used, the XSAVE header will be overwritten either by
    copying it from the parent thread in copy_thread for user threads, or
    by a fresh copy from fpu/npx_initialstate on the first use of the FPU
    for kernel threads.
    
    Reviewed by:    kib
    Sponsored by:   AFRL, DARPA
    Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
---
 sys/amd64/amd64/vm_machdep.c | 6 ------
 sys/i386/i386/vm_machdep.c   | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index e37f122dffa3..8121a17d885a 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -375,18 +375,12 @@ void
 cpu_thread_alloc(struct thread *td)
 {
 	struct pcb *pcb;
-	struct xstate_hdr *xhdr;
 
 	set_top_of_stack_td(td);
 	td->td_pcb = pcb = get_pcb_td(td);
 	td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1;
 	td->td_md.md_usr_fpu_save = fpu_save_area_alloc();
 	pcb->pcb_save = get_pcb_user_save_pcb(pcb);
-	if (use_xsave) {
-		xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1);
-		bzero(xhdr, sizeof(*xhdr));
-		xhdr->xstate_bv = xsave_mask;
-	}
 }
 
 void
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 003f00070bff..bf08f7dd3882 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -373,7 +373,6 @@ void
 cpu_thread_alloc(struct thread *td)
 {
 	struct pcb *pcb;
-	struct xstate_hdr *xhdr;
 
 	/*
 	 * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe
@@ -384,11 +383,6 @@ cpu_thread_alloc(struct thread *td)
 	    VM86_STACK_SPACE) - 1;
 	pcb->pcb_ext = NULL; 
 	pcb->pcb_save = get_pcb_user_save_pcb(pcb);
-	if (use_xsave) {
-		xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1);
-		bzero(xhdr, sizeof(*xhdr));
-		xhdr->xstate_bv = xsave_mask;
-	}
 }
 
 void


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a1706cb.21e60.4bcaaba0>