authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-21 09:10:33+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-21 19:49:26+02:00
log478b3b99d2669c3d33e01c01193c2baa797303dc
tree6078b837613bfe6c8eee5e1d01879533835824ed
parentbb40a85558625bc4c412fa8c5e67163013772146
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

libc: update OpenBSD headers to 8.0


352 files changed, 6876 insertions(+), 9558 deletions(-)

lib/libc/include/aarch64-openbsd-none/arm64/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.6 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.7 2026/08/31 10:58:08 tb Exp $ */
2/*-2/*-
3 * Copyright (c) 1990, 19933 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.4 * The Regents of the University of California. All rights reserved.
...@@ -123,11 +123,7 @@ typedef float __float_t;...@@ -123,11 +123,7 @@ typedef float __float_t;
123typedef long __ptrdiff_t;123typedef long __ptrdiff_t;
124typedef unsigned long __size_t;124typedef unsigned long __size_t;
125typedef long __ssize_t;125typedef long __ssize_t;
126#if defined(__GNUC__) && __GNUC__ >= 3
127typedef __builtin_va_list __va_list;126typedef __builtin_va_list __va_list;
128#else
129typedef char * __va_list;
130#endif
131127
132/* Wide character support types */128/* Wide character support types */
133#ifndef __cplusplus129#ifndef __cplusplus
lib/libc/include/aarch64-openbsd-none/arm64/armreg.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: armreg.h,v 1.44 2025/07/22 09:20:41 kettenis Exp $ */1/* $OpenBSD: armreg.h,v 1.45 2026/05/04 20:43:42 kettenis Exp $ */
2/*-2/*-
3 * Copyright (c) 2013, 2014 Andrew Turner3 * Copyright (c) 2013, 2014 Andrew Turner
4 * Copyright (c) 2015 The FreeBSD Foundation4 * Copyright (c) 2015 The FreeBSD Foundation
...@@ -119,6 +119,14 @@...@@ -119,6 +119,14 @@
119#define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT)119#define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT)
120#define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT)120#define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT)
121121
122/* CurrentEL - Current Exception Level */
123#define CURRENTEL_EL_SHIFT 2
124#define CURRENTEL_EL_MASK (0x3 << CURRENTEL_EL_SHIFT)
125#define CURRENTEL_EL_EL0 (0x0 << CURRENTEL_EL_SHIFT)
126#define CURRENTEL_EL_EL1 (0x1 << CURRENTEL_EL_SHIFT)
127#define CURRENTEL_EL_EL2 (0x2 << CURRENTEL_EL_SHIFT)
128#define CURRENTEL_EL_EL3 (0x3 << CURRENTEL_EL_SHIFT)
129
122/* MPIDR_EL1 - Multiprocessor Affinity Register */130/* MPIDR_EL1 - Multiprocessor Affinity Register */
123#define MPIDR_AFF3 (0xFFULL << 32)131#define MPIDR_AFF3 (0xFFULL << 32)
124#define MPIDR_AFF2 (0xFFULL << 16)132#define MPIDR_AFF2 (0xFFULL << 16)
lib/libc/include/aarch64-openbsd-none/arm64/bus.h+19-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.11 2024/11/18 05:32:39 jsg Exp $ */1/* $OpenBSD: bus.h,v 1.13 2026/06/22 07:54:19 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.3 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
4 *4 *
...@@ -349,8 +349,8 @@ struct uio;...@@ -349,8 +349,8 @@ struct uio;
349#define BUS_DMASYNC_PREREAD 0x0004349#define BUS_DMASYNC_PREREAD 0x0004
350#define BUS_DMASYNC_PREWRITE 0x0008350#define BUS_DMASYNC_PREWRITE 0x0008
351351
352typedef struct machine_bus_dma_tag *bus_dma_tag_t;352typedef struct bus_dma_tag *bus_dma_tag_t;
353typedef struct machine_bus_dmamap *bus_dmamap_t;353typedef struct bus_dmamap *bus_dmamap_t;
354354
355/*355/*
356 * bus_dma_segment_t356 * bus_dma_segment_t
...@@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t;...@@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t;
358 * Describes a single contiguous DMA transaction. Values358 * Describes a single contiguous DMA transaction. Values
359 * are suitable for programming into DMA registers.359 * are suitable for programming into DMA registers.
360 */360 */
361struct machine_bus_dma_segment {361struct bus_dma_segment {
362 bus_addr_t ds_addr; /* DMA address */362 bus_addr_t ds_addr; /* DMA address */
363 bus_size_t ds_len; /* length of transfer */363 bus_size_t ds_len; /* length of transfer */
364364
365 paddr_t _ds_paddr; /* CPU address */365 paddr_t _ds_paddr; /* CPU address */
366 vaddr_t _ds_vaddr; /* CPU address */366 vaddr_t _ds_vaddr; /* CPU address */
367 vaddr_t _ds_bounce_va; /* mapped bounced data */
367};368};
368typedef struct machine_bus_dma_segment bus_dma_segment_t;369typedef struct bus_dma_segment bus_dma_segment_t;
369370
370/*371/*
371 * bus_dma_tag_t372 * bus_dma_tag_t
...@@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;...@@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;
374 * DMA for a given bus.375 * DMA for a given bus.
375 */376 */
376377
377struct machine_bus_dma_tag {378struct bus_dma_tag {
378 void *_cookie; /* cookie used in the guts */379 void *_cookie; /* cookie used in the guts */
379 int _flags; /* misc. flags */380 int _flags; /* misc. flags */
380381
...@@ -393,7 +394,8 @@ struct machine_bus_dma_tag {...@@ -393,7 +394,8 @@ struct machine_bus_dma_tag {
393 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,394 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
394 bus_dma_segment_t *, int, bus_size_t, int);395 bus_dma_segment_t *, int, bus_size_t, int);
395 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,396 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
396 bus_size_t, struct proc *, int, paddr_t *, int *, int);397 bus_size_t, struct proc *, int, paddr_t *, int *,
398 int *, int *, int);
397 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);399 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
398 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,400 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
399 bus_addr_t, bus_size_t, int);401 bus_addr_t, bus_size_t, int);
...@@ -451,6 +453,8 @@ struct machine_bus_dma_tag {...@@ -451,6 +453,8 @@ struct machine_bus_dma_tag {
451#define bus_dmamem_mmap(t, sg, n, o, p, f) \453#define bus_dmamem_mmap(t, sg, n, o, p, f) \
452 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))454 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
453455
456void bus_dma_init(void);
457
454int _dmamap_create(bus_dma_tag_t, bus_size_t, int,458int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
455 bus_size_t, bus_size_t, int, bus_dmamap_t *);459 bus_size_t, bus_size_t, int, bus_dmamap_t *);
456void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);460void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
...@@ -461,7 +465,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);...@@ -461,7 +465,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
461int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,465int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
462 bus_dma_segment_t *, int, bus_size_t, int);466 bus_dma_segment_t *, int, bus_size_t, int);
463int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,467int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
464 bus_size_t, struct proc *, int, paddr_t *, int *, int);468 bus_size_t, struct proc *, int, paddr_t *, int *, int *,
469 int *, int);
465void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);470void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
466void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,471void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
467 bus_size_t, int);472 bus_size_t, int);
...@@ -481,7 +486,7 @@ int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,...@@ -481,7 +486,7 @@ int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
481 *486 *
482 * Describes a DMA mapping.487 * Describes a DMA mapping.
483 */488 */
484struct machine_bus_dmamap {489struct bus_dmamap {
485 /*490 /*
486 * PRIVATE MEMBERS: not for use by machine-independent code.491 * PRIVATE MEMBERS: not for use by machine-independent code.
487 */492 */
...@@ -493,6 +498,11 @@ struct machine_bus_dmamap {...@@ -493,6 +498,11 @@ struct machine_bus_dmamap {
493498
494 void *_dm_cookie; /* cookie for bus-specific functions */499 void *_dm_cookie; /* cookie for bus-specific functions */
495500
501 struct vm_page **_dm_pages; /* replacement pages */
502 vaddr_t _dm_pgva; /* those above -- mapped */
503 int _dm_npages; /* number of pages allocated */
504 int _dm_nused; /* number of pages replaced */
505
496 /*506 /*
497 * PUBLIC MEMBERS: these are used by machine-independent code.507 * PUBLIC MEMBERS: these are used by machine-independent code.
498 */508 */
lib/libc/include/aarch64-openbsd-none/arm64/codepatch.h created+72
...@@ -0,0 +1,72 @@
1/* $OpenBSD: codepatch.h,v 1.1 2026/06/23 11:45:54 kettenis Exp $ */
2/*
3 * Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MACHINE_CODEPATCH_H_
19#define _MACHINE_CODEPATCH_H_
20
21#include <machine/param.h>
22
23#ifndef _LOCORE
24
25/* code in this section will be unmapped after boot */
26#define __cptext __attribute__((section(".cptext")))
27
28__cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest);
29__cptext void codepatch_unmaprw(vaddr_t nva);
30__cptext void codepatch_fill_nop(void *caddr, uint16_t len);
31__cptext void codepatch_nop(uint16_t tag);
32void codepatch_disable(void);
33
34#endif /* !_LOCORE */
35
36/*
37 * Mark the start of some code snippet to be patched.
38 */
39#define CODEPATCH_START 998:
40/*
41 * Mark the end of some code to be patched, and assign the given tag.
42 */
43#define CODEPATCH_END2(startnum,tag) \
44 999: \
45 .section .codepatch, "a" ;\
46 .quad startnum##b ;\
47 .short (999b - startnum##b) ;\
48 .short tag ;\
49 .int 0 ;\
50 .previous
51#define CODEPATCH_END(tag) CODEPATCH_END2(998,tag)
52
53#define CPTAG_REPEAT_TLBI 1
54
55
56/* Would be neat if these could be in something like .cptext */
57#define CODEPATCH_CODE(symbol, instructions...) \
58 .section .rodata; \
59 .globl symbol; \
60symbol: instructions; \
61 .size symbol, . - symbol
62
63/* provide a (short) variable with the length of the patch */
64#define CODEPATCH_CODE_LEN(symbol, instructions...) \
65 CODEPATCH_CODE(symbol, instructions); \
66996: .globl symbol##_len; \
67 .align 2; \
68symbol##_len: \
69 .short 996b - symbol; \
70 .size symbol##_len, 2
71
72#endif /* _MACHINE_CODEPATCH_H_ */
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/arm64/cpu.h+14-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */1/* $OpenBSD: cpu.h,v 1.57 2026/09/06 20:02:12 kettenis Exp $ */
2/*2/*
3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
4 *4 *
...@@ -37,7 +37,8 @@...@@ -37,7 +37,8 @@
37#define CPU_ID_AA64SMFR0 1037#define CPU_ID_AA64SMFR0 10
38#define CPU_ID_AA64ZFR0 1138#define CPU_ID_AA64ZFR0 11
39#define CPU_LIDACTION 1239#define CPU_LIDACTION 12
40#define CPU_MAXID 13 /* number of valid machdep ids */40#define CPU_LED_BLINK 13 /* int: blink leds? */
41#define CPU_MAXID 14 /* number of valid machdep ids */
4142
42#define CTL_MACHDEP_NAMES { \43#define CTL_MACHDEP_NAMES { \
43 { 0, 0 }, \44 { 0, 0 }, \
...@@ -53,6 +54,7 @@...@@ -53,6 +54,7 @@
53 { "id_aa64smfr0", CTLTYPE_QUAD }, \54 { "id_aa64smfr0", CTLTYPE_QUAD }, \
54 { "id_aa64zfr0", CTLTYPE_QUAD }, \55 { "id_aa64zfr0", CTLTYPE_QUAD }, \
55 { "lidaction", CTLTYPE_INT }, \56 { "lidaction", CTLTYPE_INT }, \
57 { "led_blink", CTLTYPE_INT }, \
56}58}
5759
58#ifdef _KERNEL60#ifdef _KERNEL
...@@ -200,6 +202,8 @@ struct cpu_info {...@@ -200,6 +202,8 @@ struct cpu_info {
200#define CPUF_PRESENT (1<<4)202#define CPUF_PRESENT (1<<4)
201#define CPUF_GO (1<<5)203#define CPUF_GO (1<<5)
202#define CPUF_RUNNING (1<<6)204#define CPUF_RUNNING (1<<6)
205#define CPUF_PARK (1<<7)
206#define CPUF_PARKED (1<<8)
203207
204static inline struct cpu_info *208static inline struct cpu_info *
205curcpu(void)209curcpu(void)
...@@ -357,6 +361,14 @@ void cpu_wfi(void);...@@ -357,6 +361,14 @@ void cpu_wfi(void);
357void delay (unsigned);361void delay (unsigned);
358#define DELAY(x) delay(x)362#define DELAY(x) delay(x)
359363
364struct blink_led {
365 void (*bl_func)(void *, int);
366 void *bl_arg;
367 SLIST_ENTRY(blink_led) bl_next;
368};
369
370void blink_led_register(struct blink_led *);
371
360#endif /* _KERNEL */372#endif /* _KERNEL */
361373
362#ifdef MULTIPROCESSOR374#ifdef MULTIPROCESSOR
lib/libc/include/aarch64-openbsd-none/arm64/hibernate.h created+38
...@@ -0,0 +1,38 @@
1/* $OpenBSD: hibernate.h,v 1.1 2026/09/06 18:25:22 mglocker Exp $ */
2
3/*
4 * Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
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#include <machine/hibernate_var.h>
20
21/* arm64 hibernate support structures and functions */
22
23int get_hibernate_info_md(union hibernate_info *);
24void hibernate_flush(void);
25void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int);
26int hibernate_inflate_skip(union hibernate_info *, paddr_t);
27int hibernate_suspend(void);
28void hibernate_switch_stack_machdep(void);
29void hibernate_resume_machdep(vaddr_t);
30void hibernate_activate_resume_pt_machdep(void);
31void hibernate_enable_intr_machdep(void);
32void hibernate_disable_intr_machdep(void);
33#ifdef MULTIPROCESSOR
34void hibernate_quiesce_cpus(void);
35#endif /* MULTIPROCESSOR */
36
37/* arm64-only extras (see hibernate_var.h for the piglet save layout) */
38void hibernate_dcache_flush_machdep(void);
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/arm64/hibernate_var.h created+79
...@@ -0,0 +1,79 @@
1/* $OpenBSD: hibernate_var.h,v 1.2 2026/09/19 17:27:09 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
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#ifndef _LOCORE
20extern vaddr_t global_piglet_va;
21extern paddr_t global_piglet_pa;
22#endif
23
24#define PIGLET_PAGE_MASK (~((1ULL << 21) - 1))
25
26/*
27 * On arm64 the resume page tables use both TTBR0 and TTBR1. The
28 * TTBR0 (PT0) page tables start at L0 and cover the first 4MB of the
29 * piglet with 4KB pages (such that pages in the piglet can be
30 * accessed using their offset) and also covers identy mappings for
31 * the pig, the piglet and kernel using 2MB mappings. The TTBR1 (PT1)
32 * page tables covers mappings for the piglet and kernel using normal
33 * kernel VAs.
34 */
35#define HIBERNATE_PT0_L0_PAGE (PAGE_SIZE * 512) /* TTBR0 root */
36#define HIBERNATE_PT0_L1_LOW (PAGE_SIZE * 513)
37#define HIBERNATE_PT0_L2_LOW (PAGE_SIZE * 514)
38#define HIBERNATE_PT0_L3_LOW (PAGE_SIZE * 515) /* 2 pages */
39#define HIBERNATE_PT0_L1_HI (PAGE_SIZE * 517)
40#define HIBERNATE_PT1_L1_PAGE (PAGE_SIZE * 518) /* TTBR1 root */
41
42/* Pool of L2 pages per distinct PT0_L1_LOW/PT0_L1_HI/PT1_L1 slot */
43#define HIBERNATE_PT0_L2_LOW_POOL (PAGE_SIZE * 520)
44#define HIBERNATE_PT0_L2_LOW_POOL_COUNT 16
45#define HIBERNATE_PT0_L2_HI_POOL (PAGE_SIZE * 536)
46#define HIBERNATE_PT0_L2_HI_POOL_COUNT 16
47#define HIBERNATE_PT1_L2_POOL (PAGE_SIZE * 552)
48#define HIBERNATE_PT1_L2_POOL_COUNT 16
49
50/* 3 pages for stack */
51#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 570)
52
53#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 571)
54
55/*
56 * On arm64 we can't access low VA using the normal kernel page
57 * tables. Since the hiballoc page is used before we install the
58 * resume page tables, use the normal kernel VA for access.
59 */
60#define HIBERNATE_HIBALLOC_PAGE (global_piglet_va + PAGE_SIZE * 572)
61
62/* Use 4MB hibernation chunks */
63#define HIBERNATE_CHUNK_SIZE 0x400000
64
65#define HIBERNATE_CHUNK_TABLE_SIZE 0x200000
66
67#define HIBERNATE_STACK_OFFSET 0x0F00
68
69/*
70 * Minimum amount of memory for hibernate support. This is used in early boot
71 * when deciding if we can preallocate the piglet. If the machine does not
72 * have at least HIBERNATE_MIN_MEMORY RAM, we won't support hibernate. This
73 * avoids late allocation issues due to fragmented memory and failure to
74 * hibernate. We need to be able to allocate 32MB contiguous memory, aligned
75 * to 2MB.
76 *
77 * The default minimum required memory is 512MB (1ULL << 29).
78 */
79#define HIBERNATE_MIN_MEMORY (1ULL << 29)
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/arm64/simplebusvar.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */1/* $OpenBSD: simplebusvar.h,v 1.2 2026/06/22 07:54:19 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>3 * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
4 *4 *
...@@ -25,7 +25,7 @@ struct simplebus_softc {...@@ -25,7 +25,7 @@ struct simplebus_softc {
25 int sc_pacells;25 int sc_pacells;
26 int sc_pscells;26 int sc_pscells;
27 struct bus_space sc_bus;27 struct bus_space sc_bus;
28 struct machine_bus_dma_tag sc_dma;28 struct bus_dma_tag sc_dma;
29 int *sc_ranges;29 int *sc_ranges;
30 int sc_rangeslen;30 int sc_rangeslen;
31 int *sc_dmaranges;31 int *sc_dmaranges;
lib/libc/include/aarch64-openbsd-none/arm64/vmmvar.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmmvar.h,v 1.3 2025/08/03 10:17:33 tb Exp $ */1/* $OpenBSD: vmmvar.h,v 1.4 2026/09/19 17:21:52 dv Exp $ */
2/*2/*
3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
4 *4 *
...@@ -63,7 +63,6 @@ struct vm_exit {...@@ -63,7 +63,6 @@ struct vm_exit {
6363
64struct vm_intr_params {64struct vm_intr_params {
65 /* Input parameters to VMM_IOC_INTR */65 /* Input parameters to VMM_IOC_INTR */
66 uint32_t vip_vm_id;
67 uint32_t vip_vcpu_id;66 uint32_t vip_vcpu_id;
68 uint16_t vip_intr;67 uint16_t vip_intr;
69};68};
...@@ -76,7 +75,6 @@ struct vm_rwregs_params {...@@ -76,7 +75,6 @@ struct vm_rwregs_params {
76 * Input/output parameters to VMM_IOC_READREGS /75 * Input/output parameters to VMM_IOC_READREGS /
77 * VMM_IOC_WRITEREGS76 * VMM_IOC_WRITEREGS
78 */77 */
79 uint32_t vrwp_vm_id;
80 uint32_t vrwp_vcpu_id;78 uint32_t vrwp_vcpu_id;
81 uint64_t vrwp_mask;79 uint64_t vrwp_mask;
82 struct vcpu_reg_state vrwp_regs;80 struct vcpu_reg_state vrwp_regs;
lib/libc/include/aarch64-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.6 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.7 2026/08/31 10:58:08 tb Exp $ */
2/*-2/*-
3 * Copyright (c) 1990, 19933 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.4 * The Regents of the University of California. All rights reserved.
...@@ -123,11 +123,7 @@ typedef float __float_t;...@@ -123,11 +123,7 @@ typedef float __float_t;
123typedef long __ptrdiff_t;123typedef long __ptrdiff_t;
124typedef unsigned long __size_t;124typedef unsigned long __size_t;
125typedef long __ssize_t;125typedef long __ssize_t;
126#if defined(__GNUC__) && __GNUC__ >= 3
127typedef __builtin_va_list __va_list;126typedef __builtin_va_list __va_list;
128#else
129typedef char * __va_list;
130#endif
131127
132/* Wide character support types */128/* Wide character support types */
133#ifndef __cplusplus129#ifndef __cplusplus
lib/libc/include/aarch64-openbsd-none/machine/armreg.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: armreg.h,v 1.44 2025/07/22 09:20:41 kettenis Exp $ */1/* $OpenBSD: armreg.h,v 1.45 2026/05/04 20:43:42 kettenis Exp $ */
2/*-2/*-
3 * Copyright (c) 2013, 2014 Andrew Turner3 * Copyright (c) 2013, 2014 Andrew Turner
4 * Copyright (c) 2015 The FreeBSD Foundation4 * Copyright (c) 2015 The FreeBSD Foundation
...@@ -119,6 +119,14 @@...@@ -119,6 +119,14 @@
119#define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT)119#define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT)
120#define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT)120#define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT)
121121
122/* CurrentEL - Current Exception Level */
123#define CURRENTEL_EL_SHIFT 2
124#define CURRENTEL_EL_MASK (0x3 << CURRENTEL_EL_SHIFT)
125#define CURRENTEL_EL_EL0 (0x0 << CURRENTEL_EL_SHIFT)
126#define CURRENTEL_EL_EL1 (0x1 << CURRENTEL_EL_SHIFT)
127#define CURRENTEL_EL_EL2 (0x2 << CURRENTEL_EL_SHIFT)
128#define CURRENTEL_EL_EL3 (0x3 << CURRENTEL_EL_SHIFT)
129
122/* MPIDR_EL1 - Multiprocessor Affinity Register */130/* MPIDR_EL1 - Multiprocessor Affinity Register */
123#define MPIDR_AFF3 (0xFFULL << 32)131#define MPIDR_AFF3 (0xFFULL << 32)
124#define MPIDR_AFF2 (0xFFULL << 16)132#define MPIDR_AFF2 (0xFFULL << 16)
lib/libc/include/aarch64-openbsd-none/machine/bus.h+19-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.11 2024/11/18 05:32:39 jsg Exp $ */1/* $OpenBSD: bus.h,v 1.13 2026/06/22 07:54:19 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.3 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
4 *4 *
...@@ -349,8 +349,8 @@ struct uio;...@@ -349,8 +349,8 @@ struct uio;
349#define BUS_DMASYNC_PREREAD 0x0004349#define BUS_DMASYNC_PREREAD 0x0004
350#define BUS_DMASYNC_PREWRITE 0x0008350#define BUS_DMASYNC_PREWRITE 0x0008
351351
352typedef struct machine_bus_dma_tag *bus_dma_tag_t;352typedef struct bus_dma_tag *bus_dma_tag_t;
353typedef struct machine_bus_dmamap *bus_dmamap_t;353typedef struct bus_dmamap *bus_dmamap_t;
354354
355/*355/*
356 * bus_dma_segment_t356 * bus_dma_segment_t
...@@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t;...@@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t;
358 * Describes a single contiguous DMA transaction. Values358 * Describes a single contiguous DMA transaction. Values
359 * are suitable for programming into DMA registers.359 * are suitable for programming into DMA registers.
360 */360 */
361struct machine_bus_dma_segment {361struct bus_dma_segment {
362 bus_addr_t ds_addr; /* DMA address */362 bus_addr_t ds_addr; /* DMA address */
363 bus_size_t ds_len; /* length of transfer */363 bus_size_t ds_len; /* length of transfer */
364364
365 paddr_t _ds_paddr; /* CPU address */365 paddr_t _ds_paddr; /* CPU address */
366 vaddr_t _ds_vaddr; /* CPU address */366 vaddr_t _ds_vaddr; /* CPU address */
367 vaddr_t _ds_bounce_va; /* mapped bounced data */
367};368};
368typedef struct machine_bus_dma_segment bus_dma_segment_t;369typedef struct bus_dma_segment bus_dma_segment_t;
369370
370/*371/*
371 * bus_dma_tag_t372 * bus_dma_tag_t
...@@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;...@@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;
374 * DMA for a given bus.375 * DMA for a given bus.
375 */376 */
376377
377struct machine_bus_dma_tag {378struct bus_dma_tag {
378 void *_cookie; /* cookie used in the guts */379 void *_cookie; /* cookie used in the guts */
379 int _flags; /* misc. flags */380 int _flags; /* misc. flags */
380381
...@@ -393,7 +394,8 @@ struct machine_bus_dma_tag {...@@ -393,7 +394,8 @@ struct machine_bus_dma_tag {
393 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,394 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
394 bus_dma_segment_t *, int, bus_size_t, int);395 bus_dma_segment_t *, int, bus_size_t, int);
395 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,396 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
396 bus_size_t, struct proc *, int, paddr_t *, int *, int);397 bus_size_t, struct proc *, int, paddr_t *, int *,
398 int *, int *, int);
397 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);399 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
398 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,400 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
399 bus_addr_t, bus_size_t, int);401 bus_addr_t, bus_size_t, int);
...@@ -451,6 +453,8 @@ struct machine_bus_dma_tag {...@@ -451,6 +453,8 @@ struct machine_bus_dma_tag {
451#define bus_dmamem_mmap(t, sg, n, o, p, f) \453#define bus_dmamem_mmap(t, sg, n, o, p, f) \
452 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))454 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
453455
456void bus_dma_init(void);
457
454int _dmamap_create(bus_dma_tag_t, bus_size_t, int,458int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
455 bus_size_t, bus_size_t, int, bus_dmamap_t *);459 bus_size_t, bus_size_t, int, bus_dmamap_t *);
456void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);460void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
...@@ -461,7 +465,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);...@@ -461,7 +465,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
461int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,465int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
462 bus_dma_segment_t *, int, bus_size_t, int);466 bus_dma_segment_t *, int, bus_size_t, int);
463int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,467int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
464 bus_size_t, struct proc *, int, paddr_t *, int *, int);468 bus_size_t, struct proc *, int, paddr_t *, int *, int *,
469 int *, int);
465void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);470void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
466void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,471void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
467 bus_size_t, int);472 bus_size_t, int);
...@@ -481,7 +486,7 @@ int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,...@@ -481,7 +486,7 @@ int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
481 *486 *
482 * Describes a DMA mapping.487 * Describes a DMA mapping.
483 */488 */
484struct machine_bus_dmamap {489struct bus_dmamap {
485 /*490 /*
486 * PRIVATE MEMBERS: not for use by machine-independent code.491 * PRIVATE MEMBERS: not for use by machine-independent code.
487 */492 */
...@@ -493,6 +498,11 @@ struct machine_bus_dmamap {...@@ -493,6 +498,11 @@ struct machine_bus_dmamap {
493498
494 void *_dm_cookie; /* cookie for bus-specific functions */499 void *_dm_cookie; /* cookie for bus-specific functions */
495500
501 struct vm_page **_dm_pages; /* replacement pages */
502 vaddr_t _dm_pgva; /* those above -- mapped */
503 int _dm_npages; /* number of pages allocated */
504 int _dm_nused; /* number of pages replaced */
505
496 /*506 /*
497 * PUBLIC MEMBERS: these are used by machine-independent code.507 * PUBLIC MEMBERS: these are used by machine-independent code.
498 */508 */
lib/libc/include/aarch64-openbsd-none/machine/codepatch.h created+72
...@@ -0,0 +1,72 @@
1/* $OpenBSD: codepatch.h,v 1.1 2026/06/23 11:45:54 kettenis Exp $ */
2/*
3 * Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MACHINE_CODEPATCH_H_
19#define _MACHINE_CODEPATCH_H_
20
21#include <machine/param.h>
22
23#ifndef _LOCORE
24
25/* code in this section will be unmapped after boot */
26#define __cptext __attribute__((section(".cptext")))
27
28__cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest);
29__cptext void codepatch_unmaprw(vaddr_t nva);
30__cptext void codepatch_fill_nop(void *caddr, uint16_t len);
31__cptext void codepatch_nop(uint16_t tag);
32void codepatch_disable(void);
33
34#endif /* !_LOCORE */
35
36/*
37 * Mark the start of some code snippet to be patched.
38 */
39#define CODEPATCH_START 998:
40/*
41 * Mark the end of some code to be patched, and assign the given tag.
42 */
43#define CODEPATCH_END2(startnum,tag) \
44 999: \
45 .section .codepatch, "a" ;\
46 .quad startnum##b ;\
47 .short (999b - startnum##b) ;\
48 .short tag ;\
49 .int 0 ;\
50 .previous
51#define CODEPATCH_END(tag) CODEPATCH_END2(998,tag)
52
53#define CPTAG_REPEAT_TLBI 1
54
55
56/* Would be neat if these could be in something like .cptext */
57#define CODEPATCH_CODE(symbol, instructions...) \
58 .section .rodata; \
59 .globl symbol; \
60symbol: instructions; \
61 .size symbol, . - symbol
62
63/* provide a (short) variable with the length of the patch */
64#define CODEPATCH_CODE_LEN(symbol, instructions...) \
65 CODEPATCH_CODE(symbol, instructions); \
66996: .globl symbol##_len; \
67 .align 2; \
68symbol##_len: \
69 .short 996b - symbol; \
70 .size symbol##_len, 2
71
72#endif /* _MACHINE_CODEPATCH_H_ */
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/machine/cpu.h+14-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */1/* $OpenBSD: cpu.h,v 1.57 2026/09/06 20:02:12 kettenis Exp $ */
2/*2/*
3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>3 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
4 *4 *
...@@ -37,7 +37,8 @@...@@ -37,7 +37,8 @@
37#define CPU_ID_AA64SMFR0 1037#define CPU_ID_AA64SMFR0 10
38#define CPU_ID_AA64ZFR0 1138#define CPU_ID_AA64ZFR0 11
39#define CPU_LIDACTION 1239#define CPU_LIDACTION 12
40#define CPU_MAXID 13 /* number of valid machdep ids */40#define CPU_LED_BLINK 13 /* int: blink leds? */
41#define CPU_MAXID 14 /* number of valid machdep ids */
4142
42#define CTL_MACHDEP_NAMES { \43#define CTL_MACHDEP_NAMES { \
43 { 0, 0 }, \44 { 0, 0 }, \
...@@ -53,6 +54,7 @@...@@ -53,6 +54,7 @@
53 { "id_aa64smfr0", CTLTYPE_QUAD }, \54 { "id_aa64smfr0", CTLTYPE_QUAD }, \
54 { "id_aa64zfr0", CTLTYPE_QUAD }, \55 { "id_aa64zfr0", CTLTYPE_QUAD }, \
55 { "lidaction", CTLTYPE_INT }, \56 { "lidaction", CTLTYPE_INT }, \
57 { "led_blink", CTLTYPE_INT }, \
56}58}
5759
58#ifdef _KERNEL60#ifdef _KERNEL
...@@ -200,6 +202,8 @@ struct cpu_info {...@@ -200,6 +202,8 @@ struct cpu_info {
200#define CPUF_PRESENT (1<<4)202#define CPUF_PRESENT (1<<4)
201#define CPUF_GO (1<<5)203#define CPUF_GO (1<<5)
202#define CPUF_RUNNING (1<<6)204#define CPUF_RUNNING (1<<6)
205#define CPUF_PARK (1<<7)
206#define CPUF_PARKED (1<<8)
203207
204static inline struct cpu_info *208static inline struct cpu_info *
205curcpu(void)209curcpu(void)
...@@ -357,6 +361,14 @@ void cpu_wfi(void);...@@ -357,6 +361,14 @@ void cpu_wfi(void);
357void delay (unsigned);361void delay (unsigned);
358#define DELAY(x) delay(x)362#define DELAY(x) delay(x)
359363
364struct blink_led {
365 void (*bl_func)(void *, int);
366 void *bl_arg;
367 SLIST_ENTRY(blink_led) bl_next;
368};
369
370void blink_led_register(struct blink_led *);
371
360#endif /* _KERNEL */372#endif /* _KERNEL */
361373
362#ifdef MULTIPROCESSOR374#ifdef MULTIPROCESSOR
lib/libc/include/aarch64-openbsd-none/machine/hibernate.h created+38
...@@ -0,0 +1,38 @@
1/* $OpenBSD: hibernate.h,v 1.1 2026/09/06 18:25:22 mglocker Exp $ */
2
3/*
4 * Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
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#include <machine/hibernate_var.h>
20
21/* arm64 hibernate support structures and functions */
22
23int get_hibernate_info_md(union hibernate_info *);
24void hibernate_flush(void);
25void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int);
26int hibernate_inflate_skip(union hibernate_info *, paddr_t);
27int hibernate_suspend(void);
28void hibernate_switch_stack_machdep(void);
29void hibernate_resume_machdep(vaddr_t);
30void hibernate_activate_resume_pt_machdep(void);
31void hibernate_enable_intr_machdep(void);
32void hibernate_disable_intr_machdep(void);
33#ifdef MULTIPROCESSOR
34void hibernate_quiesce_cpus(void);
35#endif /* MULTIPROCESSOR */
36
37/* arm64-only extras (see hibernate_var.h for the piglet save layout) */
38void hibernate_dcache_flush_machdep(void);
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/machine/hibernate_var.h created+79
...@@ -0,0 +1,79 @@
1/* $OpenBSD: hibernate_var.h,v 1.2 2026/09/19 17:27:09 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
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#ifndef _LOCORE
20extern vaddr_t global_piglet_va;
21extern paddr_t global_piglet_pa;
22#endif
23
24#define PIGLET_PAGE_MASK (~((1ULL << 21) - 1))
25
26/*
27 * On arm64 the resume page tables use both TTBR0 and TTBR1. The
28 * TTBR0 (PT0) page tables start at L0 and cover the first 4MB of the
29 * piglet with 4KB pages (such that pages in the piglet can be
30 * accessed using their offset) and also covers identy mappings for
31 * the pig, the piglet and kernel using 2MB mappings. The TTBR1 (PT1)
32 * page tables covers mappings for the piglet and kernel using normal
33 * kernel VAs.
34 */
35#define HIBERNATE_PT0_L0_PAGE (PAGE_SIZE * 512) /* TTBR0 root */
36#define HIBERNATE_PT0_L1_LOW (PAGE_SIZE * 513)
37#define HIBERNATE_PT0_L2_LOW (PAGE_SIZE * 514)
38#define HIBERNATE_PT0_L3_LOW (PAGE_SIZE * 515) /* 2 pages */
39#define HIBERNATE_PT0_L1_HI (PAGE_SIZE * 517)
40#define HIBERNATE_PT1_L1_PAGE (PAGE_SIZE * 518) /* TTBR1 root */
41
42/* Pool of L2 pages per distinct PT0_L1_LOW/PT0_L1_HI/PT1_L1 slot */
43#define HIBERNATE_PT0_L2_LOW_POOL (PAGE_SIZE * 520)
44#define HIBERNATE_PT0_L2_LOW_POOL_COUNT 16
45#define HIBERNATE_PT0_L2_HI_POOL (PAGE_SIZE * 536)
46#define HIBERNATE_PT0_L2_HI_POOL_COUNT 16
47#define HIBERNATE_PT1_L2_POOL (PAGE_SIZE * 552)
48#define HIBERNATE_PT1_L2_POOL_COUNT 16
49
50/* 3 pages for stack */
51#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 570)
52
53#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 571)
54
55/*
56 * On arm64 we can't access low VA using the normal kernel page
57 * tables. Since the hiballoc page is used before we install the
58 * resume page tables, use the normal kernel VA for access.
59 */
60#define HIBERNATE_HIBALLOC_PAGE (global_piglet_va + PAGE_SIZE * 572)
61
62/* Use 4MB hibernation chunks */
63#define HIBERNATE_CHUNK_SIZE 0x400000
64
65#define HIBERNATE_CHUNK_TABLE_SIZE 0x200000
66
67#define HIBERNATE_STACK_OFFSET 0x0F00
68
69/*
70 * Minimum amount of memory for hibernate support. This is used in early boot
71 * when deciding if we can preallocate the piglet. If the machine does not
72 * have at least HIBERNATE_MIN_MEMORY RAM, we won't support hibernate. This
73 * avoids late allocation issues due to fragmented memory and failure to
74 * hibernate. We need to be able to allocate 32MB contiguous memory, aligned
75 * to 2MB.
76 *
77 * The default minimum required memory is 512MB (1ULL << 29).
78 */
79#define HIBERNATE_MIN_MEMORY (1ULL << 29)
\ No newline at end of file
lib/libc/include/aarch64-openbsd-none/machine/simplebusvar.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */1/* $OpenBSD: simplebusvar.h,v 1.2 2026/06/22 07:54:19 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>3 * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
4 *4 *
...@@ -25,7 +25,7 @@ struct simplebus_softc {...@@ -25,7 +25,7 @@ struct simplebus_softc {
25 int sc_pacells;25 int sc_pacells;
26 int sc_pscells;26 int sc_pscells;
27 struct bus_space sc_bus;27 struct bus_space sc_bus;
28 struct machine_bus_dma_tag sc_dma;28 struct bus_dma_tag sc_dma;
29 int *sc_ranges;29 int *sc_ranges;
30 int sc_rangeslen;30 int sc_rangeslen;
31 int *sc_dmaranges;31 int *sc_dmaranges;
lib/libc/include/aarch64-openbsd-none/machine/vmmvar.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmmvar.h,v 1.3 2025/08/03 10:17:33 tb Exp $ */1/* $OpenBSD: vmmvar.h,v 1.4 2026/09/19 17:21:52 dv Exp $ */
2/*2/*
3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
4 *4 *
...@@ -63,7 +63,6 @@ struct vm_exit {...@@ -63,7 +63,6 @@ struct vm_exit {
6363
64struct vm_intr_params {64struct vm_intr_params {
65 /* Input parameters to VMM_IOC_INTR */65 /* Input parameters to VMM_IOC_INTR */
66 uint32_t vip_vm_id;
67 uint32_t vip_vcpu_id;66 uint32_t vip_vcpu_id;
68 uint16_t vip_intr;67 uint16_t vip_intr;
69};68};
...@@ -76,7 +75,6 @@ struct vm_rwregs_params {...@@ -76,7 +75,6 @@ struct vm_rwregs_params {
76 * Input/output parameters to VMM_IOC_READREGS /75 * Input/output parameters to VMM_IOC_READREGS /
77 * VMM_IOC_WRITEREGS76 * VMM_IOC_WRITEREGS
78 */77 */
79 uint32_t vrwp_vm_id;
80 uint32_t vrwp_vcpu_id;78 uint32_t vrwp_vcpu_id;
81 uint64_t vrwp_mask;79 uint64_t vrwp_mask;
82 struct vcpu_reg_state vrwp_regs;80 struct vcpu_reg_state vrwp_regs;
lib/libc/include/arm-openbsd-eabi/arm/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.21 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.22 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef float __float_t;...@@ -122,11 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/arm-openbsd-eabi/arm/cpu.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.67 2024/06/09 21:15:29 jca Exp $ */1/* $OpenBSD: cpu.h,v 1.68 2026/05/25 01:56:50 jsg Exp $ */
2/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */2/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
33
4/*4/*
...@@ -94,8 +94,6 @@...@@ -94,8 +94,6 @@
94 * Kernel-only definitions94 * Kernel-only definitions
95 */95 */
9696
97#include <arm/cpuconf.h>
98
99#include <machine/intr.h>97#include <machine/intr.h>
100#include <machine/frame.h>98#include <machine/frame.h>
101#include <machine/pcb.h>99#include <machine/pcb.h>
lib/libc/include/arm-openbsd-eabi/arm/cpuconf.h deleted-53
...@@ -1,53 +0,0 @@
1/* $OpenBSD: cpuconf.h,v 1.20 2024/11/07 08:12:12 miod Exp $ */
2/* $NetBSD: cpuconf.h,v 1.7 2003/05/23 00:57:24 ichiro Exp $ */
3
4/*
5 * Copyright (c) 2002 Wasabi Systems, Inc.
6 * All rights reserved.
7 *
8 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed for the NetBSD Project by
21 * Wasabi Systems, Inc.
22 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
23 * or promote products derived from this software without specific prior
24 * written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _ARM_CPUCONF_H_
40#define _ARM_CPUCONF_H_
41
42/*
43 * Define which MMU classes are configured:
44 *
45 * ARM_MMU_V7 v6/v7 MMU with XP bit enabled subpage
46 * protection is not used, TEX/AP is used instead.
47 */
48
49#define ARM_MMU_V7 1
50
51#define ARM_NMMUS (ARM_MMU_V7)
52
53#endif /* _ARM_CPUCONF_H_ */
\ No newline at end of file
lib/libc/include/arm-openbsd-eabi/arm/cpufunc.h+1-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.34 2023/05/30 08:30:00 jsg Exp $ */1/* $OpenBSD: cpufunc.h,v 1.35 2026/05/25 01:56:50 jsg Exp $ */
2/* $NetBSD: cpufunc.h,v 1.29 2003/09/06 09:08:35 rearnsha Exp $ */2/* $NetBSD: cpufunc.h,v 1.29 2003/09/06 09:08:35 rearnsha Exp $ */
33
4/*4/*
...@@ -46,7 +46,6 @@...@@ -46,7 +46,6 @@
46#ifdef _KERNEL46#ifdef _KERNEL
4747
48#include <sys/types.h>48#include <sys/types.h>
49#include <arm/cpuconf.h>
5049
51struct cpu_functions {50struct cpu_functions {
5251
lib/libc/include/arm-openbsd-eabi/arm/fiq.h deleted-69
...@@ -1,69 +0,0 @@
1/* $OpenBSD: fiq.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
2/* $NetBSD: fiq.h,v 1.1 2001/12/20 01:20:23 thorpej Exp $ */
3
4/*
5 * Copyright (c) 2001 Wasabi Systems, Inc.
6 * All rights reserved.
7 *
8 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed for the NetBSD Project by
21 * Wasabi Systems, Inc.
22 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
23 * or promote products derived from this software without specific prior
24 * written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _ARM_FIQ_H_
40#define _ARM_FIQ_H_
41
42#include <sys/queue.h>
43
44struct fiqregs {
45 u_int fr_r8; /* FIQ mode r8 */
46 u_int fr_r9; /* FIQ mode r9 */
47 u_int fr_r10; /* FIQ mode r10 */
48 u_int fr_r11; /* FIQ mode r11 */
49 u_int fr_r12; /* FIQ mode r12 */
50 u_int fr_r13; /* FIQ mode r13 */
51};
52
53struct fiqhandler {
54 TAILQ_ENTRY(fiqhandler) fh_list;/* link in the FIQ handler stack */
55 void *fh_func; /* FIQ handler routine */
56 size_t fh_size; /* size of FIQ handler */
57 int fh_flags; /* flags; see below */
58 struct fiqregs *fh_regs; /* pointer to regs structure */
59};
60
61#define FH_CANPUSH 0x01 /* can push this handler out of the way */
62
63int fiq_claim(struct fiqhandler *);
64void fiq_release(struct fiqhandler *);
65
66void fiq_getregs(struct fiqregs *);
67void fiq_setregs(struct fiqregs *);
68
69#endif /* _ARM_FIQ_H_ */
\ No newline at end of file
lib/libc/include/arm-openbsd-eabi/arm/pmap.h+1-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pmap.h,v 1.57 2024/11/07 08:12:12 miod Exp $ */1/* $OpenBSD: pmap.h,v 1.58 2026/05/25 01:56:50 jsg Exp $ */
2/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */2/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */
33
4/*4/*
...@@ -71,7 +71,6 @@...@@ -71,7 +71,6 @@
7171
72#ifdef _KERNEL72#ifdef _KERNEL
7373
74#include <arm/cpuconf.h>
75#include <arm/pte.h>74#include <arm/pte.h>
76#ifndef _LOCORE75#ifndef _LOCORE
77#include <arm/cpufunc.h>76#include <arm/cpufunc.h>
lib/libc/include/generic-openbsd/arpa/telnet.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: telnet.h,v 1.7 2003/06/02 19:34:12 millert Exp $ */1/* $OpenBSD: telnet.h,v 1.8 2026/09/05 08:22:03 jsg Exp $ */
2/* $NetBSD: telnet.h,v 1.4 1994/10/26 00:56:46 cgd Exp $ */2/* $NetBSD: telnet.h,v 1.4 1994/10/26 00:56:46 cgd Exp $ */
33
4/*4/*
...@@ -96,7 +96,7 @@ extern char *telcmds[];...@@ -96,7 +96,7 @@ extern char *telcmds[];
96#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */96#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
97#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */97#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
98#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */98#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
99#define TELOPT_XASCII 17 /* extended ascic character set */99#define TELOPT_XASCII 17 /* extended ASCII character set */
100#define TELOPT_LOGOUT 18 /* force logout */100#define TELOPT_LOGOUT 18 /* force logout */
101#define TELOPT_BM 19 /* byte macro */101#define TELOPT_BM 19 /* byte macro */
102#define TELOPT_DET 20 /* data entry terminal */102#define TELOPT_DET 20 /* data entry terminal */
lib/libc/include/generic-openbsd/imsg.h+9-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: imsg.h,v 1.24 2025/06/05 08:55:07 tb Exp $ */1/* $OpenBSD: imsg.h,v 1.25 2026/09/04 18:47:43 claudio Exp $ */
22
3/*3/*
4 * Copyright (c) 2023 Claudio Jeker <claudio@openbsd.org>4 * Copyright (c) 2023 Claudio Jeker <claudio@openbsd.org>
...@@ -46,6 +46,8 @@ struct msgbuf;...@@ -46,6 +46,8 @@ struct msgbuf;
4646
47struct imsgbuf {47struct imsgbuf {
48 struct msgbuf *w;48 struct msgbuf *w;
49 void (*cb)(struct imsgbuf *, void *);
50 void *userdata;
49 pid_t pid;51 pid_t pid;
50 uint32_t maxsize;52 uint32_t maxsize;
51 int fd;53 int fd;
...@@ -127,6 +129,7 @@ int ibuf_write(int, struct msgbuf *);...@@ -127,6 +129,7 @@ int ibuf_write(int, struct msgbuf *);
127int msgbuf_write(int, struct msgbuf *);129int msgbuf_write(int, struct msgbuf *);
128int ibuf_read(int, struct msgbuf *);130int ibuf_read(int, struct msgbuf *);
129int msgbuf_read(int, struct msgbuf *);131int msgbuf_read(int, struct msgbuf *);
132uint32_t msgbuf_readlen(struct msgbuf *);
130struct ibuf *msgbuf_get(struct msgbuf *);133struct ibuf *msgbuf_get(struct msgbuf *);
131134
132struct ibufqueue *ibufq_new(void);135struct ibufqueue *ibufq_new(void);
...@@ -140,14 +143,17 @@ void ibufq_flush(struct ibufqueue *);...@@ -140,14 +143,17 @@ void ibufq_flush(struct ibufqueue *);
140/* imsg.c */143/* imsg.c */
141int imsgbuf_init(struct imsgbuf *, int);144int imsgbuf_init(struct imsgbuf *, int);
142void imsgbuf_allow_fdpass(struct imsgbuf *imsgbuf);145void imsgbuf_allow_fdpass(struct imsgbuf *imsgbuf);
146void imsgbuf_set_close_callback(struct imsgbuf *,
147 void (*)(struct imsgbuf *, void *));
143int imsgbuf_set_maxsize(struct imsgbuf *, uint32_t);148int imsgbuf_set_maxsize(struct imsgbuf *, uint32_t);
149void *imsgbuf_set_userdata(struct imsgbuf *, void *);
150void *imsgbuf_get_userdata(struct imsgbuf *);
144int imsgbuf_read(struct imsgbuf *);151int imsgbuf_read(struct imsgbuf *);
145int imsgbuf_write(struct imsgbuf *);152int imsgbuf_write(struct imsgbuf *);
146int imsgbuf_flush(struct imsgbuf *);153int imsgbuf_flush(struct imsgbuf *);
147void imsgbuf_clear(struct imsgbuf *);154void imsgbuf_clear(struct imsgbuf *);
148uint32_t imsgbuf_queuelen(struct imsgbuf *);155uint32_t imsgbuf_queuelen(struct imsgbuf *);
149int imsgbuf_get(struct imsgbuf *, struct imsg *);156int imsgbuf_get(struct imsgbuf *, struct imsg *);
150ssize_t imsg_get(struct imsgbuf *, struct imsg *);
151int imsg_ibufq_pop(struct ibufqueue *, struct imsg *);157int imsg_ibufq_pop(struct ibufqueue *, struct imsg *);
152void imsg_ibufq_push(struct ibufqueue *, struct imsg *);158void imsg_ibufq_push(struct ibufqueue *, struct imsg *);
153int imsg_get_ibuf(struct imsg *, struct ibuf *);159int imsg_get_ibuf(struct imsg *, struct ibuf *);
...@@ -164,10 +170,9 @@ int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int,...@@ -164,10 +170,9 @@ int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int,
164 const void *, size_t);170 const void *, size_t);
165int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int,171int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int,
166 const struct iovec *, int);172 const struct iovec *, int);
167int imsg_compose_ibuf(struct imsgbuf *, uint32_t, uint32_t, pid_t,
168 struct ibuf *);
169struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, size_t);173struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, size_t);
170int imsg_add(struct ibuf *, const void *, size_t);174int imsg_add(struct ibuf *, const void *, size_t);
175int imsg_add_strbuf(struct ibuf *, const char *, size_t);
171void imsg_close(struct imsgbuf *, struct ibuf *);176void imsg_close(struct imsgbuf *, struct ibuf *);
172void imsg_free(struct imsg *);177void imsg_free(struct imsg *);
173int imsg_set_maxsize(struct ibuf *, size_t);178int imsg_set_maxsize(struct ibuf *, size_t);
lib/libc/include/generic-openbsd/limits.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: limits.h,v 1.19 2015/01/20 22:09:50 tedu Exp $ */1/* $OpenBSD: limits.h,v 1.20 2026/08/10 20:10:19 daniel Exp $ */
2/* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */2/* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */
33
4/*4/*
...@@ -55,7 +55,7 @@...@@ -55,7 +55,7 @@
55#define _POSIX_SYMLOOP_MAX 855#define _POSIX_SYMLOOP_MAX 8
56#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 456#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
57#define _POSIX_THREAD_KEYS_MAX 12857#define _POSIX_THREAD_KEYS_MAX 128
58#define _POSIX_THREAD_THREADS_MAX 458#define _POSIX_THREAD_THREADS_MAX 64
5959
60#if __POSIX_VISIBLE >= 20011260#if __POSIX_VISIBLE >= 200112
61#define _POSIX_CLOCKRES_MIN 2000000061#define _POSIX_CLOCKRES_MIN 20000000
lib/libc/include/generic-openbsd/machine/_float.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
2
3#include <mips64/_float.h>
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/cdefs.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */
2/* public domain */
3#include <mips64/cdefs.h>
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/disklabel.h deleted-16
...@@ -1,16 +0,0 @@
1/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */
2/* public domain */
3
4/*
5 * Standard MBR partition scheme, with the label in the second sector
6 * of the OpenBSD partition.
7 */
8
9#ifndef _MACHINE_DISKLABEL_H_
10#define _MACHINE_DISKLABEL_H_
11
12#define LABELSECTOR 1 /* sector containing label */
13#define LABELOFFSET 0 /* offset of label in sector */
14#define MAXPARTITIONS 16 /* number of partitions */
15
16#endif /* _MACHINE_DISKLABEL_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/fenv.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/fenv.h>
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/loadfile_machdep.h deleted-49
...@@ -1,49 +0,0 @@
1/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */
2/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */
3
4/*-
5 * Copyright (c) 1999 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Christos Zoulas.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#define BOOT_ELF
34#define ELFSIZE 64
35
36#define LOAD_KERNEL LOAD_ALL
37#define COUNT_KERNEL COUNT_ALL
38
39#define LOADADDR(a) (((u_long)(a)) + offset)
40#define ALIGNENTRY(a) ((u_long)(a))
41#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
42#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
43#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
44#define WARN(a) (void)(printf a, \
45 printf((errno ? ": %s\n" : "\n"), \
46 strerror(errno)))
47#define PROGRESS(a) (void) printf a
48#define ALLOC(a) alloc(a)
49#define FREE(a, b) free(a, b)
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/reloc.h deleted-5
...@@ -1,5 +0,0 @@
1/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */
2
3/* public domain */
4
5#include <mips64/reloc.h>
\ No newline at end of file
lib/libc/include/generic-openbsd/machine/tcb.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/tcb.h>
\ No newline at end of file
lib/libc/include/generic-openbsd/math.h+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: math.h,v 1.36 2018/03/10 20:52:58 kettenis Exp $ */1/* $OpenBSD: math.h,v 1.37 2026/08/03 22:19:15 daniel Exp $ */
2/*2/*
3 * ====================================================3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
...@@ -146,7 +146,7 @@ extern char __nan[];...@@ -146,7 +146,7 @@ extern char __nan[];
146extern int signgam;146extern int signgam;
147#endif /* __BSD_VISIBLE || __XPG_VISIBLE */147#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
148148
149#if __POSIX_VISIBLE >= 201403149#if __XPG_VISIBLE >= 800
150#define M_El 2.718281828459045235360287471352662498L /* e */150#define M_El 2.718281828459045235360287471352662498L /* e */
151#define M_LOG2El 1.442695040888963407359924681001892137L /* log 2e */151#define M_LOG2El 1.442695040888963407359924681001892137L /* log 2e */
152#define M_LOG10El 0.434294481903251827651128918916605082L /* log 10e */152#define M_LOG10El 0.434294481903251827651128918916605082L /* log 10e */
...@@ -160,7 +160,7 @@ extern int signgam;...@@ -160,7 +160,7 @@ extern int signgam;
160#define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */160#define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
161#define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */161#define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */
162#define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */162#define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
163#endif /* __POSIX_VISIBLE >= 201403 */163#endif /* __XPG_VISIBLE >= 800 */
164164
165#if __BSD_VISIBLE165#if __BSD_VISIBLE
166#define HUGE MAXFLOAT166#define HUGE MAXFLOAT
lib/libc/include/generic-openbsd/md5.h+1-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: md5.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */1/* $OpenBSD: md5.h,v 1.18 2026/08/31 15:09:14 tb Exp $ */
22
3/*3/*
4 * This code implements the MD5 message-digest algorithm.4 * This code implements the MD5 message-digest algorithm.
...@@ -29,18 +29,12 @@ __BEGIN_DECLS...@@ -29,18 +29,12 @@ __BEGIN_DECLS
29void MD5Init(MD5_CTX *);29void MD5Init(MD5_CTX *);
30void MD5Update(MD5_CTX *, const u_int8_t *, size_t)30void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
31 __attribute__((__bounded__(__string__,2,3)));31 __attribute__((__bounded__(__string__,2,3)));
32void MD5Pad(MD5_CTX *);
33void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)32void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
34 __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));33 __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
35void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH])
36 __attribute__((__bounded__(__minbytes__,1,4)))
37 __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)));
38char *MD5End(MD5_CTX *, char *)34char *MD5End(MD5_CTX *, char *)
39 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));35 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
40char *MD5File(const char *, char *)36char *MD5File(const char *, char *)
41 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));37 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
42char *MD5FileChunk(const char *, char *, off_t, off_t)
43 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
44char *MD5Data(const u_int8_t *, size_t, char *)38char *MD5Data(const u_int8_t *, size_t, char *)
45 __attribute__((__bounded__(__string__,1,2)))39 __attribute__((__bounded__(__string__,1,2)))
46 __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));40 __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
lib/libc/include/generic-openbsd/mips64/_float.h deleted-71
...@@ -1,71 +0,0 @@
1/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
2
3/*
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef _MACHINE__FLOAT_H_
33#define _MACHINE__FLOAT_H_
34
35#define __FLT_RADIX 2 /* b */
36#define __FLT_ROUNDS __flt_rounds()
37#define __FLT_EVAL_METHOD 0 /* no promotions */
38
39#define __FLT_MANT_DIG 24 /* p */
40#define __FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
41#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
42#define __FLT_MIN_EXP (-125) /* emin */
43#define __FLT_MIN 1.17549435E-38F /* b**(emin-1) */
44#define __FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
45#define __FLT_MAX_EXP 128 /* emax */
46#define __FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
47#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
48
49#define __DBL_MANT_DIG 53
50#define __DBL_EPSILON 2.2204460492503131E-16
51#define __DBL_DIG 15
52#define __DBL_MIN_EXP (-1021)
53#define __DBL_MIN 2.2250738585072014E-308
54#define __DBL_MIN_10_EXP (-307)
55#define __DBL_MAX_EXP 1024
56#define __DBL_MAX 1.7976931348623157E+308
57#define __DBL_MAX_10_EXP 308
58
59#define __LDBL_MANT_DIG 113
60#define __LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
61#define __LDBL_DIG 33
62#define __LDBL_MIN_EXP (-16381)
63#define __LDBL_MIN 3.36210314311209350626267781732175260e-4932L
64#define __LDBL_MIN_10_EXP (-4931)
65#define __LDBL_MAX_EXP 16384
66#define __LDBL_MAX 1.18973149535723176508575932662800702e+4932L
67#define __LDBL_MAX_10_EXP 4932
68
69#define __DECIMAL_DIG 36
70
71#endif /* _MACHINE__FLOAT_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/_types.h deleted-154
...@@ -1,154 +0,0 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */
2
3/*-
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)types.h 8.3 (Berkeley) 1/5/94
32 * @(#)ansi.h 8.2 (Berkeley) 1/4/94
33 */
34
35#ifndef _MIPS64__TYPES_H_
36#define _MIPS64__TYPES_H_
37
38/*
39 * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
40 * value for all data types (int, long, ...). The result is an
41 * unsigned long and must be cast to any desired pointer type.
42 *
43 * _ALIGNED_POINTER is a boolean macro that checks whether an address
44 * is valid to fetch data elements of type t from on this architecture.
45 * This does not reflect the optimal alignment, just the possibility
46 * (within reasonable limits).
47 */
48#define _ALIGNBYTES 7
49#define _STACKALIGNBYTES 15
50#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
51#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
52#define _MAX_PAGE_SHIFT 14 /* maximum possible PAGE_SHIFT */
53
54/*
55 * We need to handle the various ISA levels for sizes.
56 */
57#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
58#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
59#define _MIPS_ISA_MIPS3 3 /* R4000 */
60#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
61#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
62#define _MIPS_ISA_MIPS64 64 /* MIPS64 */
63
64/* 7.18.1.1 Exact-width integer types */
65typedef signed char __int8_t;
66typedef unsigned char __uint8_t;
67typedef short __int16_t;
68typedef unsigned short __uint16_t;
69typedef int __int32_t;
70typedef unsigned int __uint32_t;
71typedef long long __int64_t;
72typedef unsigned long long __uint64_t;
73
74/* 7.18.1.2 Minimum-width integer types */
75typedef __int8_t __int_least8_t;
76typedef __uint8_t __uint_least8_t;
77typedef __int16_t __int_least16_t;
78typedef __uint16_t __uint_least16_t;
79typedef __int32_t __int_least32_t;
80typedef __uint32_t __uint_least32_t;
81typedef __int64_t __int_least64_t;
82typedef __uint64_t __uint_least64_t;
83
84/* 7.18.1.3 Fastest minimum-width integer types */
85typedef __int32_t __int_fast8_t;
86typedef __uint32_t __uint_fast8_t;
87typedef __int32_t __int_fast16_t;
88typedef __uint32_t __uint_fast16_t;
89typedef __int32_t __int_fast32_t;
90typedef __uint32_t __uint_fast32_t;
91typedef __int64_t __int_fast64_t;
92typedef __uint64_t __uint_fast64_t;
93#define __INT_FAST8_MIN INT32_MIN
94#define __INT_FAST16_MIN INT32_MIN
95#define __INT_FAST32_MIN INT32_MIN
96#define __INT_FAST64_MIN INT64_MIN
97#define __INT_FAST8_MAX INT32_MAX
98#define __INT_FAST16_MAX INT32_MAX
99#define __INT_FAST32_MAX INT32_MAX
100#define __INT_FAST64_MAX INT64_MAX
101#define __UINT_FAST8_MAX UINT32_MAX
102#define __UINT_FAST16_MAX UINT32_MAX
103#define __UINT_FAST32_MAX UINT32_MAX
104#define __UINT_FAST64_MAX UINT64_MAX
105
106/* 7.18.1.4 Integer types capable of holding object pointers */
107typedef long __intptr_t;
108typedef unsigned long __uintptr_t;
109
110/* 7.18.1.5 Greatest-width integer types */
111typedef __int64_t __intmax_t;
112typedef __uint64_t __uintmax_t;
113
114/* Register size */
115typedef long __register_t;
116typedef long f_register_t; /* XXX */
117
118/* VM system types */
119typedef unsigned long __vaddr_t;
120typedef unsigned long __paddr_t;
121typedef unsigned long __vsize_t;
122typedef unsigned long __psize_t;
123
124/* Standard system types */
125typedef double __double_t;
126typedef float __float_t;
127typedef long __ptrdiff_t;
128typedef unsigned long __size_t;
129typedef long __ssize_t;
130#if defined(__GNUC__) && __GNUC__ >= 3
131typedef __builtin_va_list __va_list;
132#else
133typedef char * __va_list;
134#endif
135
136/* Wide character support types */
137#ifndef __cplusplus
138typedef int __wchar_t;
139#endif
140typedef int __wint_t;
141typedef int __rune_t;
142typedef void * __wctrans_t;
143typedef void * __wctype_t;
144
145#if defined(_KERNEL)
146typedef struct label_t {
147 long val[14];
148} label_t;
149#endif
150
151/* Feature test macros */
152#define __HAVE_EXEC_MD_MAP
153
154#endif /* _MIPS64__TYPES_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/archtype.h deleted-77
...@@ -1,77 +0,0 @@
1/* $OpenBSD: archtype.h,v 1.16 2012/10/03 21:44:51 miod Exp $ */
2/*
3 * Copyright (c) 1997-2004 Opsycon AB, Sweden (www.opsycon.se)
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
15 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#ifndef _MIPS64_ARCHTYPE_H_
29#define _MIPS64_ARCHTYPE_H_
30/*
31 * Define architectural identities for the different Mips machines.
32 */
33#define ACER_PICA_61 0x0001 /* Acer Labs Pica 61 */
34#define MAGNUM 0x0002 /* Mips MAGNUM R4000 */
35#define DESKSTATION_RPC44 0x0003 /* Deskstation rPC44 */
36#define DESKSTATION_TYNE 0x0004 /* Deskstation Tyne */
37#define NKK_AQUARIUS 0x0005 /* NKK R4{67}00 PC */
38#define NEC_R94 0x0006 /* NEC Magnum class */
39#define SNI_RM200 0x0007 /* Siemens Nixdorf RM200 */
40
41#define SGI_IP17 0x0011 /* Crimson */
42#define SGI_IP19 0x0012 /* Onyx (!S model Challenge) */
43#define SGI_IP20 0x0013 /* Indigo */
44#define SGI_IP21 0x0014 /* POWER Challenge, POWER Onyx */
45#define SGI_IP22 0x0015 /* Indy, Indigo2, Challenge S */
46#define SGI_IP25 0x0016 /* POWER Challenge R10k */
47#define SGI_IP26 0x0017 /* POWER Indigo2 R8k */
48#define SGI_IP27 0x0018 /* IP27 Origin200/2000 */
49#define SGI_IP28 0x0019 /* POWER Indigo2 R10k */
50#define SGI_OCTANE 0x001a /* IP30 Octane */
51#define SGI_O2 0x001b /* IP32 O2 */
52#define SGI_IP35 0x001c /* IP35 Origin3x0/3x00/Fuel/Tezro */
53
54#define ALGOR_P4032 0x0021 /* ALGORITHMICS P-4032 */
55#define ALGOR_P5064 0x0022 /* ALGORITHMICS P-5064 */
56
57#define GALILEO_G9 0x0031 /* Galileo GT-64011 Eval board */
58#define GALILEO_EV64240 0x0032 /* Galileo EV64240 Eval board */
59#define GALILEO_EV64340 0x0033 /* Galileo EV64340 Eval board */
60
61#define MOMENTUM_CP7000 0x0041 /* Momentum Ocelot */
62#define MOMENTUM_CP7000G 0x0042 /* Momentum Ocelot-G */
63#define MOMENTUM_JAGUAR 0x0043 /* Momentum Jaguar ATX */
64
65#define WG4308 0x0052 /* Willowglen 4308 LMD */
66#define WG4309 0x0053 /* Willowglen 4309 LMD */
67#define WG4409 0x0054 /* Willowglen 4409 LMD */
68#define WG8138 0x0055 /* Willowglen 8138 523x VME card */
69#define WG8168 0x0056 /* Willowglen 8168 5231 VME card */
70#define WG6000 0x0057 /* Willowglen CPU-6000 */
71#define WG7000 0x0058 /* Willowglen CPU-7000 */
72#define WG8200 0x0059 /* Willowglen CPU-8200 */
73#define WG8232 0x005a /* Willowglen CPU-8232 */
74
75#define LAGUNA 0x00f1 /* Heurikon Laguna VME board */
76
77#endif /* !_MIPS64_ARCHTYPE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/asm.h deleted-360
...@@ -1,360 +0,0 @@
1/* $OpenBSD: asm.h,v 1.27 2021/05/01 16:11:10 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#ifndef _MIPS64_ASM_H_
29#define _MIPS64_ASM_H_
30
31#include <machine/regdef.h>
32
33#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
34#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
35#define _MIPS_ISA_MIPS3 3 /* R4000 */
36#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
37#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
38#define _MIPS_ISA_MIPS64 64 /* MIPS64 */
39
40#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
41#define ABICALLS .abicalls
42#endif
43
44#if defined(ABICALLS) && !defined(_KERNEL)
45 ABICALLS
46#endif
47
48#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */
49
50#if !defined(__MIPSEL__) && !defined(__MIPSEB__)
51#error "__MIPSEL__ or __MIPSEB__ must be defined"
52#endif
53/*
54 * Define how to access unaligned data word
55 */
56#if defined(__MIPSEL__)
57#define LWLO lwl
58#define LWHI lwr
59#define SWLO swl
60#define SWHI swr
61#define LDLO ldl
62#define LDHI ldr
63#define SDLO sdl
64#define SDHI sdr
65#endif
66#if defined(__MIPSEB__)
67#define LWLO lwr
68#define LWHI lwl
69#define SWLO swr
70#define SWHI swl
71#define LDLO ldr
72#define LDHI ldl
73#define SDLO sdr
74#define SDHI sdl
75#endif
76
77/*
78 * Define programming environment for ABI.
79 */
80#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
81
82#ifndef _MIPS_SIM
83#define _MIPS_SIM 1
84#define _ABIO32 1
85#endif
86#ifndef _MIPS_ISA
87#define _MIPS_ISA 2
88#define _MIPS_ISA_MIPS2 2
89#endif
90
91#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
92#define NARGSAVE 4
93
94#define SETUP_GP \
95 .set noreorder; \
96 .cpload t9; \
97 .set reorder;
98
99#define SAVE_GP(x) \
100 .cprestore x
101
102#define SETUP_GP64(gpoff, name)
103#define RESTORE_GP64
104#endif
105
106#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
107#define NARGSAVE 0
108
109#define SETUP_GP
110#define SAVE_GP(x)
111#define SETUP_GP64(gpoff, name) \
112 .cpsetup t9, gpoff, name
113#define RESTORE_GP64 \
114 .cpreturn
115#endif
116
117#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31))
118
119#else /* defined(ABICALLS) && !defined(_KERNEL) */
120
121#define NARGSAVE 4
122#define SETUP_GP
123#define SAVE_GP(x)
124
125#define ALIGNSZ 16 /* Stack layout alignment */
126#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
127
128#endif
129
130/*
131 * Basic register operations based on selected ISA
132 */
133#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \
134 _MIPS_ISA == _MIPS_ISA_MIPS32)
135#define REGSZ 4 /* 32 bit mode register size */
136#define LOGREGSZ 2 /* log rsize */
137#define REG_S sw
138#define REG_L lw
139#define CF_SZ 24 /* Call frame size */
140#define CF_ARGSZ 16 /* Call frame arg size */
141#define CF_RA_OFFS 20 /* Call ra save offset */
142#endif
143
144#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \
145 _MIPS_ISA == _MIPS_ISA_MIPS64)
146#define REGSZ 8 /* 64 bit mode register size */
147#define LOGREGSZ 3 /* log rsize */
148#define REG_S sd
149#define REG_L ld
150#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */
151#define CF_ARGSZ 32 /* Call frame arg size */
152#define CF_RA_OFFS 40 /* Call ra save offset */
153#endif
154
155#ifndef __LP64__
156#define PTR_L lw
157#define PTR_S sw
158#define PTR_SUB sub
159#define PTR_ADD add
160#define PTR_SUBU subu
161#define PTR_ADDU addu
162#define LI li
163#define LA la
164#define PTR_SLL sll
165#define PTR_SRL srl
166#define PTR_VAL .word
167#else
168#define PTR_L ld
169#define PTR_S sd
170#define PTR_ADD dadd
171#define PTR_SUB dsub
172#define PTR_SUBU dsubu
173#define PTR_ADDU daddu
174#define LI dli
175#define LA dla
176#define PTR_SLL dsll
177#define PTR_SRL dsrl
178#define PTR_VAL .dword
179#endif
180
181#define NOP nop
182#define DMFC0 dmfc0
183#define DMTC0 dmtc0
184#define MFC0 mfc0
185#define MTC0 mtc0
186#define ERET sync; eret
187
188/*
189 * Define -pg profile entry code.
190 */
191#if defined(XGPROF) || defined(XPROF)
192#define MCOUNT \
193 PTR_SUBU sp, sp, 64; \
194 SAVE_GP(16); \
195 sd ra, 56(sp); \
196 sd gp, 48(sp); \
197 .set noat; \
198 .set noreorder; \
199 move AT, ra; \
200 jal _mcount; \
201 PTR_SUBU sp, sp, 16; \
202 ld ra, 56(sp); \
203 PTR_ADDU sp, sp, 64; \
204 .set reorder; \
205 .set at;
206#else
207#define MCOUNT
208#endif
209
210/*
211 * LEAF(x, fsize)
212 *
213 * Declare a leaf routine.
214 */
215#define LEAF(x, fsize) \
216 .align 3; \
217 .globl x; \
218 .ent x, 0; \
219x: ; \
220 .frame sp, fsize, ra; \
221 SETUP_GP \
222 MCOUNT
223
224#define ALEAF(x) \
225 .globl x; \
226x:
227
228/*
229 * NLEAF(x)
230 *
231 * Declare a non-profiled leaf routine.
232 */
233#define NLEAF(x, fsize) \
234 .align 3; \
235 .globl x; \
236 .ent x, 0; \
237x: ; \
238 .frame sp, fsize, ra; \
239 SETUP_GP
240
241/*
242 * NON_LEAF(x)
243 *
244 * Declare a non-leaf routine (a routine that makes other C calls).
245 */
246#define NON_LEAF(x, fsize, retpc) \
247 .align 3; \
248 .globl x; \
249 .ent x, 0; \
250x: ; \
251 .frame sp, fsize, retpc; \
252 SETUP_GP \
253 MCOUNT
254
255/*
256 * NNON_LEAF(x)
257 *
258 * Declare a non-profiled non-leaf routine
259 * (a routine that makes other C calls).
260 */
261#define NNON_LEAF(x, fsize, retpc) \
262 .align 3; \
263 .globl x; \
264 .ent x, 0; \
265x: ; \
266 .frame sp, fsize, retpc \
267 SETUP_GP
268
269/*
270 * END(x)
271 *
272 * Mark end of a procedure.
273 */
274#define END(x) \
275 .end x
276
277/*
278 * STRONG_ALIAS, WEAK_ALIAS
279 * Create a strong or weak alias.
280 */
281#define STRONG_ALIAS(alias,sym) \
282 .global alias; alias = sym
283#define WEAK_ALIAS(alias,sym) \
284 .weak alias; alias = sym
285
286
287/*
288 * Macros to panic and printf from assembly language.
289 */
290#define PANIC(msg) \
291 LA a0, 9f; \
292 jal panic; \
293 nop ; \
294 MSG(msg)
295
296#define PRINTF(msg) \
297 LA a0, 9f; \
298 jal printf; \
299 nop ; \
300 MSG(msg)
301
302#define MSG(msg) \
303 .rdata; \
3049: .asciiz msg; \
305 .text
306
307#define LOAD_XKPHYS(reg, cca) \
308 li reg, cca | 0x10; \
309 dsll reg, reg, 59
310
311#ifdef MULTIPROCESSOR
312#define GET_CPU_INFO(ci, tmp) HW_GET_CPU_INFO(ci, tmp)
313#else /* MULTIPROCESSOR */
314#define GET_CPU_INFO(ci, tmp) \
315 LA ci, cpu_info_primary
316#endif /* MULTIPROCESSOR */
317
318/*
319 * Hazards
320 */
321
322#ifdef CPU_OCTEON
323/*
324 * OCTEON clears hazards in hardware.
325 */
326#define MFC0_HAZARD /* nothing */
327#define MTC0_HAZARD /* nothing */
328#define MTC0_SR_IE_HAZARD /* nothing */
329#define MTC0_SR_CU_HAZARD /* nothing */
330#define TLB_HAZARD /* nothing */
331#endif
332
333/* Hazard between {d,}mfc0 of COP_0_VADDR */
334#ifndef PRE_MFC0_ADDR_HAZARD
335#define PRE_MFC0_ADDR_HAZARD /* nothing */
336#endif
337
338/* Hazard after {d,}mfc0 from any register */
339#ifndef MFC0_HAZARD
340#define MFC0_HAZARD /* nothing */
341#endif
342/* Hazard after {d,}mtc0 to any register */
343#ifndef MTC0_HAZARD
344#define MTC0_HAZARD NOP; NOP; NOP; NOP
345#endif
346/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of interrupts */
347#ifndef MTC0_SR_IE_HAZARD
348#define MTC0_SR_IE_HAZARD MTC0_HAZARD
349#endif
350/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of coprocessors */
351#ifndef MTC0_SR_CU_HAZARD
352#define MTC0_SR_CU_HAZARD NOP; NOP
353#endif
354
355/* Hazard before and after a tlbp, tlbr, tlbwi or tlbwr instruction */
356#ifndef TLB_HAZARD
357#define TLB_HAZARD NOP; NOP
358#endif
359
360#endif /* !_MIPS64_ASM_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/atomic.h deleted-214
...@@ -1,214 +0,0 @@
1/* $OpenBSD: atomic.h,v 1.12 2019/10/28 09:41:37 visa Exp $ */
2
3/* Public Domain */
4
5#ifndef _MIPS64_ATOMIC_H_
6#define _MIPS64_ATOMIC_H_
7
8#if defined(_KERNEL)
9
10/* wait until the bits to set are clear, and set them */
11static __inline void
12atomic_wait_and_setbits_int(volatile unsigned int *uip, unsigned int v)
13{
14 unsigned int tmp0, tmp1;
15
16 __asm__ volatile (
17 "1: ll %0, 0(%2)\n"
18 " and %1, %0, %3\n"
19 " bnez %1, 1b\n"
20 " or %0, %3, %0\n"
21 " sc %0, 0(%2)\n"
22 " beqz %0, 1b\n"
23 " nop\n" :
24 "=&r"(tmp0), "=&r"(tmp1) :
25 "r"(uip), "r"(v) : "memory");
26}
27
28static __inline void
29atomic_setbits_int(volatile unsigned int *uip, unsigned int v)
30{
31 unsigned int tmp;
32
33 __asm__ volatile (
34 "1: ll %0, 0(%1)\n"
35 " or %0, %2, %0\n"
36 " sc %0, 0(%1)\n"
37 " beqz %0, 1b\n"
38 " nop\n" :
39 "=&r"(tmp) :
40 "r"(uip), "r"(v) : "memory");
41}
42
43static __inline void
44atomic_clearbits_int(volatile unsigned int *uip, unsigned int v)
45{
46 unsigned int tmp;
47
48 __asm__ volatile (
49 "1: ll %0, 0(%1)\n"
50 " and %0, %2, %0\n"
51 " sc %0, 0(%1)\n"
52 " beqz %0, 1b\n"
53 " nop\n" :
54 "=&r"(tmp) :
55 "r"(uip), "r"(~v) : "memory");
56}
57
58#endif /* defined(_KERNEL) */
59
60static inline unsigned int
61_atomic_cas_uint(volatile unsigned int *p, unsigned int o, unsigned int n)
62{
63 unsigned int rv, wv;
64
65 __asm__ volatile (
66 "1: ll %0, %1\n"
67 " bne %0, %4, 2f\n"
68 " move %2, %3\n"
69 " sc %2, %1\n"
70 " beqz %2, 1b\n"
71 "2: nop\n"
72 : "=&r" (rv), "+m" (*p), "=&r" (wv)
73 : "r" (n), "Ir" (o));
74
75 return (rv);
76}
77#define atomic_cas_uint(_p, _o, _n) _atomic_cas_uint((_p), (_o), (_n))
78
79static inline unsigned long
80_atomic_cas_ulong(volatile unsigned long *p, unsigned long o, unsigned long n)
81{
82 unsigned long rv, wv;
83
84 __asm__ volatile (
85 "1: lld %0, %1\n"
86 " bne %0, %4, 2f\n"
87 " move %2, %3\n"
88 " scd %2, %1\n"
89 " beqz %2, 1b\n"
90 "2: nop\n"
91 : "=&r" (rv), "+m" (*p), "=&r" (wv)
92 : "r" (n), "Ir" (o));
93
94 return (rv);
95}
96#define atomic_cas_ulong(_p, _o, _n) _atomic_cas_ulong((_p), (_o), (_n))
97
98static inline void *
99_atomic_cas_ptr(volatile void *pp, void *o, void *n)
100{
101 void * volatile *p = pp;
102 void *rv, *wv;
103
104 __asm__ volatile (
105 "1: lld %0, %1\n"
106 " bne %0, %4, 2f\n"
107 " move %2, %3\n"
108 " scd %2, %1\n"
109 " beqz %2, 1b\n"
110 "2: nop\n"
111 : "=&r" (rv), "+m" (*p), "=&r" (wv)
112 : "r" (n), "Ir" (o));
113
114 return (rv);
115}
116#define atomic_cas_ptr(_p, _o, _n) _atomic_cas_ptr((_p), (_o), (_n))
117
118
119
120static inline unsigned int
121_atomic_swap_uint(volatile unsigned int *uip, unsigned int v)
122{
123 unsigned int o, t;
124
125 __asm__ volatile (
126 "1: ll %0, %1\n"
127 " move %2, %3\n"
128 " sc %2, %1\n"
129 " beqz %2, 1b\n"
130 " nop\n"
131 : "=&r" (o), "+m" (*uip), "=&r" (t)
132 : "r" (v));
133
134 return (o);
135}
136#define atomic_swap_uint(_p, _v) _atomic_swap_uint((_p), (_v))
137
138static inline unsigned long
139_atomic_swap_ulong(volatile unsigned long *uip, unsigned long v)
140{
141 unsigned long o, t;
142
143 __asm__ volatile (
144 "1: lld %0, %1\n"
145 " move %2, %3\n"
146 " scd %2, %1\n"
147 " beqz %2, 1b\n"
148 " nop\n"
149 : "=&r" (o), "+m" (*uip), "=&r" (t)
150 : "r" (v));
151
152 return (o);
153}
154#define atomic_swap_ulong(_p, _v) _atomic_swap_ulong((_p), (_v))
155
156
157static inline void *
158_atomic_swap_ptr(volatile void *uipp, void *n)
159{
160 void * volatile *uip = uipp;
161 void *o, *t;
162
163 __asm__ volatile (
164 "1: lld %0, %1\n"
165 " move %2, %3\n"
166 " scd %2, %1\n"
167 " beqz %2, 1b\n"
168 " nop\n"
169 : "=&r" (o), "+m" (*uip), "=&r" (t)
170 : "r" (n));
171
172 return (o);
173}
174#define atomic_swap_ptr(_p, _n) _atomic_swap_ptr((_p), (_n))
175
176static inline unsigned int
177_atomic_add_int_nv(volatile unsigned int *uip, unsigned int v)
178{
179 unsigned int rv, nv;
180
181 __asm__ volatile (
182 "1: ll %0, %1\n"
183 " addu %2, %0, %3\n"
184 " sc %2, %1\n"
185 " beqz %2, 1b\n"
186 " nop\n"
187 : "=&r" (rv), "+m" (*uip), "=&r" (nv)
188 : "Ir" (v));
189
190 return (rv + v);
191}
192#define atomic_add_int_nv(_uip, _v) _atomic_add_int_nv((_uip), (_v))
193#define atomic_sub_int_nv(_uip, _v) _atomic_add_int_nv((_uip), 0 - (_v))
194
195static inline unsigned long
196_atomic_add_long_nv(volatile unsigned long *uip, unsigned long v)
197{
198 unsigned long rv, nv;
199
200 __asm__ volatile (
201 "1: lld %0, %1\n"
202 " daddu %2, %0, %3\n"
203 " scd %2, %1\n"
204 " beqz %2, 1b\n"
205 " nop\n"
206 : "=&r" (rv), "+m" (*uip), "=&r" (nv)
207 : "Ir" (v));
208
209 return (rv + v);
210}
211#define atomic_add_long_nv(_uip, _v) _atomic_add_long_nv((_uip), (_v))
212#define atomic_sub_long_nv(_uip, _v) _atomic_add_long_nv((_uip), 0UL - (_v))
213
214#endif /* _MIPS64_ATOMIC_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/autoconf.h deleted-37
...@@ -1,37 +0,0 @@
1/* $OpenBSD: autoconf.h,v 1.2 2017/06/08 12:02:52 visa Exp $ */
2
3/*
4 * Copyright (c) 2010 Miodrag Vallat.
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 * Common defines used by autoconf on all mips64-based platforms.
21 */
22
23#ifndef _MIPS64_AUTOCONF_H_
24#define _MIPS64_AUTOCONF_H_
25
26#include <machine/cpu.h> /* for struct cpu_hwinfo */
27
28struct cpu_attach_args {
29 struct mainbus_attach_args caa_maa;
30 struct cpu_hwinfo *caa_hw;
31};
32
33extern struct cpu_hwinfo bootcpu_hwinfo;
34
35void unmap_startup(void);
36
37#endif /* _MIPS64_AUTOCONF_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/cache.h deleted-107
...@@ -1,107 +0,0 @@
1/* $OpenBSD: cache.h,v 1.9 2016/12/21 13:59:57 visa Exp $ */
2
3/*
4 * Copyright (c) 2012 Miodrag Vallat.
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#ifndef _MIPS64_CACHE_H_
20#define _MIPS64_CACHE_H_
21
22/*
23 * Declare canonical cache functions for a given processor.
24 *
25 * The following assumptions are made:
26 * - only L1 has split instruction and data caches.
27 * - L1 I$ is virtually indexed.
28 *
29 * Processor-specific routines will make extra assumptions.
30 */
31
32#define CACHE_PROTOS(chip) \
33/* Figure out cache configuration */ \
34void chip##_ConfigCache(struct cpu_info *); \
35/* Writeback and invalidate all caches */ \
36void chip##_SyncCache(struct cpu_info *); \
37/* Invalidate all I$ for the given range */ \
38void chip##_InvalidateICache(struct cpu_info *, vaddr_t, size_t); \
39/* Register a given page for I$ invalidation */ \
40void chip##_InvalidateICachePage(struct cpu_info *, vaddr_t); \
41/* Perform postponed I$ invalidation */ \
42void chip##_SyncICache(struct cpu_info *); \
43/* Writeback all D$ for the given page */ \
44void chip##_SyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \
45/* Writeback all D$ for the (currently mapped) given page */ \
46void chip##_HitSyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \
47/* Writeback all D$ for the given range */ \
48void chip##_HitSyncDCache(struct cpu_info *, vaddr_t, size_t); \
49/* Invalidate all D$ for the given range */ \
50void chip##_HitInvalidateDCache(struct cpu_info *, vaddr_t, size_t); \
51/* Enforce coherency of the given range */ \
52void chip##_IOSyncDCache(struct cpu_info *, vaddr_t, size_t, int);
53
54/*
55 * Cavium Octeon.
56 */
57CACHE_PROTOS(Octeon)
58
59void Octeon_lock_secondary_cache(struct cpu_info *, paddr_t, size_t);
60void Octeon_unlock_secondary_cache(struct cpu_info *, paddr_t, size_t);
61
62/*
63 * STC Loongson 2E and 2F.
64 */
65CACHE_PROTOS(Loongson2)
66
67/*
68 * Loongson 3A and 2Gq.
69 */
70CACHE_PROTOS(Loongson3)
71
72/*
73 * MIPS R4000 and R4400.
74 */
75CACHE_PROTOS(Mips4k)
76
77/*
78 * IDT/QED/PMC-Sierra R4600, R4700, R5000, RM52xx, RM7xxx, RM9xxx.
79 */
80CACHE_PROTOS(Mips5k)
81
82/*
83 * MIPS (SGI, really) R8000.
84 */
85CACHE_PROTOS(tfp)
86
87/*
88 * MIPS/NEC R10000/R120000/R140000/R16000.
89 */
90CACHE_PROTOS(Mips10k)
91
92/*
93 * mips64r2-compliant processors.
94 */
95CACHE_PROTOS(mips64r2)
96
97/*
98 * Values used by the IOSyncDCache routine [which acts as the backend of
99 * bus_dmamap_sync()].
100 */
101#define CACHE_SYNC_R 0 /* WB invalidate, WT invalidate */
102#define CACHE_SYNC_W 1 /* WB writeback, WT unaffected */
103#define CACHE_SYNC_X 2 /* WB writeback + invalidate, WT invalidate */
104
105extern vaddr_t cache_valias_mask;
106
107#endif /* _MIPS64_CACHE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/cdefs.h deleted-43
...@@ -1,43 +0,0 @@
1/* $OpenBSD: cdefs.h,v 1.6 2013/03/28 17:30:45 martynas Exp $ */
2
3/*
4 * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_CDEFS_H_
30#define _MIPS64_CDEFS_H_
31
32#define __strong_alias(alias,sym) \
33 __asm__(".global " __STRING(alias) " ; " \
34 __STRING(alias) " = " __STRING(sym))
35#define __weak_alias(alias,sym) \
36 __asm__(".weak " __STRING(alias) " ; " \
37 __STRING(alias) " = " __STRING(sym))
38#define __warn_references(sym,msg) \
39 __asm__(".section .gnu.warning." __STRING(sym) \
40 " ; .ascii \"" msg "\" ; .text")
41#define __indr_references(sym,msg) /* nothing */
42
43#endif /* !_MIPS64_CDEFS_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/cpu.h deleted-552
...@@ -1,552 +0,0 @@
1/* $OpenBSD: cpu.h,v 1.151 2025/06/06 00:07:58 deraadt Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell and Rick Macklem.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * Copyright (C) 1989 Digital Equipment Corporation.
35 * Permission to use, copy, modify, and distribute this software and
36 * its documentation for any purpose and without fee is hereby granted,
37 * provided that the above copyright notice appears in all copies.
38 * Digital Equipment Corporation makes no representations about the
39 * suitability of this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
41 *
42 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
43 */
44
45#ifndef _MIPS64_CPU_H_
46#define _MIPS64_CPU_H_
47
48#ifndef _LOCORE
49
50/*
51 * MIPS32-style segment definitions.
52 * They only cover the first 512MB of physical addresses.
53 */
54#define CKSEG0_BASE 0xffffffff80000000UL
55#define CKSEG1_BASE 0xffffffffa0000000UL
56#define CKSSEG_BASE 0xffffffffc0000000UL
57#define CKSEG3_BASE 0xffffffffe0000000UL
58#define CKSEG_SIZE 0x0000000020000000UL
59
60#define CKSEG0_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1))
61#define CKSEG1_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1))
62#define PHYS_TO_CKSEG0(x) ((u_long)(x) | CKSEG0_BASE)
63#define PHYS_TO_CKSEG1(x) ((u_long)(x) | CKSEG1_BASE)
64
65/*
66 * MIPS64-style segment definitions.
67 * These allow for 36 bits of addressable physical memory, thus 64GB.
68 */
69
70/*
71 * Cache Coherency Attributes.
72 */
73/* r8k only */
74#define CCA_NC_COPROCESSOR 0UL /* uncached, coprocessor ordered */
75/* common to r4, r5k, r8k and r1xk */
76#define CCA_NC 2UL /* uncached, write-around */
77#define CCA_NONCOHERENT 3UL /* cached, non-coherent, write-back */
78/* r8k, r1xk only */
79#define CCA_COHERENT_EXCL 4UL /* cached, coherent, exclusive */
80#define CCA_COHERENT_EXCLWRITE 5UL /* cached, coherent, exclusive write */
81/* r4k only */
82#define CCA_COHERENT_UPDWRITE 6UL /* cached, coherent, update on write */
83/* r1xk only */
84#define CCA_NC_ACCELERATED 7UL /* uncached accelerated */
85
86#ifdef TGT_COHERENT
87#define CCA_CACHED CCA_COHERENT_EXCLWRITE
88#else
89#define CCA_CACHED CCA_NONCOHERENT
90#endif
91
92#define XKSSSEG_BASE 0x4000000000000000UL
93#define XKPHYS_BASE 0x8000000000000000UL
94#define XKSSEG_BASE 0xc000000000000000UL
95
96#define XKPHYS_TO_PHYS(x) ((paddr_t)(x) & 0x0000000fffffffffUL)
97#define PHYS_TO_XKPHYS(x,c) ((paddr_t)(x) | XKPHYS_BASE | ((c) << 59))
98#define IS_XKPHYS(va) (((va) >> 62) == 2)
99#define XKPHYS_TO_CCA(x) (((x) >> 59) & 0x07)
100
101#endif /* _LOCORE */
102
103/*
104 * Exported definitions unique to mips cpu support.
105 */
106
107#if defined(_KERNEL) && !defined(_LOCORE)
108
109#include <sys/clockintr.h>
110#include <sys/device.h>
111#include <machine/intr.h>
112#include <sys/sched.h>
113#include <sys/srp.h>
114#include <uvm/uvm_percpu.h>
115
116struct cpu_hwinfo {
117 uint32_t c0prid;
118 uint32_t c1prid;
119 uint32_t clock; /* Hz */
120 uint32_t tlbsize;
121 uint type;
122 uint32_t l2size;
123};
124
125/*
126 * Cache memory configuration. One struct per cache.
127 */
128struct cache_info {
129 uint size; /* total cache size */
130 uint linesize; /* line size */
131 uint setsize; /* set size */
132 uint sets; /* number of sets */
133};
134
135struct cpu_info {
136 struct device *ci_dev; /* our device */
137 struct cpu_info *ci_self; /* pointer to this structure */
138 struct cpu_info *ci_next; /* next cpu */
139 struct proc *ci_curproc;
140 struct user *ci_curprocpaddr;
141 struct proc *ci_fpuproc; /* pointer to last proc to use FP */
142 uint32_t ci_delayconst;
143 struct cpu_hwinfo
144 ci_hw;
145
146#if defined(MULTIPROCESSOR)
147 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
148#define __HAVE_UVM_PERCPU
149 struct uvm_pmr_cache ci_uvm;
150#endif
151
152 /* cache information and pending flush state */
153 uint ci_cacheconfiguration;
154 uint64_t ci_cachepending_l1i;
155 struct cache_info
156 ci_l1inst,
157 ci_l1data,
158 ci_l2,
159 ci_l3;
160
161 /* function pointers for the cache handling routines */
162 void (*ci_SyncCache)(struct cpu_info *);
163 void (*ci_InvalidateICache)(struct cpu_info *, vaddr_t,
164 size_t);
165 void (*ci_InvalidateICachePage)(struct cpu_info *, vaddr_t);
166 void (*ci_SyncICache)(struct cpu_info *);
167 void (*ci_SyncDCachePage)(struct cpu_info *, vaddr_t,
168 paddr_t);
169 void (*ci_HitSyncDCachePage)(struct cpu_info *, vaddr_t,
170 paddr_t);
171 void (*ci_HitSyncDCache)(struct cpu_info *, vaddr_t, size_t);
172 void (*ci_HitInvalidateDCache)(struct cpu_info *, vaddr_t,
173 size_t);
174 void (*ci_IOSyncDCache)(struct cpu_info *, vaddr_t, size_t,
175 int);
176
177 struct schedstate_percpu
178 ci_schedstate;
179 int ci_want_resched; /* need_resched() invoked */
180 cpuid_t ci_cpuid; /* our CPU ID */
181 uint32_t ci_randseed; /* per cpu random seed */
182 volatile int ci_ipl; /* software IPL */
183 uint32_t ci_softpending; /* pending soft interrupts */
184 int ci_clock_started;
185 volatile int ci_clock_deferred; /* clock interrupt postponed */
186 struct clockqueue
187 ci_queue;
188
189 struct pmap *ci_curpmap;
190 uint ci_idepth; /* interrupt depth */
191 volatile u_long ci_flags; /* flags; see below */
192 volatile int ci_ddb;
193#define CI_DDB_RUNNING 0
194#define CI_DDB_SHOULDSTOP 1
195#define CI_DDB_STOPPED 2
196#define CI_DDB_ENTERDDB 3
197#define CI_DDB_INDDB 4
198
199#ifdef DIAGNOSTIC
200 int ci_mutex_level;
201#endif
202#ifdef GPROF
203 struct gmonparam *ci_gmon;
204 struct clockintr ci_gmonclock;
205#endif
206 char ci_panicbuf[512];
207};
208
209#define CPUF_PRIMARY 0x01 /* CPU is primary CPU */
210#define CPUF_PRESENT 0x02 /* CPU is present */
211#define CPUF_RUNNING 0x04 /* CPU is running */
212
213extern struct cpu_info cpu_info_primary;
214extern struct cpu_info *cpu_info_list;
215#define CPU_INFO_ITERATOR int
216#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \
217 ci != NULL; ci = ci->ci_next)
218
219#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0)
220
221#define cpu_idle_enter() do { /* nothing */ } while (0)
222#define cpu_idle_leave() do { /* nothing */ } while (0)
223extern void (*cpu_idle_cycle_func)(void);
224#define cpu_idle_cycle() (*cpu_idle_cycle_func)()
225
226#ifdef MULTIPROCESSOR
227#define getcurcpu() hw_getcurcpu()
228#define setcurcpu(ci) hw_setcurcpu(ci)
229extern struct cpu_info *get_cpu_info(int);
230#define curcpu() getcurcpu()
231#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY)
232#define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING)
233#define cpu_number() (curcpu()->ci_cpuid)
234
235void cpu_unidle(struct cpu_info *);
236void cpu_boot_secondary_processors(void);
237#define cpu_boot_secondary(ci) hw_cpu_boot_secondary(ci)
238#define cpu_hatch(ci) hw_cpu_hatch(ci)
239
240vaddr_t alloc_contiguous_pages(size_t);
241
242#define MIPS64_IPI_NOP 0x00000001
243#define MIPS64_IPI_RENDEZVOUS 0x00000002
244#define MIPS64_IPI_DDB 0x00000004
245#define MIPS64_NIPIS 3 /* must not exceed 32 */
246
247void mips64_ipi_init(void);
248void mips64_send_ipi(unsigned int, unsigned int);
249void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg);
250
251#include <sys/mplock.h>
252#else
253#define MAXCPUS 1
254#define curcpu() (&cpu_info_primary)
255#define CPU_IS_PRIMARY(ci) 1
256#define CPU_IS_RUNNING(ci) 1
257#define cpu_number() 0UL
258#define cpu_unidle(ci)
259#define get_cpu_info(i) (&cpu_info_primary)
260#endif
261
262#define CPU_BUSY_CYCLE() __asm volatile ("" ::: "memory")
263
264extern void (*md_initclock)(void);
265extern void (*md_startclock)(struct cpu_info *);
266extern void (*md_triggerclock)(void);
267void cp0_calibrate(struct cpu_info *);
268
269unsigned int cpu_rnd_messybits(void);
270
271#include <machine/frame.h>
272
273/*
274 * Arguments to hardclock encapsulate the previous machine state in
275 * an opaque clockframe.
276 */
277#define clockframe trapframe /* Use normal trap frame */
278
279#define SR_KSU_USER 0x00000010
280#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER)
281#define CLKF_PC(framep) ((framep)->pc)
282#define CLKF_INTR(framep) (curcpu()->ci_idepth > 1) /* XXX */
283
284/*
285 * This is used during profiling to integrate system time.
286 */
287#define PROC_PC(p) ((p)->p_md.md_regs->pc)
288#define PROC_STACK(p) ((p)->p_md.md_regs->sp)
289
290/*
291 * Preempt the current process if in interrupt from user mode,
292 * or after the current trap/syscall if in system mode.
293 */
294void need_resched(struct cpu_info *);
295#define clear_resched(ci) (ci)->ci_want_resched = 0
296
297/*
298 * Give a profiling tick to the current process when the user profiling
299 * buffer pages are invalid. On MIPS designs, request an ast to send us
300 * through trap, marking the proc as needing a profiling tick.
301 */
302#define need_proftick(p) aston(p)
303
304/*
305 * Notify the current process (p) that it has a signal pending,
306 * process as soon as possible.
307 */
308void signotify(struct proc *);
309
310#define aston(p) ((p)->p_md.md_astpending = 1)
311
312#define mips_sync() __asm__ volatile ("sync" ::: "memory")
313
314#endif /* _KERNEL && !_LOCORE */
315
316#ifdef _KERNEL
317/*
318 * Values for the code field in a break instruction.
319 */
320#define BREAK_INSTR 0x0000000d
321#define BREAK_VAL_MASK 0x03ff0000
322#define BREAK_VAL_SHIFT 16
323#define BREAK_KDB_VAL 512
324#define BREAK_SSTEP_VAL 513
325#define BREAK_BRKPT_VAL 514
326#define BREAK_SOVER_VAL 515
327#define BREAK_DDB_VAL 516
328#define BREAK_FPUEMUL_VAL 517
329#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT))
330#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT))
331#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT))
332#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT))
333#define BREAK_DDB (BREAK_INSTR | (BREAK_DDB_VAL << BREAK_VAL_SHIFT))
334#define BREAK_FPUEMUL (BREAK_INSTR | (BREAK_FPUEMUL_VAL << BREAK_VAL_SHIFT))
335
336#endif /* _KERNEL */
337
338/*
339 * CTL_MACHDEP definitions.
340 */
341#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */
342 /* 2 formerly: keyboard reset */
343 /* 3 formerly: CPU_LIDSUSPEND */
344#define CPU_LIDACTION 4 /* action caused by lid close */
345#define CPU_MAXID 5 /* number of valid machdep ids */
346
347#define CTL_MACHDEP_NAMES { \
348 { 0, 0 }, \
349 { "allowaperture", CTLTYPE_INT }, \
350 { 0, 0 }, \
351 { 0, 0 }, \
352 { "lidaction", CTLTYPE_INT }, \
353}
354
355/*
356 * MIPS CPU types (cp_imp).
357 */
358#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */
359#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */
360#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */
361#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */
362#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */
363#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */
364#define MIPS_CN50XX 0x06 /* Cavium OCTEON CN50xx MIPS64R2*/
365#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */
366#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */
367#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */
368#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */
369#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */
370#define MIPS_R12000 0x0e /* MIPS R12000 ISA IV */
371#define MIPS_R14000 0x0f /* MIPS R14000 ISA IV */
372#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
373#define MIPS_R4600 0x20 /* PMCS R4600 Orion ISA III */
374#define MIPS_R4700 0x21 /* PMCS R4700 Orion ISA III */
375#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */
376#define MIPS_R5000 0x23 /* MIPS R5000 CPU ISA IV */
377#define MIPS_RM7000 0x27 /* PMCS RM7000 CPU ISA IV */
378#define MIPS_RM52X0 0x28 /* PMCS RM52X0 CPU ISA IV */
379#define MIPS_RM9000 0x34 /* PMCS RM9000 CPU ISA IV */
380#define MIPS_LOONGSON 0x42 /* STC LoongSon CPU ISA III */
381#define MIPS_VR5400 0x54 /* NEC Vr5400 CPU ISA IV+ */
382#define MIPS_LOONGSON2 0x63 /* STC LoongSon2/3 CPU ISA III+ */
383#define MIPS_CN63XX 0x90 /* Cavium OCTEON II CN6[23]xx MIPS64R2 */
384#define MIPS_CN68XX 0x91 /* Cavium OCTEON II CN68xx MIPS64R2 */
385#define MIPS_CN66XX 0x92 /* Cavium OCTEON II CN66xx MIPS64R2 */
386#define MIPS_CN61XX 0x93 /* Cavium OCTEON II CN6[01]xx MIPS64R2 */
387#define MIPS_CN78XX 0x95 /* Cavium OCTEON III CN7[678]xx MIPS64R2 */
388#define MIPS_CN71XX 0x96 /* Cavium OCTEON III CN7[01]xx MIPS64R2 */
389#define MIPS_CN73XX 0x97 /* Cavium OCTEON III CN7[23]xx MIPS64R2 */
390
391/*
392 * MIPS FPU types. Only soft, rest is the same as cpu type.
393 */
394#define MIPS_SOFT 0x00 /* Software emulation ISA I */
395
396
397#if defined(_KERNEL) && !defined(_LOCORE)
398
399extern register_t protosr;
400extern int cpu_has_synced_cp0_count;
401extern int cpu_has_userlocal;
402
403#ifdef FPUEMUL
404#define CPU_HAS_FPU(ci) ((ci)->ci_hw.c1prid != 0)
405#else
406#define CPU_HAS_FPU(ci) 1
407#endif
408
409struct exec_package;
410struct user;
411
412void tlb_asid_wrap(struct cpu_info *);
413void tlb_flush(int);
414void tlb_flush_addr(vaddr_t);
415void tlb_init(unsigned int);
416void tlb_set_page_mask(uint32_t);
417void tlb_set_pid(u_int);
418void tlb_set_wired(uint32_t);
419int tlb_update(vaddr_t, register_t);
420
421void build_trampoline(vaddr_t, vaddr_t);
422void cpu_switchto_asm(struct proc *, struct proc *);
423int exec_md_map(struct proc *, struct exec_package *);
424void savectx(struct user *, int);
425
426int copyinsn(struct proc *, vaddr_t, uint32_t *);
427void enable_fpu(struct proc *);
428void save_fpu(void);
429int fpe_branch_emulate(struct proc *, struct trapframe *, uint32_t,
430 vaddr_t);
431void MipsSaveCurFPState(struct proc *);
432void MipsSaveCurFPState16(struct proc *);
433void MipsSwitchFPState(struct proc *, struct trapframe *);
434void MipsSwitchFPState16(struct proc *, struct trapframe *);
435
436void MipsFPTrap(struct trapframe *);
437register_t MipsEmulateBranch(struct trapframe *, vaddr_t, uint32_t, uint32_t);
438
439int classify_insn(uint32_t);
440#define INSNCLASS_NEUTRAL 0
441#define INSNCLASS_CALL 1
442#define INSNCLASS_BRANCH 2
443
444/*
445 * Low level access routines to CPU registers
446 */
447
448void setsoftintr0(void);
449void clearsoftintr0(void);
450void setsoftintr1(void);
451void clearsoftintr1(void);
452register_t enableintr(void);
453register_t disableintr(void);
454register_t getsr(void);
455register_t setsr(register_t);
456
457uint32_t cp0_get_cause(void);
458u_int cp0_get_count(void);
459register_t cp0_get_config(void);
460uint32_t cp0_get_config_1(void);
461uint32_t cp0_get_config_2(void);
462uint32_t cp0_get_config_3(void);
463uint32_t cp0_get_config_4(void);
464uint32_t cp0_get_pagegrain(void);
465register_t cp0_get_prid(void);
466void cp0_reset_cause(register_t);
467void cp0_set_compare(u_int);
468void cp0_set_config(register_t);
469void cp0_set_pagegrain(uint32_t);
470void cp0_set_trapbase(register_t);
471u_int cp1_get_prid(void);
472
473static inline uint32_t
474cp0_get_hwrena(void)
475{
476 uint32_t value;
477 __asm__ volatile ("mfc0 %0, $7" : "=r" (value));
478 return value;
479}
480
481static inline void
482cp0_set_hwrena(uint32_t value)
483{
484 __asm__ volatile ("mtc0 %0, $7" : : "r" (value));
485}
486
487static inline void
488cp0_set_userlocal(void *value)
489{
490 __asm__ volatile (
491 " .set push\n"
492 " .set mips64r2\n"
493 " dmtc0 %0, $4, 2\n"
494 " .set pop\n"
495 : : "r" (value));
496}
497
498static inline u_long
499intr_disable(void)
500{
501 return disableintr();
502}
503
504static inline void
505intr_restore(u_long sr)
506{
507 setsr(sr);
508}
509
510/*
511 * Cache routines (may be overridden)
512 */
513
514#ifndef Mips_SyncCache
515#define Mips_SyncCache(ci) \
516 ((ci)->ci_SyncCache)(ci)
517#endif
518#ifndef Mips_InvalidateICache
519#define Mips_InvalidateICache(ci, va, l) \
520 ((ci)->ci_InvalidateICache)(ci, va, l)
521#endif
522#ifndef Mips_InvalidateICachePage
523#define Mips_InvalidateICachePage(ci, va) \
524 ((ci)->ci_InvalidateICachePage)(ci, va)
525#endif
526#ifndef Mips_SyncICache
527#define Mips_SyncICache(ci) \
528 ((ci)->ci_SyncICache)(ci)
529#endif
530#ifndef Mips_SyncDCachePage
531#define Mips_SyncDCachePage(ci, va, pa) \
532 ((ci)->ci_SyncDCachePage)(ci, va, pa)
533#endif
534#ifndef Mips_HitSyncDCachePage
535#define Mips_HitSyncDCachePage(ci, va, pa) \
536 ((ci)->ci_HitSyncDCachePage)(ci, va, pa)
537#endif
538#ifndef Mips_HitSyncDCache
539#define Mips_HitSyncDCache(ci, va, l) \
540 ((ci)->ci_HitSyncDCache)(ci, va, l)
541#endif
542#ifndef Mips_HitInvalidateDCache
543#define Mips_HitInvalidateDCache(ci, va, l) \
544 ((ci)->ci_HitInvalidateDCache)(ci, va, l)
545#endif
546#ifndef Mips_IOSyncDCache
547#define Mips_IOSyncDCache(ci, va, l, h) \
548 ((ci)->ci_IOSyncDCache)(ci, va, l, h)
549#endif
550
551#endif /* _KERNEL && !_LOCORE */
552#endif /* !_MIPS64_CPU_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/cpustate.h deleted-150
...@@ -1,150 +0,0 @@
1/* $OpenBSD: cpustate.h,v 1.11 2015/09/27 18:17:08 miod Exp $ */
2
3/*
4 * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#define KERN_REG_SIZE (NUMSAVEREGS * REGSZ)
30#define KERN_EXC_FRAME_SIZE (CF_SZ + KERN_REG_SIZE + 16)
31
32#define SAVE_REG(reg, offs, base, bo) \
33 REG_S reg, bo + (REGSZ * offs) (base)
34
35#define RESTORE_REG(reg, offs, base, bo) \
36 REG_L reg, bo + (REGSZ * offs) (base)
37
38/*
39 * This macro saves the 'scratch' cpu state on stack.
40 * Macros are generic so no 'special' instructions!
41 * a0 will have a pointer to the 'frame' on return.
42 * a1 will have saved STATUS_REG on return.
43 * a3 will have the exception pc on 'return'.
44 * No traps, no interrupts if frame = k1 or k0!
45 * Temp regs are saved with their register number so
46 * branch emulation etc works properly.
47 */
48#define SAVE_CPU(frame, bo) \
49 SAVE_REG(AT, AST, frame, bo) ;\
50 SAVE_REG(v0, V0, frame, bo) ;\
51 SAVE_REG(v1, V1, frame, bo) ;\
52 SAVE_REG(a0, A0, frame, bo) ;\
53 SAVE_REG(a1, A1, frame, bo) ;\
54 SAVE_REG(a2, A2, frame, bo) ;\
55 SAVE_REG(a3, A3, frame, bo) ;\
56 MFC0 a0, COP_0_CAUSE_REG ;\
57 MFC0_HAZARD ;\
58 SAVE_REG(a4, A4, frame, bo) ;\
59 SAVE_REG(a5, A5, frame, bo) ;\
60 MFC0 a1, COP_0_STATUS_REG ;\
61 MFC0_HAZARD ;\
62 SAVE_REG(a6, A6, frame, bo) ;\
63 SAVE_REG(a7, A7, frame, bo) ;\
64 PRE_MFC0_ADDR_HAZARD ;\
65 DMFC0 a2, COP_0_BAD_VADDR ;\
66 MFC0_HAZARD ;\
67 SAVE_REG(t0, T0, frame, bo) ;\
68 SAVE_REG(t1, T1, frame, bo) ;\
69 DMFC0 a3, COP_0_EXC_PC ;\
70 MFC0_HAZARD ;\
71 SAVE_REG(t2, T2, frame, bo) ;\
72 SAVE_REG(t3, T3, frame, bo) ;\
73 SAVE_REG(t8, T8, frame, bo) ;\
74 SAVE_REG(t9, T9, frame, bo) ;\
75 SAVE_REG(gp, GP, frame, bo) ;\
76 SAVE_REG(ra, RA, frame, bo) ;\
77 mflo v0 ;\
78 mfhi v1 ;\
79 SAVE_REG(v0, MULLO, frame, bo) ;\
80 SAVE_REG(v1, MULHI, frame, bo) ;\
81 SAVE_REG(a0, CAUSE, frame, bo) ;\
82 SAVE_REG(a1, SR, frame, bo) ;\
83 SAVE_REG(a2, BADVADDR, frame, bo) ;\
84 SAVE_REG(a3, PC, frame, bo) ;\
85 SAVE_REG(sp, SP, frame, bo) ;\
86 PTR_ADDU a0, frame, bo ;\
87 GET_CPU_INFO(v0, v1) ;\
88 lw a2, CI_IPL(v0) ;\
89 SAVE_REG(a2, CPL, frame, bo)
90
91/*
92 * Save 'callee save' registers in frame to aid DDB.
93 */
94#define SAVE_CPU_SREG(frame, bo) \
95 SAVE_REG(s0, S0, frame, bo) ;\
96 SAVE_REG(s1, S1, frame, bo) ;\
97 SAVE_REG(s2, S2, frame, bo) ;\
98 SAVE_REG(s3, S3, frame, bo) ;\
99 SAVE_REG(s4, S4, frame, bo) ;\
100 SAVE_REG(s5, S5, frame, bo) ;\
101 SAVE_REG(s6, S6, frame, bo) ;\
102 SAVE_REG(s7, S7, frame, bo) ;\
103 SAVE_REG(s8, S8, frame, bo)
104
105/*
106 * Restore cpu state. When called a0 = EXC_PC.
107 */
108#define RESTORE_CPU(frame, bo) \
109 RESTORE_REG(t1, SR, frame, bo) ;\
110 RESTORE_REG(t2, MULLO, frame, bo) ;\
111 RESTORE_REG(t3, MULHI, frame, bo) ;\
112 MTC0 t1, COP_0_STATUS_REG ;\
113 MTC0_SR_IE_HAZARD ;\
114 mtlo t2 ;\
115 mthi t3 ;\
116 DMTC0 a0, COP_0_EXC_PC ;\
117 MTC0_HAZARD ;\
118 RESTORE_REG(AT, AST, frame, bo) ;\
119 RESTORE_REG(v0, V0, frame, bo) ;\
120 RESTORE_REG(v1, V1, frame, bo) ;\
121 RESTORE_REG(a0, A0, frame, bo) ;\
122 RESTORE_REG(a1, A1, frame, bo) ;\
123 RESTORE_REG(a2, A2, frame, bo) ;\
124 RESTORE_REG(a3, A3, frame, bo) ;\
125 RESTORE_REG(a4, A4, frame, bo) ;\
126 RESTORE_REG(a5, A5, frame, bo) ;\
127 RESTORE_REG(a6, A6, frame, bo) ;\
128 RESTORE_REG(a7, A7, frame, bo) ;\
129 RESTORE_REG(t0, T0, frame, bo) ;\
130 RESTORE_REG(t1, T1, frame, bo) ;\
131 RESTORE_REG(t2, T2, frame, bo) ;\
132 RESTORE_REG(t3, T3, frame, bo) ;\
133 RESTORE_REG(t8, T8, frame, bo) ;\
134 RESTORE_REG(t9, T9, frame, bo) ;\
135 RESTORE_REG(gp, GP, frame, bo) ;\
136 RESTORE_REG(ra, RA, frame, bo)
137
138/*
139 * Restore 'callee save' registers
140 */
141#define RESTORE_CPU_SREG(frame, bo) \
142 RESTORE_REG(s0, S0, frame, bo) ;\
143 RESTORE_REG(s1, S1, frame, bo) ;\
144 RESTORE_REG(s2, S2, frame, bo) ;\
145 RESTORE_REG(s3, S3, frame, bo) ;\
146 RESTORE_REG(s4, S4, frame, bo) ;\
147 RESTORE_REG(s5, S5, frame, bo) ;\
148 RESTORE_REG(s6, S6, frame, bo) ;\
149 RESTORE_REG(s7, S7, frame, bo) ;\
150 RESTORE_REG(s8, S8, frame, bo)
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/db_machdep.h deleted-76
...@@ -1,76 +0,0 @@
1/* $OpenBSD: db_machdep.h,v 1.21 2021/08/30 08:11:12 jasper Exp $ */
2
3/*
4 * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_DB_MACHDEP_H_
30#define _MIPS64_DB_MACHDEP_H_
31
32#include <machine/frame.h>
33#include <machine/trap.h>
34#include <uvm/uvm_param.h>
35
36#define DB_MACHINE_COMMANDS /* We have machine specific commands */
37
38typedef struct trapframe db_regs_t;
39extern db_regs_t ddb_regs;
40
41typedef long db_expr_t;
42
43#define SOFTWARE_SSTEP /* Need software single step */
44#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */
45vaddr_t next_instr_address(vaddr_t, int);
46#define BKPT_SIZE (4)
47#define BKPT_SET(ins) (BREAK_DDB)
48#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0)
49
50#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
51#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
52
53#define PC_REGS(regs) ((vaddr_t)(regs)->pc)
54#define SET_PC_REGS(regs, value) (regs)->pc = (register_t)(value)
55
56/*
57 * Test of instructions to see class.
58 */
59#define inst_branch(i) (classify_insn(i) == INSNCLASS_BRANCH)
60#define inst_trap_return(i) ((i) & 0)
61#define inst_call(i) (classify_insn(i) == INSNCLASS_CALL)
62#define inst_return(i) ((i) == 0x03e00008)
63
64void db_machine_init(void);
65
66int db_enter_ddb(void);
67void db_startcpu(int);
68void db_stopcpu(int);
69
70int dbmd_print_insn(uint32_t, vaddr_t, int (*)(const char *, ...));
71
72#define DDB_STATE_NOT_RUNNING 0
73#define DDB_STATE_RUNNING 1
74#define DDB_STATE_EXITING 2
75
76#endif /* !_MIPS64_DB_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/elf.h deleted-7
...@@ -1,7 +0,0 @@
1/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
2
3/*
4 * This file is in the public domain.
5 */
6
7/* Nothing for now */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/endian.h deleted-49
...@@ -1,49 +0,0 @@
1/* $OpenBSD: endian.h,v 1.9 2014/07/12 16:25:08 guenther Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_ENDIAN_H_
30#define _MIPS64_ENDIAN_H_
31
32#if defined(__MIPSEL__)
33#define _BYTE_ORDER _LITTLE_ENDIAN
34#endif
35#if defined(__MIPSEB__)
36#define _BYTE_ORDER _BIG_ENDIAN
37#endif
38
39#if !defined(_BYTE_ORDER)
40#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
41#endif
42
43#define __STRICT_ALIGNMENT
44
45#ifndef __FROM_SYS__ENDIAN
46#include <sys/endian.h>
47#endif
48
49#endif /* _MIPS64_ENDIAN_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/exec.h deleted-137
...@@ -1,137 +0,0 @@
1/* $OpenBSD: exec.h,v 1.10 2022/10/28 15:07:25 kettenis Exp $ */
2
3/*
4 * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_EXEC_H_
30#define _MIPS64_EXEC_H_
31
32#define __LDPGSZ 16384
33
34#define ARCH_ELFSIZE 64
35#define ELF_TARG_CLASS ELFCLASS64
36
37#if defined(__MIPSEB__)
38#define ELF_TARG_DATA ELFDATA2MSB
39#else
40#define ELF_TARG_DATA ELFDATA2LSB
41#endif
42#define ELF_TARG_MACH EM_MIPS
43
44/* Information taken from MIPS ABI supplement */
45
46/* Architecture dependent Segment types - p_type */
47#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
48
49/* Architecture dependent d_tag field for Elf32_Dyn. */
50#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
51#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
52#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
53#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
54#define DT_MIPS_FLAGS 0x70000005 /* Flags */
55#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
56#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
57#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
58#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
59#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
60#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
61#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
62#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
63#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
64#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
65#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
66#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Relative address of debug map ptr */
67
68#define DT_PROCNUM (DT_MIPS_RLD_MAP_REL - DT_LOPROC + 1)
69
70/*
71 * Legal values for e_flags field of Elf32_Ehdr.
72 */
73#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */
74#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
75#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */
76#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */
77#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */
78#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
79#define E_MIPS_ARCH_1 0x00000000
80#define E_MIPS_ARCH_2 0x10000000
81#define E_MIPS_ARCH_3 0x20000000
82#define E_MIPS_ARCH_4 0x30000000
83#define EF_MIPS_ABI 0x0000f000 /* ABI level */
84#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */
85#define E_MIPS_ABI_O32 0x00001000
86#define E_MIPS_ABI_O64 0x00002000
87#define E_MIPS_ABI_EABI32 0x00004000
88#define E_MIPS_ABI_EABI64 0x00004000
89
90/*
91 * Mips special sections.
92 */
93#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
94#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
95#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
96
97/*
98 * Legal values for sh_type field of Elf32_Shdr.
99 */
100#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
101#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
102#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
103#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
104#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
105#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
106
107/*
108 * Legal values for sh_flags field of Elf32_Shdr.
109 */
110#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
111
112#if 0
113/*
114 * Entries found in sections of type SHT_MIPS_GPTAB.
115 */
116typedef union {
117 struct {
118 Elf32_Word gt_current_g_value; /* -G val used in compilation */
119 Elf32_Word gt_unused; /* Not used */
120 } gt_header; /* First entry in section */
121 struct {
122 Elf32_Word gt_g_value; /* If this val were used for -G */
123 Elf32_Word gt_bytes; /* This many bytes would be used */
124 } gt_entry; /* Subsequent entries in section */
125} Elf32_gptab;
126
127/*
128 * Entry found in sections of type SHT_MIPS_REGINFO.
129 */
130typedef struct {
131 Elf32_Word ri_gprmask; /* General registers used */
132 Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
133 Elf32_Sword ri_gp_value; /* $gp register value */
134} Elf32_RegInfo;
135#endif
136
137#endif /* !_MIPS64_EXEC_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/fenv.h deleted-94
...@@ -1,94 +0,0 @@
1/* $OpenBSD: fenv.h,v 1.3 2011/05/25 21:46:49 martynas Exp $ */
2
3/*
4 * Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
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#ifndef _MIPS64_FENV_H_
20#define _MIPS64_FENV_H_
21
22/*
23 * Each symbol representing a floating point exception expands to an integer
24 * constant expression with values, such that bitwise-inclusive ORs of _all
25 * combinations_ of the constants result in distinct values.
26 *
27 * We use such values that allow direct bitwise operations on FPU registers.
28 */
29#define FE_INEXACT 0x04
30#define FE_UNDERFLOW 0x08
31#define FE_OVERFLOW 0x10
32#define FE_DIVBYZERO 0x20
33#define FE_INVALID 0x40
34
35/*
36 * The following symbol is simply the bitwise-inclusive OR of all floating-point
37 * exception constants defined above.
38 */
39#define FE_ALL_EXCEPT (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | \
40 FE_DIVBYZERO | FE_INVALID)
41#define _MASK_SHIFT 5
42
43/*
44 * Each symbol representing the rounding direction, expands to an integer
45 * constant expression whose value is distinct non-negative value.
46 *
47 * We use such values that allow direct bitwise operations on FPU registers.
48 */
49#define FE_TONEAREST 0x0
50#define FE_TOWARDZERO 0x1
51#define FE_UPWARD 0x2
52#define FE_DOWNWARD 0x3
53
54/*
55 * The following symbol is simply the bitwise-inclusive OR of all floating-point
56 * rounding direction constants defined above.
57 */
58#define _ROUND_MASK (FE_TONEAREST | FE_TOWARDZERO | FE_UPWARD | \
59 FE_DOWNWARD)
60
61/*
62 * fenv_t represents the entire floating-point environment.
63 */
64typedef unsigned int fenv_t;
65
66/*
67 * The following constant represents the default floating-point environment
68 * (that is, the one installed at program startup) and has type pointer to
69 * const-qualified fenv_t.
70 *
71 * It can be used as an argument to the functions within the <fenv.h> header
72 * that manage the floating-point environment, namely fesetenv() and
73 * feupdateenv().
74 */
75__BEGIN_DECLS
76extern fenv_t __fe_dfl_env;
77__END_DECLS
78#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env)
79
80/*
81 * fexcept_t represents the floating-point status flags collectively, including
82 * any status the implementation associates with the flags.
83 *
84 * A floating-point status flag is a system variable whose value is set (but
85 * never cleared) when a floating-point exception is raised, which occurs as a
86 * side effect of exceptional floating-point arithmetic to provide auxiliary
87 * information.
88 *
89 * A floating-point control mode is a system variable whose value may be set by
90 * the user to affect the subsequent behavior of floating-point arithmetic.
91 */
92typedef unsigned int fexcept_t;
93
94#endif /* !_MIPS64_FENV_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/fpu.h deleted-73
...@@ -1,73 +0,0 @@
1/* $OpenBSD: fpu.h,v 1.2 2012/12/04 05:00:40 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2010 Miodrag Vallat.
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 * Layout of the floating-point control/status register (FCR31)
21 */
22
23/* flush denormalized results to zero instead of causing FPCSR_C_E */
24#define FPCSR_FS 0x01000000
25
26/* compare condition bits: one bit for MIPS I/II/III, eight bits for MIPS IV */
27#define FPCSR_CONDBIT(c) ((c) == 0 ? 23 : 24 + (c))
28#define FPCSR_CONDVAL(c) (1U << FPCSR_CONDBIT(c))
29
30/* cause bits */
31#define FPCSR_C_E 0x00020000 /* unimplemented operation */
32#define FPCSR_C_V 0x00010000 /* invalid operation */
33#define FPCSR_C_Z 0x00008000 /* division by zero */
34#define FPCSR_C_O 0x00004000 /* overflow */
35#define FPCSR_C_U 0x00002000 /* underflow */
36#define FPCSR_C_I 0x00001000 /* inexact */
37
38/* enable bits */
39#define FPCSR_E_V 0x00000800 /* invalid operation */
40#define FPCSR_E_Z 0x00000400 /* division by zero */
41#define FPCSR_E_O 0x00000200 /* overflow */
42#define FPCSR_E_U 0x00000100 /* underflow */
43#define FPCSR_E_I 0x00000080 /* inexact */
44
45/* flags bits */
46#define FPCSR_F_V 0x00000040 /* invalid operation */
47#define FPCSR_F_Z 0x00000020 /* division by zero */
48#define FPCSR_F_O 0x00000010 /* overflow */
49#define FPCSR_F_U 0x00000008 /* underflow */
50#define FPCSR_F_I 0x00000004 /* inexact */
51
52#define FPCSR_C_MASK 0x0003f000
53#define FPCSR_C_SHIFT 12
54#define FPCSR_E_MASK 0x00000f80
55#define FPCSR_E_SHIFT 7
56#define FPCSR_F_MASK 0x0000007c
57#define FPCSR_F_SHIFT 2
58#define FPCSR_RM_MASK 0x00000003 /* rounding mode */
59
60#ifndef _KERNEL
61
62/*
63 * IRIX-compatible interfaces allowing userland to control the state
64 * of the floating-point control/status register. These are intended
65 * to let userland control the state of the FS bit.
66 */
67#include <sys/cdefs.h>
68
69__BEGIN_DECLS
70int get_fpc_csr(void);
71int set_fpc_csr(int);
72__END_DECLS
73#endif /* _KERNEL */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/frame.h deleted-114
...@@ -1,114 +0,0 @@
1/* $OpenBSD: frame.h,v 1.8 2021/04/29 12:49:19 visa Exp $ */
2
3/*
4 * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#ifndef _MIPS64_FRAME_H_
29#define _MIPS64_FRAME_H_
30
31/*
32 * The layout of this *must* match with regnum.h or bad things
33 * will happen. libc setjmp/longjmp depends on this as well.
34 */
35struct trapframe {
36 register_t zero;
37 register_t ast;
38 register_t v0;
39 register_t v1;
40 register_t a0;
41 register_t a1;
42 register_t a2;
43 register_t a3;
44 register_t a4; /* ta0 */
45 register_t a5; /* ta1 */
46 register_t a6; /* ta2 */
47 register_t a7; /* ta3 */
48 register_t t0;
49 register_t t1;
50 register_t t2;
51 register_t t3;
52 register_t s0;
53 register_t s1;
54 register_t s2;
55 register_t s3;
56 register_t s4;
57 register_t s5;
58 register_t s6;
59 register_t s7;
60 register_t t8;
61 register_t t9;
62 register_t k0;
63 register_t k1;
64 register_t gp;
65 register_t sp;
66 register_t s8;
67 register_t ra;
68 register_t sr;
69 register_t mullo;
70 register_t mulhi;
71 register_t badvaddr;
72 register_t cause;
73 register_t pc;
74 register_t ic; /* unused, was RM7000 ICR */
75 register_t ipl;
76
77/* From here and on, only saved user processes. */
78
79 f_register_t f0;
80 f_register_t f1;
81 f_register_t f2;
82 f_register_t f3;
83 f_register_t f4;
84 f_register_t f5;
85 f_register_t f6;
86 f_register_t f7;
87 f_register_t f8;
88 f_register_t f9;
89 f_register_t f10;
90 f_register_t f11;
91 f_register_t f12;
92 f_register_t f13;
93 f_register_t f14;
94 f_register_t f15;
95 f_register_t f16;
96 f_register_t f17;
97 f_register_t f18;
98 f_register_t f19;
99 f_register_t f20;
100 f_register_t f21;
101 f_register_t f22;
102 f_register_t f23;
103 f_register_t f24;
104 f_register_t f25;
105 f_register_t f26;
106 f_register_t f27;
107 f_register_t f28;
108 f_register_t f29;
109 f_register_t f30;
110 f_register_t f31;
111 register_t fsr;
112};
113
114#endif /* !_MIPS64_FRAME_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/ieee.h deleted-169
...@@ -1,169 +0,0 @@
1/* $OpenBSD: ieee.h,v 1.4 2010/01/23 19:11:21 miod Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley.
10 *
11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement:
13 * This product includes software developed by the University of
14 * California, Lawrence Berkeley Laboratory.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)ieee.h 8.1 (Berkeley) 6/11/93
41 */
42
43/*
44 * ieee.h defines the machine-dependent layout of the machine's IEEE
45 * floating point. It does *not* define (yet?) any of the rounding
46 * mode bits, exceptions, and so forth.
47 */
48
49/*
50 * Define the number of bits in each fraction and exponent.
51 *
52 * k k+1
53 * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
54 *
55 * (-exp_bias+1)
56 * as fractions that look like 0.fffff x 2 . This means that
57 *
58 * -126
59 * the number 0.10000 x 2 , for instance, is the same as the normalized
60 *
61 * -127 -128
62 * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
63 *
64 * -129
65 * in the fraction; to represent 2 , we need two, and so on. This
66 *
67 * (-exp_bias-fracbits+1)
68 * implies that the smallest denormalized number is 2
69 *
70 * for whichever format we are talking about: for single precision, for
71 *
72 * -126 -149
73 * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
74 *
75 * -149 == -127 - 23 + 1.
76 */
77#define SNG_EXPBITS 8
78#define SNG_FRACBITS 23
79
80#define DBL_EXPBITS 11
81#define DBL_FRACHBITS 20
82#define DBL_FRACLBITS 32
83#define DBL_FRACBITS 52
84
85#define EXT_EXPBITS 15
86#define EXT_FRACHBITS 16
87#define EXT_FRACHMBITS 32
88#define EXT_FRACLMBITS 32
89#define EXT_FRACLBITS 32
90#define EXT_FRACBITS 112
91
92#define EXT_IMPLICIT_NBIT
93
94#define EXT_TO_ARRAY32(p, a) do { \
95 (a)[0] = (uint32_t)(p)->ext_fracl; \
96 (a)[1] = (uint32_t)(p)->ext_fraclm; \
97 (a)[2] = (uint32_t)(p)->ext_frachm; \
98 (a)[3] = (uint32_t)(p)->ext_frach; \
99} while(0)
100
101struct ieee_single {
102#ifdef __MIPSEB__
103 u_int sng_sign:1;
104 u_int sng_exp:8;
105 u_int sng_frac:23;
106#else
107 u_int sng_frac:23;
108 u_int sng_exp:8;
109 u_int sng_sign:1;
110#endif
111};
112
113struct ieee_double {
114#ifdef __MIPSEB__
115 u_int dbl_sign:1;
116 u_int dbl_exp:11;
117 u_int dbl_frach:20;
118 u_int dbl_fracl;
119#else
120 u_int dbl_fracl;
121 u_int dbl_frach:20;
122 u_int dbl_exp:11;
123 u_int dbl_sign:1;
124#endif
125};
126
127struct ieee_ext {
128#ifdef __MIPSEB__
129 u_int ext_sign:1;
130 u_int ext_exp:15;
131 u_int ext_frach:16;
132 u_int ext_frachm;
133 u_int ext_fraclm;
134 u_int ext_fracl;
135#else
136 u_int ext_fracl;
137 u_int ext_fraclm;
138 u_int ext_frachm;
139 u_int ext_frach:16;
140 u_int ext_exp:15;
141 u_int ext_sign:1;
142#endif
143};
144
145/*
146 * Floats whose exponent is in [1..INFNAN) (of whatever type) are
147 * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
148 * Floats whose exponent is zero are either zero (iff all fraction
149 * bits are zero) or subnormal values.
150 *
151 * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
152 * high fraction; if the bit is set, it is a `quiet NaN'.
153 */
154#define SNG_EXP_INFNAN 255
155#define DBL_EXP_INFNAN 2047
156#define EXT_EXP_INFNAN 32767
157
158#if 0
159#define SNG_QUIETNAN (1 << 22)
160#define DBL_QUIETNAN (1 << 19)
161#define EXT_QUIETNAN (1 << 15)
162#endif
163
164/*
165 * Exponent biases.
166 */
167#define SNG_EXP_BIAS 127
168#define DBL_EXP_BIAS 1023
169#define EXT_EXP_BIAS 16383
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/ieeefp.h deleted-46
...@@ -1,46 +0,0 @@
1/* $OpenBSD: ieeefp.h,v 1.4 2011/03/23 16:54:36 pirofti Exp $ */
2
3/*
4 * Written by J.T. Conklin, Apr 11, 1995
5 * Public domain.
6 */
7
8#ifndef _MIPS64_IEEEFP_H_
9#define _MIPS64_IEEEFP_H_
10
11typedef int fp_except;
12#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
13#define FP_X_UFL 0x02 /* underflow exception */
14#define FP_X_OFL 0x04 /* overflow exception */
15#define FP_X_DZ 0x08 /* divide-by-zero exception */
16#define FP_X_INV 0x10 /* invalid operation exception */
17
18typedef enum {
19 FP_RN=0, /* round to nearest representable number */
20 FP_RZ=1, /* round to zero (truncate) */
21 FP_RP=2, /* round toward positive infinity */
22 FP_RM=3 /* round toward negative infinity */
23} fp_rnd;
24
25#ifdef _KERNEL
26
27/*
28 * Defines for the floating-point completion/emulation code.
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/proc.h>
34#include <machine/fpu.h>
35
36#define float_raise(bits) \
37 do { curproc->p_md.md_regs->fsr |= (bits) << FPCSR_C_SHIFT; } while (0)
38#define float_set_inexact() float_raise(FP_X_IMP)
39#define float_set_invalid() float_raise(FP_X_INV)
40
41#define float_get_round(csr) (csr & FPCSR_RM_MASK)
42#define fpgetround() float_get_round(curproc->p_md.md_regs->fsr)
43
44#endif
45
46#endif /* !_MIPS64_IEEEFP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/kcore.h deleted-40
...@@ -1,40 +0,0 @@
1/* $OpenBSD: kcore.h,v 1.3 2023/01/04 10:59:34 jsg Exp $ */
2/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */
3
4/*
5 * Copyright (c) 1996 Leo Weppelman.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef _MIPS64_KCORE_H_
30#define _MIPS64_KCORE_H_
31
32#define NPHYS_RAM_SEGS 8
33
34typedef struct cpu_kcore_hdr {
35 paddr_t kernel_pa; /* Phys. address of kernel VA 0 */
36 int mmutype;
37 phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
38} cpu_kcore_hdr_t;
39
40#endif /* !_MIPS64_KCORE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/limits.h deleted-53
...@@ -1,53 +0,0 @@
1/* $OpenBSD: limits.h,v 1.8 2015/04/30 13:42:08 millert Exp $ */
2
3/*
4 * Copyright (c) 1988, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)limits.h 8.3 (Berkeley) 1/4/94
32 */
33
34#ifndef _MIPS64_LIMITS_H_
35#define _MIPS64_LIMITS_H_
36
37#include <sys/cdefs.h>
38
39#if __POSIX_VISIBLE || __XPG_VISIBLE
40#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
41#endif
42
43#if __BSD_VISIBLE
44#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */
45
46/* Quads and longs are the same on mips64 */
47#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
48#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
49#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
50
51#endif /* __BSD_VISIBLE */
52
53#endif /* !_MIPS64_LIMITS_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/loongson2.h deleted-65
...@@ -1,65 +0,0 @@
1/* $OpenBSD: loongson2.h,v 1.4 2013/01/16 20:28:06 miod Exp $ */
2
3/*
4 * Copyright (c) 2009 Miodrag Vallat.
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#ifndef _MIPS64_LOONGSON2_H_
20#define _MIPS64_LOONGSON2_H_
21
22/*
23 * Loongson 2E/2F specific defines
24 */
25
26/*
27 * Address Window registers physical addresses
28 *
29 * The Loongson 2F processor has an AXI crossbar with four possible bus
30 * masters, each one having four programmable address windows.
31 *
32 * Each window is defined with three 64-bit registers:
33 * - a base address register, defining the address in the master address
34 * space (base register).
35 * - an address mask register, defining which address bits are valid in this
36 * window. A given address matches a window if (addr & mask) == base.
37 * - the location of the window base in the target, as well at the target
38 * number itself (mmap register). The lower 20 bits of the address are
39 * forced as zeroes regardless of their value in this register.
40 * The translated address is thus (addr & ~mask) | (mmap & ~0xfffff).
41 */
42
43#define LOONGSON_AWR_BASE_ADDRESS 0x3ff00000
44
45#define LOONGSON_AWR_BASE(master, window) \
46 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x00)
47#define LOONGSON_AWR_SIZE(master, window) \
48 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x20)
49#define LOONGSON_AWR_MMAP(master, window) \
50 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x40)
51
52/*
53 * Bits in the diagnostic register
54 */
55
56#define COP_0_DIAG_ITLB_CLEAR 0x04
57#define COP_0_DIAG_BTB_CLEAR 0x02
58#define COP_0_DIAG_RAS_DISABLE 0x01
59
60#if defined(_KERNEL) && !defined(_LOCORE)
61int loongson2f_cpuspeed(int *);
62void loongson2f_setperf(int);
63#endif
64
65#endif /* _MIPS64_LOONGSON2_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/loongson3.h deleted-108
...@@ -1,108 +0,0 @@
1/* $OpenBSD: loongson3.h,v 1.3 2017/05/10 16:04:21 visa Exp $ */
2
3/*
4 * Copyright (c) 2016 Visa Hankala
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#ifndef _MIPS64_LOONGSON3_H_
20#define _MIPS64_LOONGSON3_H_
21
22/*
23 * Definitions for Loongson 3A.
24 */
25
26#define LS3_CFG_BASE(node) (0x100000004000ull*(node) + 0x3ff00000)
27#define LS3_MEM_BASE(node) (0x100000000000ull*(node))
28
29#define LS3_IPI_BASE(n, c) (LS3_CFG_BASE(n) + 0x1000 + 0x100*(c))
30#define LS3_IPI_ISR 0x00
31#define LS3_IPI_IMR 0x04
32#define LS3_IPI_SET 0x08
33#define LS3_IPI_CLEAR 0x0c
34#define LS3_IPI_MBOX0 0x20
35#define LS3_IPI_MBOX1 0x28
36#define LS3_IPI_MBOX2 0x30
37#define LS3_IPI_MBOX3 0x38
38
39static inline uint32_t
40loongson3_get_cpuid(void)
41{
42 uint32_t tmp;
43
44 asm volatile (
45 " .set push\n"
46 " .set mips64\n"
47 " mfc0 %0, $15, 1\n" /* EBase */
48 " .set pop\n"
49 : "=r" (tmp));
50
51 return tmp & 0xf;
52}
53
54#define LS3_COREID(cpuid) ((cpuid) & 3)
55#define LS3_NODEID(cpuid) ((cpuid) >> 2)
56
57/*
58 * Interrupt router registers
59 */
60
61#define LS3_IRT_ENTRY(node, irq) (LS3_CFG_BASE(node) + 0x1400 + (irq))
62#define LS3_IRT_INTISR(node) (LS3_CFG_BASE(node) + 0x1420)
63#define LS3_IRT_INTEN(node) (LS3_CFG_BASE(node) + 0x1424)
64#define LS3_IRT_INTENSET(node) (LS3_CFG_BASE(node) + 0x1428)
65#define LS3_IRT_INTENCLR(node) (LS3_CFG_BASE(node) + 0x142c)
66#define LS3_IRT_INTISR_CORE(node, cpu) (LS3_CFG_BASE(node) + 0x1440 + (cpu)*8)
67
68/* sys int 0-3 */
69#define LS3_IRT_ENTRY_INT(node, x) LS3_IRT_ENTRY((node), (x))
70/* PCI int 0-3 */
71#define LS3_IRT_ENTRY_PCI(node, x) LS3_IRT_ENTRY((node), 0x04+(x))
72/* LPC int */
73#define LS3_IRT_ENTRY_LPC(node) LS3_IRT_ENTRY((node), 0x0a)
74/* HT0 int 0-7 */
75#define LS3_IRT_ENTRY_HT0(node, x) LS3_IRT_ENTRY((node), 0x10+(x))
76/* HT1 int 0-7 */
77#define LS3_IRT_ENTRY_HT1(node, x) LS3_IRT_ENTRY((node), 0x18+(x))
78
79#define LS3_IRT_ROUTE(core, intr) ((0x01 << (core)) | (0x10 << (intr)))
80
81#define LS3_IRQ_INT(x) (x) /* sys int 0-3 */
82#define LS3_IRQ_PCI(x) ((x) + 0x04) /* PCI int 0-3 */
83#define LS3_IRQ_LPC 0x0a /* LPC int */
84#define LS3_IRQ_HT0(x) ((x) + 0x10) /* HT0 int 0-7 */
85#define LS3_IRQ_HT1(x) ((x) + 0x18) /* HT1 int 0-7 */
86#define LS3_IRQ_NUM 32
87
88#define LS3_IRQ_IS_HT(irq) ((irq) >= 0x10)
89
90#define LS3_IRQ_HT_MASK 0xffff0000u
91
92/*
93 * Number of HyperTransport interrupt vectors. In reality, each HT interface
94 * has 256 vectors, but the interrupt code uses only a subset of them.
95 */
96#define LS3_HT_IRQ_NUM 32
97
98/*
99 * HyperTransport registers
100 */
101
102#define LS3_HT1_MEM_BASE(n) (LS3_MEM_BASE(n)+0x00000e0000000000ull)
103#define LS3_HT1_CFG_BASE(n) (LS3_MEM_BASE(n)+0x00000efdfb000000ull)
104
105#define LS3_HT_ISR_OFFSET(x) (0x80 + (x) * 4)
106#define LS3_HT_IMR_OFFSET(x) (0xa0 + (x) * 4)
107
108#endif /* _MIPS64_LOONGSON3_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/memconf.h deleted-48
...@@ -1,48 +0,0 @@
1/* $OpenBSD: memconf.h,v 1.7 2011/05/30 22:25:21 oga Exp $ */
2
3/*
4 * Copyright (c) 1996 Per Fogelstrom
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/*
29 * Memory config list used by pmap_bootstrap.
30 */
31
32#ifndef _MIPS64_MEMCONF_H_
33#define _MIPS64_MEMCONF_H_
34
35struct phys_mem_desc {
36 uint64_t mem_first_page;
37 uint64_t mem_last_page;
38};
39
40#ifdef _KERNEL
41#ifndef MAXMEMSEGS
42#define MAXMEMSEGS 16
43#endif
44extern struct phys_mem_desc mem_layout[];
45int memrange_register(uint64_t, uint64_t, uint64_t);
46#endif
47
48#endif /* !_MIPS64_MEMCONF_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/mips_cpu.h deleted-282
...@@ -1,282 +0,0 @@
1/* $OpenBSD: mips_cpu.h,v 1.11 2022/12/11 05:07:25 visa Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell and Rick Macklem.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * Copyright (C) 1989 Digital Equipment Corporation.
35 * Permission to use, copy, modify, and distribute this software and
36 * its documentation for any purpose and without fee is hereby granted,
37 * provided that the above copyright notice appears in all copies.
38 * Digital Equipment Corporation makes no representations about the
39 * suitability of this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
41 *
42 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
43 */
44
45#ifndef _MIPS64_CPUREGS_H_
46#define _MIPS64_CPUREGS_H_
47
48#if defined(_KERNEL) || defined(_STANDALONE)
49
50/*
51 * Status register.
52 */
53
54#define SR_COP_USABILITY 0x30000000 /* CP0 and CP1 only */
55#define SR_COP_0_BIT 0x10000000
56#define SR_COP_1_BIT 0x20000000
57#define SR_COP_2_BIT 0x40000000
58#define SR_RP 0x08000000
59#define SR_FR_32 0x04000000
60#define SR_RE 0x02000000
61#define SR_DSD 0x01000000 /* Only on R12000 */
62#define SR_BOOT_EXC_VEC 0x00400000
63#define SR_TLB_SHUTDOWN 0x00200000
64#define SR_SOFT_RESET 0x00100000
65#define SR_DIAG_CH 0x00040000
66#define SR_DIAG_CE 0x00020000
67#define SR_DIAG_DE 0x00010000
68#define SR_KX 0x00000080
69#define SR_SX 0x00000040
70#define SR_UX 0x00000020
71#define SR_ERL 0x00000004
72#define SR_EXL 0x00000002
73#define SR_INT_ENAB 0x00000001
74
75#define SOFT_INT_MASK_0 0x00000100
76#define SOFT_INT_MASK_1 0x00000200
77#define SR_INT_MASK_0 0x00000400
78#define SR_INT_MASK_1 0x00000800
79#define SR_INT_MASK_2 0x00001000
80#define SR_INT_MASK_3 0x00002000
81#define SR_INT_MASK_4 0x00004000
82#define SR_INT_MASK_5 0x00008000
83
84#define SR_XX 0x80000000
85#define SR_KSU_MASK 0x00000018
86#define SR_KSU_SUPER 0x00000008
87#define SR_KSU_KERNEL 0x00000000
88#define SR_INT_MASK 0x0000ff00
89/* SR_KSU_USER is in <mips64/cpu.h> for CLKF_USERMODE() */
90#ifndef SR_KSU_USER
91#define SR_KSU_USER 0x00000010
92#endif
93
94#define SOFT_INT_MASK (SOFT_INT_MASK_0 | SOFT_INT_MASK_1)
95
96/*
97 * Cause register.
98 */
99
100#define CR_BR_DELAY 0x80000000
101#define CR_BR_DELAY_SHIFT 31
102#define CR_EXC_CODE 0x0000007c
103#define CR_EXC_CODE_SHIFT 2
104#define CR_COP_ERR 0x30000000
105#define CR_COP1_ERR 0x10000000
106#define CR_COP2_ERR 0x20000000
107#define CR_COP3_ERR 0x20000000
108#define CR_INT_SOFT0 0x00000100
109#define CR_INT_SOFT1 0x00000200
110#define CR_INT_0 0x00000400
111#define CR_INT_1 0x00000800
112#define CR_INT_2 0x00001000
113#define CR_INT_3 0x00002000
114#define CR_INT_4 0x00004000
115#define CR_INT_5 0x00008000
116
117#define CR_INT_MASK 0x003fff00
118
119/*
120 * Config register.
121 */
122
123#define CFGR_CCA_MASK 0x00000007
124#define CFGR_CU 0x00000008
125#define CFGR_ICE 0x0000000200000000
126#define CFGR_SMM 0x0000000400000000
127
128/*
129 * Location of exception vectors.
130 */
131
132#define RESET_EXC_VEC (CKSEG1_BASE + 0x1fc00000)
133#define TLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000000)
134#define XTLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000080)
135#define CACHE_ERR_EXC_VEC (CKSEG1_BASE + 0x00000100)
136#define GEN_EXC_VEC (CKSEG1_BASE + 0x00000180)
137
138/*
139 * Coprocessor 0 registers
140 */
141
142/* Common subset */
143#define COP_0_COUNT $9
144#define COP_0_TLB_HI $10
145#define COP_0_STATUS_REG $12
146#define COP_0_CAUSE_REG $13
147#define COP_0_EXC_PC $14
148#define COP_0_PRID $15
149#define COP_0_CONFIG $16
150
151/* MIPS64 release 2 */
152#define COP_0_USERLOCAL $4, 2
153#define COP_0_TLB_PG_GRAIN $5, 1
154#define COP_0_EBASE $15, 1
155
156/* R4000/5000/10000 */
157#define COP_0_TLB_INDEX $0
158#define COP_0_TLB_RANDOM $1
159#define COP_0_TLB_LO0 $2
160#define COP_0_TLB_LO1 $3
161#define COP_0_TLB_CONTEXT $4
162#define COP_0_TLB_PG_MASK $5
163#define COP_0_TLB_WIRED $6
164#define COP_0_BAD_VADDR $8
165#define COP_0_COMPARE $11
166#define COP_0_LLADDR $17
167#define COP_0_WATCH_LO $18
168#define COP_0_WATCH_HI $19
169#define COP_0_TLB_XCONTEXT $20
170#define COP_0_ECC $26
171#define COP_0_CACHE_ERR $27
172#define COP_0_TAG_LO $28
173#define COP_0_TAG_HI $29
174#define COP_0_ERROR_PC $30
175
176/* Loongson-2 specific */
177#define COP_0_DIAG $22
178
179/* Octeon specific */
180#define COP_0_CVMCTL $9, 7
181#define COP_0_CVMMEMCTL $11, 7
182
183/*
184 * COP_0_COUNT speed divider.
185 */
186#if defined(CPU_OCTEON)
187#define CP0_CYCLE_DIVIDER 1
188#else
189#define CP0_CYCLE_DIVIDER 2
190#endif
191
192/*
193 * The floating point version and status registers.
194 */
195#define FPC_ID $0
196#define FPC_CSR $31
197
198/*
199 * Config1 register
200 */
201#define CONFIG1_M 0x80000000u
202#define CONFIG1_MMUSize1 0x7e000000u
203#define CONFIG1_MMUSize1_SHIFT 25
204#define CONFIG1_IS 0x01c00000u
205#define CONFIG1_IS_SHIFT 22
206#define CONFIG1_IL 0x00380000u
207#define CONFIG1_IL_SHIFT 19
208#define CONFIG1_IA 0x00070000u
209#define CONFIG1_IA_SHIFT 16
210#define CONFIG1_DS 0x0000e000u
211#define CONFIG1_DS_SHIFT 13
212#define CONFIG1_DL 0x00001c00u
213#define CONFIG1_DL_SHIFT 10
214#define CONFIG1_DA 0x00000380u
215#define CONFIG1_DA_SHIFT 7
216#define CONFIG1_C2 0x00000040u
217#define CONFIG1_MD 0x00000020u
218#define CONFIG1_PC 0x00000010u
219#define CONFIG1_WR 0x00000008u
220#define CONFIG1_CA 0x00000004u
221#define CONFIG1_EP 0x00000002u
222#define CONFIG1_FP 0x00000001u
223
224/*
225 * Config3 register
226 */
227#define CONFIG3_M 0x80000000
228#define CONFIG3_BPG 0x40000000
229#define CONFIG3_CMGCR 0x20000000
230#define CONFIG3_IPLW 0x00600000
231#define CONFIG3_MMAR 0x001c0000
232#define CONFIG3_MCU 0x00020000
233#define CONFIG3_ISAOnExc 0x00010000
234#define CONFIG3_ISA 0x0000c000
235#define CONFIG3_ULRI 0x00002000
236#define CONFIG3_RXI 0x00001000
237#define CONFIG3_DSP2P 0x00000800
238#define CONFIG3_DSPP 0x00000400
239#define CONFIG3_CTXTC 0x00000200
240#define CONFIG3_ITL 0x00000100
241#define CONFIG3_LPA 0x00000080
242#define CONFIG3_VEIC 0x00000040
243#define CONFIG3_VInt 0x00000020
244#define CONFIG3_SP 0x00000010
245#define CONFIG3_CDMM 0x00000008
246#define CONFIG3_MT 0x00000004
247#define CONFIG3_SM 0x00000002
248#define CONFIG3_TL 0x00000001
249
250/*
251 * Config4 register
252 */
253#define CONFIG4_M 0x80000000u
254#define CONFIG4_IE 0x60000000u
255#define CONFIG4_AE 0x10000000u
256#define CONFIG4_VTLBSizeExt 0x0f000000u /* when MMUExtDef=3 */
257#define CONFIG4_KScrExist 0x00ff0000u
258#define CONFIG4_MMUExtDef 0x0000c000u
259#define CONFIG4_MMUExtDef_SHIFT 14
260#define CONFIG4_FTLBPageSize 0x00001f00u /* when MMUExtDef=2 or 3 */
261#define CONFIG4_FTLBWays 0x000000f0u /* when MMUExtDef=2 or 3 */
262#define CONFIG4_FTLBSets 0x0000000fu /* when MMUExtDef=2 or 3 */
263#define CONFIG4_MMUSizeExt 0x000000ffu /* when MMUExtDef=1 */
264
265/*
266 * PageGrain register
267 */
268#define PGRAIN_RIE 0x80000000
269#define PGRAIN_XIE 0x40000000
270#define PGRAIN_ELPA 0x20000000
271#define PGRAIN_ESP 0x10000000
272#define PGRAIN_IEC 0x08000000
273
274/*
275 * HWREna register
276 */
277#define HWRENA_ULR 0x20000000u
278#define HWRENA_CC 0x00000004u
279
280#endif /* _KERNEL || _STANDALONE */
281
282#endif /* !_MIPS64_CPUREGS_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/mips_opcode.h deleted-347
...@@ -1,347 +0,0 @@
1/* $OpenBSD: mips_opcode.h,v 1.9 2017/04/20 15:42:26 visa Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_MIPS_OPCODE_H_
38#define _MIPS64_MIPS_OPCODE_H_
39
40/*
41 * Define the instruction formats and opcode values for the
42 * MIPS instruction set.
43 */
44
45/*
46 * Define the instruction formats.
47 */
48typedef union {
49 unsigned word;
50
51#if BYTE_ORDER == BIG_ENDIAN
52 struct {
53 unsigned op: 6;
54 unsigned rs: 5;
55 unsigned rt: 5;
56 unsigned imm: 16;
57 } IType;
58
59 struct {
60 unsigned op: 6;
61 unsigned target: 26;
62 } JType;
63
64 struct {
65 unsigned op: 6;
66 unsigned rs: 5;
67 unsigned rt: 5;
68 unsigned rd: 5;
69 unsigned shamt: 5;
70 unsigned func: 6;
71 } RType;
72
73 struct {
74 unsigned op: 6; /* COP1 */
75 unsigned : 1; /* always '1' */
76 unsigned fmt: 4;
77 unsigned ft: 5;
78 unsigned fs: 5;
79 unsigned fd: 5;
80 unsigned func: 6;
81 } FRType;
82
83 struct {
84 unsigned op: 6; /* COP1X */
85 unsigned fr: 5;
86 unsigned ft: 5;
87 unsigned fs: 5;
88 unsigned fd: 5;
89 unsigned op4: 3;
90 unsigned fmt3: 3;
91 } FQType;
92#endif
93#if BYTE_ORDER == LITTLE_ENDIAN
94 struct {
95 unsigned imm: 16;
96 unsigned rt: 5;
97 unsigned rs: 5;
98 unsigned op: 6;
99 } IType;
100
101 struct {
102 unsigned target: 26;
103 unsigned op: 6;
104 } JType;
105
106 struct {
107 unsigned func: 6;
108 unsigned shamt: 5;
109 unsigned rd: 5;
110 unsigned rt: 5;
111 unsigned rs: 5;
112 unsigned op: 6;
113 } RType;
114
115 struct {
116 unsigned func: 6;
117 unsigned fd: 5;
118 unsigned fs: 5;
119 unsigned ft: 5;
120 unsigned fmt: 4;
121 unsigned : 1; /* always '1' */
122 unsigned op: 6; /* COP1 */
123 } FRType;
124
125 struct {
126 unsigned fmt3: 3;
127 unsigned op4: 3;
128 unsigned fd: 5;
129 unsigned fs: 5;
130 unsigned ft: 5;
131 unsigned fr: 5;
132 unsigned op: 6; /* COP1X */
133 } FQType;
134#endif
135} InstFmt;
136
137/*
138 * Values for the 'op' field.
139 */
140#define OP_SPECIAL 000
141#define OP_BCOND 001
142#define OP_J 002
143#define OP_JAL 003
144#define OP_BEQ 004
145#define OP_BNE 005
146#define OP_BLEZ 006
147#define OP_BGTZ 007
148
149#define OP_ADDI 010
150#define OP_ADDIU 011
151#define OP_SLTI 012
152#define OP_SLTIU 013
153#define OP_ANDI 014
154#define OP_ORI 015
155#define OP_XORI 016
156#define OP_LUI 017
157
158#define OP_COP0 020
159#define OP_COP1 021
160#define OP_COP2 022
161#define OP_COP3 023
162#define OP_COP1X 023
163#define OP_BEQL 024
164#define OP_BNEL 025
165#define OP_BLEZL 026
166#define OP_BGTZL 027
167
168#define OP_DADDI 030
169#define OP_DADDIU 031
170#define OP_LDL 032
171#define OP_LDR 033
172
173#define OP_SPECIAL3 037
174
175#define OP_LB 040
176#define OP_LH 041
177#define OP_LWL 042
178#define OP_LW 043
179#define OP_LBU 044
180#define OP_LHU 045
181#define OP_LWR 046
182#define OP_LWU 047
183
184#define OP_SB 050
185#define OP_SH 051
186#define OP_SWL 052
187#define OP_SW 053
188#define OP_SDL 054
189#define OP_SDR 055
190#define OP_SWR 056
191#define OP_CACHE 057
192
193#define OP_LL 060
194#define OP_LWC1 061
195#define OP_LWC2 062
196#define OP_LWC3 063
197#define OP_PREF 063
198#define OP_LLD 064
199#define OP_LDC1 065
200#define OP_LDC2 066
201#define OP_LD 067
202
203#define OP_SC 070
204#define OP_SWC1 071
205#define OP_SWC2 072
206#define OP_SWC3 073
207#define OP_SCD 074
208#define OP_SDC1 075
209#define OP_SDC2 076
210#define OP_SD 077
211
212/*
213 * Values for the 'func' field when 'op' == OP_SPECIAL.
214 */
215#define OP_SLL 000
216#define OP_MOVCI 001
217#define OP_SRL 002
218#define OP_SRA 003
219#define OP_SLLV 004
220#define OP_SRLV 006
221#define OP_SRAV 007
222
223#define OP_JR 010
224#define OP_JALR 011
225#define OP_MOVZ 012
226#define OP_MOVN 013
227#define OP_SYSCALL 014
228#define OP_BREAK 015
229#define OP_SYNC 017
230
231#define OP_MFHI 020
232#define OP_MTHI 021
233#define OP_MFLO 022
234#define OP_MTLO 023
235#define OP_DSLLV 024
236#define OP_DSRLV 026
237#define OP_DSRAV 027
238
239#define OP_MULT 030
240#define OP_MULTU 031
241#define OP_DIV 032
242#define OP_DIVU 033
243#define OP_DMULT 034
244#define OP_DMULTU 035
245#define OP_DDIV 036
246#define OP_DDIVU 037
247
248#define OP_ADD 040
249#define OP_ADDU 041
250#define OP_SUB 042
251#define OP_SUBU 043
252#define OP_AND 044
253#define OP_OR 045
254#define OP_XOR 046
255#define OP_NOR 047
256
257#define OP_SLT 052
258#define OP_SLTU 053
259#define OP_DADD 054
260#define OP_DADDU 055
261#define OP_DSUB 056
262#define OP_DSUBU 057
263
264#define OP_TGE 060
265#define OP_TGEU 061
266#define OP_TLT 062
267#define OP_TLTU 063
268#define OP_TEQ 064
269#define OP_TNE 066
270
271#define OP_DSLL 070
272#define OP_DSRL 072
273#define OP_DSRA 073
274#define OP_DSLL32 074
275#define OP_DSRL32 076
276#define OP_DSRA32 077
277
278/*
279 * Values for the 'rt' field when 'op' == OP_BCOND.
280 */
281#define OP_BLTZ 000
282#define OP_BGEZ 001
283#define OP_BLTZL 002
284#define OP_BGEZL 003
285
286#define OP_TGEI 010
287#define OP_TGEIU 011
288#define OP_TLTI 012
289#define OP_TLTIU 013
290#define OP_TEQI 014
291#define OP_TNEI 016
292
293#define OP_BLTZAL 020
294#define OP_BGEZAL 021
295#define OP_BLTZALL 022
296#define OP_BGEZALL 023
297
298/*
299 * Values for the 'rs' field when 'op' == OP_COPz.
300 */
301#define OP_MF 000
302#define OP_DMF 001
303#define OP_CF 002
304#define OP_MFH 003
305#define OP_MT 004
306#define OP_DMT 005
307#define OP_CT 006
308#define OP_MTH 007
309#define OP_BC 010
310#define OP_C0MISC 020 /* cop0 only */
311#define OP_TFP_C0MISC 030 /* cop0 only on R8000 */
312
313/*
314 * Values for the 'rt' field when 'op' == OP_COPz.
315 */
316#define COPz_BC_TF_MASK 0x01
317#define COPz_BC_TRUE 0x01
318#define COPz_BC_FALSE 0x00
319#define COPz_BCL_TF_MASK 0x02
320#define COPz_BCL_TRUE 0x02
321#define COPz_BCL_FALSE 0x00
322#define COPz_BC_CC_MASK 0x1c
323#define COPz_BC_CC_SHIFT 2
324
325/*
326 * Values for the 'func' field when 'op' == OP_COP1X.
327 */
328#define OP_LWXC1 000
329#define OP_LDXC1 001
330#define OP_SWXC1 010
331#define OP_SDXC1 011
332#define OP_PREFX 017
333
334/*
335 * Values for the 'op4' field when 'op' == OP_COP1X.
336 */
337#define OP_MADD 04
338#define OP_MSUB 05
339#define OP_NMADD 06
340#define OP_NMSUB 07
341
342/*
343 * Values for the 'func' field when 'op' == OP_SPECIAL3.
344 */
345#define OP_RDHWR 073
346
347#endif /* !_MIPS64_MIPS_OPCODE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/mplock.h deleted-10
...@@ -1,10 +0,0 @@
1/* $OpenBSD: mplock.h,v 1.2 2017/10/21 06:11:22 visa Exp $ */
2
3/* public domain */
4
5#ifndef _MACHINE_MPLOCK_H_
6#define _MACHINE_MPLOCK_H_
7
8#define __USE_MI_MPLOCK
9
10#endif /* !_MACHINE_MPLOCK_H */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/mutex.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mutex.h,v 1.5 2018/01/25 15:06:29 mpi Exp $ */
2
3#define __USE_MI_MUTEX
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/param.h deleted-82
...@@ -1,82 +0,0 @@
1/* $OpenBSD: param.h,v 1.37 2023/12/14 13:26:49 claudio Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#ifndef _MIPS64_PARAM_H_
38#define _MIPS64_PARAM_H_
39
40#ifdef _KERNEL
41#include <machine/cpu.h>
42#endif
43
44#define PAGE_SIZE (1 << PAGE_SHIFT)
45#define PAGE_MASK (PAGE_SIZE - 1)
46
47#ifdef _KERNEL
48
49#ifndef KERNBASE
50#define KERNBASE 0xffffffff80000000L /* start of kernel virtual */
51#endif
52
53#define NBPG PAGE_SIZE
54#define PGSHIFT PAGE_SHIFT
55#define PGOFSET PAGE_MASK
56
57#define USPACE 16384
58#define UPAGES (USPACE >> PAGE_SHIFT)
59#if PAGE_SHIFT > 12
60#define USPACE_ALIGN 0
61#else
62#define USPACE_ALIGN (2 * PAGE_SIZE) /* align to an even TLB boundary */
63#endif
64
65#define NMBCLUSTERS (64 * 1024) /* max cluster allocation */
66
67#ifndef MSGBUFSIZE
68#if PAGE_SHIFT > 12
69#define MSGBUFSIZE PAGE_SIZE
70#else
71#define MSGBUFSIZE 8192
72#endif
73#endif
74
75#ifndef _LOCORE
76#define DELAY(n) delay(n)
77void delay(int);
78#endif
79
80#endif /* _KERNEL */
81
82#endif /* _MIPS64_PARAM_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/pcb.h deleted-58
...@@ -1,58 +0,0 @@
1/* $OpenBSD: pcb.h,v 1.10 2021/10/07 12:40:16 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: pcb.h 1.13 89/04/23
37 * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93
38 */
39
40#ifndef _MIPS64_PCB_H_
41#define _MIPS64_PCB_H_
42
43#include <machine/frame.h>
44
45/*
46 * MIPS process control block. This is first in the U-area.
47 */
48struct pcb {
49 struct trapframe pcb_regs; /* saved CPU and registers */
50 struct {
51 /* val[12] is unused, was RM7000 ICR */
52 register_t val[13];
53 } pcb_context; /* kernel context for resume */
54 int pcb_onfault; /* for copyin/copyout faults */
55 void *pcb_segtab; /* copy of pmap pm_segtab */
56};
57
58#endif /* !_MIPS64_PCB_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/pmap.h deleted-228
...@@ -1,228 +0,0 @@
1/* $OpenBSD: pmap.h,v 1.55 2025/06/02 18:49:04 claudio Exp $ */
2
3/*
4 * Copyright (c) 1987 Carnegie-Mellon University
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Ralph Campbell.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93
36 */
37
38#ifndef _MIPS64_PMAP_H_
39#define _MIPS64_PMAP_H_
40
41#include <sys/mutex.h>
42
43#ifdef _KERNEL
44
45#include <machine/pte.h>
46
47/*
48 * The user address space is currently limited to 1TB (0x0 - 0x10000000000).
49 *
50 * The user address space is mapped using a two level structure where
51 * the virtual addresses bits are split in three groups:
52 * segment:directory:page:offset
53 * where:
54 * - offset are the in-page offsets (PAGE_SHIFT bits)
55 * - page are the third level page table index
56 * (PMAP_PGSHIFT - Log2(pt_entry_t) bits)
57 * - directory are the second level page table (directory) index
58 * (PMAP_PGSHIFT - Log2(void *) bits)
59 * - segment are the first level page table (segment) index
60 * (PMAP_PGSHIFT - Log2(void *) bits)
61 *
62 * This scheme allows Segment, directory and page tables have the same size
63 * (1 << PMAP_PGSHIFT bytes, regardless of the pt_entry_t size) to be able to
64 * share the same allocator.
65 *
66 * Note: The kernel doesn't use the same data structures as user programs.
67 * All the PTE entries are stored in a single array in Sysmap which is
68 * dynamically allocated at boot time.
69 */
70
71#if defined(MIPS_PTE64) && PAGE_SHIFT == 12
72#error "Cannot use MIPS_PTE64 with 4KB pages."
73#endif
74
75/*
76 * Size of page table structs (page tables, page directories,
77 * and segment table) used by this pmap.
78 */
79
80#define PMAP_PGSHIFT 12
81#define PMAP_PGSIZE (1UL << PMAP_PGSHIFT)
82
83#define NPDEPG (PMAP_PGSIZE / sizeof(void *))
84#define NPTEPG (PMAP_PGSIZE / sizeof(pt_entry_t))
85
86/*
87 * Segment sizes
88 */
89
90#define SEGSHIFT (PAGE_SHIFT+PMAP_PGSHIFT*2-PTE_LOG-3)
91#define DIRSHIFT (PAGE_SHIFT+PMAP_PGSHIFT-PTE_LOG)
92#define NBSEG (1UL << SEGSHIFT)
93#define NBDIR (1UL << DIRSHIFT)
94#define SEGOFSET (NBSEG - 1)
95#define DIROFSET (NBDIR - 1)
96
97#define mips_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET)
98#define mips_trunc_dir(x) ((vaddr_t)(x) & ~DIROFSET)
99#define mips_round_seg(x) (((vaddr_t)(x) + SEGOFSET) & ~SEGOFSET)
100#define mips_round_dir(x) (((vaddr_t)(x) + DIROFSET) & ~DIROFSET)
101#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)])
102
103/* number of segments entries */
104#define PMAP_SEGTABSIZE (PMAP_PGSIZE / sizeof(void *))
105
106struct segtab {
107 pt_entry_t **seg_tab[PMAP_SEGTABSIZE];
108};
109
110struct pmap_asid_info {
111 u_int pma_asid; /* address space tag */
112 u_int pma_asidgen; /* TLB PID generation number */
113};
114
115/*
116 * Machine dependent pmap structure.
117 */
118typedef struct pmap {
119 struct mutex pm_mtx; /* pmap lock */
120 struct mutex pm_swmtx; /* pmap switch lock */
121 int pm_count; /* pmap reference count */
122 struct pmap_statistics pm_stats; /* pmap statistics */
123 struct segtab *pm_segtab; /* pointers to pages of PTEs */
124 struct pmap_asid_info pm_asid[1]; /* ASID information */
125} *pmap_t;
126
127/*
128 * Compute the sizeof of a pmap structure. Subtract one because one
129 * ASID info structure is already included in the pmap structure itself.
130 */
131#define PMAP_SIZEOF(x) \
132 (ALIGN(sizeof(struct pmap) + \
133 (sizeof(struct pmap_asid_info) * ((x) - 1))))
134
135/* machine-dependent pg_flags */
136#define PGF_UNCACHED PG_PMAP0 /* Page is explicitly uncached */
137#define PGF_CACHED PG_PMAP1 /* Page is currently cached */
138#define PGF_ATTR_MOD PG_PMAP2
139#define PGF_ATTR_REF PG_PMAP3
140#define PGF_PRESERVE (PGF_ATTR_MOD | PGF_ATTR_REF)
141
142#define PMAP_NOCACHE PMAP_MD0
143
144extern struct pmap *const kernel_pmap_ptr;
145
146#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
147#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
148#define pmap_kernel() (kernel_pmap_ptr)
149
150extern pt_entry_t pg_ri;
151#define PMAP_CHECK_COPYIN (pg_ri == 0)
152
153#define PMAP_STEAL_MEMORY /* Enable 'stealing' during boot */
154
155#define PMAP_PREFER
156extern vaddr_t pmap_prefer_mask;
157/* pmap prefer alignment */
158#define PMAP_PREFER_ALIGN() \
159 (pmap_prefer_mask ? pmap_prefer_mask + 1 : 0)
160/* pmap prefer offset in alignment */
161#define PMAP_PREFER_OFFSET(of) ((of) & pmap_prefer_mask)
162
163void pmap_bootstrap(void);
164int pmap_copyinsn(pmap_t, vaddr_t, uint32_t *);
165int pmap_emulate_modify(pmap_t, vaddr_t);
166void pmap_page_cache(vm_page_t, u_int);
167
168#define pmap_init_percpu() do { /* nothing */ } while (0)
169#define pmap_unuse_final(p) do { /* nothing yet */ } while (0)
170#define pmap_remove_holes(vm) do { /* nothing */ } while (0)
171
172#define __HAVE_PMAP_DIRECT
173vaddr_t pmap_map_direct(vm_page_t);
174vm_page_t pmap_unmap_direct(vaddr_t);
175
176/*
177 * MD flags to pmap_enter:
178 */
179
180#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK)
181
182/* Kernel virtual address to page table entry */
183#define kvtopte(va) \
184 (Sysmap + (((vaddr_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT))
185/* User virtual address to pte page entry */
186#define uvtopte(va) (((va) >> PAGE_SHIFT) & (NPTEPG -1))
187#define uvtopde(va) (((va) >> DIRSHIFT) & (NPDEPG - 1))
188
189static inline pt_entry_t *
190pmap_pte_lookup(struct pmap *pmap, vaddr_t va)
191{
192 pt_entry_t **pde, *pte;
193
194 if ((pde = pmap_segmap(pmap, va)) == NULL)
195 return NULL;
196 if ((pte = pde[uvtopde(va)]) == NULL)
197 return NULL;
198 return pte + uvtopte(va);
199}
200
201extern pt_entry_t *Sysmap; /* kernel pte table */
202extern u_int Sysmapsize; /* number of pte's in Sysmap */
203
204#endif /* _KERNEL */
205
206#if !defined(_LOCORE)
207typedef struct pv_entry {
208 struct pv_entry *pv_next; /* next pv_entry */
209 struct pmap *pv_pmap; /* pmap where mapping lies */
210 vaddr_t pv_va; /* virtual address for mapping */
211} *pv_entry_t;
212
213struct vm_page_md {
214 struct mutex pv_mtx; /* pv list lock */
215 struct pv_entry pv_ent; /* pv list of this seg */
216};
217
218#define VM_MDPAGE_INIT(pg) \
219 do { \
220 mtx_init(&(pg)->mdpage.pv_mtx, IPL_VM); \
221 (pg)->mdpage.pv_ent.pv_next = NULL; \
222 (pg)->mdpage.pv_ent.pv_pmap = NULL; \
223 (pg)->mdpage.pv_ent.pv_va = 0; \
224 } while (0)
225
226#endif /* !_LOCORE */
227
228#endif /* !_MIPS64_PMAP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/proc.h deleted-75
...@@ -1,75 +0,0 @@
1/* $OpenBSD: proc.h,v 1.11 2017/04/13 03:52:25 guenther Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)proc.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_PROC_H_
38#define _MIPS64_PROC_H_
39
40/*
41 * Machine-dependent part of the proc structure.
42 */
43struct mdproc {
44 struct trapframe *md_regs; /* registers on current frame */
45 volatile int md_astpending; /* AST pending for this process */
46 int md_flags; /* machine-dependent flags */
47 vaddr_t md_uarea; /* allocated uarea virtual addr */
48 void *md_tcb; /* user-space thread-control-block */
49
50 /* ptrace fields */
51 vaddr_t md_ss_addr; /* single step address */
52 uint32_t md_ss_instr; /* saved single step instruction */
53
54 /* fpu emulation fields */
55 vaddr_t md_fppgva; /* vaddr of the branch emulation page */
56 vaddr_t md_fpbranchva; /* vaddr of fp branch destination */
57 vaddr_t md_fpslotva; /* initial vaddr of delay slot */
58
59 int32_t md_obsolete[10]; /* Were RM7000-specific data. */
60};
61
62/*
63 * Values for md_flags.
64 * MDP_FPUSED has two meanings: if the floating point hardware (coprocessor
65 * #1) is available, it means it has been used; if there is no floating
66 * point hardware, it means the process is currently running a duplicated
67 * delay slot, created by the branch emulation logic.
68 */
69#define MDP_FPUSED 0x00000001 /* floating point coprocessor used */
70#define MDP_PERF 0x00010000 /* Performance counter used */
71#define MDP_WATCH1 0x00020000 /* Watch register 1 used */
72#define MDP_WATCH2 0x00040000 /* Watch register 1 used */
73#define MDP_FORKSAVE 0x0000ffff /* Flags to save when forking */
74
75#endif /* !_MIPS64_PROC_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/profile.h deleted-85
...@@ -1,85 +0,0 @@
1/* $OpenBSD: profile.h,v 1.5 2019/04/19 09:19:22 visa Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)profile.h 8.1 (Berkeley) 6/10/93
35 */
36#ifndef _MIPS64_PROFILE_H_
37#define _MIPS64_PROFILE_H_
38
39#define _MCOUNT_DECL static void ___mcount
40
41/*XXX The cprestore instruction is a "dummy" to shut up as(1). */
42
43#define MCOUNT \
44 __asm(".globl _mcount;" \
45 ".type _mcount,@function;" \
46 "_mcount:;" \
47 ".set noreorder;" \
48 ".set noat;" \
49 ".cpload $25;" \
50 ".cprestore 4;" \
51 "sd $4,16($29);" \
52 "sd $5,24($29);" \
53 "sd $6,32($29);" \
54 "sd $7,40($29);" \
55 "sd $1,0($29);" \
56 "sd $31,8($29);" \
57 "move $5,$31;" \
58 ".local ___mcount;" \
59 "jal ___mcount;" \
60 "move $4,$1;" \
61 "ld $4,16($29);" \
62 "ld $5,24($29);" \
63 "ld $6,32($29);" \
64 "ld $7,40($29);" \
65 "ld $31,8($29);" \
66 "ld $1,0($29);" \
67 "daddu $29,$29,16;" \
68 "j $31;" \
69 "move $31,$1;" \
70 ".set reorder;" \
71 ".set at");
72
73#ifdef _KERNEL
74/*
75 * The following two macros do splhigh and splx respectively.
76 * They have to be defined this way because these are real
77 * functions on the MIPS, and we do not want to invoke mcount
78 * recursively.
79 */
80#define MCOUNT_ENTER s = _splhigh()
81
82#define MCOUNT_EXIT _splx(s)
83#endif /* _KERNEL */
84
85#endif /* !_MIPS64_PROFILE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/pte.h deleted-160
...@@ -1,160 +0,0 @@
1/* $OpenBSD: pte.h,v 1.24 2023/01/11 03:17:56 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: pte.h 1.11 89/09/03
37 * from: @(#)pte.h 8.1 (Berkeley) 6/10/93
38 */
39
40/*
41 * R4000 and R8000 hardware page table entries
42 */
43
44#ifndef _MIPS64_PTE_H_
45#define _MIPS64_PTE_H_
46
47#ifndef _LOCORE
48
49/*
50 * Structure defining a TLB entry data set.
51 */
52struct tlb_entry {
53 u_int64_t tlb_mask;
54 u_int64_t tlb_hi;
55 u_int64_t tlb_lo0;
56 u_int64_t tlb_lo1;
57};
58
59u_int tlb_get_pid(void);
60void tlb_read(unsigned int, struct tlb_entry *);
61
62#ifdef MIPS_PTE64
63typedef u_int64_t pt_entry_t;
64#else
65typedef u_int32_t pt_entry_t;
66#endif
67
68#endif /* _LOCORE */
69
70#ifdef MIPS_PTE64
71#define PTE_BITS 64
72#define PTE_LOAD ld
73#define PTE_LOG 3
74#define PTE_OFFS 8
75#else
76#define PTE_BITS 32
77#define PTE_LOAD lwu
78#define PTE_LOG 2
79#define PTE_OFFS 4
80#endif
81
82#if defined(CPU_MIPS64R2) && !defined(CPU_LOONGSON2)
83#define PTE_CLEAR_SWBITS(reg) \
84 .set push; \
85 .set mips64r2; \
86 /* Clear SW bits between PG_XI and PG_FRAMEBITS. */ \
87 dins reg, zero, PG_FRAMEBITS, (PTE_BITS - 2 - PG_FRAMEBITS); \
88 .set pop
89#else
90#define PTE_CLEAR_SWBITS(reg) \
91 /* Clear SW bits left of PG_FRAMEBITS. */ \
92 dsll reg, reg, (64 - PG_FRAMEBITS); \
93 dsrl reg, reg, (64 - PG_FRAMEBITS)
94#endif
95
96/* entryhi values */
97
98#define PG_HVPN (-2 * PAGE_SIZE) /* Hardware page number mask */
99#define PG_ODDPG PAGE_SIZE
100
101/* Address space ID */
102#define PG_ASID_MASK 0x00000000000000ff
103#define PG_ASID_SHIFT 0
104#define MIN_USER_ASID 1
105#define PG_ASID_COUNT 256 /* Number of available ASID */
106
107/* entrylo values */
108
109#ifdef MIPS_PTE64
110#define PG_FRAMEBITS 60
111#else
112#define PG_FRAMEBITS 28
113#endif
114#define PG_FRAME ((1ULL << PG_FRAMEBITS) - (1ULL << PG_SHIFT))
115#define PG_SHIFT 6
116
117/* software pte bits - not put in entrylo */
118#define PG_WIRED (1ULL << (PG_FRAMEBITS + 1))
119#define PG_RO (1ULL << (PG_FRAMEBITS + 0))
120
121#ifdef CPU_MIPS64R2
122#define PG_RI (1ULL << (PG_FRAMEBITS + 3))
123#define PG_XI (1ULL << (PG_FRAMEBITS + 2))
124#else
125#define PG_RI 0x00000000
126#define PG_XI 0x00000000
127#endif
128
129#define PG_NV 0x00000000
130#define PG_G 0x00000001
131#define PG_V 0x00000002
132#define PG_M 0x00000004
133#define PG_CCA_SHIFT 3
134
135#define PG_UNCACHED (CCA_NC << PG_CCA_SHIFT)
136#define PG_CACHED_NC (CCA_NONCOHERENT << PG_CCA_SHIFT)
137#define PG_CACHED_CE (CCA_COHERENT_EXCL << PG_CCA_SHIFT)
138#define PG_CACHED_CEW (CCA_COHERENT_EXCLWRITE << PG_CCA_SHIFT)
139#define PG_CACHED (CCA_CACHED << PG_CCA_SHIFT)
140#define PG_CACHEMODE (7 << PG_CCA_SHIFT)
141
142#define PG_PROTMASK (PG_M | PG_RO | PG_RI | PG_XI)
143
144#define pfn_to_pad(pa) ((((paddr_t)pa) & PG_FRAME) << PG_SHIFT)
145#define vad_to_pfn(va) (((va) >> PG_SHIFT) & PG_FRAME)
146
147#define PG_SIZE_4K 0x00000000
148#define PG_SIZE_16K 0x00006000
149#define PG_SIZE_64K 0x0001e000
150#define PG_SIZE_256K 0x0007e000
151#define PG_SIZE_1M 0x001fe000
152#define PG_SIZE_4M 0x007fe000
153#define PG_SIZE_16M 0x01ffe000
154#if PAGE_SHIFT == 12
155#define TLB_PAGE_MASK PG_SIZE_4K
156#elif PAGE_SHIFT == 14
157#define TLB_PAGE_MASK PG_SIZE_16K
158#endif
159
160#endif /* !_MIPS64_PTE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/ptrace.h deleted-46
...@@ -1,46 +0,0 @@
1/* $OpenBSD: ptrace.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93
32 */
33
34#ifndef _MIPS64_PTRACE_H_
35#define _MIPS64_PTRACE_H_
36
37/*
38 * Machine dependent trace commands.
39 *
40 */
41
42#define PT_GETREGS (PT_FIRSTMACH+0)
43#define PT_SETREGS (PT_FIRSTMACH+1)
44#define PT_STEP (PT_FIRSTMACH+2)
45
46#endif /* !_MIPS64_PTRACE_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/reg.h deleted-54
...@@ -1,54 +0,0 @@
1/* $OpenBSD: reg.h,v 1.5 2021/10/07 12:32:10 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: reg.h 1.1 90/07/09
37 * @(#)reg.h 8.2 (Berkeley) 1/11/94
38 */
39
40#ifndef _MIPS64_REG_H_
41#define _MIPS64_REG_H_
42/*
43 * Location of the users' stored
44 * registers relative to ZERO.
45 * Usage is p->p_regs[XX].
46 *
47 * must be visible to assembly code.
48 */
49#include <machine/regnum.h>
50
51struct reg {
52 register_t r_regs[NREGS]; /* numbered as above */
53};
54#endif /* !_MIPS64_REG_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/regdef.h deleted-77
...@@ -1,77 +0,0 @@
1/* $OpenBSD: regdef.h,v 1.5 2014/03/10 21:10:36 miod Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell. This file is derived from the MIPS RISC
9 * Architecture book by Gerry Kane.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)regdef.h 8.1 (Berkeley) 6/10/93
36 */
37#ifndef _MIPS64_REGDEF_H_
38#define _MIPS64_REGDEF_H_
39
40#define zero $0 /* always zero */
41#define AT $at /* assembler temp */
42#define v0 $2 /* return value */
43#define v1 $3
44#define a0 $4 /* argument registers */
45#define a1 $5
46#define a2 $6
47#define a3 $7
48#define a4 $8
49#define a5 $9
50#define a6 $10
51#define a7 $11
52#define ta0 $8 /* alias */
53#define ta1 $9
54#define ta2 $10
55#define ta3 $11
56#define t0 $12 /* temp registers (not saved across subroutine calls) */
57#define t1 $13
58#define t2 $14
59#define t3 $15
60#define s0 $16 /* saved across subroutine calls (callee saved) */
61#define s1 $17
62#define s2 $18
63#define s3 $19
64#define s4 $20
65#define s5 $21
66#define s6 $22
67#define s7 $23
68#define t8 $24 /* two more temp registers */
69#define t9 $25
70#define k0 $26 /* kernel temporary */
71#define k1 $27
72#define gp $28 /* global pointer */
73#define sp $29 /* stack pointer */
74#define s8 $30 /* one more callee saved */
75#define ra $31 /* return address */
76
77#endif /* !_MIPS64_REGDEF_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/regnum.h deleted-119
...@@ -1,119 +0,0 @@
1/* $OpenBSD: regnum.h,v 1.4 2014/07/09 12:58:08 miod Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_REGNUM_H_
30#define _MIPS64_REGNUM_H_
31
32/*
33 * Location of the saved registers relative to ZERO.
34 * Usage is p->p_regs[XX].
35 */
36#define ZERO 0
37#define AST 1
38#define V0 2
39#define V1 3
40#define A0 4
41#define A1 5
42#define A2 6
43#define A3 7
44#define A4 8
45#define A5 9
46#define A6 10
47#define A7 11
48#define T0 12
49#define T1 13
50#define T2 14
51#define T3 15
52#define S0 16
53#define S1 17
54#define S2 18
55#define S3 19
56#define S4 20
57#define S5 21
58#define S6 22
59#define S7 23
60#define T8 24
61#define T9 25
62#define K0 26
63#define K1 27
64#define GP 28
65#define SP 29
66#define S8 30
67#define RA 31
68#define SR 32
69#define PS SR /* alias for SR */
70#define MULLO 33
71#define MULHI 34
72#define BADVADDR 35
73#define CAUSE 36
74#define PC 37
75#define IC 38
76#define CPL 39
77
78#define NUMSAVEREGS 40 /* Number of registers saved in trap */
79
80#define FPBASE NUMSAVEREGS
81#define F0 (FPBASE+0)
82#define F1 (FPBASE+1)
83#define F2 (FPBASE+2)
84#define F3 (FPBASE+3)
85#define F4 (FPBASE+4)
86#define F5 (FPBASE+5)
87#define F6 (FPBASE+6)
88#define F7 (FPBASE+7)
89#define F8 (FPBASE+8)
90#define F9 (FPBASE+9)
91#define F10 (FPBASE+10)
92#define F11 (FPBASE+11)
93#define F12 (FPBASE+12)
94#define F13 (FPBASE+13)
95#define F14 (FPBASE+14)
96#define F15 (FPBASE+15)
97#define F16 (FPBASE+16)
98#define F17 (FPBASE+17)
99#define F18 (FPBASE+18)
100#define F19 (FPBASE+19)
101#define F20 (FPBASE+20)
102#define F21 (FPBASE+21)
103#define F22 (FPBASE+22)
104#define F23 (FPBASE+23)
105#define F24 (FPBASE+24)
106#define F25 (FPBASE+25)
107#define F26 (FPBASE+26)
108#define F27 (FPBASE+27)
109#define F28 (FPBASE+28)
110#define F29 (FPBASE+29)
111#define F30 (FPBASE+30)
112#define F31 (FPBASE+31)
113#define FSR (FPBASE+32)
114
115#define NUMFPREGS 33
116
117#define NREGS (NUMSAVEREGS + NUMFPREGS)
118
119#endif /* !_MIPS64_REGNUM_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/reloc.h deleted-54
...@@ -1,54 +0,0 @@
1/* $OpenBSD: reloc.h,v 1.4 2017/08/13 14:56:09 visa Exp $ */
2
3/*
4 * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_RELOC_H_
30#define _MIPS64_RELOC_H_
31
32/*
33 * Mips relocations.
34 */
35
36#define R_MIPS_NONE 0 /* No reloc */
37#define R_MIPS_16 1 /* Direct 16 bit */
38#define R_MIPS_32 2 /* Direct 32 bit */
39#define R_MIPS_REL32 3 /* PC relative 32 bit */
40#define R_MIPS_26 4 /* Direct 26 bit shifted */
41#define R_MIPS_HI16 5 /* High 16 bit */
42#define R_MIPS_LO16 6 /* Low 16 bit */
43#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
44#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
45#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
46#define R_MIPS_PC16 10 /* PC relative 16 bit */
47#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
48#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
49
50#define R_MIPS_64 18
51
52#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32)
53
54#endif /* !_MIPS64_RELOC_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/setjmp.h deleted-15
...@@ -1,15 +0,0 @@
1/* $OpenBSD: setjmp.h,v 1.4 2018/01/08 16:44:32 visa Exp $ */
2
3/* Public domain */
4
5#ifndef _MIPS64_SETJMP_H_
6#define _MIPS64_SETJMP_H_
7
8#define _JB_MASK (1 * REGSZ)
9#define _JB_PC (2 * REGSZ)
10#define _JB_REGS (3 * REGSZ)
11#define _JB_FPREGS (37 * REGSZ)
12
13#define _JBLEN 83 /* size, in longs, of a jmp_buf */
14
15#endif /* !_MIPS64_SETJMP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/signal.h deleted-70
...@@ -1,70 +0,0 @@
1/* $OpenBSD: signal.h,v 1.13 2018/01/08 16:44:32 visa Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)signal.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_SIGNAL_H_
38#define _MIPS64_SIGNAL_H_
39
40#include <sys/cdefs.h>
41#include <sys/types.h>
42
43/*
44 * Machine-dependent signal definitions
45 */
46typedef int sig_atomic_t;
47
48#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
49/*
50 * Information pushed on stack when a signal is delivered.
51 * This is used by the kernel to restore state following
52 * execution of the signal handler. It is also made available
53 * to the handler to allow it to restore state properly if
54 * a non-standard exit is performed.
55 */
56struct sigcontext {
57 long sc_cookie;
58 long sc_mask; /* signal mask to restore XXX should be int */
59 __register_t sc_pc; /* pc at time of signal */
60 __register_t sc_regs[32]; /* processor regs 0 to 31 */
61 __register_t mullo; /* mullo and mulhi registers... */
62 __register_t mulhi; /* mullo and mulhi registers... */
63 f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */
64 long sc_fpused; /* fp has been used */
65 long sc_fpc_eir; /* floating point exception instruction reg */
66 long xxx[8]; /* XXX reserved */
67};
68#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
69
70#endif /* !_MIPS64_SIGNAL_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/spinlock.h deleted-11
...@@ -1,11 +0,0 @@
1/* $OpenBSD: spinlock.h,v 1.5 2017/09/05 02:40:54 guenther Exp $ */
2 /* Public domain */
3
4#ifndef _MIPS64_SPINLOCK_H_
5#define _MIPS64_SPINLOCK_H_
6
7#define _ATOMIC_LOCK_UNLOCKED (0)
8#define _ATOMIC_LOCK_LOCKED (1)
9typedef int _atomic_lock_t;
10
11#endif /* !_MIPS64_SPINLOCK_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/sysarch.h deleted-52
...@@ -1,52 +0,0 @@
1/* $OpenBSD: sysarch.h,v 1.2 2012/12/05 23:20:13 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2009 Miodrag Vallat.
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#ifndef _MIPS64_SYSARCH_H_
20#define _MIPS64_SYSARCH_H_
21
22/*
23 * Architecture specific syscalls (mips64)
24 */
25
26#define MIPS64_CACHEFLUSH 0
27
28/*
29 * Argument structure and defines to mimic IRIX cacheflush() system call
30 */
31
32struct mips64_cacheflush_args {
33 vaddr_t va;
34 size_t sz;
35 int which;
36#define ICACHE 0x01
37#define DCACHE 0x02
38#define BCACHE (ICACHE | DCACHE)
39};
40
41#ifndef _KERNEL
42
43#include <sys/cdefs.h>
44
45__BEGIN_DECLS
46int cacheflush(void *, int, int);
47int _flush_cache(char *, int, int);
48int sysarch(int, void *);
49__END_DECLS
50#endif /* _KERNEL */
51
52#endif /* _MIPS64_SYSARCH_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/tcb.h deleted-66
...@@ -1,66 +0,0 @@
1/* $OpenBSD: tcb.h,v 1.4 2017/04/20 16:07:52 visa Exp $ */
2
3/*
4 * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
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#ifndef _MACHINE_TCB_H_
20#define _MACHINE_TCB_H_
21
22#ifdef _KERNEL
23
24static inline void
25__mips64_set_tcb(struct proc *p, void *tcb)
26{
27#ifdef CPU_MIPS64R2
28 extern int cpu_has_userlocal;
29
30 if (cpu_has_userlocal)
31 cp0_set_userlocal(tcb);
32#endif
33
34 p->p_md.md_tcb = tcb;
35}
36
37#define TCB_SET(p, addr) __mips64_set_tcb(p, addr)
38#define TCB_GET(p) ((p)->p_md.md_tcb)
39
40#else /* _KERNEL */
41
42/* ELF TLS ABI calls for small TCB, with static TLS data after it */
43#define TLS_VARIANT 1
44
45static inline void *
46__mips64_get_tcb(void)
47{
48 void *tcb;
49
50 /*
51 * This invokes emulation in kernel if the system does not implement
52 * the RDHWR instruction or the UserLocal register.
53 */
54 __asm__ volatile (
55 " .set push\n"
56 " .set mips64r2\n"
57 " rdhwr %0, $29\n"
58 " .set pop\n" : "=r" (tcb));
59 return tcb;
60}
61
62#define TCB_GET() __mips64_get_tcb()
63
64#endif /* _KERNEL */
65
66#endif /* _MACHINE_TCB_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/timetc.h deleted-23
...@@ -1,23 +0,0 @@
1/* $OpenBSD: timetc.h,v 1.3 2020/07/18 08:37:43 visa Exp $ */
2/*
3 * Copyright (c) 2020 Paul Irofti <paul@irofti.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MIPS64_TIMETC_H_
19#define _MIPS64_TIMETC_H_
20
21#define TC_CP0_COUNT 1
22
23#endif /* _MIPS64_TIMETC_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/trap.h deleted-127
...@@ -1,127 +0,0 @@
1/* $OpenBSD: trap.h,v 1.17 2022/01/28 16:20:09 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: trap.h 1.1 90/07/09
37 * from: @(#)trap.h 8.1 (Berkeley) 6/10/93
38 */
39
40#ifndef _MIPS64_TRAP_H_
41#define _MIPS64_TRAP_H_
42
43/*
44 * Trap codes (ExcCode in the cause register); also known in trap.c for
45 * name strings.
46 */
47
48#define T_INT 0 /* Interrupt pending */
49#define T_TLB_MOD 1 /* TLB modified fault */
50#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */
51#define T_TLB_ST_MISS 3 /* TLB miss on a store */
52#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */
53#define T_ADDR_ERR_ST 5 /* Address error on a store */
54#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */
55#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */
56#define T_SYSCALL 8 /* System call */
57#define T_BREAK 9 /* Breakpoint */
58#define T_RES_INST 10 /* Reserved instruction exception */
59#define T_COP_UNUSABLE 11 /* Coprocessor unusable */
60#define T_OVFLOW 12 /* Arithmetic overflow */
61#define T_TRAP 13 /* Trap instruction */
62#define T_VCEI 14 /* R4k Virtual coherency instruction */
63#define T_FPE 15 /* Floating point exception */
64#define T_IWATCH 16 /* R4k Inst. Watch address reference */
65#define T_C2E 18 /* R5k Coprocessor 2 exception */
66#define T_MDMX 22 /* R5k MDMX unusable */
67#define T_DWATCH 23 /* Data Watch address reference */
68#define T_MCHECK 24 /* Machine check */
69#define T_CACHEERR 30 /* Cache error */
70#define T_VCED 31 /* R4k Virtual coherency data */
71
72#define T_USER 0x20 /* user-mode flag or'ed with type */
73
74/*
75 * Defines for trap handler catching kernel accessing memory.
76 */
77#define KT_COPYERR 1 /* User space copy error */
78#define KT_KCOPYERR 2 /* Kernel space copy error */
79#define KT_DDBERR 3 /* DDB access error */
80
81#ifndef _LOCORE
82
83#if defined(DDB) || defined(DEBUG)
84
85struct trapdebug { /* trap history buffer for debugging */
86 register_t status;
87 register_t cause;
88 register_t vadr;
89 register_t pc;
90 register_t ra;
91 register_t sp;
92 u_int code;
93 u_int ipl;
94};
95
96#define trapdebug_enter(ci, frame, cd) \
97do { \
98 register_t sr = disableintr(); \
99 u_long cpuid = ci->ci_cpuid; \
100 struct trapdebug *t; \
101 \
102 t = trapdebug + TRAPSIZE * cpuid + trppos[cpuid]; \
103 t->status = frame->sr; \
104 t->cause = frame->cause; \
105 t->vadr = frame->badvaddr; \
106 t->pc = frame->pc; \
107 t->sp = frame->sp; \
108 t->ra = frame->ra; \
109 t->ipl = frame->ipl; \
110 t->code = cd; \
111 if (++trppos[cpuid] == TRAPSIZE) \
112 trppos[cpuid] = 0; \
113 setsr(sr); \
114} while (0)
115
116#define TRAPSIZE 10 /* Trap log buffer length */
117extern struct trapdebug trapdebug[MAXCPUS * TRAPSIZE];
118extern uint trppos[MAXCPUS];
119
120void trapDump(const char *, int (*)(const char *, ...));
121
122#else
123#define trapdebug_enter(ci, frame, code)
124#endif
125#endif /* _LOCORE */
126
127#endif /* !_MIPS64_TRAP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/mips64/vmparam.h deleted-115
...@@ -1,115 +0,0 @@
1/* $OpenBSD: vmparam.h,v 1.31 2023/11/16 13:47:22 deraadt Exp $ */
2/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */
3
4/*
5 * Copyright (c) 1988 University of Utah.
6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
10 * the Systems Programming Group of the University of Utah Computer
11 * Science Department and Ralph Campbell.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: Utah Hdr: vmparam.h 1.16 91/01/18
38 * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
39 */
40
41#ifndef _MIPS64_VMPARAM_H_
42#define _MIPS64_VMPARAM_H_
43
44/*
45 * Machine dependent constants mips processors.
46 */
47
48#define USRSTACK VM_MAXUSER_ADDRESS /* Start of user stack */
49
50/*
51 * Virtual memory related constants, all in bytes
52 */
53#ifndef MAXTSIZ
54#define MAXTSIZ (128*1024*1024) /* max text size */
55#endif
56#ifndef DFLDSIZ
57#define DFLDSIZ (128*1024*1024) /* initial data size limit */
58#endif
59#ifndef MAXDSIZ
60#define MAXDSIZ (16UL*1024*1024*1024) /* max data size */
61#endif
62#ifndef BRKSIZ
63#define BRKSIZ MAXDSIZ /* heap gap size */
64#endif
65#ifndef DFLSSIZ
66#define DFLSSIZ (2*1024*1024) /* initial stack size limit */
67#endif
68#ifndef MAXSSIZ
69#define MAXSSIZ (32*1024*1024) /* max stack size */
70#endif
71
72#define STACKGAP_RANDOM 256*1024
73
74/*
75 * PTEs for mapping user space into the kernel for physio operations.
76 * 16 pte's are enough to cover 8 disks * MAXBSIZE.
77 */
78#ifndef USRIOSIZE
79#define USRIOSIZE 32
80#endif
81
82/*
83 * PTEs for system V style shared memory.
84 * This is basically slop for kmempt which we actually allocate (malloc) from.
85 */
86#ifndef SHMMAXPGS
87#define SHMMAXPGS 8192 /* 8mb */
88#endif
89
90#ifndef VM_PHYSSEG_MAX
91#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */
92#endif
93#ifndef VM_PHYSSEG_STRAT
94#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
95#endif
96#define VM_PHYSSEG_NOADD
97
98/* user/kernel map constants */
99#define VM_MIN_ADDRESS ((vaddr_t)0x0000000000004000L)
100#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000010000000000L)
101#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
102#ifdef _KERNEL
103#define VM_MIN_STACK_ADDRESS ((vaddr_t)0x000000c000000000L)
104#endif
105#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc000000000000000L)
106#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xc000000040000000L)
107
108/* map PIE into approximately the first quarter of user va space */
109#define VM_PIE_MIN_ADDR PAGE_SIZE
110#define VM_PIE_MAX_ADDR (0x4000000000UL)
111
112/* virtual sizes (bytes) for various kernel submaps */
113#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
114
115#endif /* !_MIPS64_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/miscfs/fuse/fusefs.h+8-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: fusefs.h,v 1.15 2025/09/08 17:25:46 helg Exp $ */1/* $OpenBSD: fusefs.h,v 1.17 2026/06/20 13:45:13 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 *
...@@ -41,6 +41,7 @@ struct fusefs_mnt {...@@ -41,6 +41,7 @@ struct fusefs_mnt {
41 struct mount *mp;41 struct mount *mp;
42 uint32_t undef_op;42 uint32_t undef_op;
43 int max_read;43 int max_read;
44 int max_write;
44 int sess_init;45 int sess_init;
45 int allow_other;46 int allow_other;
46 dev_t dev;47 dev_t dev;
...@@ -74,12 +75,13 @@ void fuse_device_cleanup(dev_t);...@@ -74,12 +75,13 @@ void fuse_device_cleanup(dev_t);
74void fuse_device_queue_fbuf(dev_t, struct fusebuf *);75void fuse_device_queue_fbuf(dev_t, struct fusebuf *);
75void fuse_device_set_fmp(struct fusefs_mnt *, int);76void fuse_device_set_fmp(struct fusefs_mnt *, int);
7677
77/*
78 * The root inode is the root of the file system. Inode 0 can't be used for
79 * normal purposes.
80 */
81#define FUSE_ROOTINO ((ino_t)1)
82#define VFSTOFUSEFS(mp) ((struct fusefs_mnt *)((mp)->mnt_data))78#define VFSTOFUSEFS(mp) ((struct fusefs_mnt *)((mp)->mnt_data))
8379
80#ifdef FUSE_DEBUG
81#define DPRINTF(fmt, arg...) printf("%s: " fmt, "fusefs", ##arg)
82#else
83#define DPRINTF(fmt, arg...)
84#endif
85
84#endif /* _KERNEL */86#endif /* _KERNEL */
85#endif /* __FUSEFS_H__ */87#endif /* __FUSEFS_H__ */
\ No newline at end of file
lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h+6-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: fusefs_node.h,v 1.6 2026/01/22 11:53:31 helg Exp $ */1/* $OpenBSD: fusefs_node.h,v 1.9 2026/07/10 14:43:48 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 *
...@@ -37,8 +37,7 @@ struct fusefs_mnt;...@@ -37,8 +37,7 @@ struct fusefs_mnt;
37struct fusefs_node {37struct fusefs_node {
38 LIST_ENTRY(fusefs_node) i_hash; /* Hash chain */38 LIST_ENTRY(fusefs_node) i_hash; /* Hash chain */
39 struct vnode *i_vnode;/* Vnode associated with this inode. */39 struct vnode *i_vnode;/* Vnode associated with this inode. */
40 struct fusefs_mnt *i_ump;40 struct fusefs_mnt *i_fmp;
41 dev_t i_dev; /* Device associated with the inode. */
42 ino_t i_number; /* The identity of the inode. */41 ino_t i_number; /* The identity of the inode. */
43 ino_t i_parent_cache;/* Parent inode (only dirs). */42 ino_t i_parent_cache;/* Parent inode (only dirs). */
44 struct lockf_state *i_lockf; /* Byte-level lock state. */43 struct lockf_state *i_lockf; /* Byte-level lock state. */
...@@ -49,6 +48,9 @@ struct fusefs_node {...@@ -49,6 +48,9 @@ struct fusefs_node {
4948
50 /** meta **/49 /** meta **/
51 off_t filesize;50 off_t filesize;
51
52 /** lookup count needed by FUSE_FORGET **/
53 uint64_t nlookup;
52};54};
5355
54#ifdef ITOV56#ifdef ITOV
...@@ -62,7 +64,7 @@ struct fusefs_node {...@@ -62,7 +64,7 @@ struct fusefs_node {
62#define VTOI(vp) ((struct fusefs_node *)(vp)->v_data)64#define VTOI(vp) ((struct fusefs_node *)(vp)->v_data)
6365
64void fuse_ihashinit(void);66void fuse_ihashinit(void);
65struct vnode *fuse_ihashget(dev_t, ino_t);67struct vnode *fuse_ihashget(const struct fusefs_mnt *, ino_t);
66int fuse_ihashins(struct fusefs_node *);68int fuse_ihashins(struct fusefs_node *);
67void fuse_ihashrem(struct fusefs_node *);69void fuse_ihashrem(struct fusefs_node *);
6870
lib/libc/include/generic-openbsd/net/art.h+1-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: art.h,v 1.28 2025/07/10 05:28:13 dlg Exp $ */1/* $OpenBSD: art.h,v 1.29 2026/04/23 01:28:03 jsg Exp $ */
22
3/*3/*
4 * Copyright (c) 2015 Martin Pieuchot4 * Copyright (c) 2015 Martin Pieuchot
...@@ -161,9 +161,6 @@ void art_iter_close(struct art_iter *);...@@ -161,9 +161,6 @@ void art_iter_close(struct art_iter *);
161 (_an) != NULL; \161 (_an) != NULL; \
162 (_an) = art_iter_next((_ai)))162 (_an) = art_iter_next((_ai)))
163163
164int art_walk(struct art *,
165 int (*)(struct art_node *, void *), void *);
166
167#endif /* _KERNEL */164#endif /* _KERNEL */
168165
169#endif /* _NET_ART_H_ */166#endif /* _NET_ART_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/net/bpf.h+11-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bpf.h,v 1.75 2025/11/16 02:20:08 dlg Exp $ */1/* $OpenBSD: bpf.h,v 1.78 2026/09/10 18:31:39 claudio 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/*
...@@ -52,7 +52,10 @@ typedef u_int32_t bpf_u_int32;...@@ -52,7 +52,10 @@ typedef u_int32_t bpf_u_int32;
52#define BPF_ALIGNMENT sizeof(u_int32_t)52#define BPF_ALIGNMENT sizeof(u_int32_t)
53#define BPF_WORDALIGN(x) (((x) + (BPF_ALIGNMENT - 1)) & ~(BPF_ALIGNMENT - 1))53#define BPF_WORDALIGN(x) (((x) + (BPF_ALIGNMENT - 1)) & ~(BPF_ALIGNMENT - 1))
5454
55#ifdef _KERNEL
55#define BPF_MAXINSNS 51256#define BPF_MAXINSNS 512
57#endif
58
56#define BPF_MAXBUFSIZE (2 * 1024 * 1024)59#define BPF_MAXBUFSIZE (2 * 1024 * 1024)
57#define BPF_MINBUFSIZE 3260#define BPF_MINBUFSIZE 32
5861
...@@ -309,18 +312,20 @@ struct bpf_ops {...@@ -309,18 +312,20 @@ struct bpf_ops {
309#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k }312#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k }
310313
311__BEGIN_DECLS314__BEGIN_DECLS
315#ifndef _KERNEL
312u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int)316u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int)
313 __bounded((__buffer__, 2, 4));317 __bounded((__buffer__, 2, 4));
314318
315u_int _bpf_filter(const struct bpf_insn *, const struct bpf_ops *,319u_int _bpf_filter(const struct bpf_insn *, const struct bpf_ops *,
316 const void *, u_int);320 const void *, u_int);
321#endif /* _KERNEL */
317__END_DECLS322__END_DECLS
318323
319#ifdef _KERNEL324#ifdef _KERNEL
320struct ifnet;325struct ifnet;
321struct mbuf;326struct mbuf;
322327
323int bpf_validate(struct bpf_insn *, int);328int bpf_validate(struct bpf_insn *, u_int);
324int bpf_mtap(caddr_t, const struct mbuf *, u_int);329int bpf_mtap(caddr_t, const struct mbuf *, u_int);
325int bpf_mtap_hdr(caddr_t, const void *, u_int, const struct mbuf *, u_int);330int bpf_mtap_hdr(caddr_t, const void *, u_int, const struct mbuf *, u_int);
326int bpf_mtap_af(caddr_t, u_int32_t, const struct mbuf *, u_int);331int bpf_mtap_af(caddr_t, u_int32_t, const struct mbuf *, u_int);
...@@ -333,7 +338,10 @@ void *bpfxattach(caddr_t *, const char *, struct ifnet *, u_int, u_int);...@@ -333,7 +338,10 @@ void *bpfxattach(caddr_t *, const char *, struct ifnet *, u_int, u_int);
333void bpfsdetach(void *);338void bpfsdetach(void *);
334void bpfilterattach(int);339void bpfilterattach(int);
335340
336u_int bpf_mfilter(const struct bpf_insn *, const struct mbuf *, u_int);341u_int _bpf_lfilter(const struct bpf_insn *, u_int, const struct bpf_ops *,
342 const void *, u_int);
343
344u_int bpf_mfilter(const struct bpf_program *, const struct mbuf *, u_int);
337#endif /* _KERNEL */345#endif /* _KERNEL */
338346
339/*347/*
lib/libc/include/generic-openbsd/net/if.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if.h,v 1.223 2025/12/09 03:33:06 dlg Exp $ */1/* $OpenBSD: if.h,v 1.224 2026/06/23 14:40:40 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/*
...@@ -232,6 +232,7 @@ struct if_status_description {...@@ -232,6 +232,7 @@ struct if_status_description {
232#define IFXF_AUTOCONF4 0x80 /* [N] v4 autoconf (aka dhcp) enabled */232#define IFXF_AUTOCONF4 0x80 /* [N] v4 autoconf (aka dhcp) enabled */
233#define IFXF_MONITOR 0x100 /* [N] only used for bpf */233#define IFXF_MONITOR 0x100 /* [N] only used for bpf */
234#define IFXF_LRO 0x200 /* [N] TCP large recv offload */234#define IFXF_LRO 0x200 /* [N] TCP large recv offload */
235#define IFXF_MBUF_64BIT 0x400 /* [I] mbuf with 64 bit DMA supported */
235236
236#define IFXF_CANTCHANGE \237#define IFXF_CANTCHANGE \
237 (IFXF_MPSAFE|IFXF_CLONED)238 (IFXF_MPSAFE|IFXF_CLONED)
lib/libc/include/generic-openbsd/net/if_ppp.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_ppp.h,v 1.10 2022/01/02 22:36:03 jsg Exp $ */1/* $OpenBSD: if_ppp.h,v 1.11 2026/05/16 13:27:03 daniel Exp $ */
2/* $NetBSD: if_ppp.h,v 1.11 1996/03/15 02:28:05 paulus Exp $ */2/* $NetBSD: if_ppp.h,v 1.11 1996/03/15 02:28:05 paulus Exp $ */
33
4/*4/*
...@@ -146,7 +146,7 @@ struct ifpppcstatsreq {...@@ -146,7 +146,7 @@ struct ifpppcstatsreq {
146#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq)146#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq)
147147
148#ifdef _KERNEL148#ifdef _KERNEL
149void pppattach(void);149void pppattach(int);
150int pppoutput(struct ifnet *, struct mbuf *, struct sockaddr *,150int pppoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
151 struct rtentry *);151 struct rtentry *);
152void pppintr(void);152void pppintr(void);
lib/libc/include/generic-openbsd/net/if_sppp.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_sppp.h,v 1.32 2025/11/02 08:04:04 dlg Exp $ */1/* $OpenBSD: if_sppp.h,v 1.33 2026/05/16 13:27:03 daniel 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/*
...@@ -236,7 +236,7 @@ void sppp_input (struct ifnet *ifp, struct mbuf *m);...@@ -236,7 +236,7 @@ void sppp_input (struct ifnet *ifp, struct mbuf *m);
236int sppp_proto_up(struct ifnet *ifp, uint16_t);236int sppp_proto_up(struct ifnet *ifp, uint16_t);
237237
238/* Workaround */238/* Workaround */
239void spppattach (struct ifnet *ifp);239void spppattach (int);
240int sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data);240int sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data);
241241
242struct mbuf *sppp_dequeue (struct ifnet *ifp);242struct mbuf *sppp_dequeue (struct ifnet *ifp);
lib/libc/include/generic-openbsd/net/if_trunk.h+12-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_trunk.h,v 1.33 2025/11/24 23:40:00 dlg Exp $ */1/* $OpenBSD: if_trunk.h,v 1.34 2026/05/08 03:36:04 jsg 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>
...@@ -88,6 +88,17 @@ struct lacp_opreq {...@@ -88,6 +88,17 @@ struct lacp_opreq {
88 u_int8_t partner_state;88 u_int8_t partner_state;
89};89};
9090
91#define LACP_STATE_BITS \
92 "\020" \
93 "\001ACTIVITY" \
94 "\002TIMEOUT" \
95 "\003AGGREGATION" \
96 "\004SYNC" \
97 "\005COLLECTING" \
98 "\006DISTRIBUTING" \
99 "\007DEFAULTED" \
100 "\010EXPIRED"
101
91/* Trunk port settings */102/* Trunk port settings */
92struct trunk_reqport {103struct trunk_reqport {
93 char rp_ifname[IFNAMSIZ]; /* name of the trunk */104 char rp_ifname[IFNAMSIZ]; /* name of the trunk */
lib/libc/include/generic-openbsd/net/if_var.h+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: if_var.h,v 1.148 2026/03/22 23:14:00 bluhm Exp $ */1/* $OpenBSD: if_var.h,v 1.149 2026/06/23 18:50:43 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/*
...@@ -166,8 +166,8 @@ struct ifnet { /* and the entries */...@@ -166,8 +166,8 @@ struct ifnet { /* and the entries */
166 int if_pcount; /* [N] # of promiscuous listeners */166 int if_pcount; /* [N] # of promiscuous listeners */
167 unsigned int if_bridgeidx; /* [K] used by bridge ports */167 unsigned int if_bridgeidx; /* [K] used by bridge ports */
168 caddr_t if_bpf; /* packet filter structure */168 caddr_t if_bpf; /* packet filter structure */
169 caddr_t if_mcast; /* used by multicast code */169 struct vif *if_mcast; /* used by multicast code */
170 caddr_t if_mcast6; /* used by IPv6 multicast code */170 struct mif6 *if_mcast6; /* used by IPv6 multicast code */
171 caddr_t if_pf_kif; /* pf interface abstraction */171 caddr_t if_pf_kif; /* pf interface abstraction */
172 union {172 union {
173 /* carp if list (used by IFT_ETHER) */173 /* carp if list (used by IFT_ETHER) */
lib/libc/include/generic-openbsd/net/pfvar_priv.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pfvar_priv.h,v 1.42 2026/02/05 03:26:00 dlg Exp $ */1/* $OpenBSD: pfvar_priv.h,v 1.43 2026/09/10 12:28:04 deraadt Exp $ */
22
3/*3/*
4 * Copyright (c) 2001 Daniel Hartmeier4 * Copyright (c) 2001 Daniel Hartmeier
...@@ -682,7 +682,7 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t,...@@ -682,7 +682,7 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t,
682682
683void pf_status_init(void);683void pf_status_init(void);
684void pf_status_clear(void);684void pf_status_clear(void);
685void pf_status_read(struct pf_status *);685int pf_status_read(struct pf_status *);
686686
687#endif /* _KERNEL */687#endif /* _KERNEL */
688688
lib/libc/include/generic-openbsd/net/pipex_local.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pipex_local.h,v 1.54 2025/03/02 21:28:32 bluhm Exp $ */1/* $OpenBSD: pipex_local.h,v 1.55 2026/04/24 13:25:44 jsg Exp $ */
22
3/*3/*
4 * Copyright (c) 2009 Internet Initiative Japan Inc.4 * Copyright (c) 2009 Internet Initiative Japan Inc.
...@@ -468,7 +468,7 @@ int pipex_ccp_output (struct pipex_session *, int, int);...@@ -468,7 +468,7 @@ int pipex_ccp_output (struct pipex_session *, int, int);
468468
469struct mbuf *adjust_tcp_mss (struct mbuf *, int);469struct mbuf *adjust_tcp_mss (struct mbuf *, int);
470struct mbuf *ip_is_idle_packet (struct mbuf *, int *);470struct mbuf *ip_is_idle_packet (struct mbuf *, int *);
471void pipex_session_log (struct pipex_session *, int, const char *, ...) __attribute__((__format__(__printf__,3,4)));471void pipex_session_log (struct pipex_session *, int, const char *, ...) __attribute__((__format__(__kprintf__,3,4)));
472uint32_t pipex_sockaddr_hash_key(struct sockaddr *);472uint32_t pipex_sockaddr_hash_key(struct sockaddr *);
473int pipex_sockaddr_compar_addr(struct sockaddr *, struct sockaddr *);473int pipex_sockaddr_compar_addr(struct sockaddr *, struct sockaddr *);
474void pipex_timer_start (void);474void pipex_timer_start (void);
lib/libc/include/generic-openbsd/net/trunklacp.h deleted-316
...@@ -1,316 +0,0 @@
1/* $OpenBSD: trunklacp.h,v 1.14 2018/08/12 23:50:31 ccardenas Exp $ */
2/* $NetBSD: ieee8023ad_impl.h,v 1.2 2005/12/10 23:21:39 elad Exp $ */
3
4/*
5 * Copyright (c)2005 YAMAMOTO Takashi,
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.11 2008/03/17 01:26:44 thompsa Exp $
30 */
31
32#ifndef _NET_TRUNKLACP_H_
33#define _NET_TRUNKLACP_H_
34
35/*
36 * IEEE802.3 slow protocols (on-wire) definitions.
37 * XXX should be elsewhere.
38 */
39#define SLOWPROTOCOLS_SUBTYPE_LACP 1
40#define SLOWPROTOCOLS_SUBTYPE_MARKER 2
41
42/*
43 * default administrative values
44 */
45#define LACP_DEFAULT_MODE 1 /* Active Mode */
46#define LACP_DEFAULT_TIMEOUT 0 /* Slow Timeout */
47#define LACP_DEFAULT_SYSTEM_PRIO 0x8000 /* Medium Priority */
48#define LACP_LOW_SYSTEM_PRIO 0xffff
49#define LACP_HIGH_SYSTEM_PRIO 0x0001
50#define LACP_DEFAULT_PORT_PRIO 0x8000 /* Medium Priority */
51#define LACP_LOW_PORT_PRIO 0xffff
52#define LACP_HIGH_PORT_PRIO 0x0001
53#define LACP_DEFAULT_IFQ_PRIO 6
54
55struct slowprothdr {
56 u_int8_t sph_subtype;
57 u_int8_t sph_version;
58} __packed;
59
60/* TLV on-wire structure. */
61struct tlvhdr {
62 u_int8_t tlv_type;
63 u_int8_t tlv_length;
64 /* u_int8_t tlv_value[]; */
65} __packed;
66
67/* ... and our implementation. */
68#define TLV_SET(tlv, type, length) \
69 do { \
70 (tlv)->tlv_type = (type); \
71 (tlv)->tlv_length = sizeof(*tlv) + (length); \
72 } while (/*CONSTCOND*/0)
73
74struct tlv_template {
75 u_int8_t tmpl_type;
76 u_int8_t tmpl_length;
77};
78
79struct lacp_systemid {
80 u_int16_t lsi_prio;
81 u_int8_t lsi_mac[6];
82} __packed;
83
84struct lacp_portid {
85 u_int16_t lpi_prio;
86 u_int16_t lpi_portno;
87} __packed;
88
89struct lacp_peerinfo {
90 struct lacp_systemid lip_systemid;
91 u_int16_t lip_key;
92 struct lacp_portid lip_portid;
93 u_int8_t lip_state;
94 u_int8_t lip_resv[3];
95} __packed;
96
97struct lacp_collectorinfo {
98 u_int16_t lci_maxdelay;
99 u_int8_t lci_resv[12];
100} __packed;
101
102struct lacpdu {
103 struct ether_header ldu_eh;
104 struct slowprothdr ldu_sph;
105
106 struct tlvhdr ldu_tlv_actor;
107 struct lacp_peerinfo ldu_actor;
108 struct tlvhdr ldu_tlv_partner;
109 struct lacp_peerinfo ldu_partner;
110 struct tlvhdr ldu_tlv_collector;
111 struct lacp_collectorinfo ldu_collector;
112 struct tlvhdr ldu_tlv_term;
113 u_int8_t ldu_resv[50];
114} __packed;
115
116/*
117 * IEEE802.3ad marker protocol (on-wire) definitions.
118 */
119struct lacp_markerinfo {
120 u_int16_t mi_rq_port;
121 u_int8_t mi_rq_system[ETHER_ADDR_LEN];
122 u_int32_t mi_rq_xid;
123 u_int8_t mi_pad[2];
124} __packed;
125
126#define LACP_STATE_BITS \
127 "\020" \
128 "\001ACTIVITY" \
129 "\002TIMEOUT" \
130 "\003AGGREGATION" \
131 "\004SYNC" \
132 "\005COLLECTING" \
133 "\006DISTRIBUTING" \
134 "\007DEFAULTED" \
135 "\010EXPIRED"
136
137#ifdef _KERNEL
138
139/*
140 * IEEE802.3ad LACP implementation details.
141 */
142#define LACP_TIMER_CURRENT_WHILE 0
143#define LACP_TIMER_PERIODIC 1
144#define LACP_TIMER_WAIT_WHILE 2
145#define LACP_NTIMER 3
146
147#define LACP_TIMER_ARM(port, timer, val) \
148 (port)->lp_timer[(timer)] = (val)
149#define LACP_TIMER_DISARM(port, timer) \
150 (port)->lp_timer[(timer)] = 0
151#define LACP_TIMER_ISARMED(port, timer) \
152 ((port)->lp_timer[(timer)] > 0)
153
154/*
155 * IEEE802.3ad LACP protocol definitions.
156 */
157#define LACP_STATE_ACTIVITY (1<<0)
158#define LACP_STATE_TIMEOUT (1<<1)
159#define LACP_STATE_AGGREGATION (1<<2)
160#define LACP_STATE_SYNC (1<<3)
161#define LACP_STATE_COLLECTING (1<<4)
162#define LACP_STATE_DISTRIBUTING (1<<5)
163#define LACP_STATE_DEFAULTED (1<<6)
164#define LACP_STATE_EXPIRED (1<<7)
165
166#define LACP_PORT_NTT 0x00000001
167#define LACP_PORT_MARK 0x00000002
168
169struct markerdu {
170 struct ether_header mdu_eh;
171 struct slowprothdr mdu_sph;
172
173 struct tlvhdr mdu_tlv;
174 struct lacp_markerinfo mdu_info;
175 struct tlvhdr mdu_tlv_term;
176 u_int8_t mdu_resv[90];
177} __packed;
178
179#define MARKER_TYPE_INFO 0x01
180#define MARKER_TYPE_RESPONSE 0x02
181
182enum lacp_selected {
183 LACP_UNSELECTED,
184 LACP_STANDBY, /* not used in this implementation */
185 LACP_SELECTED,
186};
187
188enum lacp_mux_state {
189 LACP_MUX_DETACHED,
190 LACP_MUX_WAITING,
191 LACP_MUX_ATTACHED,
192 LACP_MUX_COLLECTING,
193 LACP_MUX_DISTRIBUTING,
194};
195
196#define LACP_MAX_PORTS 32
197
198struct lacp_portmap {
199 int pm_count;
200 struct lacp_port *pm_map[LACP_MAX_PORTS];
201};
202
203struct lacp_port {
204 TAILQ_ENTRY(lacp_port) lp_dist_q;
205 LIST_ENTRY(lacp_port) lp_next;
206 struct lacp_softc *lp_lsc;
207 struct trunk_port *lp_trunk;
208 struct ifnet *lp_ifp;
209 struct lacp_peerinfo lp_partner;
210 struct lacp_peerinfo lp_actor;
211 struct lacp_markerinfo lp_marker;
212#define lp_state lp_actor.lip_state
213#define lp_key lp_actor.lip_key
214#define lp_systemid lp_actor.lip_systemid
215 struct timeval lp_last_lacpdu;
216 int lp_lacpdu_sent;
217 enum lacp_mux_state lp_mux_state;
218 enum lacp_selected lp_selected;
219 int lp_flags;
220 u_int lp_media; /* XXX redundant */
221 int lp_timer[LACP_NTIMER];
222 struct mbuf_queue lp_mq;
223
224 struct lacp_aggregator *lp_aggregator;
225};
226
227struct lacp_aggregator {
228 TAILQ_ENTRY(lacp_aggregator) la_q;
229 int la_refcnt; /* num of ports which selected us */
230 int la_nports; /* num of distributing ports */
231 TAILQ_HEAD(, lacp_port) la_ports; /* distributing ports */
232 struct lacp_peerinfo la_partner;
233 struct lacp_peerinfo la_actor;
234 int la_pending; /* number of ports in wait_while */
235};
236
237struct lacp_admin_def {
238 u_int8_t lad_mode; /* active or passive */
239 u_int8_t lad_timeout; /* fast or slow */
240 u_int16_t lad_prio; /* system priority */
241 u_int16_t lad_portprio; /* port priority */
242 u_int8_t lad_ifqprio; /* ifq priority */
243};
244
245struct lacp_softc {
246 struct trunk_softc *lsc_softc;
247 struct lacp_aggregator *lsc_active_aggregator;
248 TAILQ_HEAD(, lacp_aggregator) lsc_aggregators;
249 int lsc_suppress_distributing;
250 struct timeout lsc_transit_callout;
251 struct timeout lsc_callout;
252 LIST_HEAD(, lacp_port) lsc_ports;
253 struct lacp_portmap lsc_pmap[2];
254 volatile u_int lsc_activemap;
255 SIPHASH_KEY lsc_hashkey;
256 struct task lsc_input;
257 struct lacp_admin_def lsc_admin_defaults;
258#define lsc_mode lsc_admin_defaults.lad_mode
259#define lsc_timeout lsc_admin_defaults.lad_timeout
260#define lsc_sys_prio lsc_admin_defaults.lad_prio
261#define lsc_port_prio lsc_admin_defaults.lad_portprio
262#define lsc_ifq_prio lsc_admin_defaults.lad_ifqprio
263};
264
265#define LACP_TYPE_ACTORINFO 1
266#define LACP_TYPE_PARTNERINFO 2
267#define LACP_TYPE_COLLECTORINFO 3
268
269/* timeout values (in sec) */
270#define LACP_FAST_PERIODIC_TIME (1)
271#define LACP_SLOW_PERIODIC_TIME (30)
272#define LACP_SHORT_TIMEOUT_TIME (3 * LACP_FAST_PERIODIC_TIME)
273#define LACP_LONG_TIMEOUT_TIME (3 * LACP_SLOW_PERIODIC_TIME)
274#define LACP_CHURN_DETECTION_TIME (60)
275#define LACP_AGGREGATE_WAIT_TIME (2)
276#define LACP_TRANSIT_DELAY 3000 /* in msec */
277
278#define LACP_STATE_EQ(s1, s2, mask) \
279 ((((s1) ^ (s2)) & (mask)) == 0)
280
281#define LACP_SYS_PRI(peer) (peer).lip_systemid.lsi_prio
282
283#define LACP_PORT(_lp) ((struct lacp_port *)(_lp)->tp_psc)
284#define LACP_SOFTC(_sc) ((struct lacp_softc *)(_sc)->tr_psc)
285
286int lacp_input(struct trunk_port *, struct mbuf *);
287struct trunk_port *lacp_select_tx_port(struct trunk_softc *, struct mbuf *);
288int lacp_attach(struct trunk_softc *);
289int lacp_detach(struct trunk_softc *);
290void lacp_init(struct trunk_softc *);
291void lacp_stop(struct trunk_softc *);
292int lacp_port_create(struct trunk_port *);
293void lacp_port_destroy(struct trunk_port *);
294void lacp_linkstate(struct trunk_port *);
295void lacp_req(struct trunk_softc *, caddr_t);
296void lacp_portreq(struct trunk_port *, caddr_t);
297u_int lacp_port_status(struct trunk_port *);
298
299/* following constants don't include terminating NUL */
300#define LACP_MACSTR_MAX (2*6 + 5)
301#define LACP_SYSTEMPRIOSTR_MAX (4)
302#define LACP_SYSTEMIDSTR_MAX (LACP_SYSTEMPRIOSTR_MAX + 1 + LACP_MACSTR_MAX)
303#define LACP_PORTPRIOSTR_MAX (4)
304#define LACP_PORTNOSTR_MAX (4)
305#define LACP_PORTIDSTR_MAX (LACP_PORTPRIOSTR_MAX + 1 + LACP_PORTNOSTR_MAX)
306#define LACP_KEYSTR_MAX (4)
307#define LACP_PARTNERSTR_MAX \
308 (1 + LACP_SYSTEMIDSTR_MAX + 1 + LACP_KEYSTR_MAX + 1 \
309 + LACP_PORTIDSTR_MAX + 1)
310#define LACP_LAGIDSTR_MAX \
311 (1 + LACP_PARTNERSTR_MAX + 1 + LACP_PARTNERSTR_MAX + 1)
312#define LACP_STATESTR_MAX (255) /* XXX */
313
314#endif /* _KERNEL */
315
316#endif /* _NET_TRUNKLACP_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/net80211/ieee80211.h+16-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211.h,v 1.66 2026/03/29 21:16:21 kirill Exp $ */1/* $OpenBSD: ieee80211.h,v 1.67 2026/05/28 10:50:47 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/*-
...@@ -193,6 +193,21 @@ struct ieee80211_htframe_addr4 { /* 11n */...@@ -193,6 +193,21 @@ struct ieee80211_htframe_addr4 { /* 11n */
193#define IEEE80211_QOS_EOSP 0x0010193#define IEEE80211_QOS_EOSP 0x0010
194#define IEEE80211_QOS_TID 0x000f194#define IEEE80211_QOS_TID 0x000f
195195
196#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD 0x80
197
198#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO 0x01
199#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI 0x02
200#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK 0x04
201#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE 0x08
202#define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f
203
204#define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00
205#define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01
206#define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02
207#define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03
208#define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03
209#define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5
210
196/*211/*
197 * Control frames.212 * Control frames.
198 */213 */
lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h+6-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_ioctl.h,v 1.45 2026/03/26 12:15:01 kirill Exp $ */1/* $OpenBSD: ieee80211_ioctl.h,v 1.46 2026/05/28 10:50:47 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/*-
...@@ -410,7 +410,9 @@ struct ieee80211_nodereq_all {...@@ -410,7 +410,9 @@ struct ieee80211_nodereq_all {
410#define IEEE80211_F_HOSTAPMASK 0x00000003410#define IEEE80211_F_HOSTAPMASK 0x00000003
411#define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */411#define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */
412#define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */412#define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */
413#define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO"413#define IEEE80211_F_UAPSD 0x00000010 /* CONF: enable u-APSD */
414#define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO" \
415 "\05UAPSD"
414416
415struct ieee80211_flags {417struct ieee80211_flags {
416 const char *f_name;418 const char *f_name;
...@@ -421,7 +423,8 @@ struct ieee80211_flags {...@@ -421,7 +423,8 @@ struct ieee80211_flags {
421 { "hidenwid", IEEE80211_F_HIDENWID }, \423 { "hidenwid", IEEE80211_F_HIDENWID }, \
422 { "nobridge", IEEE80211_F_NOBRIDGE }, \424 { "nobridge", IEEE80211_F_NOBRIDGE }, \
423 { "stayauth", IEEE80211_F_STAYAUTH }, \425 { "stayauth", IEEE80211_F_STAYAUTH }, \
424 { "nomimo", IEEE80211_F_NOMIMO } \426 { "nomimo", IEEE80211_F_NOMIMO }, \
427 { "uapsd", IEEE80211_F_UAPSD } \
425}428}
426429
427#define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq)430#define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq)
lib/libc/include/generic-openbsd/net80211/ieee80211_node.h+6-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_node.h,v 1.101 2026/03/29 21:16:21 kirill Exp $ */1/* $OpenBSD: ieee80211_node.h,v 1.103 2026/09/19 19:36:43 stsp 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/*-
...@@ -306,6 +306,8 @@ struct ieee80211_node {...@@ -306,6 +306,8 @@ struct ieee80211_node {
306 /* power saving mode */306 /* power saving mode */
307 u_int8_t ni_pwrsave;307 u_int8_t ni_pwrsave;
308 struct mbuf_queue ni_savedq; /* packets queued for pspoll */308 struct mbuf_queue ni_savedq; /* packets queued for pspoll */
309 u_int8_t ni_uapsd_ac;
310 u_int8_t ni_uapsd_maxsp;
309311
310 /* RSN */312 /* RSN */
311 struct timeout ni_eapol_to;313 struct timeout ni_eapol_to;
...@@ -446,6 +448,7 @@ struct ieee80211_node {...@@ -446,6 +448,7 @@ struct ieee80211_node {
446#define IEEE80211_NODE_HE 0x200000 /* HE negotiated */448#define IEEE80211_NODE_HE 0x200000 /* HE negotiated */
447#define IEEE80211_NODE_HECAP 0x400000 /* claims to support HE */449#define IEEE80211_NODE_HECAP 0x400000 /* claims to support HE */
448#define IEEE80211_NODE_CSA 0x800000 /* channel switch announced */450#define IEEE80211_NODE_CSA 0x800000 /* channel switch announced */
451#define IEEE80211_NODE_UAPSD 0x1000000 /* uAPSD negotiated */
449452
450 /* If not NULL, this function gets called when ni_refcnt hits zero. */453 /* If not NULL, this function gets called when ni_refcnt hits zero. */
451 void (*ni_unref_cb)(struct ieee80211com *,454 void (*ni_unref_cb)(struct ieee80211com *,
...@@ -675,6 +678,8 @@ void ieee80211_clean_nodes(struct ieee80211com *, int);...@@ -675,6 +678,8 @@ void ieee80211_clean_nodes(struct ieee80211com *, int);
675void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,678void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,
676 uint8_t);679 uint8_t);
677void ieee80211_clear_htcaps(struct ieee80211_node *);680void ieee80211_clear_htcaps(struct ieee80211_node *);
681uint8_t ieee80211_node_ht_secondary_channel_offset(struct ieee80211_node *);
682uint8_t ieee80211_node_vht_channel_width(struct ieee80211_node *);
678int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,683int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
679 uint8_t, int);684 uint8_t, int);
680void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *,685void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *,
lib/libc/include/generic-openbsd/net80211/ieee80211_var.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ieee80211_var.h,v 1.114 2026/03/19 16:50:32 chris Exp $ */1/* $OpenBSD: ieee80211_var.h,v 1.115 2026/05/28 10:50:47 kirill 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/*-
...@@ -344,6 +344,8 @@ struct ieee80211com {...@@ -344,6 +344,8 @@ struct ieee80211com {
344 u_int ic_edca_txop_count[EDCA_NUM_AC];344 u_int ic_edca_txop_count[EDCA_NUM_AC];
345 struct timeval ic_edca_txop_time[EDCA_NUM_AC];345 struct timeval ic_edca_txop_time[EDCA_NUM_AC];
346 u_int16_t ic_tid_noack;346 u_int16_t ic_tid_noack;
347 u_int8_t ic_uapsd_ac;
348 u_int8_t ic_uapsd_maxsp;
347 u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN];349 u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN];
348 u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN];350 u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN];
349 u_int8_t ic_psk[IEEE80211_PMK_LEN];351 u_int8_t ic_psk[IEEE80211_PMK_LEN];
lib/libc/include/generic-openbsd/netinet/in_var.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: in_var.h,v 1.47 2026/03/22 23:14:00 bluhm Exp $ */1/* $OpenBSD: in_var.h,v 1.48 2026/07/30 14:57:46 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/*
...@@ -82,8 +82,6 @@ struct in_aliasreq {...@@ -82,8 +82,6 @@ struct in_aliasreq {
82};82};
8383
84#ifdef _KERNEL84#ifdef _KERNEL
85struct router_info;
86
87/*85/*
88 * Internet multicast address structure. There is one of these for each IP86 * Internet multicast address structure. There is one of these for each IP
89 * multicast group to which this host belongs on a given network interface.87 * multicast group to which this host belongs on a given network interface.
...@@ -98,8 +96,6 @@ struct in_multi {...@@ -98,8 +96,6 @@ struct in_multi {
9896
99 u_int inm_state; /* [m] state of membership */97 u_int inm_state; /* [m] state of membership */
100 u_int inm_timer; /* [m] IGMP membership report */98 u_int inm_timer; /* [m] IGMP membership report */
101
102 struct router_info *inm_rti; /* router version info */
103};99};
104100
105static __inline struct in_multi *101static __inline struct in_multi *
lib/libc/include/generic-openbsd/netinet/ip_ipsp.h+6-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip_ipsp.h,v 1.249 2025/05/09 19:53:41 mvs Exp $ */1/* $OpenBSD: ip_ipsp.h,v 1.251 2026/08/12 18:23:14 bluhm Exp $ */
2/*2/*
3 * The authors of this code are John Ioannidis (ji@tla.org),3 * The authors of this code are John Ioannidis (ji@tla.org),
4 * Angelos D. Keromytis (kermit@csd.uch.gr),4 * Angelos D. Keromytis (kermit@csd.uch.gr),
...@@ -248,7 +248,7 @@ struct ipsec_ids {...@@ -248,7 +248,7 @@ struct ipsec_ids {
248 RBT_ENTRY(ipsec_ids) id_node_flow; /* [F] */248 RBT_ENTRY(ipsec_ids) id_node_flow; /* [F] */
249 struct ipsec_id *id_local; /* [I] */249 struct ipsec_id *id_local; /* [I] */
250 struct ipsec_id *id_remote; /* [I] */250 struct ipsec_id *id_remote; /* [I] */
251 u_int32_t id_flow; /* [I] */251 uint32_t id_flow; /* [I] */
252 u_int id_refcount; /* [F] */252 u_int id_refcount; /* [F] */
253 u_int id_gc_ttl; /* [F] */253 u_int id_gc_ttl; /* [F] */
254};254};
...@@ -425,8 +425,9 @@ struct tdb { /* tunnel descriptor block */...@@ -425,8 +425,9 @@ struct tdb { /* tunnel descriptor block */
425#define TDB_REPLAYWASTE 32425#define TDB_REPLAYWASTE 32
426#define TDB_REPLAYMAX (2100+TDB_REPLAYWASTE)426#define TDB_REPLAYMAX (2100+TDB_REPLAYWASTE)
427427
428 u_int64_t tdb_rpl; /* Replay counter */428 u_int64_t tdb_rpl; /* [m] Replay counter */
429 u_int32_t tdb_seen[howmany(TDB_REPLAYMAX, 32)]; /* Anti-replay window */429 u_int32_t tdb_seen[howmany(TDB_REPLAYMAX, 32)];
430 /* [m] Anti-replay window */
430431
431 u_int8_t tdb_iv[4]; /* Used for HALF-IV ESP */432 u_int8_t tdb_iv[4]; /* Used for HALF-IV ESP */
432433
...@@ -711,7 +712,7 @@ int ipsp_aux_match(struct tdb *, struct ipsec_ids *,...@@ -711,7 +712,7 @@ int ipsp_aux_match(struct tdb *, struct ipsec_ids *,
711 struct sockaddr_encap *, struct sockaddr_encap *);712 struct sockaddr_encap *, struct sockaddr_encap *);
712int ipsp_ids_match(struct ipsec_ids *, struct ipsec_ids *);713int ipsp_ids_match(struct ipsec_ids *, struct ipsec_ids *);
713struct ipsec_ids *ipsp_ids_insert(struct ipsec_ids *);714struct ipsec_ids *ipsp_ids_insert(struct ipsec_ids *);
714struct ipsec_ids *ipsp_ids_lookup(u_int32_t);715struct ipsec_ids *ipsp_ids_lookup(uint32_t);
715void ipsp_ids_free(struct ipsec_ids *);716void ipsp_ids_free(struct ipsec_ids *);
716717
717void ipsp_init(void);718void ipsp_init(void);
lib/libc/include/generic-openbsd/netinet/ip_mroute.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip_mroute.h,v 1.34 2025/05/09 14:43:47 jan Exp $ */1/* $OpenBSD: ip_mroute.h,v 1.35 2026/06/24 12:33:49 bluhm Exp $ */
2/* $NetBSD: ip_mroute.h,v 1.23 2004/04/21 17:49:46 itojun Exp $ */2/* $NetBSD: ip_mroute.h,v 1.23 2004/04/21 17:49:46 itojun Exp $ */
33
4#ifndef _NETINET_IP_MROUTE_H_4#ifndef _NETINET_IP_MROUTE_H_
...@@ -165,6 +165,8 @@ struct mrtstat {...@@ -165,6 +165,8 @@ struct mrtstat {
165 u_long mrts_q_overflow; /* pkts dropped - Q overflow */165 u_long mrts_q_overflow; /* pkts dropped - Q overflow */
166 u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */166 u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
167 u_long mrts_upq_sockfull; /* upcalls dropped - socket full */167 u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
168 u_long mrts_time_to_live; /* ip ttl not above 1 */
169 u_long mrts_source_route; /* packet from source-routed tunnel */
168};170};
169171
170#ifdef _KERNEL172#ifdef _KERNEL
...@@ -183,6 +185,8 @@ enum mrtstat_counters {...@@ -183,6 +185,8 @@ enum mrtstat_counters {
183 mrts_q_overflow,185 mrts_q_overflow,
184 mrts_pkt2large,186 mrts_pkt2large,
185 mrts_upq_sockfull,187 mrts_upq_sockfull,
188 mrts_time_to_live,
189 mrts_source_route,
186 mrts_ncounters190 mrts_ncounters
187};191};
188192
lib/libc/include/generic-openbsd/netinet/ip_var.h+6-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip_var.h,v 1.123 2025/07/31 09:05:11 mvs Exp $ */1/* $OpenBSD: ip_var.h,v 1.127 2026/08/11 14:28:59 bluhm Exp $ */
2/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */2/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
33
4/*4/*
...@@ -191,9 +191,10 @@ struct ipqent {...@@ -191,9 +191,10 @@ struct ipqent {
191 */191 */
192struct ipq {192struct ipq {
193 LIST_ENTRY(ipq) ipq_q; /* to other reass headers */193 LIST_ENTRY(ipq) ipq_q; /* to other reass headers */
194 u_int ipq_rdomain; /* routing domain for reassembly */
195 u_int16_t ipq_id; /* sequence id for reassembly */
194 u_int8_t ipq_ttl; /* time for reass q to live */196 u_int8_t ipq_ttl; /* time for reass q to live */
195 u_int8_t ipq_p; /* protocol of this fragment */197 u_int8_t ipq_p; /* protocol of this fragment */
196 u_int16_t ipq_id; /* sequence id for reassembly */
197 struct ipqehead ipq_fragq; /* to ip fragment queue */198 struct ipqehead ipq_fragq; /* to ip fragment queue */
198 struct in_addr ipq_src, ipq_dst;199 struct in_addr ipq_src, ipq_dst;
199};200};
...@@ -247,10 +248,12 @@ int ip_getmoptions(int, struct ip_moptions *, struct mbuf *);...@@ -247,10 +248,12 @@ int ip_getmoptions(int, struct ip_moptions *, struct mbuf *);
247void ip_init(void);248void ip_init(void);
248struct mbuf*249struct mbuf*
249 ip_insertoptions(struct mbuf *, struct mbuf *, int *);250 ip_insertoptions(struct mbuf *, struct mbuf *, int *);
251int ip_mrouter_active(u_int);
250int ip_mforward(struct mbuf *, struct ifnet *, int);252int ip_mforward(struct mbuf *, struct ifnet *, int);
251int ip_optcopy(struct ip *, struct ip *);253int ip_optcopy(struct ip *, struct ip *);
252int ip_output(struct mbuf *, struct mbuf *, struct route *, int,254int ip_output(struct mbuf *, struct mbuf *, struct route *, int,
253 struct ip_moptions *, const struct ipsec_level *, u_int32_t);255 struct ip_moptions *, const struct ipsec_level *, uint32_t);
256void ip_randomid_init(void);
254u_int16_t257u_int16_t
255 ip_randomid(void);258 ip_randomid(void);
256void ip_send(struct mbuf *);259void ip_send(struct mbuf *);
...@@ -281,9 +284,6 @@ int rip_disconnect(struct socket *);...@@ -281,9 +284,6 @@ int rip_disconnect(struct socket *);
281int rip_shutdown(struct socket *);284int rip_shutdown(struct socket *);
282int rip_send(struct socket *, struct mbuf *, struct mbuf *,285int rip_send(struct socket *, struct mbuf *, struct mbuf *,
283 struct mbuf *);286 struct mbuf *);
284#ifdef MROUTING
285extern struct socket *ip_mrouter[]; /* multicast routing daemon */
286#endif
287287
288#endif /* _KERNEL */288#endif /* _KERNEL */
289#endif /* _NETINET_IP_VAR_H_ */289#endif /* _NETINET_IP_VAR_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/netinet6/ip6_mroute.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip6_mroute.h,v 1.25 2025/05/19 04:54:04 jan Exp $ */1/* $OpenBSD: ip6_mroute.h,v 1.27 2026/09/17 15:56:59 bluhm Exp $ */
2/* $KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $ */2/* $KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $ */
33
4/*4/*
...@@ -146,6 +146,7 @@ struct mrt6stat {...@@ -146,6 +146,7 @@ struct mrt6stat {
146 u_int64_t mrt6s_q_overflow; /* pkts dropped - Q overflow */146 u_int64_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
147 u_int64_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */147 u_int64_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
148 u_int64_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */148 u_int64_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
149 u_int64_t mrt6s_hop_limit; /* ip6 hlim not above one */
149};150};
150151
151/*152/*
...@@ -206,6 +207,7 @@ enum mrt6stat_counters {...@@ -206,6 +207,7 @@ enum mrt6stat_counters {
206 mrt6s_q_overflow,207 mrt6s_q_overflow,
207 mrt6s_pkt2large,208 mrt6s_pkt2large,
208 mrt6s_upq_sockfull,209 mrt6s_upq_sockfull,
210 mrt6s_hop_limit,
209 mrt6s_ncounters211 mrt6s_ncounters
210};212};
211213
...@@ -220,6 +222,8 @@ mrt6stat_inc(enum mrt6stat_counters c)...@@ -220,6 +222,8 @@ mrt6stat_inc(enum mrt6stat_counters c)
220/* How frequent should we look for expired entries (in seconds). */222/* How frequent should we look for expired entries (in seconds). */
221#define MCAST_EXPIRE_TIMEOUT 30223#define MCAST_EXPIRE_TIMEOUT 30
222224
225extern int ip6_mrtproto;
226
223/*227/*
224 * The kernel's multicast-interface structure.228 * The kernel's multicast-interface structure.
225 */229 */
lib/libc/include/generic-openbsd/netinet6/ip6_var.h+5-14
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ip6_var.h,v 1.129 2025/12/31 04:10:00 jsg Exp $ */1/* $OpenBSD: ip6_var.h,v 1.132 2026/09/17 15:56:59 bluhm 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/*
...@@ -138,6 +138,7 @@ struct ip6q {...@@ -138,6 +138,7 @@ struct ip6q {
138 struct in6_addr ip6q_src, ip6q_dst;138 struct in6_addr ip6q_src, ip6q_dst;
139 int ip6q_unfrglen; /* len of unfragmentable part */139 int ip6q_unfrglen; /* len of unfragmentable part */
140 int ip6q_nfrag; /* # of fragments */140 int ip6q_nfrag; /* # of fragments */
141 u_int ip6q_rdomain; /* routing domain for reassembly */
141 u_int32_t ip6q_ident; /* fragment identification */142 u_int32_t ip6q_ident; /* fragment identification */
142 u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */143 u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */
143 u_int8_t ip6q_ecn;144 u_int8_t ip6q_ecn;
...@@ -164,15 +165,7 @@ struct ip6_moptions {...@@ -164,15 +165,7 @@ struct ip6_moptions {
164 * Control options for outgoing packets165 * Control options for outgoing packets
165 */166 */
166167
167/* Routing header related info */168struct ip6_pktopts {
168struct ip6po_rhinfo {
169 struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
170 struct route ip6po_rhi_route; /* Route to the 1st hop */
171};
172#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
173#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
174
175struct ip6_pktopts {
176 /* Hoplimit for outgoing packets */169 /* Hoplimit for outgoing packets */
177 int ip6po_hlim;170 int ip6po_hlim;
178171
...@@ -185,9 +178,6 @@ struct ip6_pktopts {...@@ -185,9 +178,6 @@ struct ip6_pktopts {
185 /* Destination options header (before a routing header) */178 /* Destination options header (before a routing header) */
186 struct ip6_dest *ip6po_dest1;179 struct ip6_dest *ip6po_dest1;
187180
188 /* Routing header related info. */
189 struct ip6po_rhinfo ip6po_rhinfo;
190
191 /* Destination options header (after a routing header) */181 /* Destination options header (after a routing header) */
192 struct ip6_dest *ip6po_dest2;182 struct ip6_dest *ip6po_dest2;
193183
...@@ -310,6 +300,7 @@ int ip6_unknown_opt(struct mbuf **, u_int8_t *, int);...@@ -310,6 +300,7 @@ int ip6_unknown_opt(struct mbuf **, u_int8_t *, int);
310int ip6_get_prevhdr(struct mbuf *, int);300int ip6_get_prevhdr(struct mbuf *, int);
311int ip6_nexthdr(struct mbuf *, int, int, int *);301int ip6_nexthdr(struct mbuf *, int, int, int *);
312int ip6_lasthdr(struct mbuf *, int, int, int *);302int ip6_lasthdr(struct mbuf *, int, int, int *);
303int ip6_mrouter_active(u_int);
313int ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *, int);304int ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *, int);
314int ip6_process_hopopts(struct mbuf **, u_int8_t *, int, u_int32_t *,305int ip6_process_hopopts(struct mbuf **, u_int8_t *, int, u_int32_t *,
315 u_int32_t *);306 u_int32_t *);
...@@ -371,7 +362,7 @@ struct tdb;...@@ -371,7 +362,7 @@ struct tdb;
371int ip6_output_ipsec_lookup(struct mbuf *, const struct ipsec_level *,362int ip6_output_ipsec_lookup(struct mbuf *, const struct ipsec_level *,
372 struct tdb **);363 struct tdb **);
373int ip6_output_ipsec_send(struct tdb *, struct mbuf *, struct route *,364int ip6_output_ipsec_send(struct tdb *, struct mbuf *, struct route *,
374 u_int, int, int);365 u_int, int);
375#endif /* IPSEC */366#endif /* IPSEC */
376367
377#endif /* _KERNEL */368#endif /* _KERNEL */
lib/libc/include/generic-openbsd/nfs/nfs_var.h+5-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: nfs_var.h,v 1.66 2024/09/09 03:50:14 jsg Exp $ */1/* $OpenBSD: nfs_var.h,v 1.71 2026/06/09 02:55:17 jsg Exp $ */
2/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */2/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
33
4/*4/*
...@@ -68,8 +68,6 @@ int nfs_writerpc(struct vnode *, struct uio *, int *, int *);...@@ -68,8 +68,6 @@ int nfs_writerpc(struct vnode *, struct uio *, int *, int *);
68int nfs_removeit(struct sillyrename *);68int nfs_removeit(struct sillyrename *);
69int nfs_writebp(struct buf *, int);69int nfs_writebp(struct buf *, int);
7070
71#define nfs_ioctl ((int (*)(void *))enoioctl)
72
73/* nfs_serv.c */71/* nfs_serv.c */
74int nfsrv3_access(struct nfsrv_descript *, struct nfssvc_sock *,72int nfsrv3_access(struct nfsrv_descript *, struct nfssvc_sock *,
75 struct proc *, struct mbuf **);73 struct proc *, struct mbuf **);
...@@ -148,15 +146,15 @@ int nfs_namei(struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,...@@ -148,15 +146,15 @@ int nfs_namei(struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,
148 struct proc *);146 struct proc *);
149void nfsm_adj(struct mbuf *, int, int);147void nfsm_adj(struct mbuf *, int, int);
150void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int,148void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int,
151 struct vattr *, struct nfsm_info *);149 struct vattr *, struct mbuf **);
152void nfsm_srvpostop_attr(struct nfsrv_descript *, int, struct vattr *,150void nfsm_srvpostop_attr(struct nfsrv_descript *, int, struct vattr *,
153 struct nfsm_info *);151 struct mbuf **);
154void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *,152void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *,
155 struct nfs_fattr *);153 struct nfs_fattr *);
156int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *,154int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *,
157 struct nfssvc_sock *, struct mbuf *, int *);155 struct nfssvc_sock *, struct mbuf *, int *);
158int netaddr_match(int, union nethostaddr *, struct mbuf *);156int netaddr_match(int, union nethostaddr *, struct mbuf *);
159int nfsm_srvsattr(struct mbuf **, struct vattr *, struct mbuf *, caddr_t *);157int nfsm_srvsattr(struct nfsrv_descript *, struct vattr *);
160158
161/* nfs_subs.c */159/* nfs_subs.c */
162struct mbuf *nfsm_reqhead(int);160struct mbuf *nfsm_reqhead(int);
...@@ -183,7 +181,7 @@ void nfs_add_tobecommitted_range(struct vnode *, struct buf *);...@@ -183,7 +181,7 @@ void nfs_add_tobecommitted_range(struct vnode *, struct buf *);
183void nfs_del_tobecommitted_range(struct vnode *, struct buf *);181void nfs_del_tobecommitted_range(struct vnode *, struct buf *);
184void nfs_merge_commit_ranges(struct vnode *);182void nfs_merge_commit_ranges(struct vnode *);
185int nfsrv_errmap(struct nfsrv_descript *, int);183int nfsrv_errmap(struct nfsrv_descript *, int);
186void nfsm_fhtom(struct nfsm_info *, struct vnode *, int);184void nfsm_fhtom(struct mbuf **, struct vnode *, int);
187void nfsm_srvfhtom(struct mbuf **, fhandle_t *, int);185void nfsm_srvfhtom(struct mbuf **, fhandle_t *, int);
188186
189/* nfs_syscalls.c */187/* nfs_syscalls.c */
lib/libc/include/generic-openbsd/nfs/nfsm_subs.h+85-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: nfsm_subs.h,v 1.49 2024/09/11 12:22:34 claudio Exp $ */1/* $OpenBSD: nfsm_subs.h,v 1.52 2026/06/09 02:52:26 jsg Exp $ */
2/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */2/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */
33
4/*4/*
...@@ -48,7 +48,6 @@ struct nfsm_info {...@@ -48,7 +48,6 @@ struct nfsm_info {
4848
49 /* Setting up / Tearing down. */49 /* Setting up / Tearing down. */
50 struct mbuf *nmi_md;50 struct mbuf *nmi_md;
51 struct mbuf *nmi_mb;
52 caddr_t nmi_dpos;51 caddr_t nmi_dpos;
5352
54 int nmi_v3; 53 int nmi_v3;
...@@ -56,6 +55,30 @@ struct nfsm_info {...@@ -56,6 +55,30 @@ struct nfsm_info {
56 int *nmi_errorp;55 int *nmi_errorp;
57};56};
5857
58static inline void *
59nfsd_dissect(struct nfsrv_descript *nfsd, int s, int *errorp)
60{
61 caddr_t ret;
62 int avail, error;
63
64 avail = mtod(nfsd->nd_md, caddr_t) + nfsd->nd_md->m_len -
65 nfsd->nd_dpos;
66 if (avail >= s) {
67 ret = nfsd->nd_dpos;
68 nfsd->nd_dpos += s;
69 return ret;
70 }
71 error = nfsm_disct(&nfsd->nd_md, &nfsd->nd_dpos, s, avail, &ret);
72 if (error != 0) {
73 m_freem(nfsd->nd_mrep);
74 nfsd->nd_mrep = NULL;
75 *errorp = error;
76 return NULL;
77 } else {
78 return ret;
79 }
80}
81
59static inline void *82static inline void *
60nfsm_dissect(struct nfsm_info *infop, int s)83nfsm_dissect(struct nfsm_info *infop, int s)
61{84{
...@@ -82,6 +105,27 @@ nfsm_dissect(struct nfsm_info *infop, int s)...@@ -82,6 +105,27 @@ nfsm_dissect(struct nfsm_info *infop, int s)
82105
83#define nfsm_rndup(a) (((a)+3)&(~0x3))106#define nfsm_rndup(a) (((a)+3)&(~0x3))
84107
108static inline int
109nfsd_adv(struct nfsrv_descript *nfsd, int s, int *errorp)
110{
111 int avail, error;
112
113 avail = mtod(nfsd->nd_md, caddr_t) + nfsd->nd_md->m_len -
114 nfsd->nd_dpos;
115 if (avail >= s) {
116 nfsd->nd_dpos += s;
117 return 0;
118 }
119 error = nfs_adv(&nfsd->nd_md, &nfsd->nd_dpos, s, avail);
120 if (error != 0) {
121 m_freem(nfsd->nd_mrep);
122 nfsd->nd_mrep = NULL;
123 *errorp = error;
124 return error;
125 }
126 return 0;
127}
128
85static inline int129static inline int
86nfsm_adv(struct nfsm_info *infop, int s)130nfsm_adv(struct nfsm_info *infop, int s)
87{131{
...@@ -133,6 +177,24 @@ nfsm_postop_attr(struct nfsm_info *infop, struct vnode **vpp, int *attrflagp)...@@ -133,6 +177,24 @@ nfsm_postop_attr(struct nfsm_info *infop, struct vnode **vpp, int *attrflagp)
133 return 0;177 return 0;
134}178}
135179
180static inline int
181nfsd_strsiz(struct nfsrv_descript *nfsd, int *lenp, int maxlen, int *errorp)
182{
183 uint32_t *tl = (uint32_t *)nfsd_dissect(nfsd, NFSX_UNSIGNED, errorp);
184 int len;
185 if (tl == NULL)
186 return 1;
187 len = fxdr_unsigned(int32_t, *tl);
188 if (len < 0 || len > maxlen) {
189 m_freem(nfsd->nd_mrep);
190 nfsd->nd_mrep = NULL;
191 *errorp = EBADRPC;
192 return 1;
193 }
194 *lenp = len;
195 return 0;
196}
197
136static inline int198static inline int
137nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen)199nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen)
138{200{
...@@ -151,6 +213,24 @@ nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen)...@@ -151,6 +213,24 @@ nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen)
151 return 0;213 return 0;
152}214}
153215
216static inline int
217nfsd_mtouio(struct nfsrv_descript *nfsd, struct uio *uiop, int len, int *errorp)
218{
219 int error;
220
221 if (len <= 0)
222 return 0;
223
224 error = nfsm_mbuftouio(&nfsd->nd_md, uiop, len, &nfsd->nd_dpos);
225 if (error != 0) {
226 m_freem(nfsd->nd_mrep);
227 nfsd->nd_mrep = NULL;
228 *errorp = error;
229 return error;
230 }
231 return 0;
232}
233
154static inline int234static inline int
155nfsm_mtouio(struct nfsm_info *infop, struct uio *uiop, int len)235nfsm_mtouio(struct nfsm_info *infop, struct uio *uiop, int len)
156{236{
...@@ -170,7 +250,8 @@ nfsm_mtouio(struct nfsm_info *infop, struct uio *uiop, int len)...@@ -170,7 +250,8 @@ nfsm_mtouio(struct nfsm_info *infop, struct uio *uiop, int len)
170}250}
171251
172static inline int252static inline int
173nfsm_strtom(struct nfsm_info *infop, char *str, size_t len, size_t maxlen)253nfsm_strtom(struct nfsm_info *infop, struct mbuf **mb,
254 char *str, size_t len, size_t maxlen)
174{255{
175 if (len > maxlen) {256 if (len > maxlen) {
176 m_freem(infop->nmi_mreq);257 m_freem(infop->nmi_mreq);
...@@ -178,7 +259,7 @@ nfsm_strtom(struct nfsm_info *infop, char *str, size_t len, size_t maxlen)...@@ -178,7 +259,7 @@ nfsm_strtom(struct nfsm_info *infop, char *str, size_t len, size_t maxlen)
178 *infop->nmi_errorp = ENAMETOOLONG;259 *infop->nmi_errorp = ENAMETOOLONG;
179 return 1;260 return 1;
180 }261 }
181 nfsm_strtombuf(&infop->nmi_mb, str, len);262 nfsm_strtombuf(mb, str, len);
182 return 0;263 return 0;
183}264}
184265
lib/libc/include/generic-openbsd/resolv.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: resolv.h,v 1.23 2021/11/22 20:18:27 jca Exp $ */1/* $OpenBSD: resolv.h,v 1.24 2026/09/05 08:18:23 jsg Exp $ */
22
3/*3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
...@@ -177,7 +177,7 @@ struct __res_state_ext {...@@ -177,7 +177,7 @@ struct __res_state_ext {
177#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/177#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
178#define RES_USEVC 0x00000008 /* use virtual circuit */178#define RES_USEVC 0x00000008 /* use virtual circuit */
179#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */179#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
180#define RES_IGNTC 0x00000020 /* ignore trucation errors */180#define RES_IGNTC 0x00000020 /* ignore truncation errors */
181#define RES_RECURSE 0x00000040 /* recursion desired */181#define RES_RECURSE 0x00000040 /* recursion desired */
182#define RES_DEFNAMES 0x00000080 /* use default domain name */182#define RES_DEFNAMES 0x00000080 /* use default domain name */
183#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */183#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
lib/libc/include/generic-openbsd/rmd160.h+1-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: rmd160.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */1/* $OpenBSD: rmd160.h,v 1.18 2026/08/31 15:09:14 tb Exp $ */
2/*2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved.3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 *4 *
...@@ -38,20 +38,14 @@ typedef struct RMD160Context {...@@ -38,20 +38,14 @@ typedef struct RMD160Context {
3838
39__BEGIN_DECLS39__BEGIN_DECLS
40void RMD160Init(RMD160_CTX *);40void RMD160Init(RMD160_CTX *);
41void RMD160Transform(u_int32_t [5], const u_int8_t [RMD160_BLOCK_LENGTH])
42 __attribute__((__bounded__(__minbytes__,1,5)))
43 __attribute__((__bounded__(__minbytes__,2,RMD160_BLOCK_LENGTH)));
44void RMD160Update(RMD160_CTX *, const u_int8_t *, size_t)41void RMD160Update(RMD160_CTX *, const u_int8_t *, size_t)
45 __attribute__((__bounded__(__string__,2,3)));42 __attribute__((__bounded__(__string__,2,3)));
46void RMD160Pad(RMD160_CTX *);
47void RMD160Final(u_int8_t [RMD160_DIGEST_LENGTH], RMD160_CTX *)43void RMD160Final(u_int8_t [RMD160_DIGEST_LENGTH], RMD160_CTX *)
48 __attribute__((__bounded__(__minbytes__,1,RMD160_DIGEST_LENGTH)));44 __attribute__((__bounded__(__minbytes__,1,RMD160_DIGEST_LENGTH)));
49char *RMD160End(RMD160_CTX *, char *)45char *RMD160End(RMD160_CTX *, char *)
50 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));46 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
51char *RMD160File(const char *, char *)47char *RMD160File(const char *, char *)
52 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));48 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
53char *RMD160FileChunk(const char *, char *, off_t, off_t)
54 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
55char *RMD160Data(const u_int8_t *, size_t, char *)49char *RMD160Data(const u_int8_t *, size_t, char *)
56 __attribute__((__bounded__(__string__,1,2)))50 __attribute__((__bounded__(__string__,1,2)))
57 __attribute__((__bounded__(__minbytes__,3,RMD160_DIGEST_STRING_LENGTH)));51 __attribute__((__bounded__(__minbytes__,3,RMD160_DIGEST_STRING_LENGTH)));
lib/libc/include/generic-openbsd/rpc/auth.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.h,v 1.9 2022/02/14 03:38:59 guenther Exp $ */1/* $OpenBSD: auth.h,v 1.10 2026/09/05 08:36:42 jsg Exp $ */
2/* $NetBSD: auth.h,v 1.7 1995/04/29 05:27:55 cgd Exp $ */2/* $NetBSD: auth.h,v 1.7 1995/04/29 05:27:55 cgd Exp $ */
33
4/*4/*
...@@ -105,7 +105,7 @@ typedef struct __rpc_auth {...@@ -105,7 +105,7 @@ typedef struct __rpc_auth {
105 void (*ah_nextverf)(struct __rpc_auth *);105 void (*ah_nextverf)(struct __rpc_auth *);
106 /* nextverf & serialize */106 /* nextverf & serialize */
107 int (*ah_marshal)(struct __rpc_auth *, XDR *);107 int (*ah_marshal)(struct __rpc_auth *, XDR *);
108 /* validate varifier */108 /* validate verifier */
109 int (*ah_validate)(struct __rpc_auth *,109 int (*ah_validate)(struct __rpc_auth *,
110 struct opaque_auth *);110 struct opaque_auth *);
111 /* refresh credentials */111 /* refresh credentials */
lib/libc/include/generic-openbsd/sha1.h+1-7
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1.h,v 1.24 2012/12/05 23:19:57 deraadt Exp $ */1/* $OpenBSD: sha1.h,v 1.25 2026/08/31 15:09:14 tb Exp $ */
22
3/*3/*
4 * SHA-1 in C4 * SHA-1 in C
...@@ -21,10 +21,6 @@ typedef struct {...@@ -21,10 +21,6 @@ typedef struct {
2121
22__BEGIN_DECLS22__BEGIN_DECLS
23void SHA1Init(SHA1_CTX *);23void SHA1Init(SHA1_CTX *);
24void SHA1Pad(SHA1_CTX *);
25void SHA1Transform(u_int32_t [5], const u_int8_t [SHA1_BLOCK_LENGTH])
26 __attribute__((__bounded__(__minbytes__,1,5)))
27 __attribute__((__bounded__(__minbytes__,2,SHA1_BLOCK_LENGTH)));
28void SHA1Update(SHA1_CTX *, const u_int8_t *, size_t)24void SHA1Update(SHA1_CTX *, const u_int8_t *, size_t)
29 __attribute__((__bounded__(__string__,2,3)));25 __attribute__((__bounded__(__string__,2,3)));
30void SHA1Final(u_int8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *)26void SHA1Final(u_int8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *)
...@@ -33,8 +29,6 @@ char *SHA1End(SHA1_CTX *, char *)...@@ -33,8 +29,6 @@ char *SHA1End(SHA1_CTX *, char *)
33 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));29 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
34char *SHA1File(const char *, char *)30char *SHA1File(const char *, char *)
35 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));31 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
36char *SHA1FileChunk(const char *, char *, off_t, off_t)
37 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
38char *SHA1Data(const u_int8_t *, size_t, char *)32char *SHA1Data(const u_int8_t *, size_t, char *)
39 __attribute__((__bounded__(__string__,1,2)))33 __attribute__((__bounded__(__string__,1,2)))
40 __attribute__((__bounded__(__minbytes__,3,SHA1_DIGEST_STRING_LENGTH)));34 __attribute__((__bounded__(__minbytes__,3,SHA1_DIGEST_STRING_LENGTH)));
lib/libc/include/generic-openbsd/sha2.h+1-21
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sha2.h,v 1.10 2016/09/03 17:00:29 tedu Exp $ */1/* $OpenBSD: sha2.h,v 1.11 2026/08/31 15:09:14 tb Exp $ */
22
3/*3/*
4 * FILE: sha2.h4 * FILE: sha2.h
...@@ -68,86 +68,66 @@ typedef struct _SHA2_CTX {...@@ -68,86 +68,66 @@ typedef struct _SHA2_CTX {
6868
69__BEGIN_DECLS69__BEGIN_DECLS
70void SHA224Init(SHA2_CTX *);70void SHA224Init(SHA2_CTX *);
71void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]);
72void SHA224Update(SHA2_CTX *, const u_int8_t *, size_t)71void SHA224Update(SHA2_CTX *, const u_int8_t *, size_t)
73 __attribute__((__bounded__(__string__,2,3)));72 __attribute__((__bounded__(__string__,2,3)));
74void SHA224Pad(SHA2_CTX *);
75void SHA224Final(u_int8_t [SHA224_DIGEST_LENGTH], SHA2_CTX *)73void SHA224Final(u_int8_t [SHA224_DIGEST_LENGTH], SHA2_CTX *)
76 __attribute__((__bounded__(__minbytes__,1,SHA224_DIGEST_LENGTH)));74 __attribute__((__bounded__(__minbytes__,1,SHA224_DIGEST_LENGTH)));
77char *SHA224End(SHA2_CTX *, char *)75char *SHA224End(SHA2_CTX *, char *)
78 __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH)));76 __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH)));
79char *SHA224File(const char *, char *)77char *SHA224File(const char *, char *)
80 __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH)));78 __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH)));
81char *SHA224FileChunk(const char *, char *, off_t, off_t)
82 __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH)));
83char *SHA224Data(const u_int8_t *, size_t, char *)79char *SHA224Data(const u_int8_t *, size_t, char *)
84 __attribute__((__bounded__(__string__,1,2)))80 __attribute__((__bounded__(__string__,1,2)))
85 __attribute__((__bounded__(__minbytes__,3,SHA224_DIGEST_STRING_LENGTH)));81 __attribute__((__bounded__(__minbytes__,3,SHA224_DIGEST_STRING_LENGTH)));
8682
87void SHA256Init(SHA2_CTX *);83void SHA256Init(SHA2_CTX *);
88void SHA256Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]);
89void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t)84void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t)
90 __attribute__((__bounded__(__string__,2,3)));85 __attribute__((__bounded__(__string__,2,3)));
91void SHA256Pad(SHA2_CTX *);
92void SHA256Final(u_int8_t [SHA256_DIGEST_LENGTH], SHA2_CTX *)86void SHA256Final(u_int8_t [SHA256_DIGEST_LENGTH], SHA2_CTX *)
93 __attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH)));87 __attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH)));
94char *SHA256End(SHA2_CTX *, char *)88char *SHA256End(SHA2_CTX *, char *)
95 __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH)));89 __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH)));
96char *SHA256File(const char *, char *)90char *SHA256File(const char *, char *)
97 __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH)));91 __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH)));
98char *SHA256FileChunk(const char *, char *, off_t, off_t)
99 __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH)));
100char *SHA256Data(const u_int8_t *, size_t, char *)92char *SHA256Data(const u_int8_t *, size_t, char *)
101 __attribute__((__bounded__(__string__,1,2)))93 __attribute__((__bounded__(__string__,1,2)))
102 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH)));94 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH)));
10395
104void SHA384Init(SHA2_CTX *);96void SHA384Init(SHA2_CTX *);
105void SHA384Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]);
106void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t)97void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t)
107 __attribute__((__bounded__(__string__,2,3)));98 __attribute__((__bounded__(__string__,2,3)));
108void SHA384Pad(SHA2_CTX *);
109void SHA384Final(u_int8_t [SHA384_DIGEST_LENGTH], SHA2_CTX *)99void SHA384Final(u_int8_t [SHA384_DIGEST_LENGTH], SHA2_CTX *)
110 __attribute__((__bounded__(__minbytes__,1,SHA384_DIGEST_LENGTH)));100 __attribute__((__bounded__(__minbytes__,1,SHA384_DIGEST_LENGTH)));
111char *SHA384End(SHA2_CTX *, char *)101char *SHA384End(SHA2_CTX *, char *)
112 __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH)));102 __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH)));
113char *SHA384File(const char *, char *)103char *SHA384File(const char *, char *)
114 __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH)));104 __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH)));
115char *SHA384FileChunk(const char *, char *, off_t, off_t)
116 __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH)));
117char *SHA384Data(const u_int8_t *, size_t, char *)105char *SHA384Data(const u_int8_t *, size_t, char *)
118 __attribute__((__bounded__(__string__,1,2)))106 __attribute__((__bounded__(__string__,1,2)))
119 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH)));107 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH)));
120108
121void SHA512Init(SHA2_CTX *);109void SHA512Init(SHA2_CTX *);
122void SHA512Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]);
123void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t)110void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t)
124 __attribute__((__bounded__(__string__,2,3)));111 __attribute__((__bounded__(__string__,2,3)));
125void SHA512Pad(SHA2_CTX *);
126void SHA512Final(u_int8_t [SHA512_DIGEST_LENGTH], SHA2_CTX *)112void SHA512Final(u_int8_t [SHA512_DIGEST_LENGTH], SHA2_CTX *)
127 __attribute__((__bounded__(__minbytes__,1,SHA512_DIGEST_LENGTH)));113 __attribute__((__bounded__(__minbytes__,1,SHA512_DIGEST_LENGTH)));
128char *SHA512End(SHA2_CTX *, char *)114char *SHA512End(SHA2_CTX *, char *)
129 __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH)));115 __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH)));
130char *SHA512File(const char *, char *)116char *SHA512File(const char *, char *)
131 __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH)));117 __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH)));
132char *SHA512FileChunk(const char *, char *, off_t, off_t)
133 __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH)));
134char *SHA512Data(const u_int8_t *, size_t, char *)118char *SHA512Data(const u_int8_t *, size_t, char *)
135 __attribute__((__bounded__(__string__,1,2)))119 __attribute__((__bounded__(__string__,1,2)))
136 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));120 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));
137121
138void SHA512_256Init(SHA2_CTX *);122void SHA512_256Init(SHA2_CTX *);
139void SHA512_256Transform(u_int64_t state[8], const u_int8_t [SHA512_256_BLOCK_LENGTH]);
140void SHA512_256Update(SHA2_CTX *, const u_int8_t *, size_t)123void SHA512_256Update(SHA2_CTX *, const u_int8_t *, size_t)
141 __attribute__((__bounded__(__string__,2,3)));124 __attribute__((__bounded__(__string__,2,3)));
142void SHA512_256Pad(SHA2_CTX *);
143void SHA512_256Final(u_int8_t [SHA512_256_DIGEST_LENGTH], SHA2_CTX *)125void SHA512_256Final(u_int8_t [SHA512_256_DIGEST_LENGTH], SHA2_CTX *)
144 __attribute__((__bounded__(__minbytes__,1,SHA512_256_DIGEST_LENGTH)));126 __attribute__((__bounded__(__minbytes__,1,SHA512_256_DIGEST_LENGTH)));
145char *SHA512_256End(SHA2_CTX *, char *)127char *SHA512_256End(SHA2_CTX *, char *)
146 __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH)));128 __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH)));
147char *SHA512_256File(const char *, char *)129char *SHA512_256File(const char *, char *)
148 __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH)));130 __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH)));
149char *SHA512_256FileChunk(const char *, char *, off_t, off_t)
150 __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH)));
151char *SHA512_256Data(const u_int8_t *, size_t, char *)131char *SHA512_256Data(const u_int8_t *, size_t, char *)
152 __attribute__((__bounded__(__string__,1,2)))132 __attribute__((__bounded__(__string__,1,2)))
153 __attribute__((__bounded__(__minbytes__,3,SHA512_256_DIGEST_STRING_LENGTH)));133 __attribute__((__bounded__(__minbytes__,3,SHA512_256_DIGEST_STRING_LENGTH)));
lib/libc/include/generic-openbsd/spawn.h+6-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: spawn.h,v 1.3 2015/05/20 22:50:07 millert Exp $ */1/* $OpenBSD: spawn.h,v 1.4 2026/08/31 15:12:32 tb Exp $ */
2/*-2/*-
3 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>3 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
4 * All rights reserved.4 * All rights reserved.
...@@ -69,6 +69,11 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict,...@@ -69,6 +69,11 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict,
69 int, const char *__restrict, int, mode_t);69 int, const char *__restrict, int, mode_t);
70int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);70int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
71int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);71int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
72#if __POSIX_VISIBLE >= 202405
73int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *__restrict,
74 const char *__restrict);
75int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *, int);
76#endif
7277
73/*78/*
74 * Spawn attributes79 * Spawn attributes
lib/libc/include/generic-openbsd/sys/buf.h+3-8
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: buf.h,v 1.120 2025/08/14 16:13:52 beck Exp $ */1/* $OpenBSD: buf.h,v 1.123 2026/08/03 03:27:45 jsg Exp $ */
2/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */2/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
33
4/*4/*
...@@ -120,7 +120,6 @@ struct buf {...@@ -120,7 +120,6 @@ struct buf {
120 LIST_ENTRY(buf) b_list; /* All allocated buffers. */120 LIST_ENTRY(buf) b_list; /* All allocated buffers. */
121 LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */121 LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
122 TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */122 TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
123 int cache; /* which cache are we in */
124 struct proc *b_proc; /* Associated proc; NULL if kernel. */123 struct proc *b_proc; /* Associated proc; NULL if kernel. */
125 volatile long b_flags; /* B_* flags. */124 volatile long b_flags; /* B_* flags. */
126 long b_bufsize; /* Allocated buffer size. */125 long b_bufsize; /* Allocated buffer size. */
...@@ -193,13 +192,12 @@ struct bufcache {...@@ -193,13 +192,12 @@ struct bufcache {
193#define B_WARM 0x00800000 /* buffer is or has been on the warm queue */192#define B_WARM 0x00800000 /* buffer is or has been on the warm queue */
194#define B_COLD 0x01000000 /* buffer is on the cold queue */193#define B_COLD 0x01000000 /* buffer is on the cold queue */
195#define B_BC 0x02000000 /* buffer is managed by the cache */194#define B_BC 0x02000000 /* buffer is managed by the cache */
196#define B_DMA 0x04000000 /* buffer is DMA reachable */
197195
198#define B_BITS "\20\001AGE\002NEEDCOMMIT\003ASYNC\004BAD\005BUSY" \196#define B_BITS "\20\001AGE\002NEEDCOMMIT\003ASYNC\004BAD\005BUSY" \
199 "\006CACHE\007CALL\010DELWRI\011DONE\012EINTR\013ERROR" \197 "\006CACHE\007CALL\010DELWRI\011DONE\012EINTR\013ERROR" \
200 "\014INVAL\015NOCACHE\016PHYS\017RAW\020READ" \198 "\014INVAL\015NOCACHE\016PHYS\017RAW\020READ" \
201 "\021WANTED\022WRITEINPROG\023XXX(FORMAT)\024DEFERRED" \199 "\021WANTED\022WRITEINPROG\023XXX(FORMAT)\024DEFERRED" \
202 "\025SCANNED\026DAEMON\027RELEASED\030WARM\031COLD\032BC\033DMA"200 "\025SCANNED\026DAEMON\027RELEASED\030WARM\031COLD\032BC"
203201
204/*202/*
205 * Zero out the buffer's data area.203 * Zero out the buffer's data area.
...@@ -262,9 +260,7 @@ struct buf *incore(struct vnode *, daddr_t);...@@ -262,9 +260,7 @@ struct buf *incore(struct vnode *, daddr_t);
262void bufcache_take(struct buf *);260void bufcache_take(struct buf *);
263void bufcache_release(struct buf *);261void bufcache_release(struct buf *);
264262
265int buf_flip_high(struct buf *);263struct buf *bufcache_getcleanbuf(int);
266void buf_flip_dma(struct buf *);
267struct buf *bufcache_getcleanbuf(int, int);
268struct buf *bufcache_getdirtybuf(void);264struct buf *bufcache_getdirtybuf(void);
269265
270/*266/*
...@@ -284,7 +280,6 @@ int buf_dealloc_mem(struct buf *);...@@ -284,7 +280,6 @@ int buf_dealloc_mem(struct buf *);
284void buf_fix_mapping(struct buf *, vsize_t);280void buf_fix_mapping(struct buf *, vsize_t);
285void buf_alloc_pages(struct buf *, vsize_t);281void buf_alloc_pages(struct buf *, vsize_t);
286void buf_free_pages(struct buf *);282void buf_free_pages(struct buf *);
287int buf_realloc_pages(struct buf *, struct uvm_constraint_range *, int);
288283
289void minphys(struct buf *bp);284void minphys(struct buf *bp);
290int physio(void (*strategy)(struct buf *), dev_t dev, int flags,285int physio(void (*strategy)(struct buf *), dev_t dev, int flags,
lib/libc/include/generic-openbsd/sys/device.h+5-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: device.h,v 1.71 2026/03/11 16:18:42 kettenis Exp $ */1/* $OpenBSD: device.h,v 1.72 2026/09/07 21:30:59 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/*
...@@ -202,11 +202,13 @@ void config_pending_decr(void);...@@ -202,11 +202,13 @@ void config_pending_decr(void);
202void config_mountroot(struct device *, void (*)(struct device *));202void config_mountroot(struct device *, void (*)(struct device *));
203void config_process_deferred_mountroot(void);203void config_process_deferred_mountroot(void);
204204
205int request_sleep(int);205extern int sleep_mode;
206int sleep_state(void *, int);
207#define SLEEP_RESUME 0206#define SLEEP_RESUME 0
208#define SLEEP_SUSPEND 1207#define SLEEP_SUSPEND 1
209#define SLEEP_HIBERNATE 2208#define SLEEP_HIBERNATE 2
209
210int request_sleep(int);
211int sleep_state(void *, int);
210void sleep_mp(void);212void sleep_mp(void);
211void resume_mp(void);213void resume_mp(void);
212int sleep_showstate(void *v, int sleepmode);214int sleep_showstate(void *v, int sleepmode);
lib/libc/include/generic-openbsd/sys/dkio.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: dkio.h,v 1.14 2025/11/13 20:59:14 deraadt Exp $ */1/* $OpenBSD: dkio.h,v 1.15 2026/06/24 17:03:06 krw 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,10 +50,6 @@...@@ -50,10 +50,6 @@
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/* XXX temporary to support the transition to more partitions */
54#define O_disklabel offsetof(struct disklabel, d_partitions[MAXPARTITIONS16])
55#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_disklabel)
56
57struct dk_inquiry {53struct dk_inquiry {
58 char vendor[64];54 char vendor[64];
59 char product[128];55 char product[128];
lib/libc/include/generic-openbsd/sys/exec.h+7-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: exec.h,v 1.57 2025/05/24 06:49:16 deraadt Exp $ */1/* $OpenBSD: exec.h,v 1.61 2026/09/17 19:45:07 dgl Exp $ */
2/* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */2/* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */
33
4/*-4/*-
...@@ -106,9 +106,8 @@ struct exec_vmcmd_set {...@@ -106,9 +106,8 @@ struct exec_vmcmd_set {
106 struct exec_vmcmd evs_start[EXEC_DEFAULT_VMCMD_SETSIZE];106 struct exec_vmcmd evs_start[EXEC_DEFAULT_VMCMD_SETSIZE];
107};107};
108108
109struct elf_args;
110struct exec_package {109struct exec_package {
111 char *ep_name; /* file's name */110 const char *ep_name; /* file's name */
112 void *ep_hdr; /* file's exec header */111 void *ep_hdr; /* file's exec header */
113 u_int ep_hdrlen; /* length of ep_hdr */112 u_int ep_hdrlen; /* length of ep_hdr */
114 u_int ep_hdrvalid; /* bytes of ep_hdr that are valid */113 u_int ep_hdrvalid; /* bytes of ep_hdr that are valid */
...@@ -123,16 +122,19 @@ struct exec_package {...@@ -123,16 +122,19 @@ struct exec_package {
123 u_long ep_maxsaddr; /* proc's max stack addr ("top") */122 u_long ep_maxsaddr; /* proc's max stack addr ("top") */
124 u_long ep_minsaddr; /* proc's min stack addr ("bottom") */123 u_long ep_minsaddr; /* proc's min stack addr ("bottom") */
125 u_long ep_ssize; /* size of process's stack */124 u_long ep_ssize; /* size of process's stack */
126 u_long ep_entry; /* process's entry point */125 u_long ep_entry; /* process's (maybe ld.so) point */
126 u_long ep_entrymain; /* process's (main) entry point */
127 u_long ep_phdraddr; /* process's elf phdr location */
128 u_long ep_interpaddr; /* process's ld.so location */
127 u_int ep_flags; /* flags; see below. */129 u_int ep_flags; /* flags; see below. */
128 char **ep_fa; /* a fake args vector for scripts */130 char **ep_fa; /* a fake args vector for scripts */
129 int ep_fd; /* a file descriptor we're holding */131 int ep_fd; /* a file descriptor we're holding */
130 struct elf_args *ep_args; /* ELF info */
131 void *ep_auxinfo; /* userspace auxinfo address */132 void *ep_auxinfo; /* userspace auxinfo address */
132 char *ep_interp; /* name of interpreter if any */133 char *ep_interp; /* name of interpreter if any */
133 vaddr_t ep_pinstart, ep_pinend; /* executable region */134 vaddr_t ep_pinstart, ep_pinend; /* executable region */
134 u_int *ep_pins; /* array of system call offsets */135 u_int *ep_pins; /* array of system call offsets */
135 int ep_npins; /* entries in array */136 int ep_npins; /* entries in array */
137 char *ep_execpath; /* execve path on userland stack */
136};138};
137#define EXEC_INDIR 0x0001 /* script handling already done */139#define EXEC_INDIR 0x0001 /* script handling already done */
138#define EXEC_HASFD 0x0002 /* holding a shell script */140#define EXEC_HASFD 0x0002 /* holding a shell script */
lib/libc/include/generic-openbsd/sys/exec_elf.h+3-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: exec_elf.h,v 1.108 2025/07/31 16:09:59 kettenis Exp $ */1/* $OpenBSD: exec_elf.h,v 1.112 2026/09/16 03:22:35 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.3 * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
4 *4 *
...@@ -734,16 +734,8 @@ enum AuxID {...@@ -734,16 +734,8 @@ enum AuxID {
734 AUX_sun_gid = 2002, /* egid */734 AUX_sun_gid = 2002, /* egid */
735 AUX_sun_rgid = 2003, /* rgid */735 AUX_sun_rgid = 2003, /* rgid */
736 AUX_openbsd_timekeep = 4000, /* userland clock_gettime */736 AUX_openbsd_timekeep = 4000, /* userland clock_gettime */
737 AUX_openbsd_execpath = 4001, /* realpath'd executable path */
737};738};
738
739struct elf_args {
740 u_long arg_entry; /* program entry point */
741 u_long arg_interp; /* Interpreter load address */
742 u_long arg_phaddr; /* program header address */
743 u_long arg_phentsize; /* Size of program header */
744 u_long arg_phnum; /* Number of program headers */
745};
746
747#endif739#endif
748740
749#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)741#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
...@@ -822,7 +814,7 @@ extern Elf_Dyn _DYNAMIC[];...@@ -822,7 +814,7 @@ extern Elf_Dyn _DYNAMIC[];
822/*814/*
823 * How many entries are in the AuxInfo array we pass to the process?815 * How many entries are in the AuxInfo array we pass to the process?
824 */816 */
825#define ELF_AUX_ENTRIES 11817#define ELF_AUX_ENTRIES 12
826#define ELF_AUX_WORDS (sizeof(AuxInfo) * ELF_AUX_ENTRIES / sizeof(char *))818#define ELF_AUX_WORDS (sizeof(AuxInfo) * ELF_AUX_ENTRIES / sizeof(char *))
827819
828#define ELFROUNDSIZE sizeof(Elf_Word)820#define ELFROUNDSIZE sizeof(Elf_Word)
lib/libc/include/generic-openbsd/sys/file.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: file.h,v 1.66 2022/06/20 01:39:44 visa Exp $ */1/* $OpenBSD: file.h,v 1.67 2026/09/19 17:21:52 dv Exp $ */
2/* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */2/* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */
33
4/*4/*
...@@ -46,6 +46,7 @@...@@ -46,6 +46,7 @@
46#define DTYPE_KQUEUE 4 /* event queue */46#define DTYPE_KQUEUE 4 /* event queue */
47#define DTYPE_DMABUF 5 /* DMA buffer (for DRM) */47#define DTYPE_DMABUF 5 /* DMA buffer (for DRM) */
48#define DTYPE_SYNC 6 /* sync file (for DRM) */48#define DTYPE_SYNC 6 /* sync file (for DRM) */
49#define DTYPE_VMM 7 /* vmm(4) virtual machine */
4950
50#ifdef _KERNEL51#ifdef _KERNEL
51struct proc;52struct proc;
lib/libc/include/generic-openbsd/sys/fusebuf.h+367-89
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: fusebuf.h,v 1.16 2025/09/06 06:15:52 helg Exp $ */1/* $OpenBSD: fusebuf.h,v 1.17 2026/06/17 13:29:01 helg Exp $ */
2/*2/*
3 * Copyright (c) 2013 Sylvestre Gallon3 * Copyright (c) 2013 Sylvestre Gallon
4 * Copyright (c) 2013 Martin Pieuchot4 * Copyright (c) 2013 Martin Pieuchot
...@@ -19,36 +19,25 @@...@@ -19,36 +19,25 @@
19#ifndef _SYS_FUSEBUF_H_19#ifndef _SYS_FUSEBUF_H_
20#define _SYS_FUSEBUF_H_20#define _SYS_FUSEBUF_H_
2121
22#include <sys/stdint.h>
23
22/*24/*
23 * Maximum size of the read or write buffer sent from the kernel for VFS25 * Maximum size of the read or write buffer sent from the kernel for VFS
24 * syscalls: read, readdir, readlink, write.26 * syscalls: read, readdir, readlink, write.
25 */27 */
26#define FUSEBUFMAXSIZE (4096*1024)28#define FUSEBUFMAXSIZE (4096*1024)
2729
28/* header at beginning of each fusebuf: */30/** Linux FUSE kernel interface major version we somewhat emulate. */
29struct fb_hdr {31#define FUSE_KERNEL_VERSION 7
30 SIMPLEQ_ENTRY(fusebuf) fh_next; /* next buffer in chain */32
31 size_t fh_len; /* Amount of data */33/** Linux FUSE kernel interface minor version we somewhat emulate. */
32 int fh_err; /* errno to pass back */34#define FUSE_KERNEL_MINOR_VERSION 19
33 int fh_type; /* type of data */35
34 ino_t fh_ino; /* Inode of this fusebuf */36/*
35 uint64_t fh_uuid; /* Uuid to track the answer */37 * The root inode is the root of the mounted FUSE file system.
36 pid_t fh_tid; /* calling proc thread id */38 * Also note that inode 0 can't be used for normal purposes.
37 uid_t fh_uid; /* calling proc uid */39 */
38 gid_t fh_gid; /* calling proc gid */40#define FUSE_ROOT_ID ((ino_t)1)
39 mode_t fh_umask; /* calling proc umask */
40};
41
42/* header for fuse file operations (like read/write/mkdir): */
43struct fb_io {
44 uint64_t fi_fd; /* fd where the io is performed */
45 ino_t fi_ino; /* ino for the io */
46 off_t fi_off; /* offset for the io */
47 size_t fi_len; /* Length of data */
48 mode_t fi_mode; /* mode for fd */
49 uint32_t fi_flags; /* flags on transfer */
50 dev_t fi_rdev; /* dev for mknod */
51};
5241
53/*42/*
54 * An operation is issued by the kernel through fuse(4) when the43 * An operation is issued by the kernel through fuse(4) when the
...@@ -62,43 +51,6 @@ struct fb_io {...@@ -62,43 +51,6 @@ struct fb_io {
62 * When the userland file system answers to this operation it uses51 * When the userland file system answers to this operation it uses
63 * the same ID (fh_uuid).52 * the same ID (fh_uuid).
64 */53 */
65struct fusebuf {
66 struct fb_hdr fb_hdr;
67 union {
68 struct statvfs FD_stat; /* vfs statfs */
69 struct stat FD_attr; /* for attr vnops */
70 struct fb_io FD_io; /* for file io vnops */
71 } FD;
72 uint8_t *fb_dat; /* data's */
73};
74
75#define fb_next fb_hdr.fh_next
76#define fb_len fb_hdr.fh_len
77#define fb_err fb_hdr.fh_err
78#define fb_type fb_hdr.fh_type
79#define fb_ino fb_hdr.fh_ino
80#define fb_uuid fb_hdr.fh_uuid
81#define fb_tid fb_hdr.fh_tid
82#define fb_uid fb_hdr.fh_uid
83#define fb_gid fb_hdr.fh_gid
84#define fb_umask fb_hdr.fh_umask
85
86#define fb_stat FD.FD_stat
87#define fb_attr FD.FD_attr
88#define fb_io_fd FD.FD_io.fi_fd
89#define fb_io_ino FD.FD_io.fi_ino
90#define fb_io_off FD.FD_io.fi_off
91#define fb_io_len FD.FD_io.fi_len
92#define fb_io_mode FD.FD_io.fi_mode
93#define fb_io_flags FD.FD_io.fi_flags
94#define fb_io_rdev FD.FD_io.fi_rdev
95
96/*
97 * Macros for type conversion
98 * fbtod(fb,t) - convert fusebuf pointer to data pointer of correct
99 * type
100 */
101#define fbtod(fb,t) ((t)((fb)->fb_dat))
10254
103/* flags needed by setattr */55/* flags needed by setattr */
104#define FUSE_FATTR_MODE (1 << 0)56#define FUSE_FATTR_MODE (1 << 0)
...@@ -107,42 +59,368 @@ struct fusebuf {...@@ -107,42 +59,368 @@ struct fusebuf {
107#define FUSE_FATTR_SIZE (1 << 3)59#define FUSE_FATTR_SIZE (1 << 3)
108#define FUSE_FATTR_ATIME (1 << 4)60#define FUSE_FATTR_ATIME (1 << 4)
109#define FUSE_FATTR_MTIME (1 << 5)61#define FUSE_FATTR_MTIME (1 << 5)
110#define FUSE_FATTR_FH (1 << 6)
11162
112/* fusebuf types */63/* fusebuf types */
113#define FBT_LOOKUP 064#define FUSE_LOOKUP 1
114#define FBT_GETATTR 165#define FUSE_GETATTR 3
115#define FBT_SETATTR 266#define FUSE_SETATTR 4
116#define FBT_READLINK 367#define FUSE_READLINK 5
117#define FBT_SYMLINK 468#define FUSE_SYMLINK 6
118#define FBT_MKNOD 569#define FUSE_MKNOD 8
119#define FBT_MKDIR 670#define FUSE_MKDIR 9
120#define FBT_UNLINK 771#define FUSE_UNLINK 10
121#define FBT_RMDIR 872#define FUSE_RMDIR 11
122#define FBT_RENAME 973#define FUSE_RENAME 12
123#define FBT_LINK 1074#define FUSE_LINK 13
124#define FBT_OPEN 1175#define FUSE_OPEN 14
125#define FBT_READ 1276#define FUSE_READ 15
126#define FBT_WRITE 1377#define FUSE_WRITE 16
127#define FBT_STATFS 1478#define FUSE_STATFS 17
128#define FBT_RELEASE 1679#define FUSE_RELEASE 18
129#define FBT_FSYNC 1780#define FUSE_FSYNC 20
130#define FBT_FLUSH 1881#define FUSE_FLUSH 25
131#define FBT_INIT 1982#define FUSE_INIT 26
132#define FBT_OPENDIR 2083#define FUSE_OPENDIR 27
133#define FBT_READDIR 2184#define FUSE_READDIR 28
134#define FBT_RELEASEDIR 2285#define FUSE_RELEASEDIR 29
135#define FBT_FSYNCDIR 2386#define FUSE_DESTROY 38
136#define FBT_ACCESS 2487#define FUSE_FORGET 2
137#define FBT_DESTROY 2688
138#define FBT_RECLAIM 2789struct fuse_attr {
90 uint64_t ino;
91 uint64_t size;
92 uint64_t blocks;
93 uint64_t atime;
94 uint64_t mtime;
95 uint64_t ctime;
96 uint32_t atimensec;
97 uint32_t mtimensec;
98 uint32_t ctimensec;
99 uint32_t mode;
100 uint32_t nlink;
101 uint32_t uid;
102 uint32_t gid;
103 uint32_t rdev;
104 uint32_t blksize;
105 uint32_t padding;
106};
107
108
109struct fuse_entry_out {
110 uint64_t nodeid; /* Inode number */
111 uint64_t generation; /* Not implemented */
112 uint64_t entry_valid; /* Not implemented */
113 uint64_t attr_valid; /* Not implemented */
114 uint32_t entry_valid_nsec; /* Not implemented */
115 uint32_t attr_valid_nsec; /* Not implemented */
116 struct fuse_attr attr;
117};
118
119struct fuse_forget_in {
120 uint64_t nlookup;
121};
122
123struct fuse_getattr_in {
124 uint32_t getattr_flags; /* Not implemented */
125 uint32_t dummy;
126 uint64_t fh; /* Not implemented */
127};
128
129struct fuse_attr_out {
130 uint64_t attr_valid; /* Not implemented */
131 uint32_t attr_valid_nsec; /* Not implemented */
132 uint32_t dummy;
133 struct fuse_attr attr;
134};
135
136struct fuse_mknod_in {
137 uint32_t mode;
138 uint32_t rdev;
139 uint32_t umask;
140 uint32_t padding;
141};
142
143struct fuse_mkdir_in {
144 uint32_t mode;
145 uint32_t umask;
146};
147
148struct fuse_rename_in {
149 uint64_t newdir;
150};
151
152struct fuse_link_in {
153 uint64_t oldnodeid;
154};
155
156struct fuse_setattr_in {
157 uint32_t valid;
158 uint32_t padding;
159 uint64_t fh;
160 uint64_t size;
161 uint64_t lock_owner;
162 uint64_t atime;
163 uint64_t mtime;
164 uint64_t unused2;
165 uint32_t atimensec;
166 uint32_t mtimensec;
167 uint32_t unused3;
168 uint32_t mode;
169 uint32_t unused4;
170 uint32_t uid;
171 uint32_t gid;
172 uint32_t unused5;
173};
174
175struct fuse_open_in {
176 uint32_t flags;
177 uint32_t unused;
178};
179
180struct fuse_open_out {
181 uint64_t fh;
182 uint32_t open_flags;
183 uint32_t padding;
184};
185
186struct fuse_release_in {
187 uint64_t fh;
188 uint32_t flags;
189 uint32_t release_flags;
190 uint64_t lock_owner;
191};
192
193struct fuse_flush_in {
194 uint64_t fh;
195 uint32_t unused;
196 uint32_t padding;
197 uint64_t lock_owner;
198};
199
200struct fuse_read_in {
201 uint64_t fh;
202 uint64_t offset;
203 uint32_t size;
204 uint32_t read_flags;
205 uint64_t lock_owner;
206 uint32_t flags;
207 uint32_t padding;
208};
209
210struct fuse_write_in {
211 uint64_t fh;
212 uint64_t offset;
213 uint32_t size;
214 uint32_t write_flags;
215 uint64_t lock_owner;
216 uint32_t flags;
217 uint32_t padding;
218};
219
220struct fuse_write_out {
221 uint32_t size;
222 uint32_t padding;
223};
224
225struct fuse_kstatfs {
226 uint64_t blocks;
227 uint64_t bfree;
228 uint64_t bavail;
229 uint64_t files;
230 uint64_t ffree;
231 uint32_t bsize;
232 uint32_t namelen;
233 uint32_t frsize;
234 uint32_t padding;
235 uint32_t spare[6];
236};
237
238struct fuse_statfs_out {
239 struct fuse_kstatfs st;
240};
241
242struct fuse_fsync_in {
243 uint64_t fh;
244 uint32_t fsync_flags; //XXX
245 uint32_t padding;
246};
247
248struct fuse_init_in {
249 uint32_t major;
250 uint32_t minor;
251 uint32_t max_readahead;
252 uint32_t flags;
253};
254
255struct fuse_init_out {
256 uint32_t major;
257 uint32_t minor;
258 uint32_t max_readahead; /* Not implemented */
259 uint32_t flags; /* Not implemented */
260 uint16_t max_background; /* Not implemented */
261 uint16_t congestion_threshold; /* Not implemented */
262 uint32_t max_write;
263};
264
265struct fuse_in_header {
266 uint32_t len;
267 uint32_t opcode;
268 uint64_t unique;
269 uint64_t nodeid;
270 uint32_t uid;
271 uint32_t gid;
272 uint32_t pid;
273 uint32_t padding;
274};
275
276struct fuse_out_header {
277 uint32_t len;
278 int32_t error;
279 uint64_t unique;
280};
281
282struct fuse_dirent {
283 uint64_t ino;
284 uint64_t off;
285 uint32_t namelen;
286 uint32_t type;
287 char name[]; /* unterminated string */
288};
289
290#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
291#define FUSE_DIRENT_ALIGN(x) \
292 (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
293#define FUSE_DIRENT_SIZE(d) \
294 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
139295
140#ifdef _KERNEL296#ifdef _KERNEL
141297
298/*
299 * An operation is issued by the kernel through fuse(4) when the
300 * userland file system needs to execute an action (mkdir(2),
301 * link(2), etc).
302 *
303 * When the userland file system answers to this operation it uses
304 * the same ID (fb_uuid).
305 */
306struct fusebuf {
307 SIMPLEQ_ENTRY(fusebuf) next; /* next buffer in chain */
308 struct fuse_in_header hdr;
309 int32_t error; /* error returned by daemon */
310 size_t op_in_len; /* size of input */
311 size_t op_out_len; /* size of output */
312 uint8_t op_out_buf; /* whether to expect data */
313 union {
314 union {
315 struct fuse_forget_in forget;
316 struct fuse_getattr_in getattr;
317 struct fuse_setattr_in setattr;
318 struct fuse_mknod_in mknod;
319 struct fuse_mkdir_in mkdir;
320 struct fuse_rename_in rename;
321 struct fuse_link_in link;
322 struct fuse_open_in open;
323 struct fuse_read_in read;
324 struct fuse_write_in write;
325 struct fuse_release_in release;
326 struct fuse_fsync_in fsync;
327 struct fuse_flush_in flush;
328 struct fuse_init_in init;
329 } in;
330 union {
331 struct fuse_entry_out entry;
332 struct fuse_attr_out attr;
333 struct fuse_open_out open;
334 struct fuse_write_out write;
335 struct fuse_statfs_out statfs;
336 struct fuse_init_out init;
337 } out;
338 } op;
339 uint64_t dat_len;
340 uint8_t *dat;
341};
342
343#define fb_dat dat
344#define fb_next next
345#define fb_err error
346#define fb_len dat_len
347#define fb_type hdr.opcode
348#define fb_uuid hdr.unique
349#define fb_ino hdr.nodeid
350#define fb_tid hdr.pid
351#define fb_uid hdr.uid
352#define fb_gid hdr.gid
353
142/* fusebuf prototypes */354/* fusebuf prototypes */
143struct fusebuf *fb_setup(size_t, ino_t, int, struct proc *);355struct fusebuf *fb_setup(size_t, ino_t, int, struct proc *);
144int fb_queue(dev_t, struct fusebuf *);356int fb_queue(dev_t, struct fusebuf *);
145void fb_delete(struct fusebuf *);357void fb_delete(struct fusebuf *);
146358
359#else /* _KERNEL */
360
361/*
362 * Userland fusebuf more directly maps to the protocol binary layout for each
363 * file operation request (input). This consists of a header followed by an
364 * optional input struct with data immediately following either the header or
365 * input struct.
366 *
367 * FUSE_LOOKUP: hdr, dat (filename)
368 * FUSE_GETATTR: hdr, getattr
369 * FUSE_SETATTR: hdr, setattr
370 * FUSE_READLINK: hdr
371 * FUSE_SYMLINK: hdr, dat (source\0target)
372 * FUSE_MKNOD: hdr, mknod, dat (filename)
373 * FUSE_MKDIR: hdr, mkdir, dat (dirname)
374 * FUSE_UNLINK: hdr, dat (filename)
375 * FUSE_RMDIR: hdr, dat (dirname)
376 * FUSE_RENAME: hdr, rename, dat (oldname\0newname)
377 * FUSE_LINK: hdr, dat (source\0target)
378 * FUSE_OPEN: hdr, open
379 * FUSE_READ: hdr, read
380 * FUSE_WRITE: hdr, write, dat
381 * FUSE_STATFS: hdr, statfs
382 * FUSE_RELEASE: hdr, release
383 * FUSE_FSYNC: hdr, fsync
384 * FUSE_FLUSH: hdr, flush
385 * FUSE_INIT: hdr, init
386 * FUSE_OPENDIR: hdr, open
387 * FUSE_READDIR: hdr, read
388 * FUSE_RELEASEDIR: hdr, release
389 * FUSE_DESTROY: hdr
390 * FUSE_FORGET: hdr, forget
391 */
392struct fusebuf {
393 struct fuse_in_header hdr;
394 union {
395 struct fuse_forget_in forget;
396 struct fuse_getattr_in getattr;
397 struct fuse_setattr_in setattr;
398 struct fuse_mknod_in mknod;
399 struct fuse_mkdir_in mkdir;
400 struct fuse_rename_in rename;
401 struct fuse_link_in link;
402 struct fuse_open_in open;
403 struct fuse_read_in read;
404 struct fuse_write_in write;
405 struct fuse_release_in release;
406 struct fuse_fsync_in fsync;
407 struct fuse_flush_in flush;
408 struct fuse_init_in init;
409 } in;
410};
411
412#define fb_type hdr.opcode
413#define fb_uuid hdr.unique
414#define fb_ino hdr.nodeid
415#define fb_tid hdr.pid
416#define fb_uid hdr.uid
417#define fb_gid hdr.gid
418
419/*
420 * Macro to get the additional data for operations that have it.
421 * The data starts immediately after the related input struct.
422 */
423#define fb_dat(in) (((char *)&(in)) + sizeof(in))
424
147#endif /* _KERNEL */425#endif /* _KERNEL */
148#endif /* _SYS_FUSEBUF_H_ */426#endif /* _SYS_FUSEBUF_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/sys/hibernate.h+5-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: hibernate.h,v 1.51 2025/07/05 09:24:37 jsg Exp $ */1/* $OpenBSD: hibernate.h,v 1.52 2026/09/06 18:26:41 mglocker Exp $ */
22
3/*3/*
4 * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>4 * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
...@@ -150,6 +150,10 @@ void hibernate_unpack_image(union hibernate_info *);...@@ -150,6 +150,10 @@ void hibernate_unpack_image(union hibernate_info *);
150void hibernate_populate_resume_pt(union hibernate_info *, paddr_t, paddr_t);150void hibernate_populate_resume_pt(union hibernate_info *, paddr_t, paddr_t);
151int hibernate_alloc(void);151int hibernate_alloc(void);
152void hibernate_free(void);152void hibernate_free(void);
153
154/* MD pmap setup/teardown for suspend-time HIBERNATE_HIBALLOC_PAGE access. */
155int hibernate_pmap_setup_md(void);
156void hibernate_pmap_teardown_md(void);
153void hib_getentropy(char **, size_t *);157void hib_getentropy(char **, size_t *);
154158
155int hibernate_write(union hibernate_info *, daddr_t, vaddr_t, size_t, int);159int hibernate_write(union hibernate_info *, daddr_t, vaddr_t, size_t, int);
lib/libc/include/generic-openbsd/sys/limits.h+1-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: limits.h,v 1.10 2012/06/30 20:21:10 guenther Exp $ */1/* $OpenBSD: limits.h,v 1.11 2026/09/26 15:02:53 deraadt Exp $ */
2/*2/*
3 * Copyright (c) 2002 Marc Espie.3 * Copyright (c) 2002 Marc Espie.
4 *4 *
...@@ -79,11 +79,6 @@...@@ -79,11 +79,6 @@
79 /* min value for a signed long long */79 /* min value for a signed long long */
80#endif80#endif
8181
82#if __BSD_VISIBLE
83# define UID_MAX UINT_MAX /* max value for a uid_t */
84# define GID_MAX UINT_MAX /* max value for a gid_t */
85#endif
86
87#if __XPG_VISIBLE || __POSIX_VISIBLE >= 20080982#if __XPG_VISIBLE || __POSIX_VISIBLE >= 200809
88# ifdef __LP64__83# ifdef __LP64__
89# define LONG_BIT 6484# define LONG_BIT 64
lib/libc/include/generic-openbsd/sys/mbuf.h+16-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mbuf.h,v 1.269 2026/02/05 03:26:00 dlg Exp $ */1/* $OpenBSD: mbuf.h,v 1.271 2026/07/03 11:51:57 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/*
...@@ -145,8 +145,6 @@ struct mbuf_ext {...@@ -145,8 +145,6 @@ struct mbuf_ext {
145 void *ext_arg;145 void *ext_arg;
146 u_int ext_free_fn; /* index of free function */146 u_int ext_free_fn; /* index of free function */
147 u_int ext_size; /* size of buffer, for ext_free_fn */147 u_int ext_size; /* size of buffer, for ext_free_fn */
148 struct mbuf *ext_nextref;
149 struct mbuf *ext_prevref;
150#ifdef DEBUG148#ifdef DEBUG
151 const char *ext_ofile;149 const char *ext_ofile;
152 const char *ext_nfile;150 const char *ext_nfile;
...@@ -282,13 +280,22 @@ struct mbuf {...@@ -282,13 +280,22 @@ struct mbuf {
282#define MCLREFDEBUGO(m, file, line)280#define MCLREFDEBUGO(m, file, line)
283#endif281#endif
284282
285#define MCLISREFERENCED(m) ((m)->m_ext.ext_nextref != (m))283int m_ext_refs_shared(struct mbuf *);
286284
287#define MCLADDREFERENCE(o, n) m_extref((o), (n))285static inline int
286m_extreferenced(struct mbuf *m)
287{
288 extern u_int m_extfree_refs_fn;
289
290 if (m->m_ext.ext_free_fn != m_extfree_refs_fn)
291 return (0);
292
293 return (m_ext_refs_shared(m));
294}
295
296#define MCLISREFERENCED(m) m_extreferenced(m)
288297
289#define MCLINITREFERENCE(m) do { \298#define MCLINITREFERENCE(m) do { \
290 (m)->m_ext.ext_prevref = (m); \
291 (m)->m_ext.ext_nextref = (m); \
292 MCLREFDEBUGO((m), __FILE__, __LINE__); \299 MCLREFDEBUGO((m), __FILE__, __LINE__); \
293 MCLREFDEBUGN((m), NULL, 0); \300 MCLREFDEBUGN((m), NULL, 0); \
294 } while (/* CONSTCOND */ 0)301 } while (/* CONSTCOND */ 0)
...@@ -439,8 +446,8 @@ int m_leadingspace(struct mbuf *);...@@ -439,8 +446,8 @@ int m_leadingspace(struct mbuf *);
439int m_trailingspace(struct mbuf *);446int m_trailingspace(struct mbuf *);
440void m_align(struct mbuf *, int);447void m_align(struct mbuf *, int);
441struct mbuf *m_clget(struct mbuf *, int, u_int);448struct mbuf *m_clget(struct mbuf *, int, u_int);
442void m_extref(struct mbuf *, struct mbuf *);
443void m_pool_init(struct pool *, u_int, u_int, const char *);449void m_pool_init(struct pool *, u_int, u_int, const char *);
450void m_pool_noconstraints(void);
444u_int m_pool_used(void);451u_int m_pool_used(void);
445void m_extfree_pool(caddr_t, u_int, void *);452void m_extfree_pool(caddr_t, u_int, void *);
446void m_adj(struct mbuf *, int);453void m_adj(struct mbuf *, int);
...@@ -454,8 +461,8 @@ int m_apply(struct mbuf *, int, int,...@@ -454,8 +461,8 @@ int m_apply(struct mbuf *, int, int,
454 int (*)(caddr_t, caddr_t, unsigned int), caddr_t);461 int (*)(caddr_t, caddr_t, unsigned int), caddr_t);
455struct mbuf *m_dup_pkt(struct mbuf *, unsigned int, int);462struct mbuf *m_dup_pkt(struct mbuf *, unsigned int, int);
456int m_dup_pkthdr(struct mbuf *, struct mbuf *, int);463int m_dup_pkthdr(struct mbuf *, struct mbuf *, int);
457
458void m_microtime(const struct mbuf *, struct timeval *);464void m_microtime(const struct mbuf *, struct timeval *);
465void mbuf_dma_64bit_enable(void);
459466
460static inline struct mbuf *467static inline struct mbuf *
461m_freemp(struct mbuf **mp)468m_freemp(struct mbuf **mp)
lib/libc/include/generic-openbsd/sys/mount.h+1-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: mount.h,v 1.153 2025/01/02 01:19:22 dlg Exp $ */1/* $OpenBSD: mount.h,v 1.154 2026/06/10 00:04:38 beck Exp $ */
2/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */2/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
33
4/*4/*
...@@ -478,14 +478,9 @@ struct bcachestats {...@@ -478,14 +478,9 @@ struct bcachestats {
478 int64_t numreads; /* total reads started */478 int64_t numreads; /* total reads started */
479 int64_t cachehits; /* total reads found in cache */479 int64_t cachehits; /* total reads found in cache */
480 int64_t busymapped; /* number of busy and mapped buffers */480 int64_t busymapped; /* number of busy and mapped buffers */
481 int64_t dmapages; /* dma reachable pages in buffer cache */
482 int64_t highpages; /* pages above dma region */
483 int64_t delwribufs; /* delayed write buffers */481 int64_t delwribufs; /* delayed write buffers */
484 int64_t kvaslots; /* kva slots total */482 int64_t kvaslots; /* kva slots total */
485 int64_t kvaslots_avail; /* available kva slots */483 int64_t kvaslots_avail; /* available kva slots */
486 int64_t highflips; /* total flips to above DMA */
487 int64_t highflops; /* total failed flips to above DMA */
488 int64_t dmaflips; /* total flips from high to DMA */
489};484};
490#ifdef _KERNEL485#ifdef _KERNEL
491extern struct bcachestats bcstats;486extern struct bcachestats bcstats;
lib/libc/include/generic-openbsd/sys/msg.h+4-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: msg.h,v 1.24 2024/10/27 22:08:25 jsg Exp $ */1/* $OpenBSD: msg.h,v 1.26 2026/07/08 19:39:33 mvs Exp $ */
2/* $NetBSD: msg.h,v 1.9 1996/02/09 18:25:18 christos Exp $ */2/* $NetBSD: msg.h,v 1.9 1996/02/09 18:25:18 christos Exp $ */
33
4/*4/*
...@@ -77,7 +77,9 @@ struct que {...@@ -77,7 +77,9 @@ struct que {
77/* for que_flags */77/* for que_flags */
78#define MSGQ_READERS 0x0178#define MSGQ_READERS 0x01
79#define MSGQ_WRITERS 0x0279#define MSGQ_WRITERS 0x02
80#define MSGQ_DYING 0x0480#define MSGQ_RCVWAIT 0x04
81#define MSGQ_RCVWAITING 0x08
82#define MSGQ_DYING 0x10
8183
82#define QREF(q) (q)->que_references++84#define QREF(q) (q)->que_references++
8385
...@@ -104,9 +106,6 @@ struct msginfo {...@@ -104,9 +106,6 @@ struct msginfo {
104 msgssz, /* size of a message segment (see notes above) */106 msgssz, /* size of a message segment (see notes above) */
105 msgseg; /* number of message segments */107 msgseg; /* number of message segments */
106};108};
107#ifdef SYSVMSG
108extern struct msginfo msginfo;
109#endif
110109
111int sysctl_sysvmsg(int *, u_int, void *, size_t *);110int sysctl_sysvmsg(int *, u_int, void *, size_t *);
112111
lib/libc/include/generic-openbsd/sys/namei.h+6-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: namei.h,v 1.51 2026/03/08 16:41:19 deraadt Exp $ */1/* $OpenBSD: namei.h,v 1.55 2026/09/17 18:51:39 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/*
...@@ -51,13 +51,9 @@ struct nameidata {...@@ -51,13 +51,9 @@ struct nameidata {
51 const char *ni_dirp; /* pathname pointer */51 const char *ni_dirp; /* pathname pointer */
52 int ni_dirfd; /* dirfd from *at() functions */52 int ni_dirfd; /* dirfd from *at() functions */
53 enum uio_seg ni_segflg; /* location of pathname */53 enum uio_seg ni_segflg; /* location of pathname */
54 /* u_long ni_nameiop; namei operation */
55 /* u_long ni_flags; flags to namei */
56 /* struct proc *ni_proc; process requesting lookup */
57 /*54 /*
58 * Arguments to lookup.55 * Arguments to lookup.
59 */56 */
60 /* struct ucred *ni_cred; credentials */
61 struct vnode *ni_startdir; /* starting directory */57 struct vnode *ni_startdir; /* starting directory */
62 struct vnode *ni_rootdir; /* logical root directory */58 struct vnode *ni_rootdir; /* logical root directory */
63 uint64_t ni_pledge; /* expected pledge for namei */59 uint64_t ni_pledge; /* expected pledge for namei */
...@@ -144,11 +140,14 @@ struct nameidata {...@@ -144,11 +140,14 @@ struct nameidata {
144#define ISLASTCN 0x008000 /* this is last component of pathname */140#define ISLASTCN 0x008000 /* this is last component of pathname */
145#define ISSYMLINK 0x010000 /* symlink needs interpretation */141#define ISSYMLINK 0x010000 /* symlink needs interpretation */
146#define REALPATH 0x020000 /* save pathname buffer for realpath */142#define REALPATH 0x020000 /* save pathname buffer for realpath */
143#define BPU_LOCALTIME 0x040000 /* /etc/localtime may cross 1 symlink */
147#define REQUIREDIR 0x080000 /* must be a directory */144#define REQUIREDIR 0x080000 /* must be a directory */
148#define STRIPSLASHES 0x100000 /* strip trailing slashes */145#define STRIPSLASHES 0x100000 /* strip trailing slashes */
149#define PDIRUNLOCK 0x200000 /* vfs_lookup() unlocked parent dir */146#define PDIRUNLOCK 0x200000 /* vfs_lookup() unlocked parent dir */
150#define BYPASSUNVEIL 0x400000 /* bypass pledgepath check */147#define BYPASSUNVEIL 0x400000 /* bypass pledgepath check */
151#define KERNELPATH 0x800000 /* access file as kernel, not process */148#define KERNELPATH 0x800000 /* access file as kernel, not process */
149#define BPU_ZONEINFO 0x1000000 /* /usr/share/zoneinfo prohibits symlinks */
150#define EXECPATH 0x2000000 /* like REALPATH, but can give up */
152151
153/*152/*
154 * Initialization of an nameidata structure.153 * Initialization of an nameidata structure.
...@@ -209,6 +208,7 @@ struct unveil *unveil_lookup(struct vnode *, struct process *, ssize_t *);...@@ -209,6 +208,7 @@ struct unveil *unveil_lookup(struct vnode *, struct process *, ssize_t *);
209void unveil_start_relative(struct proc *, struct nameidata *, struct vnode *);208void unveil_start_relative(struct proc *, struct nameidata *, struct vnode *);
210void unveil_check_component(struct proc *, struct nameidata *, struct vnode *);209void unveil_check_component(struct proc *, struct nameidata *, struct vnode *);
211int unveil_check_final(struct proc *, struct nameidata *);210int unveil_check_final(struct proc *, struct nameidata *);
211int checkzoneinfopath(const char *);
212212
213extern struct pool namei_pool;213extern struct pool namei_pool;
214214
...@@ -269,7 +269,7 @@ struct nchstats {...@@ -269,7 +269,7 @@ struct nchstats {
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_PLEDGEOPEN 0X20272#define UNVEIL_PLEDGEOPEN 0x20
273#define UNVEIL_MASK 0x0f273#define UNVEIL_MASK 0x0f
274274
275#endif /* !_SYS_NAMEI_H_ */275#endif /* !_SYS_NAMEI_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/sys/param.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: param.h,v 1.146 2026/03/11 02:27:20 deraadt Exp $ */1/* $OpenBSD: param.h,v 1.147 2026/07/16 06:21:08 deraadt Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1982, 1986, 1989, 19934 * Copyright (c) 1982, 1986, 1989, 1993
...@@ -220,4 +220,4 @@...@@ -220,4 +220,4 @@
220#endif220#endif
221#define FSCALE (1<<_FSHIFT)221#define FSCALE (1<<_FSHIFT)
222222
223#endif /* !_SYS_PARAM_H_ */223#endif /* !_SYS_PARAM_H_ */
\ No newline at end of file
lib/libc/include/generic-openbsd/sys/pledge.h+4-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pledge.h,v 1.53 2026/02/26 07:42:25 deraadt Exp $ */1/* $OpenBSD: pledge.h,v 1.55 2026/09/19 17:21:52 dv Exp $ */
22
3/*3/*
4 * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>4 * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
...@@ -124,11 +124,12 @@ int pledge_sysctl(struct proc *p, int namelen, int *name, void *new);...@@ -124,11 +124,12 @@ int pledge_sysctl(struct proc *p, int namelen, int *name, void *new);
124int pledge_chown(struct proc *p, uid_t, gid_t);124int pledge_chown(struct proc *p, uid_t, gid_t);
125int pledge_adjtime(struct proc *p, const void *v);125int pledge_adjtime(struct proc *p, const void *v);
126int pledge_sendit(struct proc *p, const void *to);126int pledge_sendit(struct proc *p, const void *to);
127int pledge_sockopt(struct proc *p, int set, int level, int optname);127struct protosw;
128int pledge_sockopt(struct proc *p, int set, const struct protosw *pr,
129 int level, int optname);
128int pledge_socket(struct proc *p, int domain, unsigned int state);130int pledge_socket(struct proc *p, int domain, unsigned int state);
129int pledge_ioctl(struct proc *p, long com, struct file *);131int pledge_ioctl(struct proc *p, long com, struct file *);
130int pledge_ioctl_drm(struct proc *p, long com, dev_t device);132int pledge_ioctl_drm(struct proc *p, long com, dev_t device);
131int pledge_ioctl_vmm(struct proc *p, long com);
132int pledge_ioctl_psp(struct proc *p, long com);133int pledge_ioctl_psp(struct proc *p, long com);
133int pledge_flock(struct proc *p);134int pledge_flock(struct proc *p);
134int pledge_fcntl(struct proc *p, int cmd);135int pledge_fcntl(struct proc *p, int cmd);
lib/libc/include/generic-openbsd/sys/proc.h+3-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: proc.h,v 1.397 2025/08/18 04:15:35 dlg Exp $ */1/* $OpenBSD: proc.h,v 1.401 2026/09/19 17:53:49 gnezdo Exp $ */
2/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */2/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
33
4/*-4/*-
...@@ -52,6 +52,7 @@...@@ -52,6 +52,7 @@
52#include <sys/sigio.h> /* For struct sigio */52#include <sys/sigio.h> /* For struct sigio */
53#include <sys/refcnt.h> /* For struct refcnt */53#include <sys/refcnt.h> /* For struct refcnt */
54#include <sys/pclock.h>54#include <sys/pclock.h>
55#include <sys/ptrace.h> /* For struct ptrace_state */
5556
56#ifdef _KERNEL57#ifdef _KERNEL
57#include <sys/atomic.h>58#include <sys/atomic.h>
...@@ -207,7 +208,7 @@ struct process {...@@ -207,7 +208,7 @@ struct process {
207208
208 pid_t ps_ppid; /* [K|m] Cached parent pid */209 pid_t ps_ppid; /* [K|m] Cached parent pid */
209 int ps_ptmask; /* Ptrace event mask */210 int ps_ptmask; /* Ptrace event mask */
210 struct ptrace_state *ps_ptstat;/* Ptrace state */211 struct ptrace_state ps_ptstat; /* Ptrace state */
211 struct process *ps_opptr; /* [K|m] Old parent during ptrace. */212 struct process *ps_opptr; /* [K|m] Old parent during ptrace. */
212213
213 struct rusage *ps_ru; /* sum of stats for dead threads. */214 struct rusage *ps_ru; /* sum of stats for dead threads. */
lib/libc/include/generic-openbsd/sys/queue.h+3-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: queue.h,v 1.46 2020/12/30 13:33:12 millert Exp $ */1/* $OpenBSD: queue.h,v 1.47 2026/06/12 01:04:42 millert Exp $ */
2/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */2/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
33
4/*4/*
...@@ -589,9 +589,9 @@ struct { \...@@ -589,9 +589,9 @@ struct { \
589} while (0)589} while (0)
590590
591#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \591#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
592 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((elm), field)) == NULL)\592 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((listelm), field)) == NULL)\
593 (head)->stqh_last = &STAILQ_NEXT((elm), field); \593 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
594 STAILQ_NEXT((elm), field) = (elm); \594 STAILQ_NEXT((listelm), field) = (elm); \
595} while (0)595} while (0)
596596
597#define STAILQ_REMOVE_HEAD(head, field) do { \597#define STAILQ_REMOVE_HEAD(head, field) do { \
lib/libc/include/generic-openbsd/sys/sem.h+20-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: sem.h,v 1.26 2024/10/26 05:39:03 jsg Exp $ */1/* $OpenBSD: sem.h,v 1.31 2026/08/20 16:14:20 sthen Exp $ */
2/* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */2/* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */
33
4/*4/*
...@@ -103,6 +103,7 @@ union semun {...@@ -103,6 +103,7 @@ union semun {
103103
104#ifdef _KERNEL104#ifdef _KERNEL
105#include <sys/queue.h>105#include <sys/queue.h>
106#include <sys/refcnt.h>
106107
107/*108/*
108 * Kernel implementation stuff109 * Kernel implementation stuff
...@@ -110,6 +111,20 @@ union semun {...@@ -110,6 +111,20 @@ union semun {
110#define SEMVMX 32767 /* semaphore maximum value */111#define SEMVMX 32767 /* semaphore maximum value */
111#define SEMAEM 16384 /* adjust on exit max value */112#define SEMAEM 16384 /* adjust on exit max value */
112113
114/*
115 * In-kernel semaphore implementation
116 */
117struct semid_ds_kern {
118 struct ipc_perm sem_perm; /* operation permission struct */
119 struct sem *sem_base; /* pointer to first semaphore in set */
120 unsigned short sem_nsems; /* number of sems in set */
121 time_t sem_otime; /* last operation time */
122 time_t sem_ctime; /* last change time */
123 /* Times measured in secs since */
124 /* 00:00:00 GMT, Jan. 1, 1970 */
125 struct refcnt sem_refcnt;
126};
127
113/*128/*
114 * Undo structure (one per process)129 * Undo structure (one per process)
115 */130 */
...@@ -144,16 +159,17 @@ struct sem_sysctl_info {...@@ -144,16 +159,17 @@ struct sem_sysctl_info {
144 struct semid_ds semids[1];159 struct semid_ds semids[1];
145};160};
146161
162extern struct rwlock sysvsem_lock;
147extern struct seminfo seminfo;163extern struct seminfo seminfo;
148164
149/*165/*
150 * Configuration parameters166 * Configuration parameters
151 */167 */
152#ifndef SEMMNI168#ifndef SEMMNI
153#define SEMMNI 10 /* # of semaphore identifiers */169#define SEMMNI 25 /* # of semaphore identifiers */
154#endif170#endif
155#ifndef SEMMNS171#ifndef SEMMNS
156#define SEMMNS 60 /* # of semaphores in system */172#define SEMMNS 350 /* # of semaphores in system */
157#endif173#endif
158#ifndef SEMUME174#ifndef SEMUME
159#define SEMUME 10 /* max # of undo entries per process */175#define SEMUME 10 /* max # of undo entries per process */
...@@ -173,7 +189,7 @@ extern struct seminfo seminfo;...@@ -173,7 +189,7 @@ extern struct seminfo seminfo;
173/* actual size of an undo structure */189/* actual size of an undo structure */
174#define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME)190#define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME)
175191
176extern struct semid_ds **sema; /* semaphore id list */192extern struct semid_ds_kern **sema; /* semaphore id list */
177193
178void seminit(void);194void seminit(void);
179void semexit(struct process *);195void semexit(struct process *);
lib/libc/include/generic-openbsd/sys/shm.h+18-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: shm.h,v 1.31 2024/10/26 05:39:03 jsg Exp $ */1/* $OpenBSD: shm.h,v 1.33 2026/09/16 16:37:39 mvs Exp $ */
2/* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */2/* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */
33
4/*4/*
...@@ -126,8 +126,24 @@ struct shm_sysctl_info {...@@ -126,8 +126,24 @@ struct shm_sysctl_info {
126#endif /* __BSD_VISIBLE */126#endif /* __BSD_VISIBLE */
127127
128#ifdef _KERNEL128#ifdef _KERNEL
129extern struct rwlock sysvshm_lock;
129extern struct shminfo shminfo;130extern struct shminfo shminfo;
130extern struct shmid_ds **shmsegs;131extern struct shmid_ds_kern **shmsegs;
132
133struct shmid_ds_kern {
134 struct ipc_perm shm_perm; /* operation permission structure */
135 int shm_segsz; /* size of segment in bytes */
136 pid_t shm_lpid; /* process ID of last shm op */
137 pid_t shm_cpid; /* process ID of creator */
138 uint64_t shm_nattch; /* number of current attaches */
139 time_t shm_atime; /* time of last shmat() */
140 long __shm_atimensec;
141 time_t shm_dtime; /* time of last shmdt() */
142 long __shm_dtimensec;
143 time_t shm_ctime; /* time of last change by shmctl() */
144 long __shm_ctimensec;
145 void *shm_internal; /* implementation specific data */
146};
131147
132struct vmspace;148struct vmspace;
133149
lib/libc/include/generic-openbsd/sys/socketvar.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: socketvar.h,v 1.160 2025/10/24 15:09:56 bluhm Exp $ */1/* $OpenBSD: socketvar.h,v 1.161 2026/06/11 12:50:52 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/*-
...@@ -68,7 +68,7 @@ TAILQ_HEAD(soqhead, socket);...@@ -68,7 +68,7 @@ TAILQ_HEAD(soqhead, socket);
68 */68 */
69struct sosplice {69struct sosplice {
70 struct socket *ssp_socket; /* [mr ms] send data to drain socket */70 struct socket *ssp_socket; /* [mr ms] send data to drain socket */
71 struct socket *ssp_soback; /* [ms ms] back ref to source socket */71 struct socket *ssp_soback; /* [mr ms] back ref to source socket */
72 off_t ssp_len; /* [mr] number of bytes spliced */72 off_t ssp_len; /* [mr] number of bytes spliced */
73 off_t ssp_max; /* [I] maximum number of bytes */73 off_t ssp_max; /* [I] maximum number of bytes */
74 struct timeval ssp_idletv; /* [I] idle timeout */74 struct timeval ssp_idletv; /* [I] idle timeout */
lib/libc/include/generic-openbsd/sys/syscall.h+4-6
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1/* $OpenBSD: syscall.h,v 1.284 2026/03/08 16:41:35 deraadt Exp $ */1/* $OpenBSD: syscall.h,v 1.286 2026/08/12 15:05:21 naddy 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.271 2026/03/08 16:41:21 deraadt Exp 7 * created from; OpenBSD: syscalls.master,v 1.272 2026/06/02 21:46:21 deraadt Exp
8 */8 */
99
10/* syscall: "exit" ret: "void" args: "int" */10/* syscall: "exit" ret: "void" args: "int" */
...@@ -426,7 +426,7 @@...@@ -426,7 +426,7 @@
426/* syscall: "setsid" ret: "int" args: */426/* syscall: "setsid" ret: "int" args: */
427#define SYS_setsid 147427#define SYS_setsid 147
428428
429/* syscall: "quotactl" ret: "int" args: "const char *" "int" "int" "char *" */429/* syscall: "quotactl" ret: "int" args: "const char *" "int" "int" "void *" */
430#define SYS_quotactl 148430#define SYS_quotactl 148
431431
432 /* 149 is obsolete oquota */432 /* 149 is obsolete oquota */
...@@ -452,9 +452,7 @@...@@ -452,9 +452,7 @@
452452
453 /* 162 is obsolete ogetdomainname */453 /* 162 is obsolete ogetdomainname */
454 /* 163 is obsolete osetdomainname */454 /* 163 is obsolete osetdomainname */
455/* syscall: "__tmpfd" ret: "int" args: "int" */455 /* 164 is obsolete __tmpfd */
456#define SYS___tmpfd 164
457
458/* syscall: "sysarch" ret: "int" args: "int" "void *" */456/* syscall: "sysarch" ret: "int" args: "int" "void *" */
459#define SYS_sysarch 165457#define SYS_sysarch 165
460458
lib/libc/include/generic-openbsd/sys/syscallargs.h+3-8
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1/* $OpenBSD: syscallargs.h,v 1.287 2026/03/08 16:41:35 deraadt Exp $ */1/* $OpenBSD: syscallargs.h,v 1.289 2026/08/12 15:05:21 naddy 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.271 2026/03/08 16:41:21 deraadt Exp 7 * created from; OpenBSD: syscalls.master,v 1.272 2026/06/02 21:46:21 deraadt Exp
8 */8 */
99
10#ifdef syscallarg10#ifdef syscallarg
...@@ -726,7 +726,7 @@ struct sys_quotactl_args {...@@ -726,7 +726,7 @@ struct sys_quotactl_args {
726 syscallarg(const char *) path;726 syscallarg(const char *) path;
727 syscallarg(int) cmd;727 syscallarg(int) cmd;
728 syscallarg(int) uid;728 syscallarg(int) uid;
729 syscallarg(char *) arg;729 syscallarg(void *) arg;
730};730};
731731
732struct sys_ypconnect_args {732struct sys_ypconnect_args {
...@@ -762,10 +762,6 @@ struct sys_getfh_args {...@@ -762,10 +762,6 @@ struct sys_getfh_args {
762 syscallarg(fhandle_t *) fhp;762 syscallarg(fhandle_t *) fhp;
763};763};
764764
765struct sys___tmpfd_args {
766 syscallarg(int) flags;
767};
768
769struct sys_sysarch_args {765struct sys_sysarch_args {
770 syscallarg(int) op;766 syscallarg(int) op;
771 syscallarg(void *) parms;767 syscallarg(void *) parms;
...@@ -1323,7 +1319,6 @@ int sys_pinsyscalls(struct proc *, void *, register_t *);...@@ -1323,7 +1319,6 @@ int sys_pinsyscalls(struct proc *, void *, register_t *);
1323int sys_mimmutable(struct proc *, void *, register_t *);1319int sys_mimmutable(struct proc *, void *, register_t *);
1324int sys_waitid(struct proc *, void *, register_t *);1320int sys_waitid(struct proc *, void *, register_t *);
1325int sys_getfh(struct proc *, void *, register_t *);1321int sys_getfh(struct proc *, void *, register_t *);
1326int sys___tmpfd(struct proc *, void *, register_t *);
1327int sys_sysarch(struct proc *, void *, register_t *);1322int sys_sysarch(struct proc *, void *, register_t *);
1328int sys_lseek(struct proc *, void *, register_t *);1323int sys_lseek(struct proc *, void *, register_t *);
1329int sys_truncate(struct proc *, void *, register_t *);1324int sys_truncate(struct proc *, void *, register_t *);
lib/libc/include/generic-openbsd/sys/systm.h+1-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: systm.h,v 1.177 2025/07/28 05:08:35 dlg Exp $ */1/* $OpenBSD: systm.h,v 1.179 2026/04/22 01:51:37 jsg Exp $ */
2/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */2/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
33
4/*-4/*-
...@@ -149,8 +149,6 @@ extern void (*v_putc)(int); /* Virtual console putc routine */...@@ -149,8 +149,6 @@ extern void (*v_putc)(int); /* Virtual console putc routine */
149 */149 */
150int nullop(void *);150int nullop(void *);
151int enodev(void);151int enodev(void);
152int enosys(void);
153int enoioctl(void);
154int enxio(void);152int enxio(void);
155int eopnotsupp(void *);153int eopnotsupp(void *);
156154
lib/libc/include/generic-openbsd/sys/tty.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: tty.h,v 1.45 2025/09/25 08:46:50 mvs Exp $ */1/* $OpenBSD: tty.h,v 1.46 2026/08/06 20:38:02 claudio Exp $ */
2/* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */2/* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */
33
4/*-4/*-
...@@ -146,7 +146,7 @@ struct itty {...@@ -146,7 +146,7 @@ struct itty {
146 short t_lowat;146 short t_lowat;
147 short t_column;147 short t_column;
148 int t_state;148 int t_state;
149 struct session *t_session;149 pid_t t_session_id;
150 pid_t t_pgrp_pg_id;150 pid_t t_pgrp_pg_id;
151 u_char t_line;151 u_char t_line;
152};152};
lib/libc/include/generic-openbsd/sys/videoio.h+7-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: videoio.h,v 1.29 2026/02/19 20:42:45 kirill Exp $ */1/* $OpenBSD: videoio.h,v 1.31 2026/09/13 11:04:09 kirill Exp $ */
22
3/*3/*
4 * Video for Linux Two header file4 * Video for Linux Two header file
...@@ -577,6 +577,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type {...@@ -577,6 +577,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type {
577 V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,577 V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
578};578};
579579
580#define V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (V4L2_CID_CODEC_BASE + 238)
581
580/* CIDs for the MPEG-2 Part 2 (H.262) codec */582/* CIDs for the MPEG-2 Part 2 (H.262) codec */
581#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)583#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)
582enum v4l2_mpeg_video_mpeg2_level {584enum v4l2_mpeg_video_mpeg2_level {
...@@ -4498,6 +4500,10 @@ struct v4l2_pix_format {...@@ -4498,6 +4500,10 @@ struct v4l2_pix_format {
4498#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P') /* ARM Mali-C55 Parameters */4500#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 */4501#define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S') /* ARM Mali-C55 3A Statistics */
45004502
4503/* Vendor specific - used for Dreamchip RPP-X1 ISP */
4504#define V4L2_META_FMT_RPPX1_PARAMS v4l2_fourcc('D', 'R', '1', 'P') /* Dreamchip RPP-X1 Parameters */
4505#define V4L2_META_FMT_RPPX1_STATS v4l2_fourcc('D', 'R', '1', 'S') /* Dreamchip RPP-X1 Statistics */
4506
4501/* priv field value to indicates that subsequent fields are valid. */4507/* priv field value to indicates that subsequent fields are valid. */
4502#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe4508#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
45034509
lib/libc/include/generic-openbsd/unistd.h+5-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: unistd.h,v 1.113 2025/10/07 12:02:21 brynet Exp $ */1/* $OpenBSD: unistd.h,v 1.115 2026/08/31 15:21:18 deraadt 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/*-
...@@ -346,6 +346,9 @@ char *getcwd(char *, size_t)...@@ -346,6 +346,9 @@ char *getcwd(char *, size_t)
346 __attribute__((__bounded__(__string__,1,2)));346 __attribute__((__bounded__(__string__,1,2)));
347gid_t getegid(void);347gid_t getegid(void);
348uid_t geteuid(void);348uid_t geteuid(void);
349#if __BSD_VISIBLE
350int getexecpath(char *, size_t);
351#endif
349gid_t getgid(void);352gid_t getgid(void);
350int getgroups(int, gid_t *);353int getgroups(int, gid_t *);
351char *getlogin(void);354char *getlogin(void);
...@@ -508,7 +511,7 @@ int mkstemps(char *, int);...@@ -508,7 +511,7 @@ int mkstemps(char *, int);
508int nfssvc(int, void *);511int nfssvc(int, void *);
509int profil(void *, size_t, size_t, unsigned long, unsigned int, int)512int profil(void *, size_t, size_t, unsigned long, unsigned int, int)
510 __attribute__ ((__bounded__(__string__,1,2)));513 __attribute__ ((__bounded__(__string__,1,2)));
511int quotactl(const char *, int, int, char *);514int quotactl(const char *, int, int, void *);
512int rcmd(char **, int, const char *,515int rcmd(char **, int, const char *,
513 const char *, const char *, int *);516 const char *, const char *, int *);
514int rcmd_af(char **, int, const char *,517int rcmd_af(char **, int, const char *,
lib/libc/include/generic-openbsd/uvm/uvm_extern.h+2-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_extern.h,v 1.187 2025/11/13 10:55:51 mpi Exp $ */1/* $OpenBSD: uvm_extern.h,v 1.190 2026/07/24 15:03:50 kettenis 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/*
...@@ -139,7 +139,6 @@ typedef int vm_prot_t;...@@ -139,7 +139,6 @@ typedef int vm_prot_t;
139#define UVM_PLA_NOWAIT 0x0002 /* can't sleep (need one of the two) */139#define UVM_PLA_NOWAIT 0x0002 /* can't sleep (need one of the two) */
140#define UVM_PLA_ZERO 0x0004 /* zero all pages before returning */140#define UVM_PLA_ZERO 0x0004 /* zero all pages before returning */
141#define UVM_PLA_TRYCONTIG 0x0008 /* try to allocate contig physmem */141#define UVM_PLA_TRYCONTIG 0x0008 /* try to allocate contig physmem */
142#define UVM_PLA_FAILOK 0x0010 /* caller can handle failure */
143#define UVM_PLA_NOWAKE 0x0020 /* don't wake page daemon on failure */142#define UVM_PLA_NOWAKE 0x0020 /* don't wake page daemon on failure */
144#define UVM_PLA_USERESERVE 0x0040 /* can allocate from kernel reserve */143#define UVM_PLA_USERESERVE 0x0040 /* can allocate from kernel reserve */
145144
...@@ -358,6 +357,7 @@ extern const struct kmem_pa_mode kp_zero;...@@ -358,6 +357,7 @@ extern const struct kmem_pa_mode kp_zero;
358extern const struct kmem_pa_mode kp_dma;357extern const struct kmem_pa_mode kp_dma;
359extern const struct kmem_pa_mode kp_dma_contig;358extern const struct kmem_pa_mode kp_dma_contig;
360extern const struct kmem_pa_mode kp_dma_zero;359extern const struct kmem_pa_mode kp_dma_zero;
360extern const struct kmem_pa_mode kp_mbuf_contig;
361extern const struct kmem_pa_mode kp_pageable;361extern const struct kmem_pa_mode kp_pageable;
362extern const struct kmem_pa_mode kp_none;362extern const struct kmem_pa_mode kp_none;
363363
...@@ -398,8 +398,6 @@ int uvm_pagealloc_multi(struct uvm_object *, voff_t,...@@ -398,8 +398,6 @@ int uvm_pagealloc_multi(struct uvm_object *, voff_t,
398 vsize_t, int);398 vsize_t, int);
399void uvm_pagerealloc(struct vm_page *, 399void uvm_pagerealloc(struct vm_page *,
400 struct uvm_object *, voff_t);400 struct uvm_object *, voff_t);
401int uvm_pagerealloc_multi(struct uvm_object *, voff_t,
402 vsize_t, int, struct uvm_constraint_range *);
403/* Actually, uvm_page_physload takes PF#s which need their own type */401/* Actually, uvm_page_physload takes PF#s which need their own type */
404void uvm_page_physload(paddr_t, paddr_t, paddr_t,402void uvm_page_physload(paddr_t, paddr_t, paddr_t,
405 paddr_t, int);403 paddr_t, int);
lib/libc/include/generic-openbsd/uvm/uvm_page.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_page.h,v 1.73 2025/03/10 18:54:38 mpi Exp $ */1/* $OpenBSD: uvm_page.h,v 1.74 2026/07/11 13:13:16 kettenis Exp $ */
2/* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */2/* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */
33
4/* 4/*
...@@ -158,7 +158,7 @@ struct vm_page {...@@ -158,7 +158,7 @@ struct vm_page {
158#define PQ_AOBJ 0x00200000 /* page is part of an anonymous158#define PQ_AOBJ 0x00200000 /* page is part of an anonymous
159 uvm_object */159 uvm_object */
160#define PQ_SWAPBACKED (PQ_ANON|PQ_AOBJ)160#define PQ_SWAPBACKED (PQ_ANON|PQ_AOBJ)
161#define PQ_ENCRYPT 0x00400000 /* page needs {en,de}cryption */161#define PQ_ENCRYPT 0x00400000 /* page needs {en,de}cryption */
162#define PQ_MASK 0x00ff0000162#define PQ_MASK 0x00ff0000
163163
164#define PG_PMAP0 0x01000000 /* Used by some pmaps. */164#define PG_PMAP0 0x01000000 /* Used by some pmaps. */
lib/libc/include/generic-openbsd/uvm/uvm_pager.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_pager.h,v 1.34 2025/12/18 16:05:18 mpi Exp $ */1/* $OpenBSD: uvm_pager.h,v 1.35 2026/07/07 17:32:56 kettenis 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/*
...@@ -130,6 +130,7 @@ vaddr_t uvm_pagermapin(struct vm_page **, int, int);...@@ -130,6 +130,7 @@ vaddr_t uvm_pagermapin(struct vm_page **, int, int);
130void uvm_pagermapout(vaddr_t, int);130void uvm_pagermapout(vaddr_t, int);
131struct vm_page **uvm_mk_pcluster(struct uvm_object *, struct vm_page **,131struct vm_page **uvm_mk_pcluster(struct uvm_object *, struct vm_page **,
132 int *, struct vm_page *, int, voff_t, voff_t);132 int *, struct vm_page *, int, voff_t, voff_t);
133int uvm_pseg_reserve_available(void);
133134
134/* Flags to uvm_pagermapin() */135/* Flags to uvm_pagermapin() */
135#define UVMPAGER_MAPIN_WAITOK 0x01 /* it's okay to wait */136#define UVMPAGER_MAPIN_WAITOK 0x01 /* it's okay to wait */
lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h+1-51
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_pmemrange.h,v 1.20 2026/01/28 21:09:41 deraadt Exp $ */1/* $OpenBSD: uvm_pmemrange.h,v 1.21 2026/07/24 15:03:50 kettenis 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>
...@@ -56,53 +56,6 @@ struct uvm_pmemrange {...@@ -56,53 +56,6 @@ struct uvm_pmemrange {
56 /* pmr, sorted by address */56 /* pmr, sorted by address */
57};57};
5858
59/*
60 * Description of failing memory allocation.
61 *
62 * Every descriptor corresponds to a request for the page daemon to release
63 * pages in a given memory range. There is one global descriptor for nowait
64 * allocations, all others are sitting on the stack of processes waiting for
65 * physical pages.
66 *
67 * There are multiple ways physical pages can become available:
68 * [1] unmanaged pages are released by shrinkers (bufbackoff(), drmbackoff()...)
69 * [2] page daemon drops them (we notice because they are freed)
70 * [3] a process calls free or exit
71 *
72 * The buffer cache and page daemon can decide that they don't have the
73 * ability to make pages available in the requested range. In that case,
74 * the FAIL bit will be set.
75 * XXX There's a possibility that a page is no longer on the queues but
76 * XXX has not yet been freed, or that a page was busy.
77 * XXX Also, wired pages are not considered for paging, so they could
78 * XXX cause a failure that may be recoverable.
79 *
80 * Locks used to protect struct members in this file:
81 * F uvm_lock_fpageq
82 * I immutable after creation
83 */
84struct uvm_pmalloc {
85 TAILQ_ENTRY(uvm_pmalloc) pmq; /* [F] next request */
86 struct uvm_constraint_range pm_constraint; /* [I] memory range */
87 psize_t pm_size; /* [I] # pages */
88 int pm_flags; /* [F] states flags */
89};
90
91/*
92 * Indicate to the page daemon that a nowait call failed and it should
93 * recover at least some memory in the most restricted region (assumed
94 * to be dma_constraint).
95 */
96extern struct uvm_pmalloc nowait_pma; /* [F] */
97
98
99/*
100 * uvm_pmalloc flags.
101 */
102#define UVM_PMA_LINKED 0x01 /* uvm_pmalloc is on list */
103#define UVM_PMA_FAIL 0x10 /* page daemon cannot free pages */
104#define UVM_PMA_FREED 0x20 /* at least one page in the range was freed */
105
106RBT_HEAD(uvm_pmemrange_addr, uvm_pmemrange);59RBT_HEAD(uvm_pmemrange_addr, uvm_pmemrange);
107TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange);60TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange);
10861
...@@ -112,9 +65,6 @@ TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange);...@@ -112,9 +65,6 @@ TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange);
112struct uvm_pmr_control {65struct uvm_pmr_control {
113 struct uvm_pmemrange_addr addr;66 struct uvm_pmemrange_addr addr;
114 struct uvm_pmemrange_use use;67 struct uvm_pmemrange_use use;
115
116 /* Only changed while fpageq is locked. */
117 TAILQ_HEAD(, uvm_pmalloc) allocs;
118};68};
11969
120void uvm_pmr_freepages(struct vm_page *, psize_t);70void uvm_pmr_freepages(struct vm_page *, psize_t);
lib/libc/include/generic-openbsd/uvm/uvm_swap.h+8-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_swap.h,v 1.22 2026/04/11 01:36:23 deraadt Exp $ */1/* $OpenBSD: uvm_swap.h,v 1.23 2026/07/11 13:13:16 kettenis 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,7 +37,8 @@...@@ -37,7 +37,8 @@
3737
38#ifdef _KERNEL38#ifdef _KERNEL
3939
40int uvm_swap_dropcluster(struct vm_page **, int, int);40int uvm_swap_dropcluster(struct vm_page **, int, int,
41 vaddr_t);
41int uvm_swap_get(struct vm_page *, int, int);42int uvm_swap_get(struct vm_page *, int, int);
42int uvm_swap_put(int, struct vm_page **, int, int);43int uvm_swap_put(int, struct vm_page **, int, int);
43int uvm_swap_alloc(int *, boolean_t);44int uvm_swap_alloc(int *, boolean_t);
...@@ -46,12 +47,17 @@ void uvm_swap_markbad(int, int);...@@ -46,12 +47,17 @@ void uvm_swap_markbad(int, int);
46int uvm_swapisfilled(void);47int uvm_swapisfilled(void);
47int uvm_swapisfull(void);48int uvm_swapisfull(void);
48void uvm_swap_freepages(struct vm_page **, int);49void uvm_swap_freepages(struct vm_page **, int);
50struct swapdev *uvm_swap_getsdp(int);
49#ifdef HIBERNATE51#ifdef HIBERNATE
50int uvm_hibswap(dev_t, u_long *, u_long *);52int uvm_hibswap(dev_t, u_long *, u_long *);
51#endif /* HIBERNATE */53#endif /* HIBERNATE */
52#ifdef UVM_SWAP_ENCRYPT54#ifdef UVM_SWAP_ENCRYPT
53void uvm_swap_initcrypt_all(void);55void uvm_swap_initcrypt_all(void);
54void uvm_swap_finicrypt_all(void);56void uvm_swap_finicrypt_all(void);
57void uvm_swap_encryptpg(struct swapdev *, caddr_t, caddr_t,
58 int);
59int uvm_swap_decryptpg(struct swapdev *, caddr_t, caddr_t,
60 int);
55#endif61#endif
5662
57extern volatile int seb_free;63extern volatile int seb_free;
lib/libc/include/generic-openbsd/uvm/uvm_swap_encrypt.h+6-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: uvm_swap_encrypt.h,v 1.14 2024/11/07 09:04:55 jsg Exp $ */1/* $OpenBSD: uvm_swap_encrypt.h,v 1.15 2026/08/13 21:08:17 kettenis Exp $ */
22
3/*3/*
4 * Copyright 1999 Niels Provos <provos@citi.umich.edu>4 * Copyright 1999 Niels Provos <provos@citi.umich.edu>
...@@ -51,6 +51,11 @@ struct swap_key {...@@ -51,6 +51,11 @@ struct swap_key {
51 u_int16_t refcount; /* pages that still need it */51 u_int16_t refcount; /* pages that still need it */
52};52};
5353
54extern int (*swap_key_prepare_fcn)(struct swap_key *, int);
55extern void (*swap_key_cleanup_fcn)(void);
56extern void (*swap_encrypt_fcn)(caddr_t, caddr_t, u_int64_t, size_t);
57extern void (*swap_decrypt_fcn)(caddr_t, caddr_t, u_int64_t, size_t);
58
54int swap_encrypt_ctl(int *, u_int, void *, size_t *, void *, size_t,59int swap_encrypt_ctl(int *, u_int, void *, size_t *, void *, size_t,
55 struct proc *);60 struct proc *);
5661
lib/libc/include/mips64-openbsd-none/machine/_float.h created+3
...@@ -0,0 +1,3 @@
1/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
2
3#include <mips64/_float.h>
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/cdefs.h created+3
...@@ -0,0 +1,3 @@
1/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */
2/* public domain */
3#include <mips64/cdefs.h>
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/disklabel.h created+16
...@@ -0,0 +1,16 @@
1/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */
2/* public domain */
3
4/*
5 * Standard MBR partition scheme, with the label in the second sector
6 * of the OpenBSD partition.
7 */
8
9#ifndef _MACHINE_DISKLABEL_H_
10#define _MACHINE_DISKLABEL_H_
11
12#define LABELSECTOR 1 /* sector containing label */
13#define LABELOFFSET 0 /* offset of label in sector */
14#define MAXPARTITIONS 16 /* number of partitions */
15
16#endif /* _MACHINE_DISKLABEL_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/fenv.h created+3
...@@ -0,0 +1,3 @@
1/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/fenv.h>
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/loadfile_machdep.h created+49
...@@ -0,0 +1,49 @@
1/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */
2/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */
3
4/*-
5 * Copyright (c) 1999 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Christos Zoulas.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#define BOOT_ELF
34#define ELFSIZE 64
35
36#define LOAD_KERNEL LOAD_ALL
37#define COUNT_KERNEL COUNT_ALL
38
39#define LOADADDR(a) (((u_long)(a)) + offset)
40#define ALIGNENTRY(a) ((u_long)(a))
41#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
42#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
43#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
44#define WARN(a) (void)(printf a, \
45 printf((errno ? ": %s\n" : "\n"), \
46 strerror(errno)))
47#define PROGRESS(a) (void) printf a
48#define ALLOC(a) alloc(a)
49#define FREE(a, b) free(a, b)
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/octeonvar.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */1/* $OpenBSD: octeonvar.h,v 1.56 2026/07/13 13:41:25 kirill 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/*-
...@@ -96,7 +96,7 @@ struct octeon_config {...@@ -96,7 +96,7 @@ struct octeon_config {
9696
97#define OCTEON_POOL_NELEMS_PKT 409697#define OCTEON_POOL_NELEMS_PKT 4096
98#define OCTEON_POOL_NELEMS_WQE 409698#define OCTEON_POOL_NELEMS_WQE 4096
99#define OCTEON_POOL_NELEMS_CMD 3299#define OCTEON_POOL_NELEMS_CMD 256
100#define OCTEON_POOL_NELEMS_SG 4096100#define OCTEON_POOL_NELEMS_SG 4096
101#define OCTEON_POOL_NELEMS_XXX_4 0101#define OCTEON_POOL_NELEMS_XXX_4 0
102#define OCTEON_POOL_NELEMS_XXX_5 0102#define OCTEON_POOL_NELEMS_XXX_5 0
lib/libc/include/mips64-openbsd-none/machine/reloc.h created+5
...@@ -0,0 +1,5 @@
1/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */
2
3/* public domain */
4
5#include <mips64/reloc.h>
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/machine/tcb.h created+3
...@@ -0,0 +1,3 @@
1/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/tcb.h>
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/_float.h created+71
...@@ -0,0 +1,71 @@
1/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
2
3/*
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef _MACHINE__FLOAT_H_
33#define _MACHINE__FLOAT_H_
34
35#define __FLT_RADIX 2 /* b */
36#define __FLT_ROUNDS __flt_rounds()
37#define __FLT_EVAL_METHOD 0 /* no promotions */
38
39#define __FLT_MANT_DIG 24 /* p */
40#define __FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
41#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
42#define __FLT_MIN_EXP (-125) /* emin */
43#define __FLT_MIN 1.17549435E-38F /* b**(emin-1) */
44#define __FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
45#define __FLT_MAX_EXP 128 /* emax */
46#define __FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
47#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
48
49#define __DBL_MANT_DIG 53
50#define __DBL_EPSILON 2.2204460492503131E-16
51#define __DBL_DIG 15
52#define __DBL_MIN_EXP (-1021)
53#define __DBL_MIN 2.2250738585072014E-308
54#define __DBL_MIN_10_EXP (-307)
55#define __DBL_MAX_EXP 1024
56#define __DBL_MAX 1.7976931348623157E+308
57#define __DBL_MAX_10_EXP 308
58
59#define __LDBL_MANT_DIG 113
60#define __LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
61#define __LDBL_DIG 33
62#define __LDBL_MIN_EXP (-16381)
63#define __LDBL_MIN 3.36210314311209350626267781732175260e-4932L
64#define __LDBL_MIN_10_EXP (-4931)
65#define __LDBL_MAX_EXP 16384
66#define __LDBL_MAX 1.18973149535723176508575932662800702e+4932L
67#define __LDBL_MAX_10_EXP 4932
68
69#define __DECIMAL_DIG 36
70
71#endif /* _MACHINE__FLOAT_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/_types.h created+150
...@@ -0,0 +1,150 @@
1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
2
3/*-
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)types.h 8.3 (Berkeley) 1/5/94
32 * @(#)ansi.h 8.2 (Berkeley) 1/4/94
33 */
34
35#ifndef _MIPS64__TYPES_H_
36#define _MIPS64__TYPES_H_
37
38/*
39 * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
40 * value for all data types (int, long, ...). The result is an
41 * unsigned long and must be cast to any desired pointer type.
42 *
43 * _ALIGNED_POINTER is a boolean macro that checks whether an address
44 * is valid to fetch data elements of type t from on this architecture.
45 * This does not reflect the optimal alignment, just the possibility
46 * (within reasonable limits).
47 */
48#define _ALIGNBYTES 7
49#define _STACKALIGNBYTES 15
50#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
51#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
52#define _MAX_PAGE_SHIFT 14 /* maximum possible PAGE_SHIFT */
53
54/*
55 * We need to handle the various ISA levels for sizes.
56 */
57#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
58#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
59#define _MIPS_ISA_MIPS3 3 /* R4000 */
60#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
61#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
62#define _MIPS_ISA_MIPS64 64 /* MIPS64 */
63
64/* 7.18.1.1 Exact-width integer types */
65typedef signed char __int8_t;
66typedef unsigned char __uint8_t;
67typedef short __int16_t;
68typedef unsigned short __uint16_t;
69typedef int __int32_t;
70typedef unsigned int __uint32_t;
71typedef long long __int64_t;
72typedef unsigned long long __uint64_t;
73
74/* 7.18.1.2 Minimum-width integer types */
75typedef __int8_t __int_least8_t;
76typedef __uint8_t __uint_least8_t;
77typedef __int16_t __int_least16_t;
78typedef __uint16_t __uint_least16_t;
79typedef __int32_t __int_least32_t;
80typedef __uint32_t __uint_least32_t;
81typedef __int64_t __int_least64_t;
82typedef __uint64_t __uint_least64_t;
83
84/* 7.18.1.3 Fastest minimum-width integer types */
85typedef __int32_t __int_fast8_t;
86typedef __uint32_t __uint_fast8_t;
87typedef __int32_t __int_fast16_t;
88typedef __uint32_t __uint_fast16_t;
89typedef __int32_t __int_fast32_t;
90typedef __uint32_t __uint_fast32_t;
91typedef __int64_t __int_fast64_t;
92typedef __uint64_t __uint_fast64_t;
93#define __INT_FAST8_MIN INT32_MIN
94#define __INT_FAST16_MIN INT32_MIN
95#define __INT_FAST32_MIN INT32_MIN
96#define __INT_FAST64_MIN INT64_MIN
97#define __INT_FAST8_MAX INT32_MAX
98#define __INT_FAST16_MAX INT32_MAX
99#define __INT_FAST32_MAX INT32_MAX
100#define __INT_FAST64_MAX INT64_MAX
101#define __UINT_FAST8_MAX UINT32_MAX
102#define __UINT_FAST16_MAX UINT32_MAX
103#define __UINT_FAST32_MAX UINT32_MAX
104#define __UINT_FAST64_MAX UINT64_MAX
105
106/* 7.18.1.4 Integer types capable of holding object pointers */
107typedef long __intptr_t;
108typedef unsigned long __uintptr_t;
109
110/* 7.18.1.5 Greatest-width integer types */
111typedef __int64_t __intmax_t;
112typedef __uint64_t __uintmax_t;
113
114/* Register size */
115typedef long __register_t;
116typedef long f_register_t; /* XXX */
117
118/* VM system types */
119typedef unsigned long __vaddr_t;
120typedef unsigned long __paddr_t;
121typedef unsigned long __vsize_t;
122typedef unsigned long __psize_t;
123
124/* Standard system types */
125typedef double __double_t;
126typedef float __float_t;
127typedef long __ptrdiff_t;
128typedef unsigned long __size_t;
129typedef long __ssize_t;
130typedef __builtin_va_list __va_list;
131
132/* Wide character support types */
133#ifndef __cplusplus
134typedef int __wchar_t;
135#endif
136typedef int __wint_t;
137typedef int __rune_t;
138typedef void * __wctrans_t;
139typedef void * __wctype_t;
140
141#if defined(_KERNEL)
142typedef struct label_t {
143 long val[14];
144} label_t;
145#endif
146
147/* Feature test macros */
148#define __HAVE_EXEC_MD_MAP
149
150#endif /* _MIPS64__TYPES_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/archtype.h created+77
...@@ -0,0 +1,77 @@
1/* $OpenBSD: archtype.h,v 1.16 2012/10/03 21:44:51 miod Exp $ */
2/*
3 * Copyright (c) 1997-2004 Opsycon AB, Sweden (www.opsycon.se)
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
15 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#ifndef _MIPS64_ARCHTYPE_H_
29#define _MIPS64_ARCHTYPE_H_
30/*
31 * Define architectural identities for the different Mips machines.
32 */
33#define ACER_PICA_61 0x0001 /* Acer Labs Pica 61 */
34#define MAGNUM 0x0002 /* Mips MAGNUM R4000 */
35#define DESKSTATION_RPC44 0x0003 /* Deskstation rPC44 */
36#define DESKSTATION_TYNE 0x0004 /* Deskstation Tyne */
37#define NKK_AQUARIUS 0x0005 /* NKK R4{67}00 PC */
38#define NEC_R94 0x0006 /* NEC Magnum class */
39#define SNI_RM200 0x0007 /* Siemens Nixdorf RM200 */
40
41#define SGI_IP17 0x0011 /* Crimson */
42#define SGI_IP19 0x0012 /* Onyx (!S model Challenge) */
43#define SGI_IP20 0x0013 /* Indigo */
44#define SGI_IP21 0x0014 /* POWER Challenge, POWER Onyx */
45#define SGI_IP22 0x0015 /* Indy, Indigo2, Challenge S */
46#define SGI_IP25 0x0016 /* POWER Challenge R10k */
47#define SGI_IP26 0x0017 /* POWER Indigo2 R8k */
48#define SGI_IP27 0x0018 /* IP27 Origin200/2000 */
49#define SGI_IP28 0x0019 /* POWER Indigo2 R10k */
50#define SGI_OCTANE 0x001a /* IP30 Octane */
51#define SGI_O2 0x001b /* IP32 O2 */
52#define SGI_IP35 0x001c /* IP35 Origin3x0/3x00/Fuel/Tezro */
53
54#define ALGOR_P4032 0x0021 /* ALGORITHMICS P-4032 */
55#define ALGOR_P5064 0x0022 /* ALGORITHMICS P-5064 */
56
57#define GALILEO_G9 0x0031 /* Galileo GT-64011 Eval board */
58#define GALILEO_EV64240 0x0032 /* Galileo EV64240 Eval board */
59#define GALILEO_EV64340 0x0033 /* Galileo EV64340 Eval board */
60
61#define MOMENTUM_CP7000 0x0041 /* Momentum Ocelot */
62#define MOMENTUM_CP7000G 0x0042 /* Momentum Ocelot-G */
63#define MOMENTUM_JAGUAR 0x0043 /* Momentum Jaguar ATX */
64
65#define WG4308 0x0052 /* Willowglen 4308 LMD */
66#define WG4309 0x0053 /* Willowglen 4309 LMD */
67#define WG4409 0x0054 /* Willowglen 4409 LMD */
68#define WG8138 0x0055 /* Willowglen 8138 523x VME card */
69#define WG8168 0x0056 /* Willowglen 8168 5231 VME card */
70#define WG6000 0x0057 /* Willowglen CPU-6000 */
71#define WG7000 0x0058 /* Willowglen CPU-7000 */
72#define WG8200 0x0059 /* Willowglen CPU-8200 */
73#define WG8232 0x005a /* Willowglen CPU-8232 */
74
75#define LAGUNA 0x00f1 /* Heurikon Laguna VME board */
76
77#endif /* !_MIPS64_ARCHTYPE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/asm.h created+360
...@@ -0,0 +1,360 @@
1/* $OpenBSD: asm.h,v 1.27 2021/05/01 16:11:10 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#ifndef _MIPS64_ASM_H_
29#define _MIPS64_ASM_H_
30
31#include <machine/regdef.h>
32
33#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
34#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
35#define _MIPS_ISA_MIPS3 3 /* R4000 */
36#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
37#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
38#define _MIPS_ISA_MIPS64 64 /* MIPS64 */
39
40#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
41#define ABICALLS .abicalls
42#endif
43
44#if defined(ABICALLS) && !defined(_KERNEL)
45 ABICALLS
46#endif
47
48#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */
49
50#if !defined(__MIPSEL__) && !defined(__MIPSEB__)
51#error "__MIPSEL__ or __MIPSEB__ must be defined"
52#endif
53/*
54 * Define how to access unaligned data word
55 */
56#if defined(__MIPSEL__)
57#define LWLO lwl
58#define LWHI lwr
59#define SWLO swl
60#define SWHI swr
61#define LDLO ldl
62#define LDHI ldr
63#define SDLO sdl
64#define SDHI sdr
65#endif
66#if defined(__MIPSEB__)
67#define LWLO lwr
68#define LWHI lwl
69#define SWLO swr
70#define SWHI swl
71#define LDLO ldr
72#define LDHI ldl
73#define SDLO sdr
74#define SDHI sdl
75#endif
76
77/*
78 * Define programming environment for ABI.
79 */
80#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
81
82#ifndef _MIPS_SIM
83#define _MIPS_SIM 1
84#define _ABIO32 1
85#endif
86#ifndef _MIPS_ISA
87#define _MIPS_ISA 2
88#define _MIPS_ISA_MIPS2 2
89#endif
90
91#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
92#define NARGSAVE 4
93
94#define SETUP_GP \
95 .set noreorder; \
96 .cpload t9; \
97 .set reorder;
98
99#define SAVE_GP(x) \
100 .cprestore x
101
102#define SETUP_GP64(gpoff, name)
103#define RESTORE_GP64
104#endif
105
106#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
107#define NARGSAVE 0
108
109#define SETUP_GP
110#define SAVE_GP(x)
111#define SETUP_GP64(gpoff, name) \
112 .cpsetup t9, gpoff, name
113#define RESTORE_GP64 \
114 .cpreturn
115#endif
116
117#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31))
118
119#else /* defined(ABICALLS) && !defined(_KERNEL) */
120
121#define NARGSAVE 4
122#define SETUP_GP
123#define SAVE_GP(x)
124
125#define ALIGNSZ 16 /* Stack layout alignment */
126#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
127
128#endif
129
130/*
131 * Basic register operations based on selected ISA
132 */
133#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \
134 _MIPS_ISA == _MIPS_ISA_MIPS32)
135#define REGSZ 4 /* 32 bit mode register size */
136#define LOGREGSZ 2 /* log rsize */
137#define REG_S sw
138#define REG_L lw
139#define CF_SZ 24 /* Call frame size */
140#define CF_ARGSZ 16 /* Call frame arg size */
141#define CF_RA_OFFS 20 /* Call ra save offset */
142#endif
143
144#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \
145 _MIPS_ISA == _MIPS_ISA_MIPS64)
146#define REGSZ 8 /* 64 bit mode register size */
147#define LOGREGSZ 3 /* log rsize */
148#define REG_S sd
149#define REG_L ld
150#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */
151#define CF_ARGSZ 32 /* Call frame arg size */
152#define CF_RA_OFFS 40 /* Call ra save offset */
153#endif
154
155#ifndef __LP64__
156#define PTR_L lw
157#define PTR_S sw
158#define PTR_SUB sub
159#define PTR_ADD add
160#define PTR_SUBU subu
161#define PTR_ADDU addu
162#define LI li
163#define LA la
164#define PTR_SLL sll
165#define PTR_SRL srl
166#define PTR_VAL .word
167#else
168#define PTR_L ld
169#define PTR_S sd
170#define PTR_ADD dadd
171#define PTR_SUB dsub
172#define PTR_SUBU dsubu
173#define PTR_ADDU daddu
174#define LI dli
175#define LA dla
176#define PTR_SLL dsll
177#define PTR_SRL dsrl
178#define PTR_VAL .dword
179#endif
180
181#define NOP nop
182#define DMFC0 dmfc0
183#define DMTC0 dmtc0
184#define MFC0 mfc0
185#define MTC0 mtc0
186#define ERET sync; eret
187
188/*
189 * Define -pg profile entry code.
190 */
191#if defined(XGPROF) || defined(XPROF)
192#define MCOUNT \
193 PTR_SUBU sp, sp, 64; \
194 SAVE_GP(16); \
195 sd ra, 56(sp); \
196 sd gp, 48(sp); \
197 .set noat; \
198 .set noreorder; \
199 move AT, ra; \
200 jal _mcount; \
201 PTR_SUBU sp, sp, 16; \
202 ld ra, 56(sp); \
203 PTR_ADDU sp, sp, 64; \
204 .set reorder; \
205 .set at;
206#else
207#define MCOUNT
208#endif
209
210/*
211 * LEAF(x, fsize)
212 *
213 * Declare a leaf routine.
214 */
215#define LEAF(x, fsize) \
216 .align 3; \
217 .globl x; \
218 .ent x, 0; \
219x: ; \
220 .frame sp, fsize, ra; \
221 SETUP_GP \
222 MCOUNT
223
224#define ALEAF(x) \
225 .globl x; \
226x:
227
228/*
229 * NLEAF(x)
230 *
231 * Declare a non-profiled leaf routine.
232 */
233#define NLEAF(x, fsize) \
234 .align 3; \
235 .globl x; \
236 .ent x, 0; \
237x: ; \
238 .frame sp, fsize, ra; \
239 SETUP_GP
240
241/*
242 * NON_LEAF(x)
243 *
244 * Declare a non-leaf routine (a routine that makes other C calls).
245 */
246#define NON_LEAF(x, fsize, retpc) \
247 .align 3; \
248 .globl x; \
249 .ent x, 0; \
250x: ; \
251 .frame sp, fsize, retpc; \
252 SETUP_GP \
253 MCOUNT
254
255/*
256 * NNON_LEAF(x)
257 *
258 * Declare a non-profiled non-leaf routine
259 * (a routine that makes other C calls).
260 */
261#define NNON_LEAF(x, fsize, retpc) \
262 .align 3; \
263 .globl x; \
264 .ent x, 0; \
265x: ; \
266 .frame sp, fsize, retpc \
267 SETUP_GP
268
269/*
270 * END(x)
271 *
272 * Mark end of a procedure.
273 */
274#define END(x) \
275 .end x
276
277/*
278 * STRONG_ALIAS, WEAK_ALIAS
279 * Create a strong or weak alias.
280 */
281#define STRONG_ALIAS(alias,sym) \
282 .global alias; alias = sym
283#define WEAK_ALIAS(alias,sym) \
284 .weak alias; alias = sym
285
286
287/*
288 * Macros to panic and printf from assembly language.
289 */
290#define PANIC(msg) \
291 LA a0, 9f; \
292 jal panic; \
293 nop ; \
294 MSG(msg)
295
296#define PRINTF(msg) \
297 LA a0, 9f; \
298 jal printf; \
299 nop ; \
300 MSG(msg)
301
302#define MSG(msg) \
303 .rdata; \
3049: .asciiz msg; \
305 .text
306
307#define LOAD_XKPHYS(reg, cca) \
308 li reg, cca | 0x10; \
309 dsll reg, reg, 59
310
311#ifdef MULTIPROCESSOR
312#define GET_CPU_INFO(ci, tmp) HW_GET_CPU_INFO(ci, tmp)
313#else /* MULTIPROCESSOR */
314#define GET_CPU_INFO(ci, tmp) \
315 LA ci, cpu_info_primary
316#endif /* MULTIPROCESSOR */
317
318/*
319 * Hazards
320 */
321
322#ifdef CPU_OCTEON
323/*
324 * OCTEON clears hazards in hardware.
325 */
326#define MFC0_HAZARD /* nothing */
327#define MTC0_HAZARD /* nothing */
328#define MTC0_SR_IE_HAZARD /* nothing */
329#define MTC0_SR_CU_HAZARD /* nothing */
330#define TLB_HAZARD /* nothing */
331#endif
332
333/* Hazard between {d,}mfc0 of COP_0_VADDR */
334#ifndef PRE_MFC0_ADDR_HAZARD
335#define PRE_MFC0_ADDR_HAZARD /* nothing */
336#endif
337
338/* Hazard after {d,}mfc0 from any register */
339#ifndef MFC0_HAZARD
340#define MFC0_HAZARD /* nothing */
341#endif
342/* Hazard after {d,}mtc0 to any register */
343#ifndef MTC0_HAZARD
344#define MTC0_HAZARD NOP; NOP; NOP; NOP
345#endif
346/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of interrupts */
347#ifndef MTC0_SR_IE_HAZARD
348#define MTC0_SR_IE_HAZARD MTC0_HAZARD
349#endif
350/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of coprocessors */
351#ifndef MTC0_SR_CU_HAZARD
352#define MTC0_SR_CU_HAZARD NOP; NOP
353#endif
354
355/* Hazard before and after a tlbp, tlbr, tlbwi or tlbwr instruction */
356#ifndef TLB_HAZARD
357#define TLB_HAZARD NOP; NOP
358#endif
359
360#endif /* !_MIPS64_ASM_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/atomic.h created+214
...@@ -0,0 +1,214 @@
1/* $OpenBSD: atomic.h,v 1.12 2019/10/28 09:41:37 visa Exp $ */
2
3/* Public Domain */
4
5#ifndef _MIPS64_ATOMIC_H_
6#define _MIPS64_ATOMIC_H_
7
8#if defined(_KERNEL)
9
10/* wait until the bits to set are clear, and set them */
11static __inline void
12atomic_wait_and_setbits_int(volatile unsigned int *uip, unsigned int v)
13{
14 unsigned int tmp0, tmp1;
15
16 __asm__ volatile (
17 "1: ll %0, 0(%2)\n"
18 " and %1, %0, %3\n"
19 " bnez %1, 1b\n"
20 " or %0, %3, %0\n"
21 " sc %0, 0(%2)\n"
22 " beqz %0, 1b\n"
23 " nop\n" :
24 "=&r"(tmp0), "=&r"(tmp1) :
25 "r"(uip), "r"(v) : "memory");
26}
27
28static __inline void
29atomic_setbits_int(volatile unsigned int *uip, unsigned int v)
30{
31 unsigned int tmp;
32
33 __asm__ volatile (
34 "1: ll %0, 0(%1)\n"
35 " or %0, %2, %0\n"
36 " sc %0, 0(%1)\n"
37 " beqz %0, 1b\n"
38 " nop\n" :
39 "=&r"(tmp) :
40 "r"(uip), "r"(v) : "memory");
41}
42
43static __inline void
44atomic_clearbits_int(volatile unsigned int *uip, unsigned int v)
45{
46 unsigned int tmp;
47
48 __asm__ volatile (
49 "1: ll %0, 0(%1)\n"
50 " and %0, %2, %0\n"
51 " sc %0, 0(%1)\n"
52 " beqz %0, 1b\n"
53 " nop\n" :
54 "=&r"(tmp) :
55 "r"(uip), "r"(~v) : "memory");
56}
57
58#endif /* defined(_KERNEL) */
59
60static inline unsigned int
61_atomic_cas_uint(volatile unsigned int *p, unsigned int o, unsigned int n)
62{
63 unsigned int rv, wv;
64
65 __asm__ volatile (
66 "1: ll %0, %1\n"
67 " bne %0, %4, 2f\n"
68 " move %2, %3\n"
69 " sc %2, %1\n"
70 " beqz %2, 1b\n"
71 "2: nop\n"
72 : "=&r" (rv), "+m" (*p), "=&r" (wv)
73 : "r" (n), "Ir" (o));
74
75 return (rv);
76}
77#define atomic_cas_uint(_p, _o, _n) _atomic_cas_uint((_p), (_o), (_n))
78
79static inline unsigned long
80_atomic_cas_ulong(volatile unsigned long *p, unsigned long o, unsigned long n)
81{
82 unsigned long rv, wv;
83
84 __asm__ volatile (
85 "1: lld %0, %1\n"
86 " bne %0, %4, 2f\n"
87 " move %2, %3\n"
88 " scd %2, %1\n"
89 " beqz %2, 1b\n"
90 "2: nop\n"
91 : "=&r" (rv), "+m" (*p), "=&r" (wv)
92 : "r" (n), "Ir" (o));
93
94 return (rv);
95}
96#define atomic_cas_ulong(_p, _o, _n) _atomic_cas_ulong((_p), (_o), (_n))
97
98static inline void *
99_atomic_cas_ptr(volatile void *pp, void *o, void *n)
100{
101 void * volatile *p = pp;
102 void *rv, *wv;
103
104 __asm__ volatile (
105 "1: lld %0, %1\n"
106 " bne %0, %4, 2f\n"
107 " move %2, %3\n"
108 " scd %2, %1\n"
109 " beqz %2, 1b\n"
110 "2: nop\n"
111 : "=&r" (rv), "+m" (*p), "=&r" (wv)
112 : "r" (n), "Ir" (o));
113
114 return (rv);
115}
116#define atomic_cas_ptr(_p, _o, _n) _atomic_cas_ptr((_p), (_o), (_n))
117
118
119
120static inline unsigned int
121_atomic_swap_uint(volatile unsigned int *uip, unsigned int v)
122{
123 unsigned int o, t;
124
125 __asm__ volatile (
126 "1: ll %0, %1\n"
127 " move %2, %3\n"
128 " sc %2, %1\n"
129 " beqz %2, 1b\n"
130 " nop\n"
131 : "=&r" (o), "+m" (*uip), "=&r" (t)
132 : "r" (v));
133
134 return (o);
135}
136#define atomic_swap_uint(_p, _v) _atomic_swap_uint((_p), (_v))
137
138static inline unsigned long
139_atomic_swap_ulong(volatile unsigned long *uip, unsigned long v)
140{
141 unsigned long o, t;
142
143 __asm__ volatile (
144 "1: lld %0, %1\n"
145 " move %2, %3\n"
146 " scd %2, %1\n"
147 " beqz %2, 1b\n"
148 " nop\n"
149 : "=&r" (o), "+m" (*uip), "=&r" (t)
150 : "r" (v));
151
152 return (o);
153}
154#define atomic_swap_ulong(_p, _v) _atomic_swap_ulong((_p), (_v))
155
156
157static inline void *
158_atomic_swap_ptr(volatile void *uipp, void *n)
159{
160 void * volatile *uip = uipp;
161 void *o, *t;
162
163 __asm__ volatile (
164 "1: lld %0, %1\n"
165 " move %2, %3\n"
166 " scd %2, %1\n"
167 " beqz %2, 1b\n"
168 " nop\n"
169 : "=&r" (o), "+m" (*uip), "=&r" (t)
170 : "r" (n));
171
172 return (o);
173}
174#define atomic_swap_ptr(_p, _n) _atomic_swap_ptr((_p), (_n))
175
176static inline unsigned int
177_atomic_add_int_nv(volatile unsigned int *uip, unsigned int v)
178{
179 unsigned int rv, nv;
180
181 __asm__ volatile (
182 "1: ll %0, %1\n"
183 " addu %2, %0, %3\n"
184 " sc %2, %1\n"
185 " beqz %2, 1b\n"
186 " nop\n"
187 : "=&r" (rv), "+m" (*uip), "=&r" (nv)
188 : "Ir" (v));
189
190 return (rv + v);
191}
192#define atomic_add_int_nv(_uip, _v) _atomic_add_int_nv((_uip), (_v))
193#define atomic_sub_int_nv(_uip, _v) _atomic_add_int_nv((_uip), 0 - (_v))
194
195static inline unsigned long
196_atomic_add_long_nv(volatile unsigned long *uip, unsigned long v)
197{
198 unsigned long rv, nv;
199
200 __asm__ volatile (
201 "1: lld %0, %1\n"
202 " daddu %2, %0, %3\n"
203 " scd %2, %1\n"
204 " beqz %2, 1b\n"
205 " nop\n"
206 : "=&r" (rv), "+m" (*uip), "=&r" (nv)
207 : "Ir" (v));
208
209 return (rv + v);
210}
211#define atomic_add_long_nv(_uip, _v) _atomic_add_long_nv((_uip), (_v))
212#define atomic_sub_long_nv(_uip, _v) _atomic_add_long_nv((_uip), 0UL - (_v))
213
214#endif /* _MIPS64_ATOMIC_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/autoconf.h created+37
...@@ -0,0 +1,37 @@
1/* $OpenBSD: autoconf.h,v 1.2 2017/06/08 12:02:52 visa Exp $ */
2
3/*
4 * Copyright (c) 2010 Miodrag Vallat.
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 * Common defines used by autoconf on all mips64-based platforms.
21 */
22
23#ifndef _MIPS64_AUTOCONF_H_
24#define _MIPS64_AUTOCONF_H_
25
26#include <machine/cpu.h> /* for struct cpu_hwinfo */
27
28struct cpu_attach_args {
29 struct mainbus_attach_args caa_maa;
30 struct cpu_hwinfo *caa_hw;
31};
32
33extern struct cpu_hwinfo bootcpu_hwinfo;
34
35void unmap_startup(void);
36
37#endif /* _MIPS64_AUTOCONF_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/cache.h created+107
...@@ -0,0 +1,107 @@
1/* $OpenBSD: cache.h,v 1.9 2016/12/21 13:59:57 visa Exp $ */
2
3/*
4 * Copyright (c) 2012 Miodrag Vallat.
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#ifndef _MIPS64_CACHE_H_
20#define _MIPS64_CACHE_H_
21
22/*
23 * Declare canonical cache functions for a given processor.
24 *
25 * The following assumptions are made:
26 * - only L1 has split instruction and data caches.
27 * - L1 I$ is virtually indexed.
28 *
29 * Processor-specific routines will make extra assumptions.
30 */
31
32#define CACHE_PROTOS(chip) \
33/* Figure out cache configuration */ \
34void chip##_ConfigCache(struct cpu_info *); \
35/* Writeback and invalidate all caches */ \
36void chip##_SyncCache(struct cpu_info *); \
37/* Invalidate all I$ for the given range */ \
38void chip##_InvalidateICache(struct cpu_info *, vaddr_t, size_t); \
39/* Register a given page for I$ invalidation */ \
40void chip##_InvalidateICachePage(struct cpu_info *, vaddr_t); \
41/* Perform postponed I$ invalidation */ \
42void chip##_SyncICache(struct cpu_info *); \
43/* Writeback all D$ for the given page */ \
44void chip##_SyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \
45/* Writeback all D$ for the (currently mapped) given page */ \
46void chip##_HitSyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \
47/* Writeback all D$ for the given range */ \
48void chip##_HitSyncDCache(struct cpu_info *, vaddr_t, size_t); \
49/* Invalidate all D$ for the given range */ \
50void chip##_HitInvalidateDCache(struct cpu_info *, vaddr_t, size_t); \
51/* Enforce coherency of the given range */ \
52void chip##_IOSyncDCache(struct cpu_info *, vaddr_t, size_t, int);
53
54/*
55 * Cavium Octeon.
56 */
57CACHE_PROTOS(Octeon)
58
59void Octeon_lock_secondary_cache(struct cpu_info *, paddr_t, size_t);
60void Octeon_unlock_secondary_cache(struct cpu_info *, paddr_t, size_t);
61
62/*
63 * STC Loongson 2E and 2F.
64 */
65CACHE_PROTOS(Loongson2)
66
67/*
68 * Loongson 3A and 2Gq.
69 */
70CACHE_PROTOS(Loongson3)
71
72/*
73 * MIPS R4000 and R4400.
74 */
75CACHE_PROTOS(Mips4k)
76
77/*
78 * IDT/QED/PMC-Sierra R4600, R4700, R5000, RM52xx, RM7xxx, RM9xxx.
79 */
80CACHE_PROTOS(Mips5k)
81
82/*
83 * MIPS (SGI, really) R8000.
84 */
85CACHE_PROTOS(tfp)
86
87/*
88 * MIPS/NEC R10000/R120000/R140000/R16000.
89 */
90CACHE_PROTOS(Mips10k)
91
92/*
93 * mips64r2-compliant processors.
94 */
95CACHE_PROTOS(mips64r2)
96
97/*
98 * Values used by the IOSyncDCache routine [which acts as the backend of
99 * bus_dmamap_sync()].
100 */
101#define CACHE_SYNC_R 0 /* WB invalidate, WT invalidate */
102#define CACHE_SYNC_W 1 /* WB writeback, WT unaffected */
103#define CACHE_SYNC_X 2 /* WB writeback + invalidate, WT invalidate */
104
105extern vaddr_t cache_valias_mask;
106
107#endif /* _MIPS64_CACHE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/cdefs.h created+43
...@@ -0,0 +1,43 @@
1/* $OpenBSD: cdefs.h,v 1.6 2013/03/28 17:30:45 martynas Exp $ */
2
3/*
4 * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_CDEFS_H_
30#define _MIPS64_CDEFS_H_
31
32#define __strong_alias(alias,sym) \
33 __asm__(".global " __STRING(alias) " ; " \
34 __STRING(alias) " = " __STRING(sym))
35#define __weak_alias(alias,sym) \
36 __asm__(".weak " __STRING(alias) " ; " \
37 __STRING(alias) " = " __STRING(sym))
38#define __warn_references(sym,msg) \
39 __asm__(".section .gnu.warning." __STRING(sym) \
40 " ; .ascii \"" msg "\" ; .text")
41#define __indr_references(sym,msg) /* nothing */
42
43#endif /* !_MIPS64_CDEFS_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/cpu.h created+552
...@@ -0,0 +1,552 @@
1/* $OpenBSD: cpu.h,v 1.151 2025/06/06 00:07:58 deraadt Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell and Rick Macklem.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * Copyright (C) 1989 Digital Equipment Corporation.
35 * Permission to use, copy, modify, and distribute this software and
36 * its documentation for any purpose and without fee is hereby granted,
37 * provided that the above copyright notice appears in all copies.
38 * Digital Equipment Corporation makes no representations about the
39 * suitability of this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
41 *
42 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
43 */
44
45#ifndef _MIPS64_CPU_H_
46#define _MIPS64_CPU_H_
47
48#ifndef _LOCORE
49
50/*
51 * MIPS32-style segment definitions.
52 * They only cover the first 512MB of physical addresses.
53 */
54#define CKSEG0_BASE 0xffffffff80000000UL
55#define CKSEG1_BASE 0xffffffffa0000000UL
56#define CKSSEG_BASE 0xffffffffc0000000UL
57#define CKSEG3_BASE 0xffffffffe0000000UL
58#define CKSEG_SIZE 0x0000000020000000UL
59
60#define CKSEG0_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1))
61#define CKSEG1_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1))
62#define PHYS_TO_CKSEG0(x) ((u_long)(x) | CKSEG0_BASE)
63#define PHYS_TO_CKSEG1(x) ((u_long)(x) | CKSEG1_BASE)
64
65/*
66 * MIPS64-style segment definitions.
67 * These allow for 36 bits of addressable physical memory, thus 64GB.
68 */
69
70/*
71 * Cache Coherency Attributes.
72 */
73/* r8k only */
74#define CCA_NC_COPROCESSOR 0UL /* uncached, coprocessor ordered */
75/* common to r4, r5k, r8k and r1xk */
76#define CCA_NC 2UL /* uncached, write-around */
77#define CCA_NONCOHERENT 3UL /* cached, non-coherent, write-back */
78/* r8k, r1xk only */
79#define CCA_COHERENT_EXCL 4UL /* cached, coherent, exclusive */
80#define CCA_COHERENT_EXCLWRITE 5UL /* cached, coherent, exclusive write */
81/* r4k only */
82#define CCA_COHERENT_UPDWRITE 6UL /* cached, coherent, update on write */
83/* r1xk only */
84#define CCA_NC_ACCELERATED 7UL /* uncached accelerated */
85
86#ifdef TGT_COHERENT
87#define CCA_CACHED CCA_COHERENT_EXCLWRITE
88#else
89#define CCA_CACHED CCA_NONCOHERENT
90#endif
91
92#define XKSSSEG_BASE 0x4000000000000000UL
93#define XKPHYS_BASE 0x8000000000000000UL
94#define XKSSEG_BASE 0xc000000000000000UL
95
96#define XKPHYS_TO_PHYS(x) ((paddr_t)(x) & 0x0000000fffffffffUL)
97#define PHYS_TO_XKPHYS(x,c) ((paddr_t)(x) | XKPHYS_BASE | ((c) << 59))
98#define IS_XKPHYS(va) (((va) >> 62) == 2)
99#define XKPHYS_TO_CCA(x) (((x) >> 59) & 0x07)
100
101#endif /* _LOCORE */
102
103/*
104 * Exported definitions unique to mips cpu support.
105 */
106
107#if defined(_KERNEL) && !defined(_LOCORE)
108
109#include <sys/clockintr.h>
110#include <sys/device.h>
111#include <machine/intr.h>
112#include <sys/sched.h>
113#include <sys/srp.h>
114#include <uvm/uvm_percpu.h>
115
116struct cpu_hwinfo {
117 uint32_t c0prid;
118 uint32_t c1prid;
119 uint32_t clock; /* Hz */
120 uint32_t tlbsize;
121 uint type;
122 uint32_t l2size;
123};
124
125/*
126 * Cache memory configuration. One struct per cache.
127 */
128struct cache_info {
129 uint size; /* total cache size */
130 uint linesize; /* line size */
131 uint setsize; /* set size */
132 uint sets; /* number of sets */
133};
134
135struct cpu_info {
136 struct device *ci_dev; /* our device */
137 struct cpu_info *ci_self; /* pointer to this structure */
138 struct cpu_info *ci_next; /* next cpu */
139 struct proc *ci_curproc;
140 struct user *ci_curprocpaddr;
141 struct proc *ci_fpuproc; /* pointer to last proc to use FP */
142 uint32_t ci_delayconst;
143 struct cpu_hwinfo
144 ci_hw;
145
146#if defined(MULTIPROCESSOR)
147 struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
148#define __HAVE_UVM_PERCPU
149 struct uvm_pmr_cache ci_uvm;
150#endif
151
152 /* cache information and pending flush state */
153 uint ci_cacheconfiguration;
154 uint64_t ci_cachepending_l1i;
155 struct cache_info
156 ci_l1inst,
157 ci_l1data,
158 ci_l2,
159 ci_l3;
160
161 /* function pointers for the cache handling routines */
162 void (*ci_SyncCache)(struct cpu_info *);
163 void (*ci_InvalidateICache)(struct cpu_info *, vaddr_t,
164 size_t);
165 void (*ci_InvalidateICachePage)(struct cpu_info *, vaddr_t);
166 void (*ci_SyncICache)(struct cpu_info *);
167 void (*ci_SyncDCachePage)(struct cpu_info *, vaddr_t,
168 paddr_t);
169 void (*ci_HitSyncDCachePage)(struct cpu_info *, vaddr_t,
170 paddr_t);
171 void (*ci_HitSyncDCache)(struct cpu_info *, vaddr_t, size_t);
172 void (*ci_HitInvalidateDCache)(struct cpu_info *, vaddr_t,
173 size_t);
174 void (*ci_IOSyncDCache)(struct cpu_info *, vaddr_t, size_t,
175 int);
176
177 struct schedstate_percpu
178 ci_schedstate;
179 int ci_want_resched; /* need_resched() invoked */
180 cpuid_t ci_cpuid; /* our CPU ID */
181 uint32_t ci_randseed; /* per cpu random seed */
182 volatile int ci_ipl; /* software IPL */
183 uint32_t ci_softpending; /* pending soft interrupts */
184 int ci_clock_started;
185 volatile int ci_clock_deferred; /* clock interrupt postponed */
186 struct clockqueue
187 ci_queue;
188
189 struct pmap *ci_curpmap;
190 uint ci_idepth; /* interrupt depth */
191 volatile u_long ci_flags; /* flags; see below */
192 volatile int ci_ddb;
193#define CI_DDB_RUNNING 0
194#define CI_DDB_SHOULDSTOP 1
195#define CI_DDB_STOPPED 2
196#define CI_DDB_ENTERDDB 3
197#define CI_DDB_INDDB 4
198
199#ifdef DIAGNOSTIC
200 int ci_mutex_level;
201#endif
202#ifdef GPROF
203 struct gmonparam *ci_gmon;
204 struct clockintr ci_gmonclock;
205#endif
206 char ci_panicbuf[512];
207};
208
209#define CPUF_PRIMARY 0x01 /* CPU is primary CPU */
210#define CPUF_PRESENT 0x02 /* CPU is present */
211#define CPUF_RUNNING 0x04 /* CPU is running */
212
213extern struct cpu_info cpu_info_primary;
214extern struct cpu_info *cpu_info_list;
215#define CPU_INFO_ITERATOR int
216#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \
217 ci != NULL; ci = ci->ci_next)
218
219#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0)
220
221#define cpu_idle_enter() do { /* nothing */ } while (0)
222#define cpu_idle_leave() do { /* nothing */ } while (0)
223extern void (*cpu_idle_cycle_func)(void);
224#define cpu_idle_cycle() (*cpu_idle_cycle_func)()
225
226#ifdef MULTIPROCESSOR
227#define getcurcpu() hw_getcurcpu()
228#define setcurcpu(ci) hw_setcurcpu(ci)
229extern struct cpu_info *get_cpu_info(int);
230#define curcpu() getcurcpu()
231#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY)
232#define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING)
233#define cpu_number() (curcpu()->ci_cpuid)
234
235void cpu_unidle(struct cpu_info *);
236void cpu_boot_secondary_processors(void);
237#define cpu_boot_secondary(ci) hw_cpu_boot_secondary(ci)
238#define cpu_hatch(ci) hw_cpu_hatch(ci)
239
240vaddr_t alloc_contiguous_pages(size_t);
241
242#define MIPS64_IPI_NOP 0x00000001
243#define MIPS64_IPI_RENDEZVOUS 0x00000002
244#define MIPS64_IPI_DDB 0x00000004
245#define MIPS64_NIPIS 3 /* must not exceed 32 */
246
247void mips64_ipi_init(void);
248void mips64_send_ipi(unsigned int, unsigned int);
249void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg);
250
251#include <sys/mplock.h>
252#else
253#define MAXCPUS 1
254#define curcpu() (&cpu_info_primary)
255#define CPU_IS_PRIMARY(ci) 1
256#define CPU_IS_RUNNING(ci) 1
257#define cpu_number() 0UL
258#define cpu_unidle(ci)
259#define get_cpu_info(i) (&cpu_info_primary)
260#endif
261
262#define CPU_BUSY_CYCLE() __asm volatile ("" ::: "memory")
263
264extern void (*md_initclock)(void);
265extern void (*md_startclock)(struct cpu_info *);
266extern void (*md_triggerclock)(void);
267void cp0_calibrate(struct cpu_info *);
268
269unsigned int cpu_rnd_messybits(void);
270
271#include <machine/frame.h>
272
273/*
274 * Arguments to hardclock encapsulate the previous machine state in
275 * an opaque clockframe.
276 */
277#define clockframe trapframe /* Use normal trap frame */
278
279#define SR_KSU_USER 0x00000010
280#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER)
281#define CLKF_PC(framep) ((framep)->pc)
282#define CLKF_INTR(framep) (curcpu()->ci_idepth > 1) /* XXX */
283
284/*
285 * This is used during profiling to integrate system time.
286 */
287#define PROC_PC(p) ((p)->p_md.md_regs->pc)
288#define PROC_STACK(p) ((p)->p_md.md_regs->sp)
289
290/*
291 * Preempt the current process if in interrupt from user mode,
292 * or after the current trap/syscall if in system mode.
293 */
294void need_resched(struct cpu_info *);
295#define clear_resched(ci) (ci)->ci_want_resched = 0
296
297/*
298 * Give a profiling tick to the current process when the user profiling
299 * buffer pages are invalid. On MIPS designs, request an ast to send us
300 * through trap, marking the proc as needing a profiling tick.
301 */
302#define need_proftick(p) aston(p)
303
304/*
305 * Notify the current process (p) that it has a signal pending,
306 * process as soon as possible.
307 */
308void signotify(struct proc *);
309
310#define aston(p) ((p)->p_md.md_astpending = 1)
311
312#define mips_sync() __asm__ volatile ("sync" ::: "memory")
313
314#endif /* _KERNEL && !_LOCORE */
315
316#ifdef _KERNEL
317/*
318 * Values for the code field in a break instruction.
319 */
320#define BREAK_INSTR 0x0000000d
321#define BREAK_VAL_MASK 0x03ff0000
322#define BREAK_VAL_SHIFT 16
323#define BREAK_KDB_VAL 512
324#define BREAK_SSTEP_VAL 513
325#define BREAK_BRKPT_VAL 514
326#define BREAK_SOVER_VAL 515
327#define BREAK_DDB_VAL 516
328#define BREAK_FPUEMUL_VAL 517
329#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT))
330#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT))
331#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT))
332#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT))
333#define BREAK_DDB (BREAK_INSTR | (BREAK_DDB_VAL << BREAK_VAL_SHIFT))
334#define BREAK_FPUEMUL (BREAK_INSTR | (BREAK_FPUEMUL_VAL << BREAK_VAL_SHIFT))
335
336#endif /* _KERNEL */
337
338/*
339 * CTL_MACHDEP definitions.
340 */
341#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */
342 /* 2 formerly: keyboard reset */
343 /* 3 formerly: CPU_LIDSUSPEND */
344#define CPU_LIDACTION 4 /* action caused by lid close */
345#define CPU_MAXID 5 /* number of valid machdep ids */
346
347#define CTL_MACHDEP_NAMES { \
348 { 0, 0 }, \
349 { "allowaperture", CTLTYPE_INT }, \
350 { 0, 0 }, \
351 { 0, 0 }, \
352 { "lidaction", CTLTYPE_INT }, \
353}
354
355/*
356 * MIPS CPU types (cp_imp).
357 */
358#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */
359#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */
360#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */
361#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */
362#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */
363#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */
364#define MIPS_CN50XX 0x06 /* Cavium OCTEON CN50xx MIPS64R2*/
365#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */
366#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */
367#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */
368#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */
369#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */
370#define MIPS_R12000 0x0e /* MIPS R12000 ISA IV */
371#define MIPS_R14000 0x0f /* MIPS R14000 ISA IV */
372#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
373#define MIPS_R4600 0x20 /* PMCS R4600 Orion ISA III */
374#define MIPS_R4700 0x21 /* PMCS R4700 Orion ISA III */
375#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */
376#define MIPS_R5000 0x23 /* MIPS R5000 CPU ISA IV */
377#define MIPS_RM7000 0x27 /* PMCS RM7000 CPU ISA IV */
378#define MIPS_RM52X0 0x28 /* PMCS RM52X0 CPU ISA IV */
379#define MIPS_RM9000 0x34 /* PMCS RM9000 CPU ISA IV */
380#define MIPS_LOONGSON 0x42 /* STC LoongSon CPU ISA III */
381#define MIPS_VR5400 0x54 /* NEC Vr5400 CPU ISA IV+ */
382#define MIPS_LOONGSON2 0x63 /* STC LoongSon2/3 CPU ISA III+ */
383#define MIPS_CN63XX 0x90 /* Cavium OCTEON II CN6[23]xx MIPS64R2 */
384#define MIPS_CN68XX 0x91 /* Cavium OCTEON II CN68xx MIPS64R2 */
385#define MIPS_CN66XX 0x92 /* Cavium OCTEON II CN66xx MIPS64R2 */
386#define MIPS_CN61XX 0x93 /* Cavium OCTEON II CN6[01]xx MIPS64R2 */
387#define MIPS_CN78XX 0x95 /* Cavium OCTEON III CN7[678]xx MIPS64R2 */
388#define MIPS_CN71XX 0x96 /* Cavium OCTEON III CN7[01]xx MIPS64R2 */
389#define MIPS_CN73XX 0x97 /* Cavium OCTEON III CN7[23]xx MIPS64R2 */
390
391/*
392 * MIPS FPU types. Only soft, rest is the same as cpu type.
393 */
394#define MIPS_SOFT 0x00 /* Software emulation ISA I */
395
396
397#if defined(_KERNEL) && !defined(_LOCORE)
398
399extern register_t protosr;
400extern int cpu_has_synced_cp0_count;
401extern int cpu_has_userlocal;
402
403#ifdef FPUEMUL
404#define CPU_HAS_FPU(ci) ((ci)->ci_hw.c1prid != 0)
405#else
406#define CPU_HAS_FPU(ci) 1
407#endif
408
409struct exec_package;
410struct user;
411
412void tlb_asid_wrap(struct cpu_info *);
413void tlb_flush(int);
414void tlb_flush_addr(vaddr_t);
415void tlb_init(unsigned int);
416void tlb_set_page_mask(uint32_t);
417void tlb_set_pid(u_int);
418void tlb_set_wired(uint32_t);
419int tlb_update(vaddr_t, register_t);
420
421void build_trampoline(vaddr_t, vaddr_t);
422void cpu_switchto_asm(struct proc *, struct proc *);
423int exec_md_map(struct proc *, struct exec_package *);
424void savectx(struct user *, int);
425
426int copyinsn(struct proc *, vaddr_t, uint32_t *);
427void enable_fpu(struct proc *);
428void save_fpu(void);
429int fpe_branch_emulate(struct proc *, struct trapframe *, uint32_t,
430 vaddr_t);
431void MipsSaveCurFPState(struct proc *);
432void MipsSaveCurFPState16(struct proc *);
433void MipsSwitchFPState(struct proc *, struct trapframe *);
434void MipsSwitchFPState16(struct proc *, struct trapframe *);
435
436void MipsFPTrap(struct trapframe *);
437register_t MipsEmulateBranch(struct trapframe *, vaddr_t, uint32_t, uint32_t);
438
439int classify_insn(uint32_t);
440#define INSNCLASS_NEUTRAL 0
441#define INSNCLASS_CALL 1
442#define INSNCLASS_BRANCH 2
443
444/*
445 * Low level access routines to CPU registers
446 */
447
448void setsoftintr0(void);
449void clearsoftintr0(void);
450void setsoftintr1(void);
451void clearsoftintr1(void);
452register_t enableintr(void);
453register_t disableintr(void);
454register_t getsr(void);
455register_t setsr(register_t);
456
457uint32_t cp0_get_cause(void);
458u_int cp0_get_count(void);
459register_t cp0_get_config(void);
460uint32_t cp0_get_config_1(void);
461uint32_t cp0_get_config_2(void);
462uint32_t cp0_get_config_3(void);
463uint32_t cp0_get_config_4(void);
464uint32_t cp0_get_pagegrain(void);
465register_t cp0_get_prid(void);
466void cp0_reset_cause(register_t);
467void cp0_set_compare(u_int);
468void cp0_set_config(register_t);
469void cp0_set_pagegrain(uint32_t);
470void cp0_set_trapbase(register_t);
471u_int cp1_get_prid(void);
472
473static inline uint32_t
474cp0_get_hwrena(void)
475{
476 uint32_t value;
477 __asm__ volatile ("mfc0 %0, $7" : "=r" (value));
478 return value;
479}
480
481static inline void
482cp0_set_hwrena(uint32_t value)
483{
484 __asm__ volatile ("mtc0 %0, $7" : : "r" (value));
485}
486
487static inline void
488cp0_set_userlocal(void *value)
489{
490 __asm__ volatile (
491 " .set push\n"
492 " .set mips64r2\n"
493 " dmtc0 %0, $4, 2\n"
494 " .set pop\n"
495 : : "r" (value));
496}
497
498static inline u_long
499intr_disable(void)
500{
501 return disableintr();
502}
503
504static inline void
505intr_restore(u_long sr)
506{
507 setsr(sr);
508}
509
510/*
511 * Cache routines (may be overridden)
512 */
513
514#ifndef Mips_SyncCache
515#define Mips_SyncCache(ci) \
516 ((ci)->ci_SyncCache)(ci)
517#endif
518#ifndef Mips_InvalidateICache
519#define Mips_InvalidateICache(ci, va, l) \
520 ((ci)->ci_InvalidateICache)(ci, va, l)
521#endif
522#ifndef Mips_InvalidateICachePage
523#define Mips_InvalidateICachePage(ci, va) \
524 ((ci)->ci_InvalidateICachePage)(ci, va)
525#endif
526#ifndef Mips_SyncICache
527#define Mips_SyncICache(ci) \
528 ((ci)->ci_SyncICache)(ci)
529#endif
530#ifndef Mips_SyncDCachePage
531#define Mips_SyncDCachePage(ci, va, pa) \
532 ((ci)->ci_SyncDCachePage)(ci, va, pa)
533#endif
534#ifndef Mips_HitSyncDCachePage
535#define Mips_HitSyncDCachePage(ci, va, pa) \
536 ((ci)->ci_HitSyncDCachePage)(ci, va, pa)
537#endif
538#ifndef Mips_HitSyncDCache
539#define Mips_HitSyncDCache(ci, va, l) \
540 ((ci)->ci_HitSyncDCache)(ci, va, l)
541#endif
542#ifndef Mips_HitInvalidateDCache
543#define Mips_HitInvalidateDCache(ci, va, l) \
544 ((ci)->ci_HitInvalidateDCache)(ci, va, l)
545#endif
546#ifndef Mips_IOSyncDCache
547#define Mips_IOSyncDCache(ci, va, l, h) \
548 ((ci)->ci_IOSyncDCache)(ci, va, l, h)
549#endif
550
551#endif /* _KERNEL && !_LOCORE */
552#endif /* !_MIPS64_CPU_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/cpustate.h created+150
...@@ -0,0 +1,150 @@
1/* $OpenBSD: cpustate.h,v 1.11 2015/09/27 18:17:08 miod Exp $ */
2
3/*
4 * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#define KERN_REG_SIZE (NUMSAVEREGS * REGSZ)
30#define KERN_EXC_FRAME_SIZE (CF_SZ + KERN_REG_SIZE + 16)
31
32#define SAVE_REG(reg, offs, base, bo) \
33 REG_S reg, bo + (REGSZ * offs) (base)
34
35#define RESTORE_REG(reg, offs, base, bo) \
36 REG_L reg, bo + (REGSZ * offs) (base)
37
38/*
39 * This macro saves the 'scratch' cpu state on stack.
40 * Macros are generic so no 'special' instructions!
41 * a0 will have a pointer to the 'frame' on return.
42 * a1 will have saved STATUS_REG on return.
43 * a3 will have the exception pc on 'return'.
44 * No traps, no interrupts if frame = k1 or k0!
45 * Temp regs are saved with their register number so
46 * branch emulation etc works properly.
47 */
48#define SAVE_CPU(frame, bo) \
49 SAVE_REG(AT, AST, frame, bo) ;\
50 SAVE_REG(v0, V0, frame, bo) ;\
51 SAVE_REG(v1, V1, frame, bo) ;\
52 SAVE_REG(a0, A0, frame, bo) ;\
53 SAVE_REG(a1, A1, frame, bo) ;\
54 SAVE_REG(a2, A2, frame, bo) ;\
55 SAVE_REG(a3, A3, frame, bo) ;\
56 MFC0 a0, COP_0_CAUSE_REG ;\
57 MFC0_HAZARD ;\
58 SAVE_REG(a4, A4, frame, bo) ;\
59 SAVE_REG(a5, A5, frame, bo) ;\
60 MFC0 a1, COP_0_STATUS_REG ;\
61 MFC0_HAZARD ;\
62 SAVE_REG(a6, A6, frame, bo) ;\
63 SAVE_REG(a7, A7, frame, bo) ;\
64 PRE_MFC0_ADDR_HAZARD ;\
65 DMFC0 a2, COP_0_BAD_VADDR ;\
66 MFC0_HAZARD ;\
67 SAVE_REG(t0, T0, frame, bo) ;\
68 SAVE_REG(t1, T1, frame, bo) ;\
69 DMFC0 a3, COP_0_EXC_PC ;\
70 MFC0_HAZARD ;\
71 SAVE_REG(t2, T2, frame, bo) ;\
72 SAVE_REG(t3, T3, frame, bo) ;\
73 SAVE_REG(t8, T8, frame, bo) ;\
74 SAVE_REG(t9, T9, frame, bo) ;\
75 SAVE_REG(gp, GP, frame, bo) ;\
76 SAVE_REG(ra, RA, frame, bo) ;\
77 mflo v0 ;\
78 mfhi v1 ;\
79 SAVE_REG(v0, MULLO, frame, bo) ;\
80 SAVE_REG(v1, MULHI, frame, bo) ;\
81 SAVE_REG(a0, CAUSE, frame, bo) ;\
82 SAVE_REG(a1, SR, frame, bo) ;\
83 SAVE_REG(a2, BADVADDR, frame, bo) ;\
84 SAVE_REG(a3, PC, frame, bo) ;\
85 SAVE_REG(sp, SP, frame, bo) ;\
86 PTR_ADDU a0, frame, bo ;\
87 GET_CPU_INFO(v0, v1) ;\
88 lw a2, CI_IPL(v0) ;\
89 SAVE_REG(a2, CPL, frame, bo)
90
91/*
92 * Save 'callee save' registers in frame to aid DDB.
93 */
94#define SAVE_CPU_SREG(frame, bo) \
95 SAVE_REG(s0, S0, frame, bo) ;\
96 SAVE_REG(s1, S1, frame, bo) ;\
97 SAVE_REG(s2, S2, frame, bo) ;\
98 SAVE_REG(s3, S3, frame, bo) ;\
99 SAVE_REG(s4, S4, frame, bo) ;\
100 SAVE_REG(s5, S5, frame, bo) ;\
101 SAVE_REG(s6, S6, frame, bo) ;\
102 SAVE_REG(s7, S7, frame, bo) ;\
103 SAVE_REG(s8, S8, frame, bo)
104
105/*
106 * Restore cpu state. When called a0 = EXC_PC.
107 */
108#define RESTORE_CPU(frame, bo) \
109 RESTORE_REG(t1, SR, frame, bo) ;\
110 RESTORE_REG(t2, MULLO, frame, bo) ;\
111 RESTORE_REG(t3, MULHI, frame, bo) ;\
112 MTC0 t1, COP_0_STATUS_REG ;\
113 MTC0_SR_IE_HAZARD ;\
114 mtlo t2 ;\
115 mthi t3 ;\
116 DMTC0 a0, COP_0_EXC_PC ;\
117 MTC0_HAZARD ;\
118 RESTORE_REG(AT, AST, frame, bo) ;\
119 RESTORE_REG(v0, V0, frame, bo) ;\
120 RESTORE_REG(v1, V1, frame, bo) ;\
121 RESTORE_REG(a0, A0, frame, bo) ;\
122 RESTORE_REG(a1, A1, frame, bo) ;\
123 RESTORE_REG(a2, A2, frame, bo) ;\
124 RESTORE_REG(a3, A3, frame, bo) ;\
125 RESTORE_REG(a4, A4, frame, bo) ;\
126 RESTORE_REG(a5, A5, frame, bo) ;\
127 RESTORE_REG(a6, A6, frame, bo) ;\
128 RESTORE_REG(a7, A7, frame, bo) ;\
129 RESTORE_REG(t0, T0, frame, bo) ;\
130 RESTORE_REG(t1, T1, frame, bo) ;\
131 RESTORE_REG(t2, T2, frame, bo) ;\
132 RESTORE_REG(t3, T3, frame, bo) ;\
133 RESTORE_REG(t8, T8, frame, bo) ;\
134 RESTORE_REG(t9, T9, frame, bo) ;\
135 RESTORE_REG(gp, GP, frame, bo) ;\
136 RESTORE_REG(ra, RA, frame, bo)
137
138/*
139 * Restore 'callee save' registers
140 */
141#define RESTORE_CPU_SREG(frame, bo) \
142 RESTORE_REG(s0, S0, frame, bo) ;\
143 RESTORE_REG(s1, S1, frame, bo) ;\
144 RESTORE_REG(s2, S2, frame, bo) ;\
145 RESTORE_REG(s3, S3, frame, bo) ;\
146 RESTORE_REG(s4, S4, frame, bo) ;\
147 RESTORE_REG(s5, S5, frame, bo) ;\
148 RESTORE_REG(s6, S6, frame, bo) ;\
149 RESTORE_REG(s7, S7, frame, bo) ;\
150 RESTORE_REG(s8, S8, frame, bo)
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/db_machdep.h created+76
...@@ -0,0 +1,76 @@
1/* $OpenBSD: db_machdep.h,v 1.21 2021/08/30 08:11:12 jasper Exp $ */
2
3/*
4 * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_DB_MACHDEP_H_
30#define _MIPS64_DB_MACHDEP_H_
31
32#include <machine/frame.h>
33#include <machine/trap.h>
34#include <uvm/uvm_param.h>
35
36#define DB_MACHINE_COMMANDS /* We have machine specific commands */
37
38typedef struct trapframe db_regs_t;
39extern db_regs_t ddb_regs;
40
41typedef long db_expr_t;
42
43#define SOFTWARE_SSTEP /* Need software single step */
44#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */
45vaddr_t next_instr_address(vaddr_t, int);
46#define BKPT_SIZE (4)
47#define BKPT_SET(ins) (BREAK_DDB)
48#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0)
49
50#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
51#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
52
53#define PC_REGS(regs) ((vaddr_t)(regs)->pc)
54#define SET_PC_REGS(regs, value) (regs)->pc = (register_t)(value)
55
56/*
57 * Test of instructions to see class.
58 */
59#define inst_branch(i) (classify_insn(i) == INSNCLASS_BRANCH)
60#define inst_trap_return(i) ((i) & 0)
61#define inst_call(i) (classify_insn(i) == INSNCLASS_CALL)
62#define inst_return(i) ((i) == 0x03e00008)
63
64void db_machine_init(void);
65
66int db_enter_ddb(void);
67void db_startcpu(int);
68void db_stopcpu(int);
69
70int dbmd_print_insn(uint32_t, vaddr_t, int (*)(const char *, ...));
71
72#define DDB_STATE_NOT_RUNNING 0
73#define DDB_STATE_RUNNING 1
74#define DDB_STATE_EXITING 2
75
76#endif /* !_MIPS64_DB_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/elf.h created+7
...@@ -0,0 +1,7 @@
1/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
2
3/*
4 * This file is in the public domain.
5 */
6
7/* Nothing for now */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/endian.h created+49
...@@ -0,0 +1,49 @@
1/* $OpenBSD: endian.h,v 1.9 2014/07/12 16:25:08 guenther Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_ENDIAN_H_
30#define _MIPS64_ENDIAN_H_
31
32#if defined(__MIPSEL__)
33#define _BYTE_ORDER _LITTLE_ENDIAN
34#endif
35#if defined(__MIPSEB__)
36#define _BYTE_ORDER _BIG_ENDIAN
37#endif
38
39#if !defined(_BYTE_ORDER)
40#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
41#endif
42
43#define __STRICT_ALIGNMENT
44
45#ifndef __FROM_SYS__ENDIAN
46#include <sys/endian.h>
47#endif
48
49#endif /* _MIPS64_ENDIAN_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/exec.h created+137
...@@ -0,0 +1,137 @@
1/* $OpenBSD: exec.h,v 1.10 2022/10/28 15:07:25 kettenis Exp $ */
2
3/*
4 * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_EXEC_H_
30#define _MIPS64_EXEC_H_
31
32#define __LDPGSZ 16384
33
34#define ARCH_ELFSIZE 64
35#define ELF_TARG_CLASS ELFCLASS64
36
37#if defined(__MIPSEB__)
38#define ELF_TARG_DATA ELFDATA2MSB
39#else
40#define ELF_TARG_DATA ELFDATA2LSB
41#endif
42#define ELF_TARG_MACH EM_MIPS
43
44/* Information taken from MIPS ABI supplement */
45
46/* Architecture dependent Segment types - p_type */
47#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
48
49/* Architecture dependent d_tag field for Elf32_Dyn. */
50#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
51#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
52#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
53#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
54#define DT_MIPS_FLAGS 0x70000005 /* Flags */
55#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
56#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
57#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
58#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
59#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
60#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
61#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
62#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
63#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
64#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
65#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
66#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Relative address of debug map ptr */
67
68#define DT_PROCNUM (DT_MIPS_RLD_MAP_REL - DT_LOPROC + 1)
69
70/*
71 * Legal values for e_flags field of Elf32_Ehdr.
72 */
73#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */
74#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
75#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */
76#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */
77#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */
78#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
79#define E_MIPS_ARCH_1 0x00000000
80#define E_MIPS_ARCH_2 0x10000000
81#define E_MIPS_ARCH_3 0x20000000
82#define E_MIPS_ARCH_4 0x30000000
83#define EF_MIPS_ABI 0x0000f000 /* ABI level */
84#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */
85#define E_MIPS_ABI_O32 0x00001000
86#define E_MIPS_ABI_O64 0x00002000
87#define E_MIPS_ABI_EABI32 0x00004000
88#define E_MIPS_ABI_EABI64 0x00004000
89
90/*
91 * Mips special sections.
92 */
93#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
94#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
95#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
96
97/*
98 * Legal values for sh_type field of Elf32_Shdr.
99 */
100#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
101#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
102#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
103#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
104#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
105#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
106
107/*
108 * Legal values for sh_flags field of Elf32_Shdr.
109 */
110#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
111
112#if 0
113/*
114 * Entries found in sections of type SHT_MIPS_GPTAB.
115 */
116typedef union {
117 struct {
118 Elf32_Word gt_current_g_value; /* -G val used in compilation */
119 Elf32_Word gt_unused; /* Not used */
120 } gt_header; /* First entry in section */
121 struct {
122 Elf32_Word gt_g_value; /* If this val were used for -G */
123 Elf32_Word gt_bytes; /* This many bytes would be used */
124 } gt_entry; /* Subsequent entries in section */
125} Elf32_gptab;
126
127/*
128 * Entry found in sections of type SHT_MIPS_REGINFO.
129 */
130typedef struct {
131 Elf32_Word ri_gprmask; /* General registers used */
132 Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
133 Elf32_Sword ri_gp_value; /* $gp register value */
134} Elf32_RegInfo;
135#endif
136
137#endif /* !_MIPS64_EXEC_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/fenv.h created+94
...@@ -0,0 +1,94 @@
1/* $OpenBSD: fenv.h,v 1.3 2011/05/25 21:46:49 martynas Exp $ */
2
3/*
4 * Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
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#ifndef _MIPS64_FENV_H_
20#define _MIPS64_FENV_H_
21
22/*
23 * Each symbol representing a floating point exception expands to an integer
24 * constant expression with values, such that bitwise-inclusive ORs of _all
25 * combinations_ of the constants result in distinct values.
26 *
27 * We use such values that allow direct bitwise operations on FPU registers.
28 */
29#define FE_INEXACT 0x04
30#define FE_UNDERFLOW 0x08
31#define FE_OVERFLOW 0x10
32#define FE_DIVBYZERO 0x20
33#define FE_INVALID 0x40
34
35/*
36 * The following symbol is simply the bitwise-inclusive OR of all floating-point
37 * exception constants defined above.
38 */
39#define FE_ALL_EXCEPT (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | \
40 FE_DIVBYZERO | FE_INVALID)
41#define _MASK_SHIFT 5
42
43/*
44 * Each symbol representing the rounding direction, expands to an integer
45 * constant expression whose value is distinct non-negative value.
46 *
47 * We use such values that allow direct bitwise operations on FPU registers.
48 */
49#define FE_TONEAREST 0x0
50#define FE_TOWARDZERO 0x1
51#define FE_UPWARD 0x2
52#define FE_DOWNWARD 0x3
53
54/*
55 * The following symbol is simply the bitwise-inclusive OR of all floating-point
56 * rounding direction constants defined above.
57 */
58#define _ROUND_MASK (FE_TONEAREST | FE_TOWARDZERO | FE_UPWARD | \
59 FE_DOWNWARD)
60
61/*
62 * fenv_t represents the entire floating-point environment.
63 */
64typedef unsigned int fenv_t;
65
66/*
67 * The following constant represents the default floating-point environment
68 * (that is, the one installed at program startup) and has type pointer to
69 * const-qualified fenv_t.
70 *
71 * It can be used as an argument to the functions within the <fenv.h> header
72 * that manage the floating-point environment, namely fesetenv() and
73 * feupdateenv().
74 */
75__BEGIN_DECLS
76extern fenv_t __fe_dfl_env;
77__END_DECLS
78#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env)
79
80/*
81 * fexcept_t represents the floating-point status flags collectively, including
82 * any status the implementation associates with the flags.
83 *
84 * A floating-point status flag is a system variable whose value is set (but
85 * never cleared) when a floating-point exception is raised, which occurs as a
86 * side effect of exceptional floating-point arithmetic to provide auxiliary
87 * information.
88 *
89 * A floating-point control mode is a system variable whose value may be set by
90 * the user to affect the subsequent behavior of floating-point arithmetic.
91 */
92typedef unsigned int fexcept_t;
93
94#endif /* !_MIPS64_FENV_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/fpu.h created+73
...@@ -0,0 +1,73 @@
1/* $OpenBSD: fpu.h,v 1.2 2012/12/04 05:00:40 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2010 Miodrag Vallat.
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 * Layout of the floating-point control/status register (FCR31)
21 */
22
23/* flush denormalized results to zero instead of causing FPCSR_C_E */
24#define FPCSR_FS 0x01000000
25
26/* compare condition bits: one bit for MIPS I/II/III, eight bits for MIPS IV */
27#define FPCSR_CONDBIT(c) ((c) == 0 ? 23 : 24 + (c))
28#define FPCSR_CONDVAL(c) (1U << FPCSR_CONDBIT(c))
29
30/* cause bits */
31#define FPCSR_C_E 0x00020000 /* unimplemented operation */
32#define FPCSR_C_V 0x00010000 /* invalid operation */
33#define FPCSR_C_Z 0x00008000 /* division by zero */
34#define FPCSR_C_O 0x00004000 /* overflow */
35#define FPCSR_C_U 0x00002000 /* underflow */
36#define FPCSR_C_I 0x00001000 /* inexact */
37
38/* enable bits */
39#define FPCSR_E_V 0x00000800 /* invalid operation */
40#define FPCSR_E_Z 0x00000400 /* division by zero */
41#define FPCSR_E_O 0x00000200 /* overflow */
42#define FPCSR_E_U 0x00000100 /* underflow */
43#define FPCSR_E_I 0x00000080 /* inexact */
44
45/* flags bits */
46#define FPCSR_F_V 0x00000040 /* invalid operation */
47#define FPCSR_F_Z 0x00000020 /* division by zero */
48#define FPCSR_F_O 0x00000010 /* overflow */
49#define FPCSR_F_U 0x00000008 /* underflow */
50#define FPCSR_F_I 0x00000004 /* inexact */
51
52#define FPCSR_C_MASK 0x0003f000
53#define FPCSR_C_SHIFT 12
54#define FPCSR_E_MASK 0x00000f80
55#define FPCSR_E_SHIFT 7
56#define FPCSR_F_MASK 0x0000007c
57#define FPCSR_F_SHIFT 2
58#define FPCSR_RM_MASK 0x00000003 /* rounding mode */
59
60#ifndef _KERNEL
61
62/*
63 * IRIX-compatible interfaces allowing userland to control the state
64 * of the floating-point control/status register. These are intended
65 * to let userland control the state of the FS bit.
66 */
67#include <sys/cdefs.h>
68
69__BEGIN_DECLS
70int get_fpc_csr(void);
71int set_fpc_csr(int);
72__END_DECLS
73#endif /* _KERNEL */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/frame.h created+114
...@@ -0,0 +1,114 @@
1/* $OpenBSD: frame.h,v 1.8 2021/04/29 12:49:19 visa Exp $ */
2
3/*
4 * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#ifndef _MIPS64_FRAME_H_
29#define _MIPS64_FRAME_H_
30
31/*
32 * The layout of this *must* match with regnum.h or bad things
33 * will happen. libc setjmp/longjmp depends on this as well.
34 */
35struct trapframe {
36 register_t zero;
37 register_t ast;
38 register_t v0;
39 register_t v1;
40 register_t a0;
41 register_t a1;
42 register_t a2;
43 register_t a3;
44 register_t a4; /* ta0 */
45 register_t a5; /* ta1 */
46 register_t a6; /* ta2 */
47 register_t a7; /* ta3 */
48 register_t t0;
49 register_t t1;
50 register_t t2;
51 register_t t3;
52 register_t s0;
53 register_t s1;
54 register_t s2;
55 register_t s3;
56 register_t s4;
57 register_t s5;
58 register_t s6;
59 register_t s7;
60 register_t t8;
61 register_t t9;
62 register_t k0;
63 register_t k1;
64 register_t gp;
65 register_t sp;
66 register_t s8;
67 register_t ra;
68 register_t sr;
69 register_t mullo;
70 register_t mulhi;
71 register_t badvaddr;
72 register_t cause;
73 register_t pc;
74 register_t ic; /* unused, was RM7000 ICR */
75 register_t ipl;
76
77/* From here and on, only saved user processes. */
78
79 f_register_t f0;
80 f_register_t f1;
81 f_register_t f2;
82 f_register_t f3;
83 f_register_t f4;
84 f_register_t f5;
85 f_register_t f6;
86 f_register_t f7;
87 f_register_t f8;
88 f_register_t f9;
89 f_register_t f10;
90 f_register_t f11;
91 f_register_t f12;
92 f_register_t f13;
93 f_register_t f14;
94 f_register_t f15;
95 f_register_t f16;
96 f_register_t f17;
97 f_register_t f18;
98 f_register_t f19;
99 f_register_t f20;
100 f_register_t f21;
101 f_register_t f22;
102 f_register_t f23;
103 f_register_t f24;
104 f_register_t f25;
105 f_register_t f26;
106 f_register_t f27;
107 f_register_t f28;
108 f_register_t f29;
109 f_register_t f30;
110 f_register_t f31;
111 register_t fsr;
112};
113
114#endif /* !_MIPS64_FRAME_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/ieee.h created+169
...@@ -0,0 +1,169 @@
1/* $OpenBSD: ieee.h,v 1.4 2010/01/23 19:11:21 miod Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley.
10 *
11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement:
13 * This product includes software developed by the University of
14 * California, Lawrence Berkeley Laboratory.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)ieee.h 8.1 (Berkeley) 6/11/93
41 */
42
43/*
44 * ieee.h defines the machine-dependent layout of the machine's IEEE
45 * floating point. It does *not* define (yet?) any of the rounding
46 * mode bits, exceptions, and so forth.
47 */
48
49/*
50 * Define the number of bits in each fraction and exponent.
51 *
52 * k k+1
53 * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
54 *
55 * (-exp_bias+1)
56 * as fractions that look like 0.fffff x 2 . This means that
57 *
58 * -126
59 * the number 0.10000 x 2 , for instance, is the same as the normalized
60 *
61 * -127 -128
62 * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
63 *
64 * -129
65 * in the fraction; to represent 2 , we need two, and so on. This
66 *
67 * (-exp_bias-fracbits+1)
68 * implies that the smallest denormalized number is 2
69 *
70 * for whichever format we are talking about: for single precision, for
71 *
72 * -126 -149
73 * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
74 *
75 * -149 == -127 - 23 + 1.
76 */
77#define SNG_EXPBITS 8
78#define SNG_FRACBITS 23
79
80#define DBL_EXPBITS 11
81#define DBL_FRACHBITS 20
82#define DBL_FRACLBITS 32
83#define DBL_FRACBITS 52
84
85#define EXT_EXPBITS 15
86#define EXT_FRACHBITS 16
87#define EXT_FRACHMBITS 32
88#define EXT_FRACLMBITS 32
89#define EXT_FRACLBITS 32
90#define EXT_FRACBITS 112
91
92#define EXT_IMPLICIT_NBIT
93
94#define EXT_TO_ARRAY32(p, a) do { \
95 (a)[0] = (uint32_t)(p)->ext_fracl; \
96 (a)[1] = (uint32_t)(p)->ext_fraclm; \
97 (a)[2] = (uint32_t)(p)->ext_frachm; \
98 (a)[3] = (uint32_t)(p)->ext_frach; \
99} while(0)
100
101struct ieee_single {
102#ifdef __MIPSEB__
103 u_int sng_sign:1;
104 u_int sng_exp:8;
105 u_int sng_frac:23;
106#else
107 u_int sng_frac:23;
108 u_int sng_exp:8;
109 u_int sng_sign:1;
110#endif
111};
112
113struct ieee_double {
114#ifdef __MIPSEB__
115 u_int dbl_sign:1;
116 u_int dbl_exp:11;
117 u_int dbl_frach:20;
118 u_int dbl_fracl;
119#else
120 u_int dbl_fracl;
121 u_int dbl_frach:20;
122 u_int dbl_exp:11;
123 u_int dbl_sign:1;
124#endif
125};
126
127struct ieee_ext {
128#ifdef __MIPSEB__
129 u_int ext_sign:1;
130 u_int ext_exp:15;
131 u_int ext_frach:16;
132 u_int ext_frachm;
133 u_int ext_fraclm;
134 u_int ext_fracl;
135#else
136 u_int ext_fracl;
137 u_int ext_fraclm;
138 u_int ext_frachm;
139 u_int ext_frach:16;
140 u_int ext_exp:15;
141 u_int ext_sign:1;
142#endif
143};
144
145/*
146 * Floats whose exponent is in [1..INFNAN) (of whatever type) are
147 * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
148 * Floats whose exponent is zero are either zero (iff all fraction
149 * bits are zero) or subnormal values.
150 *
151 * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
152 * high fraction; if the bit is set, it is a `quiet NaN'.
153 */
154#define SNG_EXP_INFNAN 255
155#define DBL_EXP_INFNAN 2047
156#define EXT_EXP_INFNAN 32767
157
158#if 0
159#define SNG_QUIETNAN (1 << 22)
160#define DBL_QUIETNAN (1 << 19)
161#define EXT_QUIETNAN (1 << 15)
162#endif
163
164/*
165 * Exponent biases.
166 */
167#define SNG_EXP_BIAS 127
168#define DBL_EXP_BIAS 1023
169#define EXT_EXP_BIAS 16383
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/ieeefp.h created+46
...@@ -0,0 +1,46 @@
1/* $OpenBSD: ieeefp.h,v 1.4 2011/03/23 16:54:36 pirofti Exp $ */
2
3/*
4 * Written by J.T. Conklin, Apr 11, 1995
5 * Public domain.
6 */
7
8#ifndef _MIPS64_IEEEFP_H_
9#define _MIPS64_IEEEFP_H_
10
11typedef int fp_except;
12#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
13#define FP_X_UFL 0x02 /* underflow exception */
14#define FP_X_OFL 0x04 /* overflow exception */
15#define FP_X_DZ 0x08 /* divide-by-zero exception */
16#define FP_X_INV 0x10 /* invalid operation exception */
17
18typedef enum {
19 FP_RN=0, /* round to nearest representable number */
20 FP_RZ=1, /* round to zero (truncate) */
21 FP_RP=2, /* round toward positive infinity */
22 FP_RM=3 /* round toward negative infinity */
23} fp_rnd;
24
25#ifdef _KERNEL
26
27/*
28 * Defines for the floating-point completion/emulation code.
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/proc.h>
34#include <machine/fpu.h>
35
36#define float_raise(bits) \
37 do { curproc->p_md.md_regs->fsr |= (bits) << FPCSR_C_SHIFT; } while (0)
38#define float_set_inexact() float_raise(FP_X_IMP)
39#define float_set_invalid() float_raise(FP_X_INV)
40
41#define float_get_round(csr) (csr & FPCSR_RM_MASK)
42#define fpgetround() float_get_round(curproc->p_md.md_regs->fsr)
43
44#endif
45
46#endif /* !_MIPS64_IEEEFP_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/kcore.h created+40
...@@ -0,0 +1,40 @@
1/* $OpenBSD: kcore.h,v 1.3 2023/01/04 10:59:34 jsg Exp $ */
2/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */
3
4/*
5 * Copyright (c) 1996 Leo Weppelman.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef _MIPS64_KCORE_H_
30#define _MIPS64_KCORE_H_
31
32#define NPHYS_RAM_SEGS 8
33
34typedef struct cpu_kcore_hdr {
35 paddr_t kernel_pa; /* Phys. address of kernel VA 0 */
36 int mmutype;
37 phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
38} cpu_kcore_hdr_t;
39
40#endif /* !_MIPS64_KCORE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/limits.h created+53
...@@ -0,0 +1,53 @@
1/* $OpenBSD: limits.h,v 1.8 2015/04/30 13:42:08 millert Exp $ */
2
3/*
4 * Copyright (c) 1988, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)limits.h 8.3 (Berkeley) 1/4/94
32 */
33
34#ifndef _MIPS64_LIMITS_H_
35#define _MIPS64_LIMITS_H_
36
37#include <sys/cdefs.h>
38
39#if __POSIX_VISIBLE || __XPG_VISIBLE
40#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
41#endif
42
43#if __BSD_VISIBLE
44#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */
45
46/* Quads and longs are the same on mips64 */
47#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
48#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
49#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
50
51#endif /* __BSD_VISIBLE */
52
53#endif /* !_MIPS64_LIMITS_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/loongson2.h created+65
...@@ -0,0 +1,65 @@
1/* $OpenBSD: loongson2.h,v 1.4 2013/01/16 20:28:06 miod Exp $ */
2
3/*
4 * Copyright (c) 2009 Miodrag Vallat.
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#ifndef _MIPS64_LOONGSON2_H_
20#define _MIPS64_LOONGSON2_H_
21
22/*
23 * Loongson 2E/2F specific defines
24 */
25
26/*
27 * Address Window registers physical addresses
28 *
29 * The Loongson 2F processor has an AXI crossbar with four possible bus
30 * masters, each one having four programmable address windows.
31 *
32 * Each window is defined with three 64-bit registers:
33 * - a base address register, defining the address in the master address
34 * space (base register).
35 * - an address mask register, defining which address bits are valid in this
36 * window. A given address matches a window if (addr & mask) == base.
37 * - the location of the window base in the target, as well at the target
38 * number itself (mmap register). The lower 20 bits of the address are
39 * forced as zeroes regardless of their value in this register.
40 * The translated address is thus (addr & ~mask) | (mmap & ~0xfffff).
41 */
42
43#define LOONGSON_AWR_BASE_ADDRESS 0x3ff00000
44
45#define LOONGSON_AWR_BASE(master, window) \
46 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x00)
47#define LOONGSON_AWR_SIZE(master, window) \
48 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x20)
49#define LOONGSON_AWR_MMAP(master, window) \
50 (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x40)
51
52/*
53 * Bits in the diagnostic register
54 */
55
56#define COP_0_DIAG_ITLB_CLEAR 0x04
57#define COP_0_DIAG_BTB_CLEAR 0x02
58#define COP_0_DIAG_RAS_DISABLE 0x01
59
60#if defined(_KERNEL) && !defined(_LOCORE)
61int loongson2f_cpuspeed(int *);
62void loongson2f_setperf(int);
63#endif
64
65#endif /* _MIPS64_LOONGSON2_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/loongson3.h created+108
...@@ -0,0 +1,108 @@
1/* $OpenBSD: loongson3.h,v 1.3 2017/05/10 16:04:21 visa Exp $ */
2
3/*
4 * Copyright (c) 2016 Visa Hankala
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#ifndef _MIPS64_LOONGSON3_H_
20#define _MIPS64_LOONGSON3_H_
21
22/*
23 * Definitions for Loongson 3A.
24 */
25
26#define LS3_CFG_BASE(node) (0x100000004000ull*(node) + 0x3ff00000)
27#define LS3_MEM_BASE(node) (0x100000000000ull*(node))
28
29#define LS3_IPI_BASE(n, c) (LS3_CFG_BASE(n) + 0x1000 + 0x100*(c))
30#define LS3_IPI_ISR 0x00
31#define LS3_IPI_IMR 0x04
32#define LS3_IPI_SET 0x08
33#define LS3_IPI_CLEAR 0x0c
34#define LS3_IPI_MBOX0 0x20
35#define LS3_IPI_MBOX1 0x28
36#define LS3_IPI_MBOX2 0x30
37#define LS3_IPI_MBOX3 0x38
38
39static inline uint32_t
40loongson3_get_cpuid(void)
41{
42 uint32_t tmp;
43
44 asm volatile (
45 " .set push\n"
46 " .set mips64\n"
47 " mfc0 %0, $15, 1\n" /* EBase */
48 " .set pop\n"
49 : "=r" (tmp));
50
51 return tmp & 0xf;
52}
53
54#define LS3_COREID(cpuid) ((cpuid) & 3)
55#define LS3_NODEID(cpuid) ((cpuid) >> 2)
56
57/*
58 * Interrupt router registers
59 */
60
61#define LS3_IRT_ENTRY(node, irq) (LS3_CFG_BASE(node) + 0x1400 + (irq))
62#define LS3_IRT_INTISR(node) (LS3_CFG_BASE(node) + 0x1420)
63#define LS3_IRT_INTEN(node) (LS3_CFG_BASE(node) + 0x1424)
64#define LS3_IRT_INTENSET(node) (LS3_CFG_BASE(node) + 0x1428)
65#define LS3_IRT_INTENCLR(node) (LS3_CFG_BASE(node) + 0x142c)
66#define LS3_IRT_INTISR_CORE(node, cpu) (LS3_CFG_BASE(node) + 0x1440 + (cpu)*8)
67
68/* sys int 0-3 */
69#define LS3_IRT_ENTRY_INT(node, x) LS3_IRT_ENTRY((node), (x))
70/* PCI int 0-3 */
71#define LS3_IRT_ENTRY_PCI(node, x) LS3_IRT_ENTRY((node), 0x04+(x))
72/* LPC int */
73#define LS3_IRT_ENTRY_LPC(node) LS3_IRT_ENTRY((node), 0x0a)
74/* HT0 int 0-7 */
75#define LS3_IRT_ENTRY_HT0(node, x) LS3_IRT_ENTRY((node), 0x10+(x))
76/* HT1 int 0-7 */
77#define LS3_IRT_ENTRY_HT1(node, x) LS3_IRT_ENTRY((node), 0x18+(x))
78
79#define LS3_IRT_ROUTE(core, intr) ((0x01 << (core)) | (0x10 << (intr)))
80
81#define LS3_IRQ_INT(x) (x) /* sys int 0-3 */
82#define LS3_IRQ_PCI(x) ((x) + 0x04) /* PCI int 0-3 */
83#define LS3_IRQ_LPC 0x0a /* LPC int */
84#define LS3_IRQ_HT0(x) ((x) + 0x10) /* HT0 int 0-7 */
85#define LS3_IRQ_HT1(x) ((x) + 0x18) /* HT1 int 0-7 */
86#define LS3_IRQ_NUM 32
87
88#define LS3_IRQ_IS_HT(irq) ((irq) >= 0x10)
89
90#define LS3_IRQ_HT_MASK 0xffff0000u
91
92/*
93 * Number of HyperTransport interrupt vectors. In reality, each HT interface
94 * has 256 vectors, but the interrupt code uses only a subset of them.
95 */
96#define LS3_HT_IRQ_NUM 32
97
98/*
99 * HyperTransport registers
100 */
101
102#define LS3_HT1_MEM_BASE(n) (LS3_MEM_BASE(n)+0x00000e0000000000ull)
103#define LS3_HT1_CFG_BASE(n) (LS3_MEM_BASE(n)+0x00000efdfb000000ull)
104
105#define LS3_HT_ISR_OFFSET(x) (0x80 + (x) * 4)
106#define LS3_HT_IMR_OFFSET(x) (0xa0 + (x) * 4)
107
108#endif /* _MIPS64_LOONGSON3_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/memconf.h created+48
...@@ -0,0 +1,48 @@
1/* $OpenBSD: memconf.h,v 1.7 2011/05/30 22:25:21 oga Exp $ */
2
3/*
4 * Copyright (c) 1996 Per Fogelstrom
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/*
29 * Memory config list used by pmap_bootstrap.
30 */
31
32#ifndef _MIPS64_MEMCONF_H_
33#define _MIPS64_MEMCONF_H_
34
35struct phys_mem_desc {
36 uint64_t mem_first_page;
37 uint64_t mem_last_page;
38};
39
40#ifdef _KERNEL
41#ifndef MAXMEMSEGS
42#define MAXMEMSEGS 16
43#endif
44extern struct phys_mem_desc mem_layout[];
45int memrange_register(uint64_t, uint64_t, uint64_t);
46#endif
47
48#endif /* !_MIPS64_MEMCONF_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/mips_cpu.h created+282
...@@ -0,0 +1,282 @@
1/* $OpenBSD: mips_cpu.h,v 1.11 2022/12/11 05:07:25 visa Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell and Rick Macklem.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * Copyright (C) 1989 Digital Equipment Corporation.
35 * Permission to use, copy, modify, and distribute this software and
36 * its documentation for any purpose and without fee is hereby granted,
37 * provided that the above copyright notice appears in all copies.
38 * Digital Equipment Corporation makes no representations about the
39 * suitability of this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
41 *
42 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
43 */
44
45#ifndef _MIPS64_CPUREGS_H_
46#define _MIPS64_CPUREGS_H_
47
48#if defined(_KERNEL) || defined(_STANDALONE)
49
50/*
51 * Status register.
52 */
53
54#define SR_COP_USABILITY 0x30000000 /* CP0 and CP1 only */
55#define SR_COP_0_BIT 0x10000000
56#define SR_COP_1_BIT 0x20000000
57#define SR_COP_2_BIT 0x40000000
58#define SR_RP 0x08000000
59#define SR_FR_32 0x04000000
60#define SR_RE 0x02000000
61#define SR_DSD 0x01000000 /* Only on R12000 */
62#define SR_BOOT_EXC_VEC 0x00400000
63#define SR_TLB_SHUTDOWN 0x00200000
64#define SR_SOFT_RESET 0x00100000
65#define SR_DIAG_CH 0x00040000
66#define SR_DIAG_CE 0x00020000
67#define SR_DIAG_DE 0x00010000
68#define SR_KX 0x00000080
69#define SR_SX 0x00000040
70#define SR_UX 0x00000020
71#define SR_ERL 0x00000004
72#define SR_EXL 0x00000002
73#define SR_INT_ENAB 0x00000001
74
75#define SOFT_INT_MASK_0 0x00000100
76#define SOFT_INT_MASK_1 0x00000200
77#define SR_INT_MASK_0 0x00000400
78#define SR_INT_MASK_1 0x00000800
79#define SR_INT_MASK_2 0x00001000
80#define SR_INT_MASK_3 0x00002000
81#define SR_INT_MASK_4 0x00004000
82#define SR_INT_MASK_5 0x00008000
83
84#define SR_XX 0x80000000
85#define SR_KSU_MASK 0x00000018
86#define SR_KSU_SUPER 0x00000008
87#define SR_KSU_KERNEL 0x00000000
88#define SR_INT_MASK 0x0000ff00
89/* SR_KSU_USER is in <mips64/cpu.h> for CLKF_USERMODE() */
90#ifndef SR_KSU_USER
91#define SR_KSU_USER 0x00000010
92#endif
93
94#define SOFT_INT_MASK (SOFT_INT_MASK_0 | SOFT_INT_MASK_1)
95
96/*
97 * Cause register.
98 */
99
100#define CR_BR_DELAY 0x80000000
101#define CR_BR_DELAY_SHIFT 31
102#define CR_EXC_CODE 0x0000007c
103#define CR_EXC_CODE_SHIFT 2
104#define CR_COP_ERR 0x30000000
105#define CR_COP1_ERR 0x10000000
106#define CR_COP2_ERR 0x20000000
107#define CR_COP3_ERR 0x20000000
108#define CR_INT_SOFT0 0x00000100
109#define CR_INT_SOFT1 0x00000200
110#define CR_INT_0 0x00000400
111#define CR_INT_1 0x00000800
112#define CR_INT_2 0x00001000
113#define CR_INT_3 0x00002000
114#define CR_INT_4 0x00004000
115#define CR_INT_5 0x00008000
116
117#define CR_INT_MASK 0x003fff00
118
119/*
120 * Config register.
121 */
122
123#define CFGR_CCA_MASK 0x00000007
124#define CFGR_CU 0x00000008
125#define CFGR_ICE 0x0000000200000000
126#define CFGR_SMM 0x0000000400000000
127
128/*
129 * Location of exception vectors.
130 */
131
132#define RESET_EXC_VEC (CKSEG1_BASE + 0x1fc00000)
133#define TLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000000)
134#define XTLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000080)
135#define CACHE_ERR_EXC_VEC (CKSEG1_BASE + 0x00000100)
136#define GEN_EXC_VEC (CKSEG1_BASE + 0x00000180)
137
138/*
139 * Coprocessor 0 registers
140 */
141
142/* Common subset */
143#define COP_0_COUNT $9
144#define COP_0_TLB_HI $10
145#define COP_0_STATUS_REG $12
146#define COP_0_CAUSE_REG $13
147#define COP_0_EXC_PC $14
148#define COP_0_PRID $15
149#define COP_0_CONFIG $16
150
151/* MIPS64 release 2 */
152#define COP_0_USERLOCAL $4, 2
153#define COP_0_TLB_PG_GRAIN $5, 1
154#define COP_0_EBASE $15, 1
155
156/* R4000/5000/10000 */
157#define COP_0_TLB_INDEX $0
158#define COP_0_TLB_RANDOM $1
159#define COP_0_TLB_LO0 $2
160#define COP_0_TLB_LO1 $3
161#define COP_0_TLB_CONTEXT $4
162#define COP_0_TLB_PG_MASK $5
163#define COP_0_TLB_WIRED $6
164#define COP_0_BAD_VADDR $8
165#define COP_0_COMPARE $11
166#define COP_0_LLADDR $17
167#define COP_0_WATCH_LO $18
168#define COP_0_WATCH_HI $19
169#define COP_0_TLB_XCONTEXT $20
170#define COP_0_ECC $26
171#define COP_0_CACHE_ERR $27
172#define COP_0_TAG_LO $28
173#define COP_0_TAG_HI $29
174#define COP_0_ERROR_PC $30
175
176/* Loongson-2 specific */
177#define COP_0_DIAG $22
178
179/* Octeon specific */
180#define COP_0_CVMCTL $9, 7
181#define COP_0_CVMMEMCTL $11, 7
182
183/*
184 * COP_0_COUNT speed divider.
185 */
186#if defined(CPU_OCTEON)
187#define CP0_CYCLE_DIVIDER 1
188#else
189#define CP0_CYCLE_DIVIDER 2
190#endif
191
192/*
193 * The floating point version and status registers.
194 */
195#define FPC_ID $0
196#define FPC_CSR $31
197
198/*
199 * Config1 register
200 */
201#define CONFIG1_M 0x80000000u
202#define CONFIG1_MMUSize1 0x7e000000u
203#define CONFIG1_MMUSize1_SHIFT 25
204#define CONFIG1_IS 0x01c00000u
205#define CONFIG1_IS_SHIFT 22
206#define CONFIG1_IL 0x00380000u
207#define CONFIG1_IL_SHIFT 19
208#define CONFIG1_IA 0x00070000u
209#define CONFIG1_IA_SHIFT 16
210#define CONFIG1_DS 0x0000e000u
211#define CONFIG1_DS_SHIFT 13
212#define CONFIG1_DL 0x00001c00u
213#define CONFIG1_DL_SHIFT 10
214#define CONFIG1_DA 0x00000380u
215#define CONFIG1_DA_SHIFT 7
216#define CONFIG1_C2 0x00000040u
217#define CONFIG1_MD 0x00000020u
218#define CONFIG1_PC 0x00000010u
219#define CONFIG1_WR 0x00000008u
220#define CONFIG1_CA 0x00000004u
221#define CONFIG1_EP 0x00000002u
222#define CONFIG1_FP 0x00000001u
223
224/*
225 * Config3 register
226 */
227#define CONFIG3_M 0x80000000
228#define CONFIG3_BPG 0x40000000
229#define CONFIG3_CMGCR 0x20000000
230#define CONFIG3_IPLW 0x00600000
231#define CONFIG3_MMAR 0x001c0000
232#define CONFIG3_MCU 0x00020000
233#define CONFIG3_ISAOnExc 0x00010000
234#define CONFIG3_ISA 0x0000c000
235#define CONFIG3_ULRI 0x00002000
236#define CONFIG3_RXI 0x00001000
237#define CONFIG3_DSP2P 0x00000800
238#define CONFIG3_DSPP 0x00000400
239#define CONFIG3_CTXTC 0x00000200
240#define CONFIG3_ITL 0x00000100
241#define CONFIG3_LPA 0x00000080
242#define CONFIG3_VEIC 0x00000040
243#define CONFIG3_VInt 0x00000020
244#define CONFIG3_SP 0x00000010
245#define CONFIG3_CDMM 0x00000008
246#define CONFIG3_MT 0x00000004
247#define CONFIG3_SM 0x00000002
248#define CONFIG3_TL 0x00000001
249
250/*
251 * Config4 register
252 */
253#define CONFIG4_M 0x80000000u
254#define CONFIG4_IE 0x60000000u
255#define CONFIG4_AE 0x10000000u
256#define CONFIG4_VTLBSizeExt 0x0f000000u /* when MMUExtDef=3 */
257#define CONFIG4_KScrExist 0x00ff0000u
258#define CONFIG4_MMUExtDef 0x0000c000u
259#define CONFIG4_MMUExtDef_SHIFT 14
260#define CONFIG4_FTLBPageSize 0x00001f00u /* when MMUExtDef=2 or 3 */
261#define CONFIG4_FTLBWays 0x000000f0u /* when MMUExtDef=2 or 3 */
262#define CONFIG4_FTLBSets 0x0000000fu /* when MMUExtDef=2 or 3 */
263#define CONFIG4_MMUSizeExt 0x000000ffu /* when MMUExtDef=1 */
264
265/*
266 * PageGrain register
267 */
268#define PGRAIN_RIE 0x80000000
269#define PGRAIN_XIE 0x40000000
270#define PGRAIN_ELPA 0x20000000
271#define PGRAIN_ESP 0x10000000
272#define PGRAIN_IEC 0x08000000
273
274/*
275 * HWREna register
276 */
277#define HWRENA_ULR 0x20000000u
278#define HWRENA_CC 0x00000004u
279
280#endif /* _KERNEL || _STANDALONE */
281
282#endif /* !_MIPS64_CPUREGS_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/mips_opcode.h created+347
...@@ -0,0 +1,347 @@
1/* $OpenBSD: mips_opcode.h,v 1.9 2017/04/20 15:42:26 visa Exp $ */
2
3/*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_MIPS_OPCODE_H_
38#define _MIPS64_MIPS_OPCODE_H_
39
40/*
41 * Define the instruction formats and opcode values for the
42 * MIPS instruction set.
43 */
44
45/*
46 * Define the instruction formats.
47 */
48typedef union {
49 unsigned word;
50
51#if BYTE_ORDER == BIG_ENDIAN
52 struct {
53 unsigned op: 6;
54 unsigned rs: 5;
55 unsigned rt: 5;
56 unsigned imm: 16;
57 } IType;
58
59 struct {
60 unsigned op: 6;
61 unsigned target: 26;
62 } JType;
63
64 struct {
65 unsigned op: 6;
66 unsigned rs: 5;
67 unsigned rt: 5;
68 unsigned rd: 5;
69 unsigned shamt: 5;
70 unsigned func: 6;
71 } RType;
72
73 struct {
74 unsigned op: 6; /* COP1 */
75 unsigned : 1; /* always '1' */
76 unsigned fmt: 4;
77 unsigned ft: 5;
78 unsigned fs: 5;
79 unsigned fd: 5;
80 unsigned func: 6;
81 } FRType;
82
83 struct {
84 unsigned op: 6; /* COP1X */
85 unsigned fr: 5;
86 unsigned ft: 5;
87 unsigned fs: 5;
88 unsigned fd: 5;
89 unsigned op4: 3;
90 unsigned fmt3: 3;
91 } FQType;
92#endif
93#if BYTE_ORDER == LITTLE_ENDIAN
94 struct {
95 unsigned imm: 16;
96 unsigned rt: 5;
97 unsigned rs: 5;
98 unsigned op: 6;
99 } IType;
100
101 struct {
102 unsigned target: 26;
103 unsigned op: 6;
104 } JType;
105
106 struct {
107 unsigned func: 6;
108 unsigned shamt: 5;
109 unsigned rd: 5;
110 unsigned rt: 5;
111 unsigned rs: 5;
112 unsigned op: 6;
113 } RType;
114
115 struct {
116 unsigned func: 6;
117 unsigned fd: 5;
118 unsigned fs: 5;
119 unsigned ft: 5;
120 unsigned fmt: 4;
121 unsigned : 1; /* always '1' */
122 unsigned op: 6; /* COP1 */
123 } FRType;
124
125 struct {
126 unsigned fmt3: 3;
127 unsigned op4: 3;
128 unsigned fd: 5;
129 unsigned fs: 5;
130 unsigned ft: 5;
131 unsigned fr: 5;
132 unsigned op: 6; /* COP1X */
133 } FQType;
134#endif
135} InstFmt;
136
137/*
138 * Values for the 'op' field.
139 */
140#define OP_SPECIAL 000
141#define OP_BCOND 001
142#define OP_J 002
143#define OP_JAL 003
144#define OP_BEQ 004
145#define OP_BNE 005
146#define OP_BLEZ 006
147#define OP_BGTZ 007
148
149#define OP_ADDI 010
150#define OP_ADDIU 011
151#define OP_SLTI 012
152#define OP_SLTIU 013
153#define OP_ANDI 014
154#define OP_ORI 015
155#define OP_XORI 016
156#define OP_LUI 017
157
158#define OP_COP0 020
159#define OP_COP1 021
160#define OP_COP2 022
161#define OP_COP3 023
162#define OP_COP1X 023
163#define OP_BEQL 024
164#define OP_BNEL 025
165#define OP_BLEZL 026
166#define OP_BGTZL 027
167
168#define OP_DADDI 030
169#define OP_DADDIU 031
170#define OP_LDL 032
171#define OP_LDR 033
172
173#define OP_SPECIAL3 037
174
175#define OP_LB 040
176#define OP_LH 041
177#define OP_LWL 042
178#define OP_LW 043
179#define OP_LBU 044
180#define OP_LHU 045
181#define OP_LWR 046
182#define OP_LWU 047
183
184#define OP_SB 050
185#define OP_SH 051
186#define OP_SWL 052
187#define OP_SW 053
188#define OP_SDL 054
189#define OP_SDR 055
190#define OP_SWR 056
191#define OP_CACHE 057
192
193#define OP_LL 060
194#define OP_LWC1 061
195#define OP_LWC2 062
196#define OP_LWC3 063
197#define OP_PREF 063
198#define OP_LLD 064
199#define OP_LDC1 065
200#define OP_LDC2 066
201#define OP_LD 067
202
203#define OP_SC 070
204#define OP_SWC1 071
205#define OP_SWC2 072
206#define OP_SWC3 073
207#define OP_SCD 074
208#define OP_SDC1 075
209#define OP_SDC2 076
210#define OP_SD 077
211
212/*
213 * Values for the 'func' field when 'op' == OP_SPECIAL.
214 */
215#define OP_SLL 000
216#define OP_MOVCI 001
217#define OP_SRL 002
218#define OP_SRA 003
219#define OP_SLLV 004
220#define OP_SRLV 006
221#define OP_SRAV 007
222
223#define OP_JR 010
224#define OP_JALR 011
225#define OP_MOVZ 012
226#define OP_MOVN 013
227#define OP_SYSCALL 014
228#define OP_BREAK 015
229#define OP_SYNC 017
230
231#define OP_MFHI 020
232#define OP_MTHI 021
233#define OP_MFLO 022
234#define OP_MTLO 023
235#define OP_DSLLV 024
236#define OP_DSRLV 026
237#define OP_DSRAV 027
238
239#define OP_MULT 030
240#define OP_MULTU 031
241#define OP_DIV 032
242#define OP_DIVU 033
243#define OP_DMULT 034
244#define OP_DMULTU 035
245#define OP_DDIV 036
246#define OP_DDIVU 037
247
248#define OP_ADD 040
249#define OP_ADDU 041
250#define OP_SUB 042
251#define OP_SUBU 043
252#define OP_AND 044
253#define OP_OR 045
254#define OP_XOR 046
255#define OP_NOR 047
256
257#define OP_SLT 052
258#define OP_SLTU 053
259#define OP_DADD 054
260#define OP_DADDU 055
261#define OP_DSUB 056
262#define OP_DSUBU 057
263
264#define OP_TGE 060
265#define OP_TGEU 061
266#define OP_TLT 062
267#define OP_TLTU 063
268#define OP_TEQ 064
269#define OP_TNE 066
270
271#define OP_DSLL 070
272#define OP_DSRL 072
273#define OP_DSRA 073
274#define OP_DSLL32 074
275#define OP_DSRL32 076
276#define OP_DSRA32 077
277
278/*
279 * Values for the 'rt' field when 'op' == OP_BCOND.
280 */
281#define OP_BLTZ 000
282#define OP_BGEZ 001
283#define OP_BLTZL 002
284#define OP_BGEZL 003
285
286#define OP_TGEI 010
287#define OP_TGEIU 011
288#define OP_TLTI 012
289#define OP_TLTIU 013
290#define OP_TEQI 014
291#define OP_TNEI 016
292
293#define OP_BLTZAL 020
294#define OP_BGEZAL 021
295#define OP_BLTZALL 022
296#define OP_BGEZALL 023
297
298/*
299 * Values for the 'rs' field when 'op' == OP_COPz.
300 */
301#define OP_MF 000
302#define OP_DMF 001
303#define OP_CF 002
304#define OP_MFH 003
305#define OP_MT 004
306#define OP_DMT 005
307#define OP_CT 006
308#define OP_MTH 007
309#define OP_BC 010
310#define OP_C0MISC 020 /* cop0 only */
311#define OP_TFP_C0MISC 030 /* cop0 only on R8000 */
312
313/*
314 * Values for the 'rt' field when 'op' == OP_COPz.
315 */
316#define COPz_BC_TF_MASK 0x01
317#define COPz_BC_TRUE 0x01
318#define COPz_BC_FALSE 0x00
319#define COPz_BCL_TF_MASK 0x02
320#define COPz_BCL_TRUE 0x02
321#define COPz_BCL_FALSE 0x00
322#define COPz_BC_CC_MASK 0x1c
323#define COPz_BC_CC_SHIFT 2
324
325/*
326 * Values for the 'func' field when 'op' == OP_COP1X.
327 */
328#define OP_LWXC1 000
329#define OP_LDXC1 001
330#define OP_SWXC1 010
331#define OP_SDXC1 011
332#define OP_PREFX 017
333
334/*
335 * Values for the 'op4' field when 'op' == OP_COP1X.
336 */
337#define OP_MADD 04
338#define OP_MSUB 05
339#define OP_NMADD 06
340#define OP_NMSUB 07
341
342/*
343 * Values for the 'func' field when 'op' == OP_SPECIAL3.
344 */
345#define OP_RDHWR 073
346
347#endif /* !_MIPS64_MIPS_OPCODE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/mplock.h created+10
...@@ -0,0 +1,10 @@
1/* $OpenBSD: mplock.h,v 1.2 2017/10/21 06:11:22 visa Exp $ */
2
3/* public domain */
4
5#ifndef _MACHINE_MPLOCK_H_
6#define _MACHINE_MPLOCK_H_
7
8#define __USE_MI_MPLOCK
9
10#endif /* !_MACHINE_MPLOCK_H */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/mutex.h created+3
...@@ -0,0 +1,3 @@
1/* $OpenBSD: mutex.h,v 1.5 2018/01/25 15:06:29 mpi Exp $ */
2
3#define __USE_MI_MUTEX
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/param.h created+82
...@@ -0,0 +1,82 @@
1/* $OpenBSD: param.h,v 1.37 2023/12/14 13:26:49 claudio Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#ifndef _MIPS64_PARAM_H_
38#define _MIPS64_PARAM_H_
39
40#ifdef _KERNEL
41#include <machine/cpu.h>
42#endif
43
44#define PAGE_SIZE (1 << PAGE_SHIFT)
45#define PAGE_MASK (PAGE_SIZE - 1)
46
47#ifdef _KERNEL
48
49#ifndef KERNBASE
50#define KERNBASE 0xffffffff80000000L /* start of kernel virtual */
51#endif
52
53#define NBPG PAGE_SIZE
54#define PGSHIFT PAGE_SHIFT
55#define PGOFSET PAGE_MASK
56
57#define USPACE 16384
58#define UPAGES (USPACE >> PAGE_SHIFT)
59#if PAGE_SHIFT > 12
60#define USPACE_ALIGN 0
61#else
62#define USPACE_ALIGN (2 * PAGE_SIZE) /* align to an even TLB boundary */
63#endif
64
65#define NMBCLUSTERS (64 * 1024) /* max cluster allocation */
66
67#ifndef MSGBUFSIZE
68#if PAGE_SHIFT > 12
69#define MSGBUFSIZE PAGE_SIZE
70#else
71#define MSGBUFSIZE 8192
72#endif
73#endif
74
75#ifndef _LOCORE
76#define DELAY(n) delay(n)
77void delay(int);
78#endif
79
80#endif /* _KERNEL */
81
82#endif /* _MIPS64_PARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/pcb.h created+58
...@@ -0,0 +1,58 @@
1/* $OpenBSD: pcb.h,v 1.10 2021/10/07 12:40:16 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: pcb.h 1.13 89/04/23
37 * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93
38 */
39
40#ifndef _MIPS64_PCB_H_
41#define _MIPS64_PCB_H_
42
43#include <machine/frame.h>
44
45/*
46 * MIPS process control block. This is first in the U-area.
47 */
48struct pcb {
49 struct trapframe pcb_regs; /* saved CPU and registers */
50 struct {
51 /* val[12] is unused, was RM7000 ICR */
52 register_t val[13];
53 } pcb_context; /* kernel context for resume */
54 int pcb_onfault; /* for copyin/copyout faults */
55 void *pcb_segtab; /* copy of pmap pm_segtab */
56};
57
58#endif /* !_MIPS64_PCB_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/pmap.h created+228
...@@ -0,0 +1,228 @@
1/* $OpenBSD: pmap.h,v 1.55 2025/06/02 18:49:04 claudio Exp $ */
2
3/*
4 * Copyright (c) 1987 Carnegie-Mellon University
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Ralph Campbell.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93
36 */
37
38#ifndef _MIPS64_PMAP_H_
39#define _MIPS64_PMAP_H_
40
41#include <sys/mutex.h>
42
43#ifdef _KERNEL
44
45#include <machine/pte.h>
46
47/*
48 * The user address space is currently limited to 1TB (0x0 - 0x10000000000).
49 *
50 * The user address space is mapped using a two level structure where
51 * the virtual addresses bits are split in three groups:
52 * segment:directory:page:offset
53 * where:
54 * - offset are the in-page offsets (PAGE_SHIFT bits)
55 * - page are the third level page table index
56 * (PMAP_PGSHIFT - Log2(pt_entry_t) bits)
57 * - directory are the second level page table (directory) index
58 * (PMAP_PGSHIFT - Log2(void *) bits)
59 * - segment are the first level page table (segment) index
60 * (PMAP_PGSHIFT - Log2(void *) bits)
61 *
62 * This scheme allows Segment, directory and page tables have the same size
63 * (1 << PMAP_PGSHIFT bytes, regardless of the pt_entry_t size) to be able to
64 * share the same allocator.
65 *
66 * Note: The kernel doesn't use the same data structures as user programs.
67 * All the PTE entries are stored in a single array in Sysmap which is
68 * dynamically allocated at boot time.
69 */
70
71#if defined(MIPS_PTE64) && PAGE_SHIFT == 12
72#error "Cannot use MIPS_PTE64 with 4KB pages."
73#endif
74
75/*
76 * Size of page table structs (page tables, page directories,
77 * and segment table) used by this pmap.
78 */
79
80#define PMAP_PGSHIFT 12
81#define PMAP_PGSIZE (1UL << PMAP_PGSHIFT)
82
83#define NPDEPG (PMAP_PGSIZE / sizeof(void *))
84#define NPTEPG (PMAP_PGSIZE / sizeof(pt_entry_t))
85
86/*
87 * Segment sizes
88 */
89
90#define SEGSHIFT (PAGE_SHIFT+PMAP_PGSHIFT*2-PTE_LOG-3)
91#define DIRSHIFT (PAGE_SHIFT+PMAP_PGSHIFT-PTE_LOG)
92#define NBSEG (1UL << SEGSHIFT)
93#define NBDIR (1UL << DIRSHIFT)
94#define SEGOFSET (NBSEG - 1)
95#define DIROFSET (NBDIR - 1)
96
97#define mips_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET)
98#define mips_trunc_dir(x) ((vaddr_t)(x) & ~DIROFSET)
99#define mips_round_seg(x) (((vaddr_t)(x) + SEGOFSET) & ~SEGOFSET)
100#define mips_round_dir(x) (((vaddr_t)(x) + DIROFSET) & ~DIROFSET)
101#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)])
102
103/* number of segments entries */
104#define PMAP_SEGTABSIZE (PMAP_PGSIZE / sizeof(void *))
105
106struct segtab {
107 pt_entry_t **seg_tab[PMAP_SEGTABSIZE];
108};
109
110struct pmap_asid_info {
111 u_int pma_asid; /* address space tag */
112 u_int pma_asidgen; /* TLB PID generation number */
113};
114
115/*
116 * Machine dependent pmap structure.
117 */
118typedef struct pmap {
119 struct mutex pm_mtx; /* pmap lock */
120 struct mutex pm_swmtx; /* pmap switch lock */
121 int pm_count; /* pmap reference count */
122 struct pmap_statistics pm_stats; /* pmap statistics */
123 struct segtab *pm_segtab; /* pointers to pages of PTEs */
124 struct pmap_asid_info pm_asid[1]; /* ASID information */
125} *pmap_t;
126
127/*
128 * Compute the sizeof of a pmap structure. Subtract one because one
129 * ASID info structure is already included in the pmap structure itself.
130 */
131#define PMAP_SIZEOF(x) \
132 (ALIGN(sizeof(struct pmap) + \
133 (sizeof(struct pmap_asid_info) * ((x) - 1))))
134
135/* machine-dependent pg_flags */
136#define PGF_UNCACHED PG_PMAP0 /* Page is explicitly uncached */
137#define PGF_CACHED PG_PMAP1 /* Page is currently cached */
138#define PGF_ATTR_MOD PG_PMAP2
139#define PGF_ATTR_REF PG_PMAP3
140#define PGF_PRESERVE (PGF_ATTR_MOD | PGF_ATTR_REF)
141
142#define PMAP_NOCACHE PMAP_MD0
143
144extern struct pmap *const kernel_pmap_ptr;
145
146#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
147#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
148#define pmap_kernel() (kernel_pmap_ptr)
149
150extern pt_entry_t pg_ri;
151#define PMAP_CHECK_COPYIN (pg_ri == 0)
152
153#define PMAP_STEAL_MEMORY /* Enable 'stealing' during boot */
154
155#define PMAP_PREFER
156extern vaddr_t pmap_prefer_mask;
157/* pmap prefer alignment */
158#define PMAP_PREFER_ALIGN() \
159 (pmap_prefer_mask ? pmap_prefer_mask + 1 : 0)
160/* pmap prefer offset in alignment */
161#define PMAP_PREFER_OFFSET(of) ((of) & pmap_prefer_mask)
162
163void pmap_bootstrap(void);
164int pmap_copyinsn(pmap_t, vaddr_t, uint32_t *);
165int pmap_emulate_modify(pmap_t, vaddr_t);
166void pmap_page_cache(vm_page_t, u_int);
167
168#define pmap_init_percpu() do { /* nothing */ } while (0)
169#define pmap_unuse_final(p) do { /* nothing yet */ } while (0)
170#define pmap_remove_holes(vm) do { /* nothing */ } while (0)
171
172#define __HAVE_PMAP_DIRECT
173vaddr_t pmap_map_direct(vm_page_t);
174vm_page_t pmap_unmap_direct(vaddr_t);
175
176/*
177 * MD flags to pmap_enter:
178 */
179
180#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK)
181
182/* Kernel virtual address to page table entry */
183#define kvtopte(va) \
184 (Sysmap + (((vaddr_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT))
185/* User virtual address to pte page entry */
186#define uvtopte(va) (((va) >> PAGE_SHIFT) & (NPTEPG -1))
187#define uvtopde(va) (((va) >> DIRSHIFT) & (NPDEPG - 1))
188
189static inline pt_entry_t *
190pmap_pte_lookup(struct pmap *pmap, vaddr_t va)
191{
192 pt_entry_t **pde, *pte;
193
194 if ((pde = pmap_segmap(pmap, va)) == NULL)
195 return NULL;
196 if ((pte = pde[uvtopde(va)]) == NULL)
197 return NULL;
198 return pte + uvtopte(va);
199}
200
201extern pt_entry_t *Sysmap; /* kernel pte table */
202extern u_int Sysmapsize; /* number of pte's in Sysmap */
203
204#endif /* _KERNEL */
205
206#if !defined(_LOCORE)
207typedef struct pv_entry {
208 struct pv_entry *pv_next; /* next pv_entry */
209 struct pmap *pv_pmap; /* pmap where mapping lies */
210 vaddr_t pv_va; /* virtual address for mapping */
211} *pv_entry_t;
212
213struct vm_page_md {
214 struct mutex pv_mtx; /* pv list lock */
215 struct pv_entry pv_ent; /* pv list of this seg */
216};
217
218#define VM_MDPAGE_INIT(pg) \
219 do { \
220 mtx_init(&(pg)->mdpage.pv_mtx, IPL_VM); \
221 (pg)->mdpage.pv_ent.pv_next = NULL; \
222 (pg)->mdpage.pv_ent.pv_pmap = NULL; \
223 (pg)->mdpage.pv_ent.pv_va = 0; \
224 } while (0)
225
226#endif /* !_LOCORE */
227
228#endif /* !_MIPS64_PMAP_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/proc.h created+75
...@@ -0,0 +1,75 @@
1/* $OpenBSD: proc.h,v 1.11 2017/04/13 03:52:25 guenther Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)proc.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_PROC_H_
38#define _MIPS64_PROC_H_
39
40/*
41 * Machine-dependent part of the proc structure.
42 */
43struct mdproc {
44 struct trapframe *md_regs; /* registers on current frame */
45 volatile int md_astpending; /* AST pending for this process */
46 int md_flags; /* machine-dependent flags */
47 vaddr_t md_uarea; /* allocated uarea virtual addr */
48 void *md_tcb; /* user-space thread-control-block */
49
50 /* ptrace fields */
51 vaddr_t md_ss_addr; /* single step address */
52 uint32_t md_ss_instr; /* saved single step instruction */
53
54 /* fpu emulation fields */
55 vaddr_t md_fppgva; /* vaddr of the branch emulation page */
56 vaddr_t md_fpbranchva; /* vaddr of fp branch destination */
57 vaddr_t md_fpslotva; /* initial vaddr of delay slot */
58
59 int32_t md_obsolete[10]; /* Were RM7000-specific data. */
60};
61
62/*
63 * Values for md_flags.
64 * MDP_FPUSED has two meanings: if the floating point hardware (coprocessor
65 * #1) is available, it means it has been used; if there is no floating
66 * point hardware, it means the process is currently running a duplicated
67 * delay slot, created by the branch emulation logic.
68 */
69#define MDP_FPUSED 0x00000001 /* floating point coprocessor used */
70#define MDP_PERF 0x00010000 /* Performance counter used */
71#define MDP_WATCH1 0x00020000 /* Watch register 1 used */
72#define MDP_WATCH2 0x00040000 /* Watch register 1 used */
73#define MDP_FORKSAVE 0x0000ffff /* Flags to save when forking */
74
75#endif /* !_MIPS64_PROC_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/profile.h created+85
...@@ -0,0 +1,85 @@
1/* $OpenBSD: profile.h,v 1.5 2019/04/19 09:19:22 visa Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * from: @(#)profile.h 8.1 (Berkeley) 6/10/93
35 */
36#ifndef _MIPS64_PROFILE_H_
37#define _MIPS64_PROFILE_H_
38
39#define _MCOUNT_DECL static void ___mcount
40
41/*XXX The cprestore instruction is a "dummy" to shut up as(1). */
42
43#define MCOUNT \
44 __asm(".globl _mcount;" \
45 ".type _mcount,@function;" \
46 "_mcount:;" \
47 ".set noreorder;" \
48 ".set noat;" \
49 ".cpload $25;" \
50 ".cprestore 4;" \
51 "sd $4,16($29);" \
52 "sd $5,24($29);" \
53 "sd $6,32($29);" \
54 "sd $7,40($29);" \
55 "sd $1,0($29);" \
56 "sd $31,8($29);" \
57 "move $5,$31;" \
58 ".local ___mcount;" \
59 "jal ___mcount;" \
60 "move $4,$1;" \
61 "ld $4,16($29);" \
62 "ld $5,24($29);" \
63 "ld $6,32($29);" \
64 "ld $7,40($29);" \
65 "ld $31,8($29);" \
66 "ld $1,0($29);" \
67 "daddu $29,$29,16;" \
68 "j $31;" \
69 "move $31,$1;" \
70 ".set reorder;" \
71 ".set at");
72
73#ifdef _KERNEL
74/*
75 * The following two macros do splhigh and splx respectively.
76 * They have to be defined this way because these are real
77 * functions on the MIPS, and we do not want to invoke mcount
78 * recursively.
79 */
80#define MCOUNT_ENTER s = _splhigh()
81
82#define MCOUNT_EXIT _splx(s)
83#endif /* _KERNEL */
84
85#endif /* !_MIPS64_PROFILE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/pte.h created+160
...@@ -0,0 +1,160 @@
1/* $OpenBSD: pte.h,v 1.24 2023/01/11 03:17:56 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: pte.h 1.11 89/09/03
37 * from: @(#)pte.h 8.1 (Berkeley) 6/10/93
38 */
39
40/*
41 * R4000 and R8000 hardware page table entries
42 */
43
44#ifndef _MIPS64_PTE_H_
45#define _MIPS64_PTE_H_
46
47#ifndef _LOCORE
48
49/*
50 * Structure defining a TLB entry data set.
51 */
52struct tlb_entry {
53 u_int64_t tlb_mask;
54 u_int64_t tlb_hi;
55 u_int64_t tlb_lo0;
56 u_int64_t tlb_lo1;
57};
58
59u_int tlb_get_pid(void);
60void tlb_read(unsigned int, struct tlb_entry *);
61
62#ifdef MIPS_PTE64
63typedef u_int64_t pt_entry_t;
64#else
65typedef u_int32_t pt_entry_t;
66#endif
67
68#endif /* _LOCORE */
69
70#ifdef MIPS_PTE64
71#define PTE_BITS 64
72#define PTE_LOAD ld
73#define PTE_LOG 3
74#define PTE_OFFS 8
75#else
76#define PTE_BITS 32
77#define PTE_LOAD lwu
78#define PTE_LOG 2
79#define PTE_OFFS 4
80#endif
81
82#if defined(CPU_MIPS64R2) && !defined(CPU_LOONGSON2)
83#define PTE_CLEAR_SWBITS(reg) \
84 .set push; \
85 .set mips64r2; \
86 /* Clear SW bits between PG_XI and PG_FRAMEBITS. */ \
87 dins reg, zero, PG_FRAMEBITS, (PTE_BITS - 2 - PG_FRAMEBITS); \
88 .set pop
89#else
90#define PTE_CLEAR_SWBITS(reg) \
91 /* Clear SW bits left of PG_FRAMEBITS. */ \
92 dsll reg, reg, (64 - PG_FRAMEBITS); \
93 dsrl reg, reg, (64 - PG_FRAMEBITS)
94#endif
95
96/* entryhi values */
97
98#define PG_HVPN (-2 * PAGE_SIZE) /* Hardware page number mask */
99#define PG_ODDPG PAGE_SIZE
100
101/* Address space ID */
102#define PG_ASID_MASK 0x00000000000000ff
103#define PG_ASID_SHIFT 0
104#define MIN_USER_ASID 1
105#define PG_ASID_COUNT 256 /* Number of available ASID */
106
107/* entrylo values */
108
109#ifdef MIPS_PTE64
110#define PG_FRAMEBITS 60
111#else
112#define PG_FRAMEBITS 28
113#endif
114#define PG_FRAME ((1ULL << PG_FRAMEBITS) - (1ULL << PG_SHIFT))
115#define PG_SHIFT 6
116
117/* software pte bits - not put in entrylo */
118#define PG_WIRED (1ULL << (PG_FRAMEBITS + 1))
119#define PG_RO (1ULL << (PG_FRAMEBITS + 0))
120
121#ifdef CPU_MIPS64R2
122#define PG_RI (1ULL << (PG_FRAMEBITS + 3))
123#define PG_XI (1ULL << (PG_FRAMEBITS + 2))
124#else
125#define PG_RI 0x00000000
126#define PG_XI 0x00000000
127#endif
128
129#define PG_NV 0x00000000
130#define PG_G 0x00000001
131#define PG_V 0x00000002
132#define PG_M 0x00000004
133#define PG_CCA_SHIFT 3
134
135#define PG_UNCACHED (CCA_NC << PG_CCA_SHIFT)
136#define PG_CACHED_NC (CCA_NONCOHERENT << PG_CCA_SHIFT)
137#define PG_CACHED_CE (CCA_COHERENT_EXCL << PG_CCA_SHIFT)
138#define PG_CACHED_CEW (CCA_COHERENT_EXCLWRITE << PG_CCA_SHIFT)
139#define PG_CACHED (CCA_CACHED << PG_CCA_SHIFT)
140#define PG_CACHEMODE (7 << PG_CCA_SHIFT)
141
142#define PG_PROTMASK (PG_M | PG_RO | PG_RI | PG_XI)
143
144#define pfn_to_pad(pa) ((((paddr_t)pa) & PG_FRAME) << PG_SHIFT)
145#define vad_to_pfn(va) (((va) >> PG_SHIFT) & PG_FRAME)
146
147#define PG_SIZE_4K 0x00000000
148#define PG_SIZE_16K 0x00006000
149#define PG_SIZE_64K 0x0001e000
150#define PG_SIZE_256K 0x0007e000
151#define PG_SIZE_1M 0x001fe000
152#define PG_SIZE_4M 0x007fe000
153#define PG_SIZE_16M 0x01ffe000
154#if PAGE_SHIFT == 12
155#define TLB_PAGE_MASK PG_SIZE_4K
156#elif PAGE_SHIFT == 14
157#define TLB_PAGE_MASK PG_SIZE_16K
158#endif
159
160#endif /* !_MIPS64_PTE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/ptrace.h created+46
...@@ -0,0 +1,46 @@
1/* $OpenBSD: ptrace.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93
32 */
33
34#ifndef _MIPS64_PTRACE_H_
35#define _MIPS64_PTRACE_H_
36
37/*
38 * Machine dependent trace commands.
39 *
40 */
41
42#define PT_GETREGS (PT_FIRSTMACH+0)
43#define PT_SETREGS (PT_FIRSTMACH+1)
44#define PT_STEP (PT_FIRSTMACH+2)
45
46#endif /* !_MIPS64_PTRACE_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/reg.h created+54
...@@ -0,0 +1,54 @@
1/* $OpenBSD: reg.h,v 1.5 2021/10/07 12:32:10 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: reg.h 1.1 90/07/09
37 * @(#)reg.h 8.2 (Berkeley) 1/11/94
38 */
39
40#ifndef _MIPS64_REG_H_
41#define _MIPS64_REG_H_
42/*
43 * Location of the users' stored
44 * registers relative to ZERO.
45 * Usage is p->p_regs[XX].
46 *
47 * must be visible to assembly code.
48 */
49#include <machine/regnum.h>
50
51struct reg {
52 register_t r_regs[NREGS]; /* numbered as above */
53};
54#endif /* !_MIPS64_REG_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/regdef.h created+77
...@@ -0,0 +1,77 @@
1/* $OpenBSD: regdef.h,v 1.5 2014/03/10 21:10:36 miod Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell. This file is derived from the MIPS RISC
9 * Architecture book by Gerry Kane.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)regdef.h 8.1 (Berkeley) 6/10/93
36 */
37#ifndef _MIPS64_REGDEF_H_
38#define _MIPS64_REGDEF_H_
39
40#define zero $0 /* always zero */
41#define AT $at /* assembler temp */
42#define v0 $2 /* return value */
43#define v1 $3
44#define a0 $4 /* argument registers */
45#define a1 $5
46#define a2 $6
47#define a3 $7
48#define a4 $8
49#define a5 $9
50#define a6 $10
51#define a7 $11
52#define ta0 $8 /* alias */
53#define ta1 $9
54#define ta2 $10
55#define ta3 $11
56#define t0 $12 /* temp registers (not saved across subroutine calls) */
57#define t1 $13
58#define t2 $14
59#define t3 $15
60#define s0 $16 /* saved across subroutine calls (callee saved) */
61#define s1 $17
62#define s2 $18
63#define s3 $19
64#define s4 $20
65#define s5 $21
66#define s6 $22
67#define s7 $23
68#define t8 $24 /* two more temp registers */
69#define t9 $25
70#define k0 $26 /* kernel temporary */
71#define k1 $27
72#define gp $28 /* global pointer */
73#define sp $29 /* stack pointer */
74#define s8 $30 /* one more callee saved */
75#define ra $31 /* return address */
76
77#endif /* !_MIPS64_REGDEF_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/regnum.h created+119
...@@ -0,0 +1,119 @@
1/* $OpenBSD: regnum.h,v 1.4 2014/07/09 12:58:08 miod Exp $ */
2
3/*
4 * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_REGNUM_H_
30#define _MIPS64_REGNUM_H_
31
32/*
33 * Location of the saved registers relative to ZERO.
34 * Usage is p->p_regs[XX].
35 */
36#define ZERO 0
37#define AST 1
38#define V0 2
39#define V1 3
40#define A0 4
41#define A1 5
42#define A2 6
43#define A3 7
44#define A4 8
45#define A5 9
46#define A6 10
47#define A7 11
48#define T0 12
49#define T1 13
50#define T2 14
51#define T3 15
52#define S0 16
53#define S1 17
54#define S2 18
55#define S3 19
56#define S4 20
57#define S5 21
58#define S6 22
59#define S7 23
60#define T8 24
61#define T9 25
62#define K0 26
63#define K1 27
64#define GP 28
65#define SP 29
66#define S8 30
67#define RA 31
68#define SR 32
69#define PS SR /* alias for SR */
70#define MULLO 33
71#define MULHI 34
72#define BADVADDR 35
73#define CAUSE 36
74#define PC 37
75#define IC 38
76#define CPL 39
77
78#define NUMSAVEREGS 40 /* Number of registers saved in trap */
79
80#define FPBASE NUMSAVEREGS
81#define F0 (FPBASE+0)
82#define F1 (FPBASE+1)
83#define F2 (FPBASE+2)
84#define F3 (FPBASE+3)
85#define F4 (FPBASE+4)
86#define F5 (FPBASE+5)
87#define F6 (FPBASE+6)
88#define F7 (FPBASE+7)
89#define F8 (FPBASE+8)
90#define F9 (FPBASE+9)
91#define F10 (FPBASE+10)
92#define F11 (FPBASE+11)
93#define F12 (FPBASE+12)
94#define F13 (FPBASE+13)
95#define F14 (FPBASE+14)
96#define F15 (FPBASE+15)
97#define F16 (FPBASE+16)
98#define F17 (FPBASE+17)
99#define F18 (FPBASE+18)
100#define F19 (FPBASE+19)
101#define F20 (FPBASE+20)
102#define F21 (FPBASE+21)
103#define F22 (FPBASE+22)
104#define F23 (FPBASE+23)
105#define F24 (FPBASE+24)
106#define F25 (FPBASE+25)
107#define F26 (FPBASE+26)
108#define F27 (FPBASE+27)
109#define F28 (FPBASE+28)
110#define F29 (FPBASE+29)
111#define F30 (FPBASE+30)
112#define F31 (FPBASE+31)
113#define FSR (FPBASE+32)
114
115#define NUMFPREGS 33
116
117#define NREGS (NUMSAVEREGS + NUMFPREGS)
118
119#endif /* !_MIPS64_REGNUM_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/reloc.h created+54
...@@ -0,0 +1,54 @@
1/* $OpenBSD: reloc.h,v 1.4 2017/08/13 14:56:09 visa Exp $ */
2
3/*
4 * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MIPS64_RELOC_H_
30#define _MIPS64_RELOC_H_
31
32/*
33 * Mips relocations.
34 */
35
36#define R_MIPS_NONE 0 /* No reloc */
37#define R_MIPS_16 1 /* Direct 16 bit */
38#define R_MIPS_32 2 /* Direct 32 bit */
39#define R_MIPS_REL32 3 /* PC relative 32 bit */
40#define R_MIPS_26 4 /* Direct 26 bit shifted */
41#define R_MIPS_HI16 5 /* High 16 bit */
42#define R_MIPS_LO16 6 /* Low 16 bit */
43#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
44#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
45#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
46#define R_MIPS_PC16 10 /* PC relative 16 bit */
47#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
48#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
49
50#define R_MIPS_64 18
51
52#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32)
53
54#endif /* !_MIPS64_RELOC_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/setjmp.h created+15
...@@ -0,0 +1,15 @@
1/* $OpenBSD: setjmp.h,v 1.4 2018/01/08 16:44:32 visa Exp $ */
2
3/* Public domain */
4
5#ifndef _MIPS64_SETJMP_H_
6#define _MIPS64_SETJMP_H_
7
8#define _JB_MASK (1 * REGSZ)
9#define _JB_PC (2 * REGSZ)
10#define _JB_REGS (3 * REGSZ)
11#define _JB_FPREGS (37 * REGSZ)
12
13#define _JBLEN 83 /* size, in longs, of a jmp_buf */
14
15#endif /* !_MIPS64_SETJMP_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/signal.h created+70
...@@ -0,0 +1,70 @@
1/* $OpenBSD: signal.h,v 1.13 2018/01/08 16:44:32 visa Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)signal.h 8.1 (Berkeley) 6/10/93
35 */
36
37#ifndef _MIPS64_SIGNAL_H_
38#define _MIPS64_SIGNAL_H_
39
40#include <sys/cdefs.h>
41#include <sys/types.h>
42
43/*
44 * Machine-dependent signal definitions
45 */
46typedef int sig_atomic_t;
47
48#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
49/*
50 * Information pushed on stack when a signal is delivered.
51 * This is used by the kernel to restore state following
52 * execution of the signal handler. It is also made available
53 * to the handler to allow it to restore state properly if
54 * a non-standard exit is performed.
55 */
56struct sigcontext {
57 long sc_cookie;
58 long sc_mask; /* signal mask to restore XXX should be int */
59 __register_t sc_pc; /* pc at time of signal */
60 __register_t sc_regs[32]; /* processor regs 0 to 31 */
61 __register_t mullo; /* mullo and mulhi registers... */
62 __register_t mulhi; /* mullo and mulhi registers... */
63 f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */
64 long sc_fpused; /* fp has been used */
65 long sc_fpc_eir; /* floating point exception instruction reg */
66 long xxx[8]; /* XXX reserved */
67};
68#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
69
70#endif /* !_MIPS64_SIGNAL_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/spinlock.h created+11
...@@ -0,0 +1,11 @@
1/* $OpenBSD: spinlock.h,v 1.5 2017/09/05 02:40:54 guenther Exp $ */
2 /* Public domain */
3
4#ifndef _MIPS64_SPINLOCK_H_
5#define _MIPS64_SPINLOCK_H_
6
7#define _ATOMIC_LOCK_UNLOCKED (0)
8#define _ATOMIC_LOCK_LOCKED (1)
9typedef int _atomic_lock_t;
10
11#endif /* !_MIPS64_SPINLOCK_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/sysarch.h created+52
...@@ -0,0 +1,52 @@
1/* $OpenBSD: sysarch.h,v 1.2 2012/12/05 23:20:13 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2009 Miodrag Vallat.
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#ifndef _MIPS64_SYSARCH_H_
20#define _MIPS64_SYSARCH_H_
21
22/*
23 * Architecture specific syscalls (mips64)
24 */
25
26#define MIPS64_CACHEFLUSH 0
27
28/*
29 * Argument structure and defines to mimic IRIX cacheflush() system call
30 */
31
32struct mips64_cacheflush_args {
33 vaddr_t va;
34 size_t sz;
35 int which;
36#define ICACHE 0x01
37#define DCACHE 0x02
38#define BCACHE (ICACHE | DCACHE)
39};
40
41#ifndef _KERNEL
42
43#include <sys/cdefs.h>
44
45__BEGIN_DECLS
46int cacheflush(void *, int, int);
47int _flush_cache(char *, int, int);
48int sysarch(int, void *);
49__END_DECLS
50#endif /* _KERNEL */
51
52#endif /* _MIPS64_SYSARCH_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/tcb.h created+66
...@@ -0,0 +1,66 @@
1/* $OpenBSD: tcb.h,v 1.4 2017/04/20 16:07:52 visa Exp $ */
2
3/*
4 * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
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#ifndef _MACHINE_TCB_H_
20#define _MACHINE_TCB_H_
21
22#ifdef _KERNEL
23
24static inline void
25__mips64_set_tcb(struct proc *p, void *tcb)
26{
27#ifdef CPU_MIPS64R2
28 extern int cpu_has_userlocal;
29
30 if (cpu_has_userlocal)
31 cp0_set_userlocal(tcb);
32#endif
33
34 p->p_md.md_tcb = tcb;
35}
36
37#define TCB_SET(p, addr) __mips64_set_tcb(p, addr)
38#define TCB_GET(p) ((p)->p_md.md_tcb)
39
40#else /* _KERNEL */
41
42/* ELF TLS ABI calls for small TCB, with static TLS data after it */
43#define TLS_VARIANT 1
44
45static inline void *
46__mips64_get_tcb(void)
47{
48 void *tcb;
49
50 /*
51 * This invokes emulation in kernel if the system does not implement
52 * the RDHWR instruction or the UserLocal register.
53 */
54 __asm__ volatile (
55 " .set push\n"
56 " .set mips64r2\n"
57 " rdhwr %0, $29\n"
58 " .set pop\n" : "=r" (tcb));
59 return tcb;
60}
61
62#define TCB_GET() __mips64_get_tcb()
63
64#endif /* _KERNEL */
65
66#endif /* _MACHINE_TCB_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/timetc.h created+23
...@@ -0,0 +1,23 @@
1/* $OpenBSD: timetc.h,v 1.3 2020/07/18 08:37:43 visa Exp $ */
2/*
3 * Copyright (c) 2020 Paul Irofti <paul@irofti.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MIPS64_TIMETC_H_
19#define _MIPS64_TIMETC_H_
20
21#define TC_CP0_COUNT 1
22
23#endif /* _MIPS64_TIMETC_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/trap.h created+127
...@@ -0,0 +1,127 @@
1/* $OpenBSD: trap.h,v 1.17 2022/01/28 16:20:09 visa Exp $ */
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah Hdr: trap.h 1.1 90/07/09
37 * from: @(#)trap.h 8.1 (Berkeley) 6/10/93
38 */
39
40#ifndef _MIPS64_TRAP_H_
41#define _MIPS64_TRAP_H_
42
43/*
44 * Trap codes (ExcCode in the cause register); also known in trap.c for
45 * name strings.
46 */
47
48#define T_INT 0 /* Interrupt pending */
49#define T_TLB_MOD 1 /* TLB modified fault */
50#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */
51#define T_TLB_ST_MISS 3 /* TLB miss on a store */
52#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */
53#define T_ADDR_ERR_ST 5 /* Address error on a store */
54#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */
55#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */
56#define T_SYSCALL 8 /* System call */
57#define T_BREAK 9 /* Breakpoint */
58#define T_RES_INST 10 /* Reserved instruction exception */
59#define T_COP_UNUSABLE 11 /* Coprocessor unusable */
60#define T_OVFLOW 12 /* Arithmetic overflow */
61#define T_TRAP 13 /* Trap instruction */
62#define T_VCEI 14 /* R4k Virtual coherency instruction */
63#define T_FPE 15 /* Floating point exception */
64#define T_IWATCH 16 /* R4k Inst. Watch address reference */
65#define T_C2E 18 /* R5k Coprocessor 2 exception */
66#define T_MDMX 22 /* R5k MDMX unusable */
67#define T_DWATCH 23 /* Data Watch address reference */
68#define T_MCHECK 24 /* Machine check */
69#define T_CACHEERR 30 /* Cache error */
70#define T_VCED 31 /* R4k Virtual coherency data */
71
72#define T_USER 0x20 /* user-mode flag or'ed with type */
73
74/*
75 * Defines for trap handler catching kernel accessing memory.
76 */
77#define KT_COPYERR 1 /* User space copy error */
78#define KT_KCOPYERR 2 /* Kernel space copy error */
79#define KT_DDBERR 3 /* DDB access error */
80
81#ifndef _LOCORE
82
83#if defined(DDB) || defined(DEBUG)
84
85struct trapdebug { /* trap history buffer for debugging */
86 register_t status;
87 register_t cause;
88 register_t vadr;
89 register_t pc;
90 register_t ra;
91 register_t sp;
92 u_int code;
93 u_int ipl;
94};
95
96#define trapdebug_enter(ci, frame, cd) \
97do { \
98 register_t sr = disableintr(); \
99 u_long cpuid = ci->ci_cpuid; \
100 struct trapdebug *t; \
101 \
102 t = trapdebug + TRAPSIZE * cpuid + trppos[cpuid]; \
103 t->status = frame->sr; \
104 t->cause = frame->cause; \
105 t->vadr = frame->badvaddr; \
106 t->pc = frame->pc; \
107 t->sp = frame->sp; \
108 t->ra = frame->ra; \
109 t->ipl = frame->ipl; \
110 t->code = cd; \
111 if (++trppos[cpuid] == TRAPSIZE) \
112 trppos[cpuid] = 0; \
113 setsr(sr); \
114} while (0)
115
116#define TRAPSIZE 10 /* Trap log buffer length */
117extern struct trapdebug trapdebug[MAXCPUS * TRAPSIZE];
118extern uint trppos[MAXCPUS];
119
120void trapDump(const char *, int (*)(const char *, ...));
121
122#else
123#define trapdebug_enter(ci, frame, code)
124#endif
125#endif /* _LOCORE */
126
127#endif /* !_MIPS64_TRAP_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/mips64/vmparam.h created+115
...@@ -0,0 +1,115 @@
1/* $OpenBSD: vmparam.h,v 1.31 2023/11/16 13:47:22 deraadt Exp $ */
2/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */
3
4/*
5 * Copyright (c) 1988 University of Utah.
6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
10 * the Systems Programming Group of the University of Utah Computer
11 * Science Department and Ralph Campbell.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: Utah Hdr: vmparam.h 1.16 91/01/18
38 * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
39 */
40
41#ifndef _MIPS64_VMPARAM_H_
42#define _MIPS64_VMPARAM_H_
43
44/*
45 * Machine dependent constants mips processors.
46 */
47
48#define USRSTACK VM_MAXUSER_ADDRESS /* Start of user stack */
49
50/*
51 * Virtual memory related constants, all in bytes
52 */
53#ifndef MAXTSIZ
54#define MAXTSIZ (128*1024*1024) /* max text size */
55#endif
56#ifndef DFLDSIZ
57#define DFLDSIZ (128*1024*1024) /* initial data size limit */
58#endif
59#ifndef MAXDSIZ
60#define MAXDSIZ (16UL*1024*1024*1024) /* max data size */
61#endif
62#ifndef BRKSIZ
63#define BRKSIZ MAXDSIZ /* heap gap size */
64#endif
65#ifndef DFLSSIZ
66#define DFLSSIZ (2*1024*1024) /* initial stack size limit */
67#endif
68#ifndef MAXSSIZ
69#define MAXSSIZ (32*1024*1024) /* max stack size */
70#endif
71
72#define STACKGAP_RANDOM 256*1024
73
74/*
75 * PTEs for mapping user space into the kernel for physio operations.
76 * 16 pte's are enough to cover 8 disks * MAXBSIZE.
77 */
78#ifndef USRIOSIZE
79#define USRIOSIZE 32
80#endif
81
82/*
83 * PTEs for system V style shared memory.
84 * This is basically slop for kmempt which we actually allocate (malloc) from.
85 */
86#ifndef SHMMAXPGS
87#define SHMMAXPGS 8192 /* 8mb */
88#endif
89
90#ifndef VM_PHYSSEG_MAX
91#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */
92#endif
93#ifndef VM_PHYSSEG_STRAT
94#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
95#endif
96#define VM_PHYSSEG_NOADD
97
98/* user/kernel map constants */
99#define VM_MIN_ADDRESS ((vaddr_t)0x0000000000004000L)
100#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000010000000000L)
101#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
102#ifdef _KERNEL
103#define VM_MIN_STACK_ADDRESS ((vaddr_t)0x000000c000000000L)
104#endif
105#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc000000000000000L)
106#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xc000000040000000L)
107
108/* map PIE into approximately the first quarter of user va space */
109#define VM_PIE_MIN_ADDR PAGE_SIZE
110#define VM_PIE_MAX_ADDR (0x4000000000UL)
111
112/* virtual sizes (bytes) for various kernel submaps */
113#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
114
115#endif /* !_MIPS64_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */1/* $OpenBSD: octeonvar.h,v 1.56 2026/07/13 13:41:25 kirill 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/*-
...@@ -96,7 +96,7 @@ struct octeon_config {...@@ -96,7 +96,7 @@ struct octeon_config {
9696
97#define OCTEON_POOL_NELEMS_PKT 409697#define OCTEON_POOL_NELEMS_PKT 4096
98#define OCTEON_POOL_NELEMS_WQE 409698#define OCTEON_POOL_NELEMS_WQE 4096
99#define OCTEON_POOL_NELEMS_CMD 3299#define OCTEON_POOL_NELEMS_CMD 256
100#define OCTEON_POOL_NELEMS_SG 4096100#define OCTEON_POOL_NELEMS_SG 4096
101#define OCTEON_POOL_NELEMS_XXX_4 0101#define OCTEON_POOL_NELEMS_XXX_4 0
102#define OCTEON_POOL_NELEMS_XXX_5 0102#define OCTEON_POOL_NELEMS_XXX_5 0
lib/libc/include/mips64el-openbsd-none/frame.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/frame.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/_float.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
2
3#include <mips64/_float.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/_types.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: _types.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/_types.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h deleted-127
...@@ -1,127 +0,0 @@
1/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */
2
3/*
4 * Copyright (c) 2001 Alexander Guy
5 * Copyright (c) 1995 John T. Kohl
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32#ifndef _MACHINE_APMVAR_H_
33#define _MACHINE_APMVAR_H_
34
35#include <sys/ioccom.h>
36
37/* Advanced Power Management (v1.0 and v1.1 specification)
38 * functions/defines/etc.
39 */
40
41/* These definitions make up the heart of the user-land interface
42 * to the APM devices.
43 */
44
45#define APM_AC_OFF 0x00
46#define APM_AC_ON 0x01
47#define APM_AC_BACKUP 0x02
48#define APM_AC_UNKNOWN 0xff
49#define APM_BATT_HIGH 0x00
50#define APM_BATT_LOW 0x01
51#define APM_BATT_CRITICAL 0x02
52#define APM_BATT_CHARGING 0x03
53#define APM_BATT_UNKNOWN 0xff
54#define APM_BATT_LIFE_UNKNOWN 0xff
55
56#define APM_NOEVENT 0x0000
57#define APM_STANDBY_REQ 0x0001
58#define APM_SUSPEND_REQ 0x0002
59#define APM_NORMAL_RESUME 0x0003
60#define APM_CRIT_RESUME 0x0004 /* suspend/resume happened
61 without us */
62#define APM_BATTERY_LOW 0x0005
63#define APM_POWER_CHANGE 0x0006
64#define APM_UPDATE_TIME 0x0007
65#define APM_CRIT_SUSPEND_REQ 0x0008
66#define APM_USER_STANDBY_REQ 0x0009
67#define APM_USER_SUSPEND_REQ 0x000A
68#define APM_SYS_STANDBY_RESUME 0x000B
69#define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */
70#define APM_USER_HIBERNATE_REQ 0x000D
71#define APM_EVENT_MASK 0xffff
72
73#define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK))
74#define APM_EVENT_TYPE(e) ((e) & APM_EVENT_MASK)
75#define APM_EVENT_INDEX(e) ((e) >> 16)
76
77/*
78 * LP (Laptop Package)
79 *
80 * Copyright (C) 1994 by HOSOKAWA Tatsumi <hosokawa@mt.cs.keio.ac.jp>
81 *
82 * This software may be used, modified, copied, and distributed, in
83 * both source and binary form provided that the above copyright and
84 * these terms are retained. Under no circumstances is the author
85 * responsible for the proper functioning of this software, nor does
86 * the author assume any responsibility for damages incurred with its
87 * use.
88 *
89 * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
90 */
91
92#define APM_BATTERY_ABSENT 4
93
94struct apm_power_info {
95 u_char battery_state;
96 u_char ac_state;
97 u_char battery_life;
98 u_char spare1;
99 u_int minutes_left; /* estimate */
100 u_int spare2[6];
101};
102
103struct apm_ctl {
104 u_int dev;
105 u_int mode;
106};
107
108#define APM_IOC_REJECT _IOW('A', 0, struct apm_event_info) /* reject request # */
109#define APM_IOC_STANDBY _IO('A', 1) /* put system into standby */
110#define APM_IOC_SUSPEND _IO('A', 2) /* put system into suspend */
111#define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info) /* fetch battery state */
112#define APM_IOC_DEV_CTL _IOW('A', 5, struct apm_ctl) /* put device into mode */
113#define APM_IOC_PRN_CTL _IOW('A', 6, int ) /* driver power status msg */
114#define APM_PRINT_ON 0 /* driver power status displayed */
115#define APM_PRINT_OFF 1 /* driver power status not displayed */
116#define APM_PRINT_PCT 2 /* driver power status only displayed
117 if the percentage changes */
118#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */
119#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */
120#define APM_IOC_HIBERNATE _IO('A', 9) /* put system into hibernate */
121
122#ifdef _KERNEL
123void apm_setinfohook(int (*)(struct apm_power_info *));
124int apm_record_event(u_int, const char *, const char *);
125#endif
126
127#endif /* _MACHINE_APMVAR_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/asm.h deleted-9
...@@ -1,9 +0,0 @@
1/* $OpenBSD: asm.h,v 1.2 2016/11/18 15:38:14 visa Exp $ */
2/* public domain */
3
4#ifdef MULTIPROCESSOR
5#define HW_GET_CPU_INFO(ci, tmp) \
6 dmfc0 ci, COP_0_ERROR_PC
7#endif
8
9#include <mips64/asm.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/atomic.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: atomic.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/atomic.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/autoconf.h deleted-124
...@@ -1,124 +0,0 @@
1/* $OpenBSD: autoconf.h,v 1.17 2017/05/21 13:00:53 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29/*
30 * Definitions used by autoconfiguration.
31 */
32
33#ifndef _MACHINE_AUTOCONF_H_
34#define _MACHINE_AUTOCONF_H_
35
36#include <machine/bus.h>
37
38struct bonito_config;
39struct htb_config;
40struct mips_isa_chipset;
41
42/*
43 * List of legacy I/O ranges.
44 */
45struct legacy_io_range {
46 bus_addr_t start;
47 bus_size_t end; /* inclusive */
48};
49
50/*
51 * Per platform information.
52 */
53struct platform {
54 int system_type;
55#define LOONGSON_2E 0x0000 /* Generic Loongson 2E system */
56#define LOONGSON_YEELOONG 0x0001 /* Lemote Yeeloong */
57#define LOONGSON_GDIUM 0x0002 /* EMTEC Gdium Liberty */
58#define LOONGSON_FULOONG 0x0003 /* Lemote Fuloong */
59#define LOONGSON_LYNLOONG 0x0004 /* Lemote Lynloong */
60#define LOONGSON_EBT700 0x0005 /* eBenton EBT700 */
61#define LOONGSON_3A 0x0066 /* Loongson 2Gq or 3A based system */
62
63 char *vendor;
64 char *product;
65
66 const struct bonito_config *bonito_config;
67 const struct htb_config *htb_config;
68 struct mips_isa_chipset *isa_chipset;
69 const struct legacy_io_range *legacy_io_ranges;
70
71 void (*setup)(void);
72 void (*device_register)(struct device *,
73 void *);
74
75 void (*powerdown)(void);
76 void (*reset)(void);
77 int (*suspend)(void);
78 int (*resume)(void);
79
80#ifdef MULTIPROCESSOR
81 void (*config_secondary_cpus)(
82 struct device *, cfprint_t);
83 void (*boot_secondary_cpu)(
84 struct cpu_info *);
85 int (*ipi_establish)(int (*)(void *),
86 cpuid_t);
87 void (*ipi_set)(cpuid_t);
88 void (*ipi_clear)(cpuid_t);
89#endif /* MULTIPROCESSOR */
90};
91
92#define LOONGSON_MAXCPUS 16
93
94extern const struct platform *sys_platform;
95extern void *loongson_videobios;
96extern uint loongson_cpumask;
97extern uint loongson_ver;
98extern int nnodes;
99
100#ifdef MULTIPROCESSOR
101extern uint64_t cpu_spinup_a0;
102extern uint64_t cpu_spinup_sp;
103#endif
104
105struct mainbus_attach_args {
106 const char *maa_name;
107};
108
109extern struct device *bootdv;
110extern char bootdev[];
111extern enum devclass bootdev_class;
112
113extern bus_space_tag_t early_mem_t;
114extern bus_space_tag_t early_io_t;
115
116#define REGVAL8(x) *((volatile uint8_t *)PHYS_TO_XKPHYS((x), CCA_NC))
117#define REGVAL32(x) *((volatile uint32_t *)PHYS_TO_XKPHYS((x), CCA_NC))
118#define REGVAL64(x) *((volatile uint64_t *)PHYS_TO_XKPHYS((x), CCA_NC))
119
120#define REGVAL(x) REGVAL32(x)
121
122#include <mips64/autoconf.h>
123
124#endif /* _MACHINE_AUTOCONF_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/bus.h deleted-513
...@@ -1,513 +0,0 @@
1/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef _MACHINE_BUS_H_
28#define _MACHINE_BUS_H_
29
30#ifdef __STDC__
31#define CAT(a,b) a##b
32#define CAT3(a,b,c) a##b##c
33#else
34#define CAT(a,b) a/**/b
35#define CAT3(a,b,c) a/**/b/**/c
36#endif
37
38/*
39 * Bus access types.
40 */
41struct mips_bus_space;
42typedef u_long bus_addr_t;
43typedef u_long bus_size_t;
44typedef u_long bus_space_handle_t;
45typedef struct mips_bus_space *bus_space_tag_t;
46
47struct mips_bus_space {
48 bus_addr_t bus_base;
49 void *bus_private;
50 u_int8_t (*_space_read_1)(bus_space_tag_t , bus_space_handle_t,
51 bus_size_t);
52 void (*_space_write_1)(bus_space_tag_t , bus_space_handle_t,
53 bus_size_t, u_int8_t);
54 u_int16_t (*_space_read_2)(bus_space_tag_t , bus_space_handle_t,
55 bus_size_t);
56 void (*_space_write_2)(bus_space_tag_t , bus_space_handle_t,
57 bus_size_t, u_int16_t);
58 u_int32_t (*_space_read_4)(bus_space_tag_t , bus_space_handle_t,
59 bus_size_t);
60 void (*_space_write_4)(bus_space_tag_t , bus_space_handle_t,
61 bus_size_t, u_int32_t);
62 u_int64_t (*_space_read_8)(bus_space_tag_t , bus_space_handle_t,
63 bus_size_t);
64 void (*_space_write_8)(bus_space_tag_t , bus_space_handle_t,
65 bus_size_t, u_int64_t);
66 void (*_space_read_raw_2)(bus_space_tag_t, bus_space_handle_t,
67 bus_addr_t, u_int8_t *, bus_size_t);
68 void (*_space_write_raw_2)(bus_space_tag_t, bus_space_handle_t,
69 bus_addr_t, const u_int8_t *, bus_size_t);
70 void (*_space_read_raw_4)(bus_space_tag_t, bus_space_handle_t,
71 bus_addr_t, u_int8_t *, bus_size_t);
72 void (*_space_write_raw_4)(bus_space_tag_t, bus_space_handle_t,
73 bus_addr_t, const u_int8_t *, bus_size_t);
74 void (*_space_read_raw_8)(bus_space_tag_t, bus_space_handle_t,
75 bus_addr_t, u_int8_t *, bus_size_t);
76 void (*_space_write_raw_8)(bus_space_tag_t, bus_space_handle_t,
77 bus_addr_t, const u_int8_t *, bus_size_t);
78 int (*_space_map)(bus_space_tag_t , bus_addr_t,
79 bus_size_t, int, bus_space_handle_t *);
80 void (*_space_unmap)(bus_space_tag_t, bus_space_handle_t,
81 bus_size_t);
82 int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t,
83 bus_size_t, bus_size_t, bus_space_handle_t *);
84 void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t);
85 paddr_t (*_space_mmap)(bus_space_tag_t, bus_addr_t, off_t,
86 int, int);
87};
88
89#define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o))
90#define bus_space_read_2(t, h, o) (*(t)->_space_read_2)((t), (h), (o))
91#define bus_space_read_4(t, h, o) (*(t)->_space_read_4)((t), (h), (o))
92#define bus_space_read_8(t, h, o) (*(t)->_space_read_8)((t), (h), (o))
93
94#define bus_space_write_1(t, h, o, v) (*(t)->_space_write_1)((t), (h), (o), (v))
95#define bus_space_write_2(t, h, o, v) (*(t)->_space_write_2)((t), (h), (o), (v))
96#define bus_space_write_4(t, h, o, v) (*(t)->_space_write_4)((t), (h), (o), (v))
97#define bus_space_write_8(t, h, o, v) (*(t)->_space_write_8)((t), (h), (o), (v))
98
99#define bus_space_read_raw_multi_2(t, h, a, b, l) \
100 (*(t)->_space_read_raw_2)((t), (h), (a), (b), (l))
101#define bus_space_read_raw_multi_4(t, h, a, b, l) \
102 (*(t)->_space_read_raw_4)((t), (h), (a), (b), (l))
103#define bus_space_read_raw_multi_8(t, h, a, b, l) \
104 (*(t)->_space_read_raw_8)((t), (h), (a), (b), (l))
105
106#define bus_space_write_raw_multi_2(t, h, a, b, l) \
107 (*(t)->_space_write_raw_2)((t), (h), (a), (b), (l))
108#define bus_space_write_raw_multi_4(t, h, a, b, l) \
109 (*(t)->_space_write_raw_4)((t), (h), (a), (b), (l))
110#define bus_space_write_raw_multi_8(t, h, a, b, l) \
111 (*(t)->_space_write_raw_8)((t), (h), (a), (b), (l))
112
113#define bus_space_map(t, o, s, c, p) (*(t)->_space_map)((t), (o), (s), (c), (p))
114#define bus_space_unmap(t, h, s) (*(t)->_space_unmap)((t), (h), (s))
115#define bus_space_subregion(t, h, o, s, p) \
116 (*(t)->_space_subregion)((t), (h), (o), (s), (p))
117
118#define BUS_SPACE_MAP_CACHEABLE 0x01
119#define BUS_SPACE_MAP_LINEAR 0x02
120#define BUS_SPACE_MAP_PREFETCHABLE 0x04
121
122#define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h))
123#define bus_space_mmap(t, a, o, p, f) \
124 (*(t)->_space_mmap)((t), (a), (o), (p), (f))
125
126/*----------------------------------------------------------------------------*/
127#define bus_space_read_multi(n,m) \
128static __inline void \
129CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
130 bus_size_t o, CAT3(u_int,m,_t) *x, size_t cnt) \
131{ \
132 while (cnt--) \
133 *x++ = CAT(bus_space_read_,n)(bst, bsh, o); \
134}
135
136bus_space_read_multi(1,8)
137bus_space_read_multi(2,16)
138bus_space_read_multi(4,32)
139bus_space_read_multi(8,64)
140
141/*----------------------------------------------------------------------------*/
142#define bus_space_read_region(n,m) \
143static __inline void \
144CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
145 bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \
146{ \
147 while (cnt--) { \
148 *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \
149 ba += (n); \
150 } \
151}
152
153bus_space_read_region(1,8)
154bus_space_read_region(2,16)
155bus_space_read_region(4,32)
156bus_space_read_region(8,64)
157
158/*----------------------------------------------------------------------------*/
159#define bus_space_read_raw_region(n,m) \
160static __inline void \
161CAT(bus_space_read_raw_region_,n)(bus_space_tag_t bst, \
162 bus_space_handle_t bsh, \
163 bus_addr_t ba, u_int8_t *x, size_t cnt) \
164{ \
165 cnt >>= ((n) >> 1); \
166 while (cnt--) { \
167 CAT(bus_space_read_raw_multi_,n)(bst, bsh, ba, x, (n)); \
168 ba += (n); \
169 x += (n); \
170 } \
171}
172
173bus_space_read_raw_region(2,16)
174bus_space_read_raw_region(4,32)
175bus_space_read_raw_region(8,64)
176
177/*----------------------------------------------------------------------------*/
178#define bus_space_write_multi(n,m) \
179static __inline void \
180CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
181 bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \
182{ \
183 while (cnt--) \
184 CAT(bus_space_write_,n)(bst, bsh, o, *x++); \
185}
186
187bus_space_write_multi(1,8)
188bus_space_write_multi(2,16)
189bus_space_write_multi(4,32)
190bus_space_write_multi(8,64)
191
192/*----------------------------------------------------------------------------*/
193#define bus_space_write_region(n,m) \
194static __inline void \
195CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
196 bus_addr_t ba, const CAT3(u_int,m,_t) *x, size_t cnt) \
197{ \
198 while (cnt--) { \
199 CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \
200 ba += (n); \
201 } \
202}
203
204bus_space_write_region(1,8)
205bus_space_write_region(2,16)
206bus_space_write_region(4,32)
207bus_space_write_region(8,64)
208
209/*----------------------------------------------------------------------------*/
210#define bus_space_write_raw_region(n,m) \
211static __inline void \
212CAT(bus_space_write_raw_region_,n)(bus_space_tag_t bst, \
213 bus_space_handle_t bsh, \
214 bus_addr_t ba, const u_int8_t *x, size_t cnt) \
215{ \
216 cnt >>= ((n) >> 1); \
217 while (cnt--) { \
218 CAT(bus_space_write_raw_multi_,n)(bst, bsh, ba, x, (n)); \
219 ba += (n); \
220 x += (n); \
221 } \
222}
223
224bus_space_write_raw_region(2,16)
225bus_space_write_raw_region(4,32)
226bus_space_write_raw_region(8,64)
227
228/*----------------------------------------------------------------------------*/
229#define bus_space_set_region(n,m) \
230static __inline void \
231CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
232 bus_addr_t ba, CAT3(u_int,m,_t) x, size_t cnt) \
233{ \
234 while (cnt--) { \
235 CAT(bus_space_write_,n)(bst, bsh, ba, x); \
236 ba += (n); \
237 } \
238}
239
240bus_space_set_region(1,8)
241bus_space_set_region(2,16)
242bus_space_set_region(4,32)
243bus_space_set_region(8,64)
244
245/*----------------------------------------------------------------------------*/
246static __inline void
247bus_space_copy_1(void *v, bus_space_handle_t h1, bus_size_t o1,
248 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
249{
250 char *s = (char *)(h1 + o1);
251 char *d = (char *)(h2 + o2);
252
253 while (c--)
254 *d++ = *s++;
255}
256
257
258static __inline void
259bus_space_copy_2(void *v, bus_space_handle_t h1, bus_size_t o1,
260 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
261{
262 short *s = (short *)(h1 + o1);
263 short *d = (short *)(h2 + o2);
264
265 while (c--)
266 *d++ = *s++;
267}
268
269static __inline void
270bus_space_copy_4(void *v, bus_space_handle_t h1, bus_size_t o1,
271 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
272{
273 int *s = (int *)(h1 + o1);
274 int *d = (int *)(h2 + o2);
275
276 while (c--)
277 *d++ = *s++;
278}
279
280static __inline void
281bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1,
282 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
283{
284 int64_t *s = (int64_t *)(h1 + o1);
285 int64_t *d = (int64_t *)(h2 + o2);
286
287 while (c--)
288 *d++ = *s++;
289}
290
291int generic_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
292 bus_space_handle_t *);
293void generic_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
294int generic_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t,
295 bus_size_t, bus_space_handle_t *);
296void *generic_space_vaddr(bus_space_tag_t, bus_space_handle_t);
297uint8_t generic_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
298uint16_t generic_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
299uint32_t generic_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
300uint64_t generic_space_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
301void generic_space_read_raw_2(bus_space_tag_t, bus_space_handle_t,
302 bus_addr_t, uint8_t *, bus_size_t);
303void generic_space_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
304 uint8_t);
305void generic_space_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
306 uint16_t);
307void generic_space_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
308 uint32_t);
309void generic_space_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
310 uint64_t);
311void generic_space_write_raw_2(bus_space_tag_t, bus_space_handle_t,
312 bus_addr_t, const uint8_t *, bus_size_t);
313void generic_space_read_raw_4(bus_space_tag_t, bus_space_handle_t,
314 bus_addr_t, uint8_t *, bus_size_t);
315void generic_space_write_raw_4(bus_space_tag_t, bus_space_handle_t,
316 bus_addr_t, const uint8_t *, bus_size_t);
317void generic_space_read_raw_8(bus_space_tag_t, bus_space_handle_t,
318 bus_addr_t, uint8_t *, bus_size_t);
319void generic_space_write_raw_8(bus_space_tag_t, bus_space_handle_t,
320 bus_addr_t, const uint8_t *, bus_size_t);
321paddr_t generic_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
322
323/*----------------------------------------------------------------------------*/
324/*
325 * Bus read/write barrier methods.
326 *
327 * void bus_space_barrier(bus_space_tag_t tag,
328 * bus_space_handle_t bsh, bus_size_t offset,
329 * bus_size_t len, int flags);
330 *
331 */
332static inline void
333bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
334 bus_size_t length, int flags)
335{
336 __asm__ volatile ("sync" ::: "memory");
337}
338#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
339#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
340
341#define BUS_DMA_WAITOK 0x0000
342#define BUS_DMA_NOWAIT 0x0001
343#define BUS_DMA_ALLOCNOW 0x0002
344#define BUS_DMA_COHERENT 0x0008
345#define BUS_DMA_BUS1 0x0010 /* placeholders for bus functions... */
346#define BUS_DMA_BUS2 0x0020
347#define BUS_DMA_BUS3 0x0040
348#define BUS_DMA_BUS4 0x0080
349#define BUS_DMA_READ 0x0100 /* mapping is device -> memory only */
350#define BUS_DMA_WRITE 0x0200 /* mapping is memory -> device only */
351#define BUS_DMA_STREAMING 0x0400 /* hint: sequential, unidirectional */
352#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */
353#define BUS_DMA_NOCACHE 0x1000
354#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */
355
356/* Forwards needed by prototypes below. */
357struct mbuf;
358struct proc;
359struct uio;
360
361#define BUS_DMASYNC_POSTREAD 0x0001
362#define BUS_DMASYNC_POSTWRITE 0x0002
363#define BUS_DMASYNC_PREREAD 0x0004
364#define BUS_DMASYNC_PREWRITE 0x0008
365
366typedef struct machine_bus_dma_tag *bus_dma_tag_t;
367typedef struct machine_bus_dmamap *bus_dmamap_t;
368
369/*
370 * bus_dma_segment_t
371 *
372 * Describes a single contiguous DMA transaction. Values
373 * are suitable for programming into DMA registers.
374 */
375struct machine_bus_dma_segment {
376 bus_addr_t ds_addr; /* DMA address */
377 bus_size_t ds_len; /* length of transfer */
378
379 paddr_t _ds_paddr; /* CPU address */
380 vaddr_t _ds_vaddr; /* CPU address */
381};
382typedef struct machine_bus_dma_segment bus_dma_segment_t;
383
384/*
385 * bus_dma_tag_t
386 *
387 * A machine-dependent opaque type describing the implementation of
388 * DMA for a given bus.
389 */
390
391struct machine_bus_dma_tag {
392 void *_cookie; /* cookie used in the guts */
393
394 /*
395 * DMA mapping methods.
396 */
397 int (*_dmamap_create)(bus_dma_tag_t , bus_size_t, int,
398 bus_size_t, bus_size_t, int, bus_dmamap_t *);
399 void (*_dmamap_destroy)(bus_dma_tag_t , bus_dmamap_t);
400 int (*_dmamap_load)(bus_dma_tag_t , bus_dmamap_t, void *,
401 bus_size_t, struct proc *, int);
402 int (*_dmamap_load_mbuf)(bus_dma_tag_t , bus_dmamap_t,
403 struct mbuf *, int);
404 int (*_dmamap_load_uio)(bus_dma_tag_t , bus_dmamap_t,
405 struct uio *, int);
406 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
407 bus_dma_segment_t *, int, bus_size_t, int);
408 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
409 bus_size_t, struct proc *, int, paddr_t *, int *, int);
410 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
411 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
412 bus_addr_t, bus_size_t, int);
413
414 /*
415 * DMA memory utility functions.
416 */
417 int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
418 bus_size_t, bus_dma_segment_t *, int, int *, int);
419 void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int);
420 int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
421 int, size_t, caddr_t *, int);
422 void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
423 paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
424 int, off_t, int, int);
425
426 /*
427 * internal memory address translation information.
428 */
429 bus_addr_t (*_pa_to_device)(paddr_t);
430 paddr_t (*_device_to_pa)(bus_addr_t);
431 bus_addr_t _dma_mask;
432};
433
434#define bus_dmamap_create(t, s, n, m, b, f, p) \
435 (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
436#define bus_dmamap_destroy(t, p) \
437 (*(t)->_dmamap_destroy)((t), (p))
438#define bus_dmamap_load(t, m, b, s, p, f) \
439 (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
440#define bus_dmamap_load_mbuf(t, m, b, f) \
441 (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
442#define bus_dmamap_load_uio(t, m, u, f) \
443 (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
444#define bus_dmamap_load_raw(t, m, sg, n, s, f) \
445 (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
446#define bus_dmamap_unload(t, p) \
447 (*(t)->_dmamap_unload)((t), (p))
448#define bus_dmamap_sync(t, p, a, l, o) \
449 (void)((t)->_dmamap_sync ? \
450 (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0)
451
452#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
453 (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
454#define bus_dmamem_free(t, sg, n) \
455 (*(t)->_dmamem_free)((t), (sg), (n))
456#define bus_dmamem_map(t, sg, n, s, k, f) \
457 (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
458#define bus_dmamem_unmap(t, k, s) \
459 (*(t)->_dmamem_unmap)((t), (k), (s))
460#define bus_dmamem_mmap(t, sg, n, o, p, f) \
461 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
462
463int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
464 bus_size_t, bus_size_t, int, bus_dmamap_t *);
465void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
466int _dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
467 bus_size_t, struct proc *, int);
468int _dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int);
469int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
470int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
471 bus_dma_segment_t *, int, bus_size_t, int);
472int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
473 bus_size_t, struct proc *, int, paddr_t *, int *, int);
474void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
475void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
476 bus_size_t, int);
477
478int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
479 bus_size_t, bus_dma_segment_t *, int, int *, int);
480void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int);
481int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *,
482 int, size_t, caddr_t *, int);
483void _dmamem_unmap(bus_dma_tag_t, caddr_t, size_t);
484paddr_t _dmamem_mmap(bus_dma_tag_t, bus_dma_segment_t *, int, off_t, int, int);
485int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
486 bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t);
487
488/*
489 * bus_dmamap_t
490 *
491 * Describes a DMA mapping.
492 */
493struct machine_bus_dmamap {
494 /*
495 * PRIVATE MEMBERS: not for use by machine-independent code.
496 */
497 bus_size_t _dm_size; /* largest DMA transfer mappable */
498 int _dm_segcnt; /* number of segs this map can map */
499 bus_size_t _dm_maxsegsz; /* largest possible segment */
500 bus_size_t _dm_boundary; /* don't cross this */
501 int _dm_flags; /* misc. flags */
502
503 void *_dm_cookie; /* cookie for bus-specific functions */
504
505 /*
506 * PUBLIC MEMBERS: these are used by machine-independent code.
507 */
508 bus_size_t dm_mapsize; /* size of the mapping */
509 int dm_nsegs; /* # valid segments in mapping */
510 bus_dma_segment_t dm_segs[1]; /* segments; variable length */
511};
512
513#endif /* _MACHINE_BUS_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/cdefs.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */
2/* public domain */
3#include <mips64/cdefs.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/conf.h deleted-42
...@@ -1,42 +0,0 @@
1/* $OpenBSD: conf.h,v 1.4 2022/06/28 14:43:50 visa Exp $ */
2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
3
4/*
5 * Copyright (c) 1996 Christos Zoulas. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Christos Zoulas.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/conf.h>
34
35/* open, close, write, ioctl, kqueue */
36#define cdev_apm_init(c,n) { \
37 dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
38 (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
39 (dev_type_stop((*))) enodev, 0, \
40 (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,n,kqfilter) }
41
42cdev_decl(apm);
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/cpu.h deleted-103
...@@ -1,103 +0,0 @@
1/* $OpenBSD: cpu.h,v 1.8 2017/07/30 16:05:24 visa Exp $ */
2/*-
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Ralph Campbell and Rick Macklem.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * Copyright (C) 1989 Digital Equipment Corporation.
34 * Permission to use, copy, modify, and distribute this software and
35 * its documentation for any purpose and without fee is hereby granted,
36 * provided that the above copyright notice appears in all copies.
37 * Digital Equipment Corporation makes no representations about the
38 * suitability of this software for any purpose. It is provided "as is"
39 * without express or implied warranty.
40 *
41 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
42 */
43
44#ifdef _KERNEL
45
46#if defined(MULTIPROCESSOR) && !defined(_LOCORE)
47#define MAXCPUS 4
48struct cpu_info;
49struct cpu_info *hw_getcurcpu(void);
50void hw_setcurcpu(struct cpu_info *);
51void hw_cpu_boot_secondary(struct cpu_info *);
52void hw_cpu_hatch(struct cpu_info *);
53void hw_cpu_spinup_trampoline(struct cpu_info *);
54int hw_ipi_intr_establish(int (*)(void *), u_long);
55void hw_ipi_intr_set(u_long);
56void hw_ipi_intr_clear(u_long);
57#endif /* MULTIPROCESSOR && !_LOCORE */
58
59#if defined(CPU_LOONGSON2) && !defined(CPU_LOONGSON3)
60#define Mips_SyncCache(ci) \
61 Loongson2_SyncCache((ci))
62#define Mips_InvalidateICache(ci, va, l) \
63 Loongson2_InvalidateICache((ci), (va), (l))
64#define Mips_InvalidateICachePage(ci, va) \
65 Loongson2_InvalidateICachePage((ci), (va))
66#define Mips_SyncICache(ci) \
67 Loongson2_SyncICache((ci))
68#define Mips_SyncDCachePage(ci, va, pa) \
69 Loongson2_SyncDCachePage((ci), (va), (pa))
70#define Mips_HitSyncDCachePage(ci, va, pa) \
71 Loongson2_SyncDCachePage((ci), (va), (pa))
72#define Mips_HitSyncDCache(ci, va, l) \
73 Loongson2_HitSyncDCache((ci), (va), (l))
74#define Mips_IOSyncDCache(ci, va, l, h) \
75 Loongson2_IOSyncDCache((ci), (va), (l), (h))
76#define Mips_HitInvalidateDCache(ci, va, l) \
77 Loongson2_HitInvalidateDCache((ci), (va), (l))
78#endif
79
80#if defined(CPU_LOONGSON3) && !defined(CPU_LOONGSON2)
81#define Mips_SyncCache(ci) \
82 Loongson3_SyncCache((ci))
83#define Mips_InvalidateICache(ci, va, l) \
84 Loongson3_InvalidateICache((ci), (va), (l))
85#define Mips_InvalidateICachePage(ci, va) \
86 Loongson3_InvalidateICachePage((ci), (va))
87#define Mips_SyncICache(ci) \
88 Loongson3_SyncICache((ci))
89#define Mips_SyncDCachePage(ci, va, pa) \
90 Loongson3_SyncDCachePage((ci), (va), (pa))
91#define Mips_HitSyncDCachePage(ci, va, pa) \
92 Loongson3_SyncDCachePage((ci), (va), (pa))
93#define Mips_HitSyncDCache(ci, va, l) \
94 Loongson3_HitSyncDCache((ci), (va), (l))
95#define Mips_IOSyncDCache(ci, va, l, h) \
96 Loongson3_IOSyncDCache((ci), (va), (l), (h))
97#define Mips_HitInvalidateDCache(ci, va, l) \
98 Loongson3_HitInvalidateDCache((ci), (va), (l))
99#endif
100
101#endif /* _KERNEL */
102
103#include <mips64/cpu.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/cpustate.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: cpustate.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/cpustate.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/db_machdep.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: db_machdep.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/db_machdep.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/disklabel.h deleted-16
...@@ -1,16 +0,0 @@
1/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */
2/* public domain */
3
4/*
5 * Standard MBR partition scheme, with the label in the second sector
6 * of the OpenBSD partition.
7 */
8
9#ifndef _MACHINE_DISKLABEL_H_
10#define _MACHINE_DISKLABEL_H_
11
12#define LABELSECTOR 1 /* sector containing label */
13#define LABELOFFSET 0 /* offset of label in sector */
14#define MAXPARTITIONS 16 /* number of partitions */
15
16#endif /* _MACHINE_DISKLABEL_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/elf.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: elf.h,v 1.1 2024/07/14 19:33:59 miod Exp $ */
2
3#include <mips64/elf.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/endian.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: endian.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/endian.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/exec.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: exec.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/exec.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/fenv.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/fenv.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/fpu.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: fpu.h,v 1.1 2010/09/17 00:34:04 miod Exp $ */
2/* public domain */
3#include <mips64/fpu.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/frame.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/frame.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/ieee.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ieee.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/ieee.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/ieeefp.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ieeefp.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/ieeefp.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/intr.h deleted-193
...@@ -1,193 +0,0 @@
1/* $OpenBSD: intr.h,v 1.19 2025/05/10 10:01:03 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MACHINE_INTR_H_
30#define _MACHINE_INTR_H_
31
32#define __USE_MI_SOFTINTR
33
34#include <sys/softintr.h>
35
36/*
37 * The interrupt level ipl is a logical level; per-platform interrupt
38 * code will turn it into the appropriate hardware interrupt masks
39 * values.
40 *
41 * Interrupt sources on the CPU are kept enabled regardless of the
42 * current ipl value; individual hardware sources interrupting while
43 * logically masked are masked on the fly, remembered as pending, and
44 * unmasked at the first splx() opportunity.
45 *
46 * An exception to this rule is the clock interrupt. Clock interrupts
47 * are always allowed to happen, but will (of course!) not be serviced
48 * if logically masked. The reason for this is that clocks usually sit on
49 * INT5 and cannot be easily masked if external hardware masking is used.
50 */
51
52/* Interrupt priority `levels'; not mutually exclusive. */
53#define IPL_NONE 0 /* nothing */
54#define IPL_SOFTINT 1 /* soft interrupts */
55#define IPL_SOFTCLOCK 1 /* soft clock interrupts */
56#define IPL_SOFTNET 2 /* soft network interrupts */
57#define IPL_SOFTTTY 3 /* soft terminal interrupts */
58#define IPL_SOFTHIGH IPL_SOFTTTY /* highest level of soft interrupts */
59#define IPL_BIO 4 /* block I/O */
60#define IPL_AUDIO IPL_BIO
61#define IPL_NET 5 /* network */
62#define IPL_TTY 6 /* terminal */
63#define IPL_VM 7 /* memory allocation */
64#define IPL_CLOCK 8 /* clock */
65#define IPL_STATCLOCK IPL_CLOCK
66#define IPL_SCHED 9 /* everything */
67#define IPL_HIGH 9 /* everything */
68#define IPL_IPI 10 /* interprocessor interrupt */
69#define NIPLS 11 /* number of levels */
70
71#define IPL_MPFLOOR IPL_TTY
72
73/* Interrupt priority 'flags'. */
74#define IPL_MPSAFE 0x100
75
76/* Interrupt sharing types. */
77#define IST_NONE 0 /* none */
78#define IST_PULSE 1 /* pulsed */
79#define IST_EDGE 2 /* edge-triggered */
80#define IST_LEVEL 3 /* level-triggered */
81
82#ifndef _LOCORE
83
84void softintr(int);
85
86#define splbio() splraise(IPL_BIO)
87#define splnet() splraise(IPL_NET)
88#define spltty() splraise(IPL_TTY)
89#define splaudio() splraise(IPL_AUDIO)
90#define splclock() splraise(IPL_CLOCK)
91#define splvm() splraise(IPL_VM)
92#define splhigh() splraise(IPL_HIGH)
93
94#define splsoftclock() splraise(IPL_SOFTCLOCK)
95#define splsoftnet() splraise(IPL_SOFTNET)
96#define splstatclock() splhigh()
97
98#define splsched() splhigh()
99#define spl0() spllower(0)
100
101void splinit(void);
102
103#ifdef DIAGNOSTIC
104/*
105 * Although this function is implemented in MI code, it must be in this MD
106 * header because we don't want this header to include MI includes.
107 */
108void splassert_fail(int, int, const char *);
109extern int splassert_ctl;
110void splassert_check(int, const char *);
111#define splassert(__wantipl) do { \
112 if (splassert_ctl > 0) { \
113 splassert_check(__wantipl, __func__); \
114 } \
115} while (0)
116#define splsoftassert(wantipl) splassert(wantipl)
117#else
118#define splassert(X)
119#define splsoftassert(X)
120#endif
121
122void register_splx_handler(void (*)(int));
123int splraise(int);
124void splx(int);
125int spllower(int);
126
127/*
128 * Interrupt control struct used by interrupt dispatchers
129 * to hold interrupt handler info.
130 */
131
132#include <sys/evcount.h>
133
134struct intrhand {
135 struct intrhand *ih_next;
136 int (*ih_fun)(void *);
137 void *ih_arg;
138 int ih_level;
139 int ih_irq;
140 int ih_flags;
141#define IH_MPSAFE 0x01
142 struct evcount ih_count;
143};
144
145void intr_barrier(void *);
146
147/*
148 * Low level interrupt dispatcher registration data.
149 */
150
151/* Schedule priorities for base interrupts (CPU) */
152#define INTPRI_IPI 0
153#define INTPRI_CLOCK 1
154/* other values are system-specific */
155
156#define NLOWINT 4 /* Number of low level registrations possible */
157
158extern uint32_t idle_mask;
159
160struct trapframe;
161void set_intr(int, uint32_t, uint32_t(*)(uint32_t, struct trapframe *));
162
163uint32_t updateimask(uint32_t);
164void dosoftint(void);
165
166#ifdef MULTIPROCESSOR
167extern uint32_t ipi_mask;
168#define ENABLEIPI() updateimask(~ipi_mask)
169#endif
170
171struct pic {
172 void (*pic_eoi)(int);
173 void (*pic_mask)(int);
174 void (*pic_unmask)(int);
175};
176
177#ifdef CPU_LOONGSON3
178
179void loongson3_intr_init(void);
180void *loongson3_intr_establish(int, int, int (*)(void *), void*,
181 const char *);
182void loongson3_intr_disestablish(void *);
183void *loongson3_ht_intr_establish(int, int, int (*)(void *), void*,
184 const char *);
185void loongson3_ht_intr_disestablish(void *);
186
187void loongson3_register_ht_pic(const struct pic *);
188
189#endif /* CPU_LOONGSON3 */
190
191#endif /* _LOCORE */
192
193#endif /* _MACHINE_INTR_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/isa_machdep.h deleted-51
...@@ -1,51 +0,0 @@
1/* $OpenBSD: isa_machdep.h,v 1.2 2010/05/08 21:59:56 miod Exp $ */
2
3/*
4 * Copyright (c) 2007 Miodrag Vallat.
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, this permission notice, and the disclaimer below
9 * 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_ISA_MACHDEP_H_
21#define _MACHINE_ISA_MACHDEP_H_
22
23#include <machine/bus.h>
24
25#define __NO_ISA_INTR_CHECK
26
27typedef struct mips_isa_chipset *isa_chipset_tag_t;
28
29struct mips_isa_chipset {
30 void *ic_v;
31
32 void (*ic_attach_hook)(struct device *, struct device *,
33 struct isabus_attach_args *);
34 void *(*ic_intr_establish)(void *, int, int, int, int (*)(void *),
35 void *, char *);
36 void (*ic_intr_disestablish)(void *, void *);
37};
38
39#define isa_attach_hook(p, s, iba) \
40 (*(iba)->iba_ic->ic_attach_hook)((p), (s), (iba))
41#define isa_intr_establish(c, i, t, l, f, a, n) \
42 (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (n))
43#define isa_intr_disestablish(c, h) \
44 (*(c)->ic_intr_disestablish)((c)->ic_v, (h))
45
46void loongson_generic_isa_attach_hook(struct device *, struct device *,
47 struct isabus_attach_args *);
48void loongson_isa_specific_eoi(int);
49void loongson_set_isa_imr(uint);
50
51#endif
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/kcore.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: kcore.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/kcore.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: limits.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/limits.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/loadfile_machdep.h deleted-49
...@@ -1,49 +0,0 @@
1/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */
2/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */
3
4/*-
5 * Copyright (c) 1999 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Christos Zoulas.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#define BOOT_ELF
34#define ELFSIZE 64
35
36#define LOAD_KERNEL LOAD_ALL
37#define COUNT_KERNEL COUNT_ALL
38
39#define LOADADDR(a) (((u_long)(a)) + offset)
40#define ALIGNENTRY(a) ((u_long)(a))
41#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
42#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
43#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
44#define WARN(a) (void)(printf a, \
45 printf((errno ? ": %s\n" : "\n"), \
46 strerror(errno)))
47#define PROGRESS(a) (void) printf a
48#define ALLOC(a) alloc(a)
49#define FREE(a, b) free(a, b)
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/loongson2.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: loongson2.h,v 1.1.1.1 2009/08/06 20:51:44 miod Exp $ */
2/* public domain */
3#include <mips64/loongson2.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/loongson3.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: loongson3.h,v 1.1 2016/11/06 10:20:33 visa Exp $ */
2/* public domain */
3#include <mips64/loongson3.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/memconf.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: memconf.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/memconf.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/mips_opcode.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mips_opcode.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/mips_opcode.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/mplock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mplock.h,v 1.1 2017/01/19 14:51:02 visa Exp $ */
2
3#include <mips64/mplock.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/mutex.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mutex.h,v 1.2 2015/07/08 13:37:31 dlg Exp $ */
2
3#include <mips64/mutex.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/param.h deleted-27
...@@ -1,27 +0,0 @@
1/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */
2
3/* Public Domain */
4
5#ifndef _MACHINE_PARAM_H_
6#define _MACHINE_PARAM_H_
7
8#define MACHINE "loongson"
9#define _MACHINE loongson
10#define MACHINE_ARCH "mips64el" /* not the canonical endianness */
11#define _MACHINE_ARCH mips64el
12#define MACHINE_CPU "mips64"
13#define _MACHINE_CPU mips64
14#define MID_MACHINE MID_MIPS64
15
16/*
17 * The Loongson level 1 cache expects software to prevent virtual
18 * aliases. Unfortunately, since this cache is physically tagged,
19 * this would require all virtual address to have the same bits 14
20 * and 13 as their physical addresses, which is not something the
21 * kernel can guarantee unless the page size is at least 16KB.
22 */
23#define PAGE_SHIFT 14
24
25#include <mips64/param.h>
26
27#endif /* _MACHINE_PARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/pcb.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pcb.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/pcb.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/pci_machdep.h deleted-101
...@@ -1,101 +0,0 @@
1/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29typedef struct mips_pci_chipset *pci_chipset_tag_t;
30typedef u_long pcitag_t;
31typedef u_long pci_intr_handle_t;
32
33struct pci_attach_args;
34
35/*
36 * mips-specific PCI structure and type definitions.
37 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
38 */
39struct mips_pci_chipset {
40 void *pc_conf_v;
41 void (*pc_attach_hook)(struct device *,
42 struct device *, struct pcibus_attach_args *);
43 int (*pc_bus_maxdevs)(void *, int);
44 pcitag_t (*pc_make_tag)(void *, int, int, int);
45 void (*pc_decompose_tag)(void *, pcitag_t, int *,
46 int *, int *);
47 int (*pc_conf_size)(void *, pcitag_t);
48 pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
49 void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
50
51 void *pc_intr_v;
52 int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *);
53 const char *(*pc_intr_string)(void *, pci_intr_handle_t);
54 void *(*pc_intr_establish)(void *, pci_intr_handle_t,
55 int, int (*)(void *), void *, char *);
56 void (*pc_intr_disestablish)(void *, void *);
57};
58
59/*
60 * Functions provided to machine-independent PCI code.
61 */
62#define pci_attach_hook(p, s, pba) \
63 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
64#define pci_bus_maxdevs(c, b) \
65 (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
66#define pci_make_tag(c, b, d, f) \
67 (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
68#define pci_decompose_tag(c, t, bp, dp, fp) \
69 (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
70#define pci_conf_size(c, t) \
71 (*(c)->pc_conf_size)((c)->pc_conf_v, (t))
72#define pci_conf_read(c, t, r) \
73 (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
74#define pci_conf_write(c, t, r, v) \
75 (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
76#define pci_intr_map(c, ihp) \
77 (*(c)->pa_pc->pc_intr_map)((c), (ihp))
78#define pci_intr_map_msi(c, ihp) (-1)
79#define pci_intr_map_msix(c, vec, ihp) (-1)
80#define pci_intr_string(c, ih) \
81 (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
82#define pci_intr_establish(c, ih, l, h, a, nm) \
83 (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm))
84#define pci_intr_disestablish(c, iv) \
85 (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
86#define pci_probe_device_hook(c, a) (0)
87
88#define pci_min_powerstate(c, t) (PCI_PMCSR_STATE_D3)
89#define pci_set_powerstate_md(c, t, s, p)
90
91/* PCI view of CPU memory */
92extern paddr_t loongson_dma_base;
93
94/*
95 * Functions used during early system configuration.
96 */
97
98extern pcitag_t (*pci_make_tag_early)(int, int, int);
99extern pcireg_t (*pci_conf_read_early)(pcitag_t, int);
100
101#define pci_dev_postattach(a, b)
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/pmap.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pmap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/pmap.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/pmon.h deleted-209
...@@ -1,209 +0,0 @@
1/* $OpenBSD: pmon.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */
2
3/*
4 * Copyright (c) 2009, 2012 Miodrag Vallat.
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#ifndef _MACHINE_PMON_H_
20#define _MACHINE_PMON_H_
21
22#if defined(_KERNEL) || defined(_STANDALONE)
23
24/*
25 * PMON2000 callvec definitions
26 */
27
28/* 32-bit compatible types */
29typedef uint32_t pmon_size_t;
30typedef int32_t pmon_ssize_t;
31typedef int64_t pmon_off_t;
32
33int pmon_open(const char *, int, ...);
34int pmon_close(int);
35int pmon_read(int, void *, pmon_size_t);
36pmon_ssize_t pmon_write(int, const void *, pmon_size_t);
37pmon_off_t pmon_lseek(int, pmon_off_t, int);
38int pmon_printf(const char *, ...);
39void pmon_cacheflush(void);
40char * pmon_gets(char *);
41
42#define PMON_MAXLN 256 /* internal gets() size limit */
43
44extern int32_t pmon_callvec;
45
46const char *pmon_getarg(const int);
47void pmon_init(int32_t, int32_t, int32_t, int32_t, uint32_t);
48
49#define PMON_ENVTYPE_ENVP 0
50#define PMON_ENVTYPE_EFI 1
51int pmon_getenvtype(void);
52
53/*
54 * The new environment interface is a /salmigondis/ of badly thought-out
55 * structs put together, pretending to be inspired by EFI but conveniently
56 * omitting key EFI structs because they are deemed non-applicable to
57 * MIPS systems.
58 * Of course, some fields are absolute addresses, while others are relative
59 * pointers, to add to the confusion.
60 */
61
62struct pmon_env_reset {
63 void (*cold_boot)(void); /* not filled */
64 void (*warm_boot)(void);
65 void (*boot)(unsigned int); /* not filled */
66 void (*poweroff)(void);
67};
68
69/* all values are offsets relative to the beginning of the struct */
70struct pmon_env_ptr {
71 uint64_t offs_mem;
72 uint64_t offs_cpu;
73 uint64_t offs_sys;
74 uint64_t offs_irq;
75 uint64_t offs_iface;
76 uint64_t offs_special;
77 uint64_t offs_device;
78};
79
80struct pmon_env_smbios {
81 uint16_t version;
82 uint64_t vga_bios;
83 struct pmon_env_ptr ptrs;
84};
85
86struct pmon_env_efi {
87 uint64_t mps; /* not filled */
88 uint64_t acpi; /* not filled */
89 uint64_t acpi20; /* not filled */
90 struct pmon_env_smbios bios;
91 uint64_t sal_systab; /* not filled */
92 uint64_t bootinfo; /* not filled */
93};
94
95struct pmon_env {
96 struct pmon_env_efi efi;
97 struct pmon_env_reset reset;
98};
99
100#define PMON_MEM_MAX 128
101struct pmon_env_mem_entry {
102 uint32_t node;
103 uint32_t type;
104#define PMON_MEM_SYSTEM_LOW 1 /* physical memory <= 256 MB */
105#define PMON_MEM_SYSTEM_HIGH 2 /* physical memory > 256 MB */
106#define PMON_MEM_RESERVED 3
107#define PMON_MEM_PCI_IO 4
108#define PMON_MEM_PCI_MEM 5
109#define PMON_MEM_CPU_REGISTERS 6
110#define PMON_MEM_VIDEO_ROM 7
111#define PMON_MEM_OTHER_ROM 8
112#define PMON_MEM_ACPI_TABLE 9
113 uint64_t address;
114 uint32_t size;
115};
116struct pmon_env_mem {
117 uint16_t version; /* not filled */
118 uint32_t nentries;
119 uint32_t mem_freq;
120 struct pmon_env_mem_entry mem_map[PMON_MEM_MAX];
121} __packed;
122
123struct pmon_env_cpu {
124 uint16_t version; /* not filled */
125 uint32_t prid; /* cop0 PrID */
126 uint32_t cputype;
127/* 0 and 1 are supposedly intended for 2E and 2F, which do NOT provide this
128 interface; moreover Linux and PMON disagree on the values and have 2E and
129 2F swapped. */
130#define PMON_CPUTYPE_LS3A 2
131#define PMON_CPUTYPE_LS3B 3
132#define PMON_CPUTYPE_LS1A 4
133#define PMON_CPUTYPE_LS1B 5
134 uint32_t node; /* total number of NUMA nodes */
135 uint16_t coreid; /* boot CPU core id */
136 uint16_t reserved_cores; /* mask of reserved cores */
137 uint32_t speed;
138 uint32_t ncpus;
139} __packed;
140
141struct pmon_env_sys {
142 uint16_t version; /* not filled */
143 uint32_t ccnuma_smp;
144 uint32_t double_channel;
145} __packed;
146
147struct pmon_env_irq {
148 uint16_t version; /* not filled */
149 uint16_t size; /* not filled */
150 uint16_t rtr_bus; /* not filled */
151 uint16_t rtr_devfn; /* not filled */
152 uint32_t vendor; /* not filled */
153 uint32_t device; /* not filled */
154 uint32_t pic_type;
155#define PMON_IRQ_PIC_HT 0
156#define PMON_IRQ_PIC_I8259 1
157 uint64_t ht_interrupt_bit;
158 uint64_t ht_enable;
159 uint32_t node;
160 uint64_t pci_memory_space_start;
161 uint64_t pci_memory_space_end;
162 uint64_t pci_io_space_start; /* not filled */
163 uint64_t pci_io_space_end; /* not filled */
164 uint64_t pci_cfg_space; /* not filled */
165} __packed;
166
167struct pmon_env_iface {
168 uint16_t version;
169#define PMON_IFACE_VERSION 0x0001
170 uint16_t size;
171 uint8_t flag;
172 char description[64]; /* firmware version */
173} __packed;
174
175#define PMON_RESOURCE_MAX 128
176struct pmon_env_resource {
177 uint64_t start;
178 uint64_t end;
179 char name[64];
180 uint32_t flags;
181};
182struct pmon_env_special {
183 uint16_t version;
184 char name[64];
185 uint32_t type;
186 struct pmon_env_resource resource[PMON_RESOURCE_MAX];
187};
188
189struct pmon_env_device {
190 char name[64]; /* system description */
191 uint32_t nentries;
192 struct pmon_env_resource resource[PMON_RESOURCE_MAX];
193};
194
195const char *pmon_getenv(const char *);
196
197const struct pmon_env_reset *pmon_get_env_reset(void);
198const struct pmon_env_smbios *pmon_get_env_smbios(void);
199const struct pmon_env_mem *pmon_get_env_mem(void);
200const struct pmon_env_cpu *pmon_get_env_cpu(void);
201const struct pmon_env_sys *pmon_get_env_sys(void);
202const struct pmon_env_irq *pmon_get_env_irq(void);
203const struct pmon_env_iface *pmon_get_env_iface(void);
204const struct pmon_env_special *pmon_get_env_special(void);
205const struct pmon_env_device *pmon_get_env_device(void);
206
207#endif /* _KERNEL || _STANDALONE */
208
209#endif /* _MACHINE_PMON_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/proc.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: proc.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/proc.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/profile.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: profile.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/profile.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/pte.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pte.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/pte.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/ptrace.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ptrace.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/ptrace.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/reg.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: reg.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/reg.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/regdef.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: regdef.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/regdef.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/regnum.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: regnum.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/regnum.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/reloc.h deleted-5
...@@ -1,5 +0,0 @@
1/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */
2
3/* public domain */
4
5#include <mips64/reloc.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/setjmp.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: setjmp.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/setjmp.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/signal.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: signal.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/signal.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/spinlock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: spinlock.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/spinlock.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/sysarch.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: sysarch.h,v 1.1.1.1 2009/11/22 18:12:44 miod Exp $ */
2/* public domain */
3#include <mips64/sysarch.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/tcb.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
2/* public domain */
3#include <mips64/tcb.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/timetc.h deleted-23
...@@ -1,23 +0,0 @@
1/* $OpenBSD: timetc.h,v 1.2 2020/07/18 08:37:43 visa Exp $ */
2/*
3 * Copyright (c) 2020 Paul Irofti <paul@irofti.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MACHINE_TIMETC_H_
19#define _MACHINE_TIMETC_H_
20
21#include <mips64/timetc.h>
22
23#endif /* _MACHINE_TIMETC_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/trap.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: trap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/trap.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/loongson/vmparam.h deleted-11
...@@ -1,11 +0,0 @@
1/* $OpenBSD: vmparam.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */
2/* public domain */
3#ifndef _MACHINE_VMPARAM_H_
4#define _MACHINE_VMPARAM_H_
5
6#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */
7#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
8
9#include <mips64/vmparam.h>
10
11#endif /* _MACHINE_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/_types.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: _types.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/_types.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/apmvar.h deleted-127
...@@ -1,127 +0,0 @@
1/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */
2
3/*
4 * Copyright (c) 2001 Alexander Guy
5 * Copyright (c) 1995 John T. Kohl
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32#ifndef _MACHINE_APMVAR_H_
33#define _MACHINE_APMVAR_H_
34
35#include <sys/ioccom.h>
36
37/* Advanced Power Management (v1.0 and v1.1 specification)
38 * functions/defines/etc.
39 */
40
41/* These definitions make up the heart of the user-land interface
42 * to the APM devices.
43 */
44
45#define APM_AC_OFF 0x00
46#define APM_AC_ON 0x01
47#define APM_AC_BACKUP 0x02
48#define APM_AC_UNKNOWN 0xff
49#define APM_BATT_HIGH 0x00
50#define APM_BATT_LOW 0x01
51#define APM_BATT_CRITICAL 0x02
52#define APM_BATT_CHARGING 0x03
53#define APM_BATT_UNKNOWN 0xff
54#define APM_BATT_LIFE_UNKNOWN 0xff
55
56#define APM_NOEVENT 0x0000
57#define APM_STANDBY_REQ 0x0001
58#define APM_SUSPEND_REQ 0x0002
59#define APM_NORMAL_RESUME 0x0003
60#define APM_CRIT_RESUME 0x0004 /* suspend/resume happened
61 without us */
62#define APM_BATTERY_LOW 0x0005
63#define APM_POWER_CHANGE 0x0006
64#define APM_UPDATE_TIME 0x0007
65#define APM_CRIT_SUSPEND_REQ 0x0008
66#define APM_USER_STANDBY_REQ 0x0009
67#define APM_USER_SUSPEND_REQ 0x000A
68#define APM_SYS_STANDBY_RESUME 0x000B
69#define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */
70#define APM_USER_HIBERNATE_REQ 0x000D
71#define APM_EVENT_MASK 0xffff
72
73#define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK))
74#define APM_EVENT_TYPE(e) ((e) & APM_EVENT_MASK)
75#define APM_EVENT_INDEX(e) ((e) >> 16)
76
77/*
78 * LP (Laptop Package)
79 *
80 * Copyright (C) 1994 by HOSOKAWA Tatsumi <hosokawa@mt.cs.keio.ac.jp>
81 *
82 * This software may be used, modified, copied, and distributed, in
83 * both source and binary form provided that the above copyright and
84 * these terms are retained. Under no circumstances is the author
85 * responsible for the proper functioning of this software, nor does
86 * the author assume any responsibility for damages incurred with its
87 * use.
88 *
89 * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
90 */
91
92#define APM_BATTERY_ABSENT 4
93
94struct apm_power_info {
95 u_char battery_state;
96 u_char ac_state;
97 u_char battery_life;
98 u_char spare1;
99 u_int minutes_left; /* estimate */
100 u_int spare2[6];
101};
102
103struct apm_ctl {
104 u_int dev;
105 u_int mode;
106};
107
108#define APM_IOC_REJECT _IOW('A', 0, struct apm_event_info) /* reject request # */
109#define APM_IOC_STANDBY _IO('A', 1) /* put system into standby */
110#define APM_IOC_SUSPEND _IO('A', 2) /* put system into suspend */
111#define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info) /* fetch battery state */
112#define APM_IOC_DEV_CTL _IOW('A', 5, struct apm_ctl) /* put device into mode */
113#define APM_IOC_PRN_CTL _IOW('A', 6, int ) /* driver power status msg */
114#define APM_PRINT_ON 0 /* driver power status displayed */
115#define APM_PRINT_OFF 1 /* driver power status not displayed */
116#define APM_PRINT_PCT 2 /* driver power status only displayed
117 if the percentage changes */
118#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */
119#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */
120#define APM_IOC_HIBERNATE _IO('A', 9) /* put system into hibernate */
121
122#ifdef _KERNEL
123void apm_setinfohook(int (*)(struct apm_power_info *));
124int apm_record_event(u_int, const char *, const char *);
125#endif
126
127#endif /* _MACHINE_APMVAR_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/asm.h deleted-9
...@@ -1,9 +0,0 @@
1/* $OpenBSD: asm.h,v 1.2 2016/11/18 15:38:14 visa Exp $ */
2/* public domain */
3
4#ifdef MULTIPROCESSOR
5#define HW_GET_CPU_INFO(ci, tmp) \
6 dmfc0 ci, COP_0_ERROR_PC
7#endif
8
9#include <mips64/asm.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/atomic.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: atomic.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/atomic.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/autoconf.h deleted-124
...@@ -1,124 +0,0 @@
1/* $OpenBSD: autoconf.h,v 1.17 2017/05/21 13:00:53 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29/*
30 * Definitions used by autoconfiguration.
31 */
32
33#ifndef _MACHINE_AUTOCONF_H_
34#define _MACHINE_AUTOCONF_H_
35
36#include <machine/bus.h>
37
38struct bonito_config;
39struct htb_config;
40struct mips_isa_chipset;
41
42/*
43 * List of legacy I/O ranges.
44 */
45struct legacy_io_range {
46 bus_addr_t start;
47 bus_size_t end; /* inclusive */
48};
49
50/*
51 * Per platform information.
52 */
53struct platform {
54 int system_type;
55#define LOONGSON_2E 0x0000 /* Generic Loongson 2E system */
56#define LOONGSON_YEELOONG 0x0001 /* Lemote Yeeloong */
57#define LOONGSON_GDIUM 0x0002 /* EMTEC Gdium Liberty */
58#define LOONGSON_FULOONG 0x0003 /* Lemote Fuloong */
59#define LOONGSON_LYNLOONG 0x0004 /* Lemote Lynloong */
60#define LOONGSON_EBT700 0x0005 /* eBenton EBT700 */
61#define LOONGSON_3A 0x0066 /* Loongson 2Gq or 3A based system */
62
63 char *vendor;
64 char *product;
65
66 const struct bonito_config *bonito_config;
67 const struct htb_config *htb_config;
68 struct mips_isa_chipset *isa_chipset;
69 const struct legacy_io_range *legacy_io_ranges;
70
71 void (*setup)(void);
72 void (*device_register)(struct device *,
73 void *);
74
75 void (*powerdown)(void);
76 void (*reset)(void);
77 int (*suspend)(void);
78 int (*resume)(void);
79
80#ifdef MULTIPROCESSOR
81 void (*config_secondary_cpus)(
82 struct device *, cfprint_t);
83 void (*boot_secondary_cpu)(
84 struct cpu_info *);
85 int (*ipi_establish)(int (*)(void *),
86 cpuid_t);
87 void (*ipi_set)(cpuid_t);
88 void (*ipi_clear)(cpuid_t);
89#endif /* MULTIPROCESSOR */
90};
91
92#define LOONGSON_MAXCPUS 16
93
94extern const struct platform *sys_platform;
95extern void *loongson_videobios;
96extern uint loongson_cpumask;
97extern uint loongson_ver;
98extern int nnodes;
99
100#ifdef MULTIPROCESSOR
101extern uint64_t cpu_spinup_a0;
102extern uint64_t cpu_spinup_sp;
103#endif
104
105struct mainbus_attach_args {
106 const char *maa_name;
107};
108
109extern struct device *bootdv;
110extern char bootdev[];
111extern enum devclass bootdev_class;
112
113extern bus_space_tag_t early_mem_t;
114extern bus_space_tag_t early_io_t;
115
116#define REGVAL8(x) *((volatile uint8_t *)PHYS_TO_XKPHYS((x), CCA_NC))
117#define REGVAL32(x) *((volatile uint32_t *)PHYS_TO_XKPHYS((x), CCA_NC))
118#define REGVAL64(x) *((volatile uint64_t *)PHYS_TO_XKPHYS((x), CCA_NC))
119
120#define REGVAL(x) REGVAL32(x)
121
122#include <mips64/autoconf.h>
123
124#endif /* _MACHINE_AUTOCONF_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/bus.h deleted-513
...@@ -1,513 +0,0 @@
1/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef _MACHINE_BUS_H_
28#define _MACHINE_BUS_H_
29
30#ifdef __STDC__
31#define CAT(a,b) a##b
32#define CAT3(a,b,c) a##b##c
33#else
34#define CAT(a,b) a/**/b
35#define CAT3(a,b,c) a/**/b/**/c
36#endif
37
38/*
39 * Bus access types.
40 */
41struct mips_bus_space;
42typedef u_long bus_addr_t;
43typedef u_long bus_size_t;
44typedef u_long bus_space_handle_t;
45typedef struct mips_bus_space *bus_space_tag_t;
46
47struct mips_bus_space {
48 bus_addr_t bus_base;
49 void *bus_private;
50 u_int8_t (*_space_read_1)(bus_space_tag_t , bus_space_handle_t,
51 bus_size_t);
52 void (*_space_write_1)(bus_space_tag_t , bus_space_handle_t,
53 bus_size_t, u_int8_t);
54 u_int16_t (*_space_read_2)(bus_space_tag_t , bus_space_handle_t,
55 bus_size_t);
56 void (*_space_write_2)(bus_space_tag_t , bus_space_handle_t,
57 bus_size_t, u_int16_t);
58 u_int32_t (*_space_read_4)(bus_space_tag_t , bus_space_handle_t,
59 bus_size_t);
60 void (*_space_write_4)(bus_space_tag_t , bus_space_handle_t,
61 bus_size_t, u_int32_t);
62 u_int64_t (*_space_read_8)(bus_space_tag_t , bus_space_handle_t,
63 bus_size_t);
64 void (*_space_write_8)(bus_space_tag_t , bus_space_handle_t,
65 bus_size_t, u_int64_t);
66 void (*_space_read_raw_2)(bus_space_tag_t, bus_space_handle_t,
67 bus_addr_t, u_int8_t *, bus_size_t);
68 void (*_space_write_raw_2)(bus_space_tag_t, bus_space_handle_t,
69 bus_addr_t, const u_int8_t *, bus_size_t);
70 void (*_space_read_raw_4)(bus_space_tag_t, bus_space_handle_t,
71 bus_addr_t, u_int8_t *, bus_size_t);
72 void (*_space_write_raw_4)(bus_space_tag_t, bus_space_handle_t,
73 bus_addr_t, const u_int8_t *, bus_size_t);
74 void (*_space_read_raw_8)(bus_space_tag_t, bus_space_handle_t,
75 bus_addr_t, u_int8_t *, bus_size_t);
76 void (*_space_write_raw_8)(bus_space_tag_t, bus_space_handle_t,
77 bus_addr_t, const u_int8_t *, bus_size_t);
78 int (*_space_map)(bus_space_tag_t , bus_addr_t,
79 bus_size_t, int, bus_space_handle_t *);
80 void (*_space_unmap)(bus_space_tag_t, bus_space_handle_t,
81 bus_size_t);
82 int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t,
83 bus_size_t, bus_size_t, bus_space_handle_t *);
84 void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t);
85 paddr_t (*_space_mmap)(bus_space_tag_t, bus_addr_t, off_t,
86 int, int);
87};
88
89#define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o))
90#define bus_space_read_2(t, h, o) (*(t)->_space_read_2)((t), (h), (o))
91#define bus_space_read_4(t, h, o) (*(t)->_space_read_4)((t), (h), (o))
92#define bus_space_read_8(t, h, o) (*(t)->_space_read_8)((t), (h), (o))
93
94#define bus_space_write_1(t, h, o, v) (*(t)->_space_write_1)((t), (h), (o), (v))
95#define bus_space_write_2(t, h, o, v) (*(t)->_space_write_2)((t), (h), (o), (v))
96#define bus_space_write_4(t, h, o, v) (*(t)->_space_write_4)((t), (h), (o), (v))
97#define bus_space_write_8(t, h, o, v) (*(t)->_space_write_8)((t), (h), (o), (v))
98
99#define bus_space_read_raw_multi_2(t, h, a, b, l) \
100 (*(t)->_space_read_raw_2)((t), (h), (a), (b), (l))
101#define bus_space_read_raw_multi_4(t, h, a, b, l) \
102 (*(t)->_space_read_raw_4)((t), (h), (a), (b), (l))
103#define bus_space_read_raw_multi_8(t, h, a, b, l) \
104 (*(t)->_space_read_raw_8)((t), (h), (a), (b), (l))
105
106#define bus_space_write_raw_multi_2(t, h, a, b, l) \
107 (*(t)->_space_write_raw_2)((t), (h), (a), (b), (l))
108#define bus_space_write_raw_multi_4(t, h, a, b, l) \
109 (*(t)->_space_write_raw_4)((t), (h), (a), (b), (l))
110#define bus_space_write_raw_multi_8(t, h, a, b, l) \
111 (*(t)->_space_write_raw_8)((t), (h), (a), (b), (l))
112
113#define bus_space_map(t, o, s, c, p) (*(t)->_space_map)((t), (o), (s), (c), (p))
114#define bus_space_unmap(t, h, s) (*(t)->_space_unmap)((t), (h), (s))
115#define bus_space_subregion(t, h, o, s, p) \
116 (*(t)->_space_subregion)((t), (h), (o), (s), (p))
117
118#define BUS_SPACE_MAP_CACHEABLE 0x01
119#define BUS_SPACE_MAP_LINEAR 0x02
120#define BUS_SPACE_MAP_PREFETCHABLE 0x04
121
122#define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h))
123#define bus_space_mmap(t, a, o, p, f) \
124 (*(t)->_space_mmap)((t), (a), (o), (p), (f))
125
126/*----------------------------------------------------------------------------*/
127#define bus_space_read_multi(n,m) \
128static __inline void \
129CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
130 bus_size_t o, CAT3(u_int,m,_t) *x, size_t cnt) \
131{ \
132 while (cnt--) \
133 *x++ = CAT(bus_space_read_,n)(bst, bsh, o); \
134}
135
136bus_space_read_multi(1,8)
137bus_space_read_multi(2,16)
138bus_space_read_multi(4,32)
139bus_space_read_multi(8,64)
140
141/*----------------------------------------------------------------------------*/
142#define bus_space_read_region(n,m) \
143static __inline void \
144CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
145 bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \
146{ \
147 while (cnt--) { \
148 *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \
149 ba += (n); \
150 } \
151}
152
153bus_space_read_region(1,8)
154bus_space_read_region(2,16)
155bus_space_read_region(4,32)
156bus_space_read_region(8,64)
157
158/*----------------------------------------------------------------------------*/
159#define bus_space_read_raw_region(n,m) \
160static __inline void \
161CAT(bus_space_read_raw_region_,n)(bus_space_tag_t bst, \
162 bus_space_handle_t bsh, \
163 bus_addr_t ba, u_int8_t *x, size_t cnt) \
164{ \
165 cnt >>= ((n) >> 1); \
166 while (cnt--) { \
167 CAT(bus_space_read_raw_multi_,n)(bst, bsh, ba, x, (n)); \
168 ba += (n); \
169 x += (n); \
170 } \
171}
172
173bus_space_read_raw_region(2,16)
174bus_space_read_raw_region(4,32)
175bus_space_read_raw_region(8,64)
176
177/*----------------------------------------------------------------------------*/
178#define bus_space_write_multi(n,m) \
179static __inline void \
180CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
181 bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \
182{ \
183 while (cnt--) \
184 CAT(bus_space_write_,n)(bst, bsh, o, *x++); \
185}
186
187bus_space_write_multi(1,8)
188bus_space_write_multi(2,16)
189bus_space_write_multi(4,32)
190bus_space_write_multi(8,64)
191
192/*----------------------------------------------------------------------------*/
193#define bus_space_write_region(n,m) \
194static __inline void \
195CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
196 bus_addr_t ba, const CAT3(u_int,m,_t) *x, size_t cnt) \
197{ \
198 while (cnt--) { \
199 CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \
200 ba += (n); \
201 } \
202}
203
204bus_space_write_region(1,8)
205bus_space_write_region(2,16)
206bus_space_write_region(4,32)
207bus_space_write_region(8,64)
208
209/*----------------------------------------------------------------------------*/
210#define bus_space_write_raw_region(n,m) \
211static __inline void \
212CAT(bus_space_write_raw_region_,n)(bus_space_tag_t bst, \
213 bus_space_handle_t bsh, \
214 bus_addr_t ba, const u_int8_t *x, size_t cnt) \
215{ \
216 cnt >>= ((n) >> 1); \
217 while (cnt--) { \
218 CAT(bus_space_write_raw_multi_,n)(bst, bsh, ba, x, (n)); \
219 ba += (n); \
220 x += (n); \
221 } \
222}
223
224bus_space_write_raw_region(2,16)
225bus_space_write_raw_region(4,32)
226bus_space_write_raw_region(8,64)
227
228/*----------------------------------------------------------------------------*/
229#define bus_space_set_region(n,m) \
230static __inline void \
231CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
232 bus_addr_t ba, CAT3(u_int,m,_t) x, size_t cnt) \
233{ \
234 while (cnt--) { \
235 CAT(bus_space_write_,n)(bst, bsh, ba, x); \
236 ba += (n); \
237 } \
238}
239
240bus_space_set_region(1,8)
241bus_space_set_region(2,16)
242bus_space_set_region(4,32)
243bus_space_set_region(8,64)
244
245/*----------------------------------------------------------------------------*/
246static __inline void
247bus_space_copy_1(void *v, bus_space_handle_t h1, bus_size_t o1,
248 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
249{
250 char *s = (char *)(h1 + o1);
251 char *d = (char *)(h2 + o2);
252
253 while (c--)
254 *d++ = *s++;
255}
256
257
258static __inline void
259bus_space_copy_2(void *v, bus_space_handle_t h1, bus_size_t o1,
260 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
261{
262 short *s = (short *)(h1 + o1);
263 short *d = (short *)(h2 + o2);
264
265 while (c--)
266 *d++ = *s++;
267}
268
269static __inline void
270bus_space_copy_4(void *v, bus_space_handle_t h1, bus_size_t o1,
271 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
272{
273 int *s = (int *)(h1 + o1);
274 int *d = (int *)(h2 + o2);
275
276 while (c--)
277 *d++ = *s++;
278}
279
280static __inline void
281bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1,
282 bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
283{
284 int64_t *s = (int64_t *)(h1 + o1);
285 int64_t *d = (int64_t *)(h2 + o2);
286
287 while (c--)
288 *d++ = *s++;
289}
290
291int generic_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
292 bus_space_handle_t *);
293void generic_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
294int generic_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t,
295 bus_size_t, bus_space_handle_t *);
296void *generic_space_vaddr(bus_space_tag_t, bus_space_handle_t);
297uint8_t generic_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t);
298uint16_t generic_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t);
299uint32_t generic_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
300uint64_t generic_space_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
301void generic_space_read_raw_2(bus_space_tag_t, bus_space_handle_t,
302 bus_addr_t, uint8_t *, bus_size_t);
303void generic_space_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
304 uint8_t);
305void generic_space_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
306 uint16_t);
307void generic_space_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
308 uint32_t);
309void generic_space_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
310 uint64_t);
311void generic_space_write_raw_2(bus_space_tag_t, bus_space_handle_t,
312 bus_addr_t, const uint8_t *, bus_size_t);
313void generic_space_read_raw_4(bus_space_tag_t, bus_space_handle_t,
314 bus_addr_t, uint8_t *, bus_size_t);
315void generic_space_write_raw_4(bus_space_tag_t, bus_space_handle_t,
316 bus_addr_t, const uint8_t *, bus_size_t);
317void generic_space_read_raw_8(bus_space_tag_t, bus_space_handle_t,
318 bus_addr_t, uint8_t *, bus_size_t);
319void generic_space_write_raw_8(bus_space_tag_t, bus_space_handle_t,
320 bus_addr_t, const uint8_t *, bus_size_t);
321paddr_t generic_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
322
323/*----------------------------------------------------------------------------*/
324/*
325 * Bus read/write barrier methods.
326 *
327 * void bus_space_barrier(bus_space_tag_t tag,
328 * bus_space_handle_t bsh, bus_size_t offset,
329 * bus_size_t len, int flags);
330 *
331 */
332static inline void
333bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
334 bus_size_t length, int flags)
335{
336 __asm__ volatile ("sync" ::: "memory");
337}
338#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
339#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
340
341#define BUS_DMA_WAITOK 0x0000
342#define BUS_DMA_NOWAIT 0x0001
343#define BUS_DMA_ALLOCNOW 0x0002
344#define BUS_DMA_COHERENT 0x0008
345#define BUS_DMA_BUS1 0x0010 /* placeholders for bus functions... */
346#define BUS_DMA_BUS2 0x0020
347#define BUS_DMA_BUS3 0x0040
348#define BUS_DMA_BUS4 0x0080
349#define BUS_DMA_READ 0x0100 /* mapping is device -> memory only */
350#define BUS_DMA_WRITE 0x0200 /* mapping is memory -> device only */
351#define BUS_DMA_STREAMING 0x0400 /* hint: sequential, unidirectional */
352#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */
353#define BUS_DMA_NOCACHE 0x1000
354#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */
355
356/* Forwards needed by prototypes below. */
357struct mbuf;
358struct proc;
359struct uio;
360
361#define BUS_DMASYNC_POSTREAD 0x0001
362#define BUS_DMASYNC_POSTWRITE 0x0002
363#define BUS_DMASYNC_PREREAD 0x0004
364#define BUS_DMASYNC_PREWRITE 0x0008
365
366typedef struct machine_bus_dma_tag *bus_dma_tag_t;
367typedef struct machine_bus_dmamap *bus_dmamap_t;
368
369/*
370 * bus_dma_segment_t
371 *
372 * Describes a single contiguous DMA transaction. Values
373 * are suitable for programming into DMA registers.
374 */
375struct machine_bus_dma_segment {
376 bus_addr_t ds_addr; /* DMA address */
377 bus_size_t ds_len; /* length of transfer */
378
379 paddr_t _ds_paddr; /* CPU address */
380 vaddr_t _ds_vaddr; /* CPU address */
381};
382typedef struct machine_bus_dma_segment bus_dma_segment_t;
383
384/*
385 * bus_dma_tag_t
386 *
387 * A machine-dependent opaque type describing the implementation of
388 * DMA for a given bus.
389 */
390
391struct machine_bus_dma_tag {
392 void *_cookie; /* cookie used in the guts */
393
394 /*
395 * DMA mapping methods.
396 */
397 int (*_dmamap_create)(bus_dma_tag_t , bus_size_t, int,
398 bus_size_t, bus_size_t, int, bus_dmamap_t *);
399 void (*_dmamap_destroy)(bus_dma_tag_t , bus_dmamap_t);
400 int (*_dmamap_load)(bus_dma_tag_t , bus_dmamap_t, void *,
401 bus_size_t, struct proc *, int);
402 int (*_dmamap_load_mbuf)(bus_dma_tag_t , bus_dmamap_t,
403 struct mbuf *, int);
404 int (*_dmamap_load_uio)(bus_dma_tag_t , bus_dmamap_t,
405 struct uio *, int);
406 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
407 bus_dma_segment_t *, int, bus_size_t, int);
408 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
409 bus_size_t, struct proc *, int, paddr_t *, int *, int);
410 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
411 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
412 bus_addr_t, bus_size_t, int);
413
414 /*
415 * DMA memory utility functions.
416 */
417 int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
418 bus_size_t, bus_dma_segment_t *, int, int *, int);
419 void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int);
420 int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
421 int, size_t, caddr_t *, int);
422 void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
423 paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
424 int, off_t, int, int);
425
426 /*
427 * internal memory address translation information.
428 */
429 bus_addr_t (*_pa_to_device)(paddr_t);
430 paddr_t (*_device_to_pa)(bus_addr_t);
431 bus_addr_t _dma_mask;
432};
433
434#define bus_dmamap_create(t, s, n, m, b, f, p) \
435 (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
436#define bus_dmamap_destroy(t, p) \
437 (*(t)->_dmamap_destroy)((t), (p))
438#define bus_dmamap_load(t, m, b, s, p, f) \
439 (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
440#define bus_dmamap_load_mbuf(t, m, b, f) \
441 (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
442#define bus_dmamap_load_uio(t, m, u, f) \
443 (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
444#define bus_dmamap_load_raw(t, m, sg, n, s, f) \
445 (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
446#define bus_dmamap_unload(t, p) \
447 (*(t)->_dmamap_unload)((t), (p))
448#define bus_dmamap_sync(t, p, a, l, o) \
449 (void)((t)->_dmamap_sync ? \
450 (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0)
451
452#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
453 (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
454#define bus_dmamem_free(t, sg, n) \
455 (*(t)->_dmamem_free)((t), (sg), (n))
456#define bus_dmamem_map(t, sg, n, s, k, f) \
457 (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
458#define bus_dmamem_unmap(t, k, s) \
459 (*(t)->_dmamem_unmap)((t), (k), (s))
460#define bus_dmamem_mmap(t, sg, n, o, p, f) \
461 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
462
463int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
464 bus_size_t, bus_size_t, int, bus_dmamap_t *);
465void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
466int _dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
467 bus_size_t, struct proc *, int);
468int _dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int);
469int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
470int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
471 bus_dma_segment_t *, int, bus_size_t, int);
472int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
473 bus_size_t, struct proc *, int, paddr_t *, int *, int);
474void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
475void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
476 bus_size_t, int);
477
478int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
479 bus_size_t, bus_dma_segment_t *, int, int *, int);
480void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int);
481int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *,
482 int, size_t, caddr_t *, int);
483void _dmamem_unmap(bus_dma_tag_t, caddr_t, size_t);
484paddr_t _dmamem_mmap(bus_dma_tag_t, bus_dma_segment_t *, int, off_t, int, int);
485int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
486 bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t);
487
488/*
489 * bus_dmamap_t
490 *
491 * Describes a DMA mapping.
492 */
493struct machine_bus_dmamap {
494 /*
495 * PRIVATE MEMBERS: not for use by machine-independent code.
496 */
497 bus_size_t _dm_size; /* largest DMA transfer mappable */
498 int _dm_segcnt; /* number of segs this map can map */
499 bus_size_t _dm_maxsegsz; /* largest possible segment */
500 bus_size_t _dm_boundary; /* don't cross this */
501 int _dm_flags; /* misc. flags */
502
503 void *_dm_cookie; /* cookie for bus-specific functions */
504
505 /*
506 * PUBLIC MEMBERS: these are used by machine-independent code.
507 */
508 bus_size_t dm_mapsize; /* size of the mapping */
509 int dm_nsegs; /* # valid segments in mapping */
510 bus_dma_segment_t dm_segs[1]; /* segments; variable length */
511};
512
513#endif /* _MACHINE_BUS_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/conf.h deleted-42
...@@ -1,42 +0,0 @@
1/* $OpenBSD: conf.h,v 1.4 2022/06/28 14:43:50 visa Exp $ */
2/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */
3
4/*
5 * Copyright (c) 1996 Christos Zoulas. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Christos Zoulas.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/conf.h>
34
35/* open, close, write, ioctl, kqueue */
36#define cdev_apm_init(c,n) { \
37 dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
38 (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
39 (dev_type_stop((*))) enodev, 0, \
40 (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,n,kqfilter) }
41
42cdev_decl(apm);
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/cpu.h deleted-103
...@@ -1,103 +0,0 @@
1/* $OpenBSD: cpu.h,v 1.8 2017/07/30 16:05:24 visa Exp $ */
2/*-
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Ralph Campbell and Rick Macklem.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * Copyright (C) 1989 Digital Equipment Corporation.
34 * Permission to use, copy, modify, and distribute this software and
35 * its documentation for any purpose and without fee is hereby granted,
36 * provided that the above copyright notice appears in all copies.
37 * Digital Equipment Corporation makes no representations about the
38 * suitability of this software for any purpose. It is provided "as is"
39 * without express or implied warranty.
40 *
41 * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
42 */
43
44#ifdef _KERNEL
45
46#if defined(MULTIPROCESSOR) && !defined(_LOCORE)
47#define MAXCPUS 4
48struct cpu_info;
49struct cpu_info *hw_getcurcpu(void);
50void hw_setcurcpu(struct cpu_info *);
51void hw_cpu_boot_secondary(struct cpu_info *);
52void hw_cpu_hatch(struct cpu_info *);
53void hw_cpu_spinup_trampoline(struct cpu_info *);
54int hw_ipi_intr_establish(int (*)(void *), u_long);
55void hw_ipi_intr_set(u_long);
56void hw_ipi_intr_clear(u_long);
57#endif /* MULTIPROCESSOR && !_LOCORE */
58
59#if defined(CPU_LOONGSON2) && !defined(CPU_LOONGSON3)
60#define Mips_SyncCache(ci) \
61 Loongson2_SyncCache((ci))
62#define Mips_InvalidateICache(ci, va, l) \
63 Loongson2_InvalidateICache((ci), (va), (l))
64#define Mips_InvalidateICachePage(ci, va) \
65 Loongson2_InvalidateICachePage((ci), (va))
66#define Mips_SyncICache(ci) \
67 Loongson2_SyncICache((ci))
68#define Mips_SyncDCachePage(ci, va, pa) \
69 Loongson2_SyncDCachePage((ci), (va), (pa))
70#define Mips_HitSyncDCachePage(ci, va, pa) \
71 Loongson2_SyncDCachePage((ci), (va), (pa))
72#define Mips_HitSyncDCache(ci, va, l) \
73 Loongson2_HitSyncDCache((ci), (va), (l))
74#define Mips_IOSyncDCache(ci, va, l, h) \
75 Loongson2_IOSyncDCache((ci), (va), (l), (h))
76#define Mips_HitInvalidateDCache(ci, va, l) \
77 Loongson2_HitInvalidateDCache((ci), (va), (l))
78#endif
79
80#if defined(CPU_LOONGSON3) && !defined(CPU_LOONGSON2)
81#define Mips_SyncCache(ci) \
82 Loongson3_SyncCache((ci))
83#define Mips_InvalidateICache(ci, va, l) \
84 Loongson3_InvalidateICache((ci), (va), (l))
85#define Mips_InvalidateICachePage(ci, va) \
86 Loongson3_InvalidateICachePage((ci), (va))
87#define Mips_SyncICache(ci) \
88 Loongson3_SyncICache((ci))
89#define Mips_SyncDCachePage(ci, va, pa) \
90 Loongson3_SyncDCachePage((ci), (va), (pa))
91#define Mips_HitSyncDCachePage(ci, va, pa) \
92 Loongson3_SyncDCachePage((ci), (va), (pa))
93#define Mips_HitSyncDCache(ci, va, l) \
94 Loongson3_HitSyncDCache((ci), (va), (l))
95#define Mips_IOSyncDCache(ci, va, l, h) \
96 Loongson3_IOSyncDCache((ci), (va), (l), (h))
97#define Mips_HitInvalidateDCache(ci, va, l) \
98 Loongson3_HitInvalidateDCache((ci), (va), (l))
99#endif
100
101#endif /* _KERNEL */
102
103#include <mips64/cpu.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/cpustate.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: cpustate.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/cpustate.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/db_machdep.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: db_machdep.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/db_machdep.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/elf.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: elf.h,v 1.1 2024/07/14 19:33:59 miod Exp $ */
2
3#include <mips64/elf.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/endian.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: endian.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/endian.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/exec.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: exec.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/exec.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/fpu.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: fpu.h,v 1.1 2010/09/17 00:34:04 miod Exp $ */
2/* public domain */
3#include <mips64/fpu.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/frame.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/frame.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/ieee.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ieee.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/ieee.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/ieeefp.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ieeefp.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/ieeefp.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/intr.h deleted-193
...@@ -1,193 +0,0 @@
1/* $OpenBSD: intr.h,v 1.19 2025/05/10 10:01:03 visa Exp $ */
2
3/*
4 * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#ifndef _MACHINE_INTR_H_
30#define _MACHINE_INTR_H_
31
32#define __USE_MI_SOFTINTR
33
34#include <sys/softintr.h>
35
36/*
37 * The interrupt level ipl is a logical level; per-platform interrupt
38 * code will turn it into the appropriate hardware interrupt masks
39 * values.
40 *
41 * Interrupt sources on the CPU are kept enabled regardless of the
42 * current ipl value; individual hardware sources interrupting while
43 * logically masked are masked on the fly, remembered as pending, and
44 * unmasked at the first splx() opportunity.
45 *
46 * An exception to this rule is the clock interrupt. Clock interrupts
47 * are always allowed to happen, but will (of course!) not be serviced
48 * if logically masked. The reason for this is that clocks usually sit on
49 * INT5 and cannot be easily masked if external hardware masking is used.
50 */
51
52/* Interrupt priority `levels'; not mutually exclusive. */
53#define IPL_NONE 0 /* nothing */
54#define IPL_SOFTINT 1 /* soft interrupts */
55#define IPL_SOFTCLOCK 1 /* soft clock interrupts */
56#define IPL_SOFTNET 2 /* soft network interrupts */
57#define IPL_SOFTTTY 3 /* soft terminal interrupts */
58#define IPL_SOFTHIGH IPL_SOFTTTY /* highest level of soft interrupts */
59#define IPL_BIO 4 /* block I/O */
60#define IPL_AUDIO IPL_BIO
61#define IPL_NET 5 /* network */
62#define IPL_TTY 6 /* terminal */
63#define IPL_VM 7 /* memory allocation */
64#define IPL_CLOCK 8 /* clock */
65#define IPL_STATCLOCK IPL_CLOCK
66#define IPL_SCHED 9 /* everything */
67#define IPL_HIGH 9 /* everything */
68#define IPL_IPI 10 /* interprocessor interrupt */
69#define NIPLS 11 /* number of levels */
70
71#define IPL_MPFLOOR IPL_TTY
72
73/* Interrupt priority 'flags'. */
74#define IPL_MPSAFE 0x100
75
76/* Interrupt sharing types. */
77#define IST_NONE 0 /* none */
78#define IST_PULSE 1 /* pulsed */
79#define IST_EDGE 2 /* edge-triggered */
80#define IST_LEVEL 3 /* level-triggered */
81
82#ifndef _LOCORE
83
84void softintr(int);
85
86#define splbio() splraise(IPL_BIO)
87#define splnet() splraise(IPL_NET)
88#define spltty() splraise(IPL_TTY)
89#define splaudio() splraise(IPL_AUDIO)
90#define splclock() splraise(IPL_CLOCK)
91#define splvm() splraise(IPL_VM)
92#define splhigh() splraise(IPL_HIGH)
93
94#define splsoftclock() splraise(IPL_SOFTCLOCK)
95#define splsoftnet() splraise(IPL_SOFTNET)
96#define splstatclock() splhigh()
97
98#define splsched() splhigh()
99#define spl0() spllower(0)
100
101void splinit(void);
102
103#ifdef DIAGNOSTIC
104/*
105 * Although this function is implemented in MI code, it must be in this MD
106 * header because we don't want this header to include MI includes.
107 */
108void splassert_fail(int, int, const char *);
109extern int splassert_ctl;
110void splassert_check(int, const char *);
111#define splassert(__wantipl) do { \
112 if (splassert_ctl > 0) { \
113 splassert_check(__wantipl, __func__); \
114 } \
115} while (0)
116#define splsoftassert(wantipl) splassert(wantipl)
117#else
118#define splassert(X)
119#define splsoftassert(X)
120#endif
121
122void register_splx_handler(void (*)(int));
123int splraise(int);
124void splx(int);
125int spllower(int);
126
127/*
128 * Interrupt control struct used by interrupt dispatchers
129 * to hold interrupt handler info.
130 */
131
132#include <sys/evcount.h>
133
134struct intrhand {
135 struct intrhand *ih_next;
136 int (*ih_fun)(void *);
137 void *ih_arg;
138 int ih_level;
139 int ih_irq;
140 int ih_flags;
141#define IH_MPSAFE 0x01
142 struct evcount ih_count;
143};
144
145void intr_barrier(void *);
146
147/*
148 * Low level interrupt dispatcher registration data.
149 */
150
151/* Schedule priorities for base interrupts (CPU) */
152#define INTPRI_IPI 0
153#define INTPRI_CLOCK 1
154/* other values are system-specific */
155
156#define NLOWINT 4 /* Number of low level registrations possible */
157
158extern uint32_t idle_mask;
159
160struct trapframe;
161void set_intr(int, uint32_t, uint32_t(*)(uint32_t, struct trapframe *));
162
163uint32_t updateimask(uint32_t);
164void dosoftint(void);
165
166#ifdef MULTIPROCESSOR
167extern uint32_t ipi_mask;
168#define ENABLEIPI() updateimask(~ipi_mask)
169#endif
170
171struct pic {
172 void (*pic_eoi)(int);
173 void (*pic_mask)(int);
174 void (*pic_unmask)(int);
175};
176
177#ifdef CPU_LOONGSON3
178
179void loongson3_intr_init(void);
180void *loongson3_intr_establish(int, int, int (*)(void *), void*,
181 const char *);
182void loongson3_intr_disestablish(void *);
183void *loongson3_ht_intr_establish(int, int, int (*)(void *), void*,
184 const char *);
185void loongson3_ht_intr_disestablish(void *);
186
187void loongson3_register_ht_pic(const struct pic *);
188
189#endif /* CPU_LOONGSON3 */
190
191#endif /* _LOCORE */
192
193#endif /* _MACHINE_INTR_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/isa_machdep.h deleted-51
...@@ -1,51 +0,0 @@
1/* $OpenBSD: isa_machdep.h,v 1.2 2010/05/08 21:59:56 miod Exp $ */
2
3/*
4 * Copyright (c) 2007 Miodrag Vallat.
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, this permission notice, and the disclaimer below
9 * 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_ISA_MACHDEP_H_
21#define _MACHINE_ISA_MACHDEP_H_
22
23#include <machine/bus.h>
24
25#define __NO_ISA_INTR_CHECK
26
27typedef struct mips_isa_chipset *isa_chipset_tag_t;
28
29struct mips_isa_chipset {
30 void *ic_v;
31
32 void (*ic_attach_hook)(struct device *, struct device *,
33 struct isabus_attach_args *);
34 void *(*ic_intr_establish)(void *, int, int, int, int (*)(void *),
35 void *, char *);
36 void (*ic_intr_disestablish)(void *, void *);
37};
38
39#define isa_attach_hook(p, s, iba) \
40 (*(iba)->iba_ic->ic_attach_hook)((p), (s), (iba))
41#define isa_intr_establish(c, i, t, l, f, a, n) \
42 (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (n))
43#define isa_intr_disestablish(c, h) \
44 (*(c)->ic_intr_disestablish)((c)->ic_v, (h))
45
46void loongson_generic_isa_attach_hook(struct device *, struct device *,
47 struct isabus_attach_args *);
48void loongson_isa_specific_eoi(int);
49void loongson_set_isa_imr(uint);
50
51#endif
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/kcore.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: kcore.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/kcore.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: limits.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/limits.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/loongson2.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: loongson2.h,v 1.1.1.1 2009/08/06 20:51:44 miod Exp $ */
2/* public domain */
3#include <mips64/loongson2.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/loongson3.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: loongson3.h,v 1.1 2016/11/06 10:20:33 visa Exp $ */
2/* public domain */
3#include <mips64/loongson3.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/memconf.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: memconf.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/memconf.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/mips_opcode.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mips_opcode.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/mips_opcode.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/mplock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mplock.h,v 1.1 2017/01/19 14:51:02 visa Exp $ */
2
3#include <mips64/mplock.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/mutex.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: mutex.h,v 1.2 2015/07/08 13:37:31 dlg Exp $ */
2
3#include <mips64/mutex.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/param.h deleted-27
...@@ -1,27 +0,0 @@
1/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */
2
3/* Public Domain */
4
5#ifndef _MACHINE_PARAM_H_
6#define _MACHINE_PARAM_H_
7
8#define MACHINE "loongson"
9#define _MACHINE loongson
10#define MACHINE_ARCH "mips64el" /* not the canonical endianness */
11#define _MACHINE_ARCH mips64el
12#define MACHINE_CPU "mips64"
13#define _MACHINE_CPU mips64
14#define MID_MACHINE MID_MIPS64
15
16/*
17 * The Loongson level 1 cache expects software to prevent virtual
18 * aliases. Unfortunately, since this cache is physically tagged,
19 * this would require all virtual address to have the same bits 14
20 * and 13 as their physical addresses, which is not something the
21 * kernel can guarantee unless the page size is at least 16KB.
22 */
23#define PAGE_SHIFT 14
24
25#include <mips64/param.h>
26
27#endif /* _MACHINE_PARAM_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/pcb.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pcb.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */
2/* public domain */
3#include <mips64/pcb.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/pci_machdep.h deleted-101
...@@ -1,101 +0,0 @@
1/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */
2
3/*
4 * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29typedef struct mips_pci_chipset *pci_chipset_tag_t;
30typedef u_long pcitag_t;
31typedef u_long pci_intr_handle_t;
32
33struct pci_attach_args;
34
35/*
36 * mips-specific PCI structure and type definitions.
37 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
38 */
39struct mips_pci_chipset {
40 void *pc_conf_v;
41 void (*pc_attach_hook)(struct device *,
42 struct device *, struct pcibus_attach_args *);
43 int (*pc_bus_maxdevs)(void *, int);
44 pcitag_t (*pc_make_tag)(void *, int, int, int);
45 void (*pc_decompose_tag)(void *, pcitag_t, int *,
46 int *, int *);
47 int (*pc_conf_size)(void *, pcitag_t);
48 pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
49 void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
50
51 void *pc_intr_v;
52 int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *);
53 const char *(*pc_intr_string)(void *, pci_intr_handle_t);
54 void *(*pc_intr_establish)(void *, pci_intr_handle_t,
55 int, int (*)(void *), void *, char *);
56 void (*pc_intr_disestablish)(void *, void *);
57};
58
59/*
60 * Functions provided to machine-independent PCI code.
61 */
62#define pci_attach_hook(p, s, pba) \
63 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
64#define pci_bus_maxdevs(c, b) \
65 (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
66#define pci_make_tag(c, b, d, f) \
67 (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
68#define pci_decompose_tag(c, t, bp, dp, fp) \
69 (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
70#define pci_conf_size(c, t) \
71 (*(c)->pc_conf_size)((c)->pc_conf_v, (t))
72#define pci_conf_read(c, t, r) \
73 (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
74#define pci_conf_write(c, t, r, v) \
75 (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
76#define pci_intr_map(c, ihp) \
77 (*(c)->pa_pc->pc_intr_map)((c), (ihp))
78#define pci_intr_map_msi(c, ihp) (-1)
79#define pci_intr_map_msix(c, vec, ihp) (-1)
80#define pci_intr_string(c, ih) \
81 (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
82#define pci_intr_establish(c, ih, l, h, a, nm) \
83 (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm))
84#define pci_intr_disestablish(c, iv) \
85 (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
86#define pci_probe_device_hook(c, a) (0)
87
88#define pci_min_powerstate(c, t) (PCI_PMCSR_STATE_D3)
89#define pci_set_powerstate_md(c, t, s, p)
90
91/* PCI view of CPU memory */
92extern paddr_t loongson_dma_base;
93
94/*
95 * Functions used during early system configuration.
96 */
97
98extern pcitag_t (*pci_make_tag_early)(int, int, int);
99extern pcireg_t (*pci_conf_read_early)(pcitag_t, int);
100
101#define pci_dev_postattach(a, b)
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/pmap.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pmap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/pmap.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/pmon.h deleted-209
...@@ -1,209 +0,0 @@
1/* $OpenBSD: pmon.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */
2
3/*
4 * Copyright (c) 2009, 2012 Miodrag Vallat.
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#ifndef _MACHINE_PMON_H_
20#define _MACHINE_PMON_H_
21
22#if defined(_KERNEL) || defined(_STANDALONE)
23
24/*
25 * PMON2000 callvec definitions
26 */
27
28/* 32-bit compatible types */
29typedef uint32_t pmon_size_t;
30typedef int32_t pmon_ssize_t;
31typedef int64_t pmon_off_t;
32
33int pmon_open(const char *, int, ...);
34int pmon_close(int);
35int pmon_read(int, void *, pmon_size_t);
36pmon_ssize_t pmon_write(int, const void *, pmon_size_t);
37pmon_off_t pmon_lseek(int, pmon_off_t, int);
38int pmon_printf(const char *, ...);
39void pmon_cacheflush(void);
40char * pmon_gets(char *);
41
42#define PMON_MAXLN 256 /* internal gets() size limit */
43
44extern int32_t pmon_callvec;
45
46const char *pmon_getarg(const int);
47void pmon_init(int32_t, int32_t, int32_t, int32_t, uint32_t);
48
49#define PMON_ENVTYPE_ENVP 0
50#define PMON_ENVTYPE_EFI 1
51int pmon_getenvtype(void);
52
53/*
54 * The new environment interface is a /salmigondis/ of badly thought-out
55 * structs put together, pretending to be inspired by EFI but conveniently
56 * omitting key EFI structs because they are deemed non-applicable to
57 * MIPS systems.
58 * Of course, some fields are absolute addresses, while others are relative
59 * pointers, to add to the confusion.
60 */
61
62struct pmon_env_reset {
63 void (*cold_boot)(void); /* not filled */
64 void (*warm_boot)(void);
65 void (*boot)(unsigned int); /* not filled */
66 void (*poweroff)(void);
67};
68
69/* all values are offsets relative to the beginning of the struct */
70struct pmon_env_ptr {
71 uint64_t offs_mem;
72 uint64_t offs_cpu;
73 uint64_t offs_sys;
74 uint64_t offs_irq;
75 uint64_t offs_iface;
76 uint64_t offs_special;
77 uint64_t offs_device;
78};
79
80struct pmon_env_smbios {
81 uint16_t version;
82 uint64_t vga_bios;
83 struct pmon_env_ptr ptrs;
84};
85
86struct pmon_env_efi {
87 uint64_t mps; /* not filled */
88 uint64_t acpi; /* not filled */
89 uint64_t acpi20; /* not filled */
90 struct pmon_env_smbios bios;
91 uint64_t sal_systab; /* not filled */
92 uint64_t bootinfo; /* not filled */
93};
94
95struct pmon_env {
96 struct pmon_env_efi efi;
97 struct pmon_env_reset reset;
98};
99
100#define PMON_MEM_MAX 128
101struct pmon_env_mem_entry {
102 uint32_t node;
103 uint32_t type;
104#define PMON_MEM_SYSTEM_LOW 1 /* physical memory <= 256 MB */
105#define PMON_MEM_SYSTEM_HIGH 2 /* physical memory > 256 MB */
106#define PMON_MEM_RESERVED 3
107#define PMON_MEM_PCI_IO 4
108#define PMON_MEM_PCI_MEM 5
109#define PMON_MEM_CPU_REGISTERS 6
110#define PMON_MEM_VIDEO_ROM 7
111#define PMON_MEM_OTHER_ROM 8
112#define PMON_MEM_ACPI_TABLE 9
113 uint64_t address;
114 uint32_t size;
115};
116struct pmon_env_mem {
117 uint16_t version; /* not filled */
118 uint32_t nentries;
119 uint32_t mem_freq;
120 struct pmon_env_mem_entry mem_map[PMON_MEM_MAX];
121} __packed;
122
123struct pmon_env_cpu {
124 uint16_t version; /* not filled */
125 uint32_t prid; /* cop0 PrID */
126 uint32_t cputype;
127/* 0 and 1 are supposedly intended for 2E and 2F, which do NOT provide this
128 interface; moreover Linux and PMON disagree on the values and have 2E and
129 2F swapped. */
130#define PMON_CPUTYPE_LS3A 2
131#define PMON_CPUTYPE_LS3B 3
132#define PMON_CPUTYPE_LS1A 4
133#define PMON_CPUTYPE_LS1B 5
134 uint32_t node; /* total number of NUMA nodes */
135 uint16_t coreid; /* boot CPU core id */
136 uint16_t reserved_cores; /* mask of reserved cores */
137 uint32_t speed;
138 uint32_t ncpus;
139} __packed;
140
141struct pmon_env_sys {
142 uint16_t version; /* not filled */
143 uint32_t ccnuma_smp;
144 uint32_t double_channel;
145} __packed;
146
147struct pmon_env_irq {
148 uint16_t version; /* not filled */
149 uint16_t size; /* not filled */
150 uint16_t rtr_bus; /* not filled */
151 uint16_t rtr_devfn; /* not filled */
152 uint32_t vendor; /* not filled */
153 uint32_t device; /* not filled */
154 uint32_t pic_type;
155#define PMON_IRQ_PIC_HT 0
156#define PMON_IRQ_PIC_I8259 1
157 uint64_t ht_interrupt_bit;
158 uint64_t ht_enable;
159 uint32_t node;
160 uint64_t pci_memory_space_start;
161 uint64_t pci_memory_space_end;
162 uint64_t pci_io_space_start; /* not filled */
163 uint64_t pci_io_space_end; /* not filled */
164 uint64_t pci_cfg_space; /* not filled */
165} __packed;
166
167struct pmon_env_iface {
168 uint16_t version;
169#define PMON_IFACE_VERSION 0x0001
170 uint16_t size;
171 uint8_t flag;
172 char description[64]; /* firmware version */
173} __packed;
174
175#define PMON_RESOURCE_MAX 128
176struct pmon_env_resource {
177 uint64_t start;
178 uint64_t end;
179 char name[64];
180 uint32_t flags;
181};
182struct pmon_env_special {
183 uint16_t version;
184 char name[64];
185 uint32_t type;
186 struct pmon_env_resource resource[PMON_RESOURCE_MAX];
187};
188
189struct pmon_env_device {
190 char name[64]; /* system description */
191 uint32_t nentries;
192 struct pmon_env_resource resource[PMON_RESOURCE_MAX];
193};
194
195const char *pmon_getenv(const char *);
196
197const struct pmon_env_reset *pmon_get_env_reset(void);
198const struct pmon_env_smbios *pmon_get_env_smbios(void);
199const struct pmon_env_mem *pmon_get_env_mem(void);
200const struct pmon_env_cpu *pmon_get_env_cpu(void);
201const struct pmon_env_sys *pmon_get_env_sys(void);
202const struct pmon_env_irq *pmon_get_env_irq(void);
203const struct pmon_env_iface *pmon_get_env_iface(void);
204const struct pmon_env_special *pmon_get_env_special(void);
205const struct pmon_env_device *pmon_get_env_device(void);
206
207#endif /* _KERNEL || _STANDALONE */
208
209#endif /* _MACHINE_PMON_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/proc.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: proc.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/proc.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/profile.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: profile.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/profile.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/pte.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: pte.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/pte.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/ptrace.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: ptrace.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/ptrace.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/reg.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: reg.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/reg.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/regdef.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: regdef.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/regdef.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/regnum.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: regnum.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/regnum.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/setjmp.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: setjmp.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/setjmp.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/signal.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: signal.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/signal.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/spinlock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: spinlock.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/spinlock.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/sysarch.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: sysarch.h,v 1.1.1.1 2009/11/22 18:12:44 miod Exp $ */
2/* public domain */
3#include <mips64/sysarch.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/timetc.h deleted-23
...@@ -1,23 +0,0 @@
1/* $OpenBSD: timetc.h,v 1.2 2020/07/18 08:37:43 visa Exp $ */
2/*
3 * Copyright (c) 2020 Paul Irofti <paul@irofti.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _MACHINE_TIMETC_H_
19#define _MACHINE_TIMETC_H_
20
21#include <mips64/timetc.h>
22
23#endif /* _MACHINE_TIMETC_H_ */
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/trap.h deleted-3
...@@ -1,3 +0,0 @@
1/* $OpenBSD: trap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */
2/* public domain */
3#include <mips64/trap.h>
\ No newline at end of file
lib/libc/include/mips64el-openbsd-none/machine/vmparam.h deleted-11
...@@ -1,11 +0,0 @@
1/* $OpenBSD: vmparam.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */
2/* public domain */
3#ifndef _MACHINE_VMPARAM_H_
4#define _MACHINE_VMPARAM_H_
5
6#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */
7#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
8
9#include <mips64/vmparam.h>
10
11#endif /* _MACHINE_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/powerpc-openbsd-eabihf/powerpc/_types.h+1-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,12 +122,7 @@ typedef float __float_t;...@@ -122,12 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128struct __va_list_tag;
129typedef struct __va_list_tag * __va_list;
130#endif
131126
132/* Wide character support types */127/* Wide character support types */
133#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/powerpc-openbsd-eabihf/powerpc/elf.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */1/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */
22
3/*3/*
4 * This file is in the public domain.4 * This file is in the public domain.
...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;
54#define PPC_FEATURE2_ISEL 0x0800000054#define PPC_FEATURE2_ISEL 0x08000000
55#define PPC_FEATURE2_TAR 0x0400000055#define PPC_FEATURE2_TAR 0x04000000
56#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x0200000056#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_HTM_NOSC 0x0100000058#define PPC_FEATURE2_HTM_NOSC 0x01000000
58#define PPC_FEATURE2_ARCH_3_00 0x0080000059#define PPC_FEATURE2_ARCH_3_00 0x00800000
59#define PPC_FEATURE2_HAS_IEEE128 0x0040000060#define PPC_FEATURE2_HAS_IEEE128 0x00400000
lib/libc/include/powerpc64-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.4 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.5 2026/08/31 10:58:08 tb Exp $ */
2/*-2/*-
3 * Copyright (c) 1990, 19933 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.4 * The Regents of the University of California. All rights reserved.
...@@ -123,11 +123,7 @@ typedef float __float_t;...@@ -123,11 +123,7 @@ typedef float __float_t;
123typedef long __ptrdiff_t;123typedef long __ptrdiff_t;
124typedef unsigned long __size_t;124typedef unsigned long __size_t;
125typedef long __ssize_t;125typedef long __ssize_t;
126#if defined(__GNUC__) && __GNUC__ >= 3
127typedef __builtin_va_list __va_list;126typedef __builtin_va_list __va_list;
128#else
129typedef char * __va_list;
130#endif
131127
132/* Wide character support types */128/* Wide character support types */
133#ifndef __cplusplus129#ifndef __cplusplus
lib/libc/include/powerpc64-openbsd-none/machine/elf.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */1/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */
22
3/*3/*
4 * This file is in the public domain.4 * This file is in the public domain.
...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;
54#define PPC_FEATURE2_ISEL 0x0800000054#define PPC_FEATURE2_ISEL 0x08000000
55#define PPC_FEATURE2_TAR 0x0400000055#define PPC_FEATURE2_TAR 0x04000000
56#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x0200000056#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_HTM_NOSC 0x0100000058#define PPC_FEATURE2_HTM_NOSC 0x01000000
58#define PPC_FEATURE2_ARCH_3_00 0x0080000059#define PPC_FEATURE2_ARCH_3_00 0x00800000
59#define PPC_FEATURE2_HAS_IEEE128 0x0040000060#define PPC_FEATURE2_HAS_IEEE128 0x00400000
lib/libc/include/powerpc64-openbsd-none/powerpc64/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.4 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.5 2026/08/31 10:58:08 tb Exp $ */
2/*-2/*-
3 * Copyright (c) 1990, 19933 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.4 * The Regents of the University of California. All rights reserved.
...@@ -123,11 +123,7 @@ typedef float __float_t;...@@ -123,11 +123,7 @@ typedef float __float_t;
123typedef long __ptrdiff_t;123typedef long __ptrdiff_t;
124typedef unsigned long __size_t;124typedef unsigned long __size_t;
125typedef long __ssize_t;125typedef long __ssize_t;
126#if defined(__GNUC__) && __GNUC__ >= 3
127typedef __builtin_va_list __va_list;126typedef __builtin_va_list __va_list;
128#else
129typedef char * __va_list;
130#endif
131127
132/* Wide character support types */128/* Wide character support types */
133#ifndef __cplusplus129#ifndef __cplusplus
lib/libc/include/powerpc64-openbsd-none/powerpc64/elf.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */1/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */
22
3/*3/*
4 * This file is in the public domain.4 * This file is in the public domain.
...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;...@@ -54,6 +54,7 @@ extern unsigned long hwcap2;
54#define PPC_FEATURE2_ISEL 0x0800000054#define PPC_FEATURE2_ISEL 0x08000000
55#define PPC_FEATURE2_TAR 0x0400000055#define PPC_FEATURE2_TAR 0x04000000
56#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x0200000056#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
57#define PPC_FEATURE2_HTM_NOSC 0x0100000058#define PPC_FEATURE2_HTM_NOSC 0x01000000
58#define PPC_FEATURE2_ARCH_3_00 0x0080000059#define PPC_FEATURE2_ARCH_3_00 0x00800000
59#define PPC_FEATURE2_HAS_IEEE128 0x0040000060#define PPC_FEATURE2_HAS_IEEE128 0x00400000
lib/libc/include/riscv64-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.5 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.6 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -124,11 +124,7 @@ typedef float __float_t;...@@ -124,11 +124,7 @@ typedef float __float_t;
124typedef long __ptrdiff_t;124typedef long __ptrdiff_t;
125typedef unsigned long __size_t;125typedef unsigned long __size_t;
126typedef long __ssize_t;126typedef long __ssize_t;
127#if defined(__GNUC__) && __GNUC__ >= 3
128typedef __builtin_va_list __va_list;127typedef __builtin_va_list __va_list;
129#else
130typedef char * __va_list;
131#endif
132128
133/* Wide character support types */129/* Wide character support types */
134#ifndef __cplusplus130#ifndef __cplusplus
lib/libc/include/riscv64-openbsd-none/machine/bus.h+17-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.8 2025/08/03 14:03:12 jca Exp $ */1/* $OpenBSD: bus.h,v 1.10 2026/06/22 21:12:12 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
...@@ -371,6 +371,7 @@ struct machine_bus_dma_segment {...@@ -371,6 +371,7 @@ struct machine_bus_dma_segment {
371371
372 paddr_t _ds_paddr; /* CPU address */372 paddr_t _ds_paddr; /* CPU address */
373 vaddr_t _ds_vaddr; /* CPU address */373 vaddr_t _ds_vaddr; /* CPU address */
374 vaddr_t _ds_bounce_va; /* mapped bounced data */
374 int _ds_coherent; /* Coherently mapped */375 int _ds_coherent; /* Coherently mapped */
375};376};
376typedef struct machine_bus_dma_segment bus_dma_segment_t;377typedef struct machine_bus_dma_segment bus_dma_segment_t;
...@@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;...@@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;
385struct machine_bus_dma_tag {386struct machine_bus_dma_tag {
386 void *_cookie; /* cookie used in the guts */387 void *_cookie; /* cookie used in the guts */
387 int _flags; /* misc. flags */388 int _flags; /* misc. flags */
389 paddr_t _low; /* lowest DMA-reachable address */
390 paddr_t _high; /* highest DMA-reachable address */
388391
389 /*392 /*
390 * DMA mapping methods.393 * DMA mapping methods.
...@@ -401,7 +404,8 @@ struct machine_bus_dma_tag {...@@ -401,7 +404,8 @@ struct machine_bus_dma_tag {
401 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,404 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
402 bus_dma_segment_t *, int, bus_size_t, int);405 bus_dma_segment_t *, int, bus_size_t, int);
403 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,406 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
404 bus_size_t, struct proc *, int, paddr_t *, int *, int);407 bus_size_t, struct proc *, int, paddr_t *, int *,
408 int *, int *, int);
405 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);409 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
406 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,410 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
407 bus_addr_t, bus_size_t, int);411 bus_addr_t, bus_size_t, int);
...@@ -459,6 +463,8 @@ struct machine_bus_dma_tag {...@@ -459,6 +463,8 @@ struct machine_bus_dma_tag {
459#define bus_dmamem_mmap(t, sg, n, o, p, f) \463#define bus_dmamem_mmap(t, sg, n, o, p, f) \
460 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))464 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
461465
466void bus_dma_init(void);
467
462int _dmamap_create(bus_dma_tag_t, bus_size_t, int,468int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
463 bus_size_t, bus_size_t, int, bus_dmamap_t *);469 bus_size_t, bus_size_t, int, bus_dmamap_t *);
464void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);470void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
...@@ -469,7 +475,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);...@@ -469,7 +475,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
469int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,475int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
470 bus_dma_segment_t *, int, bus_size_t, int);476 bus_dma_segment_t *, int, bus_size_t, int);
471int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,477int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
472 bus_size_t, struct proc *, int, paddr_t *, int *, int);478 bus_size_t, struct proc *, int, paddr_t *, int *, int *,
479 int *, int);
473void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);480void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
474void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,481void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
475 bus_size_t, int);482 bus_size_t, int);
...@@ -501,6 +508,13 @@ struct machine_bus_dmamap {...@@ -501,6 +508,13 @@ struct machine_bus_dmamap {
501508
502 void *_dm_cookie; /* cookie for bus-specific functions */509 void *_dm_cookie; /* cookie for bus-specific functions */
503510
511 struct vm_page **_dm_pages; /* replacement pages */
512 vaddr_t _dm_pgva; /* those above -- mapped */
513 int _dm_npages; /* number of pages allocated */
514 int _dm_nused; /* number of pages replaced */
515 paddr_t _dm_low; /* lowest DMA-reachable address */
516 paddr_t _dm_high; /* highest DMA-reachable address */
517
504 /*518 /*
505 * PUBLIC MEMBERS: these are used by machine-independent code.519 * PUBLIC MEMBERS: these are used by machine-independent code.
506 */520 */
lib/libc/include/riscv64-openbsd-none/machine/cpu.h+21-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */1/* $OpenBSD: cpu.h,v 1.28 2026/07/07 12:12:44 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
...@@ -26,11 +26,13 @@...@@ -26,11 +26,13 @@
2626
27/* CTL_MACHDEP definitions. */27/* CTL_MACHDEP definitions. */
28#define CPU_COMPATIBLE 1 /* compatible property */28#define CPU_COMPATIBLE 1 /* compatible property */
29#define CPU_MAXID 2 /* number of valid machdep ids */29#define CPU_LED_BLINK 2 /* int: blink leds? */
30#define CPU_MAXID 3 /* number of valid machdep ids */
3031
31#define CTL_MACHDEP_NAMES { \32#define CTL_MACHDEP_NAMES { \
32 { 0, 0 }, \33 { 0, 0 }, \
33 { "compatible", CTLTYPE_STRING }, \34 { "compatible", CTLTYPE_STRING }, \
35 { "led_blink", CTLTYPE_INT }, \
34}36}
3537
36#ifdef _KERNEL38#ifdef _KERNEL
...@@ -42,6 +44,8 @@...@@ -42,6 +44,8 @@
42#include <machine/frame.h>44#include <machine/frame.h>
43#include <machine/riscvreg.h>45#include <machine/riscvreg.h>
4446
47void cpu_identify_cleanup(void);
48
45/* All the CLKF_* macros take a struct clockframe * as an argument. */49/* All the CLKF_* macros take a struct clockframe * as an argument. */
4650
47#define clockframe trapframe51#define clockframe trapframe
...@@ -263,14 +267,29 @@ void delay (unsigned);...@@ -263,14 +267,29 @@ void delay (unsigned);
263267
264extern void (*cpu_startclock_fcn)(void);268extern void (*cpu_startclock_fcn)(void);
265269
270extern unsigned long riscv_hwcap;
271extern size_t riscv_vlenb;
272
266void fpu_save(struct proc *, struct trapframe *);273void fpu_save(struct proc *, struct trapframe *);
267void fpu_load(struct proc *);274void fpu_load(struct proc *);
268275
276int vector_instruction(register_t stval);
277void vector_save(struct proc *, struct trapframe *);
278void vector_load(struct proc *);
279
269extern int cpu_errata_sifive_cip_1200;280extern int cpu_errata_sifive_cip_1200;
270281
271#define cpu_idle_enter() do { /* nothing */ } while (0)282#define cpu_idle_enter() do { /* nothing */ } while (0)
272#define cpu_idle_leave() do { /* nothing */ } while (0)283#define cpu_idle_leave() do { /* nothing */ } while (0)
273284
285struct blink_led {
286 void (*bl_func)(void *, int);
287 void *bl_arg;
288 SLIST_ENTRY(blink_led) bl_next;
289};
290
291void blink_led_register(struct blink_led *);
292
274#endif /* _KERNEL */293#endif /* _KERNEL */
275294
276#ifdef MULTIPROCESSOR295#ifdef MULTIPROCESSOR
lib/libc/include/riscv64-openbsd-none/machine/elf.h+55-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: elf.h,v 1.3 2024/07/14 09:48:49 jca Exp $ */1/* $OpenBSD: elf.h,v 1.4 2026/05/02 14:09:17 jsing Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1996-1997 John D. Polstra.4 * Copyright (c) 1996-1997 John D. Polstra.
...@@ -27,7 +27,7 @@...@@ -27,7 +27,7 @@
27 */27 */
2828
29#ifndef _MACHINE_ELF_H_29#ifndef _MACHINE_ELF_H_
30#define _MACHINE_ELF_H_30#define _MACHINE_ELF_H_
3131
32/*32/*
33 * ELF definitions for the RISC-V architecture.33 * ELF definitions for the RISC-V architecture.
...@@ -35,18 +35,62 @@...@@ -35,18 +35,62 @@
3535
36#ifdef _KERNEL36#ifdef _KERNEL
37# define __HAVE_CPU_HWCAP37# define __HAVE_CPU_HWCAP
38extern unsigned long hwcap;38# define __HAVE_CPU_HWCAP2
39extern unsigned long hwcap;
40extern unsigned long hwcap2;
39#endif /* _KERNEL */41#endif /* _KERNEL */
4042
41/* Flags passed in AT_HWCAP */43/* Flags passed in AT_HWCAP */
42#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a'))44#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a'))
43#define HWCAP_ISA_I HWCAP_ISA_BIT('i')45#define HWCAP_ISA_I HWCAP_ISA_BIT('i')
44#define HWCAP_ISA_M HWCAP_ISA_BIT('m')46#define HWCAP_ISA_M HWCAP_ISA_BIT('m')
45#define HWCAP_ISA_A HWCAP_ISA_BIT('a')47#define HWCAP_ISA_A HWCAP_ISA_BIT('a')
46#define HWCAP_ISA_F HWCAP_ISA_BIT('f')48#define HWCAP_ISA_F HWCAP_ISA_BIT('f')
47#define HWCAP_ISA_D HWCAP_ISA_BIT('d')49#define HWCAP_ISA_D HWCAP_ISA_BIT('d')
48#define HWCAP_ISA_C HWCAP_ISA_BIT('c')50#define HWCAP_ISA_G \
49#define HWCAP_ISA_G \
50 (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)51 (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)
52#define HWCAP_ISA_B HWCAP_ISA_BIT('b')
53#define HWCAP_ISA_C HWCAP_ISA_BIT('c')
54#define HWCAP_ISA_H HWCAP_ISA_BIT('h')
55#define HWCAP_ISA_V HWCAP_ISA_BIT('v')
56
57#ifdef _KERNEL
58/* Kernel Used Extensions */
59#define HWCAP_ISA_K_OFFSET 32
60#define HWCAP_ISA_K_BIT(n) (1UL << (HWCAP_ISA_K_OFFSET + (n)))
61#define HWCAP_ISA_K_MASK (0xffffUL << HWCAP_ISA_K_OFFSET)
62#define HWCAP_ISA_ZICBOM HWCAP_ISA_K_BIT(0) /* Cache Block Management */
63#define HWCAP_ISA_ZICBOP HWCAP_ISA_K_BIT(1) /* Cache Block Prefetch */
64#define HWCAP_ISA_ZICBOZ HWCAP_ISA_K_BIT(2) /* Cache Block Zero */
65
66/* Supervisor Extensions */
67#define HWCAP_ISA_S_OFFSET 48
68#define HWCAP_ISA_S_BIT(n) (1UL << (HWCAP_ISA_S_OFFSET + (n)))
69#define HWCAP_ISA_S_MASK (0xffffUL << HWCAP_ISA_S_OFFSET)
70#define HWCAP_ISA_SVNAPOT HWCAP_ISA_S_BIT(0) /* NAPOT Translation */
71#define HWCAP_ISA_SVPBMT HWCAP_ISA_S_BIT(1) /* Page-Based Memory Types */
72#define HWCAP_ISA_SVINVAL HWCAP_ISA_S_BIT(2) /* Cache Invalidation */
73#define HWCAP_ISA_SSTC HWCAP_ISA_S_BIT(3) /* Timer Interrupts */
74#define HWCAP_ISA_SCOFPMF HWCAP_ISA_S_BIT(4) /* Count Overflow */
75#define HWCAP_ISA_SSNPM HWCAP_ISA_S_BIT(5) /* Pointer Masking */
76#endif /* _KERNEL */
77
78/* Flags passed in AT_HWCAP2 */
79#define HWCAP2_ISA_ZBA (1UL << 0) /* Address Generation */
80#define HWCAP2_ISA_ZBB (1UL << 1) /* Basic Bit Manipulation */
81#define HWCAP2_ISA_ZBC (1UL << 2) /* Carry-Less Multiplication */
82#define HWCAP2_ISA_ZBS (1UL << 3) /* Single-Bit */
83#define HWCAP2_ISA_ZFH (1UL << 4) /* Scalar Half Precision FP */
84#define HWCAP2_ISA_ZKT (1UL << 5) /* Data-Independent Execution */
85#define HWCAP2_ISA_ZVBB (1UL << 6) /* Vector Basic Bit Manipulation */
86#define HWCAP2_ISA_ZVBC (1UL << 7) /* Vector Carry-less Multiplication */
87#define HWCAP2_ISA_ZVFH (1UL << 8) /* Vector Half Precision FP */
88#define HWCAP2_ISA_ZVKG (1UL << 9) /* Vector GCM/GMAC */
89#define HWCAP2_ISA_ZVKNED (1UL << 10) /* Vector AES Block Cipher */
90#define HWCAP2_ISA_ZVKNHA (1UL << 11) /* Vector SHA-256 */
91#define HWCAP2_ISA_ZVKNHB (1UL << 12) /* Vector SHA-512 */
92#define HWCAP2_ISA_ZVKSED (1UL << 13) /* Vector ShangMi SM4 */
93#define HWCAP2_ISA_ZVKSH (1UL << 14) /* Vector ShangMi SM3 */
94#define HWCAP2_ISA_ZVKT (1UL << 15) /* Vector Data-Independent Execution */
5195
52#endif /* !_MACHINE_ELF_H_ */96#endif /* !_MACHINE_ELF_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/machine/pcb.h+6-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pcb.h,v 1.4 2024/10/15 09:16:39 jsg Exp $ */1/* $OpenBSD: pcb.h,v 1.5 2026/05/09 17:38:50 jsing Exp $ */
22
3/*3/*
4 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>4 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
...@@ -31,11 +31,13 @@ struct pcb {...@@ -31,11 +31,13 @@ struct pcb {
31 u_int pcb_flags;31 u_int pcb_flags;
32#define PCB_FPU 0x00000001 /* Process had FPU initialized */32#define PCB_FPU 0x00000001 /* Process had FPU initialized */
33#define PCB_SINGLESTEP 0x00000002 /* Single step process */33#define PCB_SINGLESTEP 0x00000002 /* Single step process */
34#define PCB_VECTOR 0x00000004 /* Process had vector initialized */
34 struct trapframe *pcb_tf;35 struct trapframe *pcb_tf;
3536
36 register_t pcb_sp; // stack pointer of switchframe37 register_t pcb_sp; /* stack pointer of switchframe */
3738
38 caddr_t pcb_onfault; // On fault handler39 caddr_t pcb_onfault; /* On fault handler */
39 struct fpreg pcb_fpstate; // Floating Point state */40 struct fpreg pcb_fpstate; /* Floating Point state */
41 struct vreg *pcb_vstate; /* Vector state */
40};42};
41#endif /* _MACHINE_PCB_H_ */43#endif /* _MACHINE_PCB_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/machine/reg.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: reg.h,v 1.2 2021/05/12 01:20:52 jsg Exp $ */1/* $OpenBSD: reg.h,v 1.3 2026/05/09 17:38:50 jsing Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -57,4 +57,12 @@ struct fpreg {...@@ -57,4 +57,12 @@ struct fpreg {
57 uint64_t fp_fcsr; /* floating-point control register */57 uint64_t fp_fcsr; /* floating-point control register */
58};58};
5959
60struct vreg {
61 uint64_t v_vtype; /* vector type control register */
62 uint64_t v_vl; /* vector length control register */
63 uint64_t v_vstart; /* vector start control register */
64 uint64_t v_vcsr; /* vector control and status register */
65 uint8_t v_vdata[]; /* vector register data (sized based on vlenb) */
66};
67
60#endif /* !_MACHINE_REG_H_ */68#endif /* !_MACHINE_REG_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/machine/riscvreg.h+26-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: riscvreg.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: riscvreg.h,v 1.8 2026/07/24 10:51:00 kettenis Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -67,6 +67,8 @@...@@ -67,6 +67,8 @@
67#define MSTATUS_SPIE (1 << 5)67#define MSTATUS_SPIE (1 << 5)
68#define MSTATUS_MPIE (1 << 7)68#define MSTATUS_MPIE (1 << 7)
69#define MSTATUS_SPP (1 << 8)69#define MSTATUS_SPP (1 << 8)
70#define MSTATUS_VS_SHIFT 9
71#define MSTATUS_VS_MASK (0x3 << MSTATUS_VS_SHIFT)
70#define MSTATUS_MPP_SHIFT 1172#define MSTATUS_MPP_SHIFT 11
71#define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT)73#define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT)
72#define MSTATUS_FS_SHIFT 1374#define MSTATUS_FS_SHIFT 13
...@@ -90,6 +92,12 @@...@@ -90,6 +92,12 @@
90#define SSTATUS_UPIE (1 << 4)92#define SSTATUS_UPIE (1 << 4)
91#define SSTATUS_SPIE (1 << 5)93#define SSTATUS_SPIE (1 << 5)
92#define SSTATUS_SPP (1 << 8)94#define SSTATUS_SPP (1 << 8)
95#define SSTATUS_VS_SHIFT 9
96#define SSTATUS_VS_MASK (0x3 << SSTATUS_VS_SHIFT)
97#define SSTATUS_VS_OFF (0x0 << SSTATUS_VS_SHIFT)
98#define SSTATUS_VS_INITIAL (0x1 << SSTATUS_VS_SHIFT)
99#define SSTATUS_VS_CLEAN (0x2 << SSTATUS_VS_SHIFT)
100#define SSTATUS_VS_DIRTY (0x3 << SSTATUS_VS_SHIFT)
93#define SSTATUS_FS_SHIFT 13101#define SSTATUS_FS_SHIFT 13
94#define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT)102#define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT)
95#define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT)103#define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT)
...@@ -154,6 +162,9 @@...@@ -154,6 +162,9 @@
154#define UIP_UTIP (1 << 4)162#define UIP_UTIP (1 << 4)
155#define UIP_UEIP (1 << 8)163#define UIP_UEIP (1 << 8)
156164
165#define STOPEI_ID_MASK (0x7ff << STOPEI_ID_SHIFT)
166#define STOPEI_ID_SHIFT 16
167
157#define PPN(pa) ((pa) >> PAGE_SHIFT)168#define PPN(pa) ((pa) >> PAGE_SHIFT)
158#define SATP_PPN_SHIFT 0169#define SATP_PPN_SHIFT 0
159#define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT)170#define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT)
...@@ -191,18 +202,27 @@...@@ -191,18 +202,27 @@
191#define INSN_SIZE 4202#define INSN_SIZE 4
192#define INSN_C_SIZE 2203#define INSN_C_SIZE 2
193204
205/*
206 * The maximum vector register length in bits (VLEN) is 65,536, as
207 * documented in section 31.2 of the The RISC-V Instruction Set Manual,
208 * Volume I: Unprivileged Architecture (Version 20260120).
209 */
210#define VLEN_MAX 65536
211#define VLEN_BYTES_MAX (VLEN_MAX / 8)
212
194// Check if val can fit in the CSR immediate form213// Check if val can fit in the CSR immediate form
195#define CSR_ZIMM(val) \214#define CSR_ZIMM(val) \
196 (__builtin_constant_p(val) && ((u_long)(val) < 32))215 (__builtin_constant_p(val) && ((u_long)(val) < 32))
197216
198#define csr_swap(csr, val) \217#define csr_swap(csr, val) \
199({ if (CSR_ZIMM(val)) \218({ u_long ret; \
219 if (CSR_ZIMM(val)) \
200 __asm volatile("csrrwi %0, " #csr ", %1" \220 __asm volatile("csrrwi %0, " #csr ", %1" \
201 : "=r" (val) : "i" (val)); \221 : "=r" (ret) : "i" (val)); \
202 else \222 else \
203 __asm volatile("csrrw %0, " #csr ", %1" \223 __asm volatile("csrrw %0, " #csr ", %1" \
204 : "=r" (val) : "r" (val)); \224 : "=r" (ret) : "r" (val)); \
205 val; \225 ret; \
206})226})
207227
208#define csr_write(csr, val) \228#define csr_write(csr, val) \
lib/libc/include/riscv64-openbsd-none/riscv64/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.5 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.6 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -124,11 +124,7 @@ typedef float __float_t;...@@ -124,11 +124,7 @@ typedef float __float_t;
124typedef long __ptrdiff_t;124typedef long __ptrdiff_t;
125typedef unsigned long __size_t;125typedef unsigned long __size_t;
126typedef long __ssize_t;126typedef long __ssize_t;
127#if defined(__GNUC__) && __GNUC__ >= 3
128typedef __builtin_va_list __va_list;127typedef __builtin_va_list __va_list;
129#else
130typedef char * __va_list;
131#endif
132128
133/* Wide character support types */129/* Wide character support types */
134#ifndef __cplusplus130#ifndef __cplusplus
lib/libc/include/riscv64-openbsd-none/riscv64/bus.h+17-3
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.8 2025/08/03 14:03:12 jca Exp $ */1/* $OpenBSD: bus.h,v 1.10 2026/06/22 21:12:12 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.4 * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
...@@ -371,6 +371,7 @@ struct machine_bus_dma_segment {...@@ -371,6 +371,7 @@ struct machine_bus_dma_segment {
371371
372 paddr_t _ds_paddr; /* CPU address */372 paddr_t _ds_paddr; /* CPU address */
373 vaddr_t _ds_vaddr; /* CPU address */373 vaddr_t _ds_vaddr; /* CPU address */
374 vaddr_t _ds_bounce_va; /* mapped bounced data */
374 int _ds_coherent; /* Coherently mapped */375 int _ds_coherent; /* Coherently mapped */
375};376};
376typedef struct machine_bus_dma_segment bus_dma_segment_t;377typedef struct machine_bus_dma_segment bus_dma_segment_t;
...@@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;...@@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t;
385struct machine_bus_dma_tag {386struct machine_bus_dma_tag {
386 void *_cookie; /* cookie used in the guts */387 void *_cookie; /* cookie used in the guts */
387 int _flags; /* misc. flags */388 int _flags; /* misc. flags */
389 paddr_t _low; /* lowest DMA-reachable address */
390 paddr_t _high; /* highest DMA-reachable address */
388391
389 /*392 /*
390 * DMA mapping methods.393 * DMA mapping methods.
...@@ -401,7 +404,8 @@ struct machine_bus_dma_tag {...@@ -401,7 +404,8 @@ struct machine_bus_dma_tag {
401 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,404 int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t,
402 bus_dma_segment_t *, int, bus_size_t, int);405 bus_dma_segment_t *, int, bus_size_t, int);
403 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,406 int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *,
404 bus_size_t, struct proc *, int, paddr_t *, int *, int);407 bus_size_t, struct proc *, int, paddr_t *, int *,
408 int *, int *, int);
405 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);409 void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t);
406 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,410 void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t,
407 bus_addr_t, bus_size_t, int);411 bus_addr_t, bus_size_t, int);
...@@ -459,6 +463,8 @@ struct machine_bus_dma_tag {...@@ -459,6 +463,8 @@ struct machine_bus_dma_tag {
459#define bus_dmamem_mmap(t, sg, n, o, p, f) \463#define bus_dmamem_mmap(t, sg, n, o, p, f) \
460 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))464 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
461465
466void bus_dma_init(void);
467
462int _dmamap_create(bus_dma_tag_t, bus_size_t, int,468int _dmamap_create(bus_dma_tag_t, bus_size_t, int,
463 bus_size_t, bus_size_t, int, bus_dmamap_t *);469 bus_size_t, bus_size_t, int, bus_dmamap_t *);
464void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);470void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
...@@ -469,7 +475,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);...@@ -469,7 +475,8 @@ int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
469int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,475int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
470 bus_dma_segment_t *, int, bus_size_t, int);476 bus_dma_segment_t *, int, bus_size_t, int);
471int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,477int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
472 bus_size_t, struct proc *, int, paddr_t *, int *, int);478 bus_size_t, struct proc *, int, paddr_t *, int *, int *,
479 int *, int);
473void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);480void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
474void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,481void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
475 bus_size_t, int);482 bus_size_t, int);
...@@ -501,6 +508,13 @@ struct machine_bus_dmamap {...@@ -501,6 +508,13 @@ struct machine_bus_dmamap {
501508
502 void *_dm_cookie; /* cookie for bus-specific functions */509 void *_dm_cookie; /* cookie for bus-specific functions */
503510
511 struct vm_page **_dm_pages; /* replacement pages */
512 vaddr_t _dm_pgva; /* those above -- mapped */
513 int _dm_npages; /* number of pages allocated */
514 int _dm_nused; /* number of pages replaced */
515 paddr_t _dm_low; /* lowest DMA-reachable address */
516 paddr_t _dm_high; /* highest DMA-reachable address */
517
504 /*518 /*
505 * PUBLIC MEMBERS: these are used by machine-independent code.519 * PUBLIC MEMBERS: these are used by machine-independent code.
506 */520 */
lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h+21-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */1/* $OpenBSD: cpu.h,v 1.28 2026/07/07 12:12:44 kettenis Exp $ */
22
3/*3/*
4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>4 * Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
...@@ -26,11 +26,13 @@...@@ -26,11 +26,13 @@
2626
27/* CTL_MACHDEP definitions. */27/* CTL_MACHDEP definitions. */
28#define CPU_COMPATIBLE 1 /* compatible property */28#define CPU_COMPATIBLE 1 /* compatible property */
29#define CPU_MAXID 2 /* number of valid machdep ids */29#define CPU_LED_BLINK 2 /* int: blink leds? */
30#define CPU_MAXID 3 /* number of valid machdep ids */
3031
31#define CTL_MACHDEP_NAMES { \32#define CTL_MACHDEP_NAMES { \
32 { 0, 0 }, \33 { 0, 0 }, \
33 { "compatible", CTLTYPE_STRING }, \34 { "compatible", CTLTYPE_STRING }, \
35 { "led_blink", CTLTYPE_INT }, \
34}36}
3537
36#ifdef _KERNEL38#ifdef _KERNEL
...@@ -42,6 +44,8 @@...@@ -42,6 +44,8 @@
42#include <machine/frame.h>44#include <machine/frame.h>
43#include <machine/riscvreg.h>45#include <machine/riscvreg.h>
4446
47void cpu_identify_cleanup(void);
48
45/* All the CLKF_* macros take a struct clockframe * as an argument. */49/* All the CLKF_* macros take a struct clockframe * as an argument. */
4650
47#define clockframe trapframe51#define clockframe trapframe
...@@ -263,14 +267,29 @@ void delay (unsigned);...@@ -263,14 +267,29 @@ void delay (unsigned);
263267
264extern void (*cpu_startclock_fcn)(void);268extern void (*cpu_startclock_fcn)(void);
265269
270extern unsigned long riscv_hwcap;
271extern size_t riscv_vlenb;
272
266void fpu_save(struct proc *, struct trapframe *);273void fpu_save(struct proc *, struct trapframe *);
267void fpu_load(struct proc *);274void fpu_load(struct proc *);
268275
276int vector_instruction(register_t stval);
277void vector_save(struct proc *, struct trapframe *);
278void vector_load(struct proc *);
279
269extern int cpu_errata_sifive_cip_1200;280extern int cpu_errata_sifive_cip_1200;
270281
271#define cpu_idle_enter() do { /* nothing */ } while (0)282#define cpu_idle_enter() do { /* nothing */ } while (0)
272#define cpu_idle_leave() do { /* nothing */ } while (0)283#define cpu_idle_leave() do { /* nothing */ } while (0)
273284
285struct blink_led {
286 void (*bl_func)(void *, int);
287 void *bl_arg;
288 SLIST_ENTRY(blink_led) bl_next;
289};
290
291void blink_led_register(struct blink_led *);
292
274#endif /* _KERNEL */293#endif /* _KERNEL */
275294
276#ifdef MULTIPROCESSOR295#ifdef MULTIPROCESSOR
lib/libc/include/riscv64-openbsd-none/riscv64/elf.h+55-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: elf.h,v 1.3 2024/07/14 09:48:49 jca Exp $ */1/* $OpenBSD: elf.h,v 1.4 2026/05/02 14:09:17 jsing Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1996-1997 John D. Polstra.4 * Copyright (c) 1996-1997 John D. Polstra.
...@@ -27,7 +27,7 @@...@@ -27,7 +27,7 @@
27 */27 */
2828
29#ifndef _MACHINE_ELF_H_29#ifndef _MACHINE_ELF_H_
30#define _MACHINE_ELF_H_30#define _MACHINE_ELF_H_
3131
32/*32/*
33 * ELF definitions for the RISC-V architecture.33 * ELF definitions for the RISC-V architecture.
...@@ -35,18 +35,62 @@...@@ -35,18 +35,62 @@
3535
36#ifdef _KERNEL36#ifdef _KERNEL
37# define __HAVE_CPU_HWCAP37# define __HAVE_CPU_HWCAP
38extern unsigned long hwcap;38# define __HAVE_CPU_HWCAP2
39extern unsigned long hwcap;
40extern unsigned long hwcap2;
39#endif /* _KERNEL */41#endif /* _KERNEL */
4042
41/* Flags passed in AT_HWCAP */43/* Flags passed in AT_HWCAP */
42#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a'))44#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a'))
43#define HWCAP_ISA_I HWCAP_ISA_BIT('i')45#define HWCAP_ISA_I HWCAP_ISA_BIT('i')
44#define HWCAP_ISA_M HWCAP_ISA_BIT('m')46#define HWCAP_ISA_M HWCAP_ISA_BIT('m')
45#define HWCAP_ISA_A HWCAP_ISA_BIT('a')47#define HWCAP_ISA_A HWCAP_ISA_BIT('a')
46#define HWCAP_ISA_F HWCAP_ISA_BIT('f')48#define HWCAP_ISA_F HWCAP_ISA_BIT('f')
47#define HWCAP_ISA_D HWCAP_ISA_BIT('d')49#define HWCAP_ISA_D HWCAP_ISA_BIT('d')
48#define HWCAP_ISA_C HWCAP_ISA_BIT('c')50#define HWCAP_ISA_G \
49#define HWCAP_ISA_G \
50 (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)51 (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)
52#define HWCAP_ISA_B HWCAP_ISA_BIT('b')
53#define HWCAP_ISA_C HWCAP_ISA_BIT('c')
54#define HWCAP_ISA_H HWCAP_ISA_BIT('h')
55#define HWCAP_ISA_V HWCAP_ISA_BIT('v')
56
57#ifdef _KERNEL
58/* Kernel Used Extensions */
59#define HWCAP_ISA_K_OFFSET 32
60#define HWCAP_ISA_K_BIT(n) (1UL << (HWCAP_ISA_K_OFFSET + (n)))
61#define HWCAP_ISA_K_MASK (0xffffUL << HWCAP_ISA_K_OFFSET)
62#define HWCAP_ISA_ZICBOM HWCAP_ISA_K_BIT(0) /* Cache Block Management */
63#define HWCAP_ISA_ZICBOP HWCAP_ISA_K_BIT(1) /* Cache Block Prefetch */
64#define HWCAP_ISA_ZICBOZ HWCAP_ISA_K_BIT(2) /* Cache Block Zero */
65
66/* Supervisor Extensions */
67#define HWCAP_ISA_S_OFFSET 48
68#define HWCAP_ISA_S_BIT(n) (1UL << (HWCAP_ISA_S_OFFSET + (n)))
69#define HWCAP_ISA_S_MASK (0xffffUL << HWCAP_ISA_S_OFFSET)
70#define HWCAP_ISA_SVNAPOT HWCAP_ISA_S_BIT(0) /* NAPOT Translation */
71#define HWCAP_ISA_SVPBMT HWCAP_ISA_S_BIT(1) /* Page-Based Memory Types */
72#define HWCAP_ISA_SVINVAL HWCAP_ISA_S_BIT(2) /* Cache Invalidation */
73#define HWCAP_ISA_SSTC HWCAP_ISA_S_BIT(3) /* Timer Interrupts */
74#define HWCAP_ISA_SCOFPMF HWCAP_ISA_S_BIT(4) /* Count Overflow */
75#define HWCAP_ISA_SSNPM HWCAP_ISA_S_BIT(5) /* Pointer Masking */
76#endif /* _KERNEL */
77
78/* Flags passed in AT_HWCAP2 */
79#define HWCAP2_ISA_ZBA (1UL << 0) /* Address Generation */
80#define HWCAP2_ISA_ZBB (1UL << 1) /* Basic Bit Manipulation */
81#define HWCAP2_ISA_ZBC (1UL << 2) /* Carry-Less Multiplication */
82#define HWCAP2_ISA_ZBS (1UL << 3) /* Single-Bit */
83#define HWCAP2_ISA_ZFH (1UL << 4) /* Scalar Half Precision FP */
84#define HWCAP2_ISA_ZKT (1UL << 5) /* Data-Independent Execution */
85#define HWCAP2_ISA_ZVBB (1UL << 6) /* Vector Basic Bit Manipulation */
86#define HWCAP2_ISA_ZVBC (1UL << 7) /* Vector Carry-less Multiplication */
87#define HWCAP2_ISA_ZVFH (1UL << 8) /* Vector Half Precision FP */
88#define HWCAP2_ISA_ZVKG (1UL << 9) /* Vector GCM/GMAC */
89#define HWCAP2_ISA_ZVKNED (1UL << 10) /* Vector AES Block Cipher */
90#define HWCAP2_ISA_ZVKNHA (1UL << 11) /* Vector SHA-256 */
91#define HWCAP2_ISA_ZVKNHB (1UL << 12) /* Vector SHA-512 */
92#define HWCAP2_ISA_ZVKSED (1UL << 13) /* Vector ShangMi SM4 */
93#define HWCAP2_ISA_ZVKSH (1UL << 14) /* Vector ShangMi SM3 */
94#define HWCAP2_ISA_ZVKT (1UL << 15) /* Vector Data-Independent Execution */
5195
52#endif /* !_MACHINE_ELF_H_ */96#endif /* !_MACHINE_ELF_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/riscv64/pcb.h+6-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pcb.h,v 1.4 2024/10/15 09:16:39 jsg Exp $ */1/* $OpenBSD: pcb.h,v 1.5 2026/05/09 17:38:50 jsing Exp $ */
22
3/*3/*
4 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>4 * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
...@@ -31,11 +31,13 @@ struct pcb {...@@ -31,11 +31,13 @@ struct pcb {
31 u_int pcb_flags;31 u_int pcb_flags;
32#define PCB_FPU 0x00000001 /* Process had FPU initialized */32#define PCB_FPU 0x00000001 /* Process had FPU initialized */
33#define PCB_SINGLESTEP 0x00000002 /* Single step process */33#define PCB_SINGLESTEP 0x00000002 /* Single step process */
34#define PCB_VECTOR 0x00000004 /* Process had vector initialized */
34 struct trapframe *pcb_tf;35 struct trapframe *pcb_tf;
3536
36 register_t pcb_sp; // stack pointer of switchframe37 register_t pcb_sp; /* stack pointer of switchframe */
3738
38 caddr_t pcb_onfault; // On fault handler39 caddr_t pcb_onfault; /* On fault handler */
39 struct fpreg pcb_fpstate; // Floating Point state */40 struct fpreg pcb_fpstate; /* Floating Point state */
41 struct vreg *pcb_vstate; /* Vector state */
40};42};
41#endif /* _MACHINE_PCB_H_ */43#endif /* _MACHINE_PCB_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/riscv64/reg.h+9-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: reg.h,v 1.2 2021/05/12 01:20:52 jsg Exp $ */1/* $OpenBSD: reg.h,v 1.3 2026/05/09 17:38:50 jsing Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -57,4 +57,12 @@ struct fpreg {...@@ -57,4 +57,12 @@ struct fpreg {
57 uint64_t fp_fcsr; /* floating-point control register */57 uint64_t fp_fcsr; /* floating-point control register */
58};58};
5959
60struct vreg {
61 uint64_t v_vtype; /* vector type control register */
62 uint64_t v_vl; /* vector length control register */
63 uint64_t v_vstart; /* vector start control register */
64 uint64_t v_vcsr; /* vector control and status register */
65 uint8_t v_vdata[]; /* vector register data (sized based on vlenb) */
66};
67
60#endif /* !_MACHINE_REG_H_ */68#endif /* !_MACHINE_REG_H_ */
\ No newline at end of file
lib/libc/include/riscv64-openbsd-none/riscv64/riscvreg.h+26-6
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: riscvreg.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */1/* $OpenBSD: riscvreg.h,v 1.8 2026/07/24 10:51:00 kettenis Exp $ */
22
3/*-3/*-
4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>4 * Copyright (c) 2019 Brian Bamsch <bbamsch@google.com>
...@@ -67,6 +67,8 @@...@@ -67,6 +67,8 @@
67#define MSTATUS_SPIE (1 << 5)67#define MSTATUS_SPIE (1 << 5)
68#define MSTATUS_MPIE (1 << 7)68#define MSTATUS_MPIE (1 << 7)
69#define MSTATUS_SPP (1 << 8)69#define MSTATUS_SPP (1 << 8)
70#define MSTATUS_VS_SHIFT 9
71#define MSTATUS_VS_MASK (0x3 << MSTATUS_VS_SHIFT)
70#define MSTATUS_MPP_SHIFT 1172#define MSTATUS_MPP_SHIFT 11
71#define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT)73#define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT)
72#define MSTATUS_FS_SHIFT 1374#define MSTATUS_FS_SHIFT 13
...@@ -90,6 +92,12 @@...@@ -90,6 +92,12 @@
90#define SSTATUS_UPIE (1 << 4)92#define SSTATUS_UPIE (1 << 4)
91#define SSTATUS_SPIE (1 << 5)93#define SSTATUS_SPIE (1 << 5)
92#define SSTATUS_SPP (1 << 8)94#define SSTATUS_SPP (1 << 8)
95#define SSTATUS_VS_SHIFT 9
96#define SSTATUS_VS_MASK (0x3 << SSTATUS_VS_SHIFT)
97#define SSTATUS_VS_OFF (0x0 << SSTATUS_VS_SHIFT)
98#define SSTATUS_VS_INITIAL (0x1 << SSTATUS_VS_SHIFT)
99#define SSTATUS_VS_CLEAN (0x2 << SSTATUS_VS_SHIFT)
100#define SSTATUS_VS_DIRTY (0x3 << SSTATUS_VS_SHIFT)
93#define SSTATUS_FS_SHIFT 13101#define SSTATUS_FS_SHIFT 13
94#define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT)102#define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT)
95#define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT)103#define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT)
...@@ -154,6 +162,9 @@...@@ -154,6 +162,9 @@
154#define UIP_UTIP (1 << 4)162#define UIP_UTIP (1 << 4)
155#define UIP_UEIP (1 << 8)163#define UIP_UEIP (1 << 8)
156164
165#define STOPEI_ID_MASK (0x7ff << STOPEI_ID_SHIFT)
166#define STOPEI_ID_SHIFT 16
167
157#define PPN(pa) ((pa) >> PAGE_SHIFT)168#define PPN(pa) ((pa) >> PAGE_SHIFT)
158#define SATP_PPN_SHIFT 0169#define SATP_PPN_SHIFT 0
159#define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT)170#define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT)
...@@ -191,18 +202,27 @@...@@ -191,18 +202,27 @@
191#define INSN_SIZE 4202#define INSN_SIZE 4
192#define INSN_C_SIZE 2203#define INSN_C_SIZE 2
193204
205/*
206 * The maximum vector register length in bits (VLEN) is 65,536, as
207 * documented in section 31.2 of the The RISC-V Instruction Set Manual,
208 * Volume I: Unprivileged Architecture (Version 20260120).
209 */
210#define VLEN_MAX 65536
211#define VLEN_BYTES_MAX (VLEN_MAX / 8)
212
194// Check if val can fit in the CSR immediate form213// Check if val can fit in the CSR immediate form
195#define CSR_ZIMM(val) \214#define CSR_ZIMM(val) \
196 (__builtin_constant_p(val) && ((u_long)(val) < 32))215 (__builtin_constant_p(val) && ((u_long)(val) < 32))
197216
198#define csr_swap(csr, val) \217#define csr_swap(csr, val) \
199({ if (CSR_ZIMM(val)) \218({ u_long ret; \
219 if (CSR_ZIMM(val)) \
200 __asm volatile("csrrwi %0, " #csr ", %1" \220 __asm volatile("csrrwi %0, " #csr ", %1" \
201 : "=r" (val) : "i" (val)); \221 : "=r" (ret) : "i" (val)); \
202 else \222 else \
203 __asm volatile("csrrw %0, " #csr ", %1" \223 __asm volatile("csrrw %0, " #csr ", %1" \
204 : "=r" (val) : "r" (val)); \224 : "=r" (ret) : "r" (val)); \
205 val; \225 ret; \
206})226})
207227
208#define csr_write(csr, val) \228#define csr_write(csr, val) \
lib/libc/include/sparc64-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef float __float_t;...@@ -122,11 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/sparc64-openbsd-none/sparc64/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef float __float_t;...@@ -122,11 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/x86-openbsd-none/i386/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef long double __float_t;...@@ -122,11 +122,7 @@ typedef long double __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/x86-openbsd-none/i386/i82489reg.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */1/* $OpenBSD: i82489reg.h,v 1.6 2026/09/19 07:04:46 jsg Exp $ */
2/* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */2/* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */
33
4/*-4/*-
...@@ -110,7 +110,7 @@...@@ -110,7 +110,7 @@
110# define LAPIC_LVTT_VEC_MASK 0x000000ff110# define LAPIC_LVTT_VEC_MASK 0x000000ff
111# define LAPIC_LVTT_DS 0x00001000111# define LAPIC_LVTT_DS 0x00001000
112# define LAPIC_LVTT_M 0x00010000112# define LAPIC_LVTT_M 0x00010000
113# define LAPIC_LVTT_TM 0x00020000113# define LAPIC_LVTT_TM 0x00060000
114# define LAPIC_LVTT_TM_ONESHOT 0x00000000114# define LAPIC_LVTT_TM_ONESHOT 0x00000000
115# define LAPIC_LVTT_TM_PERIODIC 0x00020000115# define LAPIC_LVTT_TM_PERIODIC 0x00020000
116# define LAPIC_LVTT_TM_TSCDL 0x00040000116# define LAPIC_LVTT_TM_TSCDL 0x00040000
lib/libc/include/x86-openbsd-none/i386/specialreg.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.87 2026/05/14 01:39:38 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/*-
...@@ -535,6 +535,9 @@...@@ -535,6 +535,9 @@
535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
536#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */536#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */
537537
538#define MSR_BP_CFG 0xc001102e
539#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */
540
538#define IPM_C1E_CMP_HLT 0x10000000541#define IPM_C1E_CMP_HLT 0x10000000
539#define IPM_SMI_CMP_HLT 0x08000000542#define IPM_SMI_CMP_HLT 0x08000000
540543
lib/libc/include/x86-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef long double __float_t;...@@ -122,11 +122,7 @@ typedef long double __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/x86-openbsd-none/machine/i82489reg.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */1/* $OpenBSD: i82489reg.h,v 1.6 2026/09/19 07:04:46 jsg Exp $ */
2/* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */2/* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */
33
4/*-4/*-
...@@ -110,7 +110,7 @@...@@ -110,7 +110,7 @@
110# define LAPIC_LVTT_VEC_MASK 0x000000ff110# define LAPIC_LVTT_VEC_MASK 0x000000ff
111# define LAPIC_LVTT_DS 0x00001000111# define LAPIC_LVTT_DS 0x00001000
112# define LAPIC_LVTT_M 0x00010000112# define LAPIC_LVTT_M 0x00010000
113# define LAPIC_LVTT_TM 0x00020000113# define LAPIC_LVTT_TM 0x00060000
114# define LAPIC_LVTT_TM_ONESHOT 0x00000000114# define LAPIC_LVTT_TM_ONESHOT 0x00000000
115# define LAPIC_LVTT_TM_PERIODIC 0x00020000115# define LAPIC_LVTT_TM_PERIODIC 0x00020000
116# define LAPIC_LVTT_TM_TSCDL 0x00040000116# define LAPIC_LVTT_TM_TSCDL 0x00040000
lib/libc/include/x86-openbsd-none/machine/specialreg.h+4-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.87 2026/05/14 01:39:38 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/*-
...@@ -535,6 +535,9 @@...@@ -535,6 +535,9 @@
535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */535#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
536#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */536#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */
537537
538#define MSR_BP_CFG 0xc001102e
539#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */
540
538#define IPM_C1E_CMP_HLT 0x10000000541#define IPM_C1E_CMP_HLT 0x10000000
539#define IPM_SMI_CMP_HLT 0x08000000542#define IPM_SMI_CMP_HLT 0x08000000
540543
lib/libc/include/x86_64-openbsd-none/amd64/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.19 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.20 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef float __float_t;...@@ -122,11 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/x86_64-openbsd-none/amd64/bus.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.37 2025/08/23 10:15:49 sf Exp $ */1/* $OpenBSD: bus.h,v 1.38 2026/04/19 09:59:22 kettenis Exp $ */
2/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */2/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
33
4/*-4/*-
...@@ -671,6 +671,8 @@ struct bus_dmamap {...@@ -671,6 +671,8 @@ struct bus_dmamap {
671 bus_dma_segment_t dm_segs[1]; /* segments; variable length */671 bus_dma_segment_t dm_segs[1]; /* segments; variable length */
672};672};
673673
674void bus_dma_init(void);
675
674int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,676int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
675 bus_size_t, int, bus_dmamap_t *);677 bus_size_t, int, bus_dmamap_t *);
676void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);678void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
lib/libc/include/x86_64-openbsd-none/amd64/cpu.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */1/* $OpenBSD: cpu.h,v 1.186 2026/09/08 21:01:59 daniel 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/*-
...@@ -170,6 +170,7 @@ struct cpu_info {...@@ -170,6 +170,7 @@ struct cpu_info {
170 u_int32_t ci_feature_sefflags_ebx;/* [I] */170 u_int32_t ci_feature_sefflags_ebx;/* [I] */
171 u_int32_t ci_feature_sefflags_ecx;/* [I] */171 u_int32_t ci_feature_sefflags_ecx;/* [I] */
172 u_int32_t ci_feature_sefflags_edx;/* [I] */172 u_int32_t ci_feature_sefflags_edx;/* [I] */
173 u_int32_t ci_feature_sefflags_2_edx;/* [I] */
173 u_int32_t ci_feature_amdspec_ebx; /* [I] */174 u_int32_t ci_feature_amdspec_ebx; /* [I] */
174 u_int32_t ci_feature_amdsev_eax; /* [I] */175 u_int32_t ci_feature_amdsev_eax; /* [I] */
175 u_int32_t ci_feature_amdsev_ebx; /* [I] */176 u_int32_t ci_feature_amdsev_ebx; /* [I] */
lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h+1-8
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */1/* $OpenBSD: cpufunc.h,v 1.48 2026/07/28 15:08:06 hshoexer 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/*-
...@@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void)...@@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void)
311 wbinvd();311 wbinvd();
312 return 0;312 return 0;
313}313}
314
315static inline int
316wbinvd_on_all_cpus_acked(void)
317{
318 wbinvd();
319 return 0;
320}
321#endif /* MULTIPROCESSOR */314#endif /* MULTIPROCESSOR */
322315
323static __inline void316static __inline void
lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h+23-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */1/* $OpenBSD: ghcb.h,v 1.8 2026/08/19 08:56:28 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>
...@@ -19,6 +19,8 @@...@@ -19,6 +19,8 @@
19#ifndef _MACHINE_GHCB_H_19#ifndef _MACHINE_GHCB_H_
20#define _MACHINE_GHCB_H_20#define _MACHINE_GHCB_H_
2121
22#ifdef AMDSEV
23
22#ifndef _LOCORE24#ifndef _LOCORE
2325
24#include <sys/systm.h>26#include <sys/systm.h>
...@@ -42,6 +44,19 @@...@@ -42,6 +44,19 @@
4244
43#define GHCB_MAX 0xFFF45#define GHCB_MAX 0xFFF
4446
47#endif /* !_LOCORE */
48
49/* Definitions used with the MSR protocol */
50#define MSR_PROTO_CPUID_REQ 0x4
51#define MSR_PROTO_CPUID_RESP 0x5
52#define MSR_PROTO_PREFERRED_GHCB_PA_REQ 0x10
53#define MSR_PROTO_PREFERRED_GHCB_PA_RESP 0x11
54#define MSR_PROTO_REGISTER_GHCB_PA_REQ 0x12
55#define MSR_PROTO_REGISTER_GHCB_PA_RESP 0x13
56#define MSR_PROTO_TERMINATION_REQ 0x100
57
58#ifndef _LOCORE
59
45struct ghcb_sa {60struct ghcb_sa {
46 uint8_t v_pad0[0xcb]; /* 000h-0CAh */61 uint8_t v_pad0[0xcb]; /* 000h-0CAh */
47 uint8_t v_cpl; /* 0CBh */62 uint8_t v_cpl; /* 0CBh */
...@@ -102,14 +117,6 @@ struct ghcb_sync {...@@ -102,14 +117,6 @@ struct ghcb_sync {
102 int sz_c;117 int sz_c;
103 int sz_d;118 int sz_d;
104};119};
105#endif /* !_LOCORE */
106
107/* Definitions used with the MSR protocol */
108#define MSR_PROTO_CPUID_REQ 0x4
109#define MSR_PROTO_CPUID_RESP 0x5
110#define MSR_PROTO_TERMINATE 0x100
111
112#ifndef _LOCORE
113120
114extern vaddr_t ghcb_vaddr;121extern vaddr_t ghcb_vaddr;
115extern paddr_t ghcb_paddr;122extern paddr_t ghcb_paddr;
...@@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v)...@@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v)
249256
250#endif /* !_LOCORE */257#endif /* !_LOCORE */
251258
259#else /* !AMDSEV */
260
261/* Definitions used with the MSR protocol */
262#define MSR_PROTO_TERMINATION_REQ 0x100
263
264#endif /* AMDSEV */
265
252#endif /* !_MACHINE_GHCB_H_ */266#endif /* !_MACHINE_GHCB_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/i82489reg.h+33-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */1/* $OpenBSD: i82489reg.h,v 1.9 2026/09/19 16:11:07 mlarkin Exp $ */
2/* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */2/* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
33
4/*-4/*-
...@@ -73,6 +73,8 @@...@@ -73,6 +73,8 @@
73#define LAPIC_IRR 0x20073#define LAPIC_IRR 0x200
74#define LAPIC_ESR 0x280 /* Err status. R */74#define LAPIC_ESR 0x280 /* Err status. R */
7575
76#define LAPIC_LVT_CMCI 0x2f0 /* Corrected machine chk LVT */
77
76#define LAPIC_ICRLO 0x300 /* Int. cmd. RW */78#define LAPIC_ICRLO 0x300 /* Int. cmd. RW */
77# define LAPIC_DLMODE_MASK 0x0000070079# define LAPIC_DLMODE_MASK 0x00000700
78# define LAPIC_DLMODE_FIXED 0x0000000080# define LAPIC_DLMODE_FIXED 0x00000000
...@@ -82,6 +84,7 @@...@@ -82,6 +84,7 @@
82# define LAPIC_DLMODE_NMI 0x0000040084# define LAPIC_DLMODE_NMI 0x00000400
83# define LAPIC_DLMODE_INIT 0x0000050085# define LAPIC_DLMODE_INIT 0x00000500
84# define LAPIC_DLMODE_STARTUP 0x0000060086# define LAPIC_DLMODE_STARTUP 0x00000600
87# define LAPIC_DLMODE_EXTINT 0x00000700
8588
86# define LAPIC_DSTMODE_LOG 0x0000080089# define LAPIC_DSTMODE_LOG 0x00000800
8790
...@@ -110,11 +113,12 @@...@@ -110,11 +113,12 @@
110# define LAPIC_LVTT_VEC_MASK 0x000000ff113# define LAPIC_LVTT_VEC_MASK 0x000000ff
111# define LAPIC_LVTT_DS 0x00001000114# define LAPIC_LVTT_DS 0x00001000
112# define LAPIC_LVTT_M 0x00010000115# define LAPIC_LVTT_M 0x00010000
113# define LAPIC_LVTT_TM 0x00020000116# define LAPIC_LVTT_TM 0x00060000
114# define LAPIC_LVTT_TM_ONESHOT 0x00000000117# define LAPIC_LVTT_TM_ONESHOT 0x00000000
115# define LAPIC_LVTT_TM_PERIODIC 0x00020000118# define LAPIC_LVTT_TM_PERIODIC 0x00020000
116# define LAPIC_LVTT_TM_TSCDL 0x00040000119# define LAPIC_LVTT_TM_TSCDL 0x00040000
117120
121#define LAPIC_LVT_THERM 0x330 /* Thermal sensor LVT */
118#define LAPIC_PCINT 0x340122#define LAPIC_PCINT 0x340
119#define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */123#define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */
120# define LAPIC_LVT_PERIODIC 0x00020000124# define LAPIC_LVT_PERIODIC 0x00020000
...@@ -144,6 +148,31 @@...@@ -144,6 +148,31 @@
144#define LAPIC_IRQ_MASK(i) (1 << ((i) + 1))148#define LAPIC_IRQ_MASK(i) (1 << ((i) + 1))
145149
146#define MSR_X2APIC_BASE 0x800150#define MSR_X2APIC_BASE 0x800
147#define MSR_X2APIC_EOI (MSR_X2APIC_BASE+0x0b) /* End Int. W */151#define MSR_X2APIC_END 0x83f
148#define MSR_X2APIC_ID (MSR_X2APIC_BASE+0x02) /* ID. RW */152#define MSR_X2APIC_ID (MSR_X2APIC_BASE + 0x02) /* ID. R */
153#define MSR_X2APIC_VERSION (MSR_X2APIC_BASE + 0x03) /* Version. R */
154#define MSR_X2APIC_TPR (MSR_X2APIC_BASE + 0x08) /* Task prio. RW */
155#define MSR_X2APIC_PPR (MSR_X2APIC_BASE + 0x0a) /* Processor prio. R */
156#define MSR_X2APIC_EOI (MSR_X2APIC_BASE + 0x0b) /* End Int. W */
157#define MSR_X2APIC_LDR (MSR_X2APIC_BASE + 0x0d) /* Logical dest. R */
158#define MSR_X2APIC_SVR (MSR_X2APIC_BASE + 0x0f) /* Spurious intvec RW */
159#define MSR_X2APIC_ISR0 (MSR_X2APIC_BASE + 0x10) /* ISR 31:0. R */
160#define MSR_X2APIC_ISR7 (MSR_X2APIC_BASE + 0x17) /* ISR 255:224. R */
161#define MSR_X2APIC_TMR0 (MSR_X2APIC_BASE + 0x18) /* TMR 31:0. R */
162#define MSR_X2APIC_TMR7 (MSR_X2APIC_BASE + 0x1f) /* TMR 255:224. R */
163#define MSR_X2APIC_IRR0 (MSR_X2APIC_BASE + 0x20) /* IRR 31:0. R */
164#define MSR_X2APIC_IRR7 (MSR_X2APIC_BASE + 0x27) /* IRR 255:224. R */
165#define MSR_X2APIC_ESR (MSR_X2APIC_BASE + 0x28) /* Error status RW */
166#define MSR_X2APIC_LVT_CMCI (MSR_X2APIC_BASE + 0x2f) /* CMCI LVT. RW */
167#define MSR_X2APIC_ICR (MSR_X2APIC_BASE + 0x30) /* ICR. RW */
168#define MSR_X2APIC_LVT_TIMER (MSR_X2APIC_BASE + 0x32) /* Timer LVT. RW */
169#define MSR_X2APIC_LVT_THERM (MSR_X2APIC_BASE + 0x33) /* Thermal LVT. RW */
170#define MSR_X2APIC_LVT_PCINT (MSR_X2APIC_BASE + 0x34) /* Perf LVT. RW */
171#define MSR_X2APIC_LVT_LINT0 (MSR_X2APIC_BASE + 0x35) /* LINT0 LVT. RW */
172#define MSR_X2APIC_LVT_LINT1 (MSR_X2APIC_BASE + 0x36) /* LINT1 LVT. RW */
173#define MSR_X2APIC_LVT_ERROR (MSR_X2APIC_BASE + 0x37) /* Error LVT. RW */
174#define MSR_X2APIC_TIMER_ICR (MSR_X2APIC_BASE + 0x38) /* Initial count RW */
175#define MSR_X2APIC_TIMER_CCR (MSR_X2APIC_BASE + 0x39) /* Current count R */
176#define MSR_X2APIC_TIMER_DCR (MSR_X2APIC_BASE + 0x3e) /* Divisor config RW */
177#define MSR_X2APIC_SELF_IPI (MSR_X2APIC_BASE + 0x3f) /* Self IPI. W */
149#define X2APIC_ID_MASK 0xff178#define X2APIC_ID_MASK 0xff
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/amd64/pci_machdep.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pci_machdep.h,v 1.32 2025/01/23 11:24:34 kettenis Exp $ */1/* $OpenBSD: pci_machdep.h,v 1.33 2026/07/25 22:57:22 chris Exp $ */
2/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */2/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
33
4/*4/*
...@@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int);...@@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int);
104104
105void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int);105void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int);
106pci_chipset_tag_t pci_lookup_segment(int, int);106pci_chipset_tag_t pci_lookup_segment(int, int);
107int acpipci_domain_to_seg(int);
107108
108#define __HAVE_PCI_MSIX109#define __HAVE_PCI_MSIX
109110
lib/libc/include/x86_64-openbsd-none/amd64/pmap.h+23-18
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pmap.h,v 1.94 2025/07/07 00:55:15 jsg Exp $ */1/* $OpenBSD: pmap.h,v 1.95 2026/06/04 05:22:04 mlarkin Exp $ */
2/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */2/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */
33
4/*4/*
...@@ -92,11 +92,8 @@...@@ -92,11 +92,8 @@
92 * The other levels are kept as physical pages in 3 UVM objects and are92 * The other levels are kept as physical pages in 3 UVM objects and are
93 * temporarily mapped for virtual access when needed.93 * temporarily mapped for virtual access when needed.
94 *94 *
95 * The other obvious difference from i386 is that it has a direct map of all95 * The other obvious difference from i386 is that it has a direct map of
96 * physical memory in the VA range:96 * physical memory in a randomized VA subrange of the direct-map window.
97 *
98 * 0xfffffd8000000000 - 0xffffff7fffffffff
99 *
100 * The direct map is used in some cases to access PTEs of non-current pmaps.97 * The direct map is used in some cases to access PTEs of non-current pmaps.
101 *98 *
102 * Note that address space is signed, so the layout for 48 bits is:99 * Note that address space is signed, so the layout for 48 bits is:
...@@ -104,8 +101,8 @@...@@ -104,8 +101,8 @@
104 * +---------------------------------+ 0xffffffffffffffff101 * +---------------------------------+ 0xffffffffffffffff
105 * | Kernel Image |102 * | Kernel Image |
106 * +---------------------------------+ 0xffffff8000000000103 * +---------------------------------+ 0xffffff8000000000
107 * | Direct Map |104 * | Direct Map Window |
108 * +---------------------------------+ 0xfffffd8000000000105 * +---------------------------------+ 0xffffee0000000000
109 * ~ ~106 * ~ ~
110 * | |107 * | |
111 * | Kernel Space |108 * | Kernel Space |
...@@ -139,13 +136,23 @@...@@ -139,13 +136,23 @@
139 */136 */
140#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK)137#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK)
141138
142#define L4_SLOT_PTE 255139#define L4_SLOT_PTE 255
143#define L4_SLOT_KERN 256140#define L4_SLOT_KERN 256
144#define L4_SLOT_KERNBASE 511141#define L4_SLOT_KERNBASE 511
145#define NUM_L4_SLOT_DIRECT 4142#define DIRECT_MAP_PML4_SLOTS 4
146#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - NUM_L4_SLOT_DIRECT)143#define DIRECT_MAP_START_CHOICES 32
144#define DIRECT_MAP_START_MASK (DIRECT_MAP_START_CHOICES - 1)
145#define DIRECT_MAP_RESERVED_PML4_SLOTS (DIRECT_MAP_PML4_SLOTS + \
146 DIRECT_MAP_START_CHOICES - 1)
147#define DIRECT_MAP_SIZE ((vaddr_t)DIRECT_MAP_PML4_SLOTS * NBPD_L4)
148#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - \
149 DIRECT_MAP_RESERVED_PML4_SLOTS)
147#define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1)150#define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1)
148151
152#if (DIRECT_MAP_START_CHOICES & DIRECT_MAP_START_MASK) != 0
153#error DIRECT_MAP_START_CHOICES must be a power of two
154#endif
155
149#define PDIR_SLOT_KERN L4_SLOT_KERN156#define PDIR_SLOT_KERN L4_SLOT_KERN
150#define PDIR_SLOT_PTE L4_SLOT_PTE157#define PDIR_SLOT_PTE L4_SLOT_PTE
151#define PDIR_SLOT_DIRECT L4_SLOT_DIRECT158#define PDIR_SLOT_DIRECT L4_SLOT_DIRECT
...@@ -160,9 +167,7 @@...@@ -160,9 +167,7 @@
160 */167 */
161168
162#define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))169#define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))
163#define PMAP_DIRECT_BASE (VA_SIGN_NEG((L4_SLOT_DIRECT * NBPD_L4)))170extern vaddr_t pmap_direct_base, pmap_direct_end;
164#define PMAP_DIRECT_END (VA_SIGN_NEG(((L4_SLOT_DIRECT + \
165 NUM_L4_SLOT_DIRECT) * NBPD_L4)))
166171
167#define L1_BASE PTE_BASE172#define L1_BASE PTE_BASE
168173
...@@ -498,8 +503,8 @@ kvtopte(vaddr_t va)...@@ -498,8 +503,8 @@ kvtopte(vaddr_t va)
498 return (PTE_BASE + pl1_i(va));503 return (PTE_BASE + pl1_i(va));
499}504}
500505
501#define PMAP_DIRECT_MAP(pa) ((vaddr_t)PMAP_DIRECT_BASE + (pa))506#define PMAP_DIRECT_MAP(pa) ((vaddr_t)pmap_direct_base + (pa))
502#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - PMAP_DIRECT_BASE)507#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base)
503#define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg))508#define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg))
504#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va))509#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va))
505510
lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h+19-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.129 2026/09/19 16:11:07 mlarkin 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
...@@ -281,6 +281,11 @@...@@ -281,6 +281,11 @@
281 ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \281 ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \
282 "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" )282 "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" )
283283
284/* SEFF subleaf 2 EDX bits */
285#define SEFF2EDX_BHI_CTRL 0x00000010 /* BHI_DIS_S supported */
286#define SEFF2_EDX_BITS \
287 ("\20" "\05BHI_CTRL" )
288
284/*289/*
285 * Thermal and Power Management (CPUID function 0x6) EAX bits290 * Thermal and Power Management (CPUID function 0x6) EAX bits
286 */291 */
...@@ -465,6 +470,7 @@...@@ -465,6 +470,7 @@
465#define APICBASE_BSP 0x100470#define APICBASE_BSP 0x100
466#define APICBASE_ENABLE_X2APIC 0x400471#define APICBASE_ENABLE_X2APIC 0x400
467#define APICBASE_GLOBAL_ENABLE 0x800472#define APICBASE_GLOBAL_ENABLE 0x800
473#define APICBASE_ADDRESS_MASK 0x000ffffffffff000ULL
468#define MSR_EBL_CR_POWERON 0x02a474#define MSR_EBL_CR_POWERON 0x02a
469#define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */475#define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */
470#define MSR_TEST_CTL 0x033476#define MSR_TEST_CTL 0x033
...@@ -474,6 +480,7 @@...@@ -474,6 +480,7 @@
474#define SPEC_CTRL_IBRS (1ULL << 0)480#define SPEC_CTRL_IBRS (1ULL << 0)
475#define SPEC_CTRL_STIBP (1ULL << 1)481#define SPEC_CTRL_STIBP (1ULL << 1)
476#define SPEC_CTRL_SSBD (1ULL << 2)482#define SPEC_CTRL_SSBD (1ULL << 2)
483#define SPEC_CTRL_BHI_DIS_S (1ULL << 10)
477#define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */484#define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */
478#define PRED_CMD_IBPB (1ULL << 0)485#define PRED_CMD_IBPB (1ULL << 0)
479#define MSR_BIOS_UPDT_TRIG 0x079486#define MSR_BIOS_UPDT_TRIG 0x079
...@@ -710,6 +717,9 @@...@@ -710,6 +717,9 @@
710#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */717#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
711#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */718#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */
712719
720#define MSR_BP_CFG 0xc001102e
721#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */
722
713#define IPM_C1E_CMP_HLT 0x10000000723#define IPM_C1E_CMP_HLT 0x10000000
714#define IPM_SMI_CMP_HLT 0x08000000724#define IPM_SMI_CMP_HLT 0x08000000
715725
...@@ -734,6 +744,7 @@...@@ -734,6 +744,7 @@
734#define MSR_SEV_STATUS 0xc0010131744#define MSR_SEV_STATUS 0xc0010131
735#define SEV_STAT_ENABLED 0x00000001745#define SEV_STAT_ENABLED 0x00000001
736#define SEV_STAT_ES_ENABLED 0x00000002746#define SEV_STAT_ES_ENABLED 0x00000002
747#define SEV_STAT_SNP_ACTIVE 0x00000004
737748
738#define MSR_LS_CFG 0xc0011020749#define MSR_LS_CFG 0xc0011020
739#define LS_CFG_DIS_LS2_SQUISH 0x02000000750#define LS_CFG_DIS_LS2_SQUISH 0x02000000
...@@ -1357,6 +1368,8 @@...@@ -1357,6 +1368,8 @@
1357#define VMCS_GUEST_IA32_LDTR_AR 0x48201368#define VMCS_GUEST_IA32_LDTR_AR 0x4820
1358#define VMCS_GUEST_IA32_TR_AR 0x48221369#define VMCS_GUEST_IA32_TR_AR 0x4822
1359#define VMCS_GUEST_INTERRUPTIBILITY_ST 0x48241370#define VMCS_GUEST_INTERRUPTIBILITY_ST 0x4824
1371#define VMX_INT_STATE_BLOCK_STI (1 << 0)
1372#define VMX_INT_STATE_BLOCK_MOVSS (1 << 1)
1360#define VMCS_GUEST_ACTIVITY_STATE 0x48261373#define VMCS_GUEST_ACTIVITY_STATE 0x4826
1361#define VMCS_GUEST_SMBASE 0x48281374#define VMCS_GUEST_SMBASE 0x4828
1362#define VMCS_GUEST_IA32_SYSENTER_CS 0x482A1375#define VMCS_GUEST_IA32_SYSENTER_CS 0x482A
...@@ -1405,6 +1418,8 @@...@@ -1405,6 +1418,8 @@
1405#define VMCS_GUEST_IA32_SYSENTER_ESP 0x68241418#define VMCS_GUEST_IA32_SYSENTER_ESP 0x6824
1406#define VMCS_GUEST_IA32_SYSENTER_EIP 0x68261419#define VMCS_GUEST_IA32_SYSENTER_EIP 0x6826
1407#define VMCS_GUEST_IA32_S_CET 0x68281420#define VMCS_GUEST_IA32_S_CET 0x6828
1421#define VMCS_GUEST_SSP 0x682A
1422#define VMCS_GUEST_IA32_INTR_SSP_TABLE 0x682C
14081423
1409/* Natural-width host state fields */1424/* Natural-width host state fields */
1410#define VMCS_HOST_IA32_CR0 0x6C001425#define VMCS_HOST_IA32_CR0 0x6C00
...@@ -1420,6 +1435,8 @@...@@ -1420,6 +1435,8 @@
1420#define VMCS_HOST_IA32_RSP 0x6C141435#define VMCS_HOST_IA32_RSP 0x6C14
1421#define VMCS_HOST_IA32_RIP 0x6C161436#define VMCS_HOST_IA32_RIP 0x6C16
1422#define VMCS_HOST_IA32_S_CET 0x6C181437#define VMCS_HOST_IA32_S_CET 0x6C18
1438#define VMCS_HOST_SSP 0x6C1A
1439#define VMCS_HOST_IA32_INTR_SSP_TABLE 0x6C1C
14231440
1424#define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x01441#define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x0
1425#define IA32_VMX_INVVPID_SINGLE_CTX 0x11442#define IA32_VMX_INVVPID_SINGLE_CTX 0x1
...@@ -1450,6 +1467,7 @@...@@ -1450,6 +1467,7 @@
1450#define MSR_AMD_VM_HSAVE_PA 0xc00101171467#define MSR_AMD_VM_HSAVE_PA 0xc0010117
1451#define CPUID_AMD_SVM_CAP 0x8000000A1468#define CPUID_AMD_SVM_CAP 0x8000000A
1452#define AMD_SVM_NESTED_PAGING_CAP (1 << 0)1469#define AMD_SVM_NESTED_PAGING_CAP (1 << 0)
1470#define AMD_SVM_NRIP_SAVE_CAP (1 << 3)
1453#define AMD_SVM_VMCB_CLEAN_CAP (1 << 5)1471#define AMD_SVM_VMCB_CLEAN_CAP (1 << 5)
1454#define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6)1472#define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6)
1455#define AMD_SVM_DECODE_ASSIST_CAP (1 << 7)1473#define AMD_SVM_DECODE_ASSIST_CAP (1 << 7)
lib/libc/include/x86_64-openbsd-none/amd64/vmmvar.h+29-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmmvar.h,v 1.117 2025/09/17 18:37:44 sf Exp $ */1/* $OpenBSD: vmmvar.h,v 1.123 2026/09/22 08:21:39 mlarkin Exp $ */
2/*2/*
3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
4 *4 *
...@@ -23,6 +23,8 @@...@@ -23,6 +23,8 @@
2323
24#ifndef _LOCORE24#ifndef _LOCORE
2525
26struct vm;
27
26#define VMM_HV_SIGNATURE "OpenBSDVMM58"28#define VMM_HV_SIGNATURE "OpenBSDVMM58"
2729
28/* VMX: Basic Exit Reasons */30/* VMX: Basic Exit Reasons */
...@@ -87,6 +89,8 @@...@@ -87,6 +89,8 @@
87#define VMX_EXIT_XSAVES 6389#define VMX_EXIT_XSAVES 63
88#define VMX_EXIT_XRSTORS 6490#define VMX_EXIT_XRSTORS 64
8991
92#define VM_EXIT_APICBASE 0xFFFC
93#define VM_EXIT_X2APIC 0xFFFD
90#define VM_EXIT_TERMINATED 0xFFFE94#define VM_EXIT_TERMINATED 0xFFFE
91#define VM_EXIT_NONE 0xFFFF95#define VM_EXIT_NONE 0xFFFF
9296
...@@ -348,10 +352,25 @@ struct vm_exit_inout {...@@ -348,10 +352,25 @@ struct vm_exit_inout {
348struct vm_exit_eptviolation {352struct vm_exit_eptviolation {
349 uint8_t vee_fault_type; /* type of vm exit */353 uint8_t vee_fault_type; /* type of vm exit */
350 uint8_t vee_insn_info; /* bitfield */354 uint8_t vee_insn_info; /* bitfield */
351#define VEE_LEN_VALID 0x1 /* vee_insn_len is valid */355#define VEE_LEN_VALID (1 << 0) /* vee_insn_len is valid */
352#define VEE_BYTES_VALID 0x2 /* vee_insn_bytes is valid */356#define VEE_BYTES_VALID (1 << 1) /* vee_insn_bytes is valid */
357#define VEE_GPA_VALID (1 << 2) /* vee_gpa is valid */
353 uint8_t vee_insn_len; /* [VMX] instruction length */358 uint8_t vee_insn_len; /* [VMX] instruction length */
354 uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */359 uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */
360 uint64_t vee_gpa; /* GPA that caused the fault */
361};
362
363/* Userspace-assisted x2APIC MSR access. */
364struct vm_exit_x2apic {
365 uint32_t vex_msr;
366 uint8_t vex_write;
367 uint8_t vex_pad[3];
368 uint64_t vex_data;
369};
370
371/* Guest-visible IA32_APIC_BASE mode change. */
372struct vm_exit_apicbase {
373 uint64_t vea_value;
355};374};
356375
357/*376/*
...@@ -469,6 +488,8 @@ struct vm_exit {...@@ -469,6 +488,8 @@ struct vm_exit {
469 union {488 union {
470 struct vm_exit_inout vei; /* IN/OUT exit */489 struct vm_exit_inout vei; /* IN/OUT exit */
471 struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/490 struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/
491 struct vm_exit_apicbase vea; /* APICBASE mode exit */
492 struct vm_exit_x2apic vex; /* x2APIC MSR exit */
472 };493 };
473494
474 struct vcpu_reg_state vrs;495 struct vcpu_reg_state vrs;
...@@ -477,7 +498,6 @@ struct vm_exit {...@@ -477,7 +498,6 @@ struct vm_exit {
477498
478struct vm_intr_params {499struct vm_intr_params {
479 /* Input parameters to VMM_IOC_INTR */500 /* Input parameters to VMM_IOC_INTR */
480 uint32_t vip_vm_id;
481 uint32_t vip_vcpu_id;501 uint32_t vip_vcpu_id;
482 uint16_t vip_intr;502 uint16_t vip_intr;
483};503};
...@@ -495,7 +515,6 @@ struct vm_rwregs_params {...@@ -495,7 +515,6 @@ struct vm_rwregs_params {
495 * Input/output parameters to VMM_IOC_READREGS /515 * Input/output parameters to VMM_IOC_READREGS /
496 * VMM_IOC_WRITEREGS516 * VMM_IOC_WRITEREGS
497 */517 */
498 uint32_t vrwp_vm_id;
499 uint32_t vrwp_vcpu_id;518 uint32_t vrwp_vcpu_id;
500 uint64_t vrwp_mask;519 uint64_t vrwp_mask;
501 struct vcpu_reg_state vrwp_regs;520 struct vcpu_reg_state vrwp_regs;
...@@ -522,7 +541,6 @@ struct vm_rwregs_params {...@@ -522,7 +541,6 @@ struct vm_rwregs_params {
522 * direct cache access (CPUIDECX_DCA)541 * direct cache access (CPUIDECX_DCA)
523 * x2APIC (CPUIDECX_X2APIC)542 * x2APIC (CPUIDECX_X2APIC)
524 * apic deadline (CPUIDECX_DEADLINE)543 * apic deadline (CPUIDECX_DEADLINE)
525 * apic (CPUID_APIC)
526 * psn (CPUID_PSN)544 * psn (CPUID_PSN)
527 * self snoop (CPUID_SS)545 * self snoop (CPUID_SS)
528 * hyperthreading (CPUID_HTT)546 * hyperthreading (CPUID_HTT)
...@@ -537,7 +555,7 @@ struct vm_rwregs_params {...@@ -537,7 +555,7 @@ struct vm_rwregs_params {
537 CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE)555 CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE)
538#define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX)556#define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX)
539#define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \557#define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \
540 CPUID_HTT | CPUID_DS | CPUID_APIC | \558 CPUID_HTT | CPUID_DS | \
541 CPUID_PSN | CPUID_SS | CPUID_PBE | \559 CPUID_PSN | CPUID_SS | CPUID_PBE | \
542 CPUID_MTRR | CPUID_MCE | CPUID_MCA)560 CPUID_MTRR | CPUID_MCE | CPUID_MCA)
543#define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \561#define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \
...@@ -976,6 +994,7 @@ struct vcpu {...@@ -976,6 +994,7 @@ struct vcpu {
976 struct vm_exit vc_exit; /* [v] */994 struct vm_exit vc_exit; /* [v] */
977995
978 uint16_t vc_intr; /* [v] */996 uint16_t vc_intr; /* [v] */
997 u_int vc_intr_latch; /* [a] */
979 uint8_t vc_irqready; /* [v] */998 uint8_t vc_irqready; /* [v] */
980999
981 uint8_t vc_fpuinited; /* [v] */1000 uint8_t vc_fpuinited; /* [v] */
...@@ -991,6 +1010,7 @@ struct vcpu {...@@ -991,6 +1010,7 @@ struct vcpu {
9911010
992 /* Shadowed MSRs */1011 /* Shadowed MSRs */
993 uint64_t vc_shadow_pat; /* [v] */1012 uint64_t vc_shadow_pat; /* [v] */
1013 uint64_t vc_apicbase; /* [v] */
9941014
995 /* Userland Protection Keys */1015 /* Userland Protection Keys */
996 uint32_t vc_pkru; /* [v] */1016 uint32_t vc_pkru; /* [v] */
...@@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *);...@@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *);
1056int vmm_probe_machdep(struct device *, void *, void *);1076int vmm_probe_machdep(struct device *, void *, void *);
1057void vmm_attach_machdep(struct device *, struct device *, void *);1077void vmm_attach_machdep(struct device *, struct device *, void *);
1058void vmm_activate_machdep(struct device *, int);1078void vmm_activate_machdep(struct device *, int);
1059int vmmioctl_machdep(dev_t, u_long, caddr_t, int, struct proc *);
1060int pledge_ioctl_vmm_machdep(struct proc *, long);
1061int vmm_start(void);1079int vmm_start(void);
1062int vmm_stop(void);1080int vmm_stop(void);
1063int vm_impl_init(struct vm *, struct proc *);1081int vm_impl_init(struct vm *, struct proc *);
1064void vm_impl_deinit(struct vm *);1082void vm_impl_deinit(struct vm *);
1065int vcpu_init(struct vcpu *, struct vm_create_params *);1083int vcpu_init(struct vcpu *, struct vm_create_params *);
1066void vcpu_deinit(struct vcpu *);1084void vcpu_deinit(struct vcpu *);
1067int vm_rwregs(struct vm_rwregs_params *, int);1085int vm_rwregs(struct vm *, struct vm_rwregs_params *, int);
1068int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *);1086int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *);
1069int svm_get_vmsa_pa(uint32_t, uint32_t, uint64_t *);1087int svm_get_vmsa_pa(struct proc *, struct file *, uint32_t, uint64_t *);
10701088
1071#endif /* _KERNEL */1089#endif /* _KERNEL */
10721090
lib/libc/include/x86_64-openbsd-none/amd64/vmparam.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmparam.h,v 1.25 2024/11/08 01:44:52 jsg Exp $ */1/* $OpenBSD: vmparam.h,v 1.26 2026/06/22 00:27:33 jsg Exp $ */
2/* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */2/* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */
33
4/*-4/*-
...@@ -98,7 +98,7 @@...@@ -98,7 +98,7 @@
98#define VM_MIN_STACK_ADDRESS 0x000060000000000098#define VM_MIN_STACK_ADDRESS 0x0000600000000000
99#endif99#endif
100#define VM_MIN_KERNEL_ADDRESS 0xffff800000000000100#define VM_MIN_KERNEL_ADDRESS 0xffff800000000000
101#define VM_MAX_KERNEL_ADDRESS 0xffff800100000000101#define VM_MAX_KERNEL_ADDRESS 0xffff808000000000
102102
103/* map PIE into approximately the first quarter of user va space */103/* map PIE into approximately the first quarter of user va space */
104#define VM_PIE_MIN_ADDR VM_MIN_ADDRESS104#define VM_PIE_MIN_ADDR VM_MIN_ADDRESS
lib/libc/include/x86_64-openbsd-none/machine/_types.h+1-5
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: _types.h,v 1.19 2023/07/02 19:02:27 cheloha Exp $ */1/* $OpenBSD: _types.h,v 1.20 2026/08/31 10:58:08 tb Exp $ */
22
3/*-3/*-
4 * Copyright (c) 1990, 19934 * Copyright (c) 1990, 1993
...@@ -122,11 +122,7 @@ typedef float __float_t;...@@ -122,11 +122,7 @@ typedef float __float_t;
122typedef long __ptrdiff_t;122typedef long __ptrdiff_t;
123typedef unsigned long __size_t;123typedef unsigned long __size_t;
124typedef long __ssize_t;124typedef long __ssize_t;
125#if defined(__GNUC__) && __GNUC__ >= 3
126typedef __builtin_va_list __va_list;125typedef __builtin_va_list __va_list;
127#else
128typedef char * __va_list;
129#endif
130126
131/* Wide character support types */127/* Wide character support types */
132#ifndef __cplusplus128#ifndef __cplusplus
lib/libc/include/x86_64-openbsd-none/machine/bus.h+3-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: bus.h,v 1.37 2025/08/23 10:15:49 sf Exp $ */1/* $OpenBSD: bus.h,v 1.38 2026/04/19 09:59:22 kettenis Exp $ */
2/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */2/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
33
4/*-4/*-
...@@ -671,6 +671,8 @@ struct bus_dmamap {...@@ -671,6 +671,8 @@ struct bus_dmamap {
671 bus_dma_segment_t dm_segs[1]; /* segments; variable length */671 bus_dma_segment_t dm_segs[1]; /* segments; variable length */
672};672};
673673
674void bus_dma_init(void);
675
674int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,676int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
675 bus_size_t, int, bus_dmamap_t *);677 bus_size_t, int, bus_dmamap_t *);
676void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);678void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
lib/libc/include/x86_64-openbsd-none/machine/cpu.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */1/* $OpenBSD: cpu.h,v 1.186 2026/09/08 21:01:59 daniel 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/*-
...@@ -170,6 +170,7 @@ struct cpu_info {...@@ -170,6 +170,7 @@ struct cpu_info {
170 u_int32_t ci_feature_sefflags_ebx;/* [I] */170 u_int32_t ci_feature_sefflags_ebx;/* [I] */
171 u_int32_t ci_feature_sefflags_ecx;/* [I] */171 u_int32_t ci_feature_sefflags_ecx;/* [I] */
172 u_int32_t ci_feature_sefflags_edx;/* [I] */172 u_int32_t ci_feature_sefflags_edx;/* [I] */
173 u_int32_t ci_feature_sefflags_2_edx;/* [I] */
173 u_int32_t ci_feature_amdspec_ebx; /* [I] */174 u_int32_t ci_feature_amdspec_ebx; /* [I] */
174 u_int32_t ci_feature_amdsev_eax; /* [I] */175 u_int32_t ci_feature_amdsev_eax; /* [I] */
175 u_int32_t ci_feature_amdsev_ebx; /* [I] */176 u_int32_t ci_feature_amdsev_ebx; /* [I] */
lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h+1-8
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */1/* $OpenBSD: cpufunc.h,v 1.48 2026/07/28 15:08:06 hshoexer 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/*-
...@@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void)...@@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void)
311 wbinvd();311 wbinvd();
312 return 0;312 return 0;
313}313}
314
315static inline int
316wbinvd_on_all_cpus_acked(void)
317{
318 wbinvd();
319 return 0;
320}
321#endif /* MULTIPROCESSOR */314#endif /* MULTIPROCESSOR */
322315
323static __inline void316static __inline void
lib/libc/include/x86_64-openbsd-none/machine/ghcb.h+23-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */1/* $OpenBSD: ghcb.h,v 1.8 2026/08/19 08:56:28 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>
...@@ -19,6 +19,8 @@...@@ -19,6 +19,8 @@
19#ifndef _MACHINE_GHCB_H_19#ifndef _MACHINE_GHCB_H_
20#define _MACHINE_GHCB_H_20#define _MACHINE_GHCB_H_
2121
22#ifdef AMDSEV
23
22#ifndef _LOCORE24#ifndef _LOCORE
2325
24#include <sys/systm.h>26#include <sys/systm.h>
...@@ -42,6 +44,19 @@...@@ -42,6 +44,19 @@
4244
43#define GHCB_MAX 0xFFF45#define GHCB_MAX 0xFFF
4446
47#endif /* !_LOCORE */
48
49/* Definitions used with the MSR protocol */
50#define MSR_PROTO_CPUID_REQ 0x4
51#define MSR_PROTO_CPUID_RESP 0x5
52#define MSR_PROTO_PREFERRED_GHCB_PA_REQ 0x10
53#define MSR_PROTO_PREFERRED_GHCB_PA_RESP 0x11
54#define MSR_PROTO_REGISTER_GHCB_PA_REQ 0x12
55#define MSR_PROTO_REGISTER_GHCB_PA_RESP 0x13
56#define MSR_PROTO_TERMINATION_REQ 0x100
57
58#ifndef _LOCORE
59
45struct ghcb_sa {60struct ghcb_sa {
46 uint8_t v_pad0[0xcb]; /* 000h-0CAh */61 uint8_t v_pad0[0xcb]; /* 000h-0CAh */
47 uint8_t v_cpl; /* 0CBh */62 uint8_t v_cpl; /* 0CBh */
...@@ -102,14 +117,6 @@ struct ghcb_sync {...@@ -102,14 +117,6 @@ struct ghcb_sync {
102 int sz_c;117 int sz_c;
103 int sz_d;118 int sz_d;
104};119};
105#endif /* !_LOCORE */
106
107/* Definitions used with the MSR protocol */
108#define MSR_PROTO_CPUID_REQ 0x4
109#define MSR_PROTO_CPUID_RESP 0x5
110#define MSR_PROTO_TERMINATE 0x100
111
112#ifndef _LOCORE
113120
114extern vaddr_t ghcb_vaddr;121extern vaddr_t ghcb_vaddr;
115extern paddr_t ghcb_paddr;122extern paddr_t ghcb_paddr;
...@@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v)...@@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v)
249256
250#endif /* !_LOCORE */257#endif /* !_LOCORE */
251258
259#else /* !AMDSEV */
260
261/* Definitions used with the MSR protocol */
262#define MSR_PROTO_TERMINATION_REQ 0x100
263
264#endif /* AMDSEV */
265
252#endif /* !_MACHINE_GHCB_H_ */266#endif /* !_MACHINE_GHCB_H_ */
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/i82489reg.h+33-4
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */1/* $OpenBSD: i82489reg.h,v 1.9 2026/09/19 16:11:07 mlarkin Exp $ */
2/* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */2/* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
33
4/*-4/*-
...@@ -73,6 +73,8 @@...@@ -73,6 +73,8 @@
73#define LAPIC_IRR 0x20073#define LAPIC_IRR 0x200
74#define LAPIC_ESR 0x280 /* Err status. R */74#define LAPIC_ESR 0x280 /* Err status. R */
7575
76#define LAPIC_LVT_CMCI 0x2f0 /* Corrected machine chk LVT */
77
76#define LAPIC_ICRLO 0x300 /* Int. cmd. RW */78#define LAPIC_ICRLO 0x300 /* Int. cmd. RW */
77# define LAPIC_DLMODE_MASK 0x0000070079# define LAPIC_DLMODE_MASK 0x00000700
78# define LAPIC_DLMODE_FIXED 0x0000000080# define LAPIC_DLMODE_FIXED 0x00000000
...@@ -82,6 +84,7 @@...@@ -82,6 +84,7 @@
82# define LAPIC_DLMODE_NMI 0x0000040084# define LAPIC_DLMODE_NMI 0x00000400
83# define LAPIC_DLMODE_INIT 0x0000050085# define LAPIC_DLMODE_INIT 0x00000500
84# define LAPIC_DLMODE_STARTUP 0x0000060086# define LAPIC_DLMODE_STARTUP 0x00000600
87# define LAPIC_DLMODE_EXTINT 0x00000700
8588
86# define LAPIC_DSTMODE_LOG 0x0000080089# define LAPIC_DSTMODE_LOG 0x00000800
8790
...@@ -110,11 +113,12 @@...@@ -110,11 +113,12 @@
110# define LAPIC_LVTT_VEC_MASK 0x000000ff113# define LAPIC_LVTT_VEC_MASK 0x000000ff
111# define LAPIC_LVTT_DS 0x00001000114# define LAPIC_LVTT_DS 0x00001000
112# define LAPIC_LVTT_M 0x00010000115# define LAPIC_LVTT_M 0x00010000
113# define LAPIC_LVTT_TM 0x00020000116# define LAPIC_LVTT_TM 0x00060000
114# define LAPIC_LVTT_TM_ONESHOT 0x00000000117# define LAPIC_LVTT_TM_ONESHOT 0x00000000
115# define LAPIC_LVTT_TM_PERIODIC 0x00020000118# define LAPIC_LVTT_TM_PERIODIC 0x00020000
116# define LAPIC_LVTT_TM_TSCDL 0x00040000119# define LAPIC_LVTT_TM_TSCDL 0x00040000
117120
121#define LAPIC_LVT_THERM 0x330 /* Thermal sensor LVT */
118#define LAPIC_PCINT 0x340122#define LAPIC_PCINT 0x340
119#define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */123#define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */
120# define LAPIC_LVT_PERIODIC 0x00020000124# define LAPIC_LVT_PERIODIC 0x00020000
...@@ -144,6 +148,31 @@...@@ -144,6 +148,31 @@
144#define LAPIC_IRQ_MASK(i) (1 << ((i) + 1))148#define LAPIC_IRQ_MASK(i) (1 << ((i) + 1))
145149
146#define MSR_X2APIC_BASE 0x800150#define MSR_X2APIC_BASE 0x800
147#define MSR_X2APIC_EOI (MSR_X2APIC_BASE+0x0b) /* End Int. W */151#define MSR_X2APIC_END 0x83f
148#define MSR_X2APIC_ID (MSR_X2APIC_BASE+0x02) /* ID. RW */152#define MSR_X2APIC_ID (MSR_X2APIC_BASE + 0x02) /* ID. R */
153#define MSR_X2APIC_VERSION (MSR_X2APIC_BASE + 0x03) /* Version. R */
154#define MSR_X2APIC_TPR (MSR_X2APIC_BASE + 0x08) /* Task prio. RW */
155#define MSR_X2APIC_PPR (MSR_X2APIC_BASE + 0x0a) /* Processor prio. R */
156#define MSR_X2APIC_EOI (MSR_X2APIC_BASE + 0x0b) /* End Int. W */
157#define MSR_X2APIC_LDR (MSR_X2APIC_BASE + 0x0d) /* Logical dest. R */
158#define MSR_X2APIC_SVR (MSR_X2APIC_BASE + 0x0f) /* Spurious intvec RW */
159#define MSR_X2APIC_ISR0 (MSR_X2APIC_BASE + 0x10) /* ISR 31:0. R */
160#define MSR_X2APIC_ISR7 (MSR_X2APIC_BASE + 0x17) /* ISR 255:224. R */
161#define MSR_X2APIC_TMR0 (MSR_X2APIC_BASE + 0x18) /* TMR 31:0. R */
162#define MSR_X2APIC_TMR7 (MSR_X2APIC_BASE + 0x1f) /* TMR 255:224. R */
163#define MSR_X2APIC_IRR0 (MSR_X2APIC_BASE + 0x20) /* IRR 31:0. R */
164#define MSR_X2APIC_IRR7 (MSR_X2APIC_BASE + 0x27) /* IRR 255:224. R */
165#define MSR_X2APIC_ESR (MSR_X2APIC_BASE + 0x28) /* Error status RW */
166#define MSR_X2APIC_LVT_CMCI (MSR_X2APIC_BASE + 0x2f) /* CMCI LVT. RW */
167#define MSR_X2APIC_ICR (MSR_X2APIC_BASE + 0x30) /* ICR. RW */
168#define MSR_X2APIC_LVT_TIMER (MSR_X2APIC_BASE + 0x32) /* Timer LVT. RW */
169#define MSR_X2APIC_LVT_THERM (MSR_X2APIC_BASE + 0x33) /* Thermal LVT. RW */
170#define MSR_X2APIC_LVT_PCINT (MSR_X2APIC_BASE + 0x34) /* Perf LVT. RW */
171#define MSR_X2APIC_LVT_LINT0 (MSR_X2APIC_BASE + 0x35) /* LINT0 LVT. RW */
172#define MSR_X2APIC_LVT_LINT1 (MSR_X2APIC_BASE + 0x36) /* LINT1 LVT. RW */
173#define MSR_X2APIC_LVT_ERROR (MSR_X2APIC_BASE + 0x37) /* Error LVT. RW */
174#define MSR_X2APIC_TIMER_ICR (MSR_X2APIC_BASE + 0x38) /* Initial count RW */
175#define MSR_X2APIC_TIMER_CCR (MSR_X2APIC_BASE + 0x39) /* Current count R */
176#define MSR_X2APIC_TIMER_DCR (MSR_X2APIC_BASE + 0x3e) /* Divisor config RW */
177#define MSR_X2APIC_SELF_IPI (MSR_X2APIC_BASE + 0x3f) /* Self IPI. W */
149#define X2APIC_ID_MASK 0xff178#define X2APIC_ID_MASK 0xff
\ No newline at end of file
lib/libc/include/x86_64-openbsd-none/machine/pci_machdep.h+2-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pci_machdep.h,v 1.32 2025/01/23 11:24:34 kettenis Exp $ */1/* $OpenBSD: pci_machdep.h,v 1.33 2026/07/25 22:57:22 chris Exp $ */
2/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */2/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
33
4/*4/*
...@@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int);...@@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int);
104104
105void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int);105void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int);
106pci_chipset_tag_t pci_lookup_segment(int, int);106pci_chipset_tag_t pci_lookup_segment(int, int);
107int acpipci_domain_to_seg(int);
107108
108#define __HAVE_PCI_MSIX109#define __HAVE_PCI_MSIX
109110
lib/libc/include/x86_64-openbsd-none/machine/pmap.h+23-18
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: pmap.h,v 1.94 2025/07/07 00:55:15 jsg Exp $ */1/* $OpenBSD: pmap.h,v 1.95 2026/06/04 05:22:04 mlarkin Exp $ */
2/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */2/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */
33
4/*4/*
...@@ -92,11 +92,8 @@...@@ -92,11 +92,8 @@
92 * The other levels are kept as physical pages in 3 UVM objects and are92 * The other levels are kept as physical pages in 3 UVM objects and are
93 * temporarily mapped for virtual access when needed.93 * temporarily mapped for virtual access when needed.
94 *94 *
95 * The other obvious difference from i386 is that it has a direct map of all95 * The other obvious difference from i386 is that it has a direct map of
96 * physical memory in the VA range:96 * physical memory in a randomized VA subrange of the direct-map window.
97 *
98 * 0xfffffd8000000000 - 0xffffff7fffffffff
99 *
100 * The direct map is used in some cases to access PTEs of non-current pmaps.97 * The direct map is used in some cases to access PTEs of non-current pmaps.
101 *98 *
102 * Note that address space is signed, so the layout for 48 bits is:99 * Note that address space is signed, so the layout for 48 bits is:
...@@ -104,8 +101,8 @@...@@ -104,8 +101,8 @@
104 * +---------------------------------+ 0xffffffffffffffff101 * +---------------------------------+ 0xffffffffffffffff
105 * | Kernel Image |102 * | Kernel Image |
106 * +---------------------------------+ 0xffffff8000000000103 * +---------------------------------+ 0xffffff8000000000
107 * | Direct Map |104 * | Direct Map Window |
108 * +---------------------------------+ 0xfffffd8000000000105 * +---------------------------------+ 0xffffee0000000000
109 * ~ ~106 * ~ ~
110 * | |107 * | |
111 * | Kernel Space |108 * | Kernel Space |
...@@ -139,13 +136,23 @@...@@ -139,13 +136,23 @@
139 */136 */
140#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK)137#define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK)
141138
142#define L4_SLOT_PTE 255139#define L4_SLOT_PTE 255
143#define L4_SLOT_KERN 256140#define L4_SLOT_KERN 256
144#define L4_SLOT_KERNBASE 511141#define L4_SLOT_KERNBASE 511
145#define NUM_L4_SLOT_DIRECT 4142#define DIRECT_MAP_PML4_SLOTS 4
146#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - NUM_L4_SLOT_DIRECT)143#define DIRECT_MAP_START_CHOICES 32
144#define DIRECT_MAP_START_MASK (DIRECT_MAP_START_CHOICES - 1)
145#define DIRECT_MAP_RESERVED_PML4_SLOTS (DIRECT_MAP_PML4_SLOTS + \
146 DIRECT_MAP_START_CHOICES - 1)
147#define DIRECT_MAP_SIZE ((vaddr_t)DIRECT_MAP_PML4_SLOTS * NBPD_L4)
148#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - \
149 DIRECT_MAP_RESERVED_PML4_SLOTS)
147#define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1)150#define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1)
148151
152#if (DIRECT_MAP_START_CHOICES & DIRECT_MAP_START_MASK) != 0
153#error DIRECT_MAP_START_CHOICES must be a power of two
154#endif
155
149#define PDIR_SLOT_KERN L4_SLOT_KERN156#define PDIR_SLOT_KERN L4_SLOT_KERN
150#define PDIR_SLOT_PTE L4_SLOT_PTE157#define PDIR_SLOT_PTE L4_SLOT_PTE
151#define PDIR_SLOT_DIRECT L4_SLOT_DIRECT158#define PDIR_SLOT_DIRECT L4_SLOT_DIRECT
...@@ -160,9 +167,7 @@...@@ -160,9 +167,7 @@
160 */167 */
161168
162#define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))169#define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))
163#define PMAP_DIRECT_BASE (VA_SIGN_NEG((L4_SLOT_DIRECT * NBPD_L4)))170extern vaddr_t pmap_direct_base, pmap_direct_end;
164#define PMAP_DIRECT_END (VA_SIGN_NEG(((L4_SLOT_DIRECT + \
165 NUM_L4_SLOT_DIRECT) * NBPD_L4)))
166171
167#define L1_BASE PTE_BASE172#define L1_BASE PTE_BASE
168173
...@@ -498,8 +503,8 @@ kvtopte(vaddr_t va)...@@ -498,8 +503,8 @@ kvtopte(vaddr_t va)
498 return (PTE_BASE + pl1_i(va));503 return (PTE_BASE + pl1_i(va));
499}504}
500505
501#define PMAP_DIRECT_MAP(pa) ((vaddr_t)PMAP_DIRECT_BASE + (pa))506#define PMAP_DIRECT_MAP(pa) ((vaddr_t)pmap_direct_base + (pa))
502#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - PMAP_DIRECT_BASE)507#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base)
503#define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg))508#define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg))
504#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va))509#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va))
505510
lib/libc/include/x86_64-openbsd-none/machine/specialreg.h+19-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */1/* $OpenBSD: specialreg.h,v 1.129 2026/09/19 16:11:07 mlarkin 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
...@@ -281,6 +281,11 @@...@@ -281,6 +281,11 @@
281 ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \281 ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \
282 "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" )282 "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" )
283283
284/* SEFF subleaf 2 EDX bits */
285#define SEFF2EDX_BHI_CTRL 0x00000010 /* BHI_DIS_S supported */
286#define SEFF2_EDX_BITS \
287 ("\20" "\05BHI_CTRL" )
288
284/*289/*
285 * Thermal and Power Management (CPUID function 0x6) EAX bits290 * Thermal and Power Management (CPUID function 0x6) EAX bits
286 */291 */
...@@ -465,6 +470,7 @@...@@ -465,6 +470,7 @@
465#define APICBASE_BSP 0x100470#define APICBASE_BSP 0x100
466#define APICBASE_ENABLE_X2APIC 0x400471#define APICBASE_ENABLE_X2APIC 0x400
467#define APICBASE_GLOBAL_ENABLE 0x800472#define APICBASE_GLOBAL_ENABLE 0x800
473#define APICBASE_ADDRESS_MASK 0x000ffffffffff000ULL
468#define MSR_EBL_CR_POWERON 0x02a474#define MSR_EBL_CR_POWERON 0x02a
469#define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */475#define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */
470#define MSR_TEST_CTL 0x033476#define MSR_TEST_CTL 0x033
...@@ -474,6 +480,7 @@...@@ -474,6 +480,7 @@
474#define SPEC_CTRL_IBRS (1ULL << 0)480#define SPEC_CTRL_IBRS (1ULL << 0)
475#define SPEC_CTRL_STIBP (1ULL << 1)481#define SPEC_CTRL_STIBP (1ULL << 1)
476#define SPEC_CTRL_SSBD (1ULL << 2)482#define SPEC_CTRL_SSBD (1ULL << 2)
483#define SPEC_CTRL_BHI_DIS_S (1ULL << 10)
477#define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */484#define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */
478#define PRED_CMD_IBPB (1ULL << 0)485#define PRED_CMD_IBPB (1ULL << 0)
479#define MSR_BIOS_UPDT_TRIG 0x079486#define MSR_BIOS_UPDT_TRIG 0x079
...@@ -710,6 +717,9 @@...@@ -710,6 +717,9 @@
710#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */717#define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */
711#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */718#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */
712719
720#define MSR_BP_CFG 0xc001102e
721#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */
722
713#define IPM_C1E_CMP_HLT 0x10000000723#define IPM_C1E_CMP_HLT 0x10000000
714#define IPM_SMI_CMP_HLT 0x08000000724#define IPM_SMI_CMP_HLT 0x08000000
715725
...@@ -734,6 +744,7 @@...@@ -734,6 +744,7 @@
734#define MSR_SEV_STATUS 0xc0010131744#define MSR_SEV_STATUS 0xc0010131
735#define SEV_STAT_ENABLED 0x00000001745#define SEV_STAT_ENABLED 0x00000001
736#define SEV_STAT_ES_ENABLED 0x00000002746#define SEV_STAT_ES_ENABLED 0x00000002
747#define SEV_STAT_SNP_ACTIVE 0x00000004
737748
738#define MSR_LS_CFG 0xc0011020749#define MSR_LS_CFG 0xc0011020
739#define LS_CFG_DIS_LS2_SQUISH 0x02000000750#define LS_CFG_DIS_LS2_SQUISH 0x02000000
...@@ -1357,6 +1368,8 @@...@@ -1357,6 +1368,8 @@
1357#define VMCS_GUEST_IA32_LDTR_AR 0x48201368#define VMCS_GUEST_IA32_LDTR_AR 0x4820
1358#define VMCS_GUEST_IA32_TR_AR 0x48221369#define VMCS_GUEST_IA32_TR_AR 0x4822
1359#define VMCS_GUEST_INTERRUPTIBILITY_ST 0x48241370#define VMCS_GUEST_INTERRUPTIBILITY_ST 0x4824
1371#define VMX_INT_STATE_BLOCK_STI (1 << 0)
1372#define VMX_INT_STATE_BLOCK_MOVSS (1 << 1)
1360#define VMCS_GUEST_ACTIVITY_STATE 0x48261373#define VMCS_GUEST_ACTIVITY_STATE 0x4826
1361#define VMCS_GUEST_SMBASE 0x48281374#define VMCS_GUEST_SMBASE 0x4828
1362#define VMCS_GUEST_IA32_SYSENTER_CS 0x482A1375#define VMCS_GUEST_IA32_SYSENTER_CS 0x482A
...@@ -1405,6 +1418,8 @@...@@ -1405,6 +1418,8 @@
1405#define VMCS_GUEST_IA32_SYSENTER_ESP 0x68241418#define VMCS_GUEST_IA32_SYSENTER_ESP 0x6824
1406#define VMCS_GUEST_IA32_SYSENTER_EIP 0x68261419#define VMCS_GUEST_IA32_SYSENTER_EIP 0x6826
1407#define VMCS_GUEST_IA32_S_CET 0x68281420#define VMCS_GUEST_IA32_S_CET 0x6828
1421#define VMCS_GUEST_SSP 0x682A
1422#define VMCS_GUEST_IA32_INTR_SSP_TABLE 0x682C
14081423
1409/* Natural-width host state fields */1424/* Natural-width host state fields */
1410#define VMCS_HOST_IA32_CR0 0x6C001425#define VMCS_HOST_IA32_CR0 0x6C00
...@@ -1420,6 +1435,8 @@...@@ -1420,6 +1435,8 @@
1420#define VMCS_HOST_IA32_RSP 0x6C141435#define VMCS_HOST_IA32_RSP 0x6C14
1421#define VMCS_HOST_IA32_RIP 0x6C161436#define VMCS_HOST_IA32_RIP 0x6C16
1422#define VMCS_HOST_IA32_S_CET 0x6C181437#define VMCS_HOST_IA32_S_CET 0x6C18
1438#define VMCS_HOST_SSP 0x6C1A
1439#define VMCS_HOST_IA32_INTR_SSP_TABLE 0x6C1C
14231440
1424#define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x01441#define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x0
1425#define IA32_VMX_INVVPID_SINGLE_CTX 0x11442#define IA32_VMX_INVVPID_SINGLE_CTX 0x1
...@@ -1450,6 +1467,7 @@...@@ -1450,6 +1467,7 @@
1450#define MSR_AMD_VM_HSAVE_PA 0xc00101171467#define MSR_AMD_VM_HSAVE_PA 0xc0010117
1451#define CPUID_AMD_SVM_CAP 0x8000000A1468#define CPUID_AMD_SVM_CAP 0x8000000A
1452#define AMD_SVM_NESTED_PAGING_CAP (1 << 0)1469#define AMD_SVM_NESTED_PAGING_CAP (1 << 0)
1470#define AMD_SVM_NRIP_SAVE_CAP (1 << 3)
1453#define AMD_SVM_VMCB_CLEAN_CAP (1 << 5)1471#define AMD_SVM_VMCB_CLEAN_CAP (1 << 5)
1454#define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6)1472#define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6)
1455#define AMD_SVM_DECODE_ASSIST_CAP (1 << 7)1473#define AMD_SVM_DECODE_ASSIST_CAP (1 << 7)
lib/libc/include/x86_64-openbsd-none/machine/vmmvar.h+29-11
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmmvar.h,v 1.117 2025/09/17 18:37:44 sf Exp $ */1/* $OpenBSD: vmmvar.h,v 1.123 2026/09/22 08:21:39 mlarkin Exp $ */
2/*2/*
3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>3 * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
4 *4 *
...@@ -23,6 +23,8 @@...@@ -23,6 +23,8 @@
2323
24#ifndef _LOCORE24#ifndef _LOCORE
2525
26struct vm;
27
26#define VMM_HV_SIGNATURE "OpenBSDVMM58"28#define VMM_HV_SIGNATURE "OpenBSDVMM58"
2729
28/* VMX: Basic Exit Reasons */30/* VMX: Basic Exit Reasons */
...@@ -87,6 +89,8 @@...@@ -87,6 +89,8 @@
87#define VMX_EXIT_XSAVES 6389#define VMX_EXIT_XSAVES 63
88#define VMX_EXIT_XRSTORS 6490#define VMX_EXIT_XRSTORS 64
8991
92#define VM_EXIT_APICBASE 0xFFFC
93#define VM_EXIT_X2APIC 0xFFFD
90#define VM_EXIT_TERMINATED 0xFFFE94#define VM_EXIT_TERMINATED 0xFFFE
91#define VM_EXIT_NONE 0xFFFF95#define VM_EXIT_NONE 0xFFFF
9296
...@@ -348,10 +352,25 @@ struct vm_exit_inout {...@@ -348,10 +352,25 @@ struct vm_exit_inout {
348struct vm_exit_eptviolation {352struct vm_exit_eptviolation {
349 uint8_t vee_fault_type; /* type of vm exit */353 uint8_t vee_fault_type; /* type of vm exit */
350 uint8_t vee_insn_info; /* bitfield */354 uint8_t vee_insn_info; /* bitfield */
351#define VEE_LEN_VALID 0x1 /* vee_insn_len is valid */355#define VEE_LEN_VALID (1 << 0) /* vee_insn_len is valid */
352#define VEE_BYTES_VALID 0x2 /* vee_insn_bytes is valid */356#define VEE_BYTES_VALID (1 << 1) /* vee_insn_bytes is valid */
357#define VEE_GPA_VALID (1 << 2) /* vee_gpa is valid */
353 uint8_t vee_insn_len; /* [VMX] instruction length */358 uint8_t vee_insn_len; /* [VMX] instruction length */
354 uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */359 uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */
360 uint64_t vee_gpa; /* GPA that caused the fault */
361};
362
363/* Userspace-assisted x2APIC MSR access. */
364struct vm_exit_x2apic {
365 uint32_t vex_msr;
366 uint8_t vex_write;
367 uint8_t vex_pad[3];
368 uint64_t vex_data;
369};
370
371/* Guest-visible IA32_APIC_BASE mode change. */
372struct vm_exit_apicbase {
373 uint64_t vea_value;
355};374};
356375
357/*376/*
...@@ -469,6 +488,8 @@ struct vm_exit {...@@ -469,6 +488,8 @@ struct vm_exit {
469 union {488 union {
470 struct vm_exit_inout vei; /* IN/OUT exit */489 struct vm_exit_inout vei; /* IN/OUT exit */
471 struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/490 struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/
491 struct vm_exit_apicbase vea; /* APICBASE mode exit */
492 struct vm_exit_x2apic vex; /* x2APIC MSR exit */
472 };493 };
473494
474 struct vcpu_reg_state vrs;495 struct vcpu_reg_state vrs;
...@@ -477,7 +498,6 @@ struct vm_exit {...@@ -477,7 +498,6 @@ struct vm_exit {
477498
478struct vm_intr_params {499struct vm_intr_params {
479 /* Input parameters to VMM_IOC_INTR */500 /* Input parameters to VMM_IOC_INTR */
480 uint32_t vip_vm_id;
481 uint32_t vip_vcpu_id;501 uint32_t vip_vcpu_id;
482 uint16_t vip_intr;502 uint16_t vip_intr;
483};503};
...@@ -495,7 +515,6 @@ struct vm_rwregs_params {...@@ -495,7 +515,6 @@ struct vm_rwregs_params {
495 * Input/output parameters to VMM_IOC_READREGS /515 * Input/output parameters to VMM_IOC_READREGS /
496 * VMM_IOC_WRITEREGS516 * VMM_IOC_WRITEREGS
497 */517 */
498 uint32_t vrwp_vm_id;
499 uint32_t vrwp_vcpu_id;518 uint32_t vrwp_vcpu_id;
500 uint64_t vrwp_mask;519 uint64_t vrwp_mask;
501 struct vcpu_reg_state vrwp_regs;520 struct vcpu_reg_state vrwp_regs;
...@@ -522,7 +541,6 @@ struct vm_rwregs_params {...@@ -522,7 +541,6 @@ struct vm_rwregs_params {
522 * direct cache access (CPUIDECX_DCA)541 * direct cache access (CPUIDECX_DCA)
523 * x2APIC (CPUIDECX_X2APIC)542 * x2APIC (CPUIDECX_X2APIC)
524 * apic deadline (CPUIDECX_DEADLINE)543 * apic deadline (CPUIDECX_DEADLINE)
525 * apic (CPUID_APIC)
526 * psn (CPUID_PSN)544 * psn (CPUID_PSN)
527 * self snoop (CPUID_SS)545 * self snoop (CPUID_SS)
528 * hyperthreading (CPUID_HTT)546 * hyperthreading (CPUID_HTT)
...@@ -537,7 +555,7 @@ struct vm_rwregs_params {...@@ -537,7 +555,7 @@ struct vm_rwregs_params {
537 CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE)555 CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE)
538#define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX)556#define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX)
539#define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \557#define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \
540 CPUID_HTT | CPUID_DS | CPUID_APIC | \558 CPUID_HTT | CPUID_DS | \
541 CPUID_PSN | CPUID_SS | CPUID_PBE | \559 CPUID_PSN | CPUID_SS | CPUID_PBE | \
542 CPUID_MTRR | CPUID_MCE | CPUID_MCA)560 CPUID_MTRR | CPUID_MCE | CPUID_MCA)
543#define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \561#define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \
...@@ -976,6 +994,7 @@ struct vcpu {...@@ -976,6 +994,7 @@ struct vcpu {
976 struct vm_exit vc_exit; /* [v] */994 struct vm_exit vc_exit; /* [v] */
977995
978 uint16_t vc_intr; /* [v] */996 uint16_t vc_intr; /* [v] */
997 u_int vc_intr_latch; /* [a] */
979 uint8_t vc_irqready; /* [v] */998 uint8_t vc_irqready; /* [v] */
980999
981 uint8_t vc_fpuinited; /* [v] */1000 uint8_t vc_fpuinited; /* [v] */
...@@ -991,6 +1010,7 @@ struct vcpu {...@@ -991,6 +1010,7 @@ struct vcpu {
9911010
992 /* Shadowed MSRs */1011 /* Shadowed MSRs */
993 uint64_t vc_shadow_pat; /* [v] */1012 uint64_t vc_shadow_pat; /* [v] */
1013 uint64_t vc_apicbase; /* [v] */
9941014
995 /* Userland Protection Keys */1015 /* Userland Protection Keys */
996 uint32_t vc_pkru; /* [v] */1016 uint32_t vc_pkru; /* [v] */
...@@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *);...@@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *);
1056int vmm_probe_machdep(struct device *, void *, void *);1076int vmm_probe_machdep(struct device *, void *, void *);
1057void vmm_attach_machdep(struct device *, struct device *, void *);1077void vmm_attach_machdep(struct device *, struct device *, void *);
1058void vmm_activate_machdep(struct device *, int);1078void vmm_activate_machdep(struct device *, int);
1059int vmmioctl_machdep(dev_t, u_long, caddr_t, int, struct proc *);
1060int pledge_ioctl_vmm_machdep(struct proc *, long);
1061int vmm_start(void);1079int vmm_start(void);
1062int vmm_stop(void);1080int vmm_stop(void);
1063int vm_impl_init(struct vm *, struct proc *);1081int vm_impl_init(struct vm *, struct proc *);
1064void vm_impl_deinit(struct vm *);1082void vm_impl_deinit(struct vm *);
1065int vcpu_init(struct vcpu *, struct vm_create_params *);1083int vcpu_init(struct vcpu *, struct vm_create_params *);
1066void vcpu_deinit(struct vcpu *);1084void vcpu_deinit(struct vcpu *);
1067int vm_rwregs(struct vm_rwregs_params *, int);1085int vm_rwregs(struct vm *, struct vm_rwregs_params *, int);
1068int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *);1086int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *);
1069int svm_get_vmsa_pa(uint32_t, uint32_t, uint64_t *);1087int svm_get_vmsa_pa(struct proc *, struct file *, uint32_t, uint64_t *);
10701088
1071#endif /* _KERNEL */1089#endif /* _KERNEL */
10721090
lib/libc/include/x86_64-openbsd-none/machine/vmparam.h+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1/* $OpenBSD: vmparam.h,v 1.25 2024/11/08 01:44:52 jsg Exp $ */1/* $OpenBSD: vmparam.h,v 1.26 2026/06/22 00:27:33 jsg Exp $ */
2/* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */2/* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */
33
4/*-4/*-
...@@ -98,7 +98,7 @@...@@ -98,7 +98,7 @@
98#define VM_MIN_STACK_ADDRESS 0x000060000000000098#define VM_MIN_STACK_ADDRESS 0x0000600000000000
99#endif99#endif
100#define VM_MIN_KERNEL_ADDRESS 0xffff800000000000100#define VM_MIN_KERNEL_ADDRESS 0xffff800000000000
101#define VM_MAX_KERNEL_ADDRESS 0xffff800100000000101#define VM_MAX_KERNEL_ADDRESS 0xffff808000000000
102102
103/* map PIE into approximately the first quarter of user va space */103/* map PIE into approximately the first quarter of user va space */
104#define VM_PIE_MIN_ADDR VM_MIN_ADDRESS104#define VM_PIE_MIN_ADDR VM_MIN_ADDRESS
tools/process_headers.zig-2
...@@ -108,7 +108,6 @@ const openbsd_targets = [_]LibCTarget{...@@ -108,7 +108,6 @@ const openbsd_targets = [_]LibCTarget{
108 .{ .arch = .arm, .abi = .eabi },108 .{ .arch = .arm, .abi = .eabi },
109 .{ .arch = .aarch64, .abi = .none },109 .{ .arch = .aarch64, .abi = .none },
110 .{ .arch = .mips64, .abi = .none },110 .{ .arch = .mips64, .abi = .none },
111 .{ .arch = .mips64el, .abi = .none },
112 .{ .arch = .powerpc, .abi = .eabihf },111 .{ .arch = .powerpc, .abi = .eabihf },
113 .{ .arch = .powerpc64, .abi = .none },112 .{ .arch = .powerpc64, .abi = .none },
114 .{ .arch = .riscv64, .abi = .none },113 .{ .arch = .riscv64, .abi = .none },
...@@ -238,7 +237,6 @@ pub fn main(init: std.process.Init) !void {...@@ -238,7 +237,6 @@ pub fn main(init: std.process.Init) !void {
238 .arm => "armv7",237 .arm => "armv7",
239 .aarch64 => "arm64",238 .aarch64 => "arm64",
240 .mips64 => "octeon",239 .mips64 => "octeon",
241 .mips64el => "loongson",
242 .powerpc => "macppc",240 .powerpc => "macppc",
243 .x86 => "i386",241 .x86 => "i386",
244 .x86_64 => "amd64",242 .x86_64 => "amd64",