authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-02 12:38:55+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-02 12:38:55+02:00
log79dc16a0ee9f10b80966611f12fcb56f993778fc
tree6e41063c7c070a40dc6e46fe2133b24f5277f348
parent95396e2c5d14fed2070742c0da41ecfbcd012978
parent846aa04a07161e865d0b28f653e1ff0a99b25840

Merge pull request 'libc: update NetBSD headers to 11.0-RELEASE' (#36368) from alexrp/zig:netbsd-11 into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36368

23 files changed, 340 insertions(+), 87 deletions(-)

lib/libc/include/generic-netbsd/fcntl.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: fcntl.h,v 1.57 2025/07/25 23:24:46 kre Exp $ */1/* $NetBSD: fcntl.h,v 1.57.2.1 2026/06/16 09:06:50 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1983, 1990, 19934 * Copyright (c) 1983, 1990, 1993
...@@ -121,6 +121,9 @@...@@ -121,6 +121,9 @@
121#if defined(_NETBSD_SOURCE)121#if defined(_NETBSD_SOURCE)
122#define O_NOSIGPIPE 0x01000000 /* don't deliver sigpipe */122#define O_NOSIGPIPE 0x01000000 /* don't deliver sigpipe */
123#define O_REGULAR 0x02000000 /* fail if not a regular file */123#define O_REGULAR 0x02000000 /* fail if not a regular file */
124#endif
125#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
126 defined(_NETBSD_SOURCE)
124#define O_EXEC 0x04000000 /* open for executing only */127#define O_EXEC 0x04000000 /* open for executing only */
125#endif128#endif
126#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \129#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \
lib/libc/include/generic-netbsd/i386/mcontext.h+23-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: mcontext.h,v 1.19 2024/11/30 01:04:10 christos Exp $ */1/* $NetBSD: mcontext.h,v 1.19.2.1 2026/07/19 15:57:27 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
...@@ -40,6 +40,7 @@...@@ -40,6 +40,7 @@
40#define _UC_CLRSTACK _UC_MD_BIT1740#define _UC_CLRSTACK _UC_MD_BIT17
41#define _UC_VM _UC_MD_BIT1841#define _UC_VM _UC_MD_BIT18
42#define _UC_TLSBASE _UC_MD_BIT1942#define _UC_TLSBASE _UC_MD_BIT19
43#define _UC_XSAVE _UC_MD_BIT20
4344
44/*45/*
45 * Layout of mcontext_t according to the System V Application Binary Interface,46 * Layout of mcontext_t according to the System V Application Binary Interface,
...@@ -85,6 +86,27 @@ typedef struct {...@@ -85,6 +86,27 @@ typedef struct {
85 char __fp_xmm[512];86 char __fp_xmm[512];
86 } __fp_xmm_state; /* x87 and xmm regs in fxsave format */87 } __fp_xmm_state; /* x87 and xmm regs in fxsave format */
87 int __fp_fpregs[128];88 int __fp_fpregs[128];
89 struct {
90 /*
91 * `The XSAVE feature set does not use bytes
92 * 511:416; bytes 463:416 are reserved.'
93 *
94 * We take a part out of this to form a pointer
95 * to an external XSAVE area. This way, we can
96 * replicate the FXSAVE parts for the benefit
97 * of userland programs that aren't aware of
98 * the XSAVE pointer, have used the extended
99 * CPU registers (ymmN/zmmN/&c.), and want to
100 * examine the x87/SSE register state in a
101 * signal handler. The kernel does not use
102 * this part.
103 */
104 char __fxsave[416];
105 char __rsvd[48];
106 __greg_t __xsaveptr;
107 __greg_t __xsavelen;
108 char __pad[40];
109 } __xsave;
88 } __fp_reg_set;110 } __fp_reg_set;
89 int __fp_pad[33]; /* Historic padding */111 int __fp_pad[33]; /* Historic padding */
90} __fpregset_t;112} __fpregset_t;
lib/libc/include/generic-netbsd/i386/wchar_limits.h+1-1
...@@ -44,4 +44,4 @@...@@ -44,4 +44,4 @@
44#define WINT_MIN (-0x7fffffff-1) /* wint_t */44#define WINT_MIN (-0x7fffffff-1) /* wint_t */
45#define WINT_MAX 0x7fffffff /* wint_t */45#define WINT_MAX 0x7fffffff /* wint_t */
4646
47#endif /* !_I386_WCHAR_LIMITS_H_ */47#endif /* !_I386_WCHAR_LIMITS_H_ */
\ No newline at end of file
lib/libc/include/generic-netbsd/machine/pte.h+32-19
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: pte.h,v 1.14.2.2 2025/10/26 12:28:36 martin Exp $ */1/* $NetBSD: pte.h,v 1.14.2.3 2026/06/03 18:17:02 martin Exp $ */
22
3/*3/*
4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
...@@ -139,6 +139,12 @@ pte_modified_p(pt_entry_t pte)...@@ -139,6 +139,12 @@ pte_modified_p(pt_entry_t pte)
139 return (pte & PTE_D) != 0;139 return (pte & PTE_D) != 0;
140}140}
141141
142static inline bool
143pte_referenced_p(pt_entry_t pte)
144{
145 return (pte & PTE_A) != 0;
146}
147
142static inline bool148static inline bool
143pte_cached_p(pt_entry_t pte)149pte_cached_p(pt_entry_t pte)
144{150{
...@@ -177,9 +183,15 @@ pte_nv_entry(bool kernel_p)...@@ -177,9 +183,15 @@ pte_nv_entry(bool kernel_p)
177}183}
178184
179static inline pt_entry_t185static inline pt_entry_t
180pte_prot_nowrite(pt_entry_t pte)186pte_clear_modify(pt_entry_t pte)
187{
188 return pte & ~PTE_D;
189}
190
191static inline pt_entry_t
192pte_clear_reference(pt_entry_t pte)
181{193{
182 return pte & ~PTE_W;194 return pte & ~PTE_A;
183}195}
184196
185static inline pt_entry_t197static inline pt_entry_t
...@@ -237,28 +249,29 @@ pte_make_enter(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,...@@ -237,28 +249,29 @@ pte_make_enter(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,
237 pte |= pte_prot_bits(mdpg, prot, kernel_p);249 pte |= pte_prot_bits(mdpg, prot, kernel_p);
238 pte |= pte_enter_flags_to_pbmt(flags);250 pte |= pte_enter_flags_to_pbmt(flags);
239251
240 if (mdpg != NULL) {252 /*
253 * pmap_enter should have checked flags and updated
254 * VM_PAGEMD_{REFERENCED,MODIFIED}_P, so there is no
255 * need here.
256 */
257 KASSERT(((flags & VM_PROT_ALL) == 0) || VM_PAGEMD_REFERENCED_P(mdpg));
258 KASSERT(((flags & VM_PROT_WRITE) == 0) || VM_PAGEMD_MODIFIED_P(mdpg));
241259
242 if ((prot & VM_PROT_WRITE) != 0 &&260 if (mdpg != NULL) {
243 ((flags & VM_PROT_WRITE) != 0 || VM_PAGEMD_MODIFIED_P(mdpg))) {261 if ((prot & VM_PROT_WRITE) != 0 && VM_PAGEMD_MODIFIED_P(mdpg)) {
244 /*262 /*
245 * This is a writable mapping, and the page's mod state263 * This is a writable mapping, and the page's mod state
246 * indicates it has already been modified. No need for264 * indicates it has already been modified. No need for
247 * modified emulation.265 * reference or modified emulation.
248 */266 */
249 pte |= PTE_A | PTE_D;267 pte |= PTE_A | PTE_D;
250 } else if ((flags & VM_PROT_ALL) || VM_PAGEMD_REFERENCED_P(mdpg)) {268 } else if (VM_PAGEMD_REFERENCED_P(mdpg)) {
251 /*269 /*
252 * - The access type indicates that we don't need to do270 * The physical page has already been referenced so no need
253 * referenced emulation.271 * to re-do referenced emulation here.
254 * OR272 */
255 * - The physical page has already been referenced so no need
256 * to re-do referenced emulation here.
257 */
258 pte |= PTE_A;273 pte |= PTE_A;
259 }274 }
260 } else {
261 pte |= PTE_A | PTE_D;
262 }275 }
263276
264 return pte;277 return pte;
lib/libc/include/generic-netbsd/machine/vmparam.h+21-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: vmparam.h,v 1.14 2023/05/07 12:41:48 skrll Exp $ */1/* $NetBSD: vmparam.h,v 1.14.8.2 2026/06/03 18:17:02 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
...@@ -50,6 +50,25 @@...@@ -50,6 +50,25 @@
50#define PAGE_SIZE (1 << PAGE_SHIFT)50#define PAGE_SIZE (1 << PAGE_SHIFT)
51#define PAGE_MASK (PAGE_SIZE - 1)51#define PAGE_MASK (PAGE_SIZE - 1)
5252
53#ifdef _LP64
54/*
55 * Default pager_map of 16MB is awfully small. There is plenty
56 * of VA so use it.
57 */
58#define PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
59
60/*
61 * Defaults for Unified Buffer Cache parameters.
62 */
63
64#ifndef UBC_WINSHIFT
65#define UBC_WINSHIFT 16 /* 64kB */
66#endif
67#ifndef UBC_NWINS
68#define UBC_NWINS 4096 /* 256MB */
69#endif
70#endif
71
53/*72/*
54 * USRSTACK is the top (end) of the user stack.73 * USRSTACK is the top (end) of the user stack.
55 *74 *
...@@ -125,12 +144,6 @@...@@ -125,12 +144,6 @@
125#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)144#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)
126145
127#else /* Sv32 */146#else /* Sv32 */
128/*
129 * kernel virtual space layout:
130 * 0x8000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss)
131 * (0x4000_0000 +1GiB) KERNEL VM start of KVA
132 * (0x0000_0000 64GiB) reserved
133 */
134147
135/*148/*
136 * kernel virtual space layout without direct map (common case)149 * kernel virtual space layout without direct map (common case)
...@@ -154,13 +167,12 @@...@@ -154,13 +167,12 @@
154 *167 *
155 */168 */
156169
157
158
159#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */170#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */
160#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */171#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */
161#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x10000000) /* 0xffff_ffff_f000_0000 */172#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x10000000) /* 0xffff_ffff_f000_0000 */
162173
163#endif174#endif
175
164#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS176#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS
165#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */177#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */
166#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)178#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)
lib/libc/include/generic-netbsd/mips/pte.h+14-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: pte.h,v 1.27 2020/08/22 15:34:51 skrll Exp $ */1/* $NetBSD: pte.h,v 1.27.28.1 2026/06/03 18:17:03 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
...@@ -269,6 +269,12 @@ pte_modified_p(pt_entry_t pte)...@@ -269,6 +269,12 @@ pte_modified_p(pt_entry_t pte)
269 return (pte & MIPS_MMU(PG_D)) != 0;269 return (pte & MIPS_MMU(PG_D)) != 0;
270}270}
271271
272static inline bool
273pte_referenced_p(pt_entry_t pte)
274{
275 return false;
276}
277
272static inline bool278static inline bool
273pte_global_p(pt_entry_t pte)279pte_global_p(pt_entry_t pte)
274{280{
...@@ -340,11 +346,17 @@ pte_prot_downgrade(pt_entry_t pte, vm_prot_t prot)...@@ -340,11 +346,17 @@ pte_prot_downgrade(pt_entry_t pte, vm_prot_t prot)
340}346}
341347
342static inline pt_entry_t348static inline pt_entry_t
343pte_prot_nowrite(pt_entry_t pte)349pte_clear_modify(pt_entry_t pte)
344{350{
345 return pte & ~MIPS_MMU(PG_D);351 return pte & ~MIPS_MMU(PG_D);
346}352}
347353
354static inline pt_entry_t
355pte_clear_reference(pt_entry_t pte)
356{
357 return pte;
358}
359
348static inline pt_entry_t360static inline pt_entry_t
349pte_cached_change(pt_entry_t pte, bool cached)361pte_cached_change(pt_entry_t pte, bool cached)
350{362{
lib/libc/include/generic-netbsd/netinet/tcp_timer.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: tcp_timer.h,v 1.30 2019/08/06 15:48:18 riastradh Exp $ */1/* $NetBSD: tcp_timer.h,v 1.30.34.1 2026/07/19 15:51:03 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2001, 2005 The NetBSD Foundation, Inc.4 * Copyright (c) 2001, 2005 The NetBSD Foundation, Inc.
...@@ -119,7 +119,7 @@...@@ -119,7 +119,7 @@
119#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */119#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */
120#define TCPTV_SRTTBASE 0 /* base roundtrip time;120#define TCPTV_SRTTBASE 0 /* base roundtrip time;
121 if 0, no idea yet */121 if 0, no idea yet */
122#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */122#define TCPTV_SRTTDFLT ( 1*PR_SLOWHZ) /* initial RTO; RFC 6298 (2.1) */
123123
124#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */124#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */
125#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */125#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */
lib/libc/include/generic-netbsd/nfs/nfs.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: nfs.h,v 1.81 2024/12/07 02:05:55 riastradh Exp $ */1/* $NetBSD: nfs.h,v 1.81.2.1 2026/06/27 09:46:05 martin Exp $ */
2/*2/*
3 * Copyright (c) 1989, 1993, 19953 * Copyright (c) 1989, 1993, 1995
4 * The Regents of the University of California. All rights reserved.4 * The Regents of the University of California. All rights reserved.
...@@ -451,6 +451,8 @@ struct nfssvc_sock {...@@ -451,6 +451,8 @@ struct nfssvc_sock {
451 int ns_sflags; /* b: */451 int ns_sflags; /* b: */
452 int ns_cc; /* b: */452 int ns_cc; /* b: */
453 int ns_reclen; /* b: */453 int ns_reclen; /* b: */
454 int ns_frag_count; /* b: */
455 int ns_streamlen; /* b: */
454 int ns_numuids;456 int ns_numuids;
455 u_int32_t ns_sref; /* g: */457 u_int32_t ns_sref; /* g: */
456 SIMPLEQ_HEAD(, nfsrv_descript) ns_sendq; /* s: send reply list */458 SIMPLEQ_HEAD(, nfsrv_descript) ns_sendq; /* s: send reply list */
lib/libc/include/generic-netbsd/nfs/nfsmount.h+4-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: nfsmount.h,v 1.54 2024/12/07 02:05:55 riastradh Exp $ */1/* $NetBSD: nfsmount.h,v 1.54.2.1 2026/06/03 18:46:36 martin Exp $ */
22
3/*3/*
4 * Copyright (c) 1989, 19934 * Copyright (c) 1989, 1993
...@@ -92,13 +92,15 @@ struct nfs_args {...@@ -92,13 +92,15 @@ struct nfs_args {
92#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */92#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
93#define NFSMNT_XLATECOOKIE 0x00040000 /* 32<->64 dir cookie xlation */93#define NFSMNT_XLATECOOKIE 0x00040000 /* 32<->64 dir cookie xlation */
94#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */94#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */
95#define NFSMNT_NOWCCMSG 0x00100000 /* Turn off attribute wcc messages */
9596
96#define NFSMNT_BITS "\177\20" \97#define NFSMNT_BITS "\177\20" \
97 "b\00soft\0b\01wsize\0b\02rsize\0b\03timeo\0" \98 "b\00soft\0b\01wsize\0b\02rsize\0b\03timeo\0" \
98 "b\04retrans\0b\05maxgrps\0b\06intr\0b\07noconn\0" \99 "b\04retrans\0b\05maxgrps\0b\06intr\0b\07noconn\0" \
99 "b\10nqnfs\0b\11nfsv3\0b\12kerb\0b\13dumbtimr\0" \100 "b\10nqnfs\0b\11nfsv3\0b\12kerb\0b\13dumbtimr\0" \
100 "b\14leaseterm\0b\15readahead\0b\16deadthresh\0b\17resvport\0" \101 "b\14leaseterm\0b\15readahead\0b\16deadthresh\0b\17resvport\0" \
101 "b\20rdirplus\0b\21readdirsize\0b\22xlatecookie\0b\23noac\0"102 "b\20rdirplus\0b\21readdirsize\0b\22xlatecookie\0b\23noac\0" \
103 "b\24nowccmsg\0"
102104
103/*105/*
104 * NFS internal flags (nm_iflag) */106 * NFS internal flags (nm_iflag) */
lib/libc/include/generic-netbsd/pthread.h+1-1
...@@ -461,4 +461,4 @@ __END_DECLS...@@ -461,4 +461,4 @@ __END_DECLS
461461
462#endif /* __LIBPTHREAD_SOURCE__ */462#endif /* __LIBPTHREAD_SOURCE__ */
463463
464#endif /* _LIB_PTHREAD_H */464#endif /* _LIB_PTHREAD_H */
\ No newline at end of file
lib/libc/include/generic-netbsd/riscv/pte.h+32-19
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: pte.h,v 1.14.2.2 2025/10/26 12:28:36 martin Exp $ */1/* $NetBSD: pte.h,v 1.14.2.3 2026/06/03 18:17:02 martin Exp $ */
22
3/*3/*
4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
...@@ -139,6 +139,12 @@ pte_modified_p(pt_entry_t pte)...@@ -139,6 +139,12 @@ pte_modified_p(pt_entry_t pte)
139 return (pte & PTE_D) != 0;139 return (pte & PTE_D) != 0;
140}140}
141141
142static inline bool
143pte_referenced_p(pt_entry_t pte)
144{
145 return (pte & PTE_A) != 0;
146}
147
142static inline bool148static inline bool
143pte_cached_p(pt_entry_t pte)149pte_cached_p(pt_entry_t pte)
144{150{
...@@ -177,9 +183,15 @@ pte_nv_entry(bool kernel_p)...@@ -177,9 +183,15 @@ pte_nv_entry(bool kernel_p)
177}183}
178184
179static inline pt_entry_t185static inline pt_entry_t
180pte_prot_nowrite(pt_entry_t pte)186pte_clear_modify(pt_entry_t pte)
187{
188 return pte & ~PTE_D;
189}
190
191static inline pt_entry_t
192pte_clear_reference(pt_entry_t pte)
181{193{
182 return pte & ~PTE_W;194 return pte & ~PTE_A;
183}195}
184196
185static inline pt_entry_t197static inline pt_entry_t
...@@ -237,28 +249,29 @@ pte_make_enter(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,...@@ -237,28 +249,29 @@ pte_make_enter(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,
237 pte |= pte_prot_bits(mdpg, prot, kernel_p);249 pte |= pte_prot_bits(mdpg, prot, kernel_p);
238 pte |= pte_enter_flags_to_pbmt(flags);250 pte |= pte_enter_flags_to_pbmt(flags);
239251
240 if (mdpg != NULL) {252 /*
253 * pmap_enter should have checked flags and updated
254 * VM_PAGEMD_{REFERENCED,MODIFIED}_P, so there is no
255 * need here.
256 */
257 KASSERT(((flags & VM_PROT_ALL) == 0) || VM_PAGEMD_REFERENCED_P(mdpg));
258 KASSERT(((flags & VM_PROT_WRITE) == 0) || VM_PAGEMD_MODIFIED_P(mdpg));
241259
242 if ((prot & VM_PROT_WRITE) != 0 &&260 if (mdpg != NULL) {
243 ((flags & VM_PROT_WRITE) != 0 || VM_PAGEMD_MODIFIED_P(mdpg))) {261 if ((prot & VM_PROT_WRITE) != 0 && VM_PAGEMD_MODIFIED_P(mdpg)) {
244 /*262 /*
245 * This is a writable mapping, and the page's mod state263 * This is a writable mapping, and the page's mod state
246 * indicates it has already been modified. No need for264 * indicates it has already been modified. No need for
247 * modified emulation.265 * reference or modified emulation.
248 */266 */
249 pte |= PTE_A | PTE_D;267 pte |= PTE_A | PTE_D;
250 } else if ((flags & VM_PROT_ALL) || VM_PAGEMD_REFERENCED_P(mdpg)) {268 } else if (VM_PAGEMD_REFERENCED_P(mdpg)) {
251 /*269 /*
252 * - The access type indicates that we don't need to do270 * The physical page has already been referenced so no need
253 * referenced emulation.271 * to re-do referenced emulation here.
254 * OR272 */
255 * - The physical page has already been referenced so no need
256 * to re-do referenced emulation here.
257 */
258 pte |= PTE_A;273 pte |= PTE_A;
259 }274 }
260 } else {
261 pte |= PTE_A | PTE_D;
262 }275 }
263276
264 return pte;277 return pte;
lib/libc/include/generic-netbsd/riscv/vmparam.h+21-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: vmparam.h,v 1.14 2023/05/07 12:41:48 skrll Exp $ */1/* $NetBSD: vmparam.h,v 1.14.8.2 2026/06/03 18:17:02 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
...@@ -50,6 +50,25 @@...@@ -50,6 +50,25 @@
50#define PAGE_SIZE (1 << PAGE_SHIFT)50#define PAGE_SIZE (1 << PAGE_SHIFT)
51#define PAGE_MASK (PAGE_SIZE - 1)51#define PAGE_MASK (PAGE_SIZE - 1)
5252
53#ifdef _LP64
54/*
55 * Default pager_map of 16MB is awfully small. There is plenty
56 * of VA so use it.
57 */
58#define PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
59
60/*
61 * Defaults for Unified Buffer Cache parameters.
62 */
63
64#ifndef UBC_WINSHIFT
65#define UBC_WINSHIFT 16 /* 64kB */
66#endif
67#ifndef UBC_NWINS
68#define UBC_NWINS 4096 /* 256MB */
69#endif
70#endif
71
53/*72/*
54 * USRSTACK is the top (end) of the user stack.73 * USRSTACK is the top (end) of the user stack.
55 *74 *
...@@ -125,12 +144,6 @@...@@ -125,12 +144,6 @@
125#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)144#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)
126145
127#else /* Sv32 */146#else /* Sv32 */
128/*
129 * kernel virtual space layout:
130 * 0x8000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss)
131 * (0x4000_0000 +1GiB) KERNEL VM start of KVA
132 * (0x0000_0000 64GiB) reserved
133 */
134147
135/*148/*
136 * kernel virtual space layout without direct map (common case)149 * kernel virtual space layout without direct map (common case)
...@@ -154,13 +167,12 @@...@@ -154,13 +167,12 @@
154 *167 *
155 */168 */
156169
157
158
159#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */170#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */
160#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */171#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffff_ffff_8000_0000 */
161#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x10000000) /* 0xffff_ffff_f000_0000 */172#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x10000000) /* 0xffff_ffff_f000_0000 */
162173
163#endif174#endif
175
164#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS176#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS
165#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */177#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */
166#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)178#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)
lib/libc/include/generic-netbsd/sys/fcntl.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: fcntl.h,v 1.57 2025/07/25 23:24:46 kre Exp $ */1/* $NetBSD: fcntl.h,v 1.57.2.1 2026/06/16 09:06:50 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1983, 1990, 19934 * Copyright (c) 1983, 1990, 1993
...@@ -121,6 +121,9 @@...@@ -121,6 +121,9 @@
121#if defined(_NETBSD_SOURCE)121#if defined(_NETBSD_SOURCE)
122#define O_NOSIGPIPE 0x01000000 /* don't deliver sigpipe */122#define O_NOSIGPIPE 0x01000000 /* don't deliver sigpipe */
123#define O_REGULAR 0x02000000 /* fail if not a regular file */123#define O_REGULAR 0x02000000 /* fail if not a regular file */
124#endif
125#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
126 defined(_NETBSD_SOURCE)
124#define O_EXEC 0x04000000 /* open for executing only */127#define O_EXEC 0x04000000 /* open for executing only */
125#endif128#endif
126#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \129#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \
lib/libc/include/generic-netbsd/sys/lua.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: lua.h,v 1.9 2023/07/11 14:57:21 martin Exp $ */1/* $NetBSD: lua.h,v 1.9.8.1 2026/06/29 19:52:23 martin Exp $ */
22
3/*3/*
4 * Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.4 * Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.
...@@ -33,7 +33,9 @@...@@ -33,7 +33,9 @@
33#define _SYS_LUA_H_33#define _SYS_LUA_H_
3434
35#include <sys/param.h>35#include <sys/param.h>
36
36#include <sys/ioccom.h>37#include <sys/ioccom.h>
38#include <sys/stdbool.h>
3739
38#include <lua.h> /* for lua_State */40#include <lua.h> /* for lua_State */
3941
lib/libc/include/generic-netbsd/sys/param.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: param.h,v 1.738.2.5 2026/05/12 04:23:51 martin Exp $ */1/* $NetBSD: param.h,v 1.738.2.9 2026/07/30 15:23:12 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1982, 1986, 1989, 19934 * Copyright (c) 1982, 1986, 1989, 1993
...@@ -566,4 +566,4 @@ extern size_t coherency_unit;...@@ -566,4 +566,4 @@ extern size_t coherency_unit;
566#endif566#endif
567#endif /* !__ASSEMBLER__ */567#endif /* !__ASSEMBLER__ */
568568
569#endif /* !_SYS_PARAM_H_ */569#endif /* !_SYS_PARAM_H_ */
\ No newline at end of file
lib/libc/include/generic-netbsd/x86/cpu_extended_state.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: cpu_extended_state.h,v 1.19 2025/04/24 01:50:39 riastradh Exp $ */1/* $NetBSD: cpu_extended_state.h,v 1.19.2.1 2026/07/19 15:57:27 martin Exp $ */
22
3#ifndef _X86_CPU_EXTENDED_STATE_H_3#ifndef _X86_CPU_EXTENDED_STATE_H_
4#define _X86_CPU_EXTENDED_STATE_H_4#define _X86_CPU_EXTENDED_STATE_H_
...@@ -142,6 +142,8 @@ struct xsave_header {...@@ -142,6 +142,8 @@ struct xsave_header {
142};142};
143__CTASSERT(sizeof(struct xsave_header) == 512 + 64);143__CTASSERT(sizeof(struct xsave_header) == 512 + 64);
144144
145#define XSAVE_ALIGN 64
146
145/*147/*
146 * The ymm save area actually follows the xsave_header.148 * The ymm save area actually follows the xsave_header.
147 */149 */
lib/libc/include/generic-netbsd/x86/fpu.h+7-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: fpu.h,v 1.23 2020/10/24 07:14:29 mgorny Exp $ */1/* $NetBSD: fpu.h,v 1.23.28.1 2026/07/19 15:57:27 martin Exp $ */
22
3#ifndef _X86_FPU_H_3#ifndef _X86_FPU_H_
4#define _X86_FPU_H_4#define _X86_FPU_H_
...@@ -46,6 +46,12 @@ int process_read_xstate(struct lwp *, struct xstate *);...@@ -46,6 +46,12 @@ int process_read_xstate(struct lwp *, struct xstate *);
46int process_verify_xstate(const struct xstate *);46int process_verify_xstate(const struct xstate *);
47int process_write_xstate(struct lwp *, const struct xstate *);47int process_write_xstate(struct lwp *, const struct xstate *);
4848
49bool process_xsave_needed_p(struct lwp *);
50void process_read_xsave(struct lwp *, const struct xsave_header **, size_t *);
51int process_verify_xsavelen(struct lwp *, size_t);
52int process_verify_xsave(struct lwp *, const struct xsave_header *, size_t);
53void process_write_xsave(struct lwp *, const struct xsave_header *, size_t);
54
49#endif55#endif
5056
51#endif /* _X86_FPU_H_ */57#endif /* _X86_FPU_H_ */
\ No newline at end of file
lib/libc/include/generic-netbsd/x86/specialreg.h+71-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: specialreg.h,v 1.219 2025/04/28 13:01:27 riastradh Exp $ */1/* $NetBSD: specialreg.h,v 1.219.2.1 2026/07/19 15:57:27 martin Exp $ */
22
3/*3/*
4 * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.4 * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
...@@ -183,16 +183,82 @@...@@ -183,16 +183,82 @@
183 "\0"183 "\0"
184184
185/*185/*
186 * Known FPU bits, only these get enabled. The save area is sized for all the186 * XCR0_FPU: Known FPU bits, only these get enabled. The save area is
187 * fields below.187 * sized for all the fields below.
188 *
189 * Any bits added to this will expand the extended CPU state that we
190 * may have to save and restore with XSAVE for userland processes,
191 * either in the kernel when preempting threads, or on the user's stack
192 * when delivering a signal.
193 *
194 * The kernel can dyanmically allocate larger sizes (on amd64, anyway,
195 * though not currently on i386 or Xen PV). But if the XSAVE area is
196 * expanded so much that it and mcontext_t exceed MINSIGSTKSZ
197 * (currently 8192), a userland ABI change and compatibility layer is
198 * required to accommodate that, because existing programs may use
199 * sigaltstack(2) with stacks sized for the old MINSIGSTKSZ.
200 *
201 * The current stack requirement is 3160 bytes of space plus up to
202 * 63+15+8=86 bytes of padding for alignment (could be reduced by
203 * around 512 bytes by having mcontext_t overlap with the XSAVE area a
204 * little in machdep.c cpu_getmcontext_xsave, but we don't do that
205 * right now):
206 *
207 * - mcontext_t (728 bytes: general registers and 512-byte FXSAVE area)
208 * - XSAVE header (576 bytes: 512 bytes of FXSAVE, 64 bytes of metadata)
209 * - AVX state: ymm0..ymm15 high 128-bit halves (256 bytes)
210 * - AVX-512 state:
211 * . k0..k7 opmask registers (64 bytes)
212 * . zmm0..zmm15 high 256-bit halves (512 bytes)
213 * . zmm16..zmm31 registers (1024 bytes)
214 *
215 * Likely future extensions that would expand the state beyond
216 * MINSIGSTKSZ:
217 *
218 * - AMX (Advanced Matrix Extensions) and ACE (AI Compute Extensions)
219 * state:
220 * . [AMX/ACE] TILECFG (64 bytes)
221 * . [AMX/ACE] TILEDATA (8192 bytes)
222 * . [ACE] SCALEDATA (128 bytes)
223 *
224 * As a precaution against ABI breakage, x86/identcpu.c will panic at
225 * boot if the XSAVE state size enabled in XCR0 exceeds MINSIGSTKSZ.
226 *
227 * References:
228 *
229 * - Intel 64 and IA-32 Architectures Software Developer's Manual,
230 * Volume 1: Basic Architecture, Intel, Order Number: 253665-092US,
231 * June 2026, Sec. 13.1 `XSAVE-Supported Features and State-Component
232 * Bitmaps', pp. 13-1 -- 13-2.
233 * https://web.archive.org/web/20260709150417/https://cdrdv2-public.intel.com/922477/253665-092-sdm-vol-1.pdf
234 *
235 * - AI Compute Extensions (ACE) Specification, x86 Ecosystem Advisory
236 * Group, Version 1.15, 2026-05-15, Sec 15.4.1 `XSAVE State
237 * Components', p. 86.
238 * https://web.archive.org/web/20260619062626/https://x86ecosystem.org/wp-content/uploads/2026/06/ACE_v1_Specification_public_1_15.pdf
188 */239 */
189#if defined __i386__ || defined XENPV /* XXX XENPV PR kern/59371 */240#if defined __i386__ || defined XENPV /* XXX XENPV PR kern/59371 */
190#define XCR0_FPU (XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \241#define XCR0_FPU (XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \
191 XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM)242 XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM)
192#else243#else
193#define XCR0_FPU (XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \244#define XCR0_FPU (XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \
194 XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM | \245 XCR0_Opmask | XCR0_ZMM_Hi256 | XCR0_Hi16_ZMM)
195 XCR0_TILECFG | XCR0_TILEDATA)246#endif
247
248/*
249 * Maximum size of XSAVE state that we can handle without ABI changes
250 * to userland. Must match usage in cpu_getmcontext. Extra 8 is neeed
251 * on amd64 to have space for return address in 16-byte-aligned stack
252 * frame.
253 */
254#ifdef __x86_64__
255#define XSAVE_MAX_BYTES \
256 (MINSIGSTKSZ - (8 + STACK_ALIGNBYTES + \
257 sizeof(struct sigframe_siginfo) + (XSAVE_ALIGN - 1)))
258#else
259#define XSAVE_MAX_BYTES \
260 (MINSIGSTKSZ - (STACK_ALIGNBYTES + \
261 sizeof(struct sigframe_siginfo) + (XSAVE_ALIGN - 1)))
196#endif262#endif
197263
198/*264/*
lib/libc/include/powerpc-netbsd-eabi/powerpc/oea/pmap.h+6-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: pmap.h,v 1.39 2023/12/15 09:42:33 rin Exp $ */1/* $NetBSD: pmap.h,v 1.39.4.1 2026/07/03 17:51:59 martin Exp $ */
22
3/*-3/*-
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
...@@ -122,11 +122,13 @@ __BEGIN_DECLS...@@ -122,11 +122,13 @@ __BEGIN_DECLS
122#include <sys/systm.h>122#include <sys/systm.h>
123123
124/*124/*
125 * For OEA and OEA64_BRIDGE, we guarantee that pa below USER_ADDR125 * Physical memory below PMAP_DIRECT_MAPPED_LEN is direct-mapped
126 * (== 3GB < VM_MIN_KERNEL_ADDRESS) is direct-mapped.126 * (pa == va). Direct region covers the segments below BOTH
127 * the user copyin window (USER_SR) and the kernel HTAB window
128 * (KERNEL_SR), so it can never overlap.
127 */129 */
128#if defined(PPC_OEA) || defined(PPC_OEA64_BRIDGE)130#if defined(PPC_OEA) || defined(PPC_OEA64_BRIDGE)
129#define PMAP_DIRECT_MAPPED_SR (USER_SR - 1)131#define PMAP_DIRECT_MAPPED_SR (MIN(USER_SR, KERNEL_SR) - 1)
130#define PMAP_DIRECT_MAPPED_LEN \132#define PMAP_DIRECT_MAPPED_LEN \
131 ((vaddr_t)SEGMENT_LENGTH * (PMAP_DIRECT_MAPPED_SR + 1))133 ((vaddr_t)SEGMENT_LENGTH * (PMAP_DIRECT_MAPPED_SR + 1))
132#endif134#endif
lib/libc/include/x86-netbsd-none/machine/mcontext.h+23-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: mcontext.h,v 1.19 2024/11/30 01:04:10 christos Exp $ */1/* $NetBSD: mcontext.h,v 1.19.2.1 2026/07/19 15:57:27 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
...@@ -40,6 +40,7 @@...@@ -40,6 +40,7 @@
40#define _UC_CLRSTACK _UC_MD_BIT1740#define _UC_CLRSTACK _UC_MD_BIT17
41#define _UC_VM _UC_MD_BIT1841#define _UC_VM _UC_MD_BIT18
42#define _UC_TLSBASE _UC_MD_BIT1942#define _UC_TLSBASE _UC_MD_BIT19
43#define _UC_XSAVE _UC_MD_BIT20
4344
44/*45/*
45 * Layout of mcontext_t according to the System V Application Binary Interface,46 * Layout of mcontext_t according to the System V Application Binary Interface,
...@@ -85,6 +86,27 @@ typedef struct {...@@ -85,6 +86,27 @@ typedef struct {
85 char __fp_xmm[512];86 char __fp_xmm[512];
86 } __fp_xmm_state; /* x87 and xmm regs in fxsave format */87 } __fp_xmm_state; /* x87 and xmm regs in fxsave format */
87 int __fp_fpregs[128];88 int __fp_fpregs[128];
89 struct {
90 /*
91 * `The XSAVE feature set does not use bytes
92 * 511:416; bytes 463:416 are reserved.'
93 *
94 * We take a part out of this to form a pointer
95 * to an external XSAVE area. This way, we can
96 * replicate the FXSAVE parts for the benefit
97 * of userland programs that aren't aware of
98 * the XSAVE pointer, have used the extended
99 * CPU registers (ymmN/zmmN/&c.), and want to
100 * examine the x87/SSE register state in a
101 * signal handler. The kernel does not use
102 * this part.
103 */
104 char __fxsave[416];
105 char __rsvd[48];
106 __greg_t __xsaveptr;
107 __greg_t __xsavelen;
108 char __pad[40];
109 } __xsave;
88 } __fp_reg_set;110 } __fp_reg_set;
89 int __fp_pad[33]; /* Historic padding */111 int __fp_pad[33]; /* Historic padding */
90} __fpregset_t;112} __fpregset_t;
lib/libc/include/x86_64-netbsd-none/amd64/mcontext.h+31-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: mcontext.h,v 1.24 2024/11/30 01:04:06 christos Exp $ */1/* $NetBSD: mcontext.h,v 1.24.2.1 2026/07/19 15:57:26 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
...@@ -56,7 +56,28 @@ typedef __greg_t __gregset_t[_NGREG];...@@ -56,7 +56,28 @@ typedef __greg_t __gregset_t[_NGREG];
56 * which requires 16 byte alignment. However the mcontext version56 * which requires 16 byte alignment. However the mcontext version
57 * is never directly accessed.57 * is never directly accessed.
58 */58 */
59typedef char __fpregset_t[512] __aligned(8);59typedef union {
60 char __fxsave[512] __aligned(8);
61 struct {
62 /*
63 * `The XSAVE feature set does not use bytes 511:416;
64 * bytes 463:416 are reserved.'
65 *
66 * We take a part out of this to form a pointer to an
67 * external XSAVE area. This way, we can replicate the
68 * FXSAVE parts for the benefit of userland programs
69 * that aren't aware of the XSAVE pointer, have used
70 * the extended CPU registers (ymmN/zmmN/&c.), and want
71 * to examine the x87/SSE register state in a signal
72 * handler. The kernel does not use this part.
73 */
74 char __fxsave[416];
75 char __rsvd[48];
76 __greg_t __xsaveptr;
77 __greg_t __xsavelen;
78 char __pad[32];
79 } __xsave;
80} __fpregset_t;
6081
61typedef struct {82typedef struct {
62 __gregset_t __gregs;83 __gregset_t __gregs;
...@@ -75,6 +96,7 @@ typedef struct {...@@ -75,6 +96,7 @@ typedef struct {
75#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)96#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
7697
77#define _UC_TLSBASE _UC_MD_BIT1998#define _UC_TLSBASE _UC_MD_BIT19
99#define _UC_XSAVE _UC_MD_BIT20
78100
79/*101/*
80 * mcontext extensions to handle signal delivery.102 * mcontext extensions to handle signal delivery.
...@@ -127,6 +149,13 @@ typedef struct {...@@ -127,6 +149,13 @@ typedef struct {
127 struct {149 struct {
128 char __fp_xmm[512];150 char __fp_xmm[512];
129 } __fp_xmm_state;151 } __fp_xmm_state;
152 struct {
153 char __fxsave[416];
154 char __rsvd[48];
155 __greg32_t __xsaveptr;
156 __greg32_t __xsavelen;
157 char __pad[40];
158 } __xsave;
130 } __fp_reg_set;159 } __fp_reg_set;
131 int __fp_pad[33]; /* Historic padding */160 int __fp_pad[33]; /* Historic padding */
132} __fpregset32_t;161} __fpregset32_t;
lib/libc/include/x86_64-netbsd-none/machine/mcontext.h+31-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $NetBSD: mcontext.h,v 1.24 2024/11/30 01:04:06 christos Exp $ */1/* $NetBSD: mcontext.h,v 1.24.2.1 2026/07/19 15:57:26 martin Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
...@@ -56,7 +56,28 @@ typedef __greg_t __gregset_t[_NGREG];...@@ -56,7 +56,28 @@ typedef __greg_t __gregset_t[_NGREG];
56 * which requires 16 byte alignment. However the mcontext version56 * which requires 16 byte alignment. However the mcontext version
57 * is never directly accessed.57 * is never directly accessed.
58 */58 */
59typedef char __fpregset_t[512] __aligned(8);59typedef union {
60 char __fxsave[512] __aligned(8);
61 struct {
62 /*
63 * `The XSAVE feature set does not use bytes 511:416;
64 * bytes 463:416 are reserved.'
65 *
66 * We take a part out of this to form a pointer to an
67 * external XSAVE area. This way, we can replicate the
68 * FXSAVE parts for the benefit of userland programs
69 * that aren't aware of the XSAVE pointer, have used
70 * the extended CPU registers (ymmN/zmmN/&c.), and want
71 * to examine the x87/SSE register state in a signal
72 * handler. The kernel does not use this part.
73 */
74 char __fxsave[416];
75 char __rsvd[48];
76 __greg_t __xsaveptr;
77 __greg_t __xsavelen;
78 char __pad[32];
79 } __xsave;
80} __fpregset_t;
6081
61typedef struct {82typedef struct {
62 __gregset_t __gregs;83 __gregset_t __gregs;
...@@ -75,6 +96,7 @@ typedef struct {...@@ -75,6 +96,7 @@ typedef struct {
75#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)96#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
7697
77#define _UC_TLSBASE _UC_MD_BIT1998#define _UC_TLSBASE _UC_MD_BIT19
99#define _UC_XSAVE _UC_MD_BIT20
78100
79/*101/*
80 * mcontext extensions to handle signal delivery.102 * mcontext extensions to handle signal delivery.
...@@ -127,6 +149,13 @@ typedef struct {...@@ -127,6 +149,13 @@ typedef struct {
127 struct {149 struct {
128 char __fp_xmm[512];150 char __fp_xmm[512];
129 } __fp_xmm_state;151 } __fp_xmm_state;
152 struct {
153 char __fxsave[416];
154 char __rsvd[48];
155 __greg32_t __xsaveptr;
156 __greg32_t __xsavelen;
157 char __pad[40];
158 } __xsave;
130 } __fp_reg_set;159 } __fp_reg_set;
131 int __fp_pad[33]; /* Historic padding */160 int __fp_pad[33]; /* Historic padding */
132} __fpregset32_t;161} __fpregset32_t;
tools/update_glibc.zig+1
...@@ -36,6 +36,7 @@ const exempt_extensions = [_][]const u8{...@@ -36,6 +36,7 @@ const exempt_extensions = [_][]const u8{
36 // These are the start files we use when targeting glibc <= 2.33.36 // These are the start files we use when targeting glibc <= 2.33.
37 "-2.33.S",37 "-2.33.S",
38 "-2.33.c",38 "-2.33.c",
39 "-2.32.c",
39};40};
4041
41pub fn main(init: std.process.Init) !void {42pub fn main(init: std.process.Init) !void {