Date: Mon, 09 Feb 2026 04:33:55 +0000 From: Minsoo Choo <minsoochoo0122@proton.me> To: Konstantin Belousov <kib@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8f23665fed2f - main - pcb.h: mark struct pcb to be preserved Message-ID: <BD10AA2C-374D-4DCF-A4DD-7EFAC6BCDB00@proton.me> In-Reply-To: <69896027.2112e.2852c0dd@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] Ideally this should be applied to sys/mips/include/pcb.h when MFCed to stable/13. However, considering that stable/13 EOL is two months away and there wouldn't be breaking change to mips's pcb.h, it should be fine to ignore it. > On Feb 8, 2026, at 23:18, Konstantin Belousov <kib@FreeBSD.org> wrote: > > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=8f23665fed2fbaf4481359b4d2fcdd7b9feb40e3 > > commit 8f23665fed2fbaf4481359b4d2fcdd7b9feb40e3 > Author: Minsoo Choo <minsoochoo0122@proton.me> > AuthorDate: 2026-02-06 20:03:53 +0000 > Commit: Konstantin Belousov <kib@FreeBSD.org> > CommitDate: 2026-02-09 04:17:16 +0000 > > pcb.h: mark struct pcb to be preserved > > There are programs that depend on this structure (e.g. kernel debuggers) > that breaks when the ABI changes. > > Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> > Reviewed by: kib > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D55149 > --- > sys/amd64/include/pcb.h | 21 +++++++++++---------- > sys/arm/include/pcb.h | 4 ++++ > sys/arm64/include/pcb.h | 5 +++++ > sys/i386/include/pcb.h | 17 +++++++++-------- > sys/powerpc/include/pcb.h | 5 +++++ > sys/riscv/include/pcb.h | 5 +++++ > 6 files changed, 39 insertions(+), 18 deletions(-) > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > index 27e1dce08ee1..5a1e8529ad8b 100644 > --- a/sys/amd64/include/pcb.h > +++ b/sys/amd64/include/pcb.h > @@ -44,18 +44,19 @@ > > #ifdef __amd64__ > /* > - * NB: The fields marked with (*) are used by kernel debuggers. Their > - * ABI should be preserved. > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > */ > struct pcb { > - register_t pcb_r15; /* (*) */ > - register_t pcb_r14; /* (*) */ > - register_t pcb_r13; /* (*) */ > - register_t pcb_r12; /* (*) */ > - register_t pcb_rbp; /* (*) */ > - register_t pcb_rsp; /* (*) */ > - register_t pcb_rbx; /* (*) */ > - register_t pcb_rip; /* (*) */ > + register_t pcb_r15; > + register_t pcb_r14; > + register_t pcb_r13; > + register_t pcb_r12; > + register_t pcb_rbp; > + register_t pcb_rsp; > + register_t pcb_rbx; > + register_t pcb_rip; > register_t pcb_fsbase; > register_t pcb_gsbase; > register_t pcb_kgsbase; > diff --git a/sys/arm/include/pcb.h b/sys/arm/include/pcb.h > index fd77544c22c1..810b1e665b19 100644 > --- a/sys/arm/include/pcb.h > +++ b/sys/arm/include/pcb.h > @@ -42,6 +42,10 @@ > #include <machine/vfp.h> > > /* > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > + * > * WARNING! > * Keep pcb_regs first for faster access in switch.S > */ > diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h > index c0feb1149cf5..9955f5b22714 100644 > --- a/sys/arm64/include/pcb.h > +++ b/sys/arm64/include/pcb.h > @@ -46,6 +46,11 @@ struct trapframe; > #define PCB_FP 10 > #define PCB_LR 11 > > +/* > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > + */ > struct pcb { > uint64_t pcb_x[12]; > /* These two need to be in order as we access them together */ > diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h > index 1b14efa425b5..1385bfeeef31 100644 > --- a/sys/i386/include/pcb.h > +++ b/sys/i386/include/pcb.h > @@ -44,16 +44,17 @@ > #include <machine/npx.h> > > /* > - * NB: The fields marked with (*) are used by kernel debuggers. Their > - * ABI should be preserved. > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > */ > struct pcb { > - int pcb_edi; /* (*) */ > - int pcb_esi; /* (*) */ > - int pcb_ebp; /* (*) */ > - int pcb_esp; /* (*) */ > - int pcb_ebx; /* (*) */ > - int pcb_eip; /* (*) */ > + int pcb_edi; > + int pcb_esi; > + int pcb_ebp; > + int pcb_esp; > + int pcb_ebx; > + int pcb_eip; > struct segment_descriptor pcb_fsd; > struct segment_descriptor pcb_gsd; > int pcb_ds; > diff --git a/sys/powerpc/include/pcb.h b/sys/powerpc/include/pcb.h > index 0230cf78aba7..7ebd13dd0ed1 100644 > --- a/sys/powerpc/include/pcb.h > +++ b/sys/powerpc/include/pcb.h > @@ -41,6 +41,11 @@ > #include <machine/setjmp.h> > > #ifndef _STANDALONE > +/* > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > + */ > struct pcb { > register_t pcb_context[20]; /* non-volatile r12-r31 */ > register_t pcb_cr; /* Condition register */ > diff --git a/sys/riscv/include/pcb.h b/sys/riscv/include/pcb.h > index bb88516a1385..bcec4c3fd478 100644 > --- a/sys/riscv/include/pcb.h > +++ b/sys/riscv/include/pcb.h > @@ -39,6 +39,11 @@ > > struct trapframe; > > +/* > + * struct pcb is known to and used by kernel debuggers. Its layout must be kept > + * stable. When adding extra fields that are accessed by kernel debuggers, > + * debuggers should be backward compatible by using osreldate. > + */ > struct pcb { > uint64_t pcb_ra; /* Return address */ > uint64_t pcb_sp; /* Stack pointer */ [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSOON1Hsq2DvaiPa9wDBpV0Ql8zuAUCaYljmQAKCRADBpV0Ql8z uBitAQDP9yaJlcs32OnaSvIwoZNhj+fp4sF6eXo7usLePMBIUgD9Ergi4f43g63u b4C3E91Bsj9nqVetGmgt2d3iBLf6nAY= =VGAI -----END PGP SIGNATURE-----home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BD10AA2C-374D-4DCF-A4DD-7EFAC6BCDB00>
