Re: git: 8cc1c0f35ec8 - main - amd64 trap.c: provide tag for the struct sfhandlers definition
- Reply: FreeBSD User : "Re: git: 8cc1c0f35ec8 - main - amd64 trap.c: provide tag for the struct sfhandlers definition"
- In reply to: FreeBSD User : "Re: git: 8cc1c0f35ec8 - main - amd64 trap.c: provide tag for the struct sfhandlers definition"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 21 Mar 2026 18:57:13 UTC
On Sat, Mar 21, 2026 at 05:15:55PM +0100, FreeBSD User wrote:
> On Fri, 20 Mar 2026 22:49:57 +0000
> Konstantin Belousov <kib@FreeBSD.org> wrote:
>
> > The branch main has been updated by kib:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=8cc1c0f35ec8d5a3edb4ee1ede962a3c1f6baef0
> >
> > commit 8cc1c0f35ec8d5a3edb4ee1ede962a3c1f6baef0
> > Author: Konstantin Belousov <kib@FreeBSD.org>
> > AuthorDate: 2026-03-03 06:37:03 +0000
> > Commit: Konstantin Belousov <kib@FreeBSD.org>
> > CommitDate: 2026-03-20 22:49:03 +0000
> >
> > amd64 trap.c: provide tag for the struct sfhandlers definition
> >
> > Sponsored by: The FreeBSD Foundation
> > MFC after: 1 week
> > ---
> > sys/amd64/amd64/trap.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
> > index 8a1d1528e6da..359b3dfe3609 100644
> > --- a/sys/amd64/amd64/trap.c
> > +++ b/sys/amd64/amd64/trap.c
> > @@ -319,10 +319,12 @@ trap_check_intr_kernel(struct thread *td, struct
> > trapframe *frame) /*
> > * Table of handlers for various segment load faults.
> > */
> > -static const struct {
> > +struct sfhandler {
> > uintptr_t faddr;
> > uintptr_t fhandler;
> > -} sfhandlers[] = {
> > +};
> > +
> > +static const struct sfhandler sfhandlers[] = {
> > {
> > .faddr = (uintptr_t)ld_ds,
> > .fhandler = (uintptr_t)ds_load_fault,
> >
>
> Hello,
>
> it seems that one of the commits in this vain results in a hard reset of some
> CURRENT machine - this taken from some reports on freebsd-current list.
>
> In my case, two Zen5 based boxes, bott as usual, but when touch the system with
> "make buildworld buildkernel" or any single make build on the acting server
> box, the system reboots immediately - no trace of a log, coredump, simple
> nothing. Only hard reset. Same on another box acting as graphical workstation.
> As soon the system gets "touch" (login/starting windowmaker) the system goes
> nirwana.
>
> No further information, my boxes do not dump anything useful.
Try the following
commit 237044fd4d0659ef2799c259b1f1852c00b08b37
Author: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat Mar 21 20:45:48 2026 +0200
amd64: use IDT trapframe size to calculate location of nmi_pcpu from the IST stack pointer
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index babfbacf92ef..5bf9a12e1bf5 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -341,7 +341,7 @@ IDTVEC(dblfault)
pushfq
andq $~(PSL_D | PSL_AC),(%rsp)
popfq
- movq TF_SIZE(%rsp),%rdx
+ movq TF_SIZE_HW(%rsp),%rdx
movl %edx,%eax
shrq $32,%rdx
movl $MSR_GSBASE,%ecx
@@ -661,7 +661,7 @@ IDTVEC(dbg)
shlq $32,%rdx
orq %rdx,%r12
/* Retrieve and load the canonical value for GS.base. */
- movq TF_SIZE(%rsp),%rdx
+ movq TF_SIZE_HW(%rsp),%rdx
movl %edx,%eax
shrq $32,%rdx
wrmsr
@@ -798,7 +798,7 @@ IDTVEC(nmi)
shlq $32,%rdx
orq %rdx,%r12
/* Retrieve and load the canonical value for GS.base. */
- movq TF_SIZE(%rsp),%rdx
+ movq TF_SIZE_HW(%rsp),%rdx
movl %edx,%eax
shrq $32,%rdx
wrmsr
@@ -1002,7 +1002,7 @@ IDTVEC(mchk)
shlq $32,%rdx
orq %rdx,%r12
/* Retrieve and load the canonical value for GS.base. */
- movq TF_SIZE(%rsp),%rdx
+ movq TF_SIZE_HW(%rsp),%rdx
movl %edx,%eax
shrq $32,%rdx
wrmsr
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 2716784ee871..762c850c1df1 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -185,6 +185,7 @@ ASSYM(TF_FS, offsetof(struct trapframe, tf_fs));
ASSYM(TF_GS, offsetof(struct trapframe, tf_gs));
ASSYM(TF_FLAGS, offsetof(struct trapframe, tf_flags));
ASSYM(TF_SIZE, sizeof(struct trapframe));
+ASSYM(TF_SIZE_HW, sizeof(struct trapframe) - 2 * 8);
ASSYM(TF_HASSEGS, TF_HASSEGS);
ASSYM(PTI_RDX, offsetof(struct pti_frame, pti_rdx));