authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-21 06:47:10+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-21 06:47:10+02:00
logbf1c847719ebf933517b5b6e10e07087c725a35b
treedce2d0538f2ac7eefb863f2761a347989401016c
parent3b3833acf73aae7d5e84e9e9ae15c9c4f9d5b367
parentc13bf5d7784f61825847bdf65676f1420c7e7e9b

Merge pull request 'OpenBSD 7.9 cross libc support' (#35375) from alexrp/zig:openbsd-7.9 into master

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

119 files changed, 1511 insertions(+), 819 deletions(-)

lib/libc/include/aarch64-openbsd-none/arm64/cpu.h+7-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.51 2025/02/11 22:27:09 kettenis Exp $ */1/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */
2/*2/*
3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
4 *4 *
...@@ -112,6 +112,7 @@ void cpu_identify_cleanup(void);...@@ -112,6 +112,7 @@ void cpu_identify_cleanup(void);
112#include <sys/sched.h>112#include <sys/sched.h>
113#include <sys/srp.h>113#include <sys/srp.h>
114#include <uvm/uvm_percpu.h>114#include <uvm/uvm_percpu.h>
115#include <sys/xcall.h>
115116
116struct cpu_info {117struct cpu_info {
117 struct device *ci_dev; /* Device corresponding to this CPU */118 struct device *ci_dev; /* Device corresponding to this CPU */
...@@ -126,6 +127,7 @@ struct cpu_info {...@@ -126,6 +127,7 @@ struct cpu_info {
126 struct cpu_info *ci_self;127 struct cpu_info *ci_self;
127128
128#define __HAVE_CPU_TOPOLOGY129#define __HAVE_CPU_TOPOLOGY
130 u_int32_t ci_cputype;
129 u_int32_t ci_smt_id;131 u_int32_t ci_smt_id;
130 u_int32_t ci_core_id;132 u_int32_t ci_core_id;
131 u_int32_t ci_pkg_id;133 u_int32_t ci_pkg_id;
...@@ -162,11 +164,14 @@ struct cpu_info {...@@ -162,11 +164,14 @@ struct cpu_info {
162 volatile int ci_opp_max;164 volatile int ci_opp_max;
163 uint32_t ci_cpu_supply;165 uint32_t ci_cpu_supply;
164166
167 uint64_t ci_capacity;
168
165 u_long ci_prev_sleep;169 u_long ci_prev_sleep;
166 u_long ci_last_itime;170 u_long ci_last_itime;
167171
168#ifdef MULTIPROCESSOR172#ifdef MULTIPROCESSOR
169 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];173 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
174 struct xcall_cpu ci_xcall;
170#define __HAVE_UVM_PERCPU175#define __HAVE_UVM_PERCPU
171 struct uvm_pmr_cache ci_uvm;176 struct uvm_pmr_cache ci_uvm;
172 volatile int ci_flags;177 volatile int ci_flags;
...@@ -339,6 +344,7 @@ intr_restore(u_long daif)...@@ -339,6 +344,7 @@ intr_restore(u_long daif)
339 restore_daif(daif);344 restore_daif(daif);
340}345}
341346
347void cpu_classify(void);
342void cpu_halt(void);348void cpu_halt(void);
343int cpu_suspend_primary(void);349int cpu_suspend_primary(void);
344void cpu_resume_secondary(struct cpu_info *);350void cpu_resume_secondary(struct cpu_info *);
lib/libc/include/aarch64-openbsd-none/arm64/intr.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intr.h,v 1.25 2025/06/30 14:19:20 kettenis Exp $ */1/* $OpenBSD: intr.h,v 1.26 2025/12/15 01:39:32 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
...@@ -84,6 +84,8 @@...@@ -84,6 +84,8 @@
84#ifndef _LOCORE84#ifndef _LOCORE
85#include <sys/queue.h>85#include <sys/queue.h>
8686
87#define SOFTINTR_XCALL NSOFTINTR
88
87void softintr(int);89void softintr(int);
8890
89int splraise(int);91int splraise(int);
...@@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int);...@@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int);
199#define ARM_IPI_NOP 0201#define ARM_IPI_NOP 0
200#define ARM_IPI_DDB 1202#define ARM_IPI_DDB 1
201#define ARM_IPI_HALT 2203#define ARM_IPI_HALT 2
204#define ARM_IPI_XCALL 3
205
206/* kern_xcall calls this to dispatch xcalls */
207#define cpu_xcall_ipi(_ci) arm_send_ipi((_ci), ARM_IPI_XCALL)
208/* interrupt controllers call this to get cpu_xcall_dispatch run */
209#define arm_cpu_xcall_dispatch() softintr(SOFTINTR_XCALL)
202210
203#ifdef DIAGNOSTIC211#ifdef DIAGNOSTIC
204/*212/*
lib/libc/include/aarch64-openbsd-none/machine/cpu.h+7-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.51 2025/02/11 22:27:09 kettenis Exp $ */1/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */
2/*2/*
3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
4 *4 *
...@@ -112,6 +112,7 @@ void cpu_identify_cleanup(void);...@@ -112,6 +112,7 @@ void cpu_identify_cleanup(void);
112#include <sys/sched.h>112#include <sys/sched.h>
113#include <sys/srp.h>113#include <sys/srp.h>
114#include <uvm/uvm_percpu.h>114#include <uvm/uvm_percpu.h>
115#include <sys/xcall.h>
115116
116struct cpu_info {117struct cpu_info {
117 struct device *ci_dev; /* Device corresponding to this CPU */118 struct device *ci_dev; /* Device corresponding to this CPU */
...@@ -126,6 +127,7 @@ struct cpu_info {...@@ -126,6 +127,7 @@ struct cpu_info {
126 struct cpu_info *ci_self;127 struct cpu_info *ci_self;
127128
128#define __HAVE_CPU_TOPOLOGY129#define __HAVE_CPU_TOPOLOGY
130 u_int32_t ci_cputype;
129 u_int32_t ci_smt_id;131 u_int32_t ci_smt_id;
130 u_int32_t ci_core_id;132 u_int32_t ci_core_id;
131 u_int32_t ci_pkg_id;133 u_int32_t ci_pkg_id;
...@@ -162,11 +164,14 @@ struct cpu_info {...@@ -162,11 +164,14 @@ struct cpu_info {
162 volatile int ci_opp_max;164 volatile int ci_opp_max;
163 uint32_t ci_cpu_supply;165 uint32_t ci_cpu_supply;
164166
167 uint64_t ci_capacity;
168
165 u_long ci_prev_sleep;169 u_long ci_prev_sleep;
166 u_long ci_last_itime;170 u_long ci_last_itime;
167171
168#ifdef MULTIPROCESSOR172#ifdef MULTIPROCESSOR
169 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];173 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
174 struct xcall_cpu ci_xcall;
170#define __HAVE_UVM_PERCPU175#define __HAVE_UVM_PERCPU
171 struct uvm_pmr_cache ci_uvm;176 struct uvm_pmr_cache ci_uvm;
172 volatile int ci_flags;177 volatile int ci_flags;
...@@ -339,6 +344,7 @@ intr_restore(u_long daif)...@@ -339,6 +344,7 @@ intr_restore(u_long daif)
339 restore_daif(daif);344 restore_daif(daif);
340}345}
341346
347void cpu_classify(void);
342void cpu_halt(void);348void cpu_halt(void);
343int cpu_suspend_primary(void);349int cpu_suspend_primary(void);
344void cpu_resume_secondary(struct cpu_info *);350void cpu_resume_secondary(struct cpu_info *);
lib/libc/include/aarch64-openbsd-none/machine/intr.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intr.h,v 1.25 2025/06/30 14:19:20 kettenis Exp $ */1/* $OpenBSD: intr.h,v 1.26 2025/12/15 01:39:32 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
...@@ -84,6 +84,8 @@...@@ -84,6 +84,8 @@
84#ifndef _LOCORE84#ifndef _LOCORE
85#include <sys/queue.h>85#include <sys/queue.h>
8686
87#define SOFTINTR_XCALL NSOFTINTR
88
87void softintr(int);89void softintr(int);
8890
89int splraise(int);91int splraise(int);
...@@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int);...@@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int);
199#define ARM_IPI_NOP 0201#define ARM_IPI_NOP 0
200#define ARM_IPI_DDB 1202#define ARM_IPI_DDB 1
201#define ARM_IPI_HALT 2203#define ARM_IPI_HALT 2
204#define ARM_IPI_XCALL 3
205
206/* kern_xcall calls this to dispatch xcalls */
207#define cpu_xcall_ipi(_ci) arm_send_ipi((_ci), ARM_IPI_XCALL)
208/* interrupt controllers call this to get cpu_xcall_dispatch run */
209#define arm_cpu_xcall_dispatch() softintr(SOFTINTR_XCALL)
202210
203#ifdef DIAGNOSTIC211#ifdef DIAGNOSTIC
204/*212/*
lib/libc/include/generic-openbsd/db.h+1-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: db.h,v 1.12 2015/10/17 21:48:42 guenther Exp $ */1/* $OpenBSD: db.h,v 1.14 2026/03/10 04:30:34 deraadt Exp $ */
2/* $NetBSD: db.h,v 1.13 1994/10/26 00:55:48 cgd Exp $ */2/* $NetBSD: db.h,v 1.13 1994/10/26 00:55:48 cgd Exp $ */
33
4/*-4/*-
...@@ -84,15 +84,9 @@ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;...@@ -84,15 +84,9 @@ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
84 * is so that the access methods can skip copying the key/data pair when84 * is so that the access methods can skip copying the key/data pair when
85 * the DB_LOCK flag isn't set.85 * the DB_LOCK flag isn't set.
86 */86 */
87#if UINT_MAX > 65535
88#define DB_LOCK 0x20000000 /* Do locking. */87#define DB_LOCK 0x20000000 /* Do locking. */
89#define DB_SHMEM 0x40000000 /* Use shared memory. */88#define DB_SHMEM 0x40000000 /* Use shared memory. */
90#define DB_TXN 0x80000000 /* Do transactions. */89#define DB_TXN 0x80000000 /* Do transactions. */
91#else
92#define DB_LOCK 0x2000 /* Do locking. */
93#define DB_SHMEM 0x4000 /* Use shared memory. */
94#define DB_TXN 0x8000 /* Do transactions. */
95#endif
9690
97/* Access method description structure. */91/* Access method description structure. */
98typedef struct __db {92typedef struct __db {
lib/libc/include/generic-openbsd/ddb/db_interface.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: db_interface.h,v 1.28 2024/09/05 08:52:27 bluhm Exp $ */1/* $OpenBSD: db_interface.h,v 1.29 2026/02/02 15:20:51 claudio Exp $ */
2/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */2/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */
33
4/*4/*
...@@ -41,6 +41,7 @@ vaddr_t db_disasm(vaddr_t, int);...@@ -41,6 +41,7 @@ vaddr_t db_disasm(vaddr_t, int);
4141
42/* kern/kern_proc.c */42/* kern/kern_proc.c */
43void db_kill_cmd(db_expr_t, int, db_expr_t, char *);43void db_kill_cmd(db_expr_t, int, db_expr_t, char *);
44void db_stop_cmd(db_expr_t, int, db_expr_t, char *);
44void db_show_all_procs(db_expr_t, int, db_expr_t, char *);45void db_show_all_procs(db_expr_t, int, db_expr_t, char *);
4546
46/* kern/kern_clockintr.c */47/* kern/kern_clockintr.c */
lib/libc/include/generic-openbsd/fnmatch.h+6-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */1/* $OpenBSD: fnmatch.h,v 1.9 2026/03/29 14:08:46 daniel Exp $ */
2/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */2/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
33
4/*-4/*-
...@@ -43,11 +43,15 @@...@@ -43,11 +43,15 @@
43#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */43#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
44#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */44#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
45#define FNM_PERIOD 0x04 /* Period must be matched by period. */45#define FNM_PERIOD 0x04 /* Period must be matched by period. */
46
46#if __BSD_VISIBLE47#if __BSD_VISIBLE
47#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */48#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
49#define FNM_FILE_NAME FNM_PATHNAME
50#endif
51
52#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405
48#define FNM_CASEFOLD 0x10 /* Case insensitive search. */53#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
49#define FNM_IGNORECASE FNM_CASEFOLD54#define FNM_IGNORECASE FNM_CASEFOLD
50#define FNM_FILE_NAME FNM_PATHNAME
51#endif55#endif
5256
53__BEGIN_DECLS57__BEGIN_DECLS
lib/libc/include/generic-openbsd/login_cap.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: login_cap.h,v 1.19 2022/03/01 01:22:11 tedu Exp $ */1/* $OpenBSD: login_cap.h,v 1.21 2025/11/24 12:37:15 jca Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved.4 * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved.
...@@ -56,6 +56,8 @@...@@ -56,6 +56,8 @@
56#define LOGIN_SETENV 0x0080 /* Set environment */56#define LOGIN_SETENV 0x0080 /* Set environment */
57#define LOGIN_SETRTABLE 0x0100 /* Set rtable */57#define LOGIN_SETRTABLE 0x0100 /* Set rtable */
58#define LOGIN_SETALL 0x01ff /* Set all. */58#define LOGIN_SETALL 0x01ff /* Set all. */
59/* The LOGIN defines below are not part of LOGIN_SETALL */
60#define LOGIN_SETXDGENV 0x0200 /* Set XDG environment variables */
5961
60#define BI_AUTH "authorize" /* Accepted authentication */62#define BI_AUTH "authorize" /* Accepted authentication */
61#define BI_REJECT "reject" /* Rejected authentication */63#define BI_REJECT "reject" /* Rejected authentication */
lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: fusefs_node.h,v 1.5 2024/10/31 13:55:21 claudio Exp $ */1/* $OpenBSD: fusefs_node.h,v 1.6 2026/01/22 11:53:31 helg Exp $ */
2/*2/*
3 * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>3 * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
4 *4 *
...@@ -40,6 +40,7 @@ struct fusefs_node {...@@ -40,6 +40,7 @@ struct fusefs_node {
40 struct fusefs_mnt *i_ump;40 struct fusefs_mnt *i_ump;
41 dev_t i_dev; /* Device associated with the inode. */41 dev_t i_dev; /* Device associated with the inode. */
42 ino_t i_number; /* The identity of the inode. */42 ino_t i_number; /* The identity of the inode. */
43 ino_t i_parent_cache;/* Parent inode (only dirs). */
43 struct lockf_state *i_lockf; /* Byte-level lock state. */44 struct lockf_state *i_lockf; /* Byte-level lock state. */
44 struct rrwlock i_lock; /* Inode lock */45 struct rrwlock i_lock; /* Inode lock */
4546
lib/libc/include/generic-openbsd/net/bpf.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bpf.h,v 1.74 2025/03/04 01:01:25 dlg Exp $ */1/* $OpenBSD: bpf.h,v 1.75 2025/11/16 02:20:08 dlg Exp $ */
2/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */2/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */
33
4/*4/*
...@@ -255,6 +255,8 @@ struct bpf_hdr {...@@ -255,6 +255,8 @@ struct bpf_hdr {
255#define BPF_LSH 0x60255#define BPF_LSH 0x60
256#define BPF_RSH 0x70256#define BPF_RSH 0x70
257#define BPF_NEG 0x80257#define BPF_NEG 0x80
258#define BPF_MOD 0x90
259#define BPF_XOR 0xa0
258#define BPF_JA 0x00260#define BPF_JA 0x00
259#define BPF_JEQ 0x10261#define BPF_JEQ 0x10
260#define BPF_JGT 0x20262#define BPF_JGT 0x20
lib/libc/include/generic-openbsd/net/hfsc.h+4-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: hfsc.h,v 1.14 2025/07/07 00:55:15 jsg Exp $ */1/* $OpenBSD: hfsc.h,v 1.15 2026/03/19 14:59:05 sthen Exp $ */
22
3/*3/*
4 * Copyright (c) 2012-2013 Henning Brauer <henning@openbsd.org>4 * Copyright (c) 2012-2013 Henning Brauer <henning@openbsd.org>
...@@ -45,9 +45,9 @@ struct hfsc_pktcntr {...@@ -45,9 +45,9 @@ struct hfsc_pktcntr {
45 do { (cntr)->packets++; (cntr)->bytes += len; } while (0)45 do { (cntr)->packets++; (cntr)->bytes += len; } while (0)
4646
47struct hfsc_sc {47struct hfsc_sc {
48 u_int m1; /* slope of the first segment in bits/sec */48 u_int64_t m1; /* slope of the first segment in bits/sec */
49 u_int d; /* the x-projection of the first segment in msec */49 u_int64_t m2; /* slope of the second segment in bits/sec */
50 u_int m2; /* slope of the second segment in bits/sec */50 u_int d; /* the x-projection of the first segment in msec */
51};51};
5252
53/* special class handles */53/* special class handles */
lib/libc/include/generic-openbsd/net/if.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if.h,v 1.221 2025/09/09 09:16:18 bluhm Exp $ */1/* $OpenBSD: if.h,v 1.223 2025/12/09 03:33:06 dlg Exp $ */
2/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */2/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
33
4/*4/*
...@@ -526,6 +526,9 @@ struct if_sffpage {...@@ -526,6 +526,9 @@ struct if_sffpage {
526#include <net/if_arp.h>526#include <net/if_arp.h>
527527
528#ifdef _KERNEL528#ifdef _KERNEL
529
530#define IF_MAX_VECTORS 8
531
529struct socket;532struct socket;
530struct ifnet;533struct ifnet;
531struct ifq_ops;534struct ifq_ops;
...@@ -555,6 +558,7 @@ void if_group_routechange(const struct sockaddr *, const struct sockaddr *);...@@ -555,6 +558,7 @@ void if_group_routechange(const struct sockaddr *, const struct sockaddr *);
555struct ifnet *if_unit(const char *);558struct ifnet *if_unit(const char *);
556struct ifnet *if_get(unsigned int);559struct ifnet *if_get(unsigned int);
557struct ifnet *if_ref(struct ifnet *);560struct ifnet *if_ref(struct ifnet *);
561struct ifnet *if_get_smr(unsigned int);
558void if_put(struct ifnet *);562void if_put(struct ifnet *);
559void ifnewlladdr(struct ifnet *);563void ifnewlladdr(struct ifnet *);
560void if_congestion(void);564void if_congestion(void);
lib/libc/include/generic-openbsd/net/if_bridge.h+48-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_bridge.h,v 1.73 2021/11/11 10:03:10 claudio Exp $ */1/* $OpenBSD: if_bridge.h,v 1.77 2025/11/21 04:44:26 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)4 * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
...@@ -39,6 +39,12 @@...@@ -39,6 +39,12 @@
39#include <sys/timeout.h>39#include <sys/timeout.h>
40#include <net/pfvar.h>40#include <net/pfvar.h>
4141
42#define IFBR_PVID_NULL EVL_VLID_NULL
43#define IFBR_PVID_MIN EVL_VLID_MIN
44#define IFBR_PVID_MAX EVL_VLID_MAX
45#define IFBR_PVID_NONE 0xffff
46#define IFBR_PVID_DECLINE 0xfffe
47
42/*48/*
43 * Bridge control request: add/delete member interfaces.49 * Bridge control request: add/delete member interfaces.
44 */50 */
...@@ -51,6 +57,7 @@ struct ifbreq {...@@ -51,6 +57,7 @@ struct ifbreq {
5157
52 u_int8_t ifbr_state; /* member stp state */58 u_int8_t ifbr_state; /* member stp state */
53 u_int8_t ifbr_priority; /* member stp priority */59 u_int8_t ifbr_priority; /* member stp priority */
60 u_int16_t ifbr_pvid; /* member port vlan id */
54 u_int32_t ifbr_path_cost; /* member stp path cost */61 u_int32_t ifbr_path_cost; /* member stp path cost */
55 u_int32_t ifbr_stpflags; /* member stp flags */62 u_int32_t ifbr_stpflags; /* member stp flags */
56 u_int8_t ifbr_proto; /* member stp protocol */63 u_int8_t ifbr_proto; /* member stp protocol */
...@@ -74,6 +81,8 @@ struct ifbreq {...@@ -74,6 +81,8 @@ struct ifbreq {
74#define IFBIF_BSTP_AUTOPTP 0x0080 /* member stp autoptp enabled */81#define IFBIF_BSTP_AUTOPTP 0x0080 /* member stp autoptp enabled */
75#define IFBIF_SPAN 0x0100 /* ifs is a span port (ro) */82#define IFBIF_SPAN 0x0100 /* ifs is a span port (ro) */
76#define IFBIF_LOCAL 0x1000 /* local port in switch(4) */83#define IFBIF_LOCAL 0x1000 /* local port in switch(4) */
84#define IFBIF_LOCKED 0x2000 /* restrict rx src mac with fib */
85#define IFBIF_PVLAN_PTAGS 0x4000 /* only use tags for primary pvlans */
77#define IFBIF_RO_MASK 0x0f00 /* read only bits */86#define IFBIF_RO_MASK 0x0f00 /* read only bits */
7887
79/* SIOCBRDGFLUSH */88/* SIOCBRDGFLUSH */
...@@ -133,15 +142,19 @@ struct ifbareq {...@@ -133,15 +142,19 @@ struct ifbareq {
133#define IFBAF_DYNAMIC 0x00 /* dynamically learned */142#define IFBAF_DYNAMIC 0x00 /* dynamically learned */
134#define IFBAF_STATIC 0x01 /* static address */143#define IFBAF_STATIC 0x01 /* static address */
135144
145struct ifbvareq;
146
136struct ifbaconf {147struct ifbaconf {
137 char ifbac_name[IFNAMSIZ]; /* bridge ifs name */148 char ifbac_name[IFNAMSIZ]; /* bridge ifs name */
138 u_int32_t ifbac_len; /* buffer size */149 u_int32_t ifbac_len; /* buffer size */
139 union {150 union {
140 caddr_t ifbacu_buf; /* buffer */151 caddr_t ifbacu_buf; /* buffer */
141 struct ifbareq *ifbacu_req; /* request pointer */152 struct ifbareq *ifbacu_req; /* request pointer */
153 struct ifbvareq *ifbacu_vreq; /* request pointer */
142 } ifbac_ifbacu;154 } ifbac_ifbacu;
143#define ifbac_buf ifbac_ifbacu.ifbacu_buf155#define ifbac_buf ifbac_ifbacu.ifbacu_buf
144#define ifbac_req ifbac_ifbacu.ifbacu_req156#define ifbac_req ifbac_ifbacu.ifbacu_req
157#define ifbac_vreq ifbac_ifbacu.ifbacu_vreq
145};158};
146159
147struct ifbrparam {160struct ifbrparam {
...@@ -237,6 +250,40 @@ struct ifbrlconf {...@@ -237,6 +250,40 @@ struct ifbrlconf {
237#define ifbrl_req ifbrl_ifbrlu.ifbrlu_req250#define ifbrl_req ifbrl_ifbrlu.ifbrlu_req
238};251};
239252
253struct ifbvareq {
254 char ifbva_name[IFNAMSIZ]; /* bridge name */
255 char ifbva_ifsname[IFNAMSIZ]; /* destination ifs */
256 time_t ifbva_created; /* monotime */
257 time_t ifbva_used; /* monotime */
258 unsigned int ifbva_flags; /* address flags */
259 uint16_t ifbva_vid; /* vlan */
260 struct ether_addr ifbva_dst; /* destination addr */
261 struct sockaddr_storage ifbva_dstsa; /* tunnel endpoint */
262};
263
264struct ifbrvidmap {
265 char ifbrvm_name[IFNAMSIZ];
266 char ifbrvm_ifsname[IFNAMSIZ];
267 unsigned int ifbrvm_op;
268#define IFBRVM_OP_SET 0x0 /* kernel = ifbrvm_map */
269#define IFBRVM_OP_OR 0x1 /* kernel |= ifbrvm_map */
270#define IFBRVM_OP_ANDNOT 0x2 /* kernel &= ~ifbrvm_map */
271 unsigned int ifbrvm_gen;
272 uint8_t ifbrvm_map[512];
273};
274
275struct ifbrpvlan {
276 char ifbrpv_name[IFNAMSIZ];
277 uint16_t ifbrpv_primary;
278 uint16_t ifbrpv_secondary;
279 unsigned int ifbrpv_type;
280#define IFBRPV_T_PRIMARY 0
281#define IFBRPV_T_SECONDARY 1 /* for searching */
282#define IFBRPV_T_ISOLATED 2
283#define IFBRPV_T_COMMUNITY 3
284 unsigned int ifbrpv_gen;
285};
286
240#ifdef _KERNEL287#ifdef _KERNEL
241288
242#include <sys/mutex.h>289#include <sys/mutex.h>
lib/libc/include/generic-openbsd/net/if_etherbridge.h+20-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_etherbridge.h,v 1.5 2024/11/04 00:13:15 jsg Exp $ */1/* $OpenBSD: if_etherbridge.h,v 1.7 2025/11/21 04:44:26 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2018, 2021 David Gwynne <dlg@openbsd.org>4 * Copyright (c) 2018, 2021 David Gwynne <dlg@openbsd.org>
...@@ -44,16 +44,21 @@ struct eb_entry {...@@ -44,16 +44,21 @@ struct eb_entry {
4444
45 uint64_t ebe_addr;45 uint64_t ebe_addr;
46 void *ebe_port;46 void *ebe_port;
47 uint16_t ebe_vs; /* secondary vid */
47 unsigned int ebe_type;48 unsigned int ebe_type;
48#define EBE_DYNAMIC 0x049#define EBE_DYNAMIC 0x0
49#define EBE_STATIC 0x150#define EBE_STATIC 0x1
50#define EBE_DEAD 0xdead51#define EBE_DEAD 0xdead
52 time_t ebe_created;
51 time_t ebe_age;53 time_t ebe_age;
5254
53 struct etherbridge *ebe_etherbridge;55 struct etherbridge *ebe_etherbridge;
54 struct smr_entry ebe_smr_entry;56 struct smr_entry ebe_smr_entry;
55};57};
5658
59#define etherbridge_port(_ebe) ((_ebe)->ebe_port)
60#define etherbridge_vs(_ebe) ((_ebe)->ebe_vs)
61
57SMR_TAILQ_HEAD(eb_list, eb_entry);62SMR_TAILQ_HEAD(eb_list, eb_entry);
58RBT_HEAD(eb_tree, eb_entry);63RBT_HEAD(eb_tree, eb_entry);
59TAILQ_HEAD(eb_queue, eb_entry);64TAILQ_HEAD(eb_queue, eb_entry);
...@@ -80,13 +85,19 @@ int etherbridge_up(struct etherbridge *);...@@ -80,13 +85,19 @@ int etherbridge_up(struct etherbridge *);
80int etherbridge_down(struct etherbridge *);85int etherbridge_down(struct etherbridge *);
81void etherbridge_destroy(struct etherbridge *);86void etherbridge_destroy(struct etherbridge *);
8287
83void etherbridge_map(struct etherbridge *, void *, uint64_t);88void etherbridge_map(struct etherbridge *, void *,
89 uint16_t, uint16_t, uint64_t);
84void etherbridge_map_ea(struct etherbridge *, void *,90void etherbridge_map_ea(struct etherbridge *, void *,
85 const struct ether_addr *);91 uint16_t, uint16_t, const struct ether_addr *);
86void *etherbridge_resolve(struct etherbridge *, uint64_t);92struct eb_entry *
93 etherbridge_resolve_entry(struct etherbridge *,
94 uint16_t, uint64_t);
95void *etherbridge_resolve(struct etherbridge *, uint16_t, uint64_t);
87void *etherbridge_resolve_ea(struct etherbridge *,96void *etherbridge_resolve_ea(struct etherbridge *,
88 const struct ether_addr *);97 uint16_t, const struct ether_addr *);
89void etherbridge_detach_port(struct etherbridge *, void *);98void etherbridge_detach_port(struct etherbridge *, void *);
99void etherbridge_filter(struct etherbridge *,
100 int (*)(struct etherbridge *, struct eb_entry *, void *), void *);
90101
91/* ioctl support */102/* ioctl support */
92int etherbridge_set_max(struct etherbridge *, struct ifbrparam *);103int etherbridge_set_max(struct etherbridge *, struct ifbrparam *);
...@@ -94,9 +105,11 @@ int etherbridge_get_max(struct etherbridge *, struct ifbrparam *);...@@ -94,9 +105,11 @@ int etherbridge_get_max(struct etherbridge *, struct ifbrparam *);
94int etherbridge_set_tmo(struct etherbridge *, struct ifbrparam *);105int etherbridge_set_tmo(struct etherbridge *, struct ifbrparam *);
95int etherbridge_get_tmo(struct etherbridge *, struct ifbrparam *);106int etherbridge_get_tmo(struct etherbridge *, struct ifbrparam *);
96int etherbridge_rtfind(struct etherbridge *, struct ifbaconf *);107int etherbridge_rtfind(struct etherbridge *, struct ifbaconf *);
108int etherbridge_vareq(struct etherbridge *, struct ifbaconf *);
97int etherbridge_add_addr(struct etherbridge *, void *,109int etherbridge_add_addr(struct etherbridge *, void *,
98 const struct ether_addr *, unsigned int);110 uint16_t, uint16_t, const struct ether_addr *, unsigned int);
99int etherbridge_del_addr(struct etherbridge *, const struct ether_addr *);111int etherbridge_del_addr(struct etherbridge *,
112 uint16_t, const struct ether_addr *);
100void etherbridge_flush(struct etherbridge *, uint32_t);113void etherbridge_flush(struct etherbridge *, uint32_t);
101114
102#endif /* _NET_ETHERBRIDGE_H_ */115#endif /* _NET_ETHERBRIDGE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/net/if_media.h+26-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_media.h,v 1.46 2025/06/13 00:08:16 jsg Exp $ */1/* $OpenBSD: if_media.h,v 1.47 2026/03/19 16:50:32 chris Exp $ */
2/* $NetBSD: if_media.h,v 1.22 2000/02/17 21:53:16 sommerfeld Exp $ */2/* $NetBSD: if_media.h,v 1.22 2000/02/17 21:53:16 sommerfeld Exp $ */
33
4/*-4/*-
...@@ -327,6 +327,18 @@ uint64_t ifmedia_baudrate(uint64_t);...@@ -327,6 +327,18 @@ uint64_t ifmedia_baudrate(uint64_t);
327#define IFM_IEEE80211_VHT_MCS7 103 /* 11ac MCS 7 */327#define IFM_IEEE80211_VHT_MCS7 103 /* 11ac MCS 7 */
328#define IFM_IEEE80211_VHT_MCS8 104 /* 11ac MCS 8 */328#define IFM_IEEE80211_VHT_MCS8 104 /* 11ac MCS 8 */
329#define IFM_IEEE80211_VHT_MCS9 105 /* 11ac MCS 9 */329#define IFM_IEEE80211_VHT_MCS9 105 /* 11ac MCS 9 */
330#define IFM_IEEE80211_HE_MCS0 106 /* 11ax MCS 0 */
331#define IFM_IEEE80211_HE_MCS1 107 /* 11ax MCS 1 */
332#define IFM_IEEE80211_HE_MCS2 108 /* 11ax MCS 2 */
333#define IFM_IEEE80211_HE_MCS3 109 /* 11ax MCS 3 */
334#define IFM_IEEE80211_HE_MCS4 110 /* 11ax MCS 4 */
335#define IFM_IEEE80211_HE_MCS5 111 /* 11ax MCS 5 */
336#define IFM_IEEE80211_HE_MCS6 112 /* 11ax MCS 6 */
337#define IFM_IEEE80211_HE_MCS7 113 /* 11ax MCS 7 */
338#define IFM_IEEE80211_HE_MCS8 114 /* 11ax MCS 8 */
339#define IFM_IEEE80211_HE_MCS9 115 /* 11ax MCS 9 */
340#define IFM_IEEE80211_HE_MCS10 116 /* 11ax MCS 10 */
341#define IFM_IEEE80211_HE_MCS11 117 /* 11ax MCS 11 */
330342
331#define IFM_IEEE80211_ADHOC 0x0000000000010000ULL /* Operate in Adhoc mode */343#define IFM_IEEE80211_ADHOC 0x0000000000010000ULL /* Operate in Adhoc mode */
332#define IFM_IEEE80211_HOSTAP 0x0000000000020000ULL /* Operate in Host AP mode */344#define IFM_IEEE80211_HOSTAP 0x0000000000020000ULL /* Operate in Host AP mode */
...@@ -341,6 +353,7 @@ uint64_t ifmedia_baudrate(uint64_t);...@@ -341,6 +353,7 @@ uint64_t ifmedia_baudrate(uint64_t);
341#define IFM_IEEE80211_FH 0x0000000400000000ULL /* 2GHz, GFSK mode */353#define IFM_IEEE80211_FH 0x0000000400000000ULL /* 2GHz, GFSK mode */
342#define IFM_IEEE80211_11N 0x0000000800000000ULL /* 11n/HT 2GHz/5GHz */354#define IFM_IEEE80211_11N 0x0000000800000000ULL /* 11n/HT 2GHz/5GHz */
343#define IFM_IEEE80211_11AC 0x0000001000000000ULL /* 11ac/VHT 5GHz */355#define IFM_IEEE80211_11AC 0x0000001000000000ULL /* 11ac/VHT 5GHz */
356#define IFM_IEEE80211_11AX 0x0000002000000000ULL /* 11ax/HE 2GHz/5GHz */
344357
345/*358/*
346 * Digitally multiplexed "Carrier" Serial Interfaces359 * Digitally multiplexed "Carrier" Serial Interfaces
...@@ -721,6 +734,18 @@ struct ifmedia_description {...@@ -721,6 +734,18 @@ struct ifmedia_description {
721 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS7, "VHT-MCS7" }, \734 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS7, "VHT-MCS7" }, \
722 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS8, "VHT-MCS8" }, \735 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS8, "VHT-MCS8" }, \
723 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS9, "VHT-MCS9" }, \736 { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS9, "VHT-MCS9" }, \
737 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS0, "HE-MCS0" }, \
738 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS1, "HE-MCS1" }, \
739 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS2, "HE-MCS2" }, \
740 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS3, "HE-MCS3" }, \
741 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS4, "HE-MCS4" }, \
742 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS5, "HE-MCS5" }, \
743 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS6, "HE-MCS6" }, \
744 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS7, "HE-MCS7" }, \
745 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS8, "HE-MCS8" }, \
746 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS9, "HE-MCS9" }, \
747 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS10, "HE-MCS10" }, \
748 { IFM_IEEE80211|IFM_IEEE80211_HE_MCS11, "HE-MCS11" }, \
724 \749 \
725 { IFM_TDM|IFM_TDM_T1, "t1" }, \750 { IFM_TDM|IFM_TDM_T1, "t1" }, \
726 { IFM_TDM|IFM_TDM_T1_AMI, "t1-ami" }, \751 { IFM_TDM|IFM_TDM_T1_AMI, "t1-ami" }, \
lib/libc/include/generic-openbsd/net/if_pflow.h+71-20
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_pflow.h,v 1.23 2023/12/16 22:16:02 mvs Exp $ */1/* $OpenBSD: if_pflow.h,v 1.24 2025/11/13 17:12:30 chris Exp $ */
22
3/*3/*
4 * Copyright (c) 2008 Henning Brauer <henning@openbsd.org>4 * Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
...@@ -33,22 +33,26 @@...@@ -33,22 +33,26 @@
3333
34/* RFC 5102 Information Element Identifiers */34/* RFC 5102 Information Element Identifiers */
3535
36#define PFIX_IE_octetDeltaCount 136#define PFIX_IE_octetDeltaCount 1
37#define PFIX_IE_packetDeltaCount 237#define PFIX_IE_packetDeltaCount 2
38#define PFIX_IE_protocolIdentifier 438#define PFIX_IE_protocolIdentifier 4
39#define PFIX_IE_ipClassOfService 539#define PFIX_IE_ipClassOfService 5
40#define PFIX_IE_sourceTransportPort 740#define PFIX_IE_sourceTransportPort 7
41#define PFIX_IE_sourceIPv4Address 841#define PFIX_IE_sourceIPv4Address 8
42#define PFIX_IE_ingressInterface 1042#define PFIX_IE_ingressInterface 10
43#define PFIX_IE_destinationTransportPort 1143#define PFIX_IE_destinationTransportPort 11
44#define PFIX_IE_destinationIPv4Address 1244#define PFIX_IE_destinationIPv4Address 12
45#define PFIX_IE_egressInterface 1445#define PFIX_IE_egressInterface 14
46#define PFIX_IE_flowEndSysUpTime 2146#define PFIX_IE_flowEndSysUpTime 21
47#define PFIX_IE_flowStartSysUpTime 2247#define PFIX_IE_flowStartSysUpTime 22
48#define PFIX_IE_sourceIPv6Address 2748#define PFIX_IE_sourceIPv6Address 27
49#define PFIX_IE_destinationIPv6Address 2849#define PFIX_IE_destinationIPv6Address 28
50#define PFIX_IE_flowStartMilliseconds 15250#define PFIX_IE_flowStartMilliseconds 152
51#define PFIX_IE_flowEndMilliseconds 15351#define PFIX_IE_flowEndMilliseconds 153
52#define PFIX_IE_postNATSourceIPv4Address 225
53#define PFIX_IE_postNATDestinationIPv4Address 226
54#define PFIX_IE_postNAPTSourceTransportPort 227
55#define PFIX_IE_postNAPTDestinationTransportPort 228
5256
53struct pflow_flow {57struct pflow_flow {
54 u_int32_t src_ip;58 u_int32_t src_ip;
...@@ -110,6 +114,28 @@ struct pflow_ipfix_tmpl_ipv4 {...@@ -110,6 +114,28 @@ struct pflow_ipfix_tmpl_ipv4 {
110#define PFLOW_IPFIX_TMPL_IPV4_ID 256114#define PFLOW_IPFIX_TMPL_IPV4_ID 256
111} __packed;115} __packed;
112116
117struct pflow_ipfix_tmpl_nat_ipv4 {
118 struct pflow_tmpl_hdr h;
119 struct pflow_tmpl_fspec src_ip;
120 struct pflow_tmpl_fspec dest_ip;
121 struct pflow_tmpl_fspec if_index_in;
122 struct pflow_tmpl_fspec if_index_out;
123 struct pflow_tmpl_fspec packets;
124 struct pflow_tmpl_fspec octets;
125 struct pflow_tmpl_fspec start;
126 struct pflow_tmpl_fspec finish;
127 struct pflow_tmpl_fspec post_src_ip;
128 struct pflow_tmpl_fspec post_dest_ip;
129 struct pflow_tmpl_fspec post_src_port;
130 struct pflow_tmpl_fspec post_dest_port;
131 struct pflow_tmpl_fspec src_port;
132 struct pflow_tmpl_fspec dest_port;
133 struct pflow_tmpl_fspec tos;
134 struct pflow_tmpl_fspec protocol;
135#define PFLOW_IPFIX_TMPL_NAT_IPV4_FIELD_COUNT 16
136#define PFLOW_IPFIX_TMPL_NAT_IPV4_ID 257
137} __packed;
138
113/* update pflow_clone_create() when changing pflow_ipfix_tmpl_v6 */139/* update pflow_clone_create() when changing pflow_ipfix_tmpl_v6 */
114struct pflow_ipfix_tmpl_ipv6 {140struct pflow_ipfix_tmpl_ipv6 {
115 struct pflow_tmpl_hdr h;141 struct pflow_tmpl_hdr h;
...@@ -126,13 +152,14 @@ struct pflow_ipfix_tmpl_ipv6 {...@@ -126,13 +152,14 @@ struct pflow_ipfix_tmpl_ipv6 {
126 struct pflow_tmpl_fspec tos;152 struct pflow_tmpl_fspec tos;
127 struct pflow_tmpl_fspec protocol;153 struct pflow_tmpl_fspec protocol;
128#define PFLOW_IPFIX_TMPL_IPV6_FIELD_COUNT 12154#define PFLOW_IPFIX_TMPL_IPV6_FIELD_COUNT 12
129#define PFLOW_IPFIX_TMPL_IPV6_ID 257155#define PFLOW_IPFIX_TMPL_IPV6_ID 258
130} __packed;156} __packed;
131157
132struct pflow_ipfix_tmpl {158struct pflow_ipfix_tmpl {
133 struct pflow_set_header set_header;159 struct pflow_set_header set_header;
134 struct pflow_ipfix_tmpl_ipv4 ipv4_tmpl;160 struct pflow_ipfix_tmpl_ipv4 ipv4_tmpl;
135 struct pflow_ipfix_tmpl_ipv6 ipv6_tmpl;161 struct pflow_ipfix_tmpl_nat_ipv4 ipv4_nat_tmpl;
162 struct pflow_ipfix_tmpl_ipv6 ipv6_tmpl;
136} __packed;163} __packed;
137164
138struct pflow_ipfix_flow4 {165struct pflow_ipfix_flow4 {
...@@ -151,6 +178,26 @@ struct pflow_ipfix_flow4 {...@@ -151,6 +178,26 @@ struct pflow_ipfix_flow4 {
151 /* XXX padding needed? */178 /* XXX padding needed? */
152} __packed;179} __packed;
153180
181struct pflow_ipfix_nat_flow4 {
182 u_int32_t src_ip; /* sourceIPv4Address*/
183 u_int32_t dest_ip; /* destinationIPv4Address */
184 u_int32_t if_index_in; /* ingressInterface */
185 u_int32_t if_index_out; /* egressInterface */
186 u_int64_t flow_packets; /* packetDeltaCount */
187 u_int64_t flow_octets; /* octetDeltaCount */
188 int64_t flow_start; /* flowStartMilliseconds */
189 int64_t flow_finish; /* flowEndMilliseconds */
190 u_int32_t post_src_ip; /* postNATSourceIPv4Address */
191 u_int32_t post_dest_ip; /* postNATDestinationIPv4Address */
192 u_int16_t post_src_port; /* postNAPTSourceTransportPort */
193 u_int16_t post_dest_port; /* postNAPTDestinationTransportPort */
194 u_int16_t src_port; /* sourceTransportPort */
195 u_int16_t dest_port; /* destinationTransportPort */
196 u_int8_t tos; /* ipClassOfService */
197 u_int8_t protocol; /* protocolIdentifier */
198 /* XXX padding needed? */
199} __packed;
200
154struct pflow_ipfix_flow6 {201struct pflow_ipfix_flow6 {
155 struct in6_addr src_ip; /* sourceIPv6Address */202 struct in6_addr src_ip; /* sourceIPv6Address */
156 struct in6_addr dest_ip; /* destinationIPv6Address */203 struct in6_addr dest_ip; /* destinationIPv6Address */
...@@ -187,6 +234,7 @@ struct pflow_softc {...@@ -187,6 +234,7 @@ struct pflow_softc {
187234
188 unsigned int sc_count; /* [m] */235 unsigned int sc_count; /* [m] */
189 unsigned int sc_count4; /* [m] */236 unsigned int sc_count4; /* [m] */
237 unsigned int sc_count4_nat; /* [m] */
190 unsigned int sc_count6; /* [m] */238 unsigned int sc_count6; /* [m] */
191 unsigned int sc_maxcount; /* [m] */239 unsigned int sc_maxcount; /* [m] */
192 unsigned int sc_maxcount4; /* [m] */240 unsigned int sc_maxcount4; /* [m] */
...@@ -196,6 +244,7 @@ struct pflow_softc {...@@ -196,6 +244,7 @@ struct pflow_softc {
196 struct timeout sc_tmo;244 struct timeout sc_tmo;
197 struct timeout sc_tmo6;245 struct timeout sc_tmo6;
198 struct timeout sc_tmo_tmpl;246 struct timeout sc_tmo_tmpl;
247 struct timeout sc_tmo_nat;
199 struct mbuf_queue sc_outputqueue;248 struct mbuf_queue sc_outputqueue;
200 struct task sc_outputtask;249 struct task sc_outputtask;
201 struct socket *so; /* [p] */250 struct socket *so; /* [p] */
...@@ -208,6 +257,8 @@ struct pflow_softc {...@@ -208,6 +257,8 @@ struct pflow_softc {
208 mbuf */257 mbuf */
209 struct mbuf *sc_mbuf6; /* [m] current cumulative258 struct mbuf *sc_mbuf6; /* [m] current cumulative
210 mbuf */259 mbuf */
260 struct mbuf *sc_mbuf_nat; /* [m] current cumulative
261 mbuf */
211 SMR_SLIST_ENTRY(pflow_softc) sc_next;262 SMR_SLIST_ENTRY(pflow_softc) sc_next;
212};263};
213264
lib/libc/include/generic-openbsd/net/if_pfsync.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_pfsync.h,v 1.65 2025/07/07 00:55:15 jsg Exp $ */1/* $OpenBSD: if_pfsync.h,v 1.66 2026/04/12 03:16:04 deraadt Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Michael Shalayeff4 * Copyright (c) 2001 Michael Shalayeff
...@@ -112,7 +112,7 @@ struct pfsync_header {...@@ -112,7 +112,7 @@ struct pfsync_header {
112 u_int8_t version;112 u_int8_t version;
113 u_int8_t _pad;113 u_int8_t _pad;
114 u_int16_t len; /* in bytes */114 u_int16_t len; /* in bytes */
115 u_int8_t pfcksum[PF_MD5_DIGEST_LENGTH];115 u_int8_t spare[16];
116} __packed;116} __packed;
117117
118/*118/*
lib/libc/include/generic-openbsd/net/if_sppp.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_sppp.h,v 1.31 2025/01/15 06:15:44 dlg Exp $ */1/* $OpenBSD: if_sppp.h,v 1.32 2025/11/02 08:04:04 dlg Exp $ */
2/* $NetBSD: if_sppp.h,v 1.2.2.1 1999/04/04 06:57:39 explorer Exp $ */2/* $NetBSD: if_sppp.h,v 1.2.2.1 1999/04/04 06:57:39 explorer Exp $ */
33
4/*4/*
...@@ -174,6 +174,7 @@ struct sppp {...@@ -174,6 +174,7 @@ struct sppp {
174 time_t pp_last_receive; /* peer's last "sign of life" */174 time_t pp_last_receive; /* peer's last "sign of life" */
175 time_t pp_last_activity; /* second of last payload data s/r */175 time_t pp_last_activity; /* second of last payload data s/r */
176 enum ppp_phase pp_phase; /* phase we're currently in */176 enum ppp_phase pp_phase; /* phase we're currently in */
177 struct task pp_autodial;
177 int state[IDX_COUNT]; /* state machine */178 int state[IDX_COUNT]; /* state machine */
178 u_char confid[IDX_COUNT]; /* id of last configuration request */179 u_char confid[IDX_COUNT]; /* id of last configuration request */
179 int rst_counter[IDX_COUNT]; /* restart counter */180 int rst_counter[IDX_COUNT]; /* restart counter */
lib/libc/include/generic-openbsd/net/if_trunk.h+3-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_trunk.h,v 1.32 2025/03/02 21:28:32 bluhm Exp $ */1/* $OpenBSD: if_trunk.h,v 1.33 2025/11/24 23:40:00 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>4 * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
...@@ -159,6 +159,8 @@ struct trunk_softc;...@@ -159,6 +159,8 @@ struct trunk_softc;
159struct trunk_port {159struct trunk_port {
160 struct ifnet *tp_if; /* physical interface */160 struct ifnet *tp_if; /* physical interface */
161 struct trunk_softc *tp_trunk; /* parent trunk */161 struct trunk_softc *tp_trunk; /* parent trunk */
162 struct refcnt tp_refs;
163 struct ether_port tp_ether_port;
162 u_int8_t tp_lladdr[ETHER_ADDR_LEN];164 u_int8_t tp_lladdr[ETHER_ADDR_LEN];
163 caddr_t tp_psc; /* protocol data */165 caddr_t tp_psc; /* protocol data */
164166
...@@ -172,7 +174,6 @@ struct trunk_port {...@@ -172,7 +174,6 @@ struct trunk_port {
172 int (*tp_ioctl)(struct ifnet *, u_long, caddr_t);174 int (*tp_ioctl)(struct ifnet *, u_long, caddr_t);
173 int (*tp_output)(struct ifnet *, struct mbuf *, struct sockaddr *,175 int (*tp_output)(struct ifnet *, struct mbuf *, struct sockaddr *,
174 struct rtentry *);176 struct rtentry *);
175 void (*tp_input)(struct ifnet *, struct mbuf *, struct netstack *);
176177
177 SLIST_ENTRY(trunk_port) tp_entries;178 SLIST_ENTRY(trunk_port) tp_entries;
178};179};
lib/libc/include/generic-openbsd/net/if_types.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_types.h,v 1.24 2022/01/02 22:36:04 jsg Exp $ */1/* $OpenBSD: if_types.h,v 1.25 2026/03/23 08:42:22 jsg Exp $ */
2/* $NetBSD: if_types.h,v 1.17 2000/10/26 06:51:31 onoe Exp $ */2/* $NetBSD: if_types.h,v 1.17 2000/10/26 06:51:31 onoe Exp $ */
33
4/*4/*
...@@ -175,7 +175,7 @@...@@ -175,7 +175,7 @@
175#define IFT_A12MPPSWITCH 0x82 /* Avalon Parallel Processor */175#define IFT_A12MPPSWITCH 0x82 /* Avalon Parallel Processor */
176#define IFT_TUNNEL 0x83 /* Encapsulation interface */176#define IFT_TUNNEL 0x83 /* Encapsulation interface */
177#define IFT_COFFEE 0x84 /* coffee pot */177#define IFT_COFFEE 0x84 /* coffee pot */
178#define IFT_CES 0x85 /* Circiut Emulation Service */178#define IFT_CES 0x85 /* Circuit Emulation Service */
179#define IFT_ATMSUBINTERFACE 0x86 /* (x) ATM Sub Interface */179#define IFT_ATMSUBINTERFACE 0x86 /* (x) ATM Sub Interface */
180#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */180#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */
181#define IFT_L3IPVLAN 0x88 /* Layer 3 Virtual LAN - IP Protocol */181#define IFT_L3IPVLAN 0x88 /* Layer 3 Virtual LAN - IP Protocol */
lib/libc/include/generic-openbsd/net/if_var.h+34-12
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_var.h,v 1.139 2025/07/19 16:40:40 mvs Exp $ */1/* $OpenBSD: if_var.h,v 1.148 2026/03/22 23:14:00 bluhm Exp $ */
2/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */2/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
33
4/*4/*
...@@ -40,7 +40,7 @@...@@ -40,7 +40,7 @@
4040
41#include <sys/queue.h>41#include <sys/queue.h>
42#include <sys/mbuf.h>42#include <sys/mbuf.h>
43#include <sys/srp.h>43#include <sys/smr.h>
44#include <sys/refcnt.h>44#include <sys/refcnt.h>
45#include <sys/task.h>45#include <sys/task.h>
46#include <sys/timeout.h>46#include <sys/timeout.h>
...@@ -81,6 +81,7 @@...@@ -81,6 +81,7 @@
81 * K kernel lock81 * K kernel lock
82 * N net lock82 * N net lock
83 * T if_tmplist_lock83 * T if_tmplist_lock
84 * m interface multicast rwlock if_maddrlock
84 *85 *
85 * For SRP related structures that allow lock-free reads, the write lock86 * For SRP related structures that allow lock-free reads, the write lock
86 * is indicated below.87 * is indicated below.
...@@ -92,9 +93,12 @@ struct task;...@@ -92,9 +93,12 @@ struct task;
92struct cpumem;93struct cpumem;
9394
94struct netstack {95struct netstack {
95 struct route ns_route;96 struct mbuf_list ns_input;
96 struct mbuf_list ns_tcp_ml;97 struct mbuf_list ns_proto;
97 struct mbuf_list ns_tcp6_ml;98
99 struct route ns_route;
100 struct mbuf_list ns_tcp_ml;
101 struct mbuf_list ns_tcp6_ml;
98};102};
99103
100/*104/*
...@@ -141,6 +145,8 @@ enum if_counters {...@@ -141,6 +145,8 @@ enum if_counters {
141 * (Would like to call this struct ``if'', but C isn't PL/1.)145 * (Would like to call this struct ``if'', but C isn't PL/1.)
142 */146 */
143TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */147TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */
148struct carp_softc;
149SMR_LIST_HEAD(carp_iflist, carp_softc);
144150
145struct ifnet { /* and the entries */151struct ifnet { /* and the entries */
146 void *if_softc; /* [I] lower-level data for this if */152 void *if_softc; /* [I] lower-level data for this if */
...@@ -148,8 +154,9 @@ struct ifnet { /* and the entries */...@@ -148,8 +154,9 @@ struct ifnet { /* and the entries */
148 TAILQ_ENTRY(ifnet) if_list; /* [NK] all struct ifnets are chained */154 TAILQ_ENTRY(ifnet) if_list; /* [NK] all struct ifnets are chained */
149 TAILQ_ENTRY(ifnet) if_tmplist; /* [T] temporary list */155 TAILQ_ENTRY(ifnet) if_tmplist; /* [T] temporary list */
150 TAILQ_HEAD(, ifaddr) if_addrlist; /* [N] list of addresses per if */156 TAILQ_HEAD(, ifaddr) if_addrlist; /* [N] list of addresses per if */
151 TAILQ_HEAD(, ifmaddr) if_maddrlist; /* [N] list of multicast records */157 TAILQ_HEAD(, ifmaddr) if_maddrlist; /* [m] list of multicast records */
152 TAILQ_HEAD(, ifg_list) if_groups; /* [N] list of groups per if */158 TAILQ_HEAD(, ifg_list) if_groups; /* [N] list of groups per if */
159 struct rwlock if_maddrlock;
153 struct task_list if_addrhooks; /* [I] address change callbacks */160 struct task_list if_addrhooks; /* [I] address change callbacks */
154 struct task_list if_linkstatehooks; /* [I] link change callbacks*/161 struct task_list if_linkstatehooks; /* [I] link change callbacks*/
155 struct task_list if_detachhooks; /* [I] detach callbacks */162 struct task_list if_detachhooks; /* [I] detach callbacks */
...@@ -163,9 +170,11 @@ struct ifnet { /* and the entries */...@@ -163,9 +170,11 @@ struct ifnet { /* and the entries */
163 caddr_t if_mcast6; /* used by IPv6 multicast code */170 caddr_t if_mcast6; /* used by IPv6 multicast code */
164 caddr_t if_pf_kif; /* pf interface abstraction */171 caddr_t if_pf_kif; /* pf interface abstraction */
165 union {172 union {
166 struct srpl carp_s; /* carp if list (used by !carp ifs) */173 /* carp if list (used by IFT_ETHER) */
167 unsigned int carp_idx; /* index of carpdev (used by carp174 struct carp_iflist carp_s;
168 ifs) */175
176 /* index of carpdev (used by IFT_CARP) */
177 unsigned int carp_idx;
169 } if_carp_ptr;178 } if_carp_ptr;
170#define if_carp if_carp_ptr.carp_s179#define if_carp if_carp_ptr.carp_s
171#define if_carpdevidx if_carp_ptr.carp_idx180#define if_carpdevidx if_carp_ptr.carp_idx
...@@ -254,6 +263,7 @@ struct ifaddr {...@@ -254,6 +263,7 @@ struct ifaddr {
254 struct ifnet *ifa_ifp; /* back-pointer to interface */263 struct ifnet *ifa_ifp; /* back-pointer to interface */
255 TAILQ_ENTRY(ifaddr) ifa_list; /* [N] list of addresses for264 TAILQ_ENTRY(ifaddr) ifa_list; /* [N] list of addresses for
256 interface */265 interface */
266 TAILQ_ENTRY(ifaddr) ifa_tmplist;/* [T] temporary list */
257 u_int ifa_flags; /* interface flags, see below */267 u_int ifa_flags; /* interface flags, see below */
258 struct refcnt ifa_refcnt; /* number of `rt_ifa` references */268 struct refcnt ifa_refcnt; /* number of `rt_ifa` references */
259 int ifa_metric; /* cost of going out this interface */269 int ifa_metric; /* cost of going out this interface */
...@@ -265,10 +275,10 @@ struct ifaddr {...@@ -265,10 +275,10 @@ struct ifaddr {
265 * Interface multicast address.275 * Interface multicast address.
266 */276 */
267struct ifmaddr {277struct ifmaddr {
268 struct sockaddr *ifma_addr; /* Protocol address */278 TAILQ_ENTRY(ifmaddr) ifma_list; /* [m] Per-interface list */
269 unsigned int ifma_ifidx; /* Index of the interface */279 struct sockaddr *ifma_addr; /* [I] Protocol address */
270 struct refcnt ifma_refcnt; /* Count of references */280 struct refcnt ifma_refcnt; /* Count of references */
271 TAILQ_ENTRY(ifmaddr) ifma_list; /* Per-interface list */281 unsigned int ifma_ifidx; /* [I] Index of the interface */
272};282};
273283
274/*284/*
...@@ -337,6 +347,9 @@ int if_enqueue_ifq(struct ifnet *, struct mbuf *);...@@ -337,6 +347,9 @@ int if_enqueue_ifq(struct ifnet *, struct mbuf *);
337void if_input(struct ifnet *, struct mbuf_list *);347void if_input(struct ifnet *, struct mbuf_list *);
338void if_vinput(struct ifnet *, struct mbuf *, struct netstack *);348void if_vinput(struct ifnet *, struct mbuf *, struct netstack *);
339void if_input_process(struct ifnet *, struct mbuf_list *, unsigned int);349void if_input_process(struct ifnet *, struct mbuf_list *, unsigned int);
350void if_input_proto(struct ifnet *, struct mbuf *,
351 void (*)(struct ifnet *, struct mbuf *, struct netstack *),
352 struct netstack *);
340int if_input_local(struct ifnet *, struct mbuf *, sa_family_t,353int if_input_local(struct ifnet *, struct mbuf *, sa_family_t,
341 struct netstack *);354 struct netstack *);
342int if_output_ml(struct ifnet *, struct mbuf_list *,355int if_output_ml(struct ifnet *, struct mbuf_list *,
...@@ -351,6 +364,15 @@ void p2p_rtrequest(struct ifnet *, int, struct rtentry *);...@@ -351,6 +364,15 @@ void p2p_rtrequest(struct ifnet *, int, struct rtentry *);
351void p2p_input(struct ifnet *, struct mbuf *, struct netstack *);364void p2p_input(struct ifnet *, struct mbuf *, struct netstack *);
352int p2p_bpf_mtap(caddr_t, const struct mbuf *, u_int);365int p2p_bpf_mtap(caddr_t, const struct mbuf *, u_int);
353366
367/* this is a helper for if_input_process and similar functions */
368static inline void
369if_input_process_proto(struct ifnet *ifp, struct mbuf *m, struct netstack *ns)
370{
371 void (*input)(struct ifnet *, struct mbuf *, struct netstack *);
372 input = m->m_pkthdr.ph_cookie;
373 (*input)(ifp, m, ns);
374}
375
354struct ifaddr *ifa_ifwithaddr(const struct sockaddr *, u_int);376struct ifaddr *ifa_ifwithaddr(const struct sockaddr *, u_int);
355struct ifaddr *ifa_ifwithdstaddr(const struct sockaddr *, u_int);377struct ifaddr *ifa_ifwithdstaddr(const struct sockaddr *, u_int);
356struct ifaddr *ifaof_ifpforaddr(const struct sockaddr *, struct ifnet *);378struct ifaddr *ifaof_ifpforaddr(const struct sockaddr *, struct ifnet *);
lib/libc/include/generic-openbsd/net/netisr.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: netisr.h,v 1.61 2023/07/06 04:55:05 dlg Exp $ */1/* $OpenBSD: netisr.h,v 1.62 2025/10/30 17:30:46 mvs Exp $ */
2/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */2/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */
33
4/*4/*
...@@ -44,7 +44,6 @@...@@ -44,7 +44,6 @@
44#define NETISR_IP 2 /* same as AF_INET */44#define NETISR_IP 2 /* same as AF_INET */
45#define NETISR_ARP 18 /* same as AF_LINK */45#define NETISR_ARP 18 /* same as AF_LINK */
46#define NETISR_IPV6 24 /* same as AF_INET6 */46#define NETISR_IPV6 24 /* same as AF_INET6 */
47#define NETISR_PIPEX 27 /* for pipex processing */
48#define NETISR_PPP 28 /* for PPP processing */47#define NETISR_PPP 28 /* for PPP processing */
49#define NETISR_BRIDGE 29 /* for bridge processing */48#define NETISR_BRIDGE 29 /* for bridge processing */
50#define NETISR_PPPOE 30 /* for pppoe processing */49#define NETISR_PPPOE 30 /* for pppoe processing */
...@@ -63,7 +62,6 @@ void ipintr(void);...@@ -63,7 +62,6 @@ void ipintr(void);
63void ip6intr(void);62void ip6intr(void);
64void pppintr(void);63void pppintr(void);
65void bridgeintr(void);64void bridgeintr(void);
66void pipexintr(void);
67void pppoeintr(void);65void pppoeintr(void);
6866
69#define schednetisr(anisr) \67#define schednetisr(anisr) \
lib/libc/include/generic-openbsd/net/pfvar.h+154-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pfvar.h,v 1.543 2025/04/14 20:02:34 sf Exp $ */1/* $OpenBSD: pfvar.h,v 1.548 2026/02/05 03:26:00 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Daniel Hartmeier4 * Copyright (c) 2001 Daniel Hartmeier
...@@ -479,6 +479,13 @@ union pf_rule_ptr {...@@ -479,6 +479,13 @@ union pf_rule_ptr {
479#define PF_ANCHOR_HIWAT 512479#define PF_ANCHOR_HIWAT 512
480#define PF_OPTIMIZER_TABLE_PFX "__automatic_"480#define PF_OPTIMIZER_TABLE_PFX "__automatic_"
481481
482enum {
483 PF_LIMITER_NOMATCH,
484 PF_LIMITER_BLOCK
485};
486
487#define PF_LIMITER_DEFAULT PF_LIMITER_BLOCK
488
482struct pf_rule {489struct pf_rule {
483 struct pf_rule_addr src;490 struct pf_rule_addr src;
484 struct pf_rule_addr dst;491 struct pf_rule_addr dst;
...@@ -591,6 +598,14 @@ struct pf_rule {...@@ -591,6 +598,14 @@ struct pf_rule {
591 u_int8_t set_prio[2];598 u_int8_t set_prio[2];
592 sa_family_t naf;599 sa_family_t naf;
593 u_int8_t rcvifnot;600 u_int8_t rcvifnot;
601 struct {
602 u_int8_t id;
603 int limiter_action;
604 } statelim;
605 struct {
606 u_int8_t id;
607 int limiter_action;
608 } sourcelim;
594609
595 struct {610 struct {
596 struct pf_addr addr;611 struct pf_addr addr;
...@@ -1502,6 +1517,133 @@ struct pfioc_synflwats {...@@ -1502,6 +1517,133 @@ struct pfioc_synflwats {
1502 u_int32_t lowat;1517 u_int32_t lowat;
1503};1518};
15041519
1520#define PF_STATELIM_NAME_LEN 16 /* kstat istr */
1521#define PF_STATELIM_DESCR_LEN 64
1522
1523struct pfioc_statelim {
1524 u_int32_t ticket;
1525
1526 char name[PF_STATELIM_NAME_LEN];
1527 uint32_t id;
1528#define PF_STATELIM_ID_NONE 0
1529#define PF_STATELIM_ID_MIN 1
1530#define PF_STATELIM_ID_MAX 255 /* fits in pf_state uint8_t */
1531
1532 /* limit on the total number of states */
1533 unsigned int limit;
1534#define PF_STATELIM_LIMIT_MIN 1
1535#define PF_STATELIM_LIMIT_MAX (1 << 24) /* pf is pretty scalable */
1536
1537 /* rate limit on the creation of states */
1538 struct {
1539 unsigned int limit;
1540 unsigned int seconds;
1541 } rate;
1542
1543 char description[PF_STATELIM_DESCR_LEN];
1544
1545 /* kernel state for GET ioctls */
1546 unsigned int inuse; /* gauge */
1547 uint64_t admitted; /* counter */
1548 uint64_t hardlimited; /* counter */
1549 uint64_t ratelimited; /* counter */
1550};
1551
1552#define PF_SOURCELIM_NAME_LEN 16 /* kstat istr */
1553#define PF_SOURCELIM_DESCR_LEN 64
1554
1555struct pfioc_sourcelim {
1556 u_int32_t ticket;
1557
1558 char name[PF_SOURCELIM_NAME_LEN];
1559 uint32_t id;
1560#define PF_SOURCELIM_ID_NONE 0
1561#define PF_SOURCELIM_ID_MIN 1
1562#define PF_SOURCELIM_ID_MAX 255 /* fits in pf_state uint8_t */
1563
1564 /* limit on the total number of address entries */
1565 unsigned int entries;
1566
1567 /* limit on the number of states per address entry */
1568 unsigned int limit;
1569
1570 /* rate limit on the creation of states by an address entry */
1571 struct {
1572 unsigned int limit;
1573 unsigned int seconds;
1574 } rate;
1575
1576 /*
1577 * when the number of states on an entry exceeds hwm, add
1578 * the address to the specified table. when the number of
1579 * states goes below lwm, remove it from the table.
1580 */
1581 char overload_tblname[PF_TABLE_NAME_SIZE];
1582 unsigned int overload_hwm;
1583 unsigned int overload_lwm;
1584
1585 /*
1586 * mask addresses before they're used for entries. /64s
1587 * everywhere for inet6 makes it easy to use too much memory.
1588 */
1589 unsigned int inet_prefix;
1590 unsigned int inet6_prefix;
1591
1592 char description[PF_SOURCELIM_DESCR_LEN];
1593
1594 /* kernel state for GET ioctls */
1595 unsigned int nentries; /* gauge */
1596 unsigned int inuse; /* gauge */
1597
1598 uint64_t addrallocs; /* counter */
1599 uint64_t addrnomem; /* counter */
1600 uint64_t admitted; /* counter */
1601 uint64_t addrlimited; /* counter */
1602 uint64_t hardlimited; /* counter */
1603 uint64_t ratelimited; /* counter */
1604};
1605
1606struct pfioc_source_entry {
1607 sa_family_t af;
1608 unsigned int rdomain;
1609 struct pf_addr addr;
1610
1611 /* stats */
1612
1613 unsigned int inuse; /* gauge */
1614 uint64_t admitted; /* counter */
1615 uint64_t hardlimited; /* counter */
1616 uint64_t ratelimited; /* counter */
1617};
1618
1619struct pfioc_source {
1620 char name[PF_SOURCELIM_NAME_LEN];
1621 uint32_t id;
1622
1623 /* copied from the parent source limiter */
1624
1625 unsigned int inet_prefix;
1626 unsigned int inet6_prefix;
1627 unsigned int limit;
1628
1629 /* source entries */
1630 size_t entry_size; /* sizeof(struct pfioc_source_entry) */
1631
1632 struct pfioc_source_entry *key;
1633 struct pfioc_source_entry *entries;
1634 size_t entrieslen; /* bytes */
1635};
1636
1637struct pfioc_source_kill {
1638 char name[PF_SOURCELIM_NAME_LEN];
1639 uint32_t id;
1640 unsigned int rdomain;
1641 sa_family_t af;
1642 struct pf_addr addr;
1643
1644 unsigned int rmstates; /* kill the states too? */
1645};
1646
1505/*1647/*
1506 * ioctl operations1648 * ioctl operations
1507 */1649 */
...@@ -1570,6 +1712,15 @@ struct pfioc_synflwats {...@@ -1570,6 +1712,15 @@ struct pfioc_synflwats {
1570#define DIOCSETSYNCOOKIES _IOWR('D', 98, u_int8_t)1712#define DIOCSETSYNCOOKIES _IOWR('D', 98, u_int8_t)
1571#define DIOCGETSYNFLWATS _IOWR('D', 99, struct pfioc_synflwats)1713#define DIOCGETSYNFLWATS _IOWR('D', 99, struct pfioc_synflwats)
1572#define DIOCXEND _IOWR('D', 100, u_int32_t)1714#define DIOCXEND _IOWR('D', 100, u_int32_t)
1715#define DIOCADDSTATELIM _IOW('D', 101, struct pfioc_statelim)
1716#define DIOCADDSOURCELIM _IOW('D', 102, struct pfioc_sourcelim)
1717#define DIOCGETSTATELIM _IOWR('D', 103, struct pfioc_statelim)
1718#define DIOCGETSOURCELIM _IOWR('D', 104, struct pfioc_sourcelim)
1719#define DIOCGETSOURCE _IOWR('D', 105, struct pfioc_source)
1720#define DIOCGETNSTATELIM _IOWR('D', 106, struct pfioc_statelim)
1721#define DIOCGETNSOURCELIM _IOWR('D', 107, struct pfioc_sourcelim)
1722#define DIOCGETNSOURCE _IOWR('D', 108, struct pfioc_source)
1723#define DIOCCLRSOURCE _IOWR('D', 109, struct pfioc_source_kill)
15731724
1574#ifdef _KERNEL1725#ifdef _KERNEL
15751726
...@@ -1723,6 +1874,8 @@ int pfr_clr_tstats(struct pfr_table *, int, int *, int);...@@ -1723,6 +1874,8 @@ int pfr_clr_tstats(struct pfr_table *, int, int *, int);
1723int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int);1874int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int);
1724int pfr_clr_addrs(struct pfr_table *, int *, int);1875int pfr_clr_addrs(struct pfr_table *, int *, int);
1725int pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, time_t);1876int pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, time_t);
1877int pfr_remove_kentry(struct pfr_ktable *, struct pfr_addr *);
1878
1726int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *,1879int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
1727 int);1880 int);
1728int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *,1881int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
lib/libc/include/generic-openbsd/net/pfvar_priv.h+256-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pfvar_priv.h,v 1.38 2024/09/07 22:41:55 aisha Exp $ */1/* $OpenBSD: pfvar_priv.h,v 1.42 2026/02/05 03:26:00 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Daniel Hartmeier4 * Copyright (c) 2001 Daniel Hartmeier
...@@ -39,6 +39,7 @@...@@ -39,6 +39,7 @@
3939
40#include <sys/rwlock.h>40#include <sys/rwlock.h>
41#include <sys/mutex.h>41#include <sys/mutex.h>
42#include <sys/pclock.h>
42#include <sys/percpu.h>43#include <sys/percpu.h>
4344
44/*45/*
...@@ -47,6 +48,45 @@...@@ -47,6 +48,45 @@
47 */48 */
4849
49struct pfsync_deferral;50struct pfsync_deferral;
51struct kstat;
52
53/*
54 * PF state links
55 *
56 * This is used to augment a struct pf_state so it can be
57 * tracked/referenced by the state and source address limiter things.
58 * Each limiter maintains a list of the states they "own", and these
59 * state links are what the limiters use to wire a state into their
60 * lists.
61 *
62 * Without PF state links, the pf_state struct would have to grow
63 * a lot to support a feature that may not be used.
64 *
65 * pfl_entry is used by the pools to add states to their list.
66 * pfl_state allows the pools to get from their list of states to
67 * the states themselves.
68 *
69 * pfl_link allows operations on states (well, delete) to be able
70 * to quickly locate the pf_state_link struct so they can be unwired
71 * from the pools.
72 */
73
74#define PF_STATE_LINK_TYPE_STATELIM 1
75#define PF_STATE_LINK_TYPE_SOURCELIM 2
76
77struct pf_state_link {
78 /* used by source/state pools to get to states */
79 TAILQ_ENTRY(pf_state_link) pfl_link;
80
81 /* used by pf_state to get to source/state pools */
82 SLIST_ENTRY(pf_state_link) pfl_linkage;
83
84 struct pf_state *pfl_state;
85 unsigned int pfl_type;
86};
87
88TAILQ_HEAD(pf_state_link_list, pf_state_link);
89SLIST_HEAD(pf_state_linkage, pf_state_link);
5090
51/*91/*
52 * pf state items - links from pf_state_key to pf_states92 * pf state items - links from pf_state_key to pf_states
...@@ -144,6 +184,9 @@ struct pf_state {...@@ -144,6 +184,9 @@ struct pf_state {
144 u_int16_t if_index_out; /* [I] */184 u_int16_t if_index_out; /* [I] */
145 u_int16_t delay; /* [I] */185 u_int16_t delay; /* [I] */
146 u_int8_t rt; /* [I] */186 u_int8_t rt; /* [I] */
187 uint8_t statelim;
188 uint8_t sourcelim;
189 struct pf_state_linkage linkage;
147};190};
148191
149RBT_HEAD(pf_state_tree_id, pf_state);192RBT_HEAD(pf_state_tree_id, pf_state);
...@@ -256,6 +299,214 @@ struct pf_state_list {...@@ -256,6 +299,214 @@ struct pf_state_list {
256 .pfs_rwl = RWLOCK_INITIALIZER("pfstates"), \299 .pfs_rwl = RWLOCK_INITIALIZER("pfstates"), \
257}300}
258301
302/*
303 * State limiter
304 */
305
306struct pf_statelim {
307 RBT_ENTRY(pf_statelim) pfstlim_id_tree;
308 RBT_ENTRY(pf_statelim) pfstlim_nm_tree;
309 TAILQ_ENTRY(pf_statelim) pfstlim_list;
310 struct kstat *pfstlim_ks;
311
312 uint32_t pfstlim_id;
313 char pfstlim_nm[PF_STATELIM_NAME_LEN];
314
315 /* config */
316
317 unsigned int pfstlim_limit;
318 struct {
319 unsigned int limit;
320 unsigned int seconds;
321 } pfstlim_rate;
322
323 /* run state */
324 struct pc_lock pfstlim_lock;
325
326 /* rate limiter */
327 uint64_t pfstlim_rate_ts;
328 uint64_t pfstlim_rate_token;
329 uint64_t pfstlim_rate_bucket;
330
331 unsigned int pfstlim_inuse;
332 struct pf_state_link_list pfstlim_states;
333
334 /* counters */
335
336 struct {
337 uint64_t admitted;
338 uint64_t hardlimited;
339 uint64_t ratelimited;
340 } pfstlim_counters;
341
342 struct {
343 time_t created;
344 time_t updated;
345 time_t cleared;
346 } pfstlim_timestamps;
347};
348
349RBT_HEAD(pf_statelim_id_tree, pf_statelim);
350RBT_PROTOTYPE(pf_statelim_id_tree, pf_statelim, pfstlim_id_tree, cmp);
351
352RBT_HEAD(pf_statelim_nm_tree, pf_statelim);
353RBT_PROTOTYPE(pf_statelim_nm_tree, pf_statelim, pfstlim_nm_tree, cmp);
354
355TAILQ_HEAD(pf_statelim_list, pf_statelim);
356
357extern struct pf_statelim_id_tree pf_statelim_id_tree_active;
358extern struct pf_statelim_list pf_statelim_list_active;
359
360extern struct pf_statelim_id_tree pf_statelim_id_tree_inactive;
361extern struct pf_statelim_nm_tree pf_statelim_nm_tree_inactive;
362extern struct pf_statelim_list pf_statelim_list_inactive;
363
364static inline unsigned int
365pf_statelim_enter(struct pf_statelim *pfstlim)
366{
367 return (pc_sprod_enter(&pfstlim->pfstlim_lock));
368}
369
370static inline void
371pf_statelim_leave(struct pf_statelim *pfstlim, unsigned int gen)
372{
373 pc_sprod_leave(&pfstlim->pfstlim_lock, gen);
374}
375
376/*
377 * Source address pools
378 */
379
380struct pf_sourcelim;
381
382struct pf_source {
383 RBT_ENTRY(pf_source) pfsr_tree;
384 RBT_ENTRY(pf_source) pfsr_ioc_tree;
385 struct pf_sourcelim *pfsr_parent;
386
387 sa_family_t pfsr_af;
388 u_int16_t pfsr_rdomain;
389 struct pf_addr pfsr_addr;
390
391 /* run state */
392
393 unsigned int pfsr_inuse;
394 unsigned int pfsr_intable;
395 struct pf_state_link_list pfsr_states;
396 time_t pfsr_empty_ts;
397 TAILQ_ENTRY(pf_source) pfsr_empty_gc;
398
399 /* rate limiter */
400 uint64_t pfsr_rate_ts;
401
402 struct {
403 uint64_t admitted;
404 uint64_t hardlimited;
405 uint64_t ratelimited;
406 } pfsr_counters;
407};
408
409RBT_HEAD(pf_source_tree, pf_source);
410RBT_PROTOTYPE(pf_source_tree, pf_source, pfsr_tree, cmp);
411
412RBT_HEAD(pf_source_ioc_tree, pf_source);
413RBT_PROTOTYPE(pf_source_ioc_tree, pf_source, pfsr_ioc_tree, cmp);
414
415TAILQ_HEAD(pf_source_list, pf_source);
416
417struct pf_sourcelim {
418 RBT_ENTRY(pf_sourcelim) pfsrlim_id_tree;
419 RBT_ENTRY(pf_sourcelim) pfsrlim_nm_tree;
420 TAILQ_ENTRY(pf_sourcelim) pfsrlim_list;
421 struct kstat *pfsrlim_ks;
422
423 uint32_t pfsrlim_id;
424 char pfsrlim_nm[PF_SOURCELIM_NAME_LEN];
425 unsigned int pfsrlim_disabled;
426
427 /* config */
428
429 unsigned int pfsrlim_entries;
430 unsigned int pfsrlim_limit;
431 unsigned int pfsrlim_ipv4_prefix;
432 unsigned int pfsrlim_ipv6_prefix;
433
434 struct {
435 unsigned int limit;
436 unsigned int seconds;
437 } pfsrlim_rate;
438
439 struct {
440 char name[PF_TABLE_NAME_SIZE];
441 unsigned int hwm;
442 unsigned int lwm;
443 struct pfr_ktable *table;
444 } pfsrlim_overload;
445
446 /* run state */
447 struct pc_lock pfsrlim_lock;
448
449 struct pf_addr pfsrlim_ipv4_mask;
450 struct pf_addr pfsrlim_ipv6_mask;
451
452 uint64_t pfsrlim_rate_token;
453 uint64_t pfsrlim_rate_bucket;
454
455 /* number of pf_sources */
456 unsigned int pfsrlim_nsources;
457 struct pf_source_tree pfsrlim_sources;
458 struct pf_source_ioc_tree pfsrlim_ioc_sources;
459
460 struct {
461 /* number of times pf_source was allocated */
462 uint64_t addrallocs;
463 /* state was rejected because the address limit was hit */
464 uint64_t addrlimited;
465 /* no memory to create address thing */
466 uint64_t addrnomem;
467
468 /* sum of pf_source inuse gauges */
469 uint64_t inuse;
470 /* sum of pf_source admitted counters */
471 uint64_t admitted;
472 /* sum of pf_source hardlimited counters */
473 uint64_t hardlimited;
474 /* sum of pf_source ratelimited counters */
475 uint64_t ratelimited;
476 } pfsrlim_counters;
477};
478
479RBT_HEAD(pf_sourcelim_id_tree, pf_sourcelim);
480RBT_PROTOTYPE(pf_sourcelim_id_tree, pf_sourcelim, pfsrlim_id_tree, cmp);
481
482RBT_HEAD(pf_sourcelim_nm_tree, pf_sourcelim);
483RBT_PROTOTYPE(pf_sourcelim_nm_tree, pf_sourcelim, pfsrlim_nm_tree, cmp);
484
485TAILQ_HEAD(pf_sourcelim_list, pf_sourcelim);
486
487extern struct pf_sourcelim_id_tree pf_sourcelim_id_tree_active;
488extern struct pf_sourcelim_list pf_sourcelim_list_active;
489
490extern struct pf_sourcelim_id_tree pf_sourcelim_id_tree_inactive;
491extern struct pf_sourcelim_nm_tree pf_sourcelim_nm_tree_inactive;
492extern struct pf_sourcelim_list pf_sourcelim_list_inactive;
493
494static inline unsigned int
495pf_sourcelim_enter(struct pf_sourcelim *pfsrlim)
496{
497 return (pc_sprod_enter(&pfsrlim->pfsrlim_lock));
498}
499
500static inline void
501pf_sourcelim_leave(struct pf_sourcelim *pfsrlim, unsigned int gen)
502{
503 pc_sprod_leave(&pfsrlim->pfsrlim_lock, gen);
504}
505
506/*
507 * pf internals
508 */
509
259extern struct rwlock pf_lock;510extern struct rwlock pf_lock;
260511
261struct pf_pdesc {512struct pf_pdesc {
...@@ -429,6 +680,10 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t,...@@ -429,6 +680,10 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t,
429 const struct pf_addr *, const struct pf_addr *,680 const struct pf_addr *, const struct pf_addr *,
430 uint16_t, uint16_t);681 uint16_t, uint16_t);
431682
683void pf_status_init(void);
684void pf_status_clear(void);
685void pf_status_read(struct pf_status *);
686
432#endif /* _KERNEL */687#endif /* _KERNEL */
433688
434#endif /* _NET_PFVAR_PRIV_H_ */689#endif /* _NET_PFVAR_PRIV_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/net80211/ieee80211.h+76-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211.h,v 1.64 2025/08/04 11:39:50 stsp Exp $ */1/* $OpenBSD: ieee80211.h,v 1.66 2026/03/29 21:16:21 kirill Exp $ */
2/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */2/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
33
4/*-4/*-
...@@ -454,9 +454,16 @@ enum {...@@ -454,9 +454,16 @@ enum {
454 IEEE80211_ELEMID_QUIET_CHNL = 198, /* 11ac */454 IEEE80211_ELEMID_QUIET_CHNL = 198, /* 11ac */
455 IEEE80211_ELEMID_OPMODE_NOTIF = 199, /* 11ac */455 IEEE80211_ELEMID_OPMODE_NOTIF = 199, /* 11ac */
456 /* 200-220 reserved */456 /* 200-220 reserved */
457 IEEE80211_ELEMID_VENDOR = 221 /* vendor private */457 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */
458 /* 222-255 reserved */458 /* 222-254 reserved */
459 IEEE80211_ELEMID_EXTENSION = 255 /* Extension */
459};460};
461/*
462 * Extension element IDs
463 * Used with IEEE80211_ELEMID_EXTENSION (255)
464 */
465#define IEEE80211_ELEMID_EXT_HECAPS 35 /* 11ax HE Capabilities */
466#define IEEE80211_ELEMID_EXT_HEOP 36 /* 11ax HE Operation */
460467
461/*468/*
462 * Action field category values (see 802.11-2012 8.4.1.11 Table 8-38).469 * Action field category values (see 802.11-2012 8.4.1.11 Table 8-38).
...@@ -518,6 +525,7 @@ enum {...@@ -518,6 +525,7 @@ enum {
518525
519#define IEEE80211_HT_NUM_MCS 77526#define IEEE80211_HT_NUM_MCS 77
520#define IEEE80211_VHT_NUM_MCS 10527#define IEEE80211_VHT_NUM_MCS 10
528#define IEEE80211_HE_NUM_MCS 12
521529
522/*530/*
523 * BlockAck/BlockAckReq Control field (see 802.11-2012 8.3.1.9 Figure 8-25).531 * BlockAck/BlockAckReq Control field (see 802.11-2012 8.3.1.9 Figure 8-25).
...@@ -712,7 +720,8 @@ enum {...@@ -712,7 +720,8 @@ enum {
712#define IEEE80211_HTOP1_NONGF_STA 0x0004720#define IEEE80211_HTOP1_NONGF_STA 0x0004
713/* Bit 3 is reserved. */721/* Bit 3 is reserved. */
714#define IEEE80211_HTOP1_OBSS_NONHT_STA 0x0010722#define IEEE80211_HTOP1_OBSS_NONHT_STA 0x0010
715/* Bits 5-15 are reserved. */723#define IEEE80211_HTOP1_CCFS2_SHIFT 5
724#define IEEE80211_HTOP1_CCFS2_MASK 0x1fe0
716/* Bytes 4-5. */725/* Bytes 4-5. */
717/* Bits 0-5 are reserved. */726/* Bits 0-5 are reserved. */
718#define IEEE80211_HTOP2_DUALBEACON 0x0040727#define IEEE80211_HTOP2_DUALBEACON 0x0040
...@@ -768,6 +777,8 @@ enum {...@@ -768,6 +777,8 @@ enum {
768#define IEEE80211_VHTCAP_LINK_ADAPT_MRQ_MFB 3777#define IEEE80211_VHTCAP_LINK_ADAPT_MRQ_MFB 3
769#define IEEE80211_VHTCAP_RX_ANT_PATTERN 0x10000000778#define IEEE80211_VHTCAP_RX_ANT_PATTERN 0x10000000
770#define IEEE80211_VHTCAP_TX_ANT_PATTERN 0x20000000779#define IEEE80211_VHTCAP_TX_ANT_PATTERN 0x20000000
780#define IEEE80211_VHTCAP_EXT_NSS_BW_SHIFT 30
781#define IEEE80211_VHTCAP_EXT_NSS_BW_MASK 0xc0000000
771782
772/*783/*
773 * VHT-MCS and NSS map (see 802.11ac-2013 8.4.2.160.3, Figure 8-401bs).784 * VHT-MCS and NSS map (see 802.11ac-2013 8.4.2.160.3, Figure 8-401bs).
...@@ -784,6 +795,7 @@ enum {...@@ -784,6 +795,7 @@ enum {
784795
785#define IEEE80211_VHT_MAX_LGI_MBIT_S_MASK 0x1fff796#define IEEE80211_VHT_MAX_LGI_MBIT_S_MASK 0x1fff
786#define IEEE80211_VHT_MAX_LGI_MBIT_S_SHIFT 0797#define IEEE80211_VHT_MAX_LGI_MBIT_S_SHIFT 0
798#define IEEE80211_VHT_EXT_NSS_BW_CAPABLE (1 << 13)
787799
788/* The highest number of spatial streams supported by VHT. */800/* The highest number of spatial streams supported by VHT. */
789#define IEEE80211_VHT_NUM_SS 8801#define IEEE80211_VHT_NUM_SS 8
...@@ -801,6 +813,66 @@ enum {...@@ -801,6 +813,66 @@ enum {
801/* Byte 1 contains channel center frequency index 0 for 80, 80+80, 160 MHz. */813/* Byte 1 contains channel center frequency index 0 for 80, 80+80, 160 MHz. */
802/* Byte 2 contains channel center frequency index 1 for 80+80 MHz only. */814/* Byte 2 contains channel center frequency index 1 for 80+80 MHz only. */
803815
816
817/*
818 * 802.11ax (HE) definitions.
819 */
820
821/* HE Capabilities element fixed fields */
822#define IEEE80211_HE_MAC_CAPS_LEN 6
823#define IEEE80211_HE_PHY_CAPS_LEN 11
824#define IEEE80211_HE_CAPS_FIXED_LEN (IEEE80211_HE_MAC_CAPS_LEN + \
825 IEEE80211_HE_PHY_CAPS_LEN)
826
827/* HE Tx/Rx MCS NSS Support field size for 80 MHz */
828#define IEEE80211_HE_MCS_NSS_80_LEN 4
829
830/* Minimum length of the HE Capabilities element body (includes Ext ID) */
831#define IEEE80211_HE_CAPS_MINLEN (1 + IEEE80211_HE_CAPS_FIXED_LEN + \
832 IEEE80211_HE_MCS_NSS_80_LEN)
833
834/*
835 * Selected HE PHY capability bits (phy_cap_info[0])
836 * These are used to determine the presence of additional MCS/NSS maps.
837 */
838#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_IN_2G 0x02
839#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_80_IN_5G 0x04
840#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G 0x08
841#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G 0x10
842
843/*
844 * Size of the HE Tx/Rx MCS NSS Support field, in bytes, for a given
845 * HE PHY capabilities byte 0.
846 */
847#define IEEE80211_HE_MCS_NSS_SIZE(_phycap0) (IEEE80211_HE_MCS_NSS_80_LEN + \
848 ((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G) ? 4 : 0)) + \
849 ((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G) ? 4 : 0)))
850
851/*
852 * HE MCS and NSS map (HE-MCS/NSS set)
853 *
854 * Set of HE MCS supported for a given number of spatial streams, `n'.
855 * Used by the HE capabilities IE and by the basic HE MCS set in
856 * the HE operation IE.
857 */
858#define IEEE80211_HE_MCS_FOR_SS_MASK(n) (0x3 << (2 * ((n) - 1)))
859#define IEEE80211_HE_MCS_FOR_SS_SHIFT(n) (2 * ((n) - 1))
860#define IEEE80211_HE_MCS_0_7 0
861#define IEEE80211_HE_MCS_0_9 1
862#define IEEE80211_HE_MCS_0_11 2
863#define IEEE80211_HE_MCS_SS_NOT_SUPP 3
864
865/* The highest number of spatial streams supported by HE */
866#define IEEE80211_HE_NUM_SS 8
867
868/*
869 * HE Operation element fixed fields (not including the Ext ID byte)
870 */
871#define IEEE80211_HEOP_PARAMS_LEN 4
872#define IEEE80211_HEOP_BASIC_MCS_LEN 2
873#define IEEE80211_HEOP_FIXED_LEN (IEEE80211_HEOP_PARAMS_LEN + \
874 IEEE80211_HEOP_BASIC_MCS_LEN)
875
804/*876/*
805 * EDCA Access Categories.877 * EDCA Access Categories.
806 */878 */
lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h+3-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_ioctl.h,v 1.44 2025/03/22 07:24:08 kevlo Exp $ */1/* $OpenBSD: ieee80211_ioctl.h,v 1.45 2026/03/26 12:15:01 kirill Exp $ */
2/* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */2/* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */
33
4/*-4/*-
...@@ -385,9 +385,10 @@ struct ieee80211_nodereq {...@@ -385,9 +385,10 @@ struct ieee80211_nodereq {
385#define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20385#define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20
386#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40386#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40
387#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80387#define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80
388#define IEEE80211_NODEREQ_ASSOCFAIL_CSA 0x100
388#define IEEE80211_NODEREQ_ASSOCFAIL_BITS \389#define IEEE80211_NODEREQ_ASSOCFAIL_BITS \
389 "\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \390 "\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \
390 "\10!WPAKEY"391 "\10!WPAKEY\11!CSA"
391392
392/* get the entire node cache */393/* get the entire node cache */
393struct ieee80211_nodereq_all {394struct ieee80211_nodereq_all {
lib/libc/include/generic-openbsd/net80211/ieee80211_node.h+48-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_node.h,v 1.97 2025/08/01 20:39:26 stsp Exp $ */1/* $OpenBSD: ieee80211_node.h,v 1.101 2026/03/29 21:16:21 kirill Exp $ */
2/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */2/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
33
4/*-4/*-
...@@ -370,6 +370,20 @@ struct ieee80211_node {...@@ -370,6 +370,20 @@ struct ieee80211_node {
370 uint8_t ni_vht_chan_center_freq_idx1;370 uint8_t ni_vht_chan_center_freq_idx1;
371 uint16_t ni_vht_basic_mcs;371 uint16_t ni_vht_basic_mcs;
372372
373 /* HE capabilities */
374 uint8_t ni_he_mac_cap[IEEE80211_HE_MAC_CAPS_LEN];
375 uint8_t ni_he_phy_cap[IEEE80211_HE_PHY_CAPS_LEN];
376 uint16_t ni_he_rxmcs_80;
377 uint16_t ni_he_txmcs_80;
378 uint16_t ni_he_rxmcs_160;
379 uint16_t ni_he_txmcs_160;
380 uint16_t ni_he_rxmcs_80p80;
381 uint16_t ni_he_txmcs_80p80;
382
383 /* HE operation */
384 uint8_t ni_he_oper_params[IEEE80211_HEOP_PARAMS_LEN];
385 uint16_t ni_he_basic_mcs;
386
373 /* Timeout handlers which trigger Tx Block Ack negotiation. */387 /* Timeout handlers which trigger Tx Block Ack negotiation. */
374 struct timeout ni_addba_req_to[IEEE80211_NUM_TID];388 struct timeout ni_addba_req_to[IEEE80211_NUM_TID];
375 int ni_addba_req_intval[IEEE80211_NUM_TID];389 int ni_addba_req_intval[IEEE80211_NUM_TID];
...@@ -381,6 +395,7 @@ struct ieee80211_node {...@@ -381,6 +395,7 @@ struct ieee80211_node {
381395
382 int ni_txmcs; /* current MCS used for TX */396 int ni_txmcs; /* current MCS used for TX */
383 int ni_vht_ss; /* VHT # spatial streams */397 int ni_vht_ss; /* VHT # spatial streams */
398 int ni_he_ss; /* HE # spatial streams */
384399
385 /* others */400 /* others */
386 u_int16_t ni_associd; /* assoc response */401 u_int16_t ni_associd; /* assoc response */
...@@ -398,6 +413,7 @@ struct ieee80211_node {...@@ -398,6 +413,7 @@ struct ieee80211_node {
398#define IEEE80211_NODE_ASSOCFAIL_BSSID 0x20413#define IEEE80211_NODE_ASSOCFAIL_BSSID 0x20
399#define IEEE80211_NODE_ASSOCFAIL_WPA_PROTO 0x40414#define IEEE80211_NODE_ASSOCFAIL_WPA_PROTO 0x40
400#define IEEE80211_NODE_ASSOCFAIL_WPA_KEY 0x80415#define IEEE80211_NODE_ASSOCFAIL_WPA_KEY 0x80
416#define IEEE80211_NODE_ASSOCFAIL_CSA 0x100
401417
402 int ni_inact; /* inactivity mark count */418 int ni_inact; /* inactivity mark count */
403 int ni_txrate; /* index to ni_rates[] */419 int ni_txrate; /* index to ni_rates[] */
...@@ -427,6 +443,9 @@ struct ieee80211_node {...@@ -427,6 +443,9 @@ struct ieee80211_node {
427#define IEEE80211_NODE_VHTCAP 0x40000 /* claims to support VHT */443#define IEEE80211_NODE_VHTCAP 0x40000 /* claims to support VHT */
428#define IEEE80211_NODE_VHT_SGI80 0x80000 /* SGI on 80 MHz negotiated */ 444#define IEEE80211_NODE_VHT_SGI80 0x80000 /* SGI on 80 MHz negotiated */
429#define IEEE80211_NODE_VHT_SGI160 0x100000 /* SGI on 160 MHz negotiated */ 445#define IEEE80211_NODE_VHT_SGI160 0x100000 /* SGI on 160 MHz negotiated */
446#define IEEE80211_NODE_HE 0x200000 /* HE negotiated */
447#define IEEE80211_NODE_HECAP 0x400000 /* claims to support HE */
448#define IEEE80211_NODE_CSA 0x800000 /* channel switch announced */
430449
431 /* If not NULL, this function gets called when ni_refcnt hits zero. */450 /* If not NULL, this function gets called when ni_refcnt hits zero. */
432 void (*ni_unref_cb)(struct ieee80211com *,451 void (*ni_unref_cb)(struct ieee80211com *,
...@@ -590,7 +609,11 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni)...@@ -590,7 +609,11 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni)
590609
591 cap_chan_width = (ni->ni_vhtcaps & IEEE80211_VHTCAP_CHAN_WIDTH_MASK) >>610 cap_chan_width = (ni->ni_vhtcaps & IEEE80211_VHTCAP_CHAN_WIDTH_MASK) >>
592 IEEE80211_VHTCAP_CHAN_WIDTH_SHIFT;611 IEEE80211_VHTCAP_CHAN_WIDTH_SHIFT;
593 if (cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160)612 if (cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160 &&
613 cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160_8080 &&
614 ((ni->ni_vhtcaps & IEEE80211_VHTCAP_EXT_NSS_BW_MASK) == 0 ||
615 (ni->ni_vht_tx_max_lgi_mbit_s &
616 IEEE80211_VHT_EXT_NSS_BW_CAPABLE) == 0))
594 return 0;617 return 0;
595618
596 op_chan_width = (ni->ni_vht_chan_width &619 op_chan_width = (ni->ni_vht_chan_width &
...@@ -600,6 +623,23 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni)...@@ -600,6 +623,23 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni)
600 return (op_chan_width == IEEE80211_VHTOP0_CHAN_WIDTH_160);623 return (op_chan_width == IEEE80211_VHTOP0_CHAN_WIDTH_160);
601}624}
602625
626/*
627 * Check if the peer supports HE.
628 * Require a HE capabilities IE and support for HE MCS with a single
629 * spatial stream.
630 */
631static inline int
632ieee80211_node_supports_he(struct ieee80211_node *ni)
633{
634 uint16_t rx_mcs;
635
636 rx_mcs = (ni->ni_he_rxmcs_80 & IEEE80211_HE_MCS_FOR_SS_MASK(1)) >>
637 IEEE80211_HE_MCS_FOR_SS_SHIFT(1);
638
639 return ((ni->ni_flags & IEEE80211_NODE_HECAP) &&
640 rx_mcs != IEEE80211_HE_MCS_SS_NOT_SUPP);
641}
642
603struct ieee80211com;643struct ieee80211com;
604644
605typedef void ieee80211_iter_func(void *, struct ieee80211_node *);645typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
...@@ -642,6 +682,11 @@ void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *,...@@ -642,6 +682,11 @@ void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *,
642void ieee80211_clear_vhtcaps(struct ieee80211_node *);682void ieee80211_clear_vhtcaps(struct ieee80211_node *);
643int ieee80211_setup_vhtop(struct ieee80211_node *, const uint8_t *,683int ieee80211_setup_vhtop(struct ieee80211_node *, const uint8_t *,
644 uint8_t, int);684 uint8_t, int);
685void ieee80211_setup_hecaps(struct ieee80211_node *, const uint8_t *,
686 uint8_t);
687void ieee80211_clear_hecaps(struct ieee80211_node *);
688int ieee80211_setup_heop(struct ieee80211_node *, const uint8_t *,
689 uint8_t, int);
645int ieee80211_setup_rates(struct ieee80211com *,690int ieee80211_setup_rates(struct ieee80211com *,
646 struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);691 struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);
647enum ieee80211_phymode ieee80211_node_abg_mode(struct ieee80211com *,692enum ieee80211_phymode ieee80211_node_abg_mode(struct ieee80211com *,
...@@ -656,6 +701,7 @@ void ieee80211_node_join(struct ieee80211com *,...@@ -656,6 +701,7 @@ void ieee80211_node_join(struct ieee80211com *,
656void ieee80211_node_leave(struct ieee80211com *,701void ieee80211_node_leave(struct ieee80211com *,
657 struct ieee80211_node *);702 struct ieee80211_node *);
658int ieee80211_match_bss(struct ieee80211com *, struct ieee80211_node *, int);703int ieee80211_match_bss(struct ieee80211com *, struct ieee80211_node *, int);
704void ieee80211_node_switch_bss(struct ieee80211com *, struct ieee80211_node *);
659void ieee80211_node_tx_stopped(struct ieee80211com *, struct ieee80211_node *);705void ieee80211_node_tx_stopped(struct ieee80211com *, struct ieee80211_node *);
660struct ieee80211_node *ieee80211_node_choose_bss(struct ieee80211com *, int,706struct ieee80211_node *ieee80211_node_choose_bss(struct ieee80211com *, int,
661 struct ieee80211_node **);707 struct ieee80211_node **);
lib/libc/include/generic-openbsd/net80211/ieee80211_proto.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_proto.h,v 1.50 2025/06/14 08:46:34 jsg Exp $ */1/* $OpenBSD: ieee80211_proto.h,v 1.51 2026/03/19 16:50:32 chris Exp $ */
2/* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */2/* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */
33
4/*-4/*-
...@@ -137,6 +137,7 @@ extern u_int8_t *ieee80211_add_xrates(u_int8_t *,...@@ -137,6 +137,7 @@ extern u_int8_t *ieee80211_add_xrates(u_int8_t *,
137extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *);137extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *);
138extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *);138extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *);
139extern u_int8_t *ieee80211_add_vhtcaps(u_int8_t *, struct ieee80211com *);139extern u_int8_t *ieee80211_add_vhtcaps(u_int8_t *, struct ieee80211com *);
140extern u_int8_t *ieee80211_add_hecaps(u_int8_t *, struct ieee80211com *);
140extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t);141extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t);
141142
142extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *,143extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *,
...@@ -169,6 +170,8 @@ extern void ieee80211_ht_negotiate(struct ieee80211com *,...@@ -169,6 +170,8 @@ extern void ieee80211_ht_negotiate(struct ieee80211com *,
169 struct ieee80211_node *);170 struct ieee80211_node *);
170extern void ieee80211_vht_negotiate(struct ieee80211com *,171extern void ieee80211_vht_negotiate(struct ieee80211com *,
171 struct ieee80211_node *);172 struct ieee80211_node *);
173extern void ieee80211_he_negotiate(struct ieee80211com *,
174 struct ieee80211_node *);
172extern void ieee80211_tx_ba_timeout(void *);175extern void ieee80211_tx_ba_timeout(void *);
173extern void ieee80211_rx_ba_timeout(void *);176extern void ieee80211_rx_ba_timeout(void *);
174extern int ieee80211_addba_request(struct ieee80211com *,177extern int ieee80211_addba_request(struct ieee80211com *,
lib/libc/include/generic-openbsd/net80211/ieee80211_var.h+18-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_var.h,v 1.112 2025/08/01 20:39:26 stsp Exp $ */1/* $OpenBSD: ieee80211_var.h,v 1.114 2026/03/19 16:50:32 chris Exp $ */
2/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */2/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
33
4/*-4/*-
...@@ -92,8 +92,9 @@ enum ieee80211_phymode {...@@ -92,8 +92,9 @@ enum ieee80211_phymode {
92 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */92 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
93 IEEE80211_MODE_11N = 4, /* 2GHz/5GHz, OFDM/HT */93 IEEE80211_MODE_11N = 4, /* 2GHz/5GHz, OFDM/HT */
94 IEEE80211_MODE_11AC = 5, /* 5GHz, OFDM/VHT */94 IEEE80211_MODE_11AC = 5, /* 5GHz, OFDM/VHT */
95 IEEE80211_MODE_11AX = 6, /* 2GHz/5GHz, OFDM/HE */
95};96};
96#define IEEE80211_MODE_MAX (IEEE80211_MODE_11AC+1)97#define IEEE80211_MODE_MAX (IEEE80211_MODE_11AX+1)
9798
98enum ieee80211_opmode {99enum ieee80211_opmode {
99 IEEE80211_M_STA = 1, /* infrastructure station */100 IEEE80211_M_STA = 1, /* infrastructure station */
...@@ -142,6 +143,7 @@ struct ieee80211_channel {...@@ -142,6 +143,7 @@ struct ieee80211_channel {
142 */143 */
143#define IEEE80211_CHANX_80MHZ 0x00000001 /* use of 80 MHz is allowed */144#define IEEE80211_CHANX_80MHZ 0x00000001 /* use of 80 MHz is allowed */
144#define IEEE80211_CHANX_160MHZ 0x00000002 /* use of 160 MHz is allowed */145#define IEEE80211_CHANX_160MHZ 0x00000002 /* use of 160 MHz is allowed */
146#define IEEE80211_CHANX_HE 0x00000004 /* 11ax/HE channel */
145147
146/*148/*
147 * Useful combinations of channel characteristics.149 * Useful combinations of channel characteristics.
...@@ -185,6 +187,8 @@ struct ieee80211_channel {...@@ -185,6 +187,8 @@ struct ieee80211_channel {
185 (((_c)->ic_xflags & IEEE80211_CHANX_80MHZ) != 0)187 (((_c)->ic_xflags & IEEE80211_CHANX_80MHZ) != 0)
186#define IEEE80211_CHAN_160MHZ_ALLOWED(_c) \188#define IEEE80211_CHAN_160MHZ_ALLOWED(_c) \
187 (((_c)->ic_xflags & IEEE80211_CHANX_160MHZ) != 0)189 (((_c)->ic_xflags & IEEE80211_CHANX_160MHZ) != 0)
190#define IEEE80211_CHAN_HE(_c) \
191 (((_c)->ic_xflags & IEEE80211_CHANX_HE) != 0)
188192
189/*193/*
190 * EDCA AC parameters.194 * EDCA AC parameters.
...@@ -337,6 +341,8 @@ struct ieee80211com {...@@ -337,6 +341,8 @@ struct ieee80211com {
337 */341 */
338 struct ieee80211_edca_ac_params ic_edca_ac[EDCA_NUM_AC];342 struct ieee80211_edca_ac_params ic_edca_ac[EDCA_NUM_AC];
339 u_int ic_edca_updtcount;343 u_int ic_edca_updtcount;
344 u_int ic_edca_txop_count[EDCA_NUM_AC];
345 struct timeval ic_edca_txop_time[EDCA_NUM_AC];
340 u_int16_t ic_tid_noack;346 u_int16_t ic_tid_noack;
341 u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN];347 u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN];
342 u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN];348 u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN];
...@@ -383,6 +389,15 @@ struct ieee80211com {...@@ -383,6 +389,15 @@ struct ieee80211com {
383 uint16_t ic_vht_txmcs;389 uint16_t ic_vht_txmcs;
384 uint16_t ic_vht_tx_max_lgi_mbit_s;390 uint16_t ic_vht_tx_max_lgi_mbit_s;
385391
392 u_int8_t ic_he_mac_cap[IEEE80211_HE_MAC_CAPS_LEN];
393 u_int8_t ic_he_phy_cap[IEEE80211_HE_PHY_CAPS_LEN];
394 uint16_t ic_he_rxmcs_80;
395 uint16_t ic_he_txmcs_80;
396 uint16_t ic_he_rxmcs_160;
397 uint16_t ic_he_txmcs_160;
398 uint16_t ic_he_rxmcs_80p80;
399 uint16_t ic_he_txmcs_80p80;
400
386 TAILQ_HEAD(, ieee80211_ess) ic_ess;401 TAILQ_HEAD(, ieee80211_ess) ic_ess;
387};402};
388#define ic_if ic_ac.ac_if403#define ic_if ic_ac.ac_if
...@@ -440,6 +455,7 @@ struct ieee80211_ess {...@@ -440,6 +455,7 @@ struct ieee80211_ess {
440#define IEEE80211_F_BGSCAN 0x08000000 /* STATUS: background scan */455#define IEEE80211_F_BGSCAN 0x08000000 /* STATUS: background scan */
441#define IEEE80211_F_AUTO_JOIN 0x10000000 /* CONF: auto-join active */456#define IEEE80211_F_AUTO_JOIN 0x10000000 /* CONF: auto-join active */
442#define IEEE80211_F_VHTON 0x20000000 /* CONF: VHT enabled */457#define IEEE80211_F_VHTON 0x20000000 /* CONF: VHT enabled */
458#define IEEE80211_F_HEON 0x40000000 /* CONF: HE enabled */
443459
444/* ic_xflags */460/* ic_xflags */
445#define IEEE80211_F_TX_MGMT_ONLY 0x00000001 /* leave data frames on ifq */461#define IEEE80211_F_TX_MGMT_ONLY 0x00000001 /* leave data frames on ifq */
lib/libc/include/generic-openbsd/netinet/if_ether.h+12-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_ether.h,v 1.96 2025/07/07 00:55:15 jsg Exp $ */1/* $OpenBSD: if_ether.h,v 1.99 2025/12/02 03:24:19 dlg Exp $ */
2/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */2/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
33
4/*4/*
...@@ -220,12 +220,12 @@ do { \...@@ -220,12 +220,12 @@ do { \
220220
221#include <net/if_var.h> /* for "struct ifnet" */221#include <net/if_var.h> /* for "struct ifnet" */
222222
223struct ether_brport {223struct ether_port {
224 struct mbuf *(*eb_input)(struct ifnet *, struct mbuf *,224 struct mbuf *(*ep_input)(struct ifnet *, struct mbuf *,
225 uint64_t, void *, struct netstack *);225 uint64_t, void *, struct netstack *);
226 void (*eb_port_take)(void *);226 void *(*ep_port_take)(void *);
227 void (*eb_port_rele)(void *);227 void (*ep_port_rele)(void *, void *);
228 void *eb_port;228 void *ep_port;
229};229};
230230
231/*231/*
...@@ -241,8 +241,8 @@ struct arpcom {...@@ -241,8 +241,8 @@ struct arpcom {
241 int ac_multicnt; /* length of ac_multiaddrs */241 int ac_multicnt; /* length of ac_multiaddrs */
242 int ac_multirangecnt; /* number of mcast ranges */242 int ac_multirangecnt; /* number of mcast ranges */
243243
244 void *ac_trunkport;244 const struct ether_port *ac_trport;
245 const struct ether_brport *ac_brport;245 const struct ether_port *ac_brport;
246};246};
247247
248extern int arpt_keep; /* arp resolved cache expire */248extern int arpt_keep; /* arp resolved cache expire */
...@@ -289,11 +289,11 @@ void ether_rtrequest(struct ifnet *, int, struct rtentry *);...@@ -289,11 +289,11 @@ void ether_rtrequest(struct ifnet *, int, struct rtentry *);
289char *ether_sprintf(u_char *);289char *ether_sprintf(u_char *);
290290
291int ether_brport_isset(struct ifnet *);291int ether_brport_isset(struct ifnet *);
292void ether_brport_set(struct ifnet *, const struct ether_brport *);292void ether_brport_set(struct ifnet *, const struct ether_port *);
293void ether_brport_clr(struct ifnet *);293void ether_brport_clr(struct ifnet *);
294const struct ether_brport *294const struct ether_port *
295 ether_brport_get(struct ifnet *);295 ether_brport_get(struct ifnet *);
296const struct ether_brport *296const struct ether_port *
297 ether_brport_get_locked(struct ifnet *);297 ether_brport_get_locked(struct ifnet *);
298298
299uint64_t ether_addr_to_e64(const struct ether_addr *);299uint64_t ether_addr_to_e64(const struct ether_addr *);
...@@ -313,6 +313,7 @@ struct ether_extracted {...@@ -313,6 +313,7 @@ struct ether_extracted {
313};313};
314314
315void ether_extract_headers(struct mbuf *, struct ether_extracted *);315void ether_extract_headers(struct mbuf *, struct ether_extracted *);
316struct mbuf *ether_offload_ifcap(struct ifnet *, struct mbuf *);
316317
317/*318/*
318 * Ethernet multicast address structure. There is one of these for each319 * Ethernet multicast address structure. There is one of these for each
lib/libc/include/generic-openbsd/netinet/igmp_var.h+17-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: igmp_var.h,v 1.16 2025/03/02 21:28:32 bluhm Exp $ */1/* $OpenBSD: igmp_var.h,v 1.17 2026/02/26 00:53:18 bluhm Exp $ */
2/* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */2/* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */
33
4/*4/*
...@@ -105,12 +105,26 @@ igmpstat_inc(enum igmpstat_counters c)...@@ -105,12 +105,26 @@ igmpstat_inc(enum igmpstat_counters c)
105 */105 */
106#define IGMP_RANDOM_DELAY(X) (arc4random_uniform(X) + 1)106#define IGMP_RANDOM_DELAY(X) (arc4random_uniform(X) + 1)
107107
108struct igmp_pktinfo {
109 STAILQ_ENTRY(igmp_pktinfo) ipi_list;
110 struct in_addr ipi_addr;
111 unsigned int ipi_rdomain;
112 unsigned int ipi_ifidx;
113 int ipi_type;
114};
115STAILQ_HEAD(igmp_pktlist, igmp_pktinfo);
116
108void igmp_init(void);117void igmp_init(void);
109int igmp_input(struct mbuf **, int *, int, int, struct netstack *);118int igmp_input(struct mbuf **, int *, int, int, struct netstack *);
110void igmp_joingroup(struct in_multi *, struct ifnet *);119void igmp_joingroup(struct in_multi *, struct ifnet *,
111void igmp_leavegroup(struct in_multi *, struct ifnet *);120 struct igmp_pktinfo *);
121void igmp_leavegroup(struct in_multi *, struct ifnet *,
122 struct igmp_pktinfo *);
112void igmp_fasttimo(void);123void igmp_fasttimo(void);
113void igmp_slowtimo(void);124void igmp_slowtimo(void);
114int igmp_sysctl(int *, u_int, void *, size_t *, void *, size_t);125int igmp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
126void igmp_sendpkt(struct igmp_pktinfo *);
127
115#endif /* _KERNEL */128#endif /* _KERNEL */
129
116#endif /* _NETINET_IGMP_VAR_H_ */130#endif /* _NETINET_IGMP_VAR_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/netinet/in_pcb.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: in_pcb.h,v 1.171 2025/07/14 09:01:52 jsg Exp $ */1/* $OpenBSD: in_pcb.h,v 1.174 2026/02/05 03:26:00 dlg Exp $ */
2/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */2/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
33
4/*4/*
...@@ -357,6 +357,7 @@ void in_setpeeraddr(struct inpcb *, struct mbuf *);...@@ -357,6 +357,7 @@ void in_setpeeraddr(struct inpcb *, struct mbuf *);
357void in_setsockaddr(struct inpcb *, struct mbuf *);357void in_setsockaddr(struct inpcb *, struct mbuf *);
358int in_sockaddr(struct socket *, struct mbuf *);358int in_sockaddr(struct socket *, struct mbuf *);
359int in_peeraddr(struct socket *, struct mbuf *);359int in_peeraddr(struct socket *, struct mbuf *);
360int in_flowid(struct socket *);
360int in_baddynamic(u_int16_t, u_int16_t);361int in_baddynamic(u_int16_t, u_int16_t);
361int in_rootonly(u_int16_t, u_int16_t);362int in_rootonly(u_int16_t, u_int16_t);
362int in_pcbselsrc(struct in_addr *, const struct sockaddr_in *,363int in_pcbselsrc(struct in_addr *, const struct sockaddr_in *,
lib/libc/include/generic-openbsd/netinet/in_var.h+17-59
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: in_var.h,v 1.41 2018/10/18 15:23:04 cheloha Exp $ */1/* $OpenBSD: in_var.h,v 1.47 2026/03/22 23:14:00 bluhm Exp $ */
2/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */2/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
33
4/*4/*
...@@ -35,6 +35,12 @@...@@ -35,6 +35,12 @@
35#ifndef _NETINET_IN_VAR_H_35#ifndef _NETINET_IN_VAR_H_
36#define _NETINET_IN_VAR_H_36#define _NETINET_IN_VAR_H_
3737
38/*
39 * Locks used to protect struct members in this file:
40 * I immutable after creation
41 * m multicast if_maddrlock rwlock of parent interface
42 */
43
38#include <sys/queue.h>44#include <sys/queue.h>
3945
40#ifdef _KERNEL46#ifdef _KERNEL
...@@ -75,37 +81,9 @@ struct in_aliasreq {...@@ -75,37 +81,9 @@ struct in_aliasreq {
75 struct sockaddr_in ifra_mask;81 struct sockaddr_in ifra_mask;
76};82};
7783
78
79#ifdef _KERNEL
80/*
81 * Macro for finding the internet address structure (in_ifaddr) corresponding
82 * to a given interface (ifnet structure).
83 */
84#define IFP_TO_IA(ifp, ia) \
85 /* struct ifnet *ifp; */ \
86 /* struct in_ifaddr *ia; */ \
87do { \
88 struct ifaddr *ifa; \
89 NET_ASSERT_LOCKED(); \
90 TAILQ_FOREACH(ifa, &(ifp)->if_addrlist, ifa_list) { \
91 if (ifa->ifa_addr->sa_family == AF_INET) \
92 break; \
93 } \
94 (ia) = ifatoia(ifa); \
95} while (/* CONSTCOND */ 0)
96#endif
97
98/*
99 * Per-interface router version information.
100 */
101struct router_info {
102 unsigned int rti_ifidx;
103 int rti_type; /* type of router on this interface */
104 int rti_age; /* time since last v1 query */
105 LIST_ENTRY(router_info) rti_list;
106};
107
108#ifdef _KERNEL84#ifdef _KERNEL
85struct router_info;
86
109/*87/*
110 * Internet multicast address structure. There is one of these for each IP88 * Internet multicast address structure. There is one of these for each IP
111 * multicast group to which this host belongs on a given network interface.89 * multicast group to which this host belongs on a given network interface.
...@@ -115,11 +93,11 @@ struct in_multi {...@@ -115,11 +93,11 @@ struct in_multi {
115#define inm_refcnt inm_ifma.ifma_refcnt93#define inm_refcnt inm_ifma.ifma_refcnt
116#define inm_ifidx inm_ifma.ifma_ifidx94#define inm_ifidx inm_ifma.ifma_ifidx
11795
118 struct sockaddr_in inm_sin; /* IPv4 multicast address */96 struct sockaddr_in inm_sin; /* [I] IPv4 multicast address */
119#define inm_addr inm_sin.sin_addr97#define inm_addr inm_sin.sin_addr
12098
121 u_int inm_state; /* state of membership */99 u_int inm_state; /* [m] state of membership */
122 u_int inm_timer; /* IGMP membership report timer */100 u_int inm_timer; /* [m] IGMP membership report */
123101
124 struct router_info *inm_rti; /* router version info */102 struct router_info *inm_rti; /* router version info */
125};103};
...@@ -130,37 +108,17 @@ ifmatoinm(struct ifmaddr *ifma)...@@ -130,37 +108,17 @@ ifmatoinm(struct ifmaddr *ifma)
130 return ((struct in_multi *)(ifma));108 return ((struct in_multi *)(ifma));
131}109}
132110
133/*111struct in_ifaddr *in_ifp2ia(struct ifnet *);
134 * Macro for looking up the in_multi record for a given IP multicast
135 * address on a given interface. If no matching record is found, "inm"
136 * returns NULL.
137 */
138#define IN_LOOKUP_MULTI(addr, ifp, inm) \
139 /* struct in_addr addr; */ \
140 /* struct ifnet *ifp; */ \
141 /* struct in_multi *inm; */ \
142do { \
143 struct ifmaddr *ifma; \
144 \
145 (inm) = NULL; \
146 NET_ASSERT_LOCKED(); \
147 TAILQ_FOREACH(ifma, &(ifp)->if_maddrlist, ifma_list) \
148 if (ifma->ifma_addr->sa_family == AF_INET && \
149 ifmatoinm(ifma)->inm_addr.s_addr == (addr).s_addr) {\
150 (inm) = ifmatoinm(ifma); \
151 break; \
152 } \
153} while (/* CONSTCOND */ 0)
154
155int in_ifinit(struct ifnet *,112int in_ifinit(struct ifnet *,
156 struct in_ifaddr *, struct sockaddr_in *, int);113 struct in_ifaddr *, struct sockaddr_in *, int);
157struct in_multi *in_addmulti(struct in_addr *, struct ifnet *);114struct in_multi *in_lookupmulti(const struct in_addr *, struct ifnet *);
115struct in_multi *in_addmulti(const struct in_addr *, struct ifnet *);
158void in_delmulti(struct in_multi *);116void in_delmulti(struct in_multi *);
159int in_hasmulti(struct in_addr *, struct ifnet *);117int in_hasmulti(const struct in_addr *, struct ifnet *);
160void in_ifscrub(struct ifnet *, struct in_ifaddr *);118void in_ifscrub(struct ifnet *, struct in_ifaddr *);
161int in_control(struct socket *, u_long, caddr_t, struct ifnet *);119int in_control(struct socket *, u_long, caddr_t, struct ifnet *);
162int in_ioctl(u_long, caddr_t, struct ifnet *, int);120int in_ioctl(u_long, caddr_t, struct ifnet *, int);
163void in_prefixlen2mask(struct in_addr *, int);121void in_prefixlen2mask(struct in_addr *, int);
164#endif122#endif /* _KERNEL */
165123
166#endif /* _NETINET_IN_VAR_H_ */124#endif /* _NETINET_IN_VAR_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/netinet/ip.h+3-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip.h,v 1.20 2021/12/14 23:47:36 dtucker Exp $ */1/* $OpenBSD: ip.h,v 1.22 2025/12/19 13:58:53 tb Exp $ */
2/* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */2/* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */
33
4/*4/*
...@@ -95,7 +95,7 @@ struct ip {...@@ -95,7 +95,7 @@ struct ip {
95#define IPTOS_PREC_ROUTINE 0x0095#define IPTOS_PREC_ROUTINE 0x00
9696
97/*97/*
98 * Definitions for DiffServ Codepoints as per RFCs 2474, 3246, 4594 & 8622.98 * Definitions for DiffServ Codepoints as per RFCs 2474, 3246, 4594, 5865, 8622.
99 * These are the 6 most significant bits as they appear on the wire, so the99 * These are the 6 most significant bits as they appear on the wire, so the
100 * two least significant bits must be zero.100 * two least significant bits must be zero.
101 */101 */
...@@ -118,6 +118,7 @@ struct ip {...@@ -118,6 +118,7 @@ struct ip {
118#define IPTOS_DSCP_AF42 0x90118#define IPTOS_DSCP_AF42 0x90
119#define IPTOS_DSCP_AF43 0x98119#define IPTOS_DSCP_AF43 0x98
120#define IPTOS_DSCP_CS5 0xa0120#define IPTOS_DSCP_CS5 0xa0
121#define IPTOS_DSCP_VA 0xb0
121#define IPTOS_DSCP_EF 0xb8122#define IPTOS_DSCP_EF 0xb8
122#define IPTOS_DSCP_CS6 0xc0123#define IPTOS_DSCP_CS6 0xc0
123#define IPTOS_DSCP_CS7 0xe0124#define IPTOS_DSCP_CS7 0xe0
lib/libc/include/generic-openbsd/netinet/tcp_timer.h+1-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: tcp_timer.h,v 1.27 2025/06/08 17:06:19 bluhm Exp $ */1/* $OpenBSD: tcp_timer.h,v 1.28 2025/12/31 03:47:04 jsg Exp $ */
2/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */2/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */
33
4/*4/*
...@@ -162,7 +162,6 @@ extern int tcp_keepintvl; /* [a] time between keepalive probes */...@@ -162,7 +162,6 @@ extern int tcp_keepintvl; /* [a] time between keepalive probes */
162extern int tcp_keepinit_sec; /* [a] copy of above in seconds for sysctl */162extern int tcp_keepinit_sec; /* [a] copy of above in seconds for sysctl */
163extern int tcp_keepidle_sec; /* [a] copy of above in seconds for sysctl */163extern int tcp_keepidle_sec; /* [a] copy of above in seconds for sysctl */
164extern int tcp_keepintvl_sec; /* [a] copy of above in seconds for sysctl */164extern int tcp_keepintvl_sec; /* [a] copy of above in seconds for sysctl */
165extern int tcp_ttl; /* time to live for TCP segs */
166extern const int tcp_backoff[];165extern const int tcp_backoff[];
167#endif /* _KERNEL */166#endif /* _KERNEL */
168#endif /* _NETINET_TCP_TIMER_H_ */167#endif /* _NETINET_TCP_TIMER_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/netinet6/in6_var.h+15-29
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: in6_var.h,v 1.81 2025/05/20 05:51:43 bluhm Exp $ */1/* $OpenBSD: in6_var.h,v 1.85 2026/03/22 23:14:00 bluhm Exp $ */
2/* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */2/* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */
33
4/*4/*
...@@ -64,6 +64,12 @@...@@ -64,6 +64,12 @@
64#ifndef _NETINET6_IN6_VAR_H_64#ifndef _NETINET6_IN6_VAR_H_
65#define _NETINET6_IN6_VAR_H_65#define _NETINET6_IN6_VAR_H_
6666
67/*
68 * Locks used to protect struct members in this file:
69 * I immutable after creation
70 * m multicast if_maddrlock rwlock of parent interface
71 */
72
67/*73/*
68 * Interface address, Internet version. One of these structures74 * Interface address, Internet version. One of these structures
69 * is allocated for each interface with an Internet address.75 * is allocated for each interface with an Internet address.
...@@ -316,11 +322,11 @@ struct in6_multi {...@@ -316,11 +322,11 @@ struct in6_multi {
316#define in6m_refcnt in6m_ifma.ifma_refcnt322#define in6m_refcnt in6m_ifma.ifma_refcnt
317#define in6m_ifidx in6m_ifma.ifma_ifidx323#define in6m_ifidx in6m_ifma.ifma_ifidx
318324
319 struct sockaddr_in6 in6m_sin; /* IPv6 multicast address */325 struct sockaddr_in6 in6m_sin; /* [I] IPv6 multicast address */
320#define in6m_addr in6m_sin.sin6_addr326#define in6m_addr in6m_sin.sin6_addr
321327
322 u_int in6m_state; /* state of membership */328 u_int in6m_state; /* [m] state of membership */
323 u_int in6m_timer; /* MLD6 membership report timer */329 u_int in6m_timer; /* [m] MLD6 membership report */
324};330};
325331
326static __inline struct in6_multi *332static __inline struct in6_multi *
...@@ -329,32 +335,12 @@ ifmatoin6m(struct ifmaddr *ifma)...@@ -329,32 +335,12 @@ ifmatoin6m(struct ifmaddr *ifma)
329 return ((struct in6_multi *)(ifma));335 return ((struct in6_multi *)(ifma));
330}336}
331337
332/*338struct in6_multi *in6_lookupmulti(const struct in6_addr *, struct ifnet *);
333 * Macros for looking up the in6_multi record for a given IP6 multicast339struct in6_multi *in6_addmulti(const struct in6_addr *, struct ifnet *, int *);
334 * address on a given interface. If no matching record is found, "in6m"
335 * returns NULL.
336 */
337#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
338 /* struct in6_addr addr; */ \
339 /* struct ifnet *ifp; */ \
340 /* struct in6_multi *in6m; */ \
341do { \
342 struct ifmaddr *ifma; \
343 \
344 (in6m) = NULL; \
345 TAILQ_FOREACH(ifma, &(ifp)->if_maddrlist, ifma_list) \
346 if (ifma->ifma_addr->sa_family == AF_INET6 && \
347 IN6_ARE_ADDR_EQUAL(&ifmatoin6m(ifma)->in6m_addr, \
348 &(addr))) { \
349 (in6m) = ifmatoin6m(ifma); \
350 break; \
351 } \
352} while (/* CONSTCOND */ 0)
353
354struct in6_multi *in6_addmulti(struct in6_addr *, struct ifnet *, int *);
355void in6_delmulti(struct in6_multi *);340void in6_delmulti(struct in6_multi *);
356int in6_hasmulti(struct in6_addr *, struct ifnet *);341int in6_hasmulti(const struct in6_addr *, struct ifnet *);
357struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *, int *);342struct in6_multi_mship *in6_joingroup(struct ifnet *, const struct in6_addr *,
343 int *);
358void in6_leavegroup(struct in6_multi_mship *);344void in6_leavegroup(struct in6_multi_mship *);
359int in6_control(struct socket *, u_long, caddr_t, struct ifnet *);345int in6_control(struct socket *, u_long, caddr_t, struct ifnet *);
360int in6_ioctl(u_long, caddr_t, struct ifnet *, int);346int in6_ioctl(u_long, caddr_t, struct ifnet *, int);
lib/libc/include/generic-openbsd/netinet6/ip6_var.h+1-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip6_var.h,v 1.128 2025/09/16 09:19:16 florian Exp $ */1/* $OpenBSD: ip6_var.h,v 1.129 2025/12/31 04:10:00 jsg Exp $ */
2/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */2/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
33
4/*4/*
...@@ -280,7 +280,6 @@ extern int ip6_defmcasthlim; /* default multicast hop limit */...@@ -280,7 +280,6 @@ extern int ip6_defmcasthlim; /* default multicast hop limit */
280extern int ip6_forwarding; /* act as router? */280extern int ip6_forwarding; /* act as router? */
281extern int ip6_mforwarding; /* act as multicast router? */281extern int ip6_mforwarding; /* act as multicast router? */
282extern int ip6_multipath; /* use multipath routes */282extern int ip6_multipath; /* use multipath routes */
283extern int ip6_sendredirect; /* send ICMPv6 redirect? */
284extern int ip6_mcast_pmtu; /* path MTU discovery for multicast */283extern int ip6_mcast_pmtu; /* path MTU discovery for multicast */
285extern int ip6_neighborgcthresh; /* Threshold # of NDP entries for GC */284extern int ip6_neighborgcthresh; /* Threshold # of NDP entries for GC */
286extern int ip6_maxdynroutes; /* Max # of routes created via redirect */285extern int ip6_maxdynroutes; /* Max # of routes created via redirect */
lib/libc/include/generic-openbsd/netinet6/mld6_var.h+17-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mld6_var.h,v 1.6 2008/04/18 06:42:20 djm Exp $ */1/* $OpenBSD: mld6_var.h,v 1.10 2026/02/26 00:53:18 bluhm Exp $ */
2/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */2/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */
33
4/*4/*
...@@ -43,11 +43,24 @@...@@ -43,11 +43,24 @@
43#define MLD_OTHERLISTENER 043#define MLD_OTHERLISTENER 0
44#define MLD_IREPORTEDLAST 144#define MLD_IREPORTEDLAST 1
4545
46struct mld6_pktinfo {
47 STAILQ_ENTRY(mld6_pktinfo) mpi_list;
48 struct in6_addr mpi_addr;
49 unsigned int mpi_rdomain;
50 unsigned int mpi_ifidx;
51 int mpi_type;
52};
53STAILQ_HEAD(mld6_pktlist, mld6_pktinfo);
54
46void mld6_init(void);55void mld6_init(void);
47void mld6_input(struct mbuf *, int);56void mld6_input(struct mbuf *, int);
48void mld6_start_listening(struct in6_multi *);57void mld6_start_listening(struct in6_multi *, struct ifnet *,
49void mld6_stop_listening(struct in6_multi *);58 struct mld6_pktinfo *);
50void mld6_fasttimeo(void);59void mld6_stop_listening(struct in6_multi *, struct ifnet *,
60 struct mld6_pktinfo *);
61void mld6_fasttimo(void);
62void mld6_sendpkt(const struct mld6_pktinfo *);
63
51#endif /* _KERNEL */64#endif /* _KERNEL */
5265
53#endif /* _NETINET6_MLD6_VAR_H_ */66#endif /* _NETINET6_MLD6_VAR_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/netinet6/nd6.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: nd6.h,v 1.105 2025/09/16 09:19:43 florian Exp $ */1/* $OpenBSD: nd6.h,v 1.106 2026/03/23 13:12:39 jsg Exp $ */
2/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */2/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
33
4/*4/*
...@@ -83,7 +83,7 @@ struct llinfo_nd6 {...@@ -83,7 +83,7 @@ struct llinfo_nd6 {
83 TAILQ_ENTRY(llinfo_nd6) ln_list; /* [m] global nd6_list */83 TAILQ_ENTRY(llinfo_nd6) ln_list; /* [m] global nd6_list */
84 struct rtentry *ln_rt; /* [I] backpointer to rtentry */84 struct rtentry *ln_rt; /* [I] backpointer to rtentry */
85 /* keep fields above in sync with struct llinfo_nd6_iterator */85 /* keep fields above in sync with struct llinfo_nd6_iterator */
86 struct refcnt ln_refcnt; /* entry refereced by list */86 struct refcnt ln_refcnt; /* entry referenced by list */
87 struct mbuf_queue ln_mq; /* hold packets until resolved */87 struct mbuf_queue ln_mq; /* hold packets until resolved */
88 struct in6_addr ln_saddr6; /* source of prompting packet */88 struct in6_addr ln_saddr6; /* source of prompting packet */
89 long ln_asked; /* number of queries already sent for addr */89 long ln_asked; /* number of queries already sent for addr */
lib/libc/include/generic-openbsd/pthread.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pthread.h,v 1.4 2018/03/05 01:15:26 deraadt Exp $ */1/* $OpenBSD: pthread.h,v 1.5 2025/11/11 18:54:05 semarie Exp $ */
22
3/*3/*
4 * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu4 * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
...@@ -50,7 +50,7 @@...@@ -50,7 +50,7 @@
50 * Run-time invariant values:50 * Run-time invariant values:
51 */51 */
52#define PTHREAD_DESTRUCTOR_ITERATIONS 452#define PTHREAD_DESTRUCTOR_ITERATIONS 4
53#define PTHREAD_KEYS_MAX 25653#define PTHREAD_KEYS_MAX 512
54#define PTHREAD_STACK_MIN (1U << _MAX_PAGE_SHIFT)54#define PTHREAD_STACK_MIN (1U << _MAX_PAGE_SHIFT)
55#define PTHREAD_THREADS_MAX ULONG_MAX55#define PTHREAD_THREADS_MAX ULONG_MAX
5656
lib/libc/include/generic-openbsd/signal.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: signal.h,v 1.26 2018/05/30 13:20:38 bluhm Exp $ */1/* $OpenBSD: signal.h,v 1.27 2026/03/23 21:33:43 daniel Exp $ */
2/* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */2/* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */
33
4/*-4/*-
...@@ -132,7 +132,7 @@ int thrkill(pid_t _tid, int _signum, void *_tcb);...@@ -132,7 +132,7 @@ int thrkill(pid_t _tid, int _signum, void *_tcb);
132int sigwait(const sigset_t *__restrict, int *__restrict);132int sigwait(const sigset_t *__restrict, int *__restrict);
133#endif133#endif
134#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809134#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
135void psignal(unsigned int, const char *);135void psignal(int, const char *);
136#endif136#endif
137#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */137#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
138__END_DECLS138__END_DECLS
lib/libc/include/generic-openbsd/sndio.h+6-12
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sndio.h,v 1.15 2024/05/24 15:10:26 ratchov Exp $ */1/* $OpenBSD: sndio.h,v 1.17 2026/01/22 09:31:22 ratchov Exp $ */
2/*2/*
3 * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>3 * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
4 *4 *
...@@ -27,17 +27,9 @@...@@ -27,17 +27,9 @@
2727
28/*28/*
29 * limits29 * limits
30 *
31 * For now SIOCTL_DISPLAYMAX is 12 byte only. It nicely fits in the
32 * padding of the sioctl_desc structure: this allows any binary linked
33 * to the library version with no sioctl_desc->display to work with
34 * this library version. Currently, any string reported by the lower
35 * layers fits in the 12-byte buffer. Once larger strings start
36 * being used (or the ABI changes for any other reason) increase
37 * SIOCTL_DISPLAYMAX and properly pad the sioctl_desc structure.
38 */30 */
39#define SIOCTL_NAMEMAX 12 /* max name length */31#define SIOCTL_NAMEMAX 16 /* max name length */
40#define SIOCTL_DISPLAYMAX 12 /* max display string length */32#define SIOCTL_DISPLAYMAX 32 /* max display string length */
4133
42/*34/*
43 * private ``handle'' structure35 * private ``handle'' structure
...@@ -119,11 +111,12 @@ struct sioctl_desc {...@@ -119,11 +111,12 @@ struct sioctl_desc {
119#define SIOCTL_LIST 5 /* switch, element of a list */111#define SIOCTL_LIST 5 /* switch, element of a list */
120#define SIOCTL_SEL 6 /* element of a selector */112#define SIOCTL_SEL 6 /* element of a selector */
121 unsigned int type; /* one of above */113 unsigned int type; /* one of above */
114 unsigned int maxval; /* max value */
115 int __pad[3]; /* for future use */
122 char func[SIOCTL_NAMEMAX]; /* function name, ex. "level" */116 char func[SIOCTL_NAMEMAX]; /* function name, ex. "level" */
123 char group[SIOCTL_NAMEMAX]; /* group this control belongs to */117 char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
124 struct sioctl_node node0; /* affected node */118 struct sioctl_node node0; /* affected node */
125 struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST,SEL} */119 struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST,SEL} */
126 unsigned int maxval; /* max value */
127 char display[SIOCTL_DISPLAYMAX]; /* free-format hint */120 char display[SIOCTL_DISPLAYMAX]; /* free-format hint */
128};121};
129122
...@@ -169,6 +162,7 @@ int sio_setpar(struct sio_hdl *, struct sio_par *);...@@ -169,6 +162,7 @@ int sio_setpar(struct sio_hdl *, struct sio_par *);
169int sio_getpar(struct sio_hdl *, struct sio_par *);162int sio_getpar(struct sio_hdl *, struct sio_par *);
170int sio_getcap(struct sio_hdl *, struct sio_cap *);163int sio_getcap(struct sio_hdl *, struct sio_cap *);
171void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *);164void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *);
165void sio_onxrun(struct sio_hdl *, void (*)(void *), void *);
172size_t sio_write(struct sio_hdl *, const void *, size_t);166size_t sio_write(struct sio_hdl *, const void *, size_t);
173size_t sio_read(struct sio_hdl *, void *, size_t);167size_t sio_read(struct sio_hdl *, void *, size_t);
174int sio_start(struct sio_hdl *);168int sio_start(struct sio_hdl *);
lib/libc/include/generic-openbsd/strings.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: strings.h,v 1.6 2017/09/10 21:50:36 schwarze Exp $ */1/* $OpenBSD: strings.h,v 1.7 2025/10/24 11:30:06 claudio Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990 The Regents of the University of California.4 * Copyright (c) 1990 The Regents of the University of California.
...@@ -78,6 +78,10 @@ int strncasecmp(const char *, const char *, size_t);...@@ -78,6 +78,10 @@ int strncasecmp(const char *, const char *, size_t);
78int strcasecmp_l(const char *, const char *, locale_t);78int strcasecmp_l(const char *, const char *, locale_t);
79int strncasecmp_l(const char *, const char *, size_t, locale_t);79int strncasecmp_l(const char *, const char *, size_t, locale_t);
80#endif80#endif
81#if __POSIX_VISIBLE >= 202405
82int ffsl(long);
83int ffsll(long long);
84#endif
81__END_DECLS85__END_DECLS
8286
83#endif /* _STRINGS_H_ */87#endif /* _STRINGS_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/sys/device.h+4-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: device.h,v 1.70 2025/09/16 12:18:10 hshoexer Exp $ */1/* $OpenBSD: device.h,v 1.71 2026/03/11 16:18:42 kettenis Exp $ */
2/* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */2/* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */
33
4/*4/*
...@@ -204,8 +204,9 @@ void config_process_deferred_mountroot(void);...@@ -204,8 +204,9 @@ void config_process_deferred_mountroot(void);
204204
205int request_sleep(int);205int request_sleep(int);
206int sleep_state(void *, int);206int sleep_state(void *, int);
207#define SLEEP_SUSPEND 0x01207#define SLEEP_RESUME 0
208#define SLEEP_HIBERNATE 0x02208#define SLEEP_SUSPEND 1
209#define SLEEP_HIBERNATE 2
209void sleep_mp(void);210void sleep_mp(void);
210void resume_mp(void);211void resume_mp(void);
211int sleep_showstate(void *v, int sleepmode);212int sleep_showstate(void *v, int sleepmode);
lib/libc/include/generic-openbsd/sys/disklabel.h+17-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: disklabel.h,v 1.93 2025/09/17 10:16:09 deraadt Exp $ */1/* $OpenBSD: disklabel.h,v 1.94 2025/11/13 20:59:14 deraadt Exp $ */
2/* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */2/* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */
33
4/*4/*
...@@ -49,14 +49,26 @@...@@ -49,14 +49,26 @@
4949
50#include <sys/uuid.h>50#include <sys/uuid.h>
5151
52/*
53 * The dev_t split has 64 partitions, but only 52 are visible
54 * and easily useable in userland (a-z and A-Z).
55 * The MD variable MAXPARTITIONS remains 52 (or less).
56 */
57#define MAXPARTITIONSUNIT 64
58
59/*
60 * Various situations still have structures limited to 16 partitions.
61 */
62#define MAXPARTITIONS16 16
63
52/*64/*
53 * Translate between device numbers and major/disk unit/disk partition.65 * Translate between device numbers and major/disk unit/disk partition.
54 */66 */
55#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)67#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONSUNIT)
56#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)68#define DISKPART(dev) (minor(dev) % MAXPARTITIONSUNIT)
57#define RAW_PART 2 /* 'c' partition */69#define RAW_PART 2 /* 'c' partition */
58#define DISKMINOR(unit, part) \70#define DISKMINOR(unit, part) \
59 (((unit) * MAXPARTITIONS) + (part))71 (((unit) * MAXPARTITIONSUNIT) + (part))
60#define MAKEDISKDEV(maj, unit, part) \72#define MAKEDISKDEV(maj, unit, part) \
61 (makedev((maj), DISKMINOR((unit), (part))))73 (makedev((maj), DISKMINOR((unit), (part))))
62#define DISKLABELDEV(dev) \74#define DISKLABELDEV(dev) \
...@@ -117,7 +129,7 @@ struct disklabel {...@@ -117,7 +129,7 @@ struct disklabel {
117 u_int8_t p_fstype; /* filesystem type, see below */129 u_int8_t p_fstype; /* filesystem type, see below */
118 u_int8_t p_fragblock; /* encoded filesystem frag/block */130 u_int8_t p_fragblock; /* encoded filesystem frag/block */
119 u_int16_t p_cpg; /* UFS: FS cylinders per group */131 u_int16_t p_cpg; /* UFS: FS cylinders per group */
120 } d_partitions[MAXPARTITIONS]; /* actually may be more */132 } d_partitions[MAXPARTITIONSUNIT]; /* maximum 52 in use */
121};133};
122#endif /* _LOCORE */134#endif /* _LOCORE */
123135
lib/libc/include/generic-openbsd/sys/dkio.h+3-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: dkio.h,v 1.13 2025/09/17 10:24:25 deraadt Exp $ */1/* $OpenBSD: dkio.h,v 1.14 2025/11/13 20:59:14 deraadt Exp $ */
2/* $NetBSD: dkio.h,v 1.1 1996/01/30 18:21:48 thorpej Exp $ */2/* $NetBSD: dkio.h,v 1.1 1996/01/30 18:21:48 thorpej Exp $ */
33
4/*4/*
...@@ -50,11 +50,9 @@...@@ -50,11 +50,9 @@
50#define DIOCGPDINFO _IOR('d', 114, struct disklabel)/* get physical */50#define DIOCGPDINFO _IOR('d', 114, struct disklabel)/* get physical */
51#define DIOCRLDINFO _IO('d', 115) /* reload disklabel */51#define DIOCRLDINFO _IO('d', 115) /* reload disklabel */
5252
53#if MAXPARTITIONS != 16
54/* XXX temporary to support the transition to more partitions */53/* XXX temporary to support the transition to more partitions */
55#define O_sizeof_disklabel (offsetof(struct disklabel, d_partitions[16]))54#define O_disklabel offsetof(struct disklabel, d_partitions[MAXPARTITIONS16])
56#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_sizeof_disklabel)55#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_disklabel)
57#endif
5856
59struct dk_inquiry {57struct dk_inquiry {
60 char vendor[64];58 char vendor[64];
lib/libc/include/generic-openbsd/sys/filedesc.h+3-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: filedesc.h,v 1.48 2025/08/04 04:59:30 guenther Exp $ */1/* $OpenBSD: filedesc.h,v 1.49 2026/03/08 16:41:19 deraadt Exp $ */
2/* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */2/* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */
33
4/*4/*
...@@ -114,8 +114,9 @@ struct filedesc0 {...@@ -114,8 +114,9 @@ struct filedesc0 {
114 * Per-process open flags.114 * Per-process open flags.
115 */115 */
116#define UF_EXCLOSE 0x01 /* auto-close on exec */116#define UF_EXCLOSE 0x01 /* auto-close on exec */
117#define UF_PLEDGED 0x02 /* open after pledge(2) */117#define UF_PLEDGED 0x02 /* opened after pledge(2) */
118#define UF_FORKCLOSE 0x04 /* auto-close on fork */118#define UF_FORKCLOSE 0x04 /* auto-close on fork */
119#define UF_PLEDGEOPEN 0x08 /* opened with __pledge_open() */
119120
120/*121/*
121 * Flags on the file descriptor table.122 * Flags on the file descriptor table.
lib/libc/include/generic-openbsd/sys/mbuf.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mbuf.h,v 1.267 2025/06/25 20:26:32 miod Exp $ */1/* $OpenBSD: mbuf.h,v 1.269 2026/02/05 03:26:00 dlg Exp $ */
2/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */2/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
33
4/*4/*
lib/libc/include/generic-openbsd/sys/mman.h+7-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mman.h,v 1.35 2022/10/07 14:59:39 deraadt Exp $ */1/* $OpenBSD: mman.h,v 1.36 2026/03/26 21:46:24 daniel Exp $ */
2/* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */2/* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */
33
4/*-4/*-
...@@ -142,6 +142,11 @@ typedef __size_t size_t;...@@ -142,6 +142,11 @@ typedef __size_t size_t;
142typedef __off_t off_t;142typedef __off_t off_t;
143#endif143#endif
144144
145#ifndef _MODE_T_DEFINED_
146#define _MODE_T_DEFINED_
147typedef __mode_t mode_t;
148#endif
149
145__BEGIN_DECLS150__BEGIN_DECLS
146void * mmap(void *, size_t, int, int, int, off_t);151void * mmap(void *, size_t, int, int, int, off_t);
147int mprotect(void *, size_t, int);152int mprotect(void *, size_t, int);
...@@ -158,7 +163,7 @@ int mimmutable(void *, size_t);...@@ -158,7 +163,7 @@ int mimmutable(void *, size_t);
158void * mquery(void *, size_t, int, int, int, off_t);163void * mquery(void *, size_t, int, int, int, off_t);
159#endif164#endif
160int posix_madvise(void *, size_t, int);165int posix_madvise(void *, size_t, int);
161int shm_open(const char *, int, __mode_t);166int shm_open(const char *, int, mode_t);
162int shm_unlink(const char *);167int shm_unlink(const char *);
163int shm_mkstemp(char *);168int shm_mkstemp(char *);
164__END_DECLS169__END_DECLS
lib/libc/include/generic-openbsd/sys/mutex.h+10-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mutex.h,v 1.23 2025/07/02 14:36:56 claudio Exp $ */1/* $OpenBSD: mutex.h,v 1.26 2025/12/11 23:34:44 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>4 * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
...@@ -54,7 +54,7 @@...@@ -54,7 +54,7 @@
54#include <sys/_lock.h>54#include <sys/_lock.h>
5555
56struct mutex {56struct mutex {
57 void *volatile mtx_owner;57 volatile unsigned long mtx_owner;
58 int mtx_wantipl;58 int mtx_wantipl;
59 int mtx_oldipl;59 int mtx_oldipl;
60#ifdef WITNESS60#ifdef WITNESS
...@@ -64,23 +64,26 @@ struct mutex {...@@ -64,23 +64,26 @@ struct mutex {
6464
65#ifdef WITNESS65#ifdef WITNESS
66#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \66#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
67 { NULL, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) }67 { 0, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) }
68#else68#else
69#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \69#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
70 { NULL, __MUTEX_IPL((ipl)), IPL_NONE }70 { 0, __MUTEX_IPL((ipl)), IPL_NONE }
71#endif71#endif
7272
73void __mtx_init(struct mutex *, int);73void __mtx_init(struct mutex *, int);
74#define _mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl)))74#define _mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl)))
7575
76#define mtx_curcpu() (unsigned long)curcpu()
77#define mtx_owner(mtx) ((mtx)->mtx_owner & ~1UL)
78
76#ifdef DIAGNOSTIC79#ifdef DIAGNOSTIC
77#define MUTEX_ASSERT_LOCKED(mtx) do { \80#define MUTEX_ASSERT_LOCKED(mtx) do { \
78 if (((mtx)->mtx_owner != curcpu()) && !(panicstr || db_active)) \81 if (mtx_owner(mtx) != mtx_curcpu() && !(panicstr || db_active)) \
79 panic("mutex %p not held in %s", (mtx), __func__); \82 panic("mutex %p not held in %s", (mtx), __func__); \
80} while (0)83} while (0)
8184
82#define MUTEX_ASSERT_UNLOCKED(mtx) do { \85#define MUTEX_ASSERT_UNLOCKED(mtx) do { \
83 if (((mtx)->mtx_owner == curcpu()) && !(panicstr || db_active)) \86 if (mtx_owner(mtx) == mtx_curcpu() && !(panicstr || db_active)) \
84 panic("mutex %p held in %s", (mtx), __func__); \87 panic("mutex %p held in %s", (mtx), __func__); \
85} while (0)88} while (0)
86#else89#else
...@@ -128,7 +131,7 @@ void mtx_leave(struct mutex *);...@@ -128,7 +131,7 @@ void mtx_leave(struct mutex *);
128#define mtx_init(m, ipl) mtx_init_flags(m, ipl, NULL, 0)131#define mtx_init(m, ipl) mtx_init_flags(m, ipl, NULL, 0)
129132
130#define mtx_owned(mtx) \133#define mtx_owned(mtx) \
131 (((mtx)->mtx_owner == curcpu()) || panicstr || db_active)134 ((mtx_owner(mtx) == mtx_curcpu()) || panicstr || db_active)
132135
133#ifdef WITNESS136#ifdef WITNESS
134137
lib/libc/include/generic-openbsd/sys/namei.h+8-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: namei.h,v 1.50 2022/01/11 23:59:55 jsg Exp $ */1/* $OpenBSD: namei.h,v 1.51 2026/03/08 16:41:19 deraadt Exp $ */
2/* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */2/* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */
33
4/*4/*
...@@ -264,11 +264,12 @@ struct nchstats {...@@ -264,11 +264,12 @@ struct nchstats {
264}264}
265265
266/* Unveil flags for namei */266/* Unveil flags for namei */
267#define UNVEIL_READ 0x01267#define UNVEIL_READ 0x01
268#define UNVEIL_WRITE 0x02268#define UNVEIL_WRITE 0x02
269#define UNVEIL_CREATE 0x04269#define UNVEIL_CREATE 0x04
270#define UNVEIL_EXEC 0x08270#define UNVEIL_EXEC 0x08
271#define UNVEIL_USERSET 0x10271#define UNVEIL_USERSET 0x10
272#define UNVEIL_MASK 0x0F272#define UNVEIL_PLEDGEOPEN 0X20
273#define UNVEIL_MASK 0x0f
273274
274#endif /* !_SYS_NAMEI_H_ */275#endif /* !_SYS_NAMEI_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/sys/param.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: param.h,v 1.145 2025/09/10 16:00:04 deraadt Exp $ */1/* $OpenBSD: param.h,v 1.146 2026/03/11 02:27:20 deraadt Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1982, 1986, 1989, 19934 * Copyright (c) 1982, 1986, 1989, 1993
lib/libc/include/generic-openbsd/sys/pledge.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pledge.h,v 1.52 2025/07/05 09:24:37 jsg Exp $ */1/* $OpenBSD: pledge.h,v 1.53 2026/02/26 07:42:25 deraadt Exp $ */
22
3/*3/*
4 * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>4 * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
...@@ -28,7 +28,6 @@...@@ -28,7 +28,6 @@
28#define PLEDGE_WPATH 0x0000000000000002ULL /* allow open for write */28#define PLEDGE_WPATH 0x0000000000000002ULL /* allow open for write */
29#define PLEDGE_CPATH 0x0000000000000004ULL /* allow creat, mkdir, unlink etc */29#define PLEDGE_CPATH 0x0000000000000004ULL /* allow creat, mkdir, unlink etc */
30#define PLEDGE_STDIO 0x0000000000000008ULL /* operate on own pid */30#define PLEDGE_STDIO 0x0000000000000008ULL /* operate on own pid */
31#define PLEDGE_TMPPATH 0x0000000000000010ULL /* for mk*temp() */
32#define PLEDGE_DNS 0x0000000000000020ULL /* DNS services */31#define PLEDGE_DNS 0x0000000000000020ULL /* DNS services */
33#define PLEDGE_INET 0x0000000000000040ULL /* AF_INET/AF_INET6 sockets */32#define PLEDGE_INET 0x0000000000000040ULL /* AF_INET/AF_INET6 sockets */
34#define PLEDGE_FLOCK 0x0000000000000080ULL /* file locking */33#define PLEDGE_FLOCK 0x0000000000000080ULL /* file locking */
...@@ -78,7 +77,6 @@ static const struct {...@@ -78,7 +77,6 @@ static const struct {
78 { PLEDGE_WPATH, "wpath" },77 { PLEDGE_WPATH, "wpath" },
79 { PLEDGE_CPATH, "cpath" },78 { PLEDGE_CPATH, "cpath" },
80 { PLEDGE_DPATH, "dpath" },79 { PLEDGE_DPATH, "dpath" },
81 { PLEDGE_TMPPATH, "tmppath" },
82 { PLEDGE_INET, "inet" },80 { PLEDGE_INET, "inet" },
83 { PLEDGE_MCAST, "mcast" },81 { PLEDGE_MCAST, "mcast" },
84 { PLEDGE_FATTR, "fattr" },82 { PLEDGE_FATTR, "fattr" },
lib/libc/include/generic-openbsd/sys/protosw.h+8-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: protosw.h,v 1.72 2025/03/02 21:28:32 bluhm Exp $ */1/* $OpenBSD: protosw.h,v 1.73 2025/10/24 15:09:56 bluhm Exp $ */
2/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */2/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
33
4/*-4/*-
...@@ -86,6 +86,7 @@ struct pr_usrreqs {...@@ -86,6 +86,7 @@ struct pr_usrreqs {
86 struct mbuf *);86 struct mbuf *);
87 int (*pru_sockaddr)(struct socket *, struct mbuf *);87 int (*pru_sockaddr)(struct socket *, struct mbuf *);
88 int (*pru_peeraddr)(struct socket *, struct mbuf *);88 int (*pru_peeraddr)(struct socket *, struct mbuf *);
89 int (*pru_flowid)(struct socket *);
89 int (*pru_connect2)(struct socket *, struct socket *);90 int (*pru_connect2)(struct socket *, struct socket *);
90};91};
9192
...@@ -394,6 +395,12 @@ pru_peeraddr(struct socket *so, struct mbuf *addr)...@@ -394,6 +395,12 @@ pru_peeraddr(struct socket *so, struct mbuf *addr)
394 return (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, addr);395 return (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, addr);
395}396}
396397
398static inline int
399pru_flowid(struct socket *so)
400{
401 return (*so->so_proto->pr_usrreqs->pru_flowid)(so);
402}
403
397static inline int404static inline int
398pru_connect2(struct socket *so1, struct socket *so2)405pru_connect2(struct socket *so1, struct socket *so2)
399{406{
lib/libc/include/generic-openbsd/sys/ptrace.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ptrace.h,v 1.16 2020/03/16 11:58:46 mpi Exp $ */1/* $OpenBSD: ptrace.h,v 1.17 2025/12/11 14:13:18 kurt Exp $ */
2/* $NetBSD: ptrace.h,v 1.21 1996/02/09 18:25:26 christos Exp $ */2/* $NetBSD: ptrace.h,v 1.21 1996/02/09 18:25:26 christos Exp $ */
33
4/*-4/*-
...@@ -82,8 +82,11 @@ typedef struct ptrace_state {...@@ -82,8 +82,11 @@ typedef struct ptrace_state {
82#define PT_GET_THREAD_FIRST 1582#define PT_GET_THREAD_FIRST 15
83#define PT_GET_THREAD_NEXT 1683#define PT_GET_THREAD_NEXT 16
8484
85#define PT_PTS_NAMELEN 32
86
85struct ptrace_thread_state {87struct ptrace_thread_state {
86 pid_t pts_tid;88 pid_t pts_tid;
89 char pts_name[PT_PTS_NAMELEN];
87};90};
8891
89#define PT_FIRSTMACH 32 /* for machine-specific requests */92#define PT_FIRSTMACH 32 /* for machine-specific requests */
lib/libc/include/generic-openbsd/sys/sched.h+8-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sched.h,v 1.77 2025/06/09 10:57:46 claudio Exp $ */1/* $OpenBSD: sched.h,v 1.78 2026/03/31 16:46:21 deraadt Exp $ */
2/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */2/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
33
4/*-4/*-
...@@ -179,8 +179,15 @@ void sched_barrier(struct cpu_info *ci);...@@ -179,8 +179,15 @@ void sched_barrier(struct cpu_info *ci);
179int sysctl_hwsetperf(void *, size_t *, void *, size_t);179int sysctl_hwsetperf(void *, size_t *, void *, size_t);
180int sysctl_hwperfpolicy(void *, size_t *, void *, size_t);180int sysctl_hwperfpolicy(void *, size_t *, void *, size_t);
181int sysctl_hwsmt(void *, size_t *, void *, size_t);181int sysctl_hwsmt(void *, size_t *, void *, size_t);
182int sysctl_hwblockcpu(void *, size_t *, void *, size_t);
182int sysctl_hwncpuonline(void);183int sysctl_hwncpuonline(void);
183184
185#define CPUTYP_SMT 0x01 /* SMT cpu */
186#define CPUTYP_P 0x02 /* Performance core */
187#define CPUTYP_E 0x04 /* Efficiency core */
188#define CPUTYP_L 0x08 /* Lethargic, Low Power Efficiency core */
189extern int sched_blockcpu;
190
184#ifdef MULTIPROCESSOR191#ifdef MULTIPROCESSOR
185void sched_start_secondary_cpus(void);192void sched_start_secondary_cpus(void);
186void sched_stop_secondary_cpus(void);193void sched_stop_secondary_cpus(void);
lib/libc/include/generic-openbsd/sys/signal.h+4-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: signal.h,v 1.29 2018/04/18 16:05:20 deraadt Exp $ */1/* $OpenBSD: signal.h,v 1.30 2026/03/21 01:56:51 daniel Exp $ */
2/* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */2/* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */
33
4/*4/*
...@@ -80,8 +80,10 @@...@@ -80,8 +80,10 @@
80#define SIGXFSZ 25 /* exceeded file size limit */80#define SIGXFSZ 25 /* exceeded file size limit */
81#define SIGVTALRM 26 /* virtual time alarm */81#define SIGVTALRM 26 /* virtual time alarm */
82#define SIGPROF 27 /* profiling time alarm */82#define SIGPROF 27 /* profiling time alarm */
83#if __BSD_VISIBLE83#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405
84#define SIGWINCH 28 /* window size changes */84#define SIGWINCH 28 /* window size changes */
85#endif
86#if __BSD_VISIBLE
85#define SIGINFO 29 /* information request */87#define SIGINFO 29 /* information request */
86#endif88#endif
87#define SIGUSR1 30 /* user defined signal 1 */89#define SIGUSR1 30 /* user defined signal 1 */
lib/libc/include/generic-openbsd/sys/socketvar.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: socketvar.h,v 1.159 2025/07/25 08:58:44 mvs Exp $ */1/* $OpenBSD: socketvar.h,v 1.160 2025/10/24 15:09:56 bluhm Exp $ */
2/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */2/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
33
4/*-4/*-
...@@ -74,6 +74,7 @@ struct sosplice {...@@ -74,6 +74,7 @@ struct sosplice {
74 struct timeval ssp_idletv; /* [I] idle timeout */74 struct timeval ssp_idletv; /* [I] idle timeout */
75 struct timeout ssp_idleto;75 struct timeout ssp_idleto;
76 struct task ssp_task; /* task for somove */76 struct task ssp_task; /* task for somove */
77 struct taskq *ssp_queue; /* [I] softnet queue where we add */
77};78};
7879
79/*80/*
lib/libc/include/generic-openbsd/sys/sockio.h+11-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sockio.h,v 1.84 2021/11/11 10:03:10 claudio Exp $ */1/* $OpenBSD: sockio.h,v 1.86 2025/11/21 04:44:26 dlg Exp $ */
2/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */2/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */
33
4/*-4/*-
...@@ -75,7 +75,11 @@...@@ -75,7 +75,11 @@
75#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */75#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */
7676
77#define SIOCBRDGADD _IOW('i', 60, struct ifbreq) /* add bridge ifs */77#define SIOCBRDGADD _IOW('i', 60, struct ifbreq) /* add bridge ifs */
78#define SIOCBRDGADDPV _IOW('i', 60, struct ifbrpvlan) /* add pvlan */
79#define SIOCBRDGFINDPV _IOWR('i', 60, struct ifbrpvlan) /* find pvlan */
78#define SIOCBRDGDEL _IOW('i', 61, struct ifbreq) /* del bridge ifs */80#define SIOCBRDGDEL _IOW('i', 61, struct ifbreq) /* del bridge ifs */
81#define SIOCBRDGDELPV _IOW('i', 61, struct ifbrpvlan) /* del pvlan */
82#define SIOCBRDGNFINDPV _IOWR('i', 61, struct ifbrpvlan) /* nfind pvlan */
79#define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */83#define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */
80#define SIOCBRDGSIFFLGS _IOW('i', 63, struct ifbreq) /* set brdg if flags */84#define SIOCBRDGSIFFLGS _IOW('i', 63, struct ifbreq) /* set brdg if flags */
81#define SIOCBRDGSCACHE _IOW('i', 64, struct ifbrparam)/* set cache size */85#define SIOCBRDGSCACHE _IOW('i', 64, struct ifbrparam)/* set cache size */
...@@ -85,12 +89,17 @@...@@ -85,12 +89,17 @@
85#define SIOCBRDGDELS _IOW('i', 66, struct ifbreq) /* del span port */89#define SIOCBRDGDELS _IOW('i', 66, struct ifbreq) /* del span port */
86#define SIOCBRDGRTS _IOWR('i', 67, struct ifbaconf) /* get addresses */90#define SIOCBRDGRTS _IOWR('i', 67, struct ifbaconf) /* get addresses */
87#define SIOCBRDGSADDR _IOWR('i', 68, struct ifbareq) /* set addr flags */91#define SIOCBRDGSADDR _IOWR('i', 68, struct ifbareq) /* set addr flags */
92#define SIOCBRDGSVADDR _IOW('i', 68, struct ifbvareq) /* add addr@vid */
88#define SIOCBRDGSTO _IOW('i', 69, struct ifbrparam)/* cache timeout */93#define SIOCBRDGSTO _IOW('i', 69, struct ifbrparam)/* cache timeout */
89#define SIOCBRDGGTO _IOWR('i', 70, struct ifbrparam)/* cache timeout */94#define SIOCBRDGGTO _IOWR('i', 70, struct ifbrparam)/* cache timeout */
90#define SIOCBRDGDADDR _IOW('i', 71, struct ifbareq) /* delete addr */95#define SIOCBRDGDADDR _IOW('i', 71, struct ifbareq) /* delete addr */
96#define SIOCBRDGDVADDR _IOW('i', 71, struct ifbvareq) /* delete addr@vid */
91#define SIOCBRDGFLUSH _IOW('i', 72, struct ifbreq) /* flush addr cache */97#define SIOCBRDGFLUSH _IOW('i', 72, struct ifbreq) /* flush addr cache */
92#define SIOCBRDGADDL _IOW('i', 73, struct ifbreq) /* add local port */98#define SIOCBRDGADDL _IOW('i', 73, struct ifbreq) /* add local port */
93#define SIOCBRDGSIFPROT _IOW('i', 74, struct ifbreq) /* set protected grp */99#define SIOCBRDGSIFPROT _IOW('i', 74, struct ifbreq) /* set protected grp */
100#define SIOCBRDGSPVID _IOW('i', 76, struct ifbreq) /* set pvid */
101#define SIOCBRDGSVMAP _IOW('i', 76, struct ifbrvidmap) /* set vid map */
102#define SIOCBRDGGVMAP _IOWR('i', 76, struct ifbrvidmap) /* get vid map */
94103
95#define SIOCBRDGARL _IOW('i', 77, struct ifbrlreq) /* add bridge rule */104#define SIOCBRDGARL _IOW('i', 77, struct ifbrlreq) /* add bridge rule */
96#define SIOCBRDGFRL _IOW('i', 78, struct ifbrlreq) /* flush brdg rules */105#define SIOCBRDGFRL _IOW('i', 78, struct ifbrlreq) /* flush brdg rules */
...@@ -105,6 +114,7 @@...@@ -105,6 +114,7 @@
105#define SIOCBRDGSMA _IOW('i', 83, struct ifbrparam)/* set max age */114#define SIOCBRDGSMA _IOW('i', 83, struct ifbrparam)/* set max age */
106#define SIOCBRDGSIFPRIO _IOW('i', 84, struct ifbreq) /* set if priority */115#define SIOCBRDGSIFPRIO _IOW('i', 84, struct ifbreq) /* set if priority */
107#define SIOCBRDGSIFCOST _IOW('i', 85, struct ifbreq) /* set if cost */116#define SIOCBRDGSIFCOST _IOW('i', 85, struct ifbreq) /* set if cost */
117#define SIOCBRDGVRTS _IOWR('i', 86, struct ifbaconf) /* get vaddresses */
108118
109#define SIOCBRDGGPARAM _IOWR('i', 88, struct ifbropreq)/* get brdg STP parms */119#define SIOCBRDGGPARAM _IOWR('i', 88, struct ifbropreq)/* get brdg STP parms */
110#define SIOCBRDGSTXHC _IOW('i', 89, struct ifbrparam)/* set tx hold count */120#define SIOCBRDGSTXHC _IOW('i', 89, struct ifbrparam)/* set tx hold count */
lib/libc/include/generic-openbsd/sys/syscall.h+5-3
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1/* $OpenBSD: syscall.h,v 1.283 2025/05/24 06:50:02 deraadt Exp $ */1/* $OpenBSD: syscall.h,v 1.284 2026/03/08 16:41:35 deraadt Exp $ */
22
3/*3/*
4 * System call numbers.4 * System call numbers.
5 *5 *
6 * DO NOT EDIT-- this file is automatically generated.6 * DO NOT EDIT-- this file is automatically generated.
7 * created from; OpenBSD: syscalls.master,v 1.270 2025/05/24 06:49:16 deraadt Exp 7 * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp
8 */8 */
99
10/* syscall: "exit" ret: "void" args: "int" */10/* syscall: "exit" ret: "void" args: "int" */
...@@ -371,7 +371,9 @@...@@ -371,7 +371,9 @@
371/* syscall: "fchmod" ret: "int" args: "int" "mode_t" */371/* syscall: "fchmod" ret: "int" args: "int" "mode_t" */
372#define SYS_fchmod 124372#define SYS_fchmod 124
373373
374 /* 125 is obsolete orecvfrom */374/* syscall: "__pledge_open" ret: "int" args: "const char *" "int" "..." "mode_t" */
375#define SYS___pledge_open 125
376
375/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */377/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */
376#define SYS_setreuid 126378#define SYS_setreuid 126
377379
lib/libc/include/generic-openbsd/sys/syscallargs.h+9-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1/* $OpenBSD: syscallargs.h,v 1.286 2025/05/24 06:50:02 deraadt Exp $ */1/* $OpenBSD: syscallargs.h,v 1.287 2026/03/08 16:41:35 deraadt Exp $ */
22
3/*3/*
4 * System call argument lists.4 * System call argument lists.
5 *5 *
6 * DO NOT EDIT-- this file is automatically generated.6 * DO NOT EDIT-- this file is automatically generated.
7 * created from; OpenBSD: syscalls.master,v 1.270 2025/05/24 06:49:16 deraadt Exp 7 * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp
8 */8 */
99
10#ifdef syscallarg10#ifdef syscallarg
...@@ -640,6 +640,12 @@ struct sys_fchmod_args {...@@ -640,6 +640,12 @@ struct sys_fchmod_args {
640 syscallarg(mode_t) mode;640 syscallarg(mode_t) mode;
641};641};
642642
643struct sys___pledge_open_args {
644 syscallarg(const char *) path;
645 syscallarg(int) flags;
646 syscallarg(mode_t) mode;
647};
648
643struct sys_setreuid_args {649struct sys_setreuid_args {
644 syscallarg(uid_t) ruid;650 syscallarg(uid_t) ruid;
645 syscallarg(uid_t) euid;651 syscallarg(uid_t) euid;
...@@ -1291,6 +1297,7 @@ int sys_writev(struct proc *, void *, register_t *);...@@ -1291,6 +1297,7 @@ int sys_writev(struct proc *, void *, register_t *);
1291int sys_kill(struct proc *, void *, register_t *);1297int sys_kill(struct proc *, void *, register_t *);
1292int sys_fchown(struct proc *, void *, register_t *);1298int sys_fchown(struct proc *, void *, register_t *);
1293int sys_fchmod(struct proc *, void *, register_t *);1299int sys_fchmod(struct proc *, void *, register_t *);
1300int sys___pledge_open(struct proc *, void *, register_t *);
1294int sys_setreuid(struct proc *, void *, register_t *);1301int sys_setreuid(struct proc *, void *, register_t *);
1295int sys_setregid(struct proc *, void *, register_t *);1302int sys_setregid(struct proc *, void *, register_t *);
1296int sys_rename(struct proc *, void *, register_t *);1303int sys_rename(struct proc *, void *, register_t *);
lib/libc/include/generic-openbsd/sys/sysctl.h+7-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sysctl.h,v 1.246 2025/07/31 09:05:11 mvs Exp $ */1/* $OpenBSD: sysctl.h,v 1.248 2026/04/16 14:47:24 deraadt Exp $ */
2/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */2/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
33
4/*4/*
...@@ -684,7 +684,6 @@ do { \...@@ -684,7 +684,6 @@ do { \
684 (kp)->p_vm_dsize = (vm)->vm_dused; \684 (kp)->p_vm_dsize = (vm)->vm_dused; \
685 (kp)->p_vm_ssize = (vm)->vm_ssize; \685 (kp)->p_vm_ssize = (vm)->vm_ssize; \
686 } \686 } \
687 (kp)->p_addr = PTRTOINT64((p)->p_addr); \
688 (kp)->p_stat = (p)->p_stat; \687 (kp)->p_stat = (p)->p_stat; \
689 (kp)->p_slptime = (p)->p_slptime; \688 (kp)->p_slptime = (p)->p_slptime; \
690 (kp)->p_holdcnt = 1; \689 (kp)->p_holdcnt = 1; \
...@@ -693,8 +692,10 @@ do { \...@@ -693,8 +692,10 @@ do { \
693 if ((p)->p_wchan && (p)->p_wmesg) \692 if ((p)->p_wchan && (p)->p_wmesg) \
694 copy_str((kp)->p_wmesg, (p)->p_wmesg, \693 copy_str((kp)->p_wmesg, (p)->p_wmesg, \
695 sizeof((kp)->p_wmesg)); \694 sizeof((kp)->p_wmesg)); \
696 if (show_addresses) \695 if (show_addresses) { \
697 (kp)->p_wchan = PTRTOINT64((p)->p_wchan); \696 (kp)->p_wchan = PTRTOINT64((p)->p_wchan); \
697 (kp)->p_addr = PTRTOINT64((p)->p_addr); \
698 } \
698 } \699 } \
699 \700 \
700 if (((pr)->ps_flags & PS_ZOMBIE) == 0) { \701 if (((pr)->ps_flags & PS_ZOMBIE) == 0) { \
...@@ -926,7 +927,8 @@ struct kinfo_file {...@@ -926,7 +927,8 @@ struct kinfo_file {
926#define HW_POWER 26 /* int: machine has wall-power */927#define HW_POWER 26 /* int: machine has wall-power */
927#define HW_BATTERY 27 /* node: battery */928#define HW_BATTERY 27 /* node: battery */
928#define HW_UCOMNAMES 28 /* strings: ucom names */929#define HW_UCOMNAMES 28 /* strings: ucom names */
929#define HW_MAXID 29 /* number of valid hw ids */930#define HW_BLOCKCPU 29 /* string: cpu types to block */
931#define HW_MAXID 30 /* number of valid hw ids */
930932
931#define CTL_HW_NAMES { \933#define CTL_HW_NAMES { \
932 { 0, 0 }, \934 { 0, 0 }, \
...@@ -958,6 +960,7 @@ struct kinfo_file {...@@ -958,6 +960,7 @@ struct kinfo_file {
958 { "power", CTLTYPE_INT }, \960 { "power", CTLTYPE_INT }, \
959 { "battery", CTLTYPE_NODE }, \961 { "battery", CTLTYPE_NODE }, \
960 { "ucomnames", CTLTYPE_STRING }, \962 { "ucomnames", CTLTYPE_STRING }, \
963 { "blockcpu", CTLTYPE_STRING }, \
961}964}
962965
963/*966/*
lib/libc/include/generic-openbsd/sys/types.h+6-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: types.h,v 1.49 2022/08/06 13:31:13 semarie Exp $ */1/* $OpenBSD: types.h,v 1.50 2026/03/26 21:46:24 daniel Exp $ */
2/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */2/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
33
4/*-4/*-
...@@ -140,7 +140,6 @@ typedef __gid_t gid_t; /* group id */...@@ -140,7 +140,6 @@ typedef __gid_t gid_t; /* group id */
140typedef __id_t id_t; /* may contain pid, uid or gid */140typedef __id_t id_t; /* may contain pid, uid or gid */
141typedef __ino_t ino_t; /* inode number */141typedef __ino_t ino_t; /* inode number */
142typedef __key_t key_t; /* IPC key (for Sys V IPC) */142typedef __key_t key_t; /* IPC key (for Sys V IPC) */
143typedef __mode_t mode_t; /* permissions */
144typedef __nlink_t nlink_t; /* link count */143typedef __nlink_t nlink_t; /* link count */
145typedef __rlim_t rlim_t; /* resource limit */144typedef __rlim_t rlim_t; /* resource limit */
146typedef __segsz_t segsz_t; /* segment size */145typedef __segsz_t segsz_t; /* segment size */
...@@ -193,6 +192,11 @@ typedef __timer_t timer_t;...@@ -193,6 +192,11 @@ typedef __timer_t timer_t;
193typedef __off_t off_t;192typedef __off_t off_t;
194#endif193#endif
195194
195#ifndef _MODE_T_DEFINED_
196#define _MODE_T_DEFINED_
197typedef __mode_t mode_t; /* permissions */
198#endif
199
196/*200/*
197 * These belong in unistd.h, but are placed here too to ensure that201 * These belong in unistd.h, but are placed here too to ensure that
198 * long arguments will be promoted to off_t if the program fails to202 * long arguments will be promoted to off_t if the program fails to
lib/libc/include/generic-openbsd/sys/videoio.h+143-68
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: videoio.h,v 1.26 2025/08/02 09:27:59 kirill Exp $ */1/* $OpenBSD: videoio.h,v 1.29 2026/02/19 20:42:45 kirill Exp $ */
22
3/*3/*
4 * Video for Linux Two header file4 * Video for Linux Two header file
...@@ -54,7 +54,7 @@...@@ -54,7 +54,7 @@
54 *54 *
55 * Author: Bill Dirks <bill@thedirks.org>55 * Author: Bill Dirks <bill@thedirks.org>
56 * Justin Schoeman56 * Justin Schoeman
57 * Hans Verkuil <hverkuil@xs4all.nl>57 * Hans Verkuil <hverkuil@kernel.org>
58 * et al.58 * et al.
59 */59 */
6060
...@@ -343,6 +343,12 @@ enum v4l2_colorfx {...@@ -343,6 +343,12 @@ enum v4l2_colorfx {
343 */343 */
344#define V4L2_CID_USER_RKISP1_BASE (V4L2_CID_USER_BASE + 0x1220)344#define V4L2_CID_USER_RKISP1_BASE (V4L2_CID_USER_BASE + 0x1220)
345345
346/*
347 * The base for the Arm Mali-C55 ISP driver controls.
348 * We reserve 16 controls for this driver
349 */
350#define V4L2_CID_USER_MALI_C55_BASE (V4L2_CID_USER_BASE + 0x1230)
351
346/* MPEG-class control IDs */352/* MPEG-class control IDs */
347/* The MPEG controls are applicable to all codec controls353/* The MPEG controls are applicable to all codec controls
348 * and the 'MPEG' part of the define is historical */354 * and the 'MPEG' part of the define is historical */
...@@ -1299,6 +1305,8 @@ enum v4l2_flash_strobe_source {...@@ -1299,6 +1305,8 @@ enum v4l2_flash_strobe_source {
12991305
1300#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)1306#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1301#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)1307#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1308#define V4L2_CID_FLASH_DURATION (V4L2_CID_FLASH_CLASS_BASE + 13)
1309#define V4L2_CID_FLASH_STROBE_OE (V4L2_CID_FLASH_CLASS_BASE + 14)
13021310
13031311
1304/* JPEG-class control IDs */1312/* JPEG-class control IDs */
...@@ -1306,7 +1314,7 @@ enum v4l2_flash_strobe_source {...@@ -1306,7 +1314,7 @@ enum v4l2_flash_strobe_source {
1306#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)1314#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1307#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)1315#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
13081316
1309#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)1317#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1310enum v4l2_jpeg_chroma_subsampling {1318enum v4l2_jpeg_chroma_subsampling {
1311 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,1319 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1312 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,1320 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
...@@ -1315,15 +1323,15 @@ enum v4l2_jpeg_chroma_subsampling {...@@ -1315,15 +1323,15 @@ enum v4l2_jpeg_chroma_subsampling {
1315 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,1323 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1316 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,1324 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1317};1325};
1318#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)1326#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1319#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)1327#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
13201328
1321#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)1329#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1322#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)1330#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1323#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)1331#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1324#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)1332#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1325#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)1333#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1326#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)1334#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
13271335
13281336
1329/* Image source controls */1337/* Image source controls */
...@@ -1356,10 +1364,10 @@ enum v4l2_jpeg_chroma_subsampling {...@@ -1356,10 +1364,10 @@ enum v4l2_jpeg_chroma_subsampling {
1356#define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)1364#define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
1357#define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1)1365#define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1)
13581366
1359#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1)1367#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1)
1360#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2)1368#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2)
1361#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3)1369#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3)
1362#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4)1370#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4)
1363enum v4l2_dv_tx_mode {1371enum v4l2_dv_tx_mode {
1364 V4L2_DV_TX_MODE_DVI_D = 0,1372 V4L2_DV_TX_MODE_DVI_D = 0,
1365 V4L2_DV_TX_MODE_HDMI = 1,1373 V4L2_DV_TX_MODE_HDMI = 1,
...@@ -1380,7 +1388,7 @@ enum v4l2_dv_it_content_type {...@@ -1380,7 +1388,7 @@ enum v4l2_dv_it_content_type {
1380 V4L2_DV_IT_CONTENT_TYPE_NO_ITC = 4,1388 V4L2_DV_IT_CONTENT_TYPE_NO_ITC = 4,
1381};1389};
13821390
1383#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)1391#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
1384#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)1392#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)
1385#define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102)1393#define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102)
13861394
...@@ -1650,15 +1658,6 @@ struct v4l2_ctrl_h264_pred_weights {...@@ -1650,15 +1658,6 @@ struct v4l2_ctrl_h264_pred_weights {
1650 struct v4l2_h264_weight_factors weight_factors[2];1658 struct v4l2_h264_weight_factors weight_factors[2];
1651};1659};
16521660
1653#define V4L2_H264_SLICE_TYPE_P 0
1654#define V4L2_H264_SLICE_TYPE_B 1
1655#define V4L2_H264_SLICE_TYPE_I 2
1656#define V4L2_H264_SLICE_TYPE_SP 3
1657#define V4L2_H264_SLICE_TYPE_SI 4
1658
1659#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01
1660#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02
1661
1662#define V4L2_H264_TOP_FIELD_REF 0x11661#define V4L2_H264_TOP_FIELD_REF 0x1
1663#define V4L2_H264_BOTTOM_FIELD_REF 0x21662#define V4L2_H264_BOTTOM_FIELD_REF 0x2
1664#define V4L2_H264_FRAME_REF 0x31663#define V4L2_H264_FRAME_REF 0x3
...@@ -1679,8 +1678,17 @@ struct v4l2_h264_reference {...@@ -1679,8 +1678,17 @@ struct v4l2_h264_reference {
1679 * Maximum DPB size, as specified by section 'A.3.1 Level limits1678 * Maximum DPB size, as specified by section 'A.3.1 Level limits
1680 * common to the Baseline, Main, and Extended profiles'.1679 * common to the Baseline, Main, and Extended profiles'.
1681 */1680 */
1682#define V4L2_H264_NUM_DPB_ENTRIES 161681#define V4L2_H264_NUM_DPB_ENTRIES 16
1683#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES)1682#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES)
1683
1684#define V4L2_H264_SLICE_TYPE_P 0
1685#define V4L2_H264_SLICE_TYPE_B 1
1686#define V4L2_H264_SLICE_TYPE_I 2
1687#define V4L2_H264_SLICE_TYPE_SP 3
1688#define V4L2_H264_SLICE_TYPE_SI 4
1689
1690#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01
1691#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02
16841692
1685#define V4L2_CID_STATELESS_H264_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 6)1693#define V4L2_CID_STATELESS_H264_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 6)
1686/**1694/**
...@@ -1820,7 +1828,6 @@ struct v4l2_ctrl_h264_decode_params {...@@ -1820,7 +1828,6 @@ struct v4l2_ctrl_h264_decode_params {
1820 u_int32_t flags;1828 u_int32_t flags;
1821};1829};
18221830
1823
1824/* Stateless FWHT control, used by the vicodec driver */1831/* Stateless FWHT control, used by the vicodec driver */
18251832
1826/* Current FWHT version */1833/* Current FWHT version */
...@@ -2207,6 +2214,8 @@ struct v4l2_ctrl_mpeg2_quantisation {...@@ -2207,6 +2214,8 @@ struct v4l2_ctrl_mpeg2_quantisation {
2207#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405)2214#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405)
2208#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406)2215#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406)
2209#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407)2216#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407)
2217#define V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS (V4L2_CID_CODEC_STATELESS_BASE + 408)
2218#define V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS (V4L2_CID_CODEC_STATELESS_BASE + 409)
22102219
2211enum v4l2_stateless_hevc_decode_mode {2220enum v4l2_stateless_hevc_decode_mode {
2212 V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,2221 V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
...@@ -2662,44 +2671,69 @@ struct v4l2_ctrl_hevc_scaling_matrix {...@@ -2662,44 +2671,69 @@ struct v4l2_ctrl_hevc_scaling_matrix {
2662 u_int8_t scaling_list_dc_coef_32x32[2];2671 u_int8_t scaling_list_dc_coef_32x32[2];
2663};2672};
26642673
2665#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900)2674#define V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED 0x1
2666#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1)
26672675
2668#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)2676/*
26692677 * struct v4l2_ctrl_hevc_ext_sps_st_rps - HEVC short term RPS parameters
2670struct v4l2_ctrl_hdr10_cll_info {2678 *
2671 u_int16_t max_content_light_level;2679 * Dynamic size 1-dimension array for short term RPS. The number of elements
2672 u_int16_t max_pic_average_light_level;2680 * is v4l2_ctrl_hevc_sps::num_short_term_ref_pic_sets. It can contain up to 65 elements.
2673};2681 *
26742682 * @delta_idx_minus1: Specifies the delta compare to the index. See details in section 7.4.8
2675#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE + 1)2683 * "Short-term reference picture set semantics" of the specification.
26762684 * @delta_rps_sign: Sign of the delta as specified in section 7.4.8 "Short-term reference picture
2677#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW 52685 * set semantics" of the specification.
2678#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH 370002686 * @abs_delta_rps_minus1: Absolute delta RPS as specified in section 7.4.8 "Short-term reference
2679#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW 52687 * picture set semantics" of the specification.
2680#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH 420002688 * @num_negative_pics: Number of short-term RPS entries that have picture order count values less
2681#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 52689 * than the picture order count value of the current picture.
2682#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH 370002690 * @num_positive_pics: Number of short-term RPS entries that have picture order count values
2683#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 52691 * greater than the picture order count value of the current picture.
2684#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH 420002692 * @used_by_curr_pic: Bit j specifies if short-term RPS j is used by the current picture.
2685#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW 500002693 * @use_delta_flag: Bit j equals to 1 specifies that the j-th entry in the source candidate
2686#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH 1000000002694 * short-term RPS is included in this candidate short-term RPS.
2687#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW 12695 * @delta_poc_s0_minus1: Specifies the negative picture order count delta for the i-th entry in
2688#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH 500002696 * the short-term RPS. See details in section 7.4.8 "Short-term reference
2697 * picture set semantics" of the specification.
2698 * @delta_poc_s1_minus1: Specifies the positive picture order count delta for the i-th entry in
2699 * the short-term RPS. See details in section 7.4.8 "Short-term reference
2700 * picture set semantics" of the specification.
2701 * @flags: See V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_{}
2702 */
2703struct v4l2_ctrl_hevc_ext_sps_st_rps {
2704 u_int8_t delta_idx_minus1;
2705 u_int8_t delta_rps_sign;
2706 u_int8_t num_negative_pics;
2707 u_int8_t num_positive_pics;
2708 u_int32_t used_by_curr_pic;
2709 u_int32_t use_delta_flag;
2710 u_int16_t abs_delta_rps_minus1;
2711 u_int16_t delta_poc_s0_minus1[16];
2712 u_int16_t delta_poc_s1_minus1[16];
2713 u_int16_t flags;
2714};
2715
2716#define V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT 0x1
26892717
2690struct v4l2_ctrl_hdr10_mastering_display {2718/*
2691 u_int16_t display_primaries_x[3];2719 * struct v4l2_ctrl_hevc_ext_sps_lt_rps - HEVC long term RPS parameters
2692 u_int16_t display_primaries_y[3];2720 *
2693 u_int16_t white_point_x;2721 * Dynamic size 1-dimension array for long term RPS. The number of elements
2694 u_int16_t white_point_y;2722 * is v4l2_ctrl_hevc_sps::num_long_term_ref_pics_sps. It can contain up to 65 elements.
2695 u_int32_t max_display_mastering_luminance;2723 *
2696 u_int32_t min_display_mastering_luminance;2724 * @lt_ref_pic_poc_lsb_sps: picture order count modulo MaxPicOrderCntLsb of the i-th candidate
2725 * long-term reference picture.
2726 * @flags: See V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_{}
2727 */
2728struct v4l2_ctrl_hevc_ext_sps_lt_rps {
2729 u_int16_t lt_ref_pic_poc_lsb_sps;
2730 u_int16_t flags;
2697};2731};
26982732
2699/* Stateless VP9 controls */2733/* Stateless VP9 controls */
27002734
2701#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x12735#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x1
2702#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE 0x22736#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE 0x2
27032737
2704/**2738/**
2705 * struct v4l2_vp9_loop_filter - VP9 loop filter parameters2739 * struct v4l2_vp9_loop_filter - VP9 loop filter parameters
...@@ -3625,6 +3659,40 @@ struct v4l2_ctrl_av1_film_grain {...@@ -3625,6 +3659,40 @@ struct v4l2_ctrl_av1_film_grain {
3625#define V4L2_CID_MPEG_BASE V4L2_CID_CODEC_BASE3659#define V4L2_CID_MPEG_BASE V4L2_CID_CODEC_BASE
3626#define V4L2_CID_MPEG_CX2341X_BASE V4L2_CID_CODEC_CX2341X_BASE3660#define V4L2_CID_MPEG_CX2341X_BASE V4L2_CID_CODEC_CX2341X_BASE
3627#define V4L2_CID_MPEG_MFC51_BASE V4L2_CID_CODEC_MFC51_BASE3661#define V4L2_CID_MPEG_MFC51_BASE V4L2_CID_CODEC_MFC51_BASE
3662#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
3663#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1)
3664
3665#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)
3666
3667struct v4l2_ctrl_hdr10_cll_info {
3668 u_int16_t max_content_light_level;
3669 u_int16_t max_pic_average_light_level;
3670};
3671
3672#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE + 1)
3673
3674#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW 5
3675#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH 37000
3676#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW 5
3677#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH 42000
3678#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 5
3679#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH 37000
3680#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 5
3681#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH 42000
3682#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW 50000
3683#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH 100000000
3684#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW 1
3685#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH 50000
3686
3687struct v4l2_ctrl_hdr10_mastering_display {
3688 u_int16_t display_primaries_x[3];
3689 u_int16_t display_primaries_y[3];
3690 u_int16_t white_point_x;
3691 u_int16_t white_point_y;
3692 u_int32_t max_display_mastering_luminance;
3693 u_int32_t min_display_mastering_luminance;
3694};
3695
3628/*3696/*
3629 * End of v4l2-controls.h3697 * End of v4l2-controls.h
3630 */3698 */
...@@ -4316,6 +4384,7 @@ struct v4l2_pix_format {...@@ -4316,6 +4384,7 @@ struct v4l2_pix_format {
4316#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */4384#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
4317#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */4385#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
4318#define V4L2_PIX_FMT_AV1_FRAME v4l2_fourcc('A', 'V', '1', 'F') /* AV1 parsed frame */4386#define V4L2_PIX_FMT_AV1_FRAME v4l2_fourcc('A', 'V', '1', 'F') /* AV1 parsed frame */
4387#define V4L2_PIX_FMT_AV1 v4l2_fourcc('A', 'V', '0', '1') /* AV1 */
4319#define V4L2_PIX_FMT_SPK v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */4388#define V4L2_PIX_FMT_SPK v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */
4320#define V4L2_PIX_FMT_RV30 v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */4389#define V4L2_PIX_FMT_RV30 v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */
4321#define V4L2_PIX_FMT_RV40 v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */4390#define V4L2_PIX_FMT_RV40 v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */
...@@ -4425,6 +4494,10 @@ struct v4l2_pix_format {...@@ -4425,6 +4494,10 @@ struct v4l2_pix_format {
4425#define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C') /* PiSP FE configuration */4494#define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C') /* PiSP FE configuration */
4426#define V4L2_META_FMT_RPI_FE_STATS v4l2_fourcc('R', 'P', 'F', 'S') /* PiSP FE stats */4495#define V4L2_META_FMT_RPI_FE_STATS v4l2_fourcc('R', 'P', 'F', 'S') /* PiSP FE stats */
44274496
4497/* Vendor specific - used for Arm Mali-C55 ISP */
4498#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P') /* ARM Mali-C55 Parameters */
4499#define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S') /* ARM Mali-C55 3A Statistics */
4500
4428/* priv field value to indicates that subsequent fields are valid. */4501/* priv field value to indicates that subsequent fields are valid. */
4429#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe4502#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
44304503
...@@ -5108,8 +5181,8 @@ struct v4l2_bt_timings {...@@ -5108,8 +5181,8 @@ struct v4l2_bt_timings {
5108} __attribute__ ((packed));5181} __attribute__ ((packed));
51095182
5110/* Interlaced or progressive format */5183/* Interlaced or progressive format */
5111#define V4L2_DV_PROGRESSIVE 05184#define V4L2_DV_PROGRESSIVE 0
5112#define V4L2_DV_INTERLACED 15185#define V4L2_DV_INTERLACED 1
51135186
5114/* Polarities. If bit is not set, it is assumed to be negative polarity */5187/* Polarities. If bit is not set, it is assumed to be negative polarity */
5115#define V4L2_DV_VSYNC_POS_POL 0x000000015188#define V4L2_DV_VSYNC_POS_POL 0x00000001
...@@ -5478,6 +5551,8 @@ enum v4l2_ctrl_type {...@@ -5478,6 +5551,8 @@ enum v4l2_ctrl_type {
5478 V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,5551 V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,
5479 V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,5552 V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,
5480 V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,5553 V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,
5554 V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS = 0x0275,
5555 V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS = 0x0276,
54815556
5482 V4L2_CTRL_TYPE_AV1_SEQUENCE = 0x280,5557 V4L2_CTRL_TYPE_AV1_SEQUENCE = 0x280,
5483 V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281,5558 V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281,
...@@ -6281,15 +6356,15 @@ struct v4l2_remove_buffers {...@@ -6281,15 +6356,15 @@ struct v4l2_remove_buffers {
6281 * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.6356 * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
6282 * You must be root to use these ioctls. Never use these in applications!6357 * You must be root to use these ioctls. Never use these in applications!
6283 */6358 */
6284#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)6359#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
6285#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)6360#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
62866361
6287#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)6362#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
6288#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)6363#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
6289#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)6364#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
6290#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)6365#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
6291#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)6366#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
6292#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)6367#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
6293#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)6368#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
6294#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)6369#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
6295#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)6370#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
lib/libc/include/generic-openbsd/sys/xcall.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: xcall.h,v 1.1 2025/07/13 05:45:21 dlg Exp $ */1/* $OpenBSD: xcall.h,v 1.2 2025/11/10 12:34:52 dlg Exp $ */
22
3/*3/*
4 * Copyright (c) 2025 David Gwynne <dlg@openbsd.org>4 * Copyright (c) 2025 David Gwynne <dlg@openbsd.org>
...@@ -45,7 +45,7 @@...@@ -45,7 +45,7 @@
45 *45 *
46 * 4. cpu_xcall_ipi has to be provided by machine/intr.h.46 * 4. cpu_xcall_ipi has to be provided by machine/intr.h.
47 *47 *
48 * 5. The MD xcall IPI handler has to call cpu_xcall_dispatch.48 * 5. call cpu_xcall_dispatch at IPL_SOFTCLOCK on the target CPU.
49 */49 */
5050
51#ifndef _SYS_XCALL_H51#ifndef _SYS_XCALL_H
lib/libc/include/generic-openbsd/time.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: time.h,v 1.32 2022/10/25 16:30:30 millert Exp $ */1/* $OpenBSD: time.h,v 1.33 2025/11/20 10:58:11 tb Exp $ */
2/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */2/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
33
4/*4/*
...@@ -106,7 +106,7 @@ struct tm {...@@ -106,7 +106,7 @@ struct tm {
106 int tm_yday; /* days since January 1 [0-365] */106 int tm_yday; /* days since January 1 [0-365] */
107 int tm_isdst; /* Daylight Saving Time flag */107 int tm_isdst; /* Daylight Saving Time flag */
108 long tm_gmtoff; /* offset from UTC in seconds */108 long tm_gmtoff; /* offset from UTC in seconds */
109 char *tm_zone; /* timezone abbreviation */109 const char *tm_zone; /* timezone abbreviation */
110};110};
111111
112__BEGIN_DECLS112__BEGIN_DECLS
lib/libc/include/generic-openbsd/unistd.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: unistd.h,v 1.112 2025/05/24 06:49:16 deraadt Exp $ */1/* $OpenBSD: unistd.h,v 1.113 2025/10/07 12:02:21 brynet Exp $ */
2/* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */2/* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */
33
4/*-4/*-
...@@ -530,7 +530,7 @@ int setpgrp(pid_t _pid, pid_t _pgrp); /* BSD compat version */...@@ -530,7 +530,7 @@ int setpgrp(pid_t _pid, pid_t _pgrp); /* BSD compat version */
530int setthrname(pid_t, const char *);530int setthrname(pid_t, const char *);
531void setusershell(void);531void setusershell(void);
532int strtofflags(char **, u_int32_t *, u_int32_t *);532int strtofflags(char **, u_int32_t *, u_int32_t *);
533int swapctl(int cmd, const void *arg, int misc);533int swapctl(int, const void *, int);
534int pledge(const char *, const char *);534int pledge(const char *, const char *);
535int unveil(const char *, const char *);535int unveil(const char *, const char *);
536pid_t __tfork_thread(const struct __tfork *, size_t, void (*)(void *),536pid_t __tfork_thread(const struct __tfork *, size_t, void (*)(void *),
lib/libc/include/generic-openbsd/uvm/uvm_anon.h+2-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_anon.h,v 1.23 2025/04/16 09:16:48 mpi Exp $ */1/* $OpenBSD: uvm_anon.h,v 1.24 2025/12/15 13:02:18 mpi Exp $ */
2/* $NetBSD: uvm_anon.h,v 1.13 2000/12/27 09:17:04 chs Exp $ */2/* $NetBSD: uvm_anon.h,v 1.13 2000/12/27 09:17:04 chs Exp $ */
33
4/*4/*
...@@ -88,7 +88,7 @@ struct vm_aref {...@@ -88,7 +88,7 @@ struct vm_aref {
8888
89#ifdef _KERNEL89#ifdef _KERNEL
90struct vm_anon *uvm_analloc(void);90struct vm_anon *uvm_analloc(void);
91void uvm_anfree_list(struct vm_anon *, struct pglist *);91void uvm_anfree(struct vm_anon *);
92void uvm_anon_release(struct vm_anon *);92void uvm_anon_release(struct vm_anon *);
93void uvm_anwait(void);93void uvm_anwait(void);
94void uvm_anon_init(void);94void uvm_anon_init(void);
...@@ -96,7 +96,6 @@ void uvm_anon_init_percpu(void);...@@ -96,7 +96,6 @@ void uvm_anon_init_percpu(void);
96void uvm_anon_dropswap(struct vm_anon *);96void uvm_anon_dropswap(struct vm_anon *);
97boolean_t uvm_anon_pagein(struct vm_amap *, struct vm_anon *);97boolean_t uvm_anon_pagein(struct vm_amap *, struct vm_anon *);
9898
99#define uvm_anfree(an) uvm_anfree_list((an), NULL)
10099
101#endif /* _KERNEL */100#endif /* _KERNEL */
102101
lib/libc/include/generic-openbsd/uvm/uvm_extern.h+1-19
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_extern.h,v 1.184 2025/06/03 08:38:17 mpi Exp $ */1/* $OpenBSD: uvm_extern.h,v 1.187 2025/11/13 10:55:51 mpi Exp $ */
2/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */2/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
33
4/*4/*
...@@ -126,15 +126,6 @@ typedef int vm_prot_t;...@@ -126,15 +126,6 @@ typedef int vm_prot_t;
126#define UVM_UNKNOWN_OFFSET ((voff_t) -1)126#define UVM_UNKNOWN_OFFSET ((voff_t) -1)
127 /* offset not known(obj) or don't care(!obj) */127 /* offset not known(obj) or don't care(!obj) */
128128
129/*
130 * the following defines are for uvm_km_kmemalloc's flags
131 */
132#define UVM_KMF_NOWAIT 0x1 /* matches M_NOWAIT */
133#define UVM_KMF_VALLOC 0x2 /* allocate VA only */
134#define UVM_KMF_CANFAIL 0x4 /* caller handles failure */
135#define UVM_KMF_ZERO 0x08 /* zero pages */
136#define UVM_KMF_TRYLOCK UVM_FLAG_TRYLOCK /* try locking only */
137
138/*129/*
139 * flags for uvm_pagealloc()130 * flags for uvm_pagealloc()
140 */131 */
...@@ -286,12 +277,6 @@ int uvm_io(vm_map_t, struct uio *, int);...@@ -286,12 +277,6 @@ int uvm_io(vm_map_t, struct uio *, int);
286277
287#define UVM_IO_FIXPROT 0x01278#define UVM_IO_FIXPROT 0x01
288279
289void uvm_km_free(vm_map_t, vaddr_t, vsize_t);
290vaddr_t uvm_km_kmemalloc_pla(struct vm_map *,
291 struct uvm_object *, vsize_t, vsize_t, int,
292 paddr_t, paddr_t, paddr_t, paddr_t, int);
293#define uvm_km_kmemalloc(map, obj, sz, flags) \
294 uvm_km_kmemalloc_pla(map, obj, sz, 0, flags, 0, (paddr_t)-1, 0, 0, 0)
295struct vm_map *uvm_km_suballoc(vm_map_t, vaddr_t *, vaddr_t *,280struct vm_map *uvm_km_suballoc(vm_map_t, vaddr_t *, vaddr_t *,
296 vsize_t, int, boolean_t, vm_map_t);281 vsize_t, int, boolean_t, vm_map_t);
297/*282/*
...@@ -443,9 +428,6 @@ void kmeminit_nkmempages(void);...@@ -443,9 +428,6 @@ void kmeminit_nkmempages(void);
443void kmeminit(void);428void kmeminit(void);
444extern u_int nkmempages;429extern u_int nkmempages;
445430
446struct vnode;
447struct uvm_object *uvn_attach(struct vnode *, vm_prot_t);
448
449struct process;431struct process;
450struct kinfo_vmentry;432struct kinfo_vmentry;
451int fill_vmmap(struct process *, struct kinfo_vmentry *,433int fill_vmmap(struct process *, struct kinfo_vmentry *,
lib/libc/include/generic-openbsd/uvm/uvm_pager.h+3-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_pager.h,v 1.33 2021/10/12 07:38:22 mpi Exp $ */1/* $OpenBSD: uvm_pager.h,v 1.34 2025/12/18 16:05:18 mpi Exp $ */
2/* $NetBSD: uvm_pager.h,v 1.20 2000/11/27 08:40:05 chs Exp $ */2/* $NetBSD: uvm_pager.h,v 1.20 2000/11/27 08:40:05 chs Exp $ */
33
4/*4/*
...@@ -110,7 +110,6 @@ struct uvm_pagerops {...@@ -110,7 +110,6 @@ struct uvm_pagerops {
110#define PGO_DOACTCLUST 0x020 /* flag to mk_pcluster to include active */110#define PGO_DOACTCLUST 0x020 /* flag to mk_pcluster to include active */
111#define PGO_LOCKED 0x040 /* fault data structures are locked [get] */111#define PGO_LOCKED 0x040 /* fault data structures are locked [get] */
112#define PGO_PDFREECLUST 0x080 /* daemon's free cluster flag [uvm_pager_put] */112#define PGO_PDFREECLUST 0x080 /* daemon's free cluster flag [uvm_pager_put] */
113#define PGO_REALLOCSWAP 0x100 /* reallocate swap area [pager_dropcluster] */
114#define PGO_NOWAIT 0x200 /* do not wait for inode lock */113#define PGO_NOWAIT 0x200 /* do not wait for inode lock */
115114
116/* page we are not interested in getting */115/* page we are not interested in getting */
...@@ -120,8 +119,8 @@ struct uvm_pagerops {...@@ -120,8 +119,8 @@ struct uvm_pagerops {
120 * prototypes119 * prototypes
121 */120 */
122121
123void uvm_pager_dropcluster(struct uvm_object *, struct vm_page *,122void uvm_pager_dropcluster(struct uvm_object *, struct vm_page **,
124 struct vm_page **, int *, int);123 int *, int);
125void uvm_pager_init(void);124void uvm_pager_init(void);
126int uvm_pager_put(struct uvm_object *, struct vm_page *, 125int uvm_pager_put(struct uvm_object *, struct vm_page *,
127 struct vm_page ***, int *, int, voff_t, voff_t);126 struct vm_page ***, int *, int, voff_t, voff_t);
lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h+1-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_pmemrange.h,v 1.19 2024/11/07 11:12:46 mpi Exp $ */1/* $OpenBSD: uvm_pmemrange.h,v 1.20 2026/01/28 21:09:41 deraadt Exp $ */
22
3/*3/*
4 * Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl>4 * Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl>
...@@ -100,7 +100,6 @@ extern struct uvm_pmalloc nowait_pma; /* [F] */...@@ -100,7 +100,6 @@ extern struct uvm_pmalloc nowait_pma; /* [F] */
100 * uvm_pmalloc flags.100 * uvm_pmalloc flags.
101 */101 */
102#define UVM_PMA_LINKED 0x01 /* uvm_pmalloc is on list */102#define UVM_PMA_LINKED 0x01 /* uvm_pmalloc is on list */
103#define UVM_PMA_BUSY 0x02 /* entry is busy with fpageq unlocked */
104#define UVM_PMA_FAIL 0x10 /* page daemon cannot free pages */103#define UVM_PMA_FAIL 0x10 /* page daemon cannot free pages */
105#define UVM_PMA_FREED 0x20 /* at least one page in the range was freed */104#define UVM_PMA_FREED 0x20 /* at least one page in the range was freed */
106105
lib/libc/include/generic-openbsd/uvm/uvm_swap.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_swap.h,v 1.20 2023/10/27 19:18:53 mpi Exp $ */1/* $OpenBSD: uvm_swap.h,v 1.22 2026/04/11 01:36:23 deraadt Exp $ */
2/* $NetBSD: uvm_swap.h,v 1.5 2000/01/11 06:57:51 chs Exp $ */2/* $NetBSD: uvm_swap.h,v 1.5 2000/01/11 06:57:51 chs Exp $ */
33
4/*4/*
...@@ -37,6 +37,7 @@...@@ -37,6 +37,7 @@
3737
38#ifdef _KERNEL38#ifdef _KERNEL
3939
40int uvm_swap_dropcluster(struct vm_page **, int, int);
40int uvm_swap_get(struct vm_page *, int, int);41int uvm_swap_get(struct vm_page *, int, int);
41int uvm_swap_put(int, struct vm_page **, int, int);42int uvm_swap_put(int, struct vm_page **, int, int);
42int uvm_swap_alloc(int *, boolean_t);43int uvm_swap_alloc(int *, boolean_t);
...@@ -53,6 +54,8 @@ void uvm_swap_initcrypt_all(void);...@@ -53,6 +54,8 @@ void uvm_swap_initcrypt_all(void);
53void uvm_swap_finicrypt_all(void);54void uvm_swap_finicrypt_all(void);
54#endif55#endif
5556
57extern volatile int seb_free;
58
56#endif /* _KERNEL */59#endif /* _KERNEL */
5760
58#endif /* _UVM_UVM_SWAP_H_ */61#endif /* _UVM_UVM_SWAP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/uvm/uvm_vnode.h+3-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_vnode.h,v 1.22 2025/09/25 09:05:47 mpi Exp $ */1/* $OpenBSD: uvm_vnode.h,v 1.24 2025/11/10 15:53:06 mpi Exp $ */
2/* $NetBSD: uvm_vnode.h,v 1.9 2000/03/26 20:54:48 kleink Exp $ */2/* $NetBSD: uvm_vnode.h,v 1.9 2000/03/26 20:54:48 kleink Exp $ */
33
4/*4/*
...@@ -72,7 +72,6 @@ struct uvm_vnode {...@@ -72,7 +72,6 @@ struct uvm_vnode {
72 */72 */
73#define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */73#define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */
74#define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */74#define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */
75#define UVM_VNODE_ALOCK 0x004 /* uvn_attach is locked out */
76#define UVM_VNODE_DYING 0x008 /* final detach/terminate in 75#define UVM_VNODE_DYING 0x008 /* final detach/terminate in
77 progress */76 progress */
78#define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg77#define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg
...@@ -92,9 +91,9 @@ struct uvm_vnode {...@@ -92,9 +91,9 @@ struct uvm_vnode {
92 * UVM_VNODE_BLOCKED: any condition that should new processes from91 * UVM_VNODE_BLOCKED: any condition that should new processes from
93 * touching the vnode [set WANTED and sleep to wait for it to clear]92 * touching the vnode [set WANTED and sleep to wait for it to clear]
94 */93 */
95#define UVM_VNODE_BLOCKED (UVM_VNODE_ALOCK|UVM_VNODE_DYING|UVM_VNODE_RELKILL)94#define UVM_VNODE_BLOCKED (UVM_VNODE_DYING|UVM_VNODE_RELKILL)
9695
97void uvm_vnp_obj_alloc(struct vnode *);96struct uvm_object *uvn_attach(struct vnode *, vm_prot_t);
98void uvm_vnp_terminate(struct vnode *);97void uvm_vnp_terminate(struct vnode *);
9998
100#endif /* _UVM_UVM_VNODE_H_ */99#endif /* _UVM_UVM_VNODE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/uvm/uvmexp.h+41-35
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvmexp.h,v 1.19 2025/03/10 19:52:57 miod Exp $ */1/* $OpenBSD: uvmexp.h,v 1.27 2026/03/08 17:06:10 deraadt Exp $ */
22
3#ifndef _UVM_UVMEXP_3#ifndef _UVM_UVMEXP_
4#define _UVM_UVMEXP_4#define _UVM_UVMEXP_
...@@ -41,13 +41,14 @@...@@ -41,13 +41,14 @@
41 * other than the vm system.41 * other than the vm system.
42 *42 *
43 * Locks used to protect struct members in this file:43 * Locks used to protect struct members in this file:
44 * a atomic operations44 * a atomic operations (signed int, so use atomic_load_sint)
45 * I immutable after creation45 * I immutable after creation
46 * K kernel lock46 * K kernel lock
47 * F uvm_lock_fpageq47 * F uvm_lock_fpageq
48 * L uvm_lock_pageq48 * L uvm_lock_pageq
49 * S uvm_swap_data_lock49 * S uvm_swap_data_lock
50 * p copy of per-CPU counters, used only by userland.50 * p copy of per-CPU counters, used only by userland.
51 * o updated only by the page daemon
51 */52 */
52struct uvmexp {53struct uvmexp {
53 /* vm_page constants */54 /* vm_page constants */
...@@ -57,13 +58,13 @@ struct uvmexp {...@@ -57,13 +58,13 @@ struct uvmexp {
5758
58 /* vm_page counters */59 /* vm_page counters */
59 int npages; /* [I] number of pages we manage */60 int npages; /* [I] number of pages we manage */
60 int free; /* [F] number of free pages */61 int free; /* [aF] number of free pages */
61 int active; /* [L] # of active pages */62 int active; /* [aL] # of active pages */
62 int inactive; /* [L] # of pages that we free'd but may want back */63 int inactive; /* [aL] # of pages that we free'd but may want back */
63 int paging; /* [a] # of pages in the process of being paged out */64 int paging; /* [a] # number of pages in the process of being paged out */
64 int wired; /* [a] number of wired pages */65 int wired; /* [a] # number of wired pages */
6566
66 int zeropages; /* [F] number of zero'd pages */67 int zeropages; /* [aF] number of zero'd pages */
67 int reserve_pagedaemon; /* [I] # of pages reserved for pagedaemon */68 int reserve_pagedaemon; /* [I] # of pages reserved for pagedaemon */
68 int reserve_kernel; /* [I] # of pages reserved for kernel */69 int reserve_kernel; /* [I] # of pages reserved for kernel */
69 int percpucaches; /* [a] # of pages in per-CPU caches */70 int percpucaches; /* [a] # of pages in per-CPU caches */
...@@ -83,9 +84,9 @@ struct uvmexp {...@@ -83,9 +84,9 @@ struct uvmexp {
83 int vnodeminpct;/* min percent vnode pages */84 int vnodeminpct;/* min percent vnode pages */
8485
85 /* swap */86 /* swap */
86 int nswapdev; /* [S] number of configured swap devices in system */87 int nswapdev; /* [aS] number of configured swap devices in system */
87 int swpages; /* [S] number of PAGE_SIZE'ed swap pages */88 int swpages; /* [aS] number of PAGE_SIZE'ed swap pages */
88 int swpginuse; /* [S] number of swap pages in use */89 int swpginuse; /* [aS] number of swap pages in use */
89 int swpgonly; /* [a] number of swap pages in use, not also in RAM */90 int swpgonly; /* [a] number of swap pages in use, not also in RAM */
90 int nswget; /* [a] number of swap pages moved from disk to RAM */91 int nswget; /* [a] number of swap pages moved from disk to RAM */
91 int nanon; /* XXX number total of anon's in system */92 int nanon; /* XXX number total of anon's in system */
...@@ -94,23 +95,23 @@ struct uvmexp {...@@ -94,23 +95,23 @@ struct uvmexp {
9495
95 /* stat counters */96 /* stat counters */
96 int faults; /* [p] page fault count */97 int faults; /* [p] page fault count */
97 int traps; /* trap count */98 int traps; /* [a] trap count */
98 int intrs; /* interrupt count */99 int intrs; /* [a] interrupt count */
99 int swtch; /* context switch count */100 int swtch; /* context switch count */
100 int softs; /* software interrupt count */101 int softs; /* [a] software interrupt count */
101 int syscalls; /* system calls */102 int syscalls; /* [a] system calls */
102 int pageins; /* [p] pagein operation count */103 int pageins; /* [p] pagein operation count */
103 /* pageouts are in pdpageouts below */104 /* pageouts are in pdpageouts below */
104 int pcphit; /* [a] # of pagealloc from per-CPU cache */105 int pcphit; /* [a] # of pagealloc from per-CPU cache */
105 int pcpmiss; /* [a] # of times a per-CPU cache was empty */106 int pcpmiss; /* [a] # of times a per-CPU cache was empty */
106 int pgswapin; /* pages swapped in */107 int pgswapin; /* pages swapped in */
107 int pgswapout; /* pages swapped out */108 int pgswapout; /* [a] pages swapped out */
108 int forks; /* forks */109 int forks; /* forks */
109 int forks_ppwait; /* forks where parent waits */110 int forks_ppwait; /* forks where parent waits */
110 int forks_sharevm; /* forks where vmspace is shared */111 int forks_sharevm; /* forks where vmspace is shared */
111 int pga_zerohit; /* pagealloc where zero wanted and zero112 int pga_zerohit; /* [a] pagealloc where zero wanted and zero
112 was available */113 was available */
113 int pga_zeromiss; /* pagealloc where zero wanted and zero114 int pga_zeromiss; /* [a] pagealloc where zero wanted and zero
114 not available */115 not available */
115 int unused09; /* formerly zeroaborts */116 int unused09; /* formerly zeroaborts */
116117
...@@ -138,23 +139,22 @@ struct uvmexp {...@@ -138,23 +139,22 @@ struct uvmexp {
138 int fltnoup; /* [p] # of times fault upgrade failed */139 int fltnoup; /* [p] # of times fault upgrade failed */
139140
140 /* daemon counters */141 /* daemon counters */
141 int pdwoke; /* [F] # of times daemon woke up */142 int pdwoke; /* [ao] # of times daemon woke up */
142 int pdrevs; /* number of times daemon scanned for free pages */143 int pdrevs; /* [ao] # of times daemon scanned for free pages */
143 int pdswout; /* number of times daemon called for swapout */144 int pdswout; /* [o] # of times daemon called for swapout */
144 int pdfreed; /* number of pages daemon freed since boot */145 int pdfreed; /* [ao] # of pages daemon freed since boot */
145 int pdscans; /* number of pages daemon scanned since boot */146 int pdscans; /* [ao] # of pages daemon scanned since boot */
146 int pdanscan; /* number of anonymous pages scanned by daemon */147 int pdanscan; /* [ao] # of anonymous pages scanned by daemon */
147 int pdobscan; /* number of object pages scanned by daemon */148 int pdobscan; /* [ao] # of object pages scanned by daemon */
148 int pdreact; /* number of pages daemon reactivated since boot */149 int pdreact; /* [ao] # of pages daemon reactivated since boot */
149 int pdbusy; /* number of times daemon found a busy page */150 int pdbusy; /* [ao] # of times daemon found a busy page */
150 int pdpageouts; /* number of times daemon started a pageout */151 int pdpageouts; /* [ao] # of times daemon started a pageout */
151 int pdpending; /* number of times daemon got a pending pagout */152 int pdpending; /* [ao] # of times daemon got a pending pagout */
152 int pddeact; /* number of pages daemon deactivates */153 int pddeact; /* [ao] # of pages daemon deactivates */
153154 int swpskip; /* [ao] # of pages delayed because swap crypt busy */
154 int unused13; /* formerly pdrevtext */155
155156 int fpswtch; /* [a] FPU context switches */
156 int fpswtch; /* FPU context switches */157 int kmapent; /* [a] number of kernel map entries */
157 int kmapent; /* number of kernel map entries */
158};158};
159159
160struct _ps_strings {160struct _ps_strings {
...@@ -163,6 +163,12 @@ struct _ps_strings {...@@ -163,6 +163,12 @@ struct _ps_strings {
163163
164#ifdef _KERNEL164#ifdef _KERNEL
165165
166static inline int
167atomic_load_sint(volatile const int *p)
168{
169 return *p;
170}
171
166/*172/*
167 * Per-cpu UVM counters.173 * Per-cpu UVM counters.
168 */174 */
lib/libc/include/mips64-openbsd-none/machine/octeonvar.h+1-27
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: octeonvar.h,v 1.54 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */
2/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */2/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */
33
4/*-4/*-
...@@ -335,32 +335,6 @@ int octeon_ioclock_speed(void);...@@ -335,32 +335,6 @@ int octeon_ioclock_speed(void);
335#endif /* _KERNEL */335#endif /* _KERNEL */
336#endif /* _KERNEL || _STANDALONE */336#endif /* _KERNEL || _STANDALONE */
337337
338static inline int
339ffs64(uint64_t val)
340{
341 int ret;
342
343 __asm volatile ( \
344 _ASM_PROLOGUE_MIPS64
345 " dclz %0, %1 \n"
346 _ASM_EPILOGUE
347 : "=r"(ret) : "r"(val));
348 return 64 - ret;
349}
350
351static inline int
352ffs32(uint32_t val)
353{
354 int ret;
355
356 __asm volatile ( \
357 _ASM_PROLOGUE_MIPS64
358 " clz %0, %1 \n"
359 _ASM_EPILOGUE
360 : "=r"(ret) : "r"(val));
361 return 32 - ret;
362}
363
364static inline uint64_t338static inline uint64_t
365octeon_xkphys_read_8(paddr_t address)339octeon_xkphys_read_8(paddr_t address)
366{340{
lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h+1-27
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: octeonvar.h,v 1.54 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */
2/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */2/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */
33
4/*-4/*-
...@@ -335,32 +335,6 @@ int octeon_ioclock_speed(void);...@@ -335,32 +335,6 @@ int octeon_ioclock_speed(void);
335#endif /* _KERNEL */335#endif /* _KERNEL */
336#endif /* _KERNEL || _STANDALONE */336#endif /* _KERNEL || _STANDALONE */
337337
338static inline int
339ffs64(uint64_t val)
340{
341 int ret;
342
343 __asm volatile ( \
344 _ASM_PROLOGUE_MIPS64
345 " dclz %0, %1 \n"
346 _ASM_EPILOGUE
347 : "=r"(ret) : "r"(val));
348 return 64 - ret;
349}
350
351static inline int
352ffs32(uint32_t val)
353{
354 int ret;
355
356 __asm volatile ( \
357 _ASM_PROLOGUE_MIPS64
358 " clz %0, %1 \n"
359 _ASM_EPILOGUE
360 : "=r"(ret) : "r"(val));
361 return 32 - ret;
362}
363
364static inline uint64_t338static inline uint64_t
365octeon_xkphys_read_8(paddr_t address)339octeon_xkphys_read_8(paddr_t address)
366{340{
lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: apmvar.h,v 1.6 2019/01/22 02:36:30 phessler Exp $ */1/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Alexander Guy4 * Copyright (c) 2001 Alexander Guy
lib/libc/include/mips64el-openbsd-none/loongson/hibernate.h deleted-33
...@@ -1,33 +0,0 @@
1/* $OpenBSD: hibernate.h,v 1.3 2018/06/21 07:33:30 mlarkin Exp $ */
2
3/*
4 * Copyright (c) 2013 Paul Irofti.
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19
20#include <machine/hibernate_var.h>
21
22/* Loongson hibernate support structures and functions */
23
24int get_hibernate_info_md(union hibernate_info *);
25void hibernate_flush(void);
26void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int);
27int hibernate_inflate_skip(union hibernate_info *, paddr_t);
28int hibernate_suspend(void);
29void hibernate_switch_stack_machdep(void);
30void hibernate_resume_machdep(vaddr_t);
31void hibernate_activate_resume_pt_machdep(void);
32void hibernate_enable_intr_machdep(void);
33void hibernate_disable_intr_machdep(void);
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/hibernate_var.h deleted-39
...@@ -1,39 +0,0 @@
1/* $OpenBSD: hibernate_var.h,v 1.1 2013/06/02 21:46:04 pirofti Exp $ */
2
3/*
4 * Copyright (c) 2013 Paul Irofti.
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/* Loongson hibernate support definitions */
20
21#define PAGE_MASK_4M ((256 * PAGE_SIZE) - 1)
22
23#define PIGLET_PAGE_MASK ~((paddr_t)PAGE_MASK_4M)
24
25/*
26 * Steal hibernate pages right after the first page which is reserved
27 * for the exception area.
28 * */
29#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 1)
30#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 2)
31#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 3)
32#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 4)
33
34#define HIBERNATE_RESERVED_PAGES 4
35
36/* Use 4MB hibernation chunks */
37#define HIBERNATE_CHUNK_SIZE 0x400000
38
39#define HIBERNATE_CHUNK_TABLE_SIZE 0x100000
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/param.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */1/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */
22
3/* Public Domain */3/* Public Domain */
44
...@@ -13,8 +13,6 @@...@@ -13,8 +13,6 @@
13#define _MACHINE_CPU mips6413#define _MACHINE_CPU mips64
14#define MID_MACHINE MID_MIPS6414#define MID_MACHINE MID_MIPS64
1515
16#ifdef _KERNEL
17
18/*16/*
19 * The Loongson level 1 cache expects software to prevent virtual17 * The Loongson level 1 cache expects software to prevent virtual
20 * aliases. Unfortunately, since this cache is physically tagged,18 * aliases. Unfortunately, since this cache is physically tagged,
...@@ -24,8 +22,6 @@...@@ -24,8 +22,6 @@
24 */22 */
25#define PAGE_SHIFT 1423#define PAGE_SHIFT 14
2624
27#endif /* _KERNEL */
28
29#include <mips64/param.h>25#include <mips64/param.h>
3026
31#endif /* _MACHINE_PARAM_H_ */27#endif /* _MACHINE_PARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/apmvar.h+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: apmvar.h,v 1.6 2019/01/22 02:36:30 phessler Exp $ */1/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Alexander Guy4 * Copyright (c) 2001 Alexander Guy
lib/libc/include/mips64el-openbsd-none/machine/hibernate.h deleted-33
...@@ -1,33 +0,0 @@
1/* $OpenBSD: hibernate.h,v 1.3 2018/06/21 07:33:30 mlarkin Exp $ */
2
3/*
4 * Copyright (c) 2013 Paul Irofti.
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19
20#include <machine/hibernate_var.h>
21
22/* Loongson hibernate support structures and functions */
23
24int get_hibernate_info_md(union hibernate_info *);
25void hibernate_flush(void);
26void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int);
27int hibernate_inflate_skip(union hibernate_info *, paddr_t);
28int hibernate_suspend(void);
29void hibernate_switch_stack_machdep(void);
30void hibernate_resume_machdep(vaddr_t);
31void hibernate_activate_resume_pt_machdep(void);
32void hibernate_enable_intr_machdep(void);
33void hibernate_disable_intr_machdep(void);
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/hibernate_var.h deleted-39
...@@ -1,39 +0,0 @@
1/* $OpenBSD: hibernate_var.h,v 1.1 2013/06/02 21:46:04 pirofti Exp $ */
2
3/*
4 * Copyright (c) 2013 Paul Irofti.
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/* Loongson hibernate support definitions */
20
21#define PAGE_MASK_4M ((256 * PAGE_SIZE) - 1)
22
23#define PIGLET_PAGE_MASK ~((paddr_t)PAGE_MASK_4M)
24
25/*
26 * Steal hibernate pages right after the first page which is reserved
27 * for the exception area.
28 * */
29#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 1)
30#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 2)
31#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 3)
32#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 4)
33
34#define HIBERNATE_RESERVED_PAGES 4
35
36/* Use 4MB hibernation chunks */
37#define HIBERNATE_CHUNK_SIZE 0x400000
38
39#define HIBERNATE_CHUNK_TABLE_SIZE 0x100000
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/param.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */1/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */
22
3/* Public Domain */3/* Public Domain */
44
...@@ -13,8 +13,6 @@...@@ -13,8 +13,6 @@
13#define _MACHINE_CPU mips6413#define _MACHINE_CPU mips64
14#define MID_MACHINE MID_MIPS6414#define MID_MACHINE MID_MIPS64
1515
16#ifdef _KERNEL
17
18/*16/*
19 * The Loongson level 1 cache expects software to prevent virtual17 * The Loongson level 1 cache expects software to prevent virtual
20 * aliases. Unfortunately, since this cache is physically tagged,18 * aliases. Unfortunately, since this cache is physically tagged,
...@@ -24,8 +22,6 @@...@@ -24,8 +22,6 @@
24 */22 */
25#define PAGE_SHIFT 1423#define PAGE_SHIFT 14
2624
27#endif /* _KERNEL */
28
29#include <mips64/param.h>25#include <mips64/param.h>
3026
31#endif /* _MACHINE_PARAM_H_ */27#endif /* _MACHINE_PARAM_H_ */
\ No newline at end of file
lib/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h+1-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intr.h,v 1.57 2025/05/10 09:54:17 visa Exp $ */1/* $OpenBSD: intr.h,v 1.58 2026/01/04 23:51:12 jsg Exp $ */
22
3/*3/*
4 * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.4 * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.
...@@ -64,7 +64,6 @@...@@ -64,7 +64,6 @@
64#if defined(_KERNEL) && !defined(_LOCORE)64#if defined(_KERNEL) && !defined(_LOCORE)
6565
66#include <sys/evcount.h>66#include <sys/evcount.h>
67#include <machine/atomic.h>
6867
69#define PPC_NIRQ 6668#define PPC_NIRQ 66
70#define PPC_CLK_IRQ 6469#define PPC_CLK_IRQ 64
...@@ -111,8 +110,6 @@ void splassert_check(int, const char *);...@@ -111,8 +110,6 @@ void splassert_check(int, const char *);
111#define splsoftassert(wantipl) do { /* nada */ } while (0)110#define splsoftassert(wantipl) do { /* nada */ } while (0)
112#endif111#endif
113112
114#define set_sint(p) atomic_setbits_int(&curcpu()->ci_ipending, p)
115
116#define splbio() splraise(IPL_BIO)113#define splbio() splraise(IPL_BIO)
117#define splnet() splraise(IPL_NET)114#define splnet() splraise(IPL_NET)
118#define spltty() splraise(IPL_TTY)115#define spltty() splraise(IPL_TTY)
lib/libc/include/powerpc64-openbsd-none/machine/atomic.h+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: atomic.h,v 1.3 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: atomic.h,v 1.4 2025/11/18 05:24:38 gkoehler Exp $ */
22
3/*3/*
4 * Copyright (c) 2015 Martin Pieuchot4 * Copyright (c) 2015 Martin Pieuchot
...@@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v)...@@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v)
276#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)276#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
277277
278#if defined(MULTIPROCESSOR) || !defined(_KERNEL)278#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
279#define membar_enter() __membar("isync")279#define membar_enter() __membar("sync")
280#define membar_exit() __membar("sync")280#define membar_exit() __membar("sync")
281#define membar_producer() __membar("sync")281#define membar_producer() __membar("sync")
282#define membar_consumer() __membar("isync")282#define membar_consumer() __membar("sync")
283#define membar_sync() __membar("sync")283#define membar_sync() __membar("sync")
284#else284#else
285#define membar_enter() __membar("")285#define membar_enter() __membar("")
lib/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: atomic.h,v 1.3 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: atomic.h,v 1.4 2025/11/18 05:24:38 gkoehler Exp $ */
22
3/*3/*
4 * Copyright (c) 2015 Martin Pieuchot4 * Copyright (c) 2015 Martin Pieuchot
...@@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v)...@@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v)
276#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)276#define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0)
277277
278#if defined(MULTIPROCESSOR) || !defined(_KERNEL)278#if defined(MULTIPROCESSOR) || !defined(_KERNEL)
279#define membar_enter() __membar("isync")279#define membar_enter() __membar("sync")
280#define membar_exit() __membar("sync")280#define membar_exit() __membar("sync")
281#define membar_producer() __membar("sync")281#define membar_producer() __membar("sync")
282#define membar_consumer() __membar("isync")282#define membar_consumer() __membar("sync")
283#define membar_sync() __membar("sync")283#define membar_sync() __membar("sync")
284#else284#else
285#define membar_enter() __membar("")285#define membar_enter() __membar("")
lib/libc/include/riscv64-openbsd-none/machine/cpu.h+4-8
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.24 2024/06/11 16:02:35 jca Exp $ */1/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
...@@ -141,13 +141,9 @@ struct cpu_info {...@@ -141,13 +141,9 @@ struct cpu_info {
141#define CPUF_GO (1<<5)141#define CPUF_GO (1<<5)
142#define CPUF_RUNNING (1<<6)142#define CPUF_RUNNING (1<<6)
143143
144static inline struct cpu_info *144register struct cpu_info *__curcpu asm ("tp");
145curcpu(void)145
146{146#define curcpu() (__curcpu)
147 struct cpu_info *__ci = NULL;
148 __asm volatile("mv %0, tp" : "=&r"(__ci));
149 return (__ci);
150}
151147
152extern uint32_t boot_hart; /* The hart we booted on. */148extern uint32_t boot_hart; /* The hart we booted on. */
153extern struct cpu_info cpu_info_primary;149extern struct cpu_info cpu_info_primary;
lib/libc/include/riscv64-openbsd-none/machine/cpufunc.h+4-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.6 2023/08/21 20:17:30 miod Exp $ */1/* $OpenBSD: cpufunc.h,v 1.7 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2014 Andrew Turner4 * Copyright (c) 2014 Andrew Turner
...@@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid)...@@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid)
89extern int64_t dcache_line_size;89extern int64_t dcache_line_size;
90extern int64_t icache_line_size;90extern int64_t icache_line_size;
9191
92extern void (*cpu_dcache_wbinv_range)(paddr_t, psize_t);92extern void (*cpu_dcache_wbinv_range)(vaddr_t, vsize_t);
93extern void (*cpu_dcache_inv_range)(paddr_t, psize_t);93extern void (*cpu_dcache_inv_range)(vaddr_t, vsize_t);
94extern void (*cpu_dcache_wb_range)(paddr_t, psize_t);94extern void (*cpu_dcache_wb_range)(vaddr_t, vsize_t);
9595
96static __inline void96static __inline void
97load_satp(uint64_t val)97load_satp(uint64_t val)
lib/libc/include/riscv64-openbsd-none/machine/pmap.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pmap.h,v 1.14 2025/02/03 17:59:40 jca Exp $ */1/* $OpenBSD: pmap.h,v 1.15 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com>
...@@ -75,6 +75,10 @@ struct pmap {...@@ -75,6 +75,10 @@ struct pmap {
75#define PMAP_NOCACHE 0x1 /* non-cacheable memory */75#define PMAP_NOCACHE 0x1 /* non-cacheable memory */
76#define PMAP_DEVICE 0x2 /* device memory */76#define PMAP_DEVICE 0x2 /* device memory */
7777
78extern uint64_t pmap_pma;
79extern uint64_t pmap_nc;
80extern uint64_t pmap_io;
81
78#define PG_PMAP_MOD PG_PMAP082#define PG_PMAP_MOD PG_PMAP0
79#define PG_PMAP_REF PG_PMAP183#define PG_PMAP_REF PG_PMAP1
80#define PG_PMAP_EXE PG_PMAP284#define PG_PMAP_EXE PG_PMAP2
lib/libc/include/riscv64-openbsd-none/machine/pte.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pte.h,v 1.4 2024/10/14 12:02:16 jsg Exp $ */1/* $OpenBSD: pte.h,v 1.5 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -38,6 +38,14 @@...@@ -38,6 +38,14 @@
38#define PTE_RX (PTE_R | PTE_X)38#define PTE_RX (PTE_R | PTE_X)
39#define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D)39#define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D)
4040
41/* Svpmbt extension */
42#define PTE_PMA (0ULL << 61)
43#define PTE_NC (1ULL << 61)
44#define PTE_IO (2ULL << 61)
45
46/* Svnapot extension */
47#define PTE_N (1ULL << 63)
48
41/* T-Head extended page attributes */49/* T-Head extended page attributes */
42#define PTE_THEAD_SO (1ULL << 63)50#define PTE_THEAD_SO (1ULL << 63)
43#define PTE_THEAD_C (1ULL << 62)51#define PTE_THEAD_C (1ULL << 62)
lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h+4-8
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.24 2024/06/11 16:02:35 jca Exp $ */1/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
...@@ -141,13 +141,9 @@ struct cpu_info {...@@ -141,13 +141,9 @@ struct cpu_info {
141#define CPUF_GO (1<<5)141#define CPUF_GO (1<<5)
142#define CPUF_RUNNING (1<<6)142#define CPUF_RUNNING (1<<6)
143143
144static inline struct cpu_info *144register struct cpu_info *__curcpu asm ("tp");
145curcpu(void)145
146{146#define curcpu() (__curcpu)
147 struct cpu_info *__ci = NULL;
148 __asm volatile("mv %0, tp" : "=&r"(__ci));
149 return (__ci);
150}
151147
152extern uint32_t boot_hart; /* The hart we booted on. */148extern uint32_t boot_hart; /* The hart we booted on. */
153extern struct cpu_info cpu_info_primary;149extern struct cpu_info cpu_info_primary;
lib/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h+4-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.6 2023/08/21 20:17:30 miod Exp $ */1/* $OpenBSD: cpufunc.h,v 1.7 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2014 Andrew Turner4 * Copyright (c) 2014 Andrew Turner
...@@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid)...@@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid)
89extern int64_t dcache_line_size;89extern int64_t dcache_line_size;
90extern int64_t icache_line_size;90extern int64_t icache_line_size;
9191
92extern void (*cpu_dcache_wbinv_range)(paddr_t, psize_t);92extern void (*cpu_dcache_wbinv_range)(vaddr_t, vsize_t);
93extern void (*cpu_dcache_inv_range)(paddr_t, psize_t);93extern void (*cpu_dcache_inv_range)(vaddr_t, vsize_t);
94extern void (*cpu_dcache_wb_range)(paddr_t, psize_t);94extern void (*cpu_dcache_wb_range)(vaddr_t, vsize_t);
9595
96static __inline void96static __inline void
97load_satp(uint64_t val)97load_satp(uint64_t val)
lib/libc/include/riscv64-openbsd-none/riscv64/pmap.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pmap.h,v 1.14 2025/02/03 17:59:40 jca Exp $ */1/* $OpenBSD: pmap.h,v 1.15 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com>
...@@ -75,6 +75,10 @@ struct pmap {...@@ -75,6 +75,10 @@ struct pmap {
75#define PMAP_NOCACHE 0x1 /* non-cacheable memory */75#define PMAP_NOCACHE 0x1 /* non-cacheable memory */
76#define PMAP_DEVICE 0x2 /* device memory */76#define PMAP_DEVICE 0x2 /* device memory */
7777
78extern uint64_t pmap_pma;
79extern uint64_t pmap_nc;
80extern uint64_t pmap_io;
81
78#define PG_PMAP_MOD PG_PMAP082#define PG_PMAP_MOD PG_PMAP0
79#define PG_PMAP_REF PG_PMAP183#define PG_PMAP_REF PG_PMAP1
80#define PG_PMAP_EXE PG_PMAP284#define PG_PMAP_EXE PG_PMAP2
lib/libc/include/riscv64-openbsd-none/riscv64/pte.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pte.h,v 1.4 2024/10/14 12:02:16 jsg Exp $ */1/* $OpenBSD: pte.h,v 1.5 2026/04/05 11:48:17 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -38,6 +38,14 @@...@@ -38,6 +38,14 @@
38#define PTE_RX (PTE_R | PTE_X)38#define PTE_RX (PTE_R | PTE_X)
39#define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D)39#define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D)
4040
41/* Svpmbt extension */
42#define PTE_PMA (0ULL << 61)
43#define PTE_NC (1ULL << 61)
44#define PTE_IO (2ULL << 61)
45
46/* Svnapot extension */
47#define PTE_N (1ULL << 63)
48
41/* T-Head extended page attributes */49/* T-Head extended page attributes */
42#define PTE_THEAD_SO (1ULL << 63)50#define PTE_THEAD_SO (1ULL << 63)
43#define PTE_THEAD_C (1ULL << 62)51#define PTE_THEAD_C (1ULL << 62)
lib/libc/include/x86-openbsd-none/i386/specialreg.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.85 2023/08/16 04:07:38 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */
2/* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */2/* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */
33
4/*-4/*-
...@@ -528,6 +528,8 @@...@@ -528,6 +528,8 @@
528#define MSR_PATCH_LOADER 0xc0010020528#define MSR_PATCH_LOADER 0xc0010020
529#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */529#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */
530530
531#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */
532#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */
531#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */533#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */
532#define DE_CFG_721 0x00000001 /* errata 721 */534#define DE_CFG_721 0x00000001 /* errata 721 */
533#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
lib/libc/include/x86-openbsd-none/machine/specialreg.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.85 2023/08/16 04:07:38 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */
2/* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */2/* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */
33
4/*-4/*-
...@@ -528,6 +528,8 @@...@@ -528,6 +528,8 @@
528#define MSR_PATCH_LOADER 0xc0010020528#define MSR_PATCH_LOADER 0xc0010020
529#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */529#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */
530530
531#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */
532#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */
531#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */533#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */
532#define DE_CFG_721 0x00000001 /* errata 721 */534#define DE_CFG_721 0x00000001 /* errata 721 */
533#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
lib/libc/include/x86_64-openbsd-none/amd64/conf.h+11-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: conf.h,v 1.11 2024/09/04 07:45:08 jsg Exp $ */1/* $OpenBSD: conf.h,v 1.12 2025/11/12 11:34:36 hshoexer Exp $ */
2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
33
4/*4/*
...@@ -56,4 +56,13 @@ cdev_decl(pctr);...@@ -56,4 +56,13 @@ cdev_decl(pctr);
56cdev_decl(vmm);56cdev_decl(vmm);
5757
58#include "psp.h"58#include "psp.h"
59cdev_decl(psp);
\ No newline at end of file
59cdev_decl(psp);
60
61#include "kexec.h"
62#define cdev_kexec_init(c,n) { \
63 dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
64 (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
65 (dev_type_stop((*))) nullop, 0, \
66 (dev_type_mmap((*))) enodev }
67
68cdev_decl(kexec);
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/cpu.h+14-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.180 2025/04/28 16:18:25 bluhm Exp $ */1/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */
2/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */2/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
33
4/*-4/*-
...@@ -53,6 +53,7 @@...@@ -53,6 +53,7 @@
53#include <sys/sched.h>53#include <sys/sched.h>
54#include <sys/sensors.h>54#include <sys/sensors.h>
55#include <sys/srp.h>55#include <sys/srp.h>
56#include <sys/xcall.h>
56#include <uvm/uvm_percpu.h>57#include <uvm/uvm_percpu.h>
5758
58#ifdef _KERNEL59#ifdef _KERNEL
...@@ -187,6 +188,7 @@ struct cpu_info {...@@ -187,6 +188,7 @@ struct cpu_info {
187 int ci_inatomic; /* [o] */188 int ci_inatomic; /* [o] */
188189
189#define __HAVE_CPU_TOPOLOGY190#define __HAVE_CPU_TOPOLOGY
191 u_int32_t ci_cputype; /* [I] */
190 u_int32_t ci_smt_id; /* [I] */192 u_int32_t ci_smt_id; /* [I] */
191 u_int32_t ci_core_id; /* [I] */193 u_int32_t ci_core_id; /* [I] */
192 u_int32_t ci_pkg_id; /* [I] */194 u_int32_t ci_pkg_id; /* [I] */
...@@ -215,6 +217,7 @@ struct cpu_info {...@@ -215,6 +217,7 @@ struct cpu_info {
215217
216#ifdef MULTIPROCESSOR218#ifdef MULTIPROCESSOR
217 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];219 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
220 struct xcall_cpu ci_xcall;
218#define __HAVE_UVM_PERCPU221#define __HAVE_UVM_PERCPU
219 struct uvm_pmr_cache ci_uvm; /* [o] page cache */222 struct uvm_pmr_cache ci_uvm; /* [o] page cache */
220#endif223#endif
...@@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *);...@@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *);
289292
290#if defined(MULTIPROCESSOR)293#if defined(MULTIPROCESSOR)
291294
292#define MAXCPUS 64 /* bitmask */295#define MAXCPUS 255
293296
294#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci))297#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci))
295#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci))298#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci))
...@@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void);...@@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void);
431#define cpu_idle_leave() do { /* nothing */ } while (0)434#define cpu_idle_leave() do { /* nothing */ } while (0)
432extern void (*initclock_func)(void);435extern void (*initclock_func)(void);
433extern void (*startclock_func)(void);436extern void (*startclock_func)(void);
437extern int hibernate_delay;
434438
435struct region_descriptor;439struct region_descriptor;
436void lgdt(struct region_descriptor *);440void lgdt(struct region_descriptor *);
...@@ -444,6 +448,9 @@ void startclocks(void);...@@ -444,6 +448,9 @@ void startclocks(void);
444void rtcinit(void);448void rtcinit(void);
445void rtcstart(void);449void rtcstart(void);
446void rtcstop(void);450void rtcstop(void);
451int rtcalarm_suspend(struct timeval *tv);
452void rtcalarm_resume(void);
453int rtcalarm_fired(void);
447void i8254_delay(int);454void i8254_delay(int);
448void i8254_initclocks(void);455void i8254_initclocks(void);
449void i8254_startclock(void);456void i8254_startclock(void);
...@@ -496,13 +503,15 @@ void mp_setperf_init(void);...@@ -496,13 +503,15 @@ void mp_setperf_init(void);
496#define CPU_CPUFEATURE 8 /* cpuid features */503#define CPU_CPUFEATURE 8 /* cpuid features */
497#define CPU_KBDRESET 10 /* keyboard reset under pcvt */504#define CPU_KBDRESET 10 /* keyboard reset under pcvt */
498#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */505#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */
506#define CPU_HIBERNATEDELAY 13 /* hibernate delay after suspend */
499#define CPU_LIDACTION 14 /* action caused by lid close */507#define CPU_LIDACTION 14 /* action caused by lid close */
500#define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */508#define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */
501#define CPU_TSCFREQ 16 /* TSC frequency */509#define CPU_TSCFREQ 16 /* TSC frequency */
502#define CPU_INVARIANTTSC 17 /* has invariant TSC */510#define CPU_INVARIANTTSC 17 /* has invariant TSC */
503#define CPU_PWRACTION 18 /* action caused by power button */511#define CPU_PWRACTION 18 /* action caused by power button */
504#define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */512#define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */
505#define CPU_MAXID 20 /* number of valid machdep ids */513#define CPU_VMMODE 20 /* virtualization mode */
514#define CPU_MAXID 21 /* number of valid machdep ids */
506515
507#define CTL_MACHDEP_NAMES { \516#define CTL_MACHDEP_NAMES { \
508 { 0, 0 }, \517 { 0, 0 }, \
...@@ -518,13 +527,14 @@ void mp_setperf_init(void);...@@ -518,13 +527,14 @@ void mp_setperf_init(void);
518 { "kbdreset", CTLTYPE_INT }, \527 { "kbdreset", CTLTYPE_INT }, \
519 { 0, 0 }, \528 { 0, 0 }, \
520 { "xcrypt", CTLTYPE_INT }, \529 { "xcrypt", CTLTYPE_INT }, \
521 { 0, 0 }, \530 { "hibernatedelay", CTLTYPE_INT }, \
522 { "lidaction", CTLTYPE_INT }, \531 { "lidaction", CTLTYPE_INT }, \
523 { "forceukbd", CTLTYPE_INT }, \532 { "forceukbd", CTLTYPE_INT }, \
524 { "tscfreq", CTLTYPE_QUAD }, \533 { "tscfreq", CTLTYPE_QUAD }, \
525 { "invarianttsc", CTLTYPE_INT }, \534 { "invarianttsc", CTLTYPE_INT }, \
526 { "pwraction", CTLTYPE_INT }, \535 { "pwraction", CTLTYPE_INT }, \
527 { "retpoline", CTLTYPE_INT }, \536 { "retpoline", CTLTYPE_INT }, \
537 { "vmmode", CTLTYPE_STRING }, \
528}538}
529539
530#endif /* !_MACHINE_CPU_H_ */540#endif /* !_MACHINE_CPU_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h+2-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.45 2025/06/27 17:23:49 bluhm Exp $ */1/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */
2/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */2/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
33
4/*-4/*-
...@@ -249,7 +249,7 @@ rdmsr(u_int msr)...@@ -249,7 +249,7 @@ rdmsr(u_int msr)
249 return (((uint64_t)hi << 32) | (uint64_t) lo);249 return (((uint64_t)hi << 32) | (uint64_t) lo);
250}250}
251251
252static __inline int252static __inline uint32_t
253rdpkru(u_int ecx)253rdpkru(u_int ecx)
254{254{
255 uint32_t edx, pkru;255 uint32_t edx, pkru;
...@@ -304,7 +304,6 @@ wbinvd(void)...@@ -304,7 +304,6 @@ wbinvd(void)
304304
305#ifdef MULTIPROCESSOR305#ifdef MULTIPROCESSOR
306int wbinvd_on_all_cpus(void);306int wbinvd_on_all_cpus(void);
307void wbinvd_on_all_cpus_acked(void);
308#else307#else
309static inline int308static inline int
310wbinvd_on_all_cpus(void)309wbinvd_on_all_cpus(void)
lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ghcb.h,v 1.6 2025/09/17 18:37:44 sf Exp $ */1/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */
22
3/*3/*
4 * Copyright (c) 2024, 2025 Hans-Joerg Hoexer <hshoexer@genua.de>4 * Copyright (c) 2024, 2025 Hans-Joerg Hoexer <hshoexer@genua.de>
...@@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int);...@@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int);
128int ghcb_valbm_isset(uint8_t *, int);128int ghcb_valbm_isset(uint8_t *, int);
129int ghcb_verify_bm(uint8_t *, uint8_t *);129int ghcb_verify_bm(uint8_t *, uint8_t *);
130int ghcb_valid(struct ghcb_sa *);130int ghcb_valid(struct ghcb_sa *);
131int ghcb_empty(struct ghcb_sa *);
131132
132void ghcb_sync_val(int, int, struct ghcb_sync *);133void ghcb_sync_val(int, int, struct ghcb_sync *);
133void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *,134void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *,
lib/libc/include/x86_64-openbsd-none/amd64/i82489var.h+2-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489var.h,v 1.21 2024/11/07 17:24:42 bluhm Exp $ */1/* $OpenBSD: i82489var.h,v 1.22 2025/11/12 09:48:52 hshoexer Exp $ */
2/* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */2/* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
33
4/*-4/*-
...@@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void);...@@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void);
72#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0)72#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0)
73#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1)73#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1)
74#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2)74#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2)
75#define LAPIC_IPI_WBINVD (LAPIC_IPI_OFFSET + 3)75#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 3)
76#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 4)
7776
78extern void Xipi_invltlb(void);77extern void Xipi_invltlb(void);
79extern void Xipi_invltlb_pcid(void);78extern void Xipi_invltlb_pcid(void);
...@@ -81,7 +80,6 @@ extern void Xipi_invlpg(void);...@@ -81,7 +80,6 @@ extern void Xipi_invlpg(void);
81extern void Xipi_invlpg_pcid(void);80extern void Xipi_invlpg_pcid(void);
82extern void Xipi_invlrange(void);81extern void Xipi_invlrange(void);
83extern void Xipi_invlrange_pcid(void);82extern void Xipi_invlrange_pcid(void);
84extern void Xipi_wbinvd(void);
85#if NVMM > 083#if NVMM > 0
86extern void Xipi_invept(void);84extern void Xipi_invept(void);
87#endif /* NVMM > 0 */85#endif /* NVMM > 0 */
lib/libc/include/x86_64-openbsd-none/amd64/i8259.h+1-53
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i8259.h,v 1.4 2015/09/02 13:39:23 mikeb Exp $ */1/* $OpenBSD: i8259.h,v 1.5 2026/01/15 15:43:45 sf Exp $ */
2/* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */
33
4/*-4/*-
...@@ -63,82 +63,30 @@ extern void i8259_default_setup(void);...@@ -63,82 +63,30 @@ extern void i8259_default_setup(void);
63#define ICU_LEN 16 /* 32-47 are ISA interrupts */63#define ICU_LEN 16 /* 32-47 are ISA interrupts */
6464
6565
66#define ICU_HARDWARE_MASK
67
68/*
69 * These macros are fairly self explanatory. If ICU_SPECIAL_MASK_MODE is
70 * defined, we try to take advantage of the ICU's `special mask mode' by only
71 * EOIing the interrupts on return. This avoids the requirement of masking and
72 * unmasking. We can't do this without special mask mode, because the ICU
73 * would also hold interrupts that it thinks are of lower priority.
74 *
75 * Many machines do not support special mask mode, so by default we don't try
76 * to use it.
77 */
78
79#define IRQ_BIT(num) (1 << ((num) % 8))66#define IRQ_BIT(num) (1 << ((num) % 8))
80#define IRQ_BYTE(num) ((num) >> 3)67#define IRQ_BYTE(num) ((num) >> 3)
8168
82#define i8259_late_ack(num)69#define i8259_late_ack(num)
8370
84#ifdef ICU_SPECIAL_MASK_MODE
85
86#define i8259_asm_ack1(num)
87#define i8259_asm_ack2(num) \
88 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\
89 outb %al,$IO_ICU1
90#define i8259_asm_mask(num)
91#define i8259_asm_unmask(num) \
92 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
93 outb %al,$ICUADDR
94
95#else /* ICU_SPECIAL_MASK_MODE */
96
97#ifndef AUTO_EOI_1
98#define i8259_asm_ack1(num) \71#define i8259_asm_ack1(num) \
99 movb $(0x60|(num%8)),%al /* specific EOI */ ;\72 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
100 outb %al,$IO_ICU173 outb %al,$IO_ICU1
101#else
102#define i8259_asm_ack1(num)
103#endif
10474
105#ifndef AUTO_EOI_2
106#define i8259_asm_ack2(num) \75#define i8259_asm_ack2(num) \
107 movb $(0x60|(num%8)),%al /* specific EOI */ ;\76 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
108 outb %al,$IO_ICU2 /* do the second ICU first */ ;\77 outb %al,$IO_ICU2 /* do the second ICU first */ ;\
109 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\78 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\
110 outb %al,$IO_ICU179 outb %al,$IO_ICU1
111#else
112#define i8259_asm_ack2(num)
113#endif
114
115#ifdef PIC_MASKDELAY
116#define MASKDELAY pushl %eax ; inb $0x84,%al ; popl %eax
117#else
118#define MASKDELAY
119#endif
120
121#ifdef ICU_HARDWARE_MASK
12280
123#define i8259_asm_mask(num) \81#define i8259_asm_mask(num) \
124 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\82 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\
125 orb $IRQ_BIT(num),%al ;\83 orb $IRQ_BIT(num),%al ;\
126 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\84 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\
127 MASKDELAY ;\
128 outb %al,$(ICUADDR+1)85 outb %al,$(ICUADDR+1)
129#define i8259_asm_unmask(num) \86#define i8259_asm_unmask(num) \
130 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\87 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\
131 andb $~IRQ_BIT(num),%al ;\88 andb $~IRQ_BIT(num),%al ;\
132 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\89 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\
133 MASKDELAY ;\
134 outb %al,$(ICUADDR+1)90 outb %al,$(ICUADDR+1)
13591
136#else /* ICU_HARDWARE_MASK */
137
138#define i8259_asm_mask(num)
139#define i8259_asm_unmask(num)
140
141#endif /* ICU_HARDWARE_MASK */
142#endif /* ICU_SPECIAL_MASK_MODE */
143
144#endif /* !_MACHINE_I8259_H_ */92#endif /* !_MACHINE_I8259_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/intr.h+5-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intr.h,v 1.36 2025/06/11 09:57:01 kettenis Exp $ */1/* $OpenBSD: intr.h,v 1.37 2025/11/10 12:34:52 dlg Exp $ */
2/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
33
4/*-4/*-
...@@ -222,7 +222,10 @@ void x86_ipi_handler(void);...@@ -222,7 +222,10 @@ void x86_ipi_handler(void);
222void x86_setperf_ipi(struct cpu_info *);222void x86_setperf_ipi(struct cpu_info *);
223223
224extern void (*ipifunc[X86_NIPI])(struct cpu_info *);224extern void (*ipifunc[X86_NIPI])(struct cpu_info *);
225#endif225
226#define cpu_xcall_ipi(_ci) x86_send_ipi((_ci), X86_IPI_XCALL)
227void Xxcallintr(void);
228#endif /* MULTIPROCESSOR */
226229
227#endif /* !_LOCORE */230#endif /* !_LOCORE */
228231
lib/libc/include/x86_64-openbsd-none/amd64/intrdefs.h+9-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intrdefs.h,v 1.24 2024/05/26 13:37:31 kettenis Exp $ */1/* $OpenBSD: intrdefs.h,v 1.25 2025/11/10 12:34:52 dlg Exp $ */
2/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
33
4#ifndef _AMD64_INTRDEFS_H4#ifndef _AMD64_INTRDEFS_H
...@@ -52,12 +52,13 @@...@@ -52,12 +52,13 @@
52#define LIR_TIMER 6252#define LIR_TIMER 62
5353
54/* Soft interrupt masks. */54/* Soft interrupt masks. */
55#define SIR_CLOCK 6155#define SIR_XCALL 61
56#define SIR_NET 6056#define SIR_CLOCK 60
57#define SIR_TTY 5957#define SIR_NET 59
58#define SIR_TTY 58
5859
59#define LIR_XEN 5860#define LIR_XEN 57
60#define LIR_HYPERV 5761#define LIR_HYPERV 56
6162
62/*63/*
63 * Maximum # of interrupt sources per CPU. 64 to fit in one word.64 * Maximum # of interrupt sources per CPU. 64 to fit in one word.
...@@ -85,8 +86,9 @@...@@ -85,8 +86,9 @@
85#define X86_IPI_START_VMM 0x0000010086#define X86_IPI_START_VMM 0x00000100
86#define X86_IPI_STOP_VMM 0x0000020087#define X86_IPI_STOP_VMM 0x00000200
87#define X86_IPI_WBINVD 0x0000040088#define X86_IPI_WBINVD 0x00000400
89#define X86_IPI_XCALL 0x00000800
8890
89#define X86_NIPI 1291#define X86_NIPI 13
9092
91#define IREENT_MAGIC 0x1804196993#define IREENT_MAGIC 0x18041969
9294
lib/libc/include/x86_64-openbsd-none/amd64/kexec.h created+48
...@@ -0,0 +1,48 @@
1/* $OpenBSD: kexec.h,v 1.1 2025/11/12 11:34:36 hshoexer Exp $ */
2
3/*
4 * Copyright (c) 2019-2020 Visa Hankala
5 * Copyright (c) 2025 Hans-Joerg Hoexer <hshoexer@yerbouti.franken.de>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef _MACHINE_KEXEC_H_
21#define _MACHINE_KEXEC_H_
22
23#include <sys/ioccom.h>
24
25#define KEXEC_TRAMPOLINE (35 * NBPG) /* @ 140 Kb */
26#define KEXEC_TRAMP_DATA (36 * NBPG)
27#define PA_KERN (16*1024*1024) /* @ 16 Mb */
28
29#ifndef _LOCORE
30
31#define KEXEC_MAX_ARGS 8 /* maximum number of boot arguments */
32
33struct kexec_args {
34 char *kimg; /* kernel image buffer */
35 size_t klen; /* size of kernel image */
36 int boothowto;
37 u_char bootduid[8];
38};
39
40#define KIOC_KEXEC _IOW('K', 1, struct kexec_args)
41#define KIOC_GETBOOTDUID _IOR('K', 2, u_char[8])
42
43extern unsigned int kexec_size;
44extern void kexec_tramp(vaddr_t, vaddr_t, paddr_t, size_t, vaddr_t);
45
46#endif /* !_LOCORE */
47
48#endif /* _MACHINE_KEXEC_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.120 2025/07/16 07:15:41 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */
2/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */2/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
3/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */3/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
44
...@@ -699,9 +699,12 @@...@@ -699,9 +699,12 @@
699#define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */699#define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */
700#define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */700#define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */
701#define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */701#define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */
702#define MSR_SYS_CFG 0xc0010010 /* System Configuration */
702#define MSR_PATCH_LOADER 0xc0010020703#define MSR_PATCH_LOADER 0xc0010020
703#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */704#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */
704705
706#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */
707#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */
705#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */708#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */
706#define DE_CFG_721 0x00000001 /* errata 721 */709#define DE_CFG_721 0x00000001 /* errata 721 */
707#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */710#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
lib/libc/include/x86_64-openbsd-none/machine/conf.h+11-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: conf.h,v 1.11 2024/09/04 07:45:08 jsg Exp $ */1/* $OpenBSD: conf.h,v 1.12 2025/11/12 11:34:36 hshoexer Exp $ */
2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
33
4/*4/*
...@@ -56,4 +56,13 @@ cdev_decl(pctr);...@@ -56,4 +56,13 @@ cdev_decl(pctr);
56cdev_decl(vmm);56cdev_decl(vmm);
5757
58#include "psp.h"58#include "psp.h"
59cdev_decl(psp);
\ No newline at end of file
59cdev_decl(psp);
60
61#include "kexec.h"
62#define cdev_kexec_init(c,n) { \
63 dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
64 (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
65 (dev_type_stop((*))) nullop, 0, \
66 (dev_type_mmap((*))) enodev }
67
68cdev_decl(kexec);
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/cpu.h+14-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.180 2025/04/28 16:18:25 bluhm Exp $ */1/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */
2/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */2/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
33
4/*-4/*-
...@@ -53,6 +53,7 @@...@@ -53,6 +53,7 @@
53#include <sys/sched.h>53#include <sys/sched.h>
54#include <sys/sensors.h>54#include <sys/sensors.h>
55#include <sys/srp.h>55#include <sys/srp.h>
56#include <sys/xcall.h>
56#include <uvm/uvm_percpu.h>57#include <uvm/uvm_percpu.h>
5758
58#ifdef _KERNEL59#ifdef _KERNEL
...@@ -187,6 +188,7 @@ struct cpu_info {...@@ -187,6 +188,7 @@ struct cpu_info {
187 int ci_inatomic; /* [o] */188 int ci_inatomic; /* [o] */
188189
189#define __HAVE_CPU_TOPOLOGY190#define __HAVE_CPU_TOPOLOGY
191 u_int32_t ci_cputype; /* [I] */
190 u_int32_t ci_smt_id; /* [I] */192 u_int32_t ci_smt_id; /* [I] */
191 u_int32_t ci_core_id; /* [I] */193 u_int32_t ci_core_id; /* [I] */
192 u_int32_t ci_pkg_id; /* [I] */194 u_int32_t ci_pkg_id; /* [I] */
...@@ -215,6 +217,7 @@ struct cpu_info {...@@ -215,6 +217,7 @@ struct cpu_info {
215217
216#ifdef MULTIPROCESSOR218#ifdef MULTIPROCESSOR
217 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];219 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
220 struct xcall_cpu ci_xcall;
218#define __HAVE_UVM_PERCPU221#define __HAVE_UVM_PERCPU
219 struct uvm_pmr_cache ci_uvm; /* [o] page cache */222 struct uvm_pmr_cache ci_uvm; /* [o] page cache */
220#endif223#endif
...@@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *);...@@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *);
289292
290#if defined(MULTIPROCESSOR)293#if defined(MULTIPROCESSOR)
291294
292#define MAXCPUS 64 /* bitmask */295#define MAXCPUS 255
293296
294#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci))297#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci))
295#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci))298#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci))
...@@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void);...@@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void);
431#define cpu_idle_leave() do { /* nothing */ } while (0)434#define cpu_idle_leave() do { /* nothing */ } while (0)
432extern void (*initclock_func)(void);435extern void (*initclock_func)(void);
433extern void (*startclock_func)(void);436extern void (*startclock_func)(void);
437extern int hibernate_delay;
434438
435struct region_descriptor;439struct region_descriptor;
436void lgdt(struct region_descriptor *);440void lgdt(struct region_descriptor *);
...@@ -444,6 +448,9 @@ void startclocks(void);...@@ -444,6 +448,9 @@ void startclocks(void);
444void rtcinit(void);448void rtcinit(void);
445void rtcstart(void);449void rtcstart(void);
446void rtcstop(void);450void rtcstop(void);
451int rtcalarm_suspend(struct timeval *tv);
452void rtcalarm_resume(void);
453int rtcalarm_fired(void);
447void i8254_delay(int);454void i8254_delay(int);
448void i8254_initclocks(void);455void i8254_initclocks(void);
449void i8254_startclock(void);456void i8254_startclock(void);
...@@ -496,13 +503,15 @@ void mp_setperf_init(void);...@@ -496,13 +503,15 @@ void mp_setperf_init(void);
496#define CPU_CPUFEATURE 8 /* cpuid features */503#define CPU_CPUFEATURE 8 /* cpuid features */
497#define CPU_KBDRESET 10 /* keyboard reset under pcvt */504#define CPU_KBDRESET 10 /* keyboard reset under pcvt */
498#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */505#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */
506#define CPU_HIBERNATEDELAY 13 /* hibernate delay after suspend */
499#define CPU_LIDACTION 14 /* action caused by lid close */507#define CPU_LIDACTION 14 /* action caused by lid close */
500#define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */508#define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */
501#define CPU_TSCFREQ 16 /* TSC frequency */509#define CPU_TSCFREQ 16 /* TSC frequency */
502#define CPU_INVARIANTTSC 17 /* has invariant TSC */510#define CPU_INVARIANTTSC 17 /* has invariant TSC */
503#define CPU_PWRACTION 18 /* action caused by power button */511#define CPU_PWRACTION 18 /* action caused by power button */
504#define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */512#define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */
505#define CPU_MAXID 20 /* number of valid machdep ids */513#define CPU_VMMODE 20 /* virtualization mode */
514#define CPU_MAXID 21 /* number of valid machdep ids */
506515
507#define CTL_MACHDEP_NAMES { \516#define CTL_MACHDEP_NAMES { \
508 { 0, 0 }, \517 { 0, 0 }, \
...@@ -518,13 +527,14 @@ void mp_setperf_init(void);...@@ -518,13 +527,14 @@ void mp_setperf_init(void);
518 { "kbdreset", CTLTYPE_INT }, \527 { "kbdreset", CTLTYPE_INT }, \
519 { 0, 0 }, \528 { 0, 0 }, \
520 { "xcrypt", CTLTYPE_INT }, \529 { "xcrypt", CTLTYPE_INT }, \
521 { 0, 0 }, \530 { "hibernatedelay", CTLTYPE_INT }, \
522 { "lidaction", CTLTYPE_INT }, \531 { "lidaction", CTLTYPE_INT }, \
523 { "forceukbd", CTLTYPE_INT }, \532 { "forceukbd", CTLTYPE_INT }, \
524 { "tscfreq", CTLTYPE_QUAD }, \533 { "tscfreq", CTLTYPE_QUAD }, \
525 { "invarianttsc", CTLTYPE_INT }, \534 { "invarianttsc", CTLTYPE_INT }, \
526 { "pwraction", CTLTYPE_INT }, \535 { "pwraction", CTLTYPE_INT }, \
527 { "retpoline", CTLTYPE_INT }, \536 { "retpoline", CTLTYPE_INT }, \
537 { "vmmode", CTLTYPE_STRING }, \
528}538}
529539
530#endif /* !_MACHINE_CPU_H_ */540#endif /* !_MACHINE_CPU_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h+2-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.45 2025/06/27 17:23:49 bluhm Exp $ */1/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */
2/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */2/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
33
4/*-4/*-
...@@ -249,7 +249,7 @@ rdmsr(u_int msr)...@@ -249,7 +249,7 @@ rdmsr(u_int msr)
249 return (((uint64_t)hi << 32) | (uint64_t) lo);249 return (((uint64_t)hi << 32) | (uint64_t) lo);
250}250}
251251
252static __inline int252static __inline uint32_t
253rdpkru(u_int ecx)253rdpkru(u_int ecx)
254{254{
255 uint32_t edx, pkru;255 uint32_t edx, pkru;
...@@ -304,7 +304,6 @@ wbinvd(void)...@@ -304,7 +304,6 @@ wbinvd(void)
304304
305#ifdef MULTIPROCESSOR305#ifdef MULTIPROCESSOR
306int wbinvd_on_all_cpus(void);306int wbinvd_on_all_cpus(void);
307void wbinvd_on_all_cpus_acked(void);
308#else307#else
309static inline int308static inline int
310wbinvd_on_all_cpus(void)309wbinvd_on_all_cpus(void)
lib/libc/include/x86_64-openbsd-none/machine/ghcb.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ghcb.h,v 1.6 2025/09/17 18:37:44 sf Exp $ */1/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */
22
3/*3/*
4 * Copyright (c) 2024, 2025 Hans-Joerg Hoexer <hshoexer@genua.de>4 * Copyright (c) 2024, 2025 Hans-Joerg Hoexer <hshoexer@genua.de>
...@@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int);...@@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int);
128int ghcb_valbm_isset(uint8_t *, int);128int ghcb_valbm_isset(uint8_t *, int);
129int ghcb_verify_bm(uint8_t *, uint8_t *);129int ghcb_verify_bm(uint8_t *, uint8_t *);
130int ghcb_valid(struct ghcb_sa *);130int ghcb_valid(struct ghcb_sa *);
131int ghcb_empty(struct ghcb_sa *);
131132
132void ghcb_sync_val(int, int, struct ghcb_sync *);133void ghcb_sync_val(int, int, struct ghcb_sync *);
133void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *,134void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *,
lib/libc/include/x86_64-openbsd-none/machine/i82489var.h+2-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489var.h,v 1.21 2024/11/07 17:24:42 bluhm Exp $ */1/* $OpenBSD: i82489var.h,v 1.22 2025/11/12 09:48:52 hshoexer Exp $ */
2/* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */2/* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
33
4/*-4/*-
...@@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void);...@@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void);
72#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0)72#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0)
73#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1)73#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1)
74#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2)74#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2)
75#define LAPIC_IPI_WBINVD (LAPIC_IPI_OFFSET + 3)75#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 3)
76#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 4)
7776
78extern void Xipi_invltlb(void);77extern void Xipi_invltlb(void);
79extern void Xipi_invltlb_pcid(void);78extern void Xipi_invltlb_pcid(void);
...@@ -81,7 +80,6 @@ extern void Xipi_invlpg(void);...@@ -81,7 +80,6 @@ extern void Xipi_invlpg(void);
81extern void Xipi_invlpg_pcid(void);80extern void Xipi_invlpg_pcid(void);
82extern void Xipi_invlrange(void);81extern void Xipi_invlrange(void);
83extern void Xipi_invlrange_pcid(void);82extern void Xipi_invlrange_pcid(void);
84extern void Xipi_wbinvd(void);
85#if NVMM > 083#if NVMM > 0
86extern void Xipi_invept(void);84extern void Xipi_invept(void);
87#endif /* NVMM > 0 */85#endif /* NVMM > 0 */
lib/libc/include/x86_64-openbsd-none/machine/i8259.h+1-53
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i8259.h,v 1.4 2015/09/02 13:39:23 mikeb Exp $ */1/* $OpenBSD: i8259.h,v 1.5 2026/01/15 15:43:45 sf Exp $ */
2/* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */
33
4/*-4/*-
...@@ -63,82 +63,30 @@ extern void i8259_default_setup(void);...@@ -63,82 +63,30 @@ extern void i8259_default_setup(void);
63#define ICU_LEN 16 /* 32-47 are ISA interrupts */63#define ICU_LEN 16 /* 32-47 are ISA interrupts */
6464
6565
66#define ICU_HARDWARE_MASK
67
68/*
69 * These macros are fairly self explanatory. If ICU_SPECIAL_MASK_MODE is
70 * defined, we try to take advantage of the ICU's `special mask mode' by only
71 * EOIing the interrupts on return. This avoids the requirement of masking and
72 * unmasking. We can't do this without special mask mode, because the ICU
73 * would also hold interrupts that it thinks are of lower priority.
74 *
75 * Many machines do not support special mask mode, so by default we don't try
76 * to use it.
77 */
78
79#define IRQ_BIT(num) (1 << ((num) % 8))66#define IRQ_BIT(num) (1 << ((num) % 8))
80#define IRQ_BYTE(num) ((num) >> 3)67#define IRQ_BYTE(num) ((num) >> 3)
8168
82#define i8259_late_ack(num)69#define i8259_late_ack(num)
8370
84#ifdef ICU_SPECIAL_MASK_MODE
85
86#define i8259_asm_ack1(num)
87#define i8259_asm_ack2(num) \
88 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\
89 outb %al,$IO_ICU1
90#define i8259_asm_mask(num)
91#define i8259_asm_unmask(num) \
92 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
93 outb %al,$ICUADDR
94
95#else /* ICU_SPECIAL_MASK_MODE */
96
97#ifndef AUTO_EOI_1
98#define i8259_asm_ack1(num) \71#define i8259_asm_ack1(num) \
99 movb $(0x60|(num%8)),%al /* specific EOI */ ;\72 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
100 outb %al,$IO_ICU173 outb %al,$IO_ICU1
101#else
102#define i8259_asm_ack1(num)
103#endif
10474
105#ifndef AUTO_EOI_2
106#define i8259_asm_ack2(num) \75#define i8259_asm_ack2(num) \
107 movb $(0x60|(num%8)),%al /* specific EOI */ ;\76 movb $(0x60|(num%8)),%al /* specific EOI */ ;\
108 outb %al,$IO_ICU2 /* do the second ICU first */ ;\77 outb %al,$IO_ICU2 /* do the second ICU first */ ;\
109 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\78 movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\
110 outb %al,$IO_ICU179 outb %al,$IO_ICU1
111#else
112#define i8259_asm_ack2(num)
113#endif
114
115#ifdef PIC_MASKDELAY
116#define MASKDELAY pushl %eax ; inb $0x84,%al ; popl %eax
117#else
118#define MASKDELAY
119#endif
120
121#ifdef ICU_HARDWARE_MASK
12280
123#define i8259_asm_mask(num) \81#define i8259_asm_mask(num) \
124 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\82 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\
125 orb $IRQ_BIT(num),%al ;\83 orb $IRQ_BIT(num),%al ;\
126 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\84 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\
127 MASKDELAY ;\
128 outb %al,$(ICUADDR+1)85 outb %al,$(ICUADDR+1)
129#define i8259_asm_unmask(num) \86#define i8259_asm_unmask(num) \
130 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\87 movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\
131 andb $~IRQ_BIT(num),%al ;\88 andb $~IRQ_BIT(num),%al ;\
132 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\89 movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\
133 MASKDELAY ;\
134 outb %al,$(ICUADDR+1)90 outb %al,$(ICUADDR+1)
13591
136#else /* ICU_HARDWARE_MASK */
137
138#define i8259_asm_mask(num)
139#define i8259_asm_unmask(num)
140
141#endif /* ICU_HARDWARE_MASK */
142#endif /* ICU_SPECIAL_MASK_MODE */
143
144#endif /* !_MACHINE_I8259_H_ */92#endif /* !_MACHINE_I8259_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/intr.h+5-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intr.h,v 1.36 2025/06/11 09:57:01 kettenis Exp $ */1/* $OpenBSD: intr.h,v 1.37 2025/11/10 12:34:52 dlg Exp $ */
2/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
33
4/*-4/*-
...@@ -222,7 +222,10 @@ void x86_ipi_handler(void);...@@ -222,7 +222,10 @@ void x86_ipi_handler(void);
222void x86_setperf_ipi(struct cpu_info *);222void x86_setperf_ipi(struct cpu_info *);
223223
224extern void (*ipifunc[X86_NIPI])(struct cpu_info *);224extern void (*ipifunc[X86_NIPI])(struct cpu_info *);
225#endif225
226#define cpu_xcall_ipi(_ci) x86_send_ipi((_ci), X86_IPI_XCALL)
227void Xxcallintr(void);
228#endif /* MULTIPROCESSOR */
226229
227#endif /* !_LOCORE */230#endif /* !_LOCORE */
228231
lib/libc/include/x86_64-openbsd-none/machine/intrdefs.h+9-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: intrdefs.h,v 1.24 2024/05/26 13:37:31 kettenis Exp $ */1/* $OpenBSD: intrdefs.h,v 1.25 2025/11/10 12:34:52 dlg Exp $ */
2/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */2/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
33
4#ifndef _AMD64_INTRDEFS_H4#ifndef _AMD64_INTRDEFS_H
...@@ -52,12 +52,13 @@...@@ -52,12 +52,13 @@
52#define LIR_TIMER 6252#define LIR_TIMER 62
5353
54/* Soft interrupt masks. */54/* Soft interrupt masks. */
55#define SIR_CLOCK 6155#define SIR_XCALL 61
56#define SIR_NET 6056#define SIR_CLOCK 60
57#define SIR_TTY 5957#define SIR_NET 59
58#define SIR_TTY 58
5859
59#define LIR_XEN 5860#define LIR_XEN 57
60#define LIR_HYPERV 5761#define LIR_HYPERV 56
6162
62/*63/*
63 * Maximum # of interrupt sources per CPU. 64 to fit in one word.64 * Maximum # of interrupt sources per CPU. 64 to fit in one word.
...@@ -85,8 +86,9 @@...@@ -85,8 +86,9 @@
85#define X86_IPI_START_VMM 0x0000010086#define X86_IPI_START_VMM 0x00000100
86#define X86_IPI_STOP_VMM 0x0000020087#define X86_IPI_STOP_VMM 0x00000200
87#define X86_IPI_WBINVD 0x0000040088#define X86_IPI_WBINVD 0x00000400
89#define X86_IPI_XCALL 0x00000800
8890
89#define X86_NIPI 1291#define X86_NIPI 13
9092
91#define IREENT_MAGIC 0x1804196993#define IREENT_MAGIC 0x18041969
9294
lib/libc/include/x86_64-openbsd-none/machine/kexec.h created+48
...@@ -0,0 +1,48 @@
1/* $OpenBSD: kexec.h,v 1.1 2025/11/12 11:34:36 hshoexer Exp $ */
2
3/*
4 * Copyright (c) 2019-2020 Visa Hankala
5 * Copyright (c) 2025 Hans-Joerg Hoexer <hshoexer@yerbouti.franken.de>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef _MACHINE_KEXEC_H_
21#define _MACHINE_KEXEC_H_
22
23#include <sys/ioccom.h>
24
25#define KEXEC_TRAMPOLINE (35 * NBPG) /* @ 140 Kb */
26#define KEXEC_TRAMP_DATA (36 * NBPG)
27#define PA_KERN (16*1024*1024) /* @ 16 Mb */
28
29#ifndef _LOCORE
30
31#define KEXEC_MAX_ARGS 8 /* maximum number of boot arguments */
32
33struct kexec_args {
34 char *kimg; /* kernel image buffer */
35 size_t klen; /* size of kernel image */
36 int boothowto;
37 u_char bootduid[8];
38};
39
40#define KIOC_KEXEC _IOW('K', 1, struct kexec_args)
41#define KIOC_GETBOOTDUID _IOR('K', 2, u_char[8])
42
43extern unsigned int kexec_size;
44extern void kexec_tramp(vaddr_t, vaddr_t, paddr_t, size_t, vaddr_t);
45
46#endif /* !_LOCORE */
47
48#endif /* _MACHINE_KEXEC_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/specialreg.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.120 2025/07/16 07:15:41 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */
2/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */2/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
3/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */3/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
44
...@@ -699,9 +699,12 @@...@@ -699,9 +699,12 @@
699#define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */699#define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */
700#define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */700#define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */
701#define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */701#define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */
702#define MSR_SYS_CFG 0xc0010010 /* System Configuration */
702#define MSR_PATCH_LOADER 0xc0010020703#define MSR_PATCH_LOADER 0xc0010020
703#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */704#define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */
704705
706#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */
707#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */
705#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */708#define MSR_DE_CFG 0xc0011029 /* Decode Configuration */
706#define DE_CFG_721 0x00000001 /* errata 721 */709#define DE_CFG_721 0x00000001 /* errata 721 */
707#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */710#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
lib/libc/openbsd/abilists
Binary files a/lib/libc/openbsd/abilists and b/lib/libc/openbsd/abilists differ
lib/std/Target.zig+1-1
...@@ -552,7 +552,7 @@ pub const Os = struct {...@@ -552,7 +552,7 @@ pub const Os = struct {
552552
553 break :blk default_min;553 break :blk default_min;
554 },554 },
555 .max = .{ .major = 7, .minor = 8, .patch = 0 },555 .max = .{ .major = 7, .minor = 9, .patch = 0 },
556 },556 },
557 },557 },
558558