diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/_types.h b/lib/libc/include/aarch64-openbsd-none/arm64/_types.h index 2de0c9d512a5cd8909f2554e476c0b32d5a29a6c..771a22bfda18eddb09cb53f2481cffed03f1ea7e 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/_types.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.6 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.7 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -123,11 +123,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/armreg.h b/lib/libc/include/aarch64-openbsd-none/arm64/armreg.h index 7483ae8dd70dfe08ce0937eca6d89902fba892cd..941fed486708b7b047ac227701d513f94e053156 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/armreg.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/armreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armreg.h,v 1.44 2025/07/22 09:20:41 kettenis Exp $ */ +/* $OpenBSD: armreg.h,v 1.45 2026/05/04 20:43:42 kettenis Exp $ */ /*- * Copyright (c) 2013, 2014 Andrew Turner * Copyright (c) 2015 The FreeBSD Foundation @@ -119,6 +119,14 @@ #define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT) #define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT) +/* CurrentEL - Current Exception Level */ +#define CURRENTEL_EL_SHIFT 2 +#define CURRENTEL_EL_MASK (0x3 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL0 (0x0 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL1 (0x1 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL2 (0x2 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL3 (0x3 << CURRENTEL_EL_SHIFT) + /* MPIDR_EL1 - Multiprocessor Affinity Register */ #define MPIDR_AFF3 (0xFFULL << 32) #define MPIDR_AFF2 (0xFFULL << 16) diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/bus.h b/lib/libc/include/aarch64-openbsd-none/arm64/bus.h index 70ad145593e80527ec3be3aa799403b1d0f88d5e..a359fa758b64422295c45787bf999d2b20fc2905 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/bus.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.11 2024/11/18 05:32:39 jsg Exp $ */ +/* $OpenBSD: bus.h,v 1.13 2026/06/22 07:54:19 deraadt Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. * @@ -349,8 +349,8 @@ struct uio; #define BUS_DMASYNC_PREREAD 0x0004 #define BUS_DMASYNC_PREWRITE 0x0008 -typedef struct machine_bus_dma_tag *bus_dma_tag_t; -typedef struct machine_bus_dmamap *bus_dmamap_t; +typedef struct bus_dma_tag *bus_dma_tag_t; +typedef struct bus_dmamap *bus_dmamap_t; /* * bus_dma_segment_t @@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t; * Describes a single contiguous DMA transaction. Values * are suitable for programming into DMA registers. */ -struct machine_bus_dma_segment { +struct bus_dma_segment { bus_addr_t ds_addr; /* DMA address */ bus_size_t ds_len; /* length of transfer */ paddr_t _ds_paddr; /* CPU address */ vaddr_t _ds_vaddr; /* CPU address */ + vaddr_t _ds_bounce_va; /* mapped bounced data */ }; -typedef struct machine_bus_dma_segment bus_dma_segment_t; +typedef struct bus_dma_segment bus_dma_segment_t; /* * bus_dma_tag_t @@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t; * DMA for a given bus. */ -struct machine_bus_dma_tag { +struct bus_dma_tag { void *_cookie; /* cookie used in the guts */ int _flags; /* misc. flags */ @@ -393,7 +394,8 @@ struct machine_bus_dma_tag { int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, + int *, int *, int); void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -451,6 +453,8 @@ struct machine_bus_dma_tag { #define bus_dmamem_mmap(t, sg, n, o, p, f) \ (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) +void bus_dma_init(void); + int _dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _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); int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, int *, + int *, int); void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, 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, * * Describes a DMA mapping. */ -struct machine_bus_dmamap { +struct bus_dmamap { /* * PRIVATE MEMBERS: not for use by machine-independent code. */ @@ -493,6 +498,11 @@ struct machine_bus_dmamap { void *_dm_cookie; /* cookie for bus-specific functions */ + struct vm_page **_dm_pages; /* replacement pages */ + vaddr_t _dm_pgva; /* those above -- mapped */ + int _dm_npages; /* number of pages allocated */ + int _dm_nused; /* number of pages replaced */ + /* * PUBLIC MEMBERS: these are used by machine-independent code. */ diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/codepatch.h b/lib/libc/include/aarch64-openbsd-none/arm64/codepatch.h new file mode 100644 index 0000000000000000000000000000000000000000..849b50725410584d3addc86cb9e9a7dda433070e --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/arm64/codepatch.h @@ -0,0 +1,72 @@ +/* $OpenBSD: codepatch.h,v 1.1 2026/06/23 11:45:54 kettenis Exp $ */ +/* + * Copyright (c) 2014-2015 Stefan Fritsch + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_CODEPATCH_H_ +#define _MACHINE_CODEPATCH_H_ + +#include + +#ifndef _LOCORE + +/* code in this section will be unmapped after boot */ +#define __cptext __attribute__((section(".cptext"))) + +__cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest); +__cptext void codepatch_unmaprw(vaddr_t nva); +__cptext void codepatch_fill_nop(void *caddr, uint16_t len); +__cptext void codepatch_nop(uint16_t tag); +void codepatch_disable(void); + +#endif /* !_LOCORE */ + +/* + * Mark the start of some code snippet to be patched. + */ +#define CODEPATCH_START 998: +/* + * Mark the end of some code to be patched, and assign the given tag. + */ +#define CODEPATCH_END2(startnum,tag) \ + 999: \ + .section .codepatch, "a" ;\ + .quad startnum##b ;\ + .short (999b - startnum##b) ;\ + .short tag ;\ + .int 0 ;\ + .previous +#define CODEPATCH_END(tag) CODEPATCH_END2(998,tag) + +#define CPTAG_REPEAT_TLBI 1 + + +/* Would be neat if these could be in something like .cptext */ +#define CODEPATCH_CODE(symbol, instructions...) \ + .section .rodata; \ + .globl symbol; \ +symbol: instructions; \ + .size symbol, . - symbol + +/* provide a (short) variable with the length of the patch */ +#define CODEPATCH_CODE_LEN(symbol, instructions...) \ + CODEPATCH_CODE(symbol, instructions); \ +996: .globl symbol##_len; \ + .align 2; \ +symbol##_len: \ + .short 996b - symbol; \ + .size symbol##_len, 2 + +#endif /* _MACHINE_CODEPATCH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h b/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h index 172be4326fd49576fbd2335e2cb6498d56d919ef..1d396b8467afbe1989518872b5ceacaa4cdccf41 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.57 2026/09/06 20:02:12 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn * @@ -37,7 +37,8 @@ #define CPU_ID_AA64SMFR0 10 #define CPU_ID_AA64ZFR0 11 #define CPU_LIDACTION 12 -#define CPU_MAXID 13 /* number of valid machdep ids */ +#define CPU_LED_BLINK 13 /* int: blink leds? */ +#define CPU_MAXID 14 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -53,6 +54,7 @@ { "id_aa64smfr0", CTLTYPE_QUAD }, \ { "id_aa64zfr0", CTLTYPE_QUAD }, \ { "lidaction", CTLTYPE_INT }, \ + { "led_blink", CTLTYPE_INT }, \ } #ifdef _KERNEL @@ -200,6 +202,8 @@ struct cpu_info { #define CPUF_PRESENT (1<<4) #define CPUF_GO (1<<5) #define CPUF_RUNNING (1<<6) +#define CPUF_PARK (1<<7) +#define CPUF_PARKED (1<<8) static inline struct cpu_info * curcpu(void) @@ -357,6 +361,14 @@ void cpu_wfi(void); void delay (unsigned); #define DELAY(x) delay(x) +struct blink_led { + void (*bl_func)(void *, int); + void *bl_arg; + SLIST_ENTRY(blink_led) bl_next; +}; + +void blink_led_register(struct blink_led *); + #endif /* _KERNEL */ #ifdef MULTIPROCESSOR diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/hibernate.h b/lib/libc/include/aarch64-openbsd-none/arm64/hibernate.h new file mode 100644 index 0000000000000000000000000000000000000000..015fdcd1597f8eaa013b0a8c2028a3a673821e27 --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/arm64/hibernate.h @@ -0,0 +1,38 @@ +/* $OpenBSD: hibernate.h,v 1.1 2026/09/06 18:25:22 mglocker Exp $ */ + +/* + * Copyright (c) 2011 Mike Larkin + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +/* arm64 hibernate support structures and functions */ + +int get_hibernate_info_md(union hibernate_info *); +void hibernate_flush(void); +void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int); +int hibernate_inflate_skip(union hibernate_info *, paddr_t); +int hibernate_suspend(void); +void hibernate_switch_stack_machdep(void); +void hibernate_resume_machdep(vaddr_t); +void hibernate_activate_resume_pt_machdep(void); +void hibernate_enable_intr_machdep(void); +void hibernate_disable_intr_machdep(void); +#ifdef MULTIPROCESSOR +void hibernate_quiesce_cpus(void); +#endif /* MULTIPROCESSOR */ + +/* arm64-only extras (see hibernate_var.h for the piglet save layout) */ +void hibernate_dcache_flush_machdep(void); \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/hibernate_var.h b/lib/libc/include/aarch64-openbsd-none/arm64/hibernate_var.h new file mode 100644 index 0000000000000000000000000000000000000000..1eb26562b5ce455ec64cd7d8374a0bb7bc2a8e3d --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/arm64/hibernate_var.h @@ -0,0 +1,79 @@ +/* $OpenBSD: hibernate_var.h,v 1.2 2026/09/19 17:27:09 kettenis Exp $ */ + +/* + * Copyright (c) 2011 Mike Larkin + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LOCORE +extern vaddr_t global_piglet_va; +extern paddr_t global_piglet_pa; +#endif + +#define PIGLET_PAGE_MASK (~((1ULL << 21) - 1)) + +/* + * On arm64 the resume page tables use both TTBR0 and TTBR1. The + * TTBR0 (PT0) page tables start at L0 and cover the first 4MB of the + * piglet with 4KB pages (such that pages in the piglet can be + * accessed using their offset) and also covers identy mappings for + * the pig, the piglet and kernel using 2MB mappings. The TTBR1 (PT1) + * page tables covers mappings for the piglet and kernel using normal + * kernel VAs. + */ +#define HIBERNATE_PT0_L0_PAGE (PAGE_SIZE * 512) /* TTBR0 root */ +#define HIBERNATE_PT0_L1_LOW (PAGE_SIZE * 513) +#define HIBERNATE_PT0_L2_LOW (PAGE_SIZE * 514) +#define HIBERNATE_PT0_L3_LOW (PAGE_SIZE * 515) /* 2 pages */ +#define HIBERNATE_PT0_L1_HI (PAGE_SIZE * 517) +#define HIBERNATE_PT1_L1_PAGE (PAGE_SIZE * 518) /* TTBR1 root */ + +/* Pool of L2 pages per distinct PT0_L1_LOW/PT0_L1_HI/PT1_L1 slot */ +#define HIBERNATE_PT0_L2_LOW_POOL (PAGE_SIZE * 520) +#define HIBERNATE_PT0_L2_LOW_POOL_COUNT 16 +#define HIBERNATE_PT0_L2_HI_POOL (PAGE_SIZE * 536) +#define HIBERNATE_PT0_L2_HI_POOL_COUNT 16 +#define HIBERNATE_PT1_L2_POOL (PAGE_SIZE * 552) +#define HIBERNATE_PT1_L2_POOL_COUNT 16 + +/* 3 pages for stack */ +#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 570) + +#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 571) + +/* + * On arm64 we can't access low VA using the normal kernel page + * tables. Since the hiballoc page is used before we install the + * resume page tables, use the normal kernel VA for access. + */ +#define HIBERNATE_HIBALLOC_PAGE (global_piglet_va + PAGE_SIZE * 572) + +/* Use 4MB hibernation chunks */ +#define HIBERNATE_CHUNK_SIZE 0x400000 + +#define HIBERNATE_CHUNK_TABLE_SIZE 0x200000 + +#define HIBERNATE_STACK_OFFSET 0x0F00 + +/* + * Minimum amount of memory for hibernate support. This is used in early boot + * when deciding if we can preallocate the piglet. If the machine does not + * have at least HIBERNATE_MIN_MEMORY RAM, we won't support hibernate. This + * avoids late allocation issues due to fragmented memory and failure to + * hibernate. We need to be able to allocate 32MB contiguous memory, aligned + * to 2MB. + * + * The default minimum required memory is 512MB (1ULL << 29). + */ +#define HIBERNATE_MIN_MEMORY (1ULL << 29) \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/simplebusvar.h b/lib/libc/include/aarch64-openbsd-none/arm64/simplebusvar.h index be1336cf1fd4ba321e6e4eb532efd73cc0cbd0b4..a3fda16ece76743ae6f7b982089565cbb118e923 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/simplebusvar.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/simplebusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */ +/* $OpenBSD: simplebusvar.h,v 1.2 2026/06/22 07:54:19 deraadt Exp $ */ /* * Copyright (c) 2016 Patrick Wildt * @@ -25,7 +25,7 @@ struct simplebus_softc { int sc_pacells; int sc_pscells; struct bus_space sc_bus; - struct machine_bus_dma_tag sc_dma; + struct bus_dma_tag sc_dma; int *sc_ranges; int sc_rangeslen; int *sc_dmaranges; diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/vmmvar.h b/lib/libc/include/aarch64-openbsd-none/arm64/vmmvar.h index 7d156212804edf9de37feede5696c6b645c4013c..91f394a04de08f5b4b3b0de57a199e058bba49c2 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/vmmvar.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.3 2025/08/03 10:17:33 tb Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.4 2026/09/19 17:21:52 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -63,7 +63,6 @@ struct vm_exit { struct vm_intr_params { /* Input parameters to VMM_IOC_INTR */ - uint32_t vip_vm_id; uint32_t vip_vcpu_id; uint16_t vip_intr; }; @@ -76,7 +75,6 @@ struct vm_rwregs_params { * Input/output parameters to VMM_IOC_READREGS / * VMM_IOC_WRITEREGS */ - uint32_t vrwp_vm_id; uint32_t vrwp_vcpu_id; uint64_t vrwp_mask; struct vcpu_reg_state vrwp_regs; diff --git a/lib/libc/include/aarch64-openbsd-none/machine/_types.h b/lib/libc/include/aarch64-openbsd-none/machine/_types.h index 2de0c9d512a5cd8909f2554e476c0b32d5a29a6c..771a22bfda18eddb09cb53f2481cffed03f1ea7e 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/_types.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.6 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.7 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -123,11 +123,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/aarch64-openbsd-none/machine/armreg.h b/lib/libc/include/aarch64-openbsd-none/machine/armreg.h index 7483ae8dd70dfe08ce0937eca6d89902fba892cd..941fed486708b7b047ac227701d513f94e053156 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/armreg.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/armreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armreg.h,v 1.44 2025/07/22 09:20:41 kettenis Exp $ */ +/* $OpenBSD: armreg.h,v 1.45 2026/05/04 20:43:42 kettenis Exp $ */ /*- * Copyright (c) 2013, 2014 Andrew Turner * Copyright (c) 2015 The FreeBSD Foundation @@ -119,6 +119,14 @@ #define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT) #define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT) +/* CurrentEL - Current Exception Level */ +#define CURRENTEL_EL_SHIFT 2 +#define CURRENTEL_EL_MASK (0x3 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL0 (0x0 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL1 (0x1 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL2 (0x2 << CURRENTEL_EL_SHIFT) +#define CURRENTEL_EL_EL3 (0x3 << CURRENTEL_EL_SHIFT) + /* MPIDR_EL1 - Multiprocessor Affinity Register */ #define MPIDR_AFF3 (0xFFULL << 32) #define MPIDR_AFF2 (0xFFULL << 16) diff --git a/lib/libc/include/aarch64-openbsd-none/machine/bus.h b/lib/libc/include/aarch64-openbsd-none/machine/bus.h index 70ad145593e80527ec3be3aa799403b1d0f88d5e..a359fa758b64422295c45787bf999d2b20fc2905 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/bus.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.11 2024/11/18 05:32:39 jsg Exp $ */ +/* $OpenBSD: bus.h,v 1.13 2026/06/22 07:54:19 deraadt Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. * @@ -349,8 +349,8 @@ struct uio; #define BUS_DMASYNC_PREREAD 0x0004 #define BUS_DMASYNC_PREWRITE 0x0008 -typedef struct machine_bus_dma_tag *bus_dma_tag_t; -typedef struct machine_bus_dmamap *bus_dmamap_t; +typedef struct bus_dma_tag *bus_dma_tag_t; +typedef struct bus_dmamap *bus_dmamap_t; /* * bus_dma_segment_t @@ -358,14 +358,15 @@ typedef struct machine_bus_dmamap *bus_dmamap_t; * Describes a single contiguous DMA transaction. Values * are suitable for programming into DMA registers. */ -struct machine_bus_dma_segment { +struct bus_dma_segment { bus_addr_t ds_addr; /* DMA address */ bus_size_t ds_len; /* length of transfer */ paddr_t _ds_paddr; /* CPU address */ vaddr_t _ds_vaddr; /* CPU address */ + vaddr_t _ds_bounce_va; /* mapped bounced data */ }; -typedef struct machine_bus_dma_segment bus_dma_segment_t; +typedef struct bus_dma_segment bus_dma_segment_t; /* * bus_dma_tag_t @@ -374,7 +375,7 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t; * DMA for a given bus. */ -struct machine_bus_dma_tag { +struct bus_dma_tag { void *_cookie; /* cookie used in the guts */ int _flags; /* misc. flags */ @@ -393,7 +394,8 @@ struct machine_bus_dma_tag { int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, + int *, int *, int); void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -451,6 +453,8 @@ struct machine_bus_dma_tag { #define bus_dmamem_mmap(t, sg, n, o, p, f) \ (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) +void bus_dma_init(void); + int _dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _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); int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, int *, + int *, int); void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, 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, * * Describes a DMA mapping. */ -struct machine_bus_dmamap { +struct bus_dmamap { /* * PRIVATE MEMBERS: not for use by machine-independent code. */ @@ -493,6 +498,11 @@ struct machine_bus_dmamap { void *_dm_cookie; /* cookie for bus-specific functions */ + struct vm_page **_dm_pages; /* replacement pages */ + vaddr_t _dm_pgva; /* those above -- mapped */ + int _dm_npages; /* number of pages allocated */ + int _dm_nused; /* number of pages replaced */ + /* * PUBLIC MEMBERS: these are used by machine-independent code. */ diff --git a/lib/libc/include/aarch64-openbsd-none/machine/codepatch.h b/lib/libc/include/aarch64-openbsd-none/machine/codepatch.h new file mode 100644 index 0000000000000000000000000000000000000000..849b50725410584d3addc86cb9e9a7dda433070e --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/machine/codepatch.h @@ -0,0 +1,72 @@ +/* $OpenBSD: codepatch.h,v 1.1 2026/06/23 11:45:54 kettenis Exp $ */ +/* + * Copyright (c) 2014-2015 Stefan Fritsch + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_CODEPATCH_H_ +#define _MACHINE_CODEPATCH_H_ + +#include + +#ifndef _LOCORE + +/* code in this section will be unmapped after boot */ +#define __cptext __attribute__((section(".cptext"))) + +__cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest); +__cptext void codepatch_unmaprw(vaddr_t nva); +__cptext void codepatch_fill_nop(void *caddr, uint16_t len); +__cptext void codepatch_nop(uint16_t tag); +void codepatch_disable(void); + +#endif /* !_LOCORE */ + +/* + * Mark the start of some code snippet to be patched. + */ +#define CODEPATCH_START 998: +/* + * Mark the end of some code to be patched, and assign the given tag. + */ +#define CODEPATCH_END2(startnum,tag) \ + 999: \ + .section .codepatch, "a" ;\ + .quad startnum##b ;\ + .short (999b - startnum##b) ;\ + .short tag ;\ + .int 0 ;\ + .previous +#define CODEPATCH_END(tag) CODEPATCH_END2(998,tag) + +#define CPTAG_REPEAT_TLBI 1 + + +/* Would be neat if these could be in something like .cptext */ +#define CODEPATCH_CODE(symbol, instructions...) \ + .section .rodata; \ + .globl symbol; \ +symbol: instructions; \ + .size symbol, . - symbol + +/* provide a (short) variable with the length of the patch */ +#define CODEPATCH_CODE_LEN(symbol, instructions...) \ + CODEPATCH_CODE(symbol, instructions); \ +996: .globl symbol##_len; \ + .align 2; \ +symbol##_len: \ + .short 996b - symbol; \ + .size symbol##_len, 2 + +#endif /* _MACHINE_CODEPATCH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/machine/cpu.h b/lib/libc/include/aarch64-openbsd-none/machine/cpu.h index 172be4326fd49576fbd2335e2cb6498d56d919ef..1d396b8467afbe1989518872b5ceacaa4cdccf41 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.57 2026/09/06 20:02:12 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn * @@ -37,7 +37,8 @@ #define CPU_ID_AA64SMFR0 10 #define CPU_ID_AA64ZFR0 11 #define CPU_LIDACTION 12 -#define CPU_MAXID 13 /* number of valid machdep ids */ +#define CPU_LED_BLINK 13 /* int: blink leds? */ +#define CPU_MAXID 14 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -53,6 +54,7 @@ { "id_aa64smfr0", CTLTYPE_QUAD }, \ { "id_aa64zfr0", CTLTYPE_QUAD }, \ { "lidaction", CTLTYPE_INT }, \ + { "led_blink", CTLTYPE_INT }, \ } #ifdef _KERNEL @@ -200,6 +202,8 @@ struct cpu_info { #define CPUF_PRESENT (1<<4) #define CPUF_GO (1<<5) #define CPUF_RUNNING (1<<6) +#define CPUF_PARK (1<<7) +#define CPUF_PARKED (1<<8) static inline struct cpu_info * curcpu(void) @@ -357,6 +361,14 @@ void cpu_wfi(void); void delay (unsigned); #define DELAY(x) delay(x) +struct blink_led { + void (*bl_func)(void *, int); + void *bl_arg; + SLIST_ENTRY(blink_led) bl_next; +}; + +void blink_led_register(struct blink_led *); + #endif /* _KERNEL */ #ifdef MULTIPROCESSOR diff --git a/lib/libc/include/aarch64-openbsd-none/machine/hibernate.h b/lib/libc/include/aarch64-openbsd-none/machine/hibernate.h new file mode 100644 index 0000000000000000000000000000000000000000..015fdcd1597f8eaa013b0a8c2028a3a673821e27 --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/machine/hibernate.h @@ -0,0 +1,38 @@ +/* $OpenBSD: hibernate.h,v 1.1 2026/09/06 18:25:22 mglocker Exp $ */ + +/* + * Copyright (c) 2011 Mike Larkin + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +/* arm64 hibernate support structures and functions */ + +int get_hibernate_info_md(union hibernate_info *); +void hibernate_flush(void); +void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int); +int hibernate_inflate_skip(union hibernate_info *, paddr_t); +int hibernate_suspend(void); +void hibernate_switch_stack_machdep(void); +void hibernate_resume_machdep(vaddr_t); +void hibernate_activate_resume_pt_machdep(void); +void hibernate_enable_intr_machdep(void); +void hibernate_disable_intr_machdep(void); +#ifdef MULTIPROCESSOR +void hibernate_quiesce_cpus(void); +#endif /* MULTIPROCESSOR */ + +/* arm64-only extras (see hibernate_var.h for the piglet save layout) */ +void hibernate_dcache_flush_machdep(void); \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/machine/hibernate_var.h b/lib/libc/include/aarch64-openbsd-none/machine/hibernate_var.h new file mode 100644 index 0000000000000000000000000000000000000000..1eb26562b5ce455ec64cd7d8374a0bb7bc2a8e3d --- /dev/null +++ b/lib/libc/include/aarch64-openbsd-none/machine/hibernate_var.h @@ -0,0 +1,79 @@ +/* $OpenBSD: hibernate_var.h,v 1.2 2026/09/19 17:27:09 kettenis Exp $ */ + +/* + * Copyright (c) 2011 Mike Larkin + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LOCORE +extern vaddr_t global_piglet_va; +extern paddr_t global_piglet_pa; +#endif + +#define PIGLET_PAGE_MASK (~((1ULL << 21) - 1)) + +/* + * On arm64 the resume page tables use both TTBR0 and TTBR1. The + * TTBR0 (PT0) page tables start at L0 and cover the first 4MB of the + * piglet with 4KB pages (such that pages in the piglet can be + * accessed using their offset) and also covers identy mappings for + * the pig, the piglet and kernel using 2MB mappings. The TTBR1 (PT1) + * page tables covers mappings for the piglet and kernel using normal + * kernel VAs. + */ +#define HIBERNATE_PT0_L0_PAGE (PAGE_SIZE * 512) /* TTBR0 root */ +#define HIBERNATE_PT0_L1_LOW (PAGE_SIZE * 513) +#define HIBERNATE_PT0_L2_LOW (PAGE_SIZE * 514) +#define HIBERNATE_PT0_L3_LOW (PAGE_SIZE * 515) /* 2 pages */ +#define HIBERNATE_PT0_L1_HI (PAGE_SIZE * 517) +#define HIBERNATE_PT1_L1_PAGE (PAGE_SIZE * 518) /* TTBR1 root */ + +/* Pool of L2 pages per distinct PT0_L1_LOW/PT0_L1_HI/PT1_L1 slot */ +#define HIBERNATE_PT0_L2_LOW_POOL (PAGE_SIZE * 520) +#define HIBERNATE_PT0_L2_LOW_POOL_COUNT 16 +#define HIBERNATE_PT0_L2_HI_POOL (PAGE_SIZE * 536) +#define HIBERNATE_PT0_L2_HI_POOL_COUNT 16 +#define HIBERNATE_PT1_L2_POOL (PAGE_SIZE * 552) +#define HIBERNATE_PT1_L2_POOL_COUNT 16 + +/* 3 pages for stack */ +#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 570) + +#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 571) + +/* + * On arm64 we can't access low VA using the normal kernel page + * tables. Since the hiballoc page is used before we install the + * resume page tables, use the normal kernel VA for access. + */ +#define HIBERNATE_HIBALLOC_PAGE (global_piglet_va + PAGE_SIZE * 572) + +/* Use 4MB hibernation chunks */ +#define HIBERNATE_CHUNK_SIZE 0x400000 + +#define HIBERNATE_CHUNK_TABLE_SIZE 0x200000 + +#define HIBERNATE_STACK_OFFSET 0x0F00 + +/* + * Minimum amount of memory for hibernate support. This is used in early boot + * when deciding if we can preallocate the piglet. If the machine does not + * have at least HIBERNATE_MIN_MEMORY RAM, we won't support hibernate. This + * avoids late allocation issues due to fragmented memory and failure to + * hibernate. We need to be able to allocate 32MB contiguous memory, aligned + * to 2MB. + * + * The default minimum required memory is 512MB (1ULL << 29). + */ +#define HIBERNATE_MIN_MEMORY (1ULL << 29) \ No newline at end of file diff --git a/lib/libc/include/aarch64-openbsd-none/machine/simplebusvar.h b/lib/libc/include/aarch64-openbsd-none/machine/simplebusvar.h index be1336cf1fd4ba321e6e4eb532efd73cc0cbd0b4..a3fda16ece76743ae6f7b982089565cbb118e923 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/simplebusvar.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/simplebusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */ +/* $OpenBSD: simplebusvar.h,v 1.2 2026/06/22 07:54:19 deraadt Exp $ */ /* * Copyright (c) 2016 Patrick Wildt * @@ -25,7 +25,7 @@ struct simplebus_softc { int sc_pacells; int sc_pscells; struct bus_space sc_bus; - struct machine_bus_dma_tag sc_dma; + struct bus_dma_tag sc_dma; int *sc_ranges; int sc_rangeslen; int *sc_dmaranges; diff --git a/lib/libc/include/aarch64-openbsd-none/machine/vmmvar.h b/lib/libc/include/aarch64-openbsd-none/machine/vmmvar.h index 7d156212804edf9de37feede5696c6b645c4013c..91f394a04de08f5b4b3b0de57a199e058bba49c2 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/vmmvar.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.3 2025/08/03 10:17:33 tb Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.4 2026/09/19 17:21:52 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -63,7 +63,6 @@ struct vm_exit { struct vm_intr_params { /* Input parameters to VMM_IOC_INTR */ - uint32_t vip_vm_id; uint32_t vip_vcpu_id; uint16_t vip_intr; }; @@ -76,7 +75,6 @@ struct vm_rwregs_params { * Input/output parameters to VMM_IOC_READREGS / * VMM_IOC_WRITEREGS */ - uint32_t vrwp_vm_id; uint32_t vrwp_vcpu_id; uint64_t vrwp_mask; struct vcpu_reg_state vrwp_regs; diff --git a/lib/libc/include/arm-openbsd-eabi/arm/_types.h b/lib/libc/include/arm-openbsd-eabi/arm/_types.h index 5693a7cce191aee040d1f79333eb2acc864b21b4..b28c257440efaf2340fb047dcf498da193b7f540 100644 --- a/lib/libc/include/arm-openbsd-eabi/arm/_types.h +++ b/lib/libc/include/arm-openbsd-eabi/arm/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.21 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.22 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/arm-openbsd-eabi/arm/cpu.h b/lib/libc/include/arm-openbsd-eabi/arm/cpu.h index eb81d8ee82a3c7d763b12e66d81716042339f7dd..d4fd383dd8bc058d9699ece5c1aa102ac27c9ab2 100644 --- a/lib/libc/include/arm-openbsd-eabi/arm/cpu.h +++ b/lib/libc/include/arm-openbsd-eabi/arm/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.67 2024/06/09 21:15:29 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.68 2026/05/25 01:56:50 jsg Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -94,8 +94,6 @@ * Kernel-only definitions */ -#include - #include #include #include diff --git a/lib/libc/include/arm-openbsd-eabi/arm/cpuconf.h b/lib/libc/include/arm-openbsd-eabi/arm/cpuconf.h deleted file mode 100644 index a1576f6511212c3f3bf01979593548316e2775d4..0000000000000000000000000000000000000000 --- a/lib/libc/include/arm-openbsd-eabi/arm/cpuconf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: cpuconf.h,v 1.20 2024/11/07 08:12:12 miod Exp $ */ -/* $NetBSD: cpuconf.h,v 1.7 2003/05/23 00:57:24 ichiro Exp $ */ - -/* - * Copyright (c) 2002 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Jason R. Thorpe for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ARM_CPUCONF_H_ -#define _ARM_CPUCONF_H_ - -/* - * Define which MMU classes are configured: - * - * ARM_MMU_V7 v6/v7 MMU with XP bit enabled subpage - * protection is not used, TEX/AP is used instead. - */ - -#define ARM_MMU_V7 1 - -#define ARM_NMMUS (ARM_MMU_V7) - -#endif /* _ARM_CPUCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/arm-openbsd-eabi/arm/cpufunc.h b/lib/libc/include/arm-openbsd-eabi/arm/cpufunc.h index 07d18177ae0d230fc161e8fb8502b07a9074f1aa..80a9f51314a3e8715873dd92256c0042990d2602 100644 --- a/lib/libc/include/arm-openbsd-eabi/arm/cpufunc.h +++ b/lib/libc/include/arm-openbsd-eabi/arm/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.34 2023/05/30 08:30:00 jsg Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.35 2026/05/25 01:56:50 jsg Exp $ */ /* $NetBSD: cpufunc.h,v 1.29 2003/09/06 09:08:35 rearnsha Exp $ */ /* @@ -46,7 +46,6 @@ #ifdef _KERNEL #include -#include struct cpu_functions { diff --git a/lib/libc/include/arm-openbsd-eabi/arm/fiq.h b/lib/libc/include/arm-openbsd-eabi/arm/fiq.h deleted file mode 100644 index 4abafaa056c8f9d2a01de2363150a5392fe32e40..0000000000000000000000000000000000000000 --- a/lib/libc/include/arm-openbsd-eabi/arm/fiq.h +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: fiq.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ -/* $NetBSD: fiq.h,v 1.1 2001/12/20 01:20:23 thorpej Exp $ */ - -/* - * Copyright (c) 2001 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Jason R. Thorpe for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ARM_FIQ_H_ -#define _ARM_FIQ_H_ - -#include - -struct fiqregs { - u_int fr_r8; /* FIQ mode r8 */ - u_int fr_r9; /* FIQ mode r9 */ - u_int fr_r10; /* FIQ mode r10 */ - u_int fr_r11; /* FIQ mode r11 */ - u_int fr_r12; /* FIQ mode r12 */ - u_int fr_r13; /* FIQ mode r13 */ -}; - -struct fiqhandler { - TAILQ_ENTRY(fiqhandler) fh_list;/* link in the FIQ handler stack */ - void *fh_func; /* FIQ handler routine */ - size_t fh_size; /* size of FIQ handler */ - int fh_flags; /* flags; see below */ - struct fiqregs *fh_regs; /* pointer to regs structure */ -}; - -#define FH_CANPUSH 0x01 /* can push this handler out of the way */ - -int fiq_claim(struct fiqhandler *); -void fiq_release(struct fiqhandler *); - -void fiq_getregs(struct fiqregs *); -void fiq_setregs(struct fiqregs *); - -#endif /* _ARM_FIQ_H_ */ \ No newline at end of file diff --git a/lib/libc/include/arm-openbsd-eabi/arm/pmap.h b/lib/libc/include/arm-openbsd-eabi/arm/pmap.h index 4e717b13d1c87ab0d01ff92c7b66ecabba5dc390..02657eaf48f3762ec19e35bf1c5d0b9fac9f5a1a 100644 --- a/lib/libc/include/arm-openbsd-eabi/arm/pmap.h +++ b/lib/libc/include/arm-openbsd-eabi/arm/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.57 2024/11/07 08:12:12 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.58 2026/05/25 01:56:50 jsg Exp $ */ /* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */ /* @@ -71,7 +71,6 @@ #ifdef _KERNEL -#include #include #ifndef _LOCORE #include diff --git a/lib/libc/include/generic-openbsd/arpa/telnet.h b/lib/libc/include/generic-openbsd/arpa/telnet.h index f0094f2af20ecdae47ca5e0bc28ec7c417c55828..2793d82df1d984efee26981f950510a6dc307799 100644 --- a/lib/libc/include/generic-openbsd/arpa/telnet.h +++ b/lib/libc/include/generic-openbsd/arpa/telnet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: telnet.h,v 1.7 2003/06/02 19:34:12 millert Exp $ */ +/* $OpenBSD: telnet.h,v 1.8 2026/09/05 08:22:03 jsg Exp $ */ /* $NetBSD: telnet.h,v 1.4 1994/10/26 00:56:46 cgd Exp $ */ /* @@ -96,7 +96,7 @@ extern char *telcmds[]; #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_XASCII 17 /* extended ASCII character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ diff --git a/lib/libc/include/generic-openbsd/imsg.h b/lib/libc/include/generic-openbsd/imsg.h index bda67b7085ad49bbc30a6d9da0c7a7d9dab89e70..e5960af613baf8783a1a6cfde5c48cb45353dadb 100644 --- a/lib/libc/include/generic-openbsd/imsg.h +++ b/lib/libc/include/generic-openbsd/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.24 2025/06/05 08:55:07 tb Exp $ */ +/* $OpenBSD: imsg.h,v 1.25 2026/09/04 18:47:43 claudio Exp $ */ /* * Copyright (c) 2023 Claudio Jeker @@ -46,6 +46,8 @@ struct msgbuf; struct imsgbuf { struct msgbuf *w; + void (*cb)(struct imsgbuf *, void *); + void *userdata; pid_t pid; uint32_t maxsize; int fd; @@ -127,6 +129,7 @@ int ibuf_write(int, struct msgbuf *); int msgbuf_write(int, struct msgbuf *); int ibuf_read(int, struct msgbuf *); int msgbuf_read(int, struct msgbuf *); +uint32_t msgbuf_readlen(struct msgbuf *); struct ibuf *msgbuf_get(struct msgbuf *); struct ibufqueue *ibufq_new(void); @@ -140,14 +143,17 @@ void ibufq_flush(struct ibufqueue *); /* imsg.c */ int imsgbuf_init(struct imsgbuf *, int); void imsgbuf_allow_fdpass(struct imsgbuf *imsgbuf); +void imsgbuf_set_close_callback(struct imsgbuf *, + void (*)(struct imsgbuf *, void *)); int imsgbuf_set_maxsize(struct imsgbuf *, uint32_t); +void *imsgbuf_set_userdata(struct imsgbuf *, void *); +void *imsgbuf_get_userdata(struct imsgbuf *); int imsgbuf_read(struct imsgbuf *); int imsgbuf_write(struct imsgbuf *); int imsgbuf_flush(struct imsgbuf *); void imsgbuf_clear(struct imsgbuf *); uint32_t imsgbuf_queuelen(struct imsgbuf *); int imsgbuf_get(struct imsgbuf *, struct imsg *); -ssize_t imsg_get(struct imsgbuf *, struct imsg *); int imsg_ibufq_pop(struct ibufqueue *, struct imsg *); void imsg_ibufq_push(struct ibufqueue *, struct imsg *); int imsg_get_ibuf(struct imsg *, struct ibuf *); @@ -164,10 +170,9 @@ int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, const void *, size_t); int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, const struct iovec *, int); -int imsg_compose_ibuf(struct imsgbuf *, uint32_t, uint32_t, pid_t, - struct ibuf *); struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, size_t); int imsg_add(struct ibuf *, const void *, size_t); +int imsg_add_strbuf(struct ibuf *, const char *, size_t); void imsg_close(struct imsgbuf *, struct ibuf *); void imsg_free(struct imsg *); int imsg_set_maxsize(struct ibuf *, size_t); diff --git a/lib/libc/include/generic-openbsd/limits.h b/lib/libc/include/generic-openbsd/limits.h index 7b9702ce670d18632e5ff2aec3b89f53445c8727..6c35d700c5275148338215ea60ed766e06b69b24 100644 --- a/lib/libc/include/generic-openbsd/limits.h +++ b/lib/libc/include/generic-openbsd/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.19 2015/01/20 22:09:50 tedu Exp $ */ +/* $OpenBSD: limits.h,v 1.20 2026/08/10 20:10:19 daniel Exp $ */ /* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */ /* @@ -55,7 +55,7 @@ #define _POSIX_SYMLOOP_MAX 8 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 #define _POSIX_THREAD_KEYS_MAX 128 -#define _POSIX_THREAD_THREADS_MAX 4 +#define _POSIX_THREAD_THREADS_MAX 64 #if __POSIX_VISIBLE >= 200112 #define _POSIX_CLOCKRES_MIN 20000000 diff --git a/lib/libc/include/generic-openbsd/machine/_float.h b/lib/libc/include/generic-openbsd/machine/_float.h deleted file mode 100644 index 6c9717939fcba76197bbb74f2517fbf45ecfe782..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/_float.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/cdefs.h b/lib/libc/include/generic-openbsd/machine/cdefs.h deleted file mode 100644 index e44353fedfe1e56cc82b7f74e8e03f3753c98167..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/cdefs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/disklabel.h b/lib/libc/include/generic-openbsd/machine/disklabel.h deleted file mode 100644 index e7758205f60b4f71e05e646714431838d70a82a1..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/disklabel.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */ -/* public domain */ - -/* - * Standard MBR partition scheme, with the label in the second sector - * of the OpenBSD partition. - */ - -#ifndef _MACHINE_DISKLABEL_H_ -#define _MACHINE_DISKLABEL_H_ - -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ - -#endif /* _MACHINE_DISKLABEL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/fenv.h b/lib/libc/include/generic-openbsd/machine/fenv.h deleted file mode 100644 index 08e89fbf323e30d7c88ccce0eb090e4c2cfa5f30..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/fenv.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/loadfile_machdep.h b/lib/libc/include/generic-openbsd/machine/loadfile_machdep.h deleted file mode 100644 index 1486f8ce5c754fca11c37ce27e90e32eeb9a6f9c..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/loadfile_machdep.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */ -/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define BOOT_ELF -#define ELFSIZE 64 - -#define LOAD_KERNEL LOAD_ALL -#define COUNT_KERNEL COUNT_ALL - -#define LOADADDR(a) (((u_long)(a)) + offset) -#define ALIGNENTRY(a) ((u_long)(a)) -#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) -#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) -#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) -#define WARN(a) (void)(printf a, \ - printf((errno ? ": %s\n" : "\n"), \ - strerror(errno))) -#define PROGRESS(a) (void) printf a -#define ALLOC(a) alloc(a) -#define FREE(a, b) free(a, b) \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/reloc.h b/lib/libc/include/generic-openbsd/machine/reloc.h deleted file mode 100644 index 4eb8c01cf15e7d068665c757f2cdb4ca3b1c79ec..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/reloc.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */ - -/* public domain */ - -#include \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/machine/tcb.h b/lib/libc/include/generic-openbsd/machine/tcb.h deleted file mode 100644 index 427e19101a005a0836cad7a09118435406234f8d..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/machine/tcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/math.h b/lib/libc/include/generic-openbsd/math.h index 9cad4b0f74b0a6b368b653a74f3060bab3813896..92d553e0410b75cb84dfed83fe8d6eb1dff77696 100644 --- a/lib/libc/include/generic-openbsd/math.h +++ b/lib/libc/include/generic-openbsd/math.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math.h,v 1.36 2018/03/10 20:52:58 kettenis Exp $ */ +/* $OpenBSD: math.h,v 1.37 2026/08/03 22:19:15 daniel Exp $ */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -146,7 +146,7 @@ extern char __nan[]; extern int signgam; #endif /* __BSD_VISIBLE || __XPG_VISIBLE */ -#if __POSIX_VISIBLE >= 201403 +#if __XPG_VISIBLE >= 800 #define M_El 2.718281828459045235360287471352662498L /* e */ #define M_LOG2El 1.442695040888963407359924681001892137L /* log 2e */ #define M_LOG10El 0.434294481903251827651128918916605082L /* log 10e */ @@ -160,7 +160,7 @@ extern int signgam; #define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */ #define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */ #define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ -#endif /* __POSIX_VISIBLE >= 201403 */ +#endif /* __XPG_VISIBLE >= 800 */ #if __BSD_VISIBLE #define HUGE MAXFLOAT diff --git a/lib/libc/include/generic-openbsd/md5.h b/lib/libc/include/generic-openbsd/md5.h index a4623a50efaeed57507e81853e64fcd4debe8dcf..e1e6679ad82ad2e4f0a1a33e04b3c3a536cbe2dc 100644 --- a/lib/libc/include/generic-openbsd/md5.h +++ b/lib/libc/include/generic-openbsd/md5.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */ +/* $OpenBSD: md5.h,v 1.18 2026/08/31 15:09:14 tb Exp $ */ /* * This code implements the MD5 message-digest algorithm. @@ -29,18 +29,12 @@ __BEGIN_DECLS void MD5Init(MD5_CTX *); void MD5Update(MD5_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void MD5Pad(MD5_CTX *); void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *) __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH))); -void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH]) - __attribute__((__bounded__(__minbytes__,1,4))) - __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH))); char *MD5End(MD5_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH))); char *MD5File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH))); -char *MD5FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH))); char *MD5Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH))); diff --git a/lib/libc/include/generic-openbsd/mips64/_float.h b/lib/libc/include/generic-openbsd/mips64/_float.h deleted file mode 100644 index 4bb91f4f9e682dbee56ebd4965149e339fc2aeb9..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/_float.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ - -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE__FLOAT_H_ -#define _MACHINE__FLOAT_H_ - -#define __FLT_RADIX 2 /* b */ -#define __FLT_ROUNDS __flt_rounds() -#define __FLT_EVAL_METHOD 0 /* no promotions */ - -#define __FLT_MANT_DIG 24 /* p */ -#define __FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define __FLT_MIN_EXP (-125) /* emin */ -#define __FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define __FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ -#define __FLT_MAX_EXP 128 /* emax */ -#define __FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ - -#define __DBL_MANT_DIG 53 -#define __DBL_EPSILON 2.2204460492503131E-16 -#define __DBL_DIG 15 -#define __DBL_MIN_EXP (-1021) -#define __DBL_MIN 2.2250738585072014E-308 -#define __DBL_MIN_10_EXP (-307) -#define __DBL_MAX_EXP 1024 -#define __DBL_MAX 1.7976931348623157E+308 -#define __DBL_MAX_10_EXP 308 - -#define __LDBL_MANT_DIG 113 -#define __LDBL_EPSILON 1.92592994438723585305597794258492732e-34L -#define __LDBL_DIG 33 -#define __LDBL_MIN_EXP (-16381) -#define __LDBL_MIN 3.36210314311209350626267781732175260e-4932L -#define __LDBL_MIN_10_EXP (-4931) -#define __LDBL_MAX_EXP 16384 -#define __LDBL_MAX 1.18973149535723176508575932662800702e+4932L -#define __LDBL_MAX_10_EXP 4932 - -#define __DECIMAL_DIG 36 - -#endif /* _MACHINE__FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/_types.h b/lib/libc/include/generic-openbsd/mips64/_types.h deleted file mode 100644 index ca5dbe7d7bd2cd6ed9e0a8e483923646b7111780..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/_types.h +++ /dev/null @@ -1,154 +0,0 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)types.h 8.3 (Berkeley) 1/5/94 - * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS64__TYPES_H_ -#define _MIPS64__TYPES_H_ - -/* - * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned - * value for all data types (int, long, ...). The result is an - * unsigned long and must be cast to any desired pointer type. - * - * _ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - */ -#define _ALIGNBYTES 7 -#define _STACKALIGNBYTES 15 -#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0) -#define _MAX_PAGE_SHIFT 14 /* maximum possible PAGE_SHIFT */ - -/* - * We need to handle the various ISA levels for sizes. - */ -#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */ -#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */ -#define _MIPS_ISA_MIPS3 3 /* R4000 */ -#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */ -#define _MIPS_ISA_MIPS32 32 /* MIPS32 */ -#define _MIPS_ISA_MIPS64 64 /* MIPS64 */ - -/* 7.18.1.1 Exact-width integer types */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long long __int64_t; -typedef unsigned long long __uint64_t; - -/* 7.18.1.2 Minimum-width integer types */ -typedef __int8_t __int_least8_t; -typedef __uint8_t __uint_least8_t; -typedef __int16_t __int_least16_t; -typedef __uint16_t __uint_least16_t; -typedef __int32_t __int_least32_t; -typedef __uint32_t __uint_least32_t; -typedef __int64_t __int_least64_t; -typedef __uint64_t __uint_least64_t; - -/* 7.18.1.3 Fastest minimum-width integer types */ -typedef __int32_t __int_fast8_t; -typedef __uint32_t __uint_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __uint32_t __uint_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __uint32_t __uint_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __uint64_t __uint_fast64_t; -#define __INT_FAST8_MIN INT32_MIN -#define __INT_FAST16_MIN INT32_MIN -#define __INT_FAST32_MIN INT32_MIN -#define __INT_FAST64_MIN INT64_MIN -#define __INT_FAST8_MAX INT32_MAX -#define __INT_FAST16_MAX INT32_MAX -#define __INT_FAST32_MAX INT32_MAX -#define __INT_FAST64_MAX INT64_MAX -#define __UINT_FAST8_MAX UINT32_MAX -#define __UINT_FAST16_MAX UINT32_MAX -#define __UINT_FAST32_MAX UINT32_MAX -#define __UINT_FAST64_MAX UINT64_MAX - -/* 7.18.1.4 Integer types capable of holding object pointers */ -typedef long __intptr_t; -typedef unsigned long __uintptr_t; - -/* 7.18.1.5 Greatest-width integer types */ -typedef __int64_t __intmax_t; -typedef __uint64_t __uintmax_t; - -/* Register size */ -typedef long __register_t; -typedef long f_register_t; /* XXX */ - -/* VM system types */ -typedef unsigned long __vaddr_t; -typedef unsigned long __paddr_t; -typedef unsigned long __vsize_t; -typedef unsigned long __psize_t; - -/* Standard system types */ -typedef double __double_t; -typedef float __float_t; -typedef long __ptrdiff_t; -typedef unsigned long __size_t; -typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 -typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif - -/* Wide character support types */ -#ifndef __cplusplus -typedef int __wchar_t; -#endif -typedef int __wint_t; -typedef int __rune_t; -typedef void * __wctrans_t; -typedef void * __wctype_t; - -#if defined(_KERNEL) -typedef struct label_t { - long val[14]; -} label_t; -#endif - -/* Feature test macros */ -#define __HAVE_EXEC_MD_MAP - -#endif /* _MIPS64__TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/archtype.h b/lib/libc/include/generic-openbsd/mips64/archtype.h deleted file mode 100644 index 7ab1da2012ed89195eeb823049f3d5286d239fba..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/archtype.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: archtype.h,v 1.16 2012/10/03 21:44:51 miod Exp $ */ -/* - * Copyright (c) 1997-2004 Opsycon AB, Sweden (www.opsycon.se) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_ARCHTYPE_H_ -#define _MIPS64_ARCHTYPE_H_ -/* - * Define architectural identities for the different Mips machines. - */ -#define ACER_PICA_61 0x0001 /* Acer Labs Pica 61 */ -#define MAGNUM 0x0002 /* Mips MAGNUM R4000 */ -#define DESKSTATION_RPC44 0x0003 /* Deskstation rPC44 */ -#define DESKSTATION_TYNE 0x0004 /* Deskstation Tyne */ -#define NKK_AQUARIUS 0x0005 /* NKK R4{67}00 PC */ -#define NEC_R94 0x0006 /* NEC Magnum class */ -#define SNI_RM200 0x0007 /* Siemens Nixdorf RM200 */ - -#define SGI_IP17 0x0011 /* Crimson */ -#define SGI_IP19 0x0012 /* Onyx (!S model Challenge) */ -#define SGI_IP20 0x0013 /* Indigo */ -#define SGI_IP21 0x0014 /* POWER Challenge, POWER Onyx */ -#define SGI_IP22 0x0015 /* Indy, Indigo2, Challenge S */ -#define SGI_IP25 0x0016 /* POWER Challenge R10k */ -#define SGI_IP26 0x0017 /* POWER Indigo2 R8k */ -#define SGI_IP27 0x0018 /* IP27 Origin200/2000 */ -#define SGI_IP28 0x0019 /* POWER Indigo2 R10k */ -#define SGI_OCTANE 0x001a /* IP30 Octane */ -#define SGI_O2 0x001b /* IP32 O2 */ -#define SGI_IP35 0x001c /* IP35 Origin3x0/3x00/Fuel/Tezro */ - -#define ALGOR_P4032 0x0021 /* ALGORITHMICS P-4032 */ -#define ALGOR_P5064 0x0022 /* ALGORITHMICS P-5064 */ - -#define GALILEO_G9 0x0031 /* Galileo GT-64011 Eval board */ -#define GALILEO_EV64240 0x0032 /* Galileo EV64240 Eval board */ -#define GALILEO_EV64340 0x0033 /* Galileo EV64340 Eval board */ - -#define MOMENTUM_CP7000 0x0041 /* Momentum Ocelot */ -#define MOMENTUM_CP7000G 0x0042 /* Momentum Ocelot-G */ -#define MOMENTUM_JAGUAR 0x0043 /* Momentum Jaguar ATX */ - -#define WG4308 0x0052 /* Willowglen 4308 LMD */ -#define WG4309 0x0053 /* Willowglen 4309 LMD */ -#define WG4409 0x0054 /* Willowglen 4409 LMD */ -#define WG8138 0x0055 /* Willowglen 8138 523x VME card */ -#define WG8168 0x0056 /* Willowglen 8168 5231 VME card */ -#define WG6000 0x0057 /* Willowglen CPU-6000 */ -#define WG7000 0x0058 /* Willowglen CPU-7000 */ -#define WG8200 0x0059 /* Willowglen CPU-8200 */ -#define WG8232 0x005a /* Willowglen CPU-8232 */ - -#define LAGUNA 0x00f1 /* Heurikon Laguna VME board */ - -#endif /* !_MIPS64_ARCHTYPE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/asm.h b/lib/libc/include/generic-openbsd/mips64/asm.h deleted file mode 100644 index 8bc75825519e63bb49863bcc63a1d499e8b44a89..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/asm.h +++ /dev/null @@ -1,360 +0,0 @@ -/* $OpenBSD: asm.h,v 1.27 2021/05/01 16:11:10 visa Exp $ */ - -/* - * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#ifndef _MIPS64_ASM_H_ -#define _MIPS64_ASM_H_ - -#include - -#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */ -#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */ -#define _MIPS_ISA_MIPS3 3 /* R4000 */ -#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */ -#define _MIPS_ISA_MIPS32 32 /* MIPS32 */ -#define _MIPS_ISA_MIPS64 64 /* MIPS64 */ - -#if !defined(ABICALLS) && !defined(_NO_ABICALLS) -#define ABICALLS .abicalls -#endif - -#if defined(ABICALLS) && !defined(_KERNEL) - ABICALLS -#endif - -#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */ - -#if !defined(__MIPSEL__) && !defined(__MIPSEB__) -#error "__MIPSEL__ or __MIPSEB__ must be defined" -#endif -/* - * Define how to access unaligned data word - */ -#if defined(__MIPSEL__) -#define LWLO lwl -#define LWHI lwr -#define SWLO swl -#define SWHI swr -#define LDLO ldl -#define LDHI ldr -#define SDLO sdl -#define SDHI sdr -#endif -#if defined(__MIPSEB__) -#define LWLO lwr -#define LWHI lwl -#define SWLO swr -#define SWHI swl -#define LDLO ldr -#define LDHI ldl -#define SDLO sdr -#define SDHI sdl -#endif - -/* - * Define programming environment for ABI. - */ -#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE) - -#ifndef _MIPS_SIM -#define _MIPS_SIM 1 -#define _ABIO32 1 -#endif -#ifndef _MIPS_ISA -#define _MIPS_ISA 2 -#define _MIPS_ISA_MIPS2 2 -#endif - -#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32) -#define NARGSAVE 4 - -#define SETUP_GP \ - .set noreorder; \ - .cpload t9; \ - .set reorder; - -#define SAVE_GP(x) \ - .cprestore x - -#define SETUP_GP64(gpoff, name) -#define RESTORE_GP64 -#endif - -#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32) -#define NARGSAVE 0 - -#define SETUP_GP -#define SAVE_GP(x) -#define SETUP_GP64(gpoff, name) \ - .cpsetup t9, gpoff, name -#define RESTORE_GP64 \ - .cpreturn -#endif - -#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31)) - -#else /* defined(ABICALLS) && !defined(_KERNEL) */ - -#define NARGSAVE 4 -#define SETUP_GP -#define SAVE_GP(x) - -#define ALIGNSZ 16 /* Stack layout alignment */ -#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1)) - -#endif - -/* - * Basic register operations based on selected ISA - */ -#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \ - _MIPS_ISA == _MIPS_ISA_MIPS32) -#define REGSZ 4 /* 32 bit mode register size */ -#define LOGREGSZ 2 /* log rsize */ -#define REG_S sw -#define REG_L lw -#define CF_SZ 24 /* Call frame size */ -#define CF_ARGSZ 16 /* Call frame arg size */ -#define CF_RA_OFFS 20 /* Call ra save offset */ -#endif - -#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \ - _MIPS_ISA == _MIPS_ISA_MIPS64) -#define REGSZ 8 /* 64 bit mode register size */ -#define LOGREGSZ 3 /* log rsize */ -#define REG_S sd -#define REG_L ld -#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */ -#define CF_ARGSZ 32 /* Call frame arg size */ -#define CF_RA_OFFS 40 /* Call ra save offset */ -#endif - -#ifndef __LP64__ -#define PTR_L lw -#define PTR_S sw -#define PTR_SUB sub -#define PTR_ADD add -#define PTR_SUBU subu -#define PTR_ADDU addu -#define LI li -#define LA la -#define PTR_SLL sll -#define PTR_SRL srl -#define PTR_VAL .word -#else -#define PTR_L ld -#define PTR_S sd -#define PTR_ADD dadd -#define PTR_SUB dsub -#define PTR_SUBU dsubu -#define PTR_ADDU daddu -#define LI dli -#define LA dla -#define PTR_SLL dsll -#define PTR_SRL dsrl -#define PTR_VAL .dword -#endif - -#define NOP nop -#define DMFC0 dmfc0 -#define DMTC0 dmtc0 -#define MFC0 mfc0 -#define MTC0 mtc0 -#define ERET sync; eret - -/* - * Define -pg profile entry code. - */ -#if defined(XGPROF) || defined(XPROF) -#define MCOUNT \ - PTR_SUBU sp, sp, 64; \ - SAVE_GP(16); \ - sd ra, 56(sp); \ - sd gp, 48(sp); \ - .set noat; \ - .set noreorder; \ - move AT, ra; \ - jal _mcount; \ - PTR_SUBU sp, sp, 16; \ - ld ra, 56(sp); \ - PTR_ADDU sp, sp, 64; \ - .set reorder; \ - .set at; -#else -#define MCOUNT -#endif - -/* - * LEAF(x, fsize) - * - * Declare a leaf routine. - */ -#define LEAF(x, fsize) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, ra; \ - SETUP_GP \ - MCOUNT - -#define ALEAF(x) \ - .globl x; \ -x: - -/* - * NLEAF(x) - * - * Declare a non-profiled leaf routine. - */ -#define NLEAF(x, fsize) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, ra; \ - SETUP_GP - -/* - * NON_LEAF(x) - * - * Declare a non-leaf routine (a routine that makes other C calls). - */ -#define NON_LEAF(x, fsize, retpc) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, retpc; \ - SETUP_GP \ - MCOUNT - -/* - * NNON_LEAF(x) - * - * Declare a non-profiled non-leaf routine - * (a routine that makes other C calls). - */ -#define NNON_LEAF(x, fsize, retpc) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, retpc \ - SETUP_GP - -/* - * END(x) - * - * Mark end of a procedure. - */ -#define END(x) \ - .end x - -/* - * STRONG_ALIAS, WEAK_ALIAS - * Create a strong or weak alias. - */ -#define STRONG_ALIAS(alias,sym) \ - .global alias; alias = sym -#define WEAK_ALIAS(alias,sym) \ - .weak alias; alias = sym - - -/* - * Macros to panic and printf from assembly language. - */ -#define PANIC(msg) \ - LA a0, 9f; \ - jal panic; \ - nop ; \ - MSG(msg) - -#define PRINTF(msg) \ - LA a0, 9f; \ - jal printf; \ - nop ; \ - MSG(msg) - -#define MSG(msg) \ - .rdata; \ -9: .asciiz msg; \ - .text - -#define LOAD_XKPHYS(reg, cca) \ - li reg, cca | 0x10; \ - dsll reg, reg, 59 - -#ifdef MULTIPROCESSOR -#define GET_CPU_INFO(ci, tmp) HW_GET_CPU_INFO(ci, tmp) -#else /* MULTIPROCESSOR */ -#define GET_CPU_INFO(ci, tmp) \ - LA ci, cpu_info_primary -#endif /* MULTIPROCESSOR */ - -/* - * Hazards - */ - -#ifdef CPU_OCTEON -/* - * OCTEON clears hazards in hardware. - */ -#define MFC0_HAZARD /* nothing */ -#define MTC0_HAZARD /* nothing */ -#define MTC0_SR_IE_HAZARD /* nothing */ -#define MTC0_SR_CU_HAZARD /* nothing */ -#define TLB_HAZARD /* nothing */ -#endif - -/* Hazard between {d,}mfc0 of COP_0_VADDR */ -#ifndef PRE_MFC0_ADDR_HAZARD -#define PRE_MFC0_ADDR_HAZARD /* nothing */ -#endif - -/* Hazard after {d,}mfc0 from any register */ -#ifndef MFC0_HAZARD -#define MFC0_HAZARD /* nothing */ -#endif -/* Hazard after {d,}mtc0 to any register */ -#ifndef MTC0_HAZARD -#define MTC0_HAZARD NOP; NOP; NOP; NOP -#endif -/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of interrupts */ -#ifndef MTC0_SR_IE_HAZARD -#define MTC0_SR_IE_HAZARD MTC0_HAZARD -#endif -/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of coprocessors */ -#ifndef MTC0_SR_CU_HAZARD -#define MTC0_SR_CU_HAZARD NOP; NOP -#endif - -/* Hazard before and after a tlbp, tlbr, tlbwi or tlbwr instruction */ -#ifndef TLB_HAZARD -#define TLB_HAZARD NOP; NOP -#endif - -#endif /* !_MIPS64_ASM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/atomic.h b/lib/libc/include/generic-openbsd/mips64/atomic.h deleted file mode 100644 index a5b8737ccb0111be9a1994f40d3d43198ed75a1f..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/atomic.h +++ /dev/null @@ -1,214 +0,0 @@ -/* $OpenBSD: atomic.h,v 1.12 2019/10/28 09:41:37 visa Exp $ */ - -/* Public Domain */ - -#ifndef _MIPS64_ATOMIC_H_ -#define _MIPS64_ATOMIC_H_ - -#if defined(_KERNEL) - -/* wait until the bits to set are clear, and set them */ -static __inline void -atomic_wait_and_setbits_int(volatile unsigned int *uip, unsigned int v) -{ - unsigned int tmp0, tmp1; - - __asm__ volatile ( - "1: ll %0, 0(%2)\n" - " and %1, %0, %3\n" - " bnez %1, 1b\n" - " or %0, %3, %0\n" - " sc %0, 0(%2)\n" - " beqz %0, 1b\n" - " nop\n" : - "=&r"(tmp0), "=&r"(tmp1) : - "r"(uip), "r"(v) : "memory"); -} - -static __inline void -atomic_setbits_int(volatile unsigned int *uip, unsigned int v) -{ - unsigned int tmp; - - __asm__ volatile ( - "1: ll %0, 0(%1)\n" - " or %0, %2, %0\n" - " sc %0, 0(%1)\n" - " beqz %0, 1b\n" - " nop\n" : - "=&r"(tmp) : - "r"(uip), "r"(v) : "memory"); -} - -static __inline void -atomic_clearbits_int(volatile unsigned int *uip, unsigned int v) -{ - unsigned int tmp; - - __asm__ volatile ( - "1: ll %0, 0(%1)\n" - " and %0, %2, %0\n" - " sc %0, 0(%1)\n" - " beqz %0, 1b\n" - " nop\n" : - "=&r"(tmp) : - "r"(uip), "r"(~v) : "memory"); -} - -#endif /* defined(_KERNEL) */ - -static inline unsigned int -_atomic_cas_uint(volatile unsigned int *p, unsigned int o, unsigned int n) -{ - unsigned int rv, wv; - - __asm__ volatile ( - "1: ll %0, %1\n" - " bne %0, %4, 2f\n" - " move %2, %3\n" - " sc %2, %1\n" - " beqz %2, 1b\n" - "2: nop\n" - : "=&r" (rv), "+m" (*p), "=&r" (wv) - : "r" (n), "Ir" (o)); - - return (rv); -} -#define atomic_cas_uint(_p, _o, _n) _atomic_cas_uint((_p), (_o), (_n)) - -static inline unsigned long -_atomic_cas_ulong(volatile unsigned long *p, unsigned long o, unsigned long n) -{ - unsigned long rv, wv; - - __asm__ volatile ( - "1: lld %0, %1\n" - " bne %0, %4, 2f\n" - " move %2, %3\n" - " scd %2, %1\n" - " beqz %2, 1b\n" - "2: nop\n" - : "=&r" (rv), "+m" (*p), "=&r" (wv) - : "r" (n), "Ir" (o)); - - return (rv); -} -#define atomic_cas_ulong(_p, _o, _n) _atomic_cas_ulong((_p), (_o), (_n)) - -static inline void * -_atomic_cas_ptr(volatile void *pp, void *o, void *n) -{ - void * volatile *p = pp; - void *rv, *wv; - - __asm__ volatile ( - "1: lld %0, %1\n" - " bne %0, %4, 2f\n" - " move %2, %3\n" - " scd %2, %1\n" - " beqz %2, 1b\n" - "2: nop\n" - : "=&r" (rv), "+m" (*p), "=&r" (wv) - : "r" (n), "Ir" (o)); - - return (rv); -} -#define atomic_cas_ptr(_p, _o, _n) _atomic_cas_ptr((_p), (_o), (_n)) - - - -static inline unsigned int -_atomic_swap_uint(volatile unsigned int *uip, unsigned int v) -{ - unsigned int o, t; - - __asm__ volatile ( - "1: ll %0, %1\n" - " move %2, %3\n" - " sc %2, %1\n" - " beqz %2, 1b\n" - " nop\n" - : "=&r" (o), "+m" (*uip), "=&r" (t) - : "r" (v)); - - return (o); -} -#define atomic_swap_uint(_p, _v) _atomic_swap_uint((_p), (_v)) - -static inline unsigned long -_atomic_swap_ulong(volatile unsigned long *uip, unsigned long v) -{ - unsigned long o, t; - - __asm__ volatile ( - "1: lld %0, %1\n" - " move %2, %3\n" - " scd %2, %1\n" - " beqz %2, 1b\n" - " nop\n" - : "=&r" (o), "+m" (*uip), "=&r" (t) - : "r" (v)); - - return (o); -} -#define atomic_swap_ulong(_p, _v) _atomic_swap_ulong((_p), (_v)) - - -static inline void * -_atomic_swap_ptr(volatile void *uipp, void *n) -{ - void * volatile *uip = uipp; - void *o, *t; - - __asm__ volatile ( - "1: lld %0, %1\n" - " move %2, %3\n" - " scd %2, %1\n" - " beqz %2, 1b\n" - " nop\n" - : "=&r" (o), "+m" (*uip), "=&r" (t) - : "r" (n)); - - return (o); -} -#define atomic_swap_ptr(_p, _n) _atomic_swap_ptr((_p), (_n)) - -static inline unsigned int -_atomic_add_int_nv(volatile unsigned int *uip, unsigned int v) -{ - unsigned int rv, nv; - - __asm__ volatile ( - "1: ll %0, %1\n" - " addu %2, %0, %3\n" - " sc %2, %1\n" - " beqz %2, 1b\n" - " nop\n" - : "=&r" (rv), "+m" (*uip), "=&r" (nv) - : "Ir" (v)); - - return (rv + v); -} -#define atomic_add_int_nv(_uip, _v) _atomic_add_int_nv((_uip), (_v)) -#define atomic_sub_int_nv(_uip, _v) _atomic_add_int_nv((_uip), 0 - (_v)) - -static inline unsigned long -_atomic_add_long_nv(volatile unsigned long *uip, unsigned long v) -{ - unsigned long rv, nv; - - __asm__ volatile ( - "1: lld %0, %1\n" - " daddu %2, %0, %3\n" - " scd %2, %1\n" - " beqz %2, 1b\n" - " nop\n" - : "=&r" (rv), "+m" (*uip), "=&r" (nv) - : "Ir" (v)); - - return (rv + v); -} -#define atomic_add_long_nv(_uip, _v) _atomic_add_long_nv((_uip), (_v)) -#define atomic_sub_long_nv(_uip, _v) _atomic_add_long_nv((_uip), 0UL - (_v)) - -#endif /* _MIPS64_ATOMIC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/autoconf.h b/lib/libc/include/generic-openbsd/mips64/autoconf.h deleted file mode 100644 index 8a518cca7fc89a9fe2b466133ef20027f5a3ccc6..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/autoconf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: autoconf.h,v 1.2 2017/06/08 12:02:52 visa Exp $ */ - -/* - * Copyright (c) 2010 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Common defines used by autoconf on all mips64-based platforms. - */ - -#ifndef _MIPS64_AUTOCONF_H_ -#define _MIPS64_AUTOCONF_H_ - -#include /* for struct cpu_hwinfo */ - -struct cpu_attach_args { - struct mainbus_attach_args caa_maa; - struct cpu_hwinfo *caa_hw; -}; - -extern struct cpu_hwinfo bootcpu_hwinfo; - -void unmap_startup(void); - -#endif /* _MIPS64_AUTOCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/cache.h b/lib/libc/include/generic-openbsd/mips64/cache.h deleted file mode 100644 index 0f7ba849452b50e9d3b4dcd8e4482ebc57a83187..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/cache.h +++ /dev/null @@ -1,107 +0,0 @@ -/* $OpenBSD: cache.h,v 1.9 2016/12/21 13:59:57 visa Exp $ */ - -/* - * Copyright (c) 2012 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_CACHE_H_ -#define _MIPS64_CACHE_H_ - -/* - * Declare canonical cache functions for a given processor. - * - * The following assumptions are made: - * - only L1 has split instruction and data caches. - * - L1 I$ is virtually indexed. - * - * Processor-specific routines will make extra assumptions. - */ - -#define CACHE_PROTOS(chip) \ -/* Figure out cache configuration */ \ -void chip##_ConfigCache(struct cpu_info *); \ -/* Writeback and invalidate all caches */ \ -void chip##_SyncCache(struct cpu_info *); \ -/* Invalidate all I$ for the given range */ \ -void chip##_InvalidateICache(struct cpu_info *, vaddr_t, size_t); \ -/* Register a given page for I$ invalidation */ \ -void chip##_InvalidateICachePage(struct cpu_info *, vaddr_t); \ -/* Perform postponed I$ invalidation */ \ -void chip##_SyncICache(struct cpu_info *); \ -/* Writeback all D$ for the given page */ \ -void chip##_SyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \ -/* Writeback all D$ for the (currently mapped) given page */ \ -void chip##_HitSyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \ -/* Writeback all D$ for the given range */ \ -void chip##_HitSyncDCache(struct cpu_info *, vaddr_t, size_t); \ -/* Invalidate all D$ for the given range */ \ -void chip##_HitInvalidateDCache(struct cpu_info *, vaddr_t, size_t); \ -/* Enforce coherency of the given range */ \ -void chip##_IOSyncDCache(struct cpu_info *, vaddr_t, size_t, int); - -/* - * Cavium Octeon. - */ -CACHE_PROTOS(Octeon) - -void Octeon_lock_secondary_cache(struct cpu_info *, paddr_t, size_t); -void Octeon_unlock_secondary_cache(struct cpu_info *, paddr_t, size_t); - -/* - * STC Loongson 2E and 2F. - */ -CACHE_PROTOS(Loongson2) - -/* - * Loongson 3A and 2Gq. - */ -CACHE_PROTOS(Loongson3) - -/* - * MIPS R4000 and R4400. - */ -CACHE_PROTOS(Mips4k) - -/* - * IDT/QED/PMC-Sierra R4600, R4700, R5000, RM52xx, RM7xxx, RM9xxx. - */ -CACHE_PROTOS(Mips5k) - -/* - * MIPS (SGI, really) R8000. - */ -CACHE_PROTOS(tfp) - -/* - * MIPS/NEC R10000/R120000/R140000/R16000. - */ -CACHE_PROTOS(Mips10k) - -/* - * mips64r2-compliant processors. - */ -CACHE_PROTOS(mips64r2) - -/* - * Values used by the IOSyncDCache routine [which acts as the backend of - * bus_dmamap_sync()]. - */ -#define CACHE_SYNC_R 0 /* WB invalidate, WT invalidate */ -#define CACHE_SYNC_W 1 /* WB writeback, WT unaffected */ -#define CACHE_SYNC_X 2 /* WB writeback + invalidate, WT invalidate */ - -extern vaddr_t cache_valias_mask; - -#endif /* _MIPS64_CACHE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/cdefs.h b/lib/libc/include/generic-openbsd/mips64/cdefs.h deleted file mode 100644 index 685c9d51d52f339806784b95306169535be7e0d0..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/cdefs.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.6 2013/03/28 17:30:45 martynas Exp $ */ - -/* - * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_CDEFS_H_ -#define _MIPS64_CDEFS_H_ - -#define __strong_alias(alias,sym) \ - __asm__(".global " __STRING(alias) " ; " \ - __STRING(alias) " = " __STRING(sym)) -#define __weak_alias(alias,sym) \ - __asm__(".weak " __STRING(alias) " ; " \ - __STRING(alias) " = " __STRING(sym)) -#define __warn_references(sym,msg) \ - __asm__(".section .gnu.warning." __STRING(sym) \ - " ; .ascii \"" msg "\" ; .text") -#define __indr_references(sym,msg) /* nothing */ - -#endif /* !_MIPS64_CDEFS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/cpu.h b/lib/libc/include/generic-openbsd/mips64/cpu.h deleted file mode 100644 index 20177a2555480a354df28fb1aa2e5b1fe907710b..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/cpu.h +++ /dev/null @@ -1,552 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.151 2025/06/06 00:07:58 deraadt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS64_CPU_H_ -#define _MIPS64_CPU_H_ - -#ifndef _LOCORE - -/* - * MIPS32-style segment definitions. - * They only cover the first 512MB of physical addresses. - */ -#define CKSEG0_BASE 0xffffffff80000000UL -#define CKSEG1_BASE 0xffffffffa0000000UL -#define CKSSEG_BASE 0xffffffffc0000000UL -#define CKSEG3_BASE 0xffffffffe0000000UL -#define CKSEG_SIZE 0x0000000020000000UL - -#define CKSEG0_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1)) -#define CKSEG1_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1)) -#define PHYS_TO_CKSEG0(x) ((u_long)(x) | CKSEG0_BASE) -#define PHYS_TO_CKSEG1(x) ((u_long)(x) | CKSEG1_BASE) - -/* - * MIPS64-style segment definitions. - * These allow for 36 bits of addressable physical memory, thus 64GB. - */ - -/* - * Cache Coherency Attributes. - */ -/* r8k only */ -#define CCA_NC_COPROCESSOR 0UL /* uncached, coprocessor ordered */ -/* common to r4, r5k, r8k and r1xk */ -#define CCA_NC 2UL /* uncached, write-around */ -#define CCA_NONCOHERENT 3UL /* cached, non-coherent, write-back */ -/* r8k, r1xk only */ -#define CCA_COHERENT_EXCL 4UL /* cached, coherent, exclusive */ -#define CCA_COHERENT_EXCLWRITE 5UL /* cached, coherent, exclusive write */ -/* r4k only */ -#define CCA_COHERENT_UPDWRITE 6UL /* cached, coherent, update on write */ -/* r1xk only */ -#define CCA_NC_ACCELERATED 7UL /* uncached accelerated */ - -#ifdef TGT_COHERENT -#define CCA_CACHED CCA_COHERENT_EXCLWRITE -#else -#define CCA_CACHED CCA_NONCOHERENT -#endif - -#define XKSSSEG_BASE 0x4000000000000000UL -#define XKPHYS_BASE 0x8000000000000000UL -#define XKSSEG_BASE 0xc000000000000000UL - -#define XKPHYS_TO_PHYS(x) ((paddr_t)(x) & 0x0000000fffffffffUL) -#define PHYS_TO_XKPHYS(x,c) ((paddr_t)(x) | XKPHYS_BASE | ((c) << 59)) -#define IS_XKPHYS(va) (((va) >> 62) == 2) -#define XKPHYS_TO_CCA(x) (((x) >> 59) & 0x07) - -#endif /* _LOCORE */ - -/* - * Exported definitions unique to mips cpu support. - */ - -#if defined(_KERNEL) && !defined(_LOCORE) - -#include -#include -#include -#include -#include -#include - -struct cpu_hwinfo { - uint32_t c0prid; - uint32_t c1prid; - uint32_t clock; /* Hz */ - uint32_t tlbsize; - uint type; - uint32_t l2size; -}; - -/* - * Cache memory configuration. One struct per cache. - */ -struct cache_info { - uint size; /* total cache size */ - uint linesize; /* line size */ - uint setsize; /* set size */ - uint sets; /* number of sets */ -}; - -struct cpu_info { - struct device *ci_dev; /* our device */ - struct cpu_info *ci_self; /* pointer to this structure */ - struct cpu_info *ci_next; /* next cpu */ - struct proc *ci_curproc; - struct user *ci_curprocpaddr; - struct proc *ci_fpuproc; /* pointer to last proc to use FP */ - uint32_t ci_delayconst; - struct cpu_hwinfo - ci_hw; - -#if defined(MULTIPROCESSOR) - struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; -#define __HAVE_UVM_PERCPU - struct uvm_pmr_cache ci_uvm; -#endif - - /* cache information and pending flush state */ - uint ci_cacheconfiguration; - uint64_t ci_cachepending_l1i; - struct cache_info - ci_l1inst, - ci_l1data, - ci_l2, - ci_l3; - - /* function pointers for the cache handling routines */ - void (*ci_SyncCache)(struct cpu_info *); - void (*ci_InvalidateICache)(struct cpu_info *, vaddr_t, - size_t); - void (*ci_InvalidateICachePage)(struct cpu_info *, vaddr_t); - void (*ci_SyncICache)(struct cpu_info *); - void (*ci_SyncDCachePage)(struct cpu_info *, vaddr_t, - paddr_t); - void (*ci_HitSyncDCachePage)(struct cpu_info *, vaddr_t, - paddr_t); - void (*ci_HitSyncDCache)(struct cpu_info *, vaddr_t, size_t); - void (*ci_HitInvalidateDCache)(struct cpu_info *, vaddr_t, - size_t); - void (*ci_IOSyncDCache)(struct cpu_info *, vaddr_t, size_t, - int); - - struct schedstate_percpu - ci_schedstate; - int ci_want_resched; /* need_resched() invoked */ - cpuid_t ci_cpuid; /* our CPU ID */ - uint32_t ci_randseed; /* per cpu random seed */ - volatile int ci_ipl; /* software IPL */ - uint32_t ci_softpending; /* pending soft interrupts */ - int ci_clock_started; - volatile int ci_clock_deferred; /* clock interrupt postponed */ - struct clockqueue - ci_queue; - - struct pmap *ci_curpmap; - uint ci_idepth; /* interrupt depth */ - volatile u_long ci_flags; /* flags; see below */ - volatile int ci_ddb; -#define CI_DDB_RUNNING 0 -#define CI_DDB_SHOULDSTOP 1 -#define CI_DDB_STOPPED 2 -#define CI_DDB_ENTERDDB 3 -#define CI_DDB_INDDB 4 - -#ifdef DIAGNOSTIC - int ci_mutex_level; -#endif -#ifdef GPROF - struct gmonparam *ci_gmon; - struct clockintr ci_gmonclock; -#endif - char ci_panicbuf[512]; -}; - -#define CPUF_PRIMARY 0x01 /* CPU is primary CPU */ -#define CPUF_PRESENT 0x02 /* CPU is present */ -#define CPUF_RUNNING 0x04 /* CPU is running */ - -extern struct cpu_info cpu_info_primary; -extern struct cpu_info *cpu_info_list; -#define CPU_INFO_ITERATOR int -#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \ - ci != NULL; ci = ci->ci_next) - -#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0) - -#define cpu_idle_enter() do { /* nothing */ } while (0) -#define cpu_idle_leave() do { /* nothing */ } while (0) -extern void (*cpu_idle_cycle_func)(void); -#define cpu_idle_cycle() (*cpu_idle_cycle_func)() - -#ifdef MULTIPROCESSOR -#define getcurcpu() hw_getcurcpu() -#define setcurcpu(ci) hw_setcurcpu(ci) -extern struct cpu_info *get_cpu_info(int); -#define curcpu() getcurcpu() -#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) -#define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING) -#define cpu_number() (curcpu()->ci_cpuid) - -void cpu_unidle(struct cpu_info *); -void cpu_boot_secondary_processors(void); -#define cpu_boot_secondary(ci) hw_cpu_boot_secondary(ci) -#define cpu_hatch(ci) hw_cpu_hatch(ci) - -vaddr_t alloc_contiguous_pages(size_t); - -#define MIPS64_IPI_NOP 0x00000001 -#define MIPS64_IPI_RENDEZVOUS 0x00000002 -#define MIPS64_IPI_DDB 0x00000004 -#define MIPS64_NIPIS 3 /* must not exceed 32 */ - -void mips64_ipi_init(void); -void mips64_send_ipi(unsigned int, unsigned int); -void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg); - -#include -#else -#define MAXCPUS 1 -#define curcpu() (&cpu_info_primary) -#define CPU_IS_PRIMARY(ci) 1 -#define CPU_IS_RUNNING(ci) 1 -#define cpu_number() 0UL -#define cpu_unidle(ci) -#define get_cpu_info(i) (&cpu_info_primary) -#endif - -#define CPU_BUSY_CYCLE() __asm volatile ("" ::: "memory") - -extern void (*md_initclock)(void); -extern void (*md_startclock)(struct cpu_info *); -extern void (*md_triggerclock)(void); -void cp0_calibrate(struct cpu_info *); - -unsigned int cpu_rnd_messybits(void); - -#include - -/* - * Arguments to hardclock encapsulate the previous machine state in - * an opaque clockframe. - */ -#define clockframe trapframe /* Use normal trap frame */ - -#define SR_KSU_USER 0x00000010 -#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER) -#define CLKF_PC(framep) ((framep)->pc) -#define CLKF_INTR(framep) (curcpu()->ci_idepth > 1) /* XXX */ - -/* - * This is used during profiling to integrate system time. - */ -#define PROC_PC(p) ((p)->p_md.md_regs->pc) -#define PROC_STACK(p) ((p)->p_md.md_regs->sp) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -void need_resched(struct cpu_info *); -#define clear_resched(ci) (ci)->ci_want_resched = 0 - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On MIPS designs, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define need_proftick(p) aston(p) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -void signotify(struct proc *); - -#define aston(p) ((p)->p_md.md_astpending = 1) - -#define mips_sync() __asm__ volatile ("sync" ::: "memory") - -#endif /* _KERNEL && !_LOCORE */ - -#ifdef _KERNEL -/* - * Values for the code field in a break instruction. - */ -#define BREAK_INSTR 0x0000000d -#define BREAK_VAL_MASK 0x03ff0000 -#define BREAK_VAL_SHIFT 16 -#define BREAK_KDB_VAL 512 -#define BREAK_SSTEP_VAL 513 -#define BREAK_BRKPT_VAL 514 -#define BREAK_SOVER_VAL 515 -#define BREAK_DDB_VAL 516 -#define BREAK_FPUEMUL_VAL 517 -#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT)) -#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT)) -#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT)) -#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT)) -#define BREAK_DDB (BREAK_INSTR | (BREAK_DDB_VAL << BREAK_VAL_SHIFT)) -#define BREAK_FPUEMUL (BREAK_INSTR | (BREAK_FPUEMUL_VAL << BREAK_VAL_SHIFT)) - -#endif /* _KERNEL */ - -/* - * CTL_MACHDEP definitions. - */ -#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ - /* 2 formerly: keyboard reset */ - /* 3 formerly: CPU_LIDSUSPEND */ -#define CPU_LIDACTION 4 /* action caused by lid close */ -#define CPU_MAXID 5 /* number of valid machdep ids */ - -#define CTL_MACHDEP_NAMES { \ - { 0, 0 }, \ - { "allowaperture", CTLTYPE_INT }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "lidaction", CTLTYPE_INT }, \ -} - -/* - * MIPS CPU types (cp_imp). - */ -#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */ -#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */ -#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */ -#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */ -#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */ -#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */ -#define MIPS_CN50XX 0x06 /* Cavium OCTEON CN50xx MIPS64R2*/ -#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */ -#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */ -#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */ -#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */ -#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */ -#define MIPS_R12000 0x0e /* MIPS R12000 ISA IV */ -#define MIPS_R14000 0x0f /* MIPS R14000 ISA IV */ -#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */ -#define MIPS_R4600 0x20 /* PMCS R4600 Orion ISA III */ -#define MIPS_R4700 0x21 /* PMCS R4700 Orion ISA III */ -#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */ -#define MIPS_R5000 0x23 /* MIPS R5000 CPU ISA IV */ -#define MIPS_RM7000 0x27 /* PMCS RM7000 CPU ISA IV */ -#define MIPS_RM52X0 0x28 /* PMCS RM52X0 CPU ISA IV */ -#define MIPS_RM9000 0x34 /* PMCS RM9000 CPU ISA IV */ -#define MIPS_LOONGSON 0x42 /* STC LoongSon CPU ISA III */ -#define MIPS_VR5400 0x54 /* NEC Vr5400 CPU ISA IV+ */ -#define MIPS_LOONGSON2 0x63 /* STC LoongSon2/3 CPU ISA III+ */ -#define MIPS_CN63XX 0x90 /* Cavium OCTEON II CN6[23]xx MIPS64R2 */ -#define MIPS_CN68XX 0x91 /* Cavium OCTEON II CN68xx MIPS64R2 */ -#define MIPS_CN66XX 0x92 /* Cavium OCTEON II CN66xx MIPS64R2 */ -#define MIPS_CN61XX 0x93 /* Cavium OCTEON II CN6[01]xx MIPS64R2 */ -#define MIPS_CN78XX 0x95 /* Cavium OCTEON III CN7[678]xx MIPS64R2 */ -#define MIPS_CN71XX 0x96 /* Cavium OCTEON III CN7[01]xx MIPS64R2 */ -#define MIPS_CN73XX 0x97 /* Cavium OCTEON III CN7[23]xx MIPS64R2 */ - -/* - * MIPS FPU types. Only soft, rest is the same as cpu type. - */ -#define MIPS_SOFT 0x00 /* Software emulation ISA I */ - - -#if defined(_KERNEL) && !defined(_LOCORE) - -extern register_t protosr; -extern int cpu_has_synced_cp0_count; -extern int cpu_has_userlocal; - -#ifdef FPUEMUL -#define CPU_HAS_FPU(ci) ((ci)->ci_hw.c1prid != 0) -#else -#define CPU_HAS_FPU(ci) 1 -#endif - -struct exec_package; -struct user; - -void tlb_asid_wrap(struct cpu_info *); -void tlb_flush(int); -void tlb_flush_addr(vaddr_t); -void tlb_init(unsigned int); -void tlb_set_page_mask(uint32_t); -void tlb_set_pid(u_int); -void tlb_set_wired(uint32_t); -int tlb_update(vaddr_t, register_t); - -void build_trampoline(vaddr_t, vaddr_t); -void cpu_switchto_asm(struct proc *, struct proc *); -int exec_md_map(struct proc *, struct exec_package *); -void savectx(struct user *, int); - -int copyinsn(struct proc *, vaddr_t, uint32_t *); -void enable_fpu(struct proc *); -void save_fpu(void); -int fpe_branch_emulate(struct proc *, struct trapframe *, uint32_t, - vaddr_t); -void MipsSaveCurFPState(struct proc *); -void MipsSaveCurFPState16(struct proc *); -void MipsSwitchFPState(struct proc *, struct trapframe *); -void MipsSwitchFPState16(struct proc *, struct trapframe *); - -void MipsFPTrap(struct trapframe *); -register_t MipsEmulateBranch(struct trapframe *, vaddr_t, uint32_t, uint32_t); - -int classify_insn(uint32_t); -#define INSNCLASS_NEUTRAL 0 -#define INSNCLASS_CALL 1 -#define INSNCLASS_BRANCH 2 - -/* - * Low level access routines to CPU registers - */ - -void setsoftintr0(void); -void clearsoftintr0(void); -void setsoftintr1(void); -void clearsoftintr1(void); -register_t enableintr(void); -register_t disableintr(void); -register_t getsr(void); -register_t setsr(register_t); - -uint32_t cp0_get_cause(void); -u_int cp0_get_count(void); -register_t cp0_get_config(void); -uint32_t cp0_get_config_1(void); -uint32_t cp0_get_config_2(void); -uint32_t cp0_get_config_3(void); -uint32_t cp0_get_config_4(void); -uint32_t cp0_get_pagegrain(void); -register_t cp0_get_prid(void); -void cp0_reset_cause(register_t); -void cp0_set_compare(u_int); -void cp0_set_config(register_t); -void cp0_set_pagegrain(uint32_t); -void cp0_set_trapbase(register_t); -u_int cp1_get_prid(void); - -static inline uint32_t -cp0_get_hwrena(void) -{ - uint32_t value; - __asm__ volatile ("mfc0 %0, $7" : "=r" (value)); - return value; -} - -static inline void -cp0_set_hwrena(uint32_t value) -{ - __asm__ volatile ("mtc0 %0, $7" : : "r" (value)); -} - -static inline void -cp0_set_userlocal(void *value) -{ - __asm__ volatile ( - " .set push\n" - " .set mips64r2\n" - " dmtc0 %0, $4, 2\n" - " .set pop\n" - : : "r" (value)); -} - -static inline u_long -intr_disable(void) -{ - return disableintr(); -} - -static inline void -intr_restore(u_long sr) -{ - setsr(sr); -} - -/* - * Cache routines (may be overridden) - */ - -#ifndef Mips_SyncCache -#define Mips_SyncCache(ci) \ - ((ci)->ci_SyncCache)(ci) -#endif -#ifndef Mips_InvalidateICache -#define Mips_InvalidateICache(ci, va, l) \ - ((ci)->ci_InvalidateICache)(ci, va, l) -#endif -#ifndef Mips_InvalidateICachePage -#define Mips_InvalidateICachePage(ci, va) \ - ((ci)->ci_InvalidateICachePage)(ci, va) -#endif -#ifndef Mips_SyncICache -#define Mips_SyncICache(ci) \ - ((ci)->ci_SyncICache)(ci) -#endif -#ifndef Mips_SyncDCachePage -#define Mips_SyncDCachePage(ci, va, pa) \ - ((ci)->ci_SyncDCachePage)(ci, va, pa) -#endif -#ifndef Mips_HitSyncDCachePage -#define Mips_HitSyncDCachePage(ci, va, pa) \ - ((ci)->ci_HitSyncDCachePage)(ci, va, pa) -#endif -#ifndef Mips_HitSyncDCache -#define Mips_HitSyncDCache(ci, va, l) \ - ((ci)->ci_HitSyncDCache)(ci, va, l) -#endif -#ifndef Mips_HitInvalidateDCache -#define Mips_HitInvalidateDCache(ci, va, l) \ - ((ci)->ci_HitInvalidateDCache)(ci, va, l) -#endif -#ifndef Mips_IOSyncDCache -#define Mips_IOSyncDCache(ci, va, l, h) \ - ((ci)->ci_IOSyncDCache)(ci, va, l, h) -#endif - -#endif /* _KERNEL && !_LOCORE */ -#endif /* !_MIPS64_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/cpustate.h b/lib/libc/include/generic-openbsd/mips64/cpustate.h deleted file mode 100644 index a6ad1d367624f41130462e7aef1b7323bdb0d5ca..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/cpustate.h +++ /dev/null @@ -1,150 +0,0 @@ -/* $OpenBSD: cpustate.h,v 1.11 2015/09/27 18:17:08 miod Exp $ */ - -/* - * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#define KERN_REG_SIZE (NUMSAVEREGS * REGSZ) -#define KERN_EXC_FRAME_SIZE (CF_SZ + KERN_REG_SIZE + 16) - -#define SAVE_REG(reg, offs, base, bo) \ - REG_S reg, bo + (REGSZ * offs) (base) - -#define RESTORE_REG(reg, offs, base, bo) \ - REG_L reg, bo + (REGSZ * offs) (base) - -/* - * This macro saves the 'scratch' cpu state on stack. - * Macros are generic so no 'special' instructions! - * a0 will have a pointer to the 'frame' on return. - * a1 will have saved STATUS_REG on return. - * a3 will have the exception pc on 'return'. - * No traps, no interrupts if frame = k1 or k0! - * Temp regs are saved with their register number so - * branch emulation etc works properly. - */ -#define SAVE_CPU(frame, bo) \ - SAVE_REG(AT, AST, frame, bo) ;\ - SAVE_REG(v0, V0, frame, bo) ;\ - SAVE_REG(v1, V1, frame, bo) ;\ - SAVE_REG(a0, A0, frame, bo) ;\ - SAVE_REG(a1, A1, frame, bo) ;\ - SAVE_REG(a2, A2, frame, bo) ;\ - SAVE_REG(a3, A3, frame, bo) ;\ - MFC0 a0, COP_0_CAUSE_REG ;\ - MFC0_HAZARD ;\ - SAVE_REG(a4, A4, frame, bo) ;\ - SAVE_REG(a5, A5, frame, bo) ;\ - MFC0 a1, COP_0_STATUS_REG ;\ - MFC0_HAZARD ;\ - SAVE_REG(a6, A6, frame, bo) ;\ - SAVE_REG(a7, A7, frame, bo) ;\ - PRE_MFC0_ADDR_HAZARD ;\ - DMFC0 a2, COP_0_BAD_VADDR ;\ - MFC0_HAZARD ;\ - SAVE_REG(t0, T0, frame, bo) ;\ - SAVE_REG(t1, T1, frame, bo) ;\ - DMFC0 a3, COP_0_EXC_PC ;\ - MFC0_HAZARD ;\ - SAVE_REG(t2, T2, frame, bo) ;\ - SAVE_REG(t3, T3, frame, bo) ;\ - SAVE_REG(t8, T8, frame, bo) ;\ - SAVE_REG(t9, T9, frame, bo) ;\ - SAVE_REG(gp, GP, frame, bo) ;\ - SAVE_REG(ra, RA, frame, bo) ;\ - mflo v0 ;\ - mfhi v1 ;\ - SAVE_REG(v0, MULLO, frame, bo) ;\ - SAVE_REG(v1, MULHI, frame, bo) ;\ - SAVE_REG(a0, CAUSE, frame, bo) ;\ - SAVE_REG(a1, SR, frame, bo) ;\ - SAVE_REG(a2, BADVADDR, frame, bo) ;\ - SAVE_REG(a3, PC, frame, bo) ;\ - SAVE_REG(sp, SP, frame, bo) ;\ - PTR_ADDU a0, frame, bo ;\ - GET_CPU_INFO(v0, v1) ;\ - lw a2, CI_IPL(v0) ;\ - SAVE_REG(a2, CPL, frame, bo) - -/* - * Save 'callee save' registers in frame to aid DDB. - */ -#define SAVE_CPU_SREG(frame, bo) \ - SAVE_REG(s0, S0, frame, bo) ;\ - SAVE_REG(s1, S1, frame, bo) ;\ - SAVE_REG(s2, S2, frame, bo) ;\ - SAVE_REG(s3, S3, frame, bo) ;\ - SAVE_REG(s4, S4, frame, bo) ;\ - SAVE_REG(s5, S5, frame, bo) ;\ - SAVE_REG(s6, S6, frame, bo) ;\ - SAVE_REG(s7, S7, frame, bo) ;\ - SAVE_REG(s8, S8, frame, bo) - -/* - * Restore cpu state. When called a0 = EXC_PC. - */ -#define RESTORE_CPU(frame, bo) \ - RESTORE_REG(t1, SR, frame, bo) ;\ - RESTORE_REG(t2, MULLO, frame, bo) ;\ - RESTORE_REG(t3, MULHI, frame, bo) ;\ - MTC0 t1, COP_0_STATUS_REG ;\ - MTC0_SR_IE_HAZARD ;\ - mtlo t2 ;\ - mthi t3 ;\ - DMTC0 a0, COP_0_EXC_PC ;\ - MTC0_HAZARD ;\ - RESTORE_REG(AT, AST, frame, bo) ;\ - RESTORE_REG(v0, V0, frame, bo) ;\ - RESTORE_REG(v1, V1, frame, bo) ;\ - RESTORE_REG(a0, A0, frame, bo) ;\ - RESTORE_REG(a1, A1, frame, bo) ;\ - RESTORE_REG(a2, A2, frame, bo) ;\ - RESTORE_REG(a3, A3, frame, bo) ;\ - RESTORE_REG(a4, A4, frame, bo) ;\ - RESTORE_REG(a5, A5, frame, bo) ;\ - RESTORE_REG(a6, A6, frame, bo) ;\ - RESTORE_REG(a7, A7, frame, bo) ;\ - RESTORE_REG(t0, T0, frame, bo) ;\ - RESTORE_REG(t1, T1, frame, bo) ;\ - RESTORE_REG(t2, T2, frame, bo) ;\ - RESTORE_REG(t3, T3, frame, bo) ;\ - RESTORE_REG(t8, T8, frame, bo) ;\ - RESTORE_REG(t9, T9, frame, bo) ;\ - RESTORE_REG(gp, GP, frame, bo) ;\ - RESTORE_REG(ra, RA, frame, bo) - -/* - * Restore 'callee save' registers - */ -#define RESTORE_CPU_SREG(frame, bo) \ - RESTORE_REG(s0, S0, frame, bo) ;\ - RESTORE_REG(s1, S1, frame, bo) ;\ - RESTORE_REG(s2, S2, frame, bo) ;\ - RESTORE_REG(s3, S3, frame, bo) ;\ - RESTORE_REG(s4, S4, frame, bo) ;\ - RESTORE_REG(s5, S5, frame, bo) ;\ - RESTORE_REG(s6, S6, frame, bo) ;\ - RESTORE_REG(s7, S7, frame, bo) ;\ - RESTORE_REG(s8, S8, frame, bo) \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/db_machdep.h b/lib/libc/include/generic-openbsd/mips64/db_machdep.h deleted file mode 100644 index 7dec17ccc290a4f02606df578d5375cf138749a4..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/db_machdep.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.21 2021/08/30 08:11:12 jasper Exp $ */ - -/* - * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_DB_MACHDEP_H_ -#define _MIPS64_DB_MACHDEP_H_ - -#include -#include -#include - -#define DB_MACHINE_COMMANDS /* We have machine specific commands */ - -typedef struct trapframe db_regs_t; -extern db_regs_t ddb_regs; - -typedef long db_expr_t; - -#define SOFTWARE_SSTEP /* Need software single step */ -#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */ -vaddr_t next_instr_address(vaddr_t, int); -#define BKPT_SIZE (4) -#define BKPT_SET(ins) (BREAK_DDB) -#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0) - -#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK) -#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */ - -#define PC_REGS(regs) ((vaddr_t)(regs)->pc) -#define SET_PC_REGS(regs, value) (regs)->pc = (register_t)(value) - -/* - * Test of instructions to see class. - */ -#define inst_branch(i) (classify_insn(i) == INSNCLASS_BRANCH) -#define inst_trap_return(i) ((i) & 0) -#define inst_call(i) (classify_insn(i) == INSNCLASS_CALL) -#define inst_return(i) ((i) == 0x03e00008) - -void db_machine_init(void); - -int db_enter_ddb(void); -void db_startcpu(int); -void db_stopcpu(int); - -int dbmd_print_insn(uint32_t, vaddr_t, int (*)(const char *, ...)); - -#define DDB_STATE_NOT_RUNNING 0 -#define DDB_STATE_RUNNING 1 -#define DDB_STATE_EXITING 2 - -#endif /* !_MIPS64_DB_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/elf.h b/lib/libc/include/generic-openbsd/mips64/elf.h deleted file mode 100644 index 1cd8fda26a984ce714b564cd5363545f6cf78064..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/elf.h +++ /dev/null @@ -1,7 +0,0 @@ -/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */ - -/* - * This file is in the public domain. - */ - -/* Nothing for now */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/endian.h b/lib/libc/include/generic-openbsd/mips64/endian.h deleted file mode 100644 index 178466dc551c5ec31039c700101cf2ab6847cb57..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/endian.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: endian.h,v 1.9 2014/07/12 16:25:08 guenther Exp $ */ - -/* - * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_ENDIAN_H_ -#define _MIPS64_ENDIAN_H_ - -#if defined(__MIPSEL__) -#define _BYTE_ORDER _LITTLE_ENDIAN -#endif -#if defined(__MIPSEB__) -#define _BYTE_ORDER _BIG_ENDIAN -#endif - -#if !defined(_BYTE_ORDER) -#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!" -#endif - -#define __STRICT_ALIGNMENT - -#ifndef __FROM_SYS__ENDIAN -#include -#endif - -#endif /* _MIPS64_ENDIAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/exec.h b/lib/libc/include/generic-openbsd/mips64/exec.h deleted file mode 100644 index f946e5fc68432799fbe6684f7f9ebb02f0a40939..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/exec.h +++ /dev/null @@ -1,137 +0,0 @@ -/* $OpenBSD: exec.h,v 1.10 2022/10/28 15:07:25 kettenis Exp $ */ - -/* - * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_EXEC_H_ -#define _MIPS64_EXEC_H_ - -#define __LDPGSZ 16384 - -#define ARCH_ELFSIZE 64 -#define ELF_TARG_CLASS ELFCLASS64 - -#if defined(__MIPSEB__) -#define ELF_TARG_DATA ELFDATA2MSB -#else -#define ELF_TARG_DATA ELFDATA2LSB -#endif -#define ELF_TARG_MACH EM_MIPS - -/* Information taken from MIPS ABI supplement */ - -/* Architecture dependent Segment types - p_type */ -#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ - -/* Architecture dependent d_tag field for Elf32_Dyn. */ -#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */ -#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */ -#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */ -#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */ -#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */ -#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */ -#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */ -#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */ -#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */ -#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */ -#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */ -#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Relative address of debug map ptr */ - -#define DT_PROCNUM (DT_MIPS_RLD_MAP_REL - DT_LOPROC + 1) - -/* - * Legal values for e_flags field of Elf32_Ehdr. - */ -#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */ -#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */ -#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */ -#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */ -#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */ -#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -#define E_MIPS_ARCH_1 0x00000000 -#define E_MIPS_ARCH_2 0x10000000 -#define E_MIPS_ARCH_3 0x20000000 -#define E_MIPS_ARCH_4 0x30000000 -#define EF_MIPS_ABI 0x0000f000 /* ABI level */ -#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */ -#define E_MIPS_ABI_O32 0x00001000 -#define E_MIPS_ABI_O64 0x00002000 -#define E_MIPS_ABI_EABI32 0x00004000 -#define E_MIPS_ABI_EABI64 0x00004000 - -/* - * Mips special sections. - */ -#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ - -/* - * Legal values for sh_type field of Elf32_Shdr. - */ -#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */ -#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ - -/* - * Legal values for sh_flags field of Elf32_Shdr. - */ -#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ - -#if 0 -/* - * Entries found in sections of type SHT_MIPS_GPTAB. - */ -typedef union { - struct { - Elf32_Word gt_current_g_value; /* -G val used in compilation */ - Elf32_Word gt_unused; /* Not used */ - } gt_header; /* First entry in section */ - struct { - Elf32_Word gt_g_value; /* If this val were used for -G */ - Elf32_Word gt_bytes; /* This many bytes would be used */ - } gt_entry; /* Subsequent entries in section */ -} Elf32_gptab; - -/* - * Entry found in sections of type SHT_MIPS_REGINFO. - */ -typedef struct { - Elf32_Word ri_gprmask; /* General registers used */ - Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ - Elf32_Sword ri_gp_value; /* $gp register value */ -} Elf32_RegInfo; -#endif - -#endif /* !_MIPS64_EXEC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/fenv.h b/lib/libc/include/generic-openbsd/mips64/fenv.h deleted file mode 100644 index 6059d900666e889a211cc50217f5edf32d4f5bac..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/fenv.h +++ /dev/null @@ -1,94 +0,0 @@ -/* $OpenBSD: fenv.h,v 1.3 2011/05/25 21:46:49 martynas Exp $ */ - -/* - * Copyright (c) 2011 Martynas Venckus - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_FENV_H_ -#define _MIPS64_FENV_H_ - -/* - * Each symbol representing a floating point exception expands to an integer - * constant expression with values, such that bitwise-inclusive ORs of _all - * combinations_ of the constants result in distinct values. - * - * We use such values that allow direct bitwise operations on FPU registers. - */ -#define FE_INEXACT 0x04 -#define FE_UNDERFLOW 0x08 -#define FE_OVERFLOW 0x10 -#define FE_DIVBYZERO 0x20 -#define FE_INVALID 0x40 - -/* - * The following symbol is simply the bitwise-inclusive OR of all floating-point - * exception constants defined above. - */ -#define FE_ALL_EXCEPT (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | \ - FE_DIVBYZERO | FE_INVALID) -#define _MASK_SHIFT 5 - -/* - * Each symbol representing the rounding direction, expands to an integer - * constant expression whose value is distinct non-negative value. - * - * We use such values that allow direct bitwise operations on FPU registers. - */ -#define FE_TONEAREST 0x0 -#define FE_TOWARDZERO 0x1 -#define FE_UPWARD 0x2 -#define FE_DOWNWARD 0x3 - -/* - * The following symbol is simply the bitwise-inclusive OR of all floating-point - * rounding direction constants defined above. - */ -#define _ROUND_MASK (FE_TONEAREST | FE_TOWARDZERO | FE_UPWARD | \ - FE_DOWNWARD) - -/* - * fenv_t represents the entire floating-point environment. - */ -typedef unsigned int fenv_t; - -/* - * The following constant represents the default floating-point environment - * (that is, the one installed at program startup) and has type pointer to - * const-qualified fenv_t. - * - * It can be used as an argument to the functions within the header - * that manage the floating-point environment, namely fesetenv() and - * feupdateenv(). - */ -__BEGIN_DECLS -extern fenv_t __fe_dfl_env; -__END_DECLS -#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env) - -/* - * fexcept_t represents the floating-point status flags collectively, including - * any status the implementation associates with the flags. - * - * A floating-point status flag is a system variable whose value is set (but - * never cleared) when a floating-point exception is raised, which occurs as a - * side effect of exceptional floating-point arithmetic to provide auxiliary - * information. - * - * A floating-point control mode is a system variable whose value may be set by - * the user to affect the subsequent behavior of floating-point arithmetic. - */ -typedef unsigned int fexcept_t; - -#endif /* !_MIPS64_FENV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/fpu.h b/lib/libc/include/generic-openbsd/mips64/fpu.h deleted file mode 100644 index d670aed7bd564d6bc057a512e242160e719dff9f..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/fpu.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $OpenBSD: fpu.h,v 1.2 2012/12/04 05:00:40 deraadt Exp $ */ - -/* - * Copyright (c) 2010 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Layout of the floating-point control/status register (FCR31) - */ - -/* flush denormalized results to zero instead of causing FPCSR_C_E */ -#define FPCSR_FS 0x01000000 - -/* compare condition bits: one bit for MIPS I/II/III, eight bits for MIPS IV */ -#define FPCSR_CONDBIT(c) ((c) == 0 ? 23 : 24 + (c)) -#define FPCSR_CONDVAL(c) (1U << FPCSR_CONDBIT(c)) - -/* cause bits */ -#define FPCSR_C_E 0x00020000 /* unimplemented operation */ -#define FPCSR_C_V 0x00010000 /* invalid operation */ -#define FPCSR_C_Z 0x00008000 /* division by zero */ -#define FPCSR_C_O 0x00004000 /* overflow */ -#define FPCSR_C_U 0x00002000 /* underflow */ -#define FPCSR_C_I 0x00001000 /* inexact */ - -/* enable bits */ -#define FPCSR_E_V 0x00000800 /* invalid operation */ -#define FPCSR_E_Z 0x00000400 /* division by zero */ -#define FPCSR_E_O 0x00000200 /* overflow */ -#define FPCSR_E_U 0x00000100 /* underflow */ -#define FPCSR_E_I 0x00000080 /* inexact */ - -/* flags bits */ -#define FPCSR_F_V 0x00000040 /* invalid operation */ -#define FPCSR_F_Z 0x00000020 /* division by zero */ -#define FPCSR_F_O 0x00000010 /* overflow */ -#define FPCSR_F_U 0x00000008 /* underflow */ -#define FPCSR_F_I 0x00000004 /* inexact */ - -#define FPCSR_C_MASK 0x0003f000 -#define FPCSR_C_SHIFT 12 -#define FPCSR_E_MASK 0x00000f80 -#define FPCSR_E_SHIFT 7 -#define FPCSR_F_MASK 0x0000007c -#define FPCSR_F_SHIFT 2 -#define FPCSR_RM_MASK 0x00000003 /* rounding mode */ - -#ifndef _KERNEL - -/* - * IRIX-compatible interfaces allowing userland to control the state - * of the floating-point control/status register. These are intended - * to let userland control the state of the FS bit. - */ -#include - -__BEGIN_DECLS -int get_fpc_csr(void); -int set_fpc_csr(int); -__END_DECLS -#endif /* _KERNEL */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/frame.h b/lib/libc/include/generic-openbsd/mips64/frame.h deleted file mode 100644 index 233e911c36a9a13d1e592ee4f9853d0c236420ac..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/frame.h +++ /dev/null @@ -1,114 +0,0 @@ -/* $OpenBSD: frame.h,v 1.8 2021/04/29 12:49:19 visa Exp $ */ - -/* - * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#ifndef _MIPS64_FRAME_H_ -#define _MIPS64_FRAME_H_ - -/* - * The layout of this *must* match with regnum.h or bad things - * will happen. libc setjmp/longjmp depends on this as well. - */ -struct trapframe { - register_t zero; - register_t ast; - register_t v0; - register_t v1; - register_t a0; - register_t a1; - register_t a2; - register_t a3; - register_t a4; /* ta0 */ - register_t a5; /* ta1 */ - register_t a6; /* ta2 */ - register_t a7; /* ta3 */ - register_t t0; - register_t t1; - register_t t2; - register_t t3; - register_t s0; - register_t s1; - register_t s2; - register_t s3; - register_t s4; - register_t s5; - register_t s6; - register_t s7; - register_t t8; - register_t t9; - register_t k0; - register_t k1; - register_t gp; - register_t sp; - register_t s8; - register_t ra; - register_t sr; - register_t mullo; - register_t mulhi; - register_t badvaddr; - register_t cause; - register_t pc; - register_t ic; /* unused, was RM7000 ICR */ - register_t ipl; - -/* From here and on, only saved user processes. */ - - f_register_t f0; - f_register_t f1; - f_register_t f2; - f_register_t f3; - f_register_t f4; - f_register_t f5; - f_register_t f6; - f_register_t f7; - f_register_t f8; - f_register_t f9; - f_register_t f10; - f_register_t f11; - f_register_t f12; - f_register_t f13; - f_register_t f14; - f_register_t f15; - f_register_t f16; - f_register_t f17; - f_register_t f18; - f_register_t f19; - f_register_t f20; - f_register_t f21; - f_register_t f22; - f_register_t f23; - f_register_t f24; - f_register_t f25; - f_register_t f26; - f_register_t f27; - f_register_t f28; - f_register_t f29; - f_register_t f30; - f_register_t f31; - register_t fsr; -}; - -#endif /* !_MIPS64_FRAME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/ieee.h b/lib/libc/include/generic-openbsd/mips64/ieee.h deleted file mode 100644 index d96b3479fbec3fec86ad310b45b4d6b073613674..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/ieee.h +++ /dev/null @@ -1,169 +0,0 @@ -/* $OpenBSD: ieee.h,v 1.4 2010/01/23 19:11:21 miod Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ieee.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * ieee.h defines the machine-dependent layout of the machine's IEEE - * floating point. It does *not* define (yet?) any of the rounding - * mode bits, exceptions, and so forth. - */ - -/* - * Define the number of bits in each fraction and exponent. - * - * k k+1 - * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented - * - * (-exp_bias+1) - * as fractions that look like 0.fffff x 2 . This means that - * - * -126 - * the number 0.10000 x 2 , for instance, is the same as the normalized - * - * -127 -128 - * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero - * - * -129 - * in the fraction; to represent 2 , we need two, and so on. This - * - * (-exp_bias-fracbits+1) - * implies that the smallest denormalized number is 2 - * - * for whichever format we are talking about: for single precision, for - * - * -126 -149 - * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and - * - * -149 == -127 - 23 + 1. - */ -#define SNG_EXPBITS 8 -#define SNG_FRACBITS 23 - -#define DBL_EXPBITS 11 -#define DBL_FRACHBITS 20 -#define DBL_FRACLBITS 32 -#define DBL_FRACBITS 52 - -#define EXT_EXPBITS 15 -#define EXT_FRACHBITS 16 -#define EXT_FRACHMBITS 32 -#define EXT_FRACLMBITS 32 -#define EXT_FRACLBITS 32 -#define EXT_FRACBITS 112 - -#define EXT_IMPLICIT_NBIT - -#define EXT_TO_ARRAY32(p, a) do { \ - (a)[0] = (uint32_t)(p)->ext_fracl; \ - (a)[1] = (uint32_t)(p)->ext_fraclm; \ - (a)[2] = (uint32_t)(p)->ext_frachm; \ - (a)[3] = (uint32_t)(p)->ext_frach; \ -} while(0) - -struct ieee_single { -#ifdef __MIPSEB__ - u_int sng_sign:1; - u_int sng_exp:8; - u_int sng_frac:23; -#else - u_int sng_frac:23; - u_int sng_exp:8; - u_int sng_sign:1; -#endif -}; - -struct ieee_double { -#ifdef __MIPSEB__ - u_int dbl_sign:1; - u_int dbl_exp:11; - u_int dbl_frach:20; - u_int dbl_fracl; -#else - u_int dbl_fracl; - u_int dbl_frach:20; - u_int dbl_exp:11; - u_int dbl_sign:1; -#endif -}; - -struct ieee_ext { -#ifdef __MIPSEB__ - u_int ext_sign:1; - u_int ext_exp:15; - u_int ext_frach:16; - u_int ext_frachm; - u_int ext_fraclm; - u_int ext_fracl; -#else - u_int ext_fracl; - u_int ext_fraclm; - u_int ext_frachm; - u_int ext_frach:16; - u_int ext_exp:15; - u_int ext_sign:1; -#endif -}; - -/* - * Floats whose exponent is in [1..INFNAN) (of whatever type) are - * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. - * Floats whose exponent is zero are either zero (iff all fraction - * bits are zero) or subnormal values. - * - * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its - * high fraction; if the bit is set, it is a `quiet NaN'. - */ -#define SNG_EXP_INFNAN 255 -#define DBL_EXP_INFNAN 2047 -#define EXT_EXP_INFNAN 32767 - -#if 0 -#define SNG_QUIETNAN (1 << 22) -#define DBL_QUIETNAN (1 << 19) -#define EXT_QUIETNAN (1 << 15) -#endif - -/* - * Exponent biases. - */ -#define SNG_EXP_BIAS 127 -#define DBL_EXP_BIAS 1023 -#define EXT_EXP_BIAS 16383 \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/ieeefp.h b/lib/libc/include/generic-openbsd/mips64/ieeefp.h deleted file mode 100644 index e3521f45cd0f946e7c5ceb4ecafda9aced50d795..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/ieeefp.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.4 2011/03/23 16:54:36 pirofti Exp $ */ - -/* - * Written by J.T. Conklin, Apr 11, 1995 - * Public domain. - */ - -#ifndef _MIPS64_IEEEFP_H_ -#define _MIPS64_IEEEFP_H_ - -typedef int fp_except; -#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ -#define FP_X_UFL 0x02 /* underflow exception */ -#define FP_X_OFL 0x04 /* overflow exception */ -#define FP_X_DZ 0x08 /* divide-by-zero exception */ -#define FP_X_INV 0x10 /* invalid operation exception */ - -typedef enum { - FP_RN=0, /* round to nearest representable number */ - FP_RZ=1, /* round to zero (truncate) */ - FP_RP=2, /* round toward positive infinity */ - FP_RM=3 /* round toward negative infinity */ -} fp_rnd; - -#ifdef _KERNEL - -/* - * Defines for the floating-point completion/emulation code. - */ - -#include -#include -#include -#include - -#define float_raise(bits) \ - do { curproc->p_md.md_regs->fsr |= (bits) << FPCSR_C_SHIFT; } while (0) -#define float_set_inexact() float_raise(FP_X_IMP) -#define float_set_invalid() float_raise(FP_X_INV) - -#define float_get_round(csr) (csr & FPCSR_RM_MASK) -#define fpgetround() float_get_round(curproc->p_md.md_regs->fsr) - -#endif - -#endif /* !_MIPS64_IEEEFP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/kcore.h b/lib/libc/include/generic-openbsd/mips64/kcore.h deleted file mode 100644 index 5a69401214af28aa88af634148df52c3cdb7d1e5..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/kcore.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.3 2023/01/04 10:59:34 jsg Exp $ */ -/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */ - -/* - * Copyright (c) 1996 Leo Weppelman. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIPS64_KCORE_H_ -#define _MIPS64_KCORE_H_ - -#define NPHYS_RAM_SEGS 8 - -typedef struct cpu_kcore_hdr { - paddr_t kernel_pa; /* Phys. address of kernel VA 0 */ - int mmutype; - phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS]; -} cpu_kcore_hdr_t; - -#endif /* !_MIPS64_KCORE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/limits.h b/lib/libc/include/generic-openbsd/mips64/limits.h deleted file mode 100644 index 398deda85270e8b1940be26b3f75dd63292e8a12..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/limits.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: limits.h,v 1.8 2015/04/30 13:42:08 millert Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS64_LIMITS_H_ -#define _MIPS64_LIMITS_H_ - -#include - -#if __POSIX_VISIBLE || __XPG_VISIBLE -#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ -#endif - -#if __BSD_VISIBLE -#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */ - -/* Quads and longs are the same on mips64 */ -#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */ -#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */ -#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */ - -#endif /* __BSD_VISIBLE */ - -#endif /* !_MIPS64_LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/loongson2.h b/lib/libc/include/generic-openbsd/mips64/loongson2.h deleted file mode 100644 index ecfab5502497f42445eac78ab68cc92510d5c5a8..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/loongson2.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: loongson2.h,v 1.4 2013/01/16 20:28:06 miod Exp $ */ - -/* - * Copyright (c) 2009 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_LOONGSON2_H_ -#define _MIPS64_LOONGSON2_H_ - -/* - * Loongson 2E/2F specific defines - */ - -/* - * Address Window registers physical addresses - * - * The Loongson 2F processor has an AXI crossbar with four possible bus - * masters, each one having four programmable address windows. - * - * Each window is defined with three 64-bit registers: - * - a base address register, defining the address in the master address - * space (base register). - * - an address mask register, defining which address bits are valid in this - * window. A given address matches a window if (addr & mask) == base. - * - the location of the window base in the target, as well at the target - * number itself (mmap register). The lower 20 bits of the address are - * forced as zeroes regardless of their value in this register. - * The translated address is thus (addr & ~mask) | (mmap & ~0xfffff). - */ - -#define LOONGSON_AWR_BASE_ADDRESS 0x3ff00000 - -#define LOONGSON_AWR_BASE(master, window) \ - (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x00) -#define LOONGSON_AWR_SIZE(master, window) \ - (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x20) -#define LOONGSON_AWR_MMAP(master, window) \ - (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x40) - -/* - * Bits in the diagnostic register - */ - -#define COP_0_DIAG_ITLB_CLEAR 0x04 -#define COP_0_DIAG_BTB_CLEAR 0x02 -#define COP_0_DIAG_RAS_DISABLE 0x01 - -#if defined(_KERNEL) && !defined(_LOCORE) -int loongson2f_cpuspeed(int *); -void loongson2f_setperf(int); -#endif - -#endif /* _MIPS64_LOONGSON2_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/loongson3.h b/lib/libc/include/generic-openbsd/mips64/loongson3.h deleted file mode 100644 index 8b8633e3a4286d81f3b29b94baf2a1fd5e6442c2..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/loongson3.h +++ /dev/null @@ -1,108 +0,0 @@ -/* $OpenBSD: loongson3.h,v 1.3 2017/05/10 16:04:21 visa Exp $ */ - -/* - * Copyright (c) 2016 Visa Hankala - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_LOONGSON3_H_ -#define _MIPS64_LOONGSON3_H_ - -/* - * Definitions for Loongson 3A. - */ - -#define LS3_CFG_BASE(node) (0x100000004000ull*(node) + 0x3ff00000) -#define LS3_MEM_BASE(node) (0x100000000000ull*(node)) - -#define LS3_IPI_BASE(n, c) (LS3_CFG_BASE(n) + 0x1000 + 0x100*(c)) -#define LS3_IPI_ISR 0x00 -#define LS3_IPI_IMR 0x04 -#define LS3_IPI_SET 0x08 -#define LS3_IPI_CLEAR 0x0c -#define LS3_IPI_MBOX0 0x20 -#define LS3_IPI_MBOX1 0x28 -#define LS3_IPI_MBOX2 0x30 -#define LS3_IPI_MBOX3 0x38 - -static inline uint32_t -loongson3_get_cpuid(void) -{ - uint32_t tmp; - - asm volatile ( - " .set push\n" - " .set mips64\n" - " mfc0 %0, $15, 1\n" /* EBase */ - " .set pop\n" - : "=r" (tmp)); - - return tmp & 0xf; -} - -#define LS3_COREID(cpuid) ((cpuid) & 3) -#define LS3_NODEID(cpuid) ((cpuid) >> 2) - -/* - * Interrupt router registers - */ - -#define LS3_IRT_ENTRY(node, irq) (LS3_CFG_BASE(node) + 0x1400 + (irq)) -#define LS3_IRT_INTISR(node) (LS3_CFG_BASE(node) + 0x1420) -#define LS3_IRT_INTEN(node) (LS3_CFG_BASE(node) + 0x1424) -#define LS3_IRT_INTENSET(node) (LS3_CFG_BASE(node) + 0x1428) -#define LS3_IRT_INTENCLR(node) (LS3_CFG_BASE(node) + 0x142c) -#define LS3_IRT_INTISR_CORE(node, cpu) (LS3_CFG_BASE(node) + 0x1440 + (cpu)*8) - -/* sys int 0-3 */ -#define LS3_IRT_ENTRY_INT(node, x) LS3_IRT_ENTRY((node), (x)) -/* PCI int 0-3 */ -#define LS3_IRT_ENTRY_PCI(node, x) LS3_IRT_ENTRY((node), 0x04+(x)) -/* LPC int */ -#define LS3_IRT_ENTRY_LPC(node) LS3_IRT_ENTRY((node), 0x0a) -/* HT0 int 0-7 */ -#define LS3_IRT_ENTRY_HT0(node, x) LS3_IRT_ENTRY((node), 0x10+(x)) -/* HT1 int 0-7 */ -#define LS3_IRT_ENTRY_HT1(node, x) LS3_IRT_ENTRY((node), 0x18+(x)) - -#define LS3_IRT_ROUTE(core, intr) ((0x01 << (core)) | (0x10 << (intr))) - -#define LS3_IRQ_INT(x) (x) /* sys int 0-3 */ -#define LS3_IRQ_PCI(x) ((x) + 0x04) /* PCI int 0-3 */ -#define LS3_IRQ_LPC 0x0a /* LPC int */ -#define LS3_IRQ_HT0(x) ((x) + 0x10) /* HT0 int 0-7 */ -#define LS3_IRQ_HT1(x) ((x) + 0x18) /* HT1 int 0-7 */ -#define LS3_IRQ_NUM 32 - -#define LS3_IRQ_IS_HT(irq) ((irq) >= 0x10) - -#define LS3_IRQ_HT_MASK 0xffff0000u - -/* - * Number of HyperTransport interrupt vectors. In reality, each HT interface - * has 256 vectors, but the interrupt code uses only a subset of them. - */ -#define LS3_HT_IRQ_NUM 32 - -/* - * HyperTransport registers - */ - -#define LS3_HT1_MEM_BASE(n) (LS3_MEM_BASE(n)+0x00000e0000000000ull) -#define LS3_HT1_CFG_BASE(n) (LS3_MEM_BASE(n)+0x00000efdfb000000ull) - -#define LS3_HT_ISR_OFFSET(x) (0x80 + (x) * 4) -#define LS3_HT_IMR_OFFSET(x) (0xa0 + (x) * 4) - -#endif /* _MIPS64_LOONGSON3_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/memconf.h b/lib/libc/include/generic-openbsd/mips64/memconf.h deleted file mode 100644 index 208a60d9c5e39631d20b3e5cf0e13b419db72be6..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/memconf.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: memconf.h,v 1.7 2011/05/30 22:25:21 oga Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Memory config list used by pmap_bootstrap. - */ - -#ifndef _MIPS64_MEMCONF_H_ -#define _MIPS64_MEMCONF_H_ - -struct phys_mem_desc { - uint64_t mem_first_page; - uint64_t mem_last_page; -}; - -#ifdef _KERNEL -#ifndef MAXMEMSEGS -#define MAXMEMSEGS 16 -#endif -extern struct phys_mem_desc mem_layout[]; -int memrange_register(uint64_t, uint64_t, uint64_t); -#endif - -#endif /* !_MIPS64_MEMCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/mips_cpu.h b/lib/libc/include/generic-openbsd/mips64/mips_cpu.h deleted file mode 100644 index 02b7f62d4894702595d6e6d5ec64af6881ac9b69..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/mips_cpu.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $OpenBSD: mips_cpu.h,v 1.11 2022/12/11 05:07:25 visa Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS64_CPUREGS_H_ -#define _MIPS64_CPUREGS_H_ - -#if defined(_KERNEL) || defined(_STANDALONE) - -/* - * Status register. - */ - -#define SR_COP_USABILITY 0x30000000 /* CP0 and CP1 only */ -#define SR_COP_0_BIT 0x10000000 -#define SR_COP_1_BIT 0x20000000 -#define SR_COP_2_BIT 0x40000000 -#define SR_RP 0x08000000 -#define SR_FR_32 0x04000000 -#define SR_RE 0x02000000 -#define SR_DSD 0x01000000 /* Only on R12000 */ -#define SR_BOOT_EXC_VEC 0x00400000 -#define SR_TLB_SHUTDOWN 0x00200000 -#define SR_SOFT_RESET 0x00100000 -#define SR_DIAG_CH 0x00040000 -#define SR_DIAG_CE 0x00020000 -#define SR_DIAG_DE 0x00010000 -#define SR_KX 0x00000080 -#define SR_SX 0x00000040 -#define SR_UX 0x00000020 -#define SR_ERL 0x00000004 -#define SR_EXL 0x00000002 -#define SR_INT_ENAB 0x00000001 - -#define SOFT_INT_MASK_0 0x00000100 -#define SOFT_INT_MASK_1 0x00000200 -#define SR_INT_MASK_0 0x00000400 -#define SR_INT_MASK_1 0x00000800 -#define SR_INT_MASK_2 0x00001000 -#define SR_INT_MASK_3 0x00002000 -#define SR_INT_MASK_4 0x00004000 -#define SR_INT_MASK_5 0x00008000 - -#define SR_XX 0x80000000 -#define SR_KSU_MASK 0x00000018 -#define SR_KSU_SUPER 0x00000008 -#define SR_KSU_KERNEL 0x00000000 -#define SR_INT_MASK 0x0000ff00 -/* SR_KSU_USER is in for CLKF_USERMODE() */ -#ifndef SR_KSU_USER -#define SR_KSU_USER 0x00000010 -#endif - -#define SOFT_INT_MASK (SOFT_INT_MASK_0 | SOFT_INT_MASK_1) - -/* - * Cause register. - */ - -#define CR_BR_DELAY 0x80000000 -#define CR_BR_DELAY_SHIFT 31 -#define CR_EXC_CODE 0x0000007c -#define CR_EXC_CODE_SHIFT 2 -#define CR_COP_ERR 0x30000000 -#define CR_COP1_ERR 0x10000000 -#define CR_COP2_ERR 0x20000000 -#define CR_COP3_ERR 0x20000000 -#define CR_INT_SOFT0 0x00000100 -#define CR_INT_SOFT1 0x00000200 -#define CR_INT_0 0x00000400 -#define CR_INT_1 0x00000800 -#define CR_INT_2 0x00001000 -#define CR_INT_3 0x00002000 -#define CR_INT_4 0x00004000 -#define CR_INT_5 0x00008000 - -#define CR_INT_MASK 0x003fff00 - -/* - * Config register. - */ - -#define CFGR_CCA_MASK 0x00000007 -#define CFGR_CU 0x00000008 -#define CFGR_ICE 0x0000000200000000 -#define CFGR_SMM 0x0000000400000000 - -/* - * Location of exception vectors. - */ - -#define RESET_EXC_VEC (CKSEG1_BASE + 0x1fc00000) -#define TLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000000) -#define XTLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000080) -#define CACHE_ERR_EXC_VEC (CKSEG1_BASE + 0x00000100) -#define GEN_EXC_VEC (CKSEG1_BASE + 0x00000180) - -/* - * Coprocessor 0 registers - */ - -/* Common subset */ -#define COP_0_COUNT $9 -#define COP_0_TLB_HI $10 -#define COP_0_STATUS_REG $12 -#define COP_0_CAUSE_REG $13 -#define COP_0_EXC_PC $14 -#define COP_0_PRID $15 -#define COP_0_CONFIG $16 - -/* MIPS64 release 2 */ -#define COP_0_USERLOCAL $4, 2 -#define COP_0_TLB_PG_GRAIN $5, 1 -#define COP_0_EBASE $15, 1 - -/* R4000/5000/10000 */ -#define COP_0_TLB_INDEX $0 -#define COP_0_TLB_RANDOM $1 -#define COP_0_TLB_LO0 $2 -#define COP_0_TLB_LO1 $3 -#define COP_0_TLB_CONTEXT $4 -#define COP_0_TLB_PG_MASK $5 -#define COP_0_TLB_WIRED $6 -#define COP_0_BAD_VADDR $8 -#define COP_0_COMPARE $11 -#define COP_0_LLADDR $17 -#define COP_0_WATCH_LO $18 -#define COP_0_WATCH_HI $19 -#define COP_0_TLB_XCONTEXT $20 -#define COP_0_ECC $26 -#define COP_0_CACHE_ERR $27 -#define COP_0_TAG_LO $28 -#define COP_0_TAG_HI $29 -#define COP_0_ERROR_PC $30 - -/* Loongson-2 specific */ -#define COP_0_DIAG $22 - -/* Octeon specific */ -#define COP_0_CVMCTL $9, 7 -#define COP_0_CVMMEMCTL $11, 7 - -/* - * COP_0_COUNT speed divider. - */ -#if defined(CPU_OCTEON) -#define CP0_CYCLE_DIVIDER 1 -#else -#define CP0_CYCLE_DIVIDER 2 -#endif - -/* - * The floating point version and status registers. - */ -#define FPC_ID $0 -#define FPC_CSR $31 - -/* - * Config1 register - */ -#define CONFIG1_M 0x80000000u -#define CONFIG1_MMUSize1 0x7e000000u -#define CONFIG1_MMUSize1_SHIFT 25 -#define CONFIG1_IS 0x01c00000u -#define CONFIG1_IS_SHIFT 22 -#define CONFIG1_IL 0x00380000u -#define CONFIG1_IL_SHIFT 19 -#define CONFIG1_IA 0x00070000u -#define CONFIG1_IA_SHIFT 16 -#define CONFIG1_DS 0x0000e000u -#define CONFIG1_DS_SHIFT 13 -#define CONFIG1_DL 0x00001c00u -#define CONFIG1_DL_SHIFT 10 -#define CONFIG1_DA 0x00000380u -#define CONFIG1_DA_SHIFT 7 -#define CONFIG1_C2 0x00000040u -#define CONFIG1_MD 0x00000020u -#define CONFIG1_PC 0x00000010u -#define CONFIG1_WR 0x00000008u -#define CONFIG1_CA 0x00000004u -#define CONFIG1_EP 0x00000002u -#define CONFIG1_FP 0x00000001u - -/* - * Config3 register - */ -#define CONFIG3_M 0x80000000 -#define CONFIG3_BPG 0x40000000 -#define CONFIG3_CMGCR 0x20000000 -#define CONFIG3_IPLW 0x00600000 -#define CONFIG3_MMAR 0x001c0000 -#define CONFIG3_MCU 0x00020000 -#define CONFIG3_ISAOnExc 0x00010000 -#define CONFIG3_ISA 0x0000c000 -#define CONFIG3_ULRI 0x00002000 -#define CONFIG3_RXI 0x00001000 -#define CONFIG3_DSP2P 0x00000800 -#define CONFIG3_DSPP 0x00000400 -#define CONFIG3_CTXTC 0x00000200 -#define CONFIG3_ITL 0x00000100 -#define CONFIG3_LPA 0x00000080 -#define CONFIG3_VEIC 0x00000040 -#define CONFIG3_VInt 0x00000020 -#define CONFIG3_SP 0x00000010 -#define CONFIG3_CDMM 0x00000008 -#define CONFIG3_MT 0x00000004 -#define CONFIG3_SM 0x00000002 -#define CONFIG3_TL 0x00000001 - -/* - * Config4 register - */ -#define CONFIG4_M 0x80000000u -#define CONFIG4_IE 0x60000000u -#define CONFIG4_AE 0x10000000u -#define CONFIG4_VTLBSizeExt 0x0f000000u /* when MMUExtDef=3 */ -#define CONFIG4_KScrExist 0x00ff0000u -#define CONFIG4_MMUExtDef 0x0000c000u -#define CONFIG4_MMUExtDef_SHIFT 14 -#define CONFIG4_FTLBPageSize 0x00001f00u /* when MMUExtDef=2 or 3 */ -#define CONFIG4_FTLBWays 0x000000f0u /* when MMUExtDef=2 or 3 */ -#define CONFIG4_FTLBSets 0x0000000fu /* when MMUExtDef=2 or 3 */ -#define CONFIG4_MMUSizeExt 0x000000ffu /* when MMUExtDef=1 */ - -/* - * PageGrain register - */ -#define PGRAIN_RIE 0x80000000 -#define PGRAIN_XIE 0x40000000 -#define PGRAIN_ELPA 0x20000000 -#define PGRAIN_ESP 0x10000000 -#define PGRAIN_IEC 0x08000000 - -/* - * HWREna register - */ -#define HWRENA_ULR 0x20000000u -#define HWRENA_CC 0x00000004u - -#endif /* _KERNEL || _STANDALONE */ - -#endif /* !_MIPS64_CPUREGS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/mips_opcode.h b/lib/libc/include/generic-openbsd/mips64/mips_opcode.h deleted file mode 100644 index f40d67885bec9e5d105ae7206fbc53fa0c4ab114..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/mips_opcode.h +++ /dev/null @@ -1,347 +0,0 @@ -/* $OpenBSD: mips_opcode.h,v 1.9 2017/04/20 15:42:26 visa Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_MIPS_OPCODE_H_ -#define _MIPS64_MIPS_OPCODE_H_ - -/* - * Define the instruction formats and opcode values for the - * MIPS instruction set. - */ - -/* - * Define the instruction formats. - */ -typedef union { - unsigned word; - -#if BYTE_ORDER == BIG_ENDIAN - struct { - unsigned op: 6; - unsigned rs: 5; - unsigned rt: 5; - unsigned imm: 16; - } IType; - - struct { - unsigned op: 6; - unsigned target: 26; - } JType; - - struct { - unsigned op: 6; - unsigned rs: 5; - unsigned rt: 5; - unsigned rd: 5; - unsigned shamt: 5; - unsigned func: 6; - } RType; - - struct { - unsigned op: 6; /* COP1 */ - unsigned : 1; /* always '1' */ - unsigned fmt: 4; - unsigned ft: 5; - unsigned fs: 5; - unsigned fd: 5; - unsigned func: 6; - } FRType; - - struct { - unsigned op: 6; /* COP1X */ - unsigned fr: 5; - unsigned ft: 5; - unsigned fs: 5; - unsigned fd: 5; - unsigned op4: 3; - unsigned fmt3: 3; - } FQType; -#endif -#if BYTE_ORDER == LITTLE_ENDIAN - struct { - unsigned imm: 16; - unsigned rt: 5; - unsigned rs: 5; - unsigned op: 6; - } IType; - - struct { - unsigned target: 26; - unsigned op: 6; - } JType; - - struct { - unsigned func: 6; - unsigned shamt: 5; - unsigned rd: 5; - unsigned rt: 5; - unsigned rs: 5; - unsigned op: 6; - } RType; - - struct { - unsigned func: 6; - unsigned fd: 5; - unsigned fs: 5; - unsigned ft: 5; - unsigned fmt: 4; - unsigned : 1; /* always '1' */ - unsigned op: 6; /* COP1 */ - } FRType; - - struct { - unsigned fmt3: 3; - unsigned op4: 3; - unsigned fd: 5; - unsigned fs: 5; - unsigned ft: 5; - unsigned fr: 5; - unsigned op: 6; /* COP1X */ - } FQType; -#endif -} InstFmt; - -/* - * Values for the 'op' field. - */ -#define OP_SPECIAL 000 -#define OP_BCOND 001 -#define OP_J 002 -#define OP_JAL 003 -#define OP_BEQ 004 -#define OP_BNE 005 -#define OP_BLEZ 006 -#define OP_BGTZ 007 - -#define OP_ADDI 010 -#define OP_ADDIU 011 -#define OP_SLTI 012 -#define OP_SLTIU 013 -#define OP_ANDI 014 -#define OP_ORI 015 -#define OP_XORI 016 -#define OP_LUI 017 - -#define OP_COP0 020 -#define OP_COP1 021 -#define OP_COP2 022 -#define OP_COP3 023 -#define OP_COP1X 023 -#define OP_BEQL 024 -#define OP_BNEL 025 -#define OP_BLEZL 026 -#define OP_BGTZL 027 - -#define OP_DADDI 030 -#define OP_DADDIU 031 -#define OP_LDL 032 -#define OP_LDR 033 - -#define OP_SPECIAL3 037 - -#define OP_LB 040 -#define OP_LH 041 -#define OP_LWL 042 -#define OP_LW 043 -#define OP_LBU 044 -#define OP_LHU 045 -#define OP_LWR 046 -#define OP_LWU 047 - -#define OP_SB 050 -#define OP_SH 051 -#define OP_SWL 052 -#define OP_SW 053 -#define OP_SDL 054 -#define OP_SDR 055 -#define OP_SWR 056 -#define OP_CACHE 057 - -#define OP_LL 060 -#define OP_LWC1 061 -#define OP_LWC2 062 -#define OP_LWC3 063 -#define OP_PREF 063 -#define OP_LLD 064 -#define OP_LDC1 065 -#define OP_LDC2 066 -#define OP_LD 067 - -#define OP_SC 070 -#define OP_SWC1 071 -#define OP_SWC2 072 -#define OP_SWC3 073 -#define OP_SCD 074 -#define OP_SDC1 075 -#define OP_SDC2 076 -#define OP_SD 077 - -/* - * Values for the 'func' field when 'op' == OP_SPECIAL. - */ -#define OP_SLL 000 -#define OP_MOVCI 001 -#define OP_SRL 002 -#define OP_SRA 003 -#define OP_SLLV 004 -#define OP_SRLV 006 -#define OP_SRAV 007 - -#define OP_JR 010 -#define OP_JALR 011 -#define OP_MOVZ 012 -#define OP_MOVN 013 -#define OP_SYSCALL 014 -#define OP_BREAK 015 -#define OP_SYNC 017 - -#define OP_MFHI 020 -#define OP_MTHI 021 -#define OP_MFLO 022 -#define OP_MTLO 023 -#define OP_DSLLV 024 -#define OP_DSRLV 026 -#define OP_DSRAV 027 - -#define OP_MULT 030 -#define OP_MULTU 031 -#define OP_DIV 032 -#define OP_DIVU 033 -#define OP_DMULT 034 -#define OP_DMULTU 035 -#define OP_DDIV 036 -#define OP_DDIVU 037 - -#define OP_ADD 040 -#define OP_ADDU 041 -#define OP_SUB 042 -#define OP_SUBU 043 -#define OP_AND 044 -#define OP_OR 045 -#define OP_XOR 046 -#define OP_NOR 047 - -#define OP_SLT 052 -#define OP_SLTU 053 -#define OP_DADD 054 -#define OP_DADDU 055 -#define OP_DSUB 056 -#define OP_DSUBU 057 - -#define OP_TGE 060 -#define OP_TGEU 061 -#define OP_TLT 062 -#define OP_TLTU 063 -#define OP_TEQ 064 -#define OP_TNE 066 - -#define OP_DSLL 070 -#define OP_DSRL 072 -#define OP_DSRA 073 -#define OP_DSLL32 074 -#define OP_DSRL32 076 -#define OP_DSRA32 077 - -/* - * Values for the 'rt' field when 'op' == OP_BCOND. - */ -#define OP_BLTZ 000 -#define OP_BGEZ 001 -#define OP_BLTZL 002 -#define OP_BGEZL 003 - -#define OP_TGEI 010 -#define OP_TGEIU 011 -#define OP_TLTI 012 -#define OP_TLTIU 013 -#define OP_TEQI 014 -#define OP_TNEI 016 - -#define OP_BLTZAL 020 -#define OP_BGEZAL 021 -#define OP_BLTZALL 022 -#define OP_BGEZALL 023 - -/* - * Values for the 'rs' field when 'op' == OP_COPz. - */ -#define OP_MF 000 -#define OP_DMF 001 -#define OP_CF 002 -#define OP_MFH 003 -#define OP_MT 004 -#define OP_DMT 005 -#define OP_CT 006 -#define OP_MTH 007 -#define OP_BC 010 -#define OP_C0MISC 020 /* cop0 only */ -#define OP_TFP_C0MISC 030 /* cop0 only on R8000 */ - -/* - * Values for the 'rt' field when 'op' == OP_COPz. - */ -#define COPz_BC_TF_MASK 0x01 -#define COPz_BC_TRUE 0x01 -#define COPz_BC_FALSE 0x00 -#define COPz_BCL_TF_MASK 0x02 -#define COPz_BCL_TRUE 0x02 -#define COPz_BCL_FALSE 0x00 -#define COPz_BC_CC_MASK 0x1c -#define COPz_BC_CC_SHIFT 2 - -/* - * Values for the 'func' field when 'op' == OP_COP1X. - */ -#define OP_LWXC1 000 -#define OP_LDXC1 001 -#define OP_SWXC1 010 -#define OP_SDXC1 011 -#define OP_PREFX 017 - -/* - * Values for the 'op4' field when 'op' == OP_COP1X. - */ -#define OP_MADD 04 -#define OP_MSUB 05 -#define OP_NMADD 06 -#define OP_NMSUB 07 - -/* - * Values for the 'func' field when 'op' == OP_SPECIAL3. - */ -#define OP_RDHWR 073 - -#endif /* !_MIPS64_MIPS_OPCODE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/mplock.h b/lib/libc/include/generic-openbsd/mips64/mplock.h deleted file mode 100644 index a2c480761ec57539f780ccd7e1ccc1fe1ec862a5..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/mplock.h +++ /dev/null @@ -1,10 +0,0 @@ -/* $OpenBSD: mplock.h,v 1.2 2017/10/21 06:11:22 visa Exp $ */ - -/* public domain */ - -#ifndef _MACHINE_MPLOCK_H_ -#define _MACHINE_MPLOCK_H_ - -#define __USE_MI_MPLOCK - -#endif /* !_MACHINE_MPLOCK_H */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/mutex.h b/lib/libc/include/generic-openbsd/mips64/mutex.h deleted file mode 100644 index f5115c3084e8ea620d6739688a599123808004fd..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/mutex.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mutex.h,v 1.5 2018/01/25 15:06:29 mpi Exp $ */ - -#define __USE_MI_MUTEX \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/param.h b/lib/libc/include/generic-openbsd/mips64/param.h deleted file mode 100644 index 3420605a0d9228d606fd09bbdb5160aa301bf2db..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/param.h +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: param.h,v 1.37 2023/12/14 13:26:49 claudio Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MIPS64_PARAM_H_ -#define _MIPS64_PARAM_H_ - -#ifdef _KERNEL -#include -#endif - -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) - -#ifdef _KERNEL - -#ifndef KERNBASE -#define KERNBASE 0xffffffff80000000L /* start of kernel virtual */ -#endif - -#define NBPG PAGE_SIZE -#define PGSHIFT PAGE_SHIFT -#define PGOFSET PAGE_MASK - -#define USPACE 16384 -#define UPAGES (USPACE >> PAGE_SHIFT) -#if PAGE_SHIFT > 12 -#define USPACE_ALIGN 0 -#else -#define USPACE_ALIGN (2 * PAGE_SIZE) /* align to an even TLB boundary */ -#endif - -#define NMBCLUSTERS (64 * 1024) /* max cluster allocation */ - -#ifndef MSGBUFSIZE -#if PAGE_SHIFT > 12 -#define MSGBUFSIZE PAGE_SIZE -#else -#define MSGBUFSIZE 8192 -#endif -#endif - -#ifndef _LOCORE -#define DELAY(n) delay(n) -void delay(int); -#endif - -#endif /* _KERNEL */ - -#endif /* _MIPS64_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/pcb.h b/lib/libc/include/generic-openbsd/mips64/pcb.h deleted file mode 100644 index bef10d569cdc3045fb198e030b5aaf19c0980151..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/pcb.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.10 2021/10/07 12:40:16 visa Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: pcb.h 1.13 89/04/23 - * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_PCB_H_ -#define _MIPS64_PCB_H_ - -#include - -/* - * MIPS process control block. This is first in the U-area. - */ -struct pcb { - struct trapframe pcb_regs; /* saved CPU and registers */ - struct { - /* val[12] is unused, was RM7000 ICR */ - register_t val[13]; - } pcb_context; /* kernel context for resume */ - int pcb_onfault; /* for copyin/copyout faults */ - void *pcb_segtab; /* copy of pmap pm_segtab */ -}; - -#endif /* !_MIPS64_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/pmap.h b/lib/libc/include/generic-openbsd/mips64/pmap.h deleted file mode 100644 index 571adc77b869b9340adc271c2ee943bdf6f2cf12..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/pmap.h +++ /dev/null @@ -1,228 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.55 2025/06/02 18:49:04 claudio Exp $ */ - -/* - * Copyright (c) 1987 Carnegie-Mellon University - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_PMAP_H_ -#define _MIPS64_PMAP_H_ - -#include - -#ifdef _KERNEL - -#include - -/* - * The user address space is currently limited to 1TB (0x0 - 0x10000000000). - * - * The user address space is mapped using a two level structure where - * the virtual addresses bits are split in three groups: - * segment:directory:page:offset - * where: - * - offset are the in-page offsets (PAGE_SHIFT bits) - * - page are the third level page table index - * (PMAP_PGSHIFT - Log2(pt_entry_t) bits) - * - directory are the second level page table (directory) index - * (PMAP_PGSHIFT - Log2(void *) bits) - * - segment are the first level page table (segment) index - * (PMAP_PGSHIFT - Log2(void *) bits) - * - * This scheme allows Segment, directory and page tables have the same size - * (1 << PMAP_PGSHIFT bytes, regardless of the pt_entry_t size) to be able to - * share the same allocator. - * - * Note: The kernel doesn't use the same data structures as user programs. - * All the PTE entries are stored in a single array in Sysmap which is - * dynamically allocated at boot time. - */ - -#if defined(MIPS_PTE64) && PAGE_SHIFT == 12 -#error "Cannot use MIPS_PTE64 with 4KB pages." -#endif - -/* - * Size of page table structs (page tables, page directories, - * and segment table) used by this pmap. - */ - -#define PMAP_PGSHIFT 12 -#define PMAP_PGSIZE (1UL << PMAP_PGSHIFT) - -#define NPDEPG (PMAP_PGSIZE / sizeof(void *)) -#define NPTEPG (PMAP_PGSIZE / sizeof(pt_entry_t)) - -/* - * Segment sizes - */ - -#define SEGSHIFT (PAGE_SHIFT+PMAP_PGSHIFT*2-PTE_LOG-3) -#define DIRSHIFT (PAGE_SHIFT+PMAP_PGSHIFT-PTE_LOG) -#define NBSEG (1UL << SEGSHIFT) -#define NBDIR (1UL << DIRSHIFT) -#define SEGOFSET (NBSEG - 1) -#define DIROFSET (NBDIR - 1) - -#define mips_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET) -#define mips_trunc_dir(x) ((vaddr_t)(x) & ~DIROFSET) -#define mips_round_seg(x) (((vaddr_t)(x) + SEGOFSET) & ~SEGOFSET) -#define mips_round_dir(x) (((vaddr_t)(x) + DIROFSET) & ~DIROFSET) -#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)]) - -/* number of segments entries */ -#define PMAP_SEGTABSIZE (PMAP_PGSIZE / sizeof(void *)) - -struct segtab { - pt_entry_t **seg_tab[PMAP_SEGTABSIZE]; -}; - -struct pmap_asid_info { - u_int pma_asid; /* address space tag */ - u_int pma_asidgen; /* TLB PID generation number */ -}; - -/* - * Machine dependent pmap structure. - */ -typedef struct pmap { - struct mutex pm_mtx; /* pmap lock */ - struct mutex pm_swmtx; /* pmap switch lock */ - int pm_count; /* pmap reference count */ - struct pmap_statistics pm_stats; /* pmap statistics */ - struct segtab *pm_segtab; /* pointers to pages of PTEs */ - struct pmap_asid_info pm_asid[1]; /* ASID information */ -} *pmap_t; - -/* - * Compute the sizeof of a pmap structure. Subtract one because one - * ASID info structure is already included in the pmap structure itself. - */ -#define PMAP_SIZEOF(x) \ - (ALIGN(sizeof(struct pmap) + \ - (sizeof(struct pmap_asid_info) * ((x) - 1)))) - -/* machine-dependent pg_flags */ -#define PGF_UNCACHED PG_PMAP0 /* Page is explicitly uncached */ -#define PGF_CACHED PG_PMAP1 /* Page is currently cached */ -#define PGF_ATTR_MOD PG_PMAP2 -#define PGF_ATTR_REF PG_PMAP3 -#define PGF_PRESERVE (PGF_ATTR_MOD | PGF_ATTR_REF) - -#define PMAP_NOCACHE PMAP_MD0 - -extern struct pmap *const kernel_pmap_ptr; - -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) -#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) -#define pmap_kernel() (kernel_pmap_ptr) - -extern pt_entry_t pg_ri; -#define PMAP_CHECK_COPYIN (pg_ri == 0) - -#define PMAP_STEAL_MEMORY /* Enable 'stealing' during boot */ - -#define PMAP_PREFER -extern vaddr_t pmap_prefer_mask; -/* pmap prefer alignment */ -#define PMAP_PREFER_ALIGN() \ - (pmap_prefer_mask ? pmap_prefer_mask + 1 : 0) -/* pmap prefer offset in alignment */ -#define PMAP_PREFER_OFFSET(of) ((of) & pmap_prefer_mask) - -void pmap_bootstrap(void); -int pmap_copyinsn(pmap_t, vaddr_t, uint32_t *); -int pmap_emulate_modify(pmap_t, vaddr_t); -void pmap_page_cache(vm_page_t, u_int); - -#define pmap_init_percpu() do { /* nothing */ } while (0) -#define pmap_unuse_final(p) do { /* nothing yet */ } while (0) -#define pmap_remove_holes(vm) do { /* nothing */ } while (0) - -#define __HAVE_PMAP_DIRECT -vaddr_t pmap_map_direct(vm_page_t); -vm_page_t pmap_unmap_direct(vaddr_t); - -/* - * MD flags to pmap_enter: - */ - -#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK) - -/* Kernel virtual address to page table entry */ -#define kvtopte(va) \ - (Sysmap + (((vaddr_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT)) -/* User virtual address to pte page entry */ -#define uvtopte(va) (((va) >> PAGE_SHIFT) & (NPTEPG -1)) -#define uvtopde(va) (((va) >> DIRSHIFT) & (NPDEPG - 1)) - -static inline pt_entry_t * -pmap_pte_lookup(struct pmap *pmap, vaddr_t va) -{ - pt_entry_t **pde, *pte; - - if ((pde = pmap_segmap(pmap, va)) == NULL) - return NULL; - if ((pte = pde[uvtopde(va)]) == NULL) - return NULL; - return pte + uvtopte(va); -} - -extern pt_entry_t *Sysmap; /* kernel pte table */ -extern u_int Sysmapsize; /* number of pte's in Sysmap */ - -#endif /* _KERNEL */ - -#if !defined(_LOCORE) -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap; /* pmap where mapping lies */ - vaddr_t pv_va; /* virtual address for mapping */ -} *pv_entry_t; - -struct vm_page_md { - struct mutex pv_mtx; /* pv list lock */ - struct pv_entry pv_ent; /* pv list of this seg */ -}; - -#define VM_MDPAGE_INIT(pg) \ - do { \ - mtx_init(&(pg)->mdpage.pv_mtx, IPL_VM); \ - (pg)->mdpage.pv_ent.pv_next = NULL; \ - (pg)->mdpage.pv_ent.pv_pmap = NULL; \ - (pg)->mdpage.pv_ent.pv_va = 0; \ - } while (0) - -#endif /* !_LOCORE */ - -#endif /* !_MIPS64_PMAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/proc.h b/lib/libc/include/generic-openbsd/mips64/proc.h deleted file mode 100644 index 987d27cd4bfba46fb538643ed9493333ea761049..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/proc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: proc.h,v 1.11 2017/04/13 03:52:25 guenther Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)proc.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_PROC_H_ -#define _MIPS64_PROC_H_ - -/* - * Machine-dependent part of the proc structure. - */ -struct mdproc { - struct trapframe *md_regs; /* registers on current frame */ - volatile int md_astpending; /* AST pending for this process */ - int md_flags; /* machine-dependent flags */ - vaddr_t md_uarea; /* allocated uarea virtual addr */ - void *md_tcb; /* user-space thread-control-block */ - - /* ptrace fields */ - vaddr_t md_ss_addr; /* single step address */ - uint32_t md_ss_instr; /* saved single step instruction */ - - /* fpu emulation fields */ - vaddr_t md_fppgva; /* vaddr of the branch emulation page */ - vaddr_t md_fpbranchva; /* vaddr of fp branch destination */ - vaddr_t md_fpslotva; /* initial vaddr of delay slot */ - - int32_t md_obsolete[10]; /* Were RM7000-specific data. */ -}; - -/* - * Values for md_flags. - * MDP_FPUSED has two meanings: if the floating point hardware (coprocessor - * #1) is available, it means it has been used; if there is no floating - * point hardware, it means the process is currently running a duplicated - * delay slot, created by the branch emulation logic. - */ -#define MDP_FPUSED 0x00000001 /* floating point coprocessor used */ -#define MDP_PERF 0x00010000 /* Performance counter used */ -#define MDP_WATCH1 0x00020000 /* Watch register 1 used */ -#define MDP_WATCH2 0x00040000 /* Watch register 1 used */ -#define MDP_FORKSAVE 0x0000ffff /* Flags to save when forking */ - -#endif /* !_MIPS64_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/profile.h b/lib/libc/include/generic-openbsd/mips64/profile.h deleted file mode 100644 index 09470a2561e34ffdac7a252355a2a995e418919f..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/profile.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $OpenBSD: profile.h,v 1.5 2019/04/19 09:19:22 visa Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)profile.h 8.1 (Berkeley) 6/10/93 - */ -#ifndef _MIPS64_PROFILE_H_ -#define _MIPS64_PROFILE_H_ - -#define _MCOUNT_DECL static void ___mcount - -/*XXX The cprestore instruction is a "dummy" to shut up as(1). */ - -#define MCOUNT \ - __asm(".globl _mcount;" \ - ".type _mcount,@function;" \ - "_mcount:;" \ - ".set noreorder;" \ - ".set noat;" \ - ".cpload $25;" \ - ".cprestore 4;" \ - "sd $4,16($29);" \ - "sd $5,24($29);" \ - "sd $6,32($29);" \ - "sd $7,40($29);" \ - "sd $1,0($29);" \ - "sd $31,8($29);" \ - "move $5,$31;" \ - ".local ___mcount;" \ - "jal ___mcount;" \ - "move $4,$1;" \ - "ld $4,16($29);" \ - "ld $5,24($29);" \ - "ld $6,32($29);" \ - "ld $7,40($29);" \ - "ld $31,8($29);" \ - "ld $1,0($29);" \ - "daddu $29,$29,16;" \ - "j $31;" \ - "move $31,$1;" \ - ".set reorder;" \ - ".set at"); - -#ifdef _KERNEL -/* - * The following two macros do splhigh and splx respectively. - * They have to be defined this way because these are real - * functions on the MIPS, and we do not want to invoke mcount - * recursively. - */ -#define MCOUNT_ENTER s = _splhigh() - -#define MCOUNT_EXIT _splx(s) -#endif /* _KERNEL */ - -#endif /* !_MIPS64_PROFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/pte.h b/lib/libc/include/generic-openbsd/mips64/pte.h deleted file mode 100644 index cc5c5d0ba198b041dc169db65c8cd5e83b891cd0..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/pte.h +++ /dev/null @@ -1,160 +0,0 @@ -/* $OpenBSD: pte.h,v 1.24 2023/01/11 03:17:56 visa Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: pte.h 1.11 89/09/03 - * from: @(#)pte.h 8.1 (Berkeley) 6/10/93 - */ - -/* - * R4000 and R8000 hardware page table entries - */ - -#ifndef _MIPS64_PTE_H_ -#define _MIPS64_PTE_H_ - -#ifndef _LOCORE - -/* - * Structure defining a TLB entry data set. - */ -struct tlb_entry { - u_int64_t tlb_mask; - u_int64_t tlb_hi; - u_int64_t tlb_lo0; - u_int64_t tlb_lo1; -}; - -u_int tlb_get_pid(void); -void tlb_read(unsigned int, struct tlb_entry *); - -#ifdef MIPS_PTE64 -typedef u_int64_t pt_entry_t; -#else -typedef u_int32_t pt_entry_t; -#endif - -#endif /* _LOCORE */ - -#ifdef MIPS_PTE64 -#define PTE_BITS 64 -#define PTE_LOAD ld -#define PTE_LOG 3 -#define PTE_OFFS 8 -#else -#define PTE_BITS 32 -#define PTE_LOAD lwu -#define PTE_LOG 2 -#define PTE_OFFS 4 -#endif - -#if defined(CPU_MIPS64R2) && !defined(CPU_LOONGSON2) -#define PTE_CLEAR_SWBITS(reg) \ - .set push; \ - .set mips64r2; \ - /* Clear SW bits between PG_XI and PG_FRAMEBITS. */ \ - dins reg, zero, PG_FRAMEBITS, (PTE_BITS - 2 - PG_FRAMEBITS); \ - .set pop -#else -#define PTE_CLEAR_SWBITS(reg) \ - /* Clear SW bits left of PG_FRAMEBITS. */ \ - dsll reg, reg, (64 - PG_FRAMEBITS); \ - dsrl reg, reg, (64 - PG_FRAMEBITS) -#endif - -/* entryhi values */ - -#define PG_HVPN (-2 * PAGE_SIZE) /* Hardware page number mask */ -#define PG_ODDPG PAGE_SIZE - -/* Address space ID */ -#define PG_ASID_MASK 0x00000000000000ff -#define PG_ASID_SHIFT 0 -#define MIN_USER_ASID 1 -#define PG_ASID_COUNT 256 /* Number of available ASID */ - -/* entrylo values */ - -#ifdef MIPS_PTE64 -#define PG_FRAMEBITS 60 -#else -#define PG_FRAMEBITS 28 -#endif -#define PG_FRAME ((1ULL << PG_FRAMEBITS) - (1ULL << PG_SHIFT)) -#define PG_SHIFT 6 - -/* software pte bits - not put in entrylo */ -#define PG_WIRED (1ULL << (PG_FRAMEBITS + 1)) -#define PG_RO (1ULL << (PG_FRAMEBITS + 0)) - -#ifdef CPU_MIPS64R2 -#define PG_RI (1ULL << (PG_FRAMEBITS + 3)) -#define PG_XI (1ULL << (PG_FRAMEBITS + 2)) -#else -#define PG_RI 0x00000000 -#define PG_XI 0x00000000 -#endif - -#define PG_NV 0x00000000 -#define PG_G 0x00000001 -#define PG_V 0x00000002 -#define PG_M 0x00000004 -#define PG_CCA_SHIFT 3 - -#define PG_UNCACHED (CCA_NC << PG_CCA_SHIFT) -#define PG_CACHED_NC (CCA_NONCOHERENT << PG_CCA_SHIFT) -#define PG_CACHED_CE (CCA_COHERENT_EXCL << PG_CCA_SHIFT) -#define PG_CACHED_CEW (CCA_COHERENT_EXCLWRITE << PG_CCA_SHIFT) -#define PG_CACHED (CCA_CACHED << PG_CCA_SHIFT) -#define PG_CACHEMODE (7 << PG_CCA_SHIFT) - -#define PG_PROTMASK (PG_M | PG_RO | PG_RI | PG_XI) - -#define pfn_to_pad(pa) ((((paddr_t)pa) & PG_FRAME) << PG_SHIFT) -#define vad_to_pfn(va) (((va) >> PG_SHIFT) & PG_FRAME) - -#define PG_SIZE_4K 0x00000000 -#define PG_SIZE_16K 0x00006000 -#define PG_SIZE_64K 0x0001e000 -#define PG_SIZE_256K 0x0007e000 -#define PG_SIZE_1M 0x001fe000 -#define PG_SIZE_4M 0x007fe000 -#define PG_SIZE_16M 0x01ffe000 -#if PAGE_SHIFT == 12 -#define TLB_PAGE_MASK PG_SIZE_4K -#elif PAGE_SHIFT == 14 -#define TLB_PAGE_MASK PG_SIZE_16K -#endif - -#endif /* !_MIPS64_PTE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/ptrace.h b/lib/libc/include/generic-openbsd/mips64/ptrace.h deleted file mode 100644 index 000251046bc02a091b0d82f010cccf8372ea3531..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/ptrace.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_PTRACE_H_ -#define _MIPS64_PTRACE_H_ - -/* - * Machine dependent trace commands. - * - */ - -#define PT_GETREGS (PT_FIRSTMACH+0) -#define PT_SETREGS (PT_FIRSTMACH+1) -#define PT_STEP (PT_FIRSTMACH+2) - -#endif /* !_MIPS64_PTRACE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/reg.h b/lib/libc/include/generic-openbsd/mips64/reg.h deleted file mode 100644 index 38245604ff42012a86bcce96432b6c6409a8da97..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/reg.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: reg.h,v 1.5 2021/10/07 12:32:10 visa Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: reg.h 1.1 90/07/09 - * @(#)reg.h 8.2 (Berkeley) 1/11/94 - */ - -#ifndef _MIPS64_REG_H_ -#define _MIPS64_REG_H_ -/* - * Location of the users' stored - * registers relative to ZERO. - * Usage is p->p_regs[XX]. - * - * must be visible to assembly code. - */ -#include - -struct reg { - register_t r_regs[NREGS]; /* numbered as above */ -}; -#endif /* !_MIPS64_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/regdef.h b/lib/libc/include/generic-openbsd/mips64/regdef.h deleted file mode 100644 index 27c56a035a292209a8b5fd35e0be820f73040012..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/regdef.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: regdef.h,v 1.5 2014/03/10 21:10:36 miod Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. This file is derived from the MIPS RISC - * Architecture book by Gerry Kane. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)regdef.h 8.1 (Berkeley) 6/10/93 - */ -#ifndef _MIPS64_REGDEF_H_ -#define _MIPS64_REGDEF_H_ - -#define zero $0 /* always zero */ -#define AT $at /* assembler temp */ -#define v0 $2 /* return value */ -#define v1 $3 -#define a0 $4 /* argument registers */ -#define a1 $5 -#define a2 $6 -#define a3 $7 -#define a4 $8 -#define a5 $9 -#define a6 $10 -#define a7 $11 -#define ta0 $8 /* alias */ -#define ta1 $9 -#define ta2 $10 -#define ta3 $11 -#define t0 $12 /* temp registers (not saved across subroutine calls) */ -#define t1 $13 -#define t2 $14 -#define t3 $15 -#define s0 $16 /* saved across subroutine calls (callee saved) */ -#define s1 $17 -#define s2 $18 -#define s3 $19 -#define s4 $20 -#define s5 $21 -#define s6 $22 -#define s7 $23 -#define t8 $24 /* two more temp registers */ -#define t9 $25 -#define k0 $26 /* kernel temporary */ -#define k1 $27 -#define gp $28 /* global pointer */ -#define sp $29 /* stack pointer */ -#define s8 $30 /* one more callee saved */ -#define ra $31 /* return address */ - -#endif /* !_MIPS64_REGDEF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/regnum.h b/lib/libc/include/generic-openbsd/mips64/regnum.h deleted file mode 100644 index f11f05e222ff95c9151c83a288e6e93d1fe31f57..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/regnum.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $OpenBSD: regnum.h,v 1.4 2014/07/09 12:58:08 miod Exp $ */ - -/* - * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_REGNUM_H_ -#define _MIPS64_REGNUM_H_ - -/* - * Location of the saved registers relative to ZERO. - * Usage is p->p_regs[XX]. - */ -#define ZERO 0 -#define AST 1 -#define V0 2 -#define V1 3 -#define A0 4 -#define A1 5 -#define A2 6 -#define A3 7 -#define A4 8 -#define A5 9 -#define A6 10 -#define A7 11 -#define T0 12 -#define T1 13 -#define T2 14 -#define T3 15 -#define S0 16 -#define S1 17 -#define S2 18 -#define S3 19 -#define S4 20 -#define S5 21 -#define S6 22 -#define S7 23 -#define T8 24 -#define T9 25 -#define K0 26 -#define K1 27 -#define GP 28 -#define SP 29 -#define S8 30 -#define RA 31 -#define SR 32 -#define PS SR /* alias for SR */ -#define MULLO 33 -#define MULHI 34 -#define BADVADDR 35 -#define CAUSE 36 -#define PC 37 -#define IC 38 -#define CPL 39 - -#define NUMSAVEREGS 40 /* Number of registers saved in trap */ - -#define FPBASE NUMSAVEREGS -#define F0 (FPBASE+0) -#define F1 (FPBASE+1) -#define F2 (FPBASE+2) -#define F3 (FPBASE+3) -#define F4 (FPBASE+4) -#define F5 (FPBASE+5) -#define F6 (FPBASE+6) -#define F7 (FPBASE+7) -#define F8 (FPBASE+8) -#define F9 (FPBASE+9) -#define F10 (FPBASE+10) -#define F11 (FPBASE+11) -#define F12 (FPBASE+12) -#define F13 (FPBASE+13) -#define F14 (FPBASE+14) -#define F15 (FPBASE+15) -#define F16 (FPBASE+16) -#define F17 (FPBASE+17) -#define F18 (FPBASE+18) -#define F19 (FPBASE+19) -#define F20 (FPBASE+20) -#define F21 (FPBASE+21) -#define F22 (FPBASE+22) -#define F23 (FPBASE+23) -#define F24 (FPBASE+24) -#define F25 (FPBASE+25) -#define F26 (FPBASE+26) -#define F27 (FPBASE+27) -#define F28 (FPBASE+28) -#define F29 (FPBASE+29) -#define F30 (FPBASE+30) -#define F31 (FPBASE+31) -#define FSR (FPBASE+32) - -#define NUMFPREGS 33 - -#define NREGS (NUMSAVEREGS + NUMFPREGS) - -#endif /* !_MIPS64_REGNUM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/reloc.h b/lib/libc/include/generic-openbsd/mips64/reloc.h deleted file mode 100644 index c25f3c163d7f1973a1f7dd4262efa9115220a965..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/reloc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.4 2017/08/13 14:56:09 visa Exp $ */ - -/* - * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS64_RELOC_H_ -#define _MIPS64_RELOC_H_ - -/* - * Mips relocations. - */ - -#define R_MIPS_NONE 0 /* No reloc */ -#define R_MIPS_16 1 /* Direct 16 bit */ -#define R_MIPS_32 2 /* Direct 32 bit */ -#define R_MIPS_REL32 3 /* PC relative 32 bit */ -#define R_MIPS_26 4 /* Direct 26 bit shifted */ -#define R_MIPS_HI16 5 /* High 16 bit */ -#define R_MIPS_LO16 6 /* Low 16 bit */ -#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -#define R_MIPS_PC16 10 /* PC relative 16 bit */ -#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ - -#define R_MIPS_64 18 - -#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32) - -#endif /* !_MIPS64_RELOC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/setjmp.h b/lib/libc/include/generic-openbsd/mips64/setjmp.h deleted file mode 100644 index a7f81372b643302cec43055dff972df20b878c8b..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/setjmp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.4 2018/01/08 16:44:32 visa Exp $ */ - -/* Public domain */ - -#ifndef _MIPS64_SETJMP_H_ -#define _MIPS64_SETJMP_H_ - -#define _JB_MASK (1 * REGSZ) -#define _JB_PC (2 * REGSZ) -#define _JB_REGS (3 * REGSZ) -#define _JB_FPREGS (37 * REGSZ) - -#define _JBLEN 83 /* size, in longs, of a jmp_buf */ - -#endif /* !_MIPS64_SETJMP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/signal.h b/lib/libc/include/generic-openbsd/mips64/signal.h deleted file mode 100644 index 2d6f9c1ad86f5a5ea70e7c97c2098378cdbd5226..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/signal.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: signal.h,v 1.13 2018/01/08 16:44:32 visa Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signal.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_SIGNAL_H_ -#define _MIPS64_SIGNAL_H_ - -#include -#include - -/* - * Machine-dependent signal definitions - */ -typedef int sig_atomic_t; - -#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to restore state properly if - * a non-standard exit is performed. - */ -struct sigcontext { - long sc_cookie; - long sc_mask; /* signal mask to restore XXX should be int */ - __register_t sc_pc; /* pc at time of signal */ - __register_t sc_regs[32]; /* processor regs 0 to 31 */ - __register_t mullo; /* mullo and mulhi registers... */ - __register_t mulhi; /* mullo and mulhi registers... */ - f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */ - long sc_fpused; /* fp has been used */ - long sc_fpc_eir; /* floating point exception instruction reg */ - long xxx[8]; /* XXX reserved */ -}; -#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */ - -#endif /* !_MIPS64_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/spinlock.h b/lib/libc/include/generic-openbsd/mips64/spinlock.h deleted file mode 100644 index 4ca59f45178112695da6a091194d2f066bcdfa96..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/spinlock.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.5 2017/09/05 02:40:54 guenther Exp $ */ - /* Public domain */ - -#ifndef _MIPS64_SPINLOCK_H_ -#define _MIPS64_SPINLOCK_H_ - -#define _ATOMIC_LOCK_UNLOCKED (0) -#define _ATOMIC_LOCK_LOCKED (1) -typedef int _atomic_lock_t; - -#endif /* !_MIPS64_SPINLOCK_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/sysarch.h b/lib/libc/include/generic-openbsd/mips64/sysarch.h deleted file mode 100644 index 04171b7d5d6a11c23c0b137c931123ee82fc4379..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/sysarch.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: sysarch.h,v 1.2 2012/12/05 23:20:13 deraadt Exp $ */ - -/* - * Copyright (c) 2009 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_SYSARCH_H_ -#define _MIPS64_SYSARCH_H_ - -/* - * Architecture specific syscalls (mips64) - */ - -#define MIPS64_CACHEFLUSH 0 - -/* - * Argument structure and defines to mimic IRIX cacheflush() system call - */ - -struct mips64_cacheflush_args { - vaddr_t va; - size_t sz; - int which; -#define ICACHE 0x01 -#define DCACHE 0x02 -#define BCACHE (ICACHE | DCACHE) -}; - -#ifndef _KERNEL - -#include - -__BEGIN_DECLS -int cacheflush(void *, int, int); -int _flush_cache(char *, int, int); -int sysarch(int, void *); -__END_DECLS -#endif /* _KERNEL */ - -#endif /* _MIPS64_SYSARCH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/tcb.h b/lib/libc/include/generic-openbsd/mips64/tcb.h deleted file mode 100644 index eb7bf3bce54545b3976cc142a990ae9faf59d4e7..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/tcb.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $OpenBSD: tcb.h,v 1.4 2017/04/20 16:07:52 visa Exp $ */ - -/* - * Copyright (c) 2011 Philip Guenther - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_TCB_H_ -#define _MACHINE_TCB_H_ - -#ifdef _KERNEL - -static inline void -__mips64_set_tcb(struct proc *p, void *tcb) -{ -#ifdef CPU_MIPS64R2 - extern int cpu_has_userlocal; - - if (cpu_has_userlocal) - cp0_set_userlocal(tcb); -#endif - - p->p_md.md_tcb = tcb; -} - -#define TCB_SET(p, addr) __mips64_set_tcb(p, addr) -#define TCB_GET(p) ((p)->p_md.md_tcb) - -#else /* _KERNEL */ - -/* ELF TLS ABI calls for small TCB, with static TLS data after it */ -#define TLS_VARIANT 1 - -static inline void * -__mips64_get_tcb(void) -{ - void *tcb; - - /* - * This invokes emulation in kernel if the system does not implement - * the RDHWR instruction or the UserLocal register. - */ - __asm__ volatile ( - " .set push\n" - " .set mips64r2\n" - " rdhwr %0, $29\n" - " .set pop\n" : "=r" (tcb)); - return tcb; -} - -#define TCB_GET() __mips64_get_tcb() - -#endif /* _KERNEL */ - -#endif /* _MACHINE_TCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/timetc.h b/lib/libc/include/generic-openbsd/mips64/timetc.h deleted file mode 100644 index 8d7039b7063c7bcc66723542a76db95f91899541..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/timetc.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: timetc.h,v 1.3 2020/07/18 08:37:43 visa Exp $ */ -/* - * Copyright (c) 2020 Paul Irofti - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MIPS64_TIMETC_H_ -#define _MIPS64_TIMETC_H_ - -#define TC_CP0_COUNT 1 - -#endif /* _MIPS64_TIMETC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/trap.h b/lib/libc/include/generic-openbsd/mips64/trap.h deleted file mode 100644 index 2fff7cd58444a028f3a5c1251d705d6ae22bf6e5..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/trap.h +++ /dev/null @@ -1,127 +0,0 @@ -/* $OpenBSD: trap.h,v 1.17 2022/01/28 16:20:09 visa Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: trap.h 1.1 90/07/09 - * from: @(#)trap.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS64_TRAP_H_ -#define _MIPS64_TRAP_H_ - -/* - * Trap codes (ExcCode in the cause register); also known in trap.c for - * name strings. - */ - -#define T_INT 0 /* Interrupt pending */ -#define T_TLB_MOD 1 /* TLB modified fault */ -#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */ -#define T_TLB_ST_MISS 3 /* TLB miss on a store */ -#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */ -#define T_ADDR_ERR_ST 5 /* Address error on a store */ -#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */ -#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */ -#define T_SYSCALL 8 /* System call */ -#define T_BREAK 9 /* Breakpoint */ -#define T_RES_INST 10 /* Reserved instruction exception */ -#define T_COP_UNUSABLE 11 /* Coprocessor unusable */ -#define T_OVFLOW 12 /* Arithmetic overflow */ -#define T_TRAP 13 /* Trap instruction */ -#define T_VCEI 14 /* R4k Virtual coherency instruction */ -#define T_FPE 15 /* Floating point exception */ -#define T_IWATCH 16 /* R4k Inst. Watch address reference */ -#define T_C2E 18 /* R5k Coprocessor 2 exception */ -#define T_MDMX 22 /* R5k MDMX unusable */ -#define T_DWATCH 23 /* Data Watch address reference */ -#define T_MCHECK 24 /* Machine check */ -#define T_CACHEERR 30 /* Cache error */ -#define T_VCED 31 /* R4k Virtual coherency data */ - -#define T_USER 0x20 /* user-mode flag or'ed with type */ - -/* - * Defines for trap handler catching kernel accessing memory. - */ -#define KT_COPYERR 1 /* User space copy error */ -#define KT_KCOPYERR 2 /* Kernel space copy error */ -#define KT_DDBERR 3 /* DDB access error */ - -#ifndef _LOCORE - -#if defined(DDB) || defined(DEBUG) - -struct trapdebug { /* trap history buffer for debugging */ - register_t status; - register_t cause; - register_t vadr; - register_t pc; - register_t ra; - register_t sp; - u_int code; - u_int ipl; -}; - -#define trapdebug_enter(ci, frame, cd) \ -do { \ - register_t sr = disableintr(); \ - u_long cpuid = ci->ci_cpuid; \ - struct trapdebug *t; \ - \ - t = trapdebug + TRAPSIZE * cpuid + trppos[cpuid]; \ - t->status = frame->sr; \ - t->cause = frame->cause; \ - t->vadr = frame->badvaddr; \ - t->pc = frame->pc; \ - t->sp = frame->sp; \ - t->ra = frame->ra; \ - t->ipl = frame->ipl; \ - t->code = cd; \ - if (++trppos[cpuid] == TRAPSIZE) \ - trppos[cpuid] = 0; \ - setsr(sr); \ -} while (0) - -#define TRAPSIZE 10 /* Trap log buffer length */ -extern struct trapdebug trapdebug[MAXCPUS * TRAPSIZE]; -extern uint trppos[MAXCPUS]; - -void trapDump(const char *, int (*)(const char *, ...)); - -#else -#define trapdebug_enter(ci, frame, code) -#endif -#endif /* _LOCORE */ - -#endif /* !_MIPS64_TRAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/mips64/vmparam.h b/lib/libc/include/generic-openbsd/mips64/vmparam.h deleted file mode 100644 index 64dbaaabb8f0d2e33dfdcde3385a34dc5b22a30f..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/mips64/vmparam.h +++ /dev/null @@ -1,115 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.31 2023/11/16 13:47:22 deraadt Exp $ */ -/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: vmparam.h 1.16 91/01/18 - * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 - */ - -#ifndef _MIPS64_VMPARAM_H_ -#define _MIPS64_VMPARAM_H_ - -/* - * Machine dependent constants mips processors. - */ - -#define USRSTACK VM_MAXUSER_ADDRESS /* Start of user stack */ - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (128*1024*1024) /* max text size */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (128*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (16UL*1024*1024*1024) /* max data size */ -#endif -#ifndef BRKSIZ -#define BRKSIZ MAXDSIZ /* heap gap size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (2*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (32*1024*1024) /* max stack size */ -#endif - -#define STACKGAP_RANDOM 256*1024 - -/* - * PTEs for mapping user space into the kernel for physio operations. - * 16 pte's are enough to cover 8 disks * MAXBSIZE. - */ -#ifndef USRIOSIZE -#define USRIOSIZE 32 -#endif - -/* - * PTEs for system V style shared memory. - * This is basically slop for kmempt which we actually allocate (malloc) from. - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 8192 /* 8mb */ -#endif - -#ifndef VM_PHYSSEG_MAX -#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */ -#endif -#ifndef VM_PHYSSEG_STRAT -#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH -#endif -#define VM_PHYSSEG_NOADD - -/* user/kernel map constants */ -#define VM_MIN_ADDRESS ((vaddr_t)0x0000000000004000L) -#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000010000000000L) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#ifdef _KERNEL -#define VM_MIN_STACK_ADDRESS ((vaddr_t)0x000000c000000000L) -#endif -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc000000000000000L) -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xc000000040000000L) - -/* map PIE into approximately the first quarter of user va space */ -#define VM_PIE_MIN_ADDR PAGE_SIZE -#define VM_PIE_MAX_ADDR (0x4000000000UL) - -/* virtual sizes (bytes) for various kernel submaps */ -#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) - -#endif /* !_MIPS64_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs.h b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs.h index 12210d6f608f90b556b902fa1890a8c0224b64ea..e046424460162174f8417f42a21116c2323924c5 100644 --- a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs.h +++ b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs.h,v 1.15 2025/09/08 17:25:46 helg Exp $ */ +/* $OpenBSD: fusefs.h,v 1.17 2026/06/20 13:45:13 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -41,6 +41,7 @@ struct fusefs_mnt { struct mount *mp; uint32_t undef_op; int max_read; + int max_write; int sess_init; int allow_other; dev_t dev; @@ -74,12 +75,13 @@ void fuse_device_cleanup(dev_t); void fuse_device_queue_fbuf(dev_t, struct fusebuf *); void fuse_device_set_fmp(struct fusefs_mnt *, int); -/* - * The root inode is the root of the file system. Inode 0 can't be used for - * normal purposes. - */ -#define FUSE_ROOTINO ((ino_t)1) #define VFSTOFUSEFS(mp) ((struct fusefs_mnt *)((mp)->mnt_data)) +#ifdef FUSE_DEBUG +#define DPRINTF(fmt, arg...) printf("%s: " fmt, "fusefs", ##arg) +#else +#define DPRINTF(fmt, arg...) +#endif + #endif /* _KERNEL */ #endif /* __FUSEFS_H__ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h index ee144d1f9f7dc23f7d401f95483dfec83d664a34..4797e2e97ef5f096a4048dd6a4901ba46ac4c3c9 100644 --- a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h +++ b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs_node.h,v 1.6 2026/01/22 11:53:31 helg Exp $ */ +/* $OpenBSD: fusefs_node.h,v 1.9 2026/07/10 14:43:48 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -37,8 +37,7 @@ struct fusefs_mnt; struct fusefs_node { LIST_ENTRY(fusefs_node) i_hash; /* Hash chain */ struct vnode *i_vnode;/* Vnode associated with this inode. */ - struct fusefs_mnt *i_ump; - dev_t i_dev; /* Device associated with the inode. */ + struct fusefs_mnt *i_fmp; ino_t i_number; /* The identity of the inode. */ ino_t i_parent_cache;/* Parent inode (only dirs). */ struct lockf_state *i_lockf; /* Byte-level lock state. */ @@ -49,6 +48,9 @@ struct fusefs_node { /** meta **/ off_t filesize; + + /** lookup count needed by FUSE_FORGET **/ + uint64_t nlookup; }; #ifdef ITOV @@ -62,7 +64,7 @@ struct fusefs_node { #define VTOI(vp) ((struct fusefs_node *)(vp)->v_data) void fuse_ihashinit(void); -struct vnode *fuse_ihashget(dev_t, ino_t); +struct vnode *fuse_ihashget(const struct fusefs_mnt *, ino_t); int fuse_ihashins(struct fusefs_node *); void fuse_ihashrem(struct fusefs_node *); diff --git a/lib/libc/include/generic-openbsd/net/art.h b/lib/libc/include/generic-openbsd/net/art.h index bf621de830142e49154bfba6f526b88c6fea6d79..d64c10b4e4f6e927c402e4f4733c6637efff2991 100644 --- a/lib/libc/include/generic-openbsd/net/art.h +++ b/lib/libc/include/generic-openbsd/net/art.h @@ -1,4 +1,4 @@ -/* $OpenBSD: art.h,v 1.28 2025/07/10 05:28:13 dlg Exp $ */ +/* $OpenBSD: art.h,v 1.29 2026/04/23 01:28:03 jsg Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -161,9 +161,6 @@ void art_iter_close(struct art_iter *); (_an) != NULL; \ (_an) = art_iter_next((_ai))) -int art_walk(struct art *, - int (*)(struct art_node *, void *), void *); - #endif /* _KERNEL */ #endif /* _NET_ART_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/net/bpf.h b/lib/libc/include/generic-openbsd/net/bpf.h index a8a2dba58598b94880789b59bc417f427c08ee95..e01c35672858c244771b18d5c631d2f0bd3d715f 100644 --- a/lib/libc/include/generic-openbsd/net/bpf.h +++ b/lib/libc/include/generic-openbsd/net/bpf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.h,v 1.75 2025/11/16 02:20:08 dlg Exp $ */ +/* $OpenBSD: bpf.h,v 1.78 2026/09/10 18:31:39 claudio Exp $ */ /* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */ /* @@ -52,7 +52,10 @@ typedef u_int32_t bpf_u_int32; #define BPF_ALIGNMENT sizeof(u_int32_t) #define BPF_WORDALIGN(x) (((x) + (BPF_ALIGNMENT - 1)) & ~(BPF_ALIGNMENT - 1)) +#ifdef _KERNEL #define BPF_MAXINSNS 512 +#endif + #define BPF_MAXBUFSIZE (2 * 1024 * 1024) #define BPF_MINBUFSIZE 32 @@ -309,18 +312,20 @@ struct bpf_ops { #define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k } __BEGIN_DECLS +#ifndef _KERNEL u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int) __bounded((__buffer__, 2, 4)); u_int _bpf_filter(const struct bpf_insn *, const struct bpf_ops *, const void *, u_int); +#endif /* _KERNEL */ __END_DECLS #ifdef _KERNEL struct ifnet; struct mbuf; -int bpf_validate(struct bpf_insn *, int); +int bpf_validate(struct bpf_insn *, u_int); int bpf_mtap(caddr_t, const struct mbuf *, u_int); int bpf_mtap_hdr(caddr_t, const void *, u_int, const struct mbuf *, u_int); int 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); void bpfsdetach(void *); void bpfilterattach(int); -u_int bpf_mfilter(const struct bpf_insn *, const struct mbuf *, u_int); +u_int _bpf_lfilter(const struct bpf_insn *, u_int, const struct bpf_ops *, + const void *, u_int); + +u_int bpf_mfilter(const struct bpf_program *, const struct mbuf *, u_int); #endif /* _KERNEL */ /* diff --git a/lib/libc/include/generic-openbsd/net/if.h b/lib/libc/include/generic-openbsd/net/if.h index a309550f9557c7aed9062f263d585a265e6e2759..b550d74d3693d45cd1b9e7087c9423a5f82b1707 100644 --- a/lib/libc/include/generic-openbsd/net/if.h +++ b/lib/libc/include/generic-openbsd/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.223 2025/12/09 03:33:06 dlg Exp $ */ +/* $OpenBSD: if.h,v 1.224 2026/06/23 14:40:40 bluhm Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -232,6 +232,7 @@ struct if_status_description { #define IFXF_AUTOCONF4 0x80 /* [N] v4 autoconf (aka dhcp) enabled */ #define IFXF_MONITOR 0x100 /* [N] only used for bpf */ #define IFXF_LRO 0x200 /* [N] TCP large recv offload */ +#define IFXF_MBUF_64BIT 0x400 /* [I] mbuf with 64 bit DMA supported */ #define IFXF_CANTCHANGE \ (IFXF_MPSAFE|IFXF_CLONED) diff --git a/lib/libc/include/generic-openbsd/net/if_ppp.h b/lib/libc/include/generic-openbsd/net/if_ppp.h index 75f3eb5918ddb42b6572673761f13c471ecdb331..7247832a49ab8bf3115c3d80a84c60e0100c63e0 100644 --- a/lib/libc/include/generic-openbsd/net/if_ppp.h +++ b/lib/libc/include/generic-openbsd/net/if_ppp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.h,v 1.10 2022/01/02 22:36:03 jsg Exp $ */ +/* $OpenBSD: if_ppp.h,v 1.11 2026/05/16 13:27:03 daniel Exp $ */ /* $NetBSD: if_ppp.h,v 1.11 1996/03/15 02:28:05 paulus Exp $ */ /* @@ -146,7 +146,7 @@ struct ifpppcstatsreq { #define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq) #ifdef _KERNEL -void pppattach(void); +void pppattach(int); int pppoutput(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); void pppintr(void); diff --git a/lib/libc/include/generic-openbsd/net/if_sppp.h b/lib/libc/include/generic-openbsd/net/if_sppp.h index 484feeaee3088ec90a01d206d80b7a86033901d3..9eaa5729c8fe318d2b2b6ad59aaad6c0f3a32df1 100644 --- a/lib/libc/include/generic-openbsd/net/if_sppp.h +++ b/lib/libc/include/generic-openbsd/net/if_sppp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sppp.h,v 1.32 2025/11/02 08:04:04 dlg Exp $ */ +/* $OpenBSD: if_sppp.h,v 1.33 2026/05/16 13:27:03 daniel Exp $ */ /* $NetBSD: if_sppp.h,v 1.2.2.1 1999/04/04 06:57:39 explorer Exp $ */ /* @@ -236,7 +236,7 @@ void sppp_input (struct ifnet *ifp, struct mbuf *m); int sppp_proto_up(struct ifnet *ifp, uint16_t); /* Workaround */ -void spppattach (struct ifnet *ifp); +void spppattach (int); int sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data); struct mbuf *sppp_dequeue (struct ifnet *ifp); diff --git a/lib/libc/include/generic-openbsd/net/if_trunk.h b/lib/libc/include/generic-openbsd/net/if_trunk.h index 4cd0a91a48fabb91e0e99ee762b77319cd4492b0..bbe88d0067ec9955cf85a715ba43e0eae0dce925 100644 --- a/lib/libc/include/generic-openbsd/net/if_trunk.h +++ b/lib/libc/include/generic-openbsd/net/if_trunk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.h,v 1.33 2025/11/24 23:40:00 dlg Exp $ */ +/* $OpenBSD: if_trunk.h,v 1.34 2026/05/08 03:36:04 jsg Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -88,6 +88,17 @@ struct lacp_opreq { u_int8_t partner_state; }; +#define LACP_STATE_BITS \ + "\020" \ + "\001ACTIVITY" \ + "\002TIMEOUT" \ + "\003AGGREGATION" \ + "\004SYNC" \ + "\005COLLECTING" \ + "\006DISTRIBUTING" \ + "\007DEFAULTED" \ + "\010EXPIRED" + /* Trunk port settings */ struct trunk_reqport { char rp_ifname[IFNAMSIZ]; /* name of the trunk */ diff --git a/lib/libc/include/generic-openbsd/net/if_var.h b/lib/libc/include/generic-openbsd/net/if_var.h index d672bc61bf1cf5cafff0d4f052c671de8a4f7310..ce6c9a5a127cca10018db70f651fe1acf6812c8b 100644 --- a/lib/libc/include/generic-openbsd/net/if_var.h +++ b/lib/libc/include/generic-openbsd/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.148 2026/03/22 23:14:00 bluhm Exp $ */ +/* $OpenBSD: if_var.h,v 1.149 2026/06/23 18:50:43 bluhm Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -166,8 +166,8 @@ struct ifnet { /* and the entries */ int if_pcount; /* [N] # of promiscuous listeners */ unsigned int if_bridgeidx; /* [K] used by bridge ports */ caddr_t if_bpf; /* packet filter structure */ - caddr_t if_mcast; /* used by multicast code */ - caddr_t if_mcast6; /* used by IPv6 multicast code */ + struct vif *if_mcast; /* used by multicast code */ + struct mif6 *if_mcast6; /* used by IPv6 multicast code */ caddr_t if_pf_kif; /* pf interface abstraction */ union { /* carp if list (used by IFT_ETHER) */ diff --git a/lib/libc/include/generic-openbsd/net/pfvar_priv.h b/lib/libc/include/generic-openbsd/net/pfvar_priv.h index e33bd69e28de7e4dd12b4c9864af468adabc530d..c82574816e0daff467092f777484ce28adcaa35d 100644 --- a/lib/libc/include/generic-openbsd/net/pfvar_priv.h +++ b/lib/libc/include/generic-openbsd/net/pfvar_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar_priv.h,v 1.42 2026/02/05 03:26:00 dlg Exp $ */ +/* $OpenBSD: pfvar_priv.h,v 1.43 2026/09/10 12:28:04 deraadt Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -682,7 +682,7 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t, void pf_status_init(void); void pf_status_clear(void); -void pf_status_read(struct pf_status *); +int pf_status_read(struct pf_status *); #endif /* _KERNEL */ diff --git a/lib/libc/include/generic-openbsd/net/pipex_local.h b/lib/libc/include/generic-openbsd/net/pipex_local.h index 9fe5ec3d67732a240672b1347c46b8f7e029a822..01e72be5c073b1b31e59721928563bc3e293dd3e 100644 --- a/lib/libc/include/generic-openbsd/net/pipex_local.h +++ b/lib/libc/include/generic-openbsd/net/pipex_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex_local.h,v 1.54 2025/03/02 21:28:32 bluhm Exp $ */ +/* $OpenBSD: pipex_local.h,v 1.55 2026/04/24 13:25:44 jsg Exp $ */ /* * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -468,7 +468,7 @@ int pipex_ccp_output (struct pipex_session *, int, int); struct mbuf *adjust_tcp_mss (struct mbuf *, int); struct mbuf *ip_is_idle_packet (struct mbuf *, int *); -void pipex_session_log (struct pipex_session *, int, const char *, ...) __attribute__((__format__(__printf__,3,4))); +void pipex_session_log (struct pipex_session *, int, const char *, ...) __attribute__((__format__(__kprintf__,3,4))); uint32_t pipex_sockaddr_hash_key(struct sockaddr *); int pipex_sockaddr_compar_addr(struct sockaddr *, struct sockaddr *); void pipex_timer_start (void); diff --git a/lib/libc/include/generic-openbsd/net/trunklacp.h b/lib/libc/include/generic-openbsd/net/trunklacp.h deleted file mode 100644 index 597e804bbcb3be879206483e9d46b988c6a3ec0d..0000000000000000000000000000000000000000 --- a/lib/libc/include/generic-openbsd/net/trunklacp.h +++ /dev/null @@ -1,316 +0,0 @@ -/* $OpenBSD: trunklacp.h,v 1.14 2018/08/12 23:50:31 ccardenas Exp $ */ -/* $NetBSD: ieee8023ad_impl.h,v 1.2 2005/12/10 23:21:39 elad Exp $ */ - -/* - * Copyright (c)2005 YAMAMOTO Takashi, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.11 2008/03/17 01:26:44 thompsa Exp $ - */ - -#ifndef _NET_TRUNKLACP_H_ -#define _NET_TRUNKLACP_H_ - -/* - * IEEE802.3 slow protocols (on-wire) definitions. - * XXX should be elsewhere. - */ -#define SLOWPROTOCOLS_SUBTYPE_LACP 1 -#define SLOWPROTOCOLS_SUBTYPE_MARKER 2 - -/* - * default administrative values - */ -#define LACP_DEFAULT_MODE 1 /* Active Mode */ -#define LACP_DEFAULT_TIMEOUT 0 /* Slow Timeout */ -#define LACP_DEFAULT_SYSTEM_PRIO 0x8000 /* Medium Priority */ -#define LACP_LOW_SYSTEM_PRIO 0xffff -#define LACP_HIGH_SYSTEM_PRIO 0x0001 -#define LACP_DEFAULT_PORT_PRIO 0x8000 /* Medium Priority */ -#define LACP_LOW_PORT_PRIO 0xffff -#define LACP_HIGH_PORT_PRIO 0x0001 -#define LACP_DEFAULT_IFQ_PRIO 6 - -struct slowprothdr { - u_int8_t sph_subtype; - u_int8_t sph_version; -} __packed; - -/* TLV on-wire structure. */ -struct tlvhdr { - u_int8_t tlv_type; - u_int8_t tlv_length; - /* u_int8_t tlv_value[]; */ -} __packed; - -/* ... and our implementation. */ -#define TLV_SET(tlv, type, length) \ - do { \ - (tlv)->tlv_type = (type); \ - (tlv)->tlv_length = sizeof(*tlv) + (length); \ - } while (/*CONSTCOND*/0) - -struct tlv_template { - u_int8_t tmpl_type; - u_int8_t tmpl_length; -}; - -struct lacp_systemid { - u_int16_t lsi_prio; - u_int8_t lsi_mac[6]; -} __packed; - -struct lacp_portid { - u_int16_t lpi_prio; - u_int16_t lpi_portno; -} __packed; - -struct lacp_peerinfo { - struct lacp_systemid lip_systemid; - u_int16_t lip_key; - struct lacp_portid lip_portid; - u_int8_t lip_state; - u_int8_t lip_resv[3]; -} __packed; - -struct lacp_collectorinfo { - u_int16_t lci_maxdelay; - u_int8_t lci_resv[12]; -} __packed; - -struct lacpdu { - struct ether_header ldu_eh; - struct slowprothdr ldu_sph; - - struct tlvhdr ldu_tlv_actor; - struct lacp_peerinfo ldu_actor; - struct tlvhdr ldu_tlv_partner; - struct lacp_peerinfo ldu_partner; - struct tlvhdr ldu_tlv_collector; - struct lacp_collectorinfo ldu_collector; - struct tlvhdr ldu_tlv_term; - u_int8_t ldu_resv[50]; -} __packed; - -/* - * IEEE802.3ad marker protocol (on-wire) definitions. - */ -struct lacp_markerinfo { - u_int16_t mi_rq_port; - u_int8_t mi_rq_system[ETHER_ADDR_LEN]; - u_int32_t mi_rq_xid; - u_int8_t mi_pad[2]; -} __packed; - -#define LACP_STATE_BITS \ - "\020" \ - "\001ACTIVITY" \ - "\002TIMEOUT" \ - "\003AGGREGATION" \ - "\004SYNC" \ - "\005COLLECTING" \ - "\006DISTRIBUTING" \ - "\007DEFAULTED" \ - "\010EXPIRED" - -#ifdef _KERNEL - -/* - * IEEE802.3ad LACP implementation details. - */ -#define LACP_TIMER_CURRENT_WHILE 0 -#define LACP_TIMER_PERIODIC 1 -#define LACP_TIMER_WAIT_WHILE 2 -#define LACP_NTIMER 3 - -#define LACP_TIMER_ARM(port, timer, val) \ - (port)->lp_timer[(timer)] = (val) -#define LACP_TIMER_DISARM(port, timer) \ - (port)->lp_timer[(timer)] = 0 -#define LACP_TIMER_ISARMED(port, timer) \ - ((port)->lp_timer[(timer)] > 0) - -/* - * IEEE802.3ad LACP protocol definitions. - */ -#define LACP_STATE_ACTIVITY (1<<0) -#define LACP_STATE_TIMEOUT (1<<1) -#define LACP_STATE_AGGREGATION (1<<2) -#define LACP_STATE_SYNC (1<<3) -#define LACP_STATE_COLLECTING (1<<4) -#define LACP_STATE_DISTRIBUTING (1<<5) -#define LACP_STATE_DEFAULTED (1<<6) -#define LACP_STATE_EXPIRED (1<<7) - -#define LACP_PORT_NTT 0x00000001 -#define LACP_PORT_MARK 0x00000002 - -struct markerdu { - struct ether_header mdu_eh; - struct slowprothdr mdu_sph; - - struct tlvhdr mdu_tlv; - struct lacp_markerinfo mdu_info; - struct tlvhdr mdu_tlv_term; - u_int8_t mdu_resv[90]; -} __packed; - -#define MARKER_TYPE_INFO 0x01 -#define MARKER_TYPE_RESPONSE 0x02 - -enum lacp_selected { - LACP_UNSELECTED, - LACP_STANDBY, /* not used in this implementation */ - LACP_SELECTED, -}; - -enum lacp_mux_state { - LACP_MUX_DETACHED, - LACP_MUX_WAITING, - LACP_MUX_ATTACHED, - LACP_MUX_COLLECTING, - LACP_MUX_DISTRIBUTING, -}; - -#define LACP_MAX_PORTS 32 - -struct lacp_portmap { - int pm_count; - struct lacp_port *pm_map[LACP_MAX_PORTS]; -}; - -struct lacp_port { - TAILQ_ENTRY(lacp_port) lp_dist_q; - LIST_ENTRY(lacp_port) lp_next; - struct lacp_softc *lp_lsc; - struct trunk_port *lp_trunk; - struct ifnet *lp_ifp; - struct lacp_peerinfo lp_partner; - struct lacp_peerinfo lp_actor; - struct lacp_markerinfo lp_marker; -#define lp_state lp_actor.lip_state -#define lp_key lp_actor.lip_key -#define lp_systemid lp_actor.lip_systemid - struct timeval lp_last_lacpdu; - int lp_lacpdu_sent; - enum lacp_mux_state lp_mux_state; - enum lacp_selected lp_selected; - int lp_flags; - u_int lp_media; /* XXX redundant */ - int lp_timer[LACP_NTIMER]; - struct mbuf_queue lp_mq; - - struct lacp_aggregator *lp_aggregator; -}; - -struct lacp_aggregator { - TAILQ_ENTRY(lacp_aggregator) la_q; - int la_refcnt; /* num of ports which selected us */ - int la_nports; /* num of distributing ports */ - TAILQ_HEAD(, lacp_port) la_ports; /* distributing ports */ - struct lacp_peerinfo la_partner; - struct lacp_peerinfo la_actor; - int la_pending; /* number of ports in wait_while */ -}; - -struct lacp_admin_def { - u_int8_t lad_mode; /* active or passive */ - u_int8_t lad_timeout; /* fast or slow */ - u_int16_t lad_prio; /* system priority */ - u_int16_t lad_portprio; /* port priority */ - u_int8_t lad_ifqprio; /* ifq priority */ -}; - -struct lacp_softc { - struct trunk_softc *lsc_softc; - struct lacp_aggregator *lsc_active_aggregator; - TAILQ_HEAD(, lacp_aggregator) lsc_aggregators; - int lsc_suppress_distributing; - struct timeout lsc_transit_callout; - struct timeout lsc_callout; - LIST_HEAD(, lacp_port) lsc_ports; - struct lacp_portmap lsc_pmap[2]; - volatile u_int lsc_activemap; - SIPHASH_KEY lsc_hashkey; - struct task lsc_input; - struct lacp_admin_def lsc_admin_defaults; -#define lsc_mode lsc_admin_defaults.lad_mode -#define lsc_timeout lsc_admin_defaults.lad_timeout -#define lsc_sys_prio lsc_admin_defaults.lad_prio -#define lsc_port_prio lsc_admin_defaults.lad_portprio -#define lsc_ifq_prio lsc_admin_defaults.lad_ifqprio -}; - -#define LACP_TYPE_ACTORINFO 1 -#define LACP_TYPE_PARTNERINFO 2 -#define LACP_TYPE_COLLECTORINFO 3 - -/* timeout values (in sec) */ -#define LACP_FAST_PERIODIC_TIME (1) -#define LACP_SLOW_PERIODIC_TIME (30) -#define LACP_SHORT_TIMEOUT_TIME (3 * LACP_FAST_PERIODIC_TIME) -#define LACP_LONG_TIMEOUT_TIME (3 * LACP_SLOW_PERIODIC_TIME) -#define LACP_CHURN_DETECTION_TIME (60) -#define LACP_AGGREGATE_WAIT_TIME (2) -#define LACP_TRANSIT_DELAY 3000 /* in msec */ - -#define LACP_STATE_EQ(s1, s2, mask) \ - ((((s1) ^ (s2)) & (mask)) == 0) - -#define LACP_SYS_PRI(peer) (peer).lip_systemid.lsi_prio - -#define LACP_PORT(_lp) ((struct lacp_port *)(_lp)->tp_psc) -#define LACP_SOFTC(_sc) ((struct lacp_softc *)(_sc)->tr_psc) - -int lacp_input(struct trunk_port *, struct mbuf *); -struct trunk_port *lacp_select_tx_port(struct trunk_softc *, struct mbuf *); -int lacp_attach(struct trunk_softc *); -int lacp_detach(struct trunk_softc *); -void lacp_init(struct trunk_softc *); -void lacp_stop(struct trunk_softc *); -int lacp_port_create(struct trunk_port *); -void lacp_port_destroy(struct trunk_port *); -void lacp_linkstate(struct trunk_port *); -void lacp_req(struct trunk_softc *, caddr_t); -void lacp_portreq(struct trunk_port *, caddr_t); -u_int lacp_port_status(struct trunk_port *); - -/* following constants don't include terminating NUL */ -#define LACP_MACSTR_MAX (2*6 + 5) -#define LACP_SYSTEMPRIOSTR_MAX (4) -#define LACP_SYSTEMIDSTR_MAX (LACP_SYSTEMPRIOSTR_MAX + 1 + LACP_MACSTR_MAX) -#define LACP_PORTPRIOSTR_MAX (4) -#define LACP_PORTNOSTR_MAX (4) -#define LACP_PORTIDSTR_MAX (LACP_PORTPRIOSTR_MAX + 1 + LACP_PORTNOSTR_MAX) -#define LACP_KEYSTR_MAX (4) -#define LACP_PARTNERSTR_MAX \ - (1 + LACP_SYSTEMIDSTR_MAX + 1 + LACP_KEYSTR_MAX + 1 \ - + LACP_PORTIDSTR_MAX + 1) -#define LACP_LAGIDSTR_MAX \ - (1 + LACP_PARTNERSTR_MAX + 1 + LACP_PARTNERSTR_MAX + 1) -#define LACP_STATESTR_MAX (255) /* XXX */ - -#endif /* _KERNEL */ - -#endif /* _NET_TRUNKLACP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211.h b/lib/libc/include/generic-openbsd/net80211/ieee80211.h index ab4838200fc797bed98868369fb5d5f41629bd36..e36b001318aeeb6d763480c797bc070871e71470 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.h,v 1.66 2026/03/29 21:16:21 kirill Exp $ */ +/* $OpenBSD: ieee80211.h,v 1.67 2026/05/28 10:50:47 kirill Exp $ */ /* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */ /*- @@ -193,6 +193,21 @@ struct ieee80211_htframe_addr4 { /* 11n */ #define IEEE80211_QOS_EOSP 0x0010 #define IEEE80211_QOS_TID 0x000f +#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD 0x80 + +#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO 0x01 +#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI 0x02 +#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK 0x04 +#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE 0x08 +#define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f + +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00 +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01 +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02 +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03 +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03 +#define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5 + /* * Control frames. */ diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h index 9221d2afd7703428ccb4d09e265db0e6e826a62f..4df48ef849c38f8cceabb6e626c1909790d6f8e9 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_ioctl.h,v 1.45 2026/03/26 12:15:01 kirill Exp $ */ +/* $OpenBSD: ieee80211_ioctl.h,v 1.46 2026/05/28 10:50:47 kirill Exp $ */ /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */ /*- @@ -410,7 +410,9 @@ struct ieee80211_nodereq_all { #define IEEE80211_F_HOSTAPMASK 0x00000003 #define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */ #define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */ -#define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO" +#define IEEE80211_F_UAPSD 0x00000010 /* CONF: enable u-APSD */ +#define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO" \ + "\05UAPSD" struct ieee80211_flags { const char *f_name; @@ -421,7 +423,8 @@ struct ieee80211_flags { { "hidenwid", IEEE80211_F_HIDENWID }, \ { "nobridge", IEEE80211_F_NOBRIDGE }, \ { "stayauth", IEEE80211_F_STAYAUTH }, \ - { "nomimo", IEEE80211_F_NOMIMO } \ + { "nomimo", IEEE80211_F_NOMIMO }, \ + { "uapsd", IEEE80211_F_UAPSD } \ } #define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq) diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h index 30b74d46caa5e893592536058debbc10eb11bb5e..61405688b4036e60abf74dce2fda38976060740c 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.101 2026/03/29 21:16:21 kirill Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.103 2026/09/19 19:36:43 stsp Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -306,6 +306,8 @@ struct ieee80211_node { /* power saving mode */ u_int8_t ni_pwrsave; struct mbuf_queue ni_savedq; /* packets queued for pspoll */ + u_int8_t ni_uapsd_ac; + u_int8_t ni_uapsd_maxsp; /* RSN */ struct timeout ni_eapol_to; @@ -446,6 +448,7 @@ struct ieee80211_node { #define IEEE80211_NODE_HE 0x200000 /* HE negotiated */ #define IEEE80211_NODE_HECAP 0x400000 /* claims to support HE */ #define IEEE80211_NODE_CSA 0x800000 /* channel switch announced */ +#define IEEE80211_NODE_UAPSD 0x1000000 /* uAPSD negotiated */ /* If not NULL, this function gets called when ni_refcnt hits zero. */ void (*ni_unref_cb)(struct ieee80211com *, @@ -675,6 +678,8 @@ void ieee80211_clean_nodes(struct ieee80211com *, int); void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *, uint8_t); void ieee80211_clear_htcaps(struct ieee80211_node *); +uint8_t ieee80211_node_ht_secondary_channel_offset(struct ieee80211_node *); +uint8_t ieee80211_node_vht_channel_width(struct ieee80211_node *); int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *, uint8_t, int); void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *, diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h index 3311152aaa4a472f07553dfe5d56278206e68d89..c48d070b81187765534dd63806d643575d269391 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.114 2026/03/19 16:50:32 chris Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.115 2026/05/28 10:50:47 kirill Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -344,6 +344,8 @@ struct ieee80211com { u_int ic_edca_txop_count[EDCA_NUM_AC]; struct timeval ic_edca_txop_time[EDCA_NUM_AC]; u_int16_t ic_tid_noack; + u_int8_t ic_uapsd_ac; + u_int8_t ic_uapsd_maxsp; u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN]; u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN]; u_int8_t ic_psk[IEEE80211_PMK_LEN]; diff --git a/lib/libc/include/generic-openbsd/netinet/in_var.h b/lib/libc/include/generic-openbsd/netinet/in_var.h index 23f4cef8b2e4dc2cafad2e031ca2e4224543440e..edf0bcbf7bf6dee03c8c205e67a1298b951dab51 100644 --- a/lib/libc/include/generic-openbsd/netinet/in_var.h +++ b/lib/libc/include/generic-openbsd/netinet/in_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_var.h,v 1.47 2026/03/22 23:14:00 bluhm Exp $ */ +/* $OpenBSD: in_var.h,v 1.48 2026/07/30 14:57:46 bluhm Exp $ */ /* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */ /* @@ -82,8 +82,6 @@ struct in_aliasreq { }; #ifdef _KERNEL -struct router_info; - /* * Internet multicast address structure. There is one of these for each IP * multicast group to which this host belongs on a given network interface. @@ -98,8 +96,6 @@ struct in_multi { u_int inm_state; /* [m] state of membership */ u_int inm_timer; /* [m] IGMP membership report */ - - struct router_info *inm_rti; /* router version info */ }; static __inline struct in_multi * diff --git a/lib/libc/include/generic-openbsd/netinet/ip_ipsp.h b/lib/libc/include/generic-openbsd/netinet/ip_ipsp.h index a77dc4b4ce9f4e13a317aa0883c2bd061ec15b07..4808407dc2760322cdbd6753c0452a296a37b3a8 100644 --- a/lib/libc/include/generic-openbsd/netinet/ip_ipsp.h +++ b/lib/libc/include/generic-openbsd/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.249 2025/05/09 19:53:41 mvs Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.251 2026/08/12 18:23:14 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -248,7 +248,7 @@ struct ipsec_ids { RBT_ENTRY(ipsec_ids) id_node_flow; /* [F] */ struct ipsec_id *id_local; /* [I] */ struct ipsec_id *id_remote; /* [I] */ - u_int32_t id_flow; /* [I] */ + uint32_t id_flow; /* [I] */ u_int id_refcount; /* [F] */ u_int id_gc_ttl; /* [F] */ }; @@ -425,8 +425,9 @@ struct tdb { /* tunnel descriptor block */ #define TDB_REPLAYWASTE 32 #define TDB_REPLAYMAX (2100+TDB_REPLAYWASTE) - u_int64_t tdb_rpl; /* Replay counter */ - u_int32_t tdb_seen[howmany(TDB_REPLAYMAX, 32)]; /* Anti-replay window */ + u_int64_t tdb_rpl; /* [m] Replay counter */ + u_int32_t tdb_seen[howmany(TDB_REPLAYMAX, 32)]; + /* [m] Anti-replay window */ u_int8_t tdb_iv[4]; /* Used for HALF-IV ESP */ @@ -711,7 +712,7 @@ int ipsp_aux_match(struct tdb *, struct ipsec_ids *, struct sockaddr_encap *, struct sockaddr_encap *); int ipsp_ids_match(struct ipsec_ids *, struct ipsec_ids *); struct ipsec_ids *ipsp_ids_insert(struct ipsec_ids *); -struct ipsec_ids *ipsp_ids_lookup(u_int32_t); +struct ipsec_ids *ipsp_ids_lookup(uint32_t); void ipsp_ids_free(struct ipsec_ids *); void ipsp_init(void); diff --git a/lib/libc/include/generic-openbsd/netinet/ip_mroute.h b/lib/libc/include/generic-openbsd/netinet/ip_mroute.h index d800b3c872b1a07061a227d092e39622ecdf55a3..13f7eac9fa2de6655842076f34cfbd4b4ef1ea82 100644 --- a/lib/libc/include/generic-openbsd/netinet/ip_mroute.h +++ b/lib/libc/include/generic-openbsd/netinet/ip_mroute.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.h,v 1.34 2025/05/09 14:43:47 jan Exp $ */ +/* $OpenBSD: ip_mroute.h,v 1.35 2026/06/24 12:33:49 bluhm Exp $ */ /* $NetBSD: ip_mroute.h,v 1.23 2004/04/21 17:49:46 itojun Exp $ */ #ifndef _NETINET_IP_MROUTE_H_ @@ -165,6 +165,8 @@ struct mrtstat { u_long mrts_q_overflow; /* pkts dropped - Q overflow */ u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */ u_long mrts_upq_sockfull; /* upcalls dropped - socket full */ + u_long mrts_time_to_live; /* ip ttl not above 1 */ + u_long mrts_source_route; /* packet from source-routed tunnel */ }; #ifdef _KERNEL @@ -183,6 +185,8 @@ enum mrtstat_counters { mrts_q_overflow, mrts_pkt2large, mrts_upq_sockfull, + mrts_time_to_live, + mrts_source_route, mrts_ncounters }; diff --git a/lib/libc/include/generic-openbsd/netinet/ip_var.h b/lib/libc/include/generic-openbsd/netinet/ip_var.h index 69ef765c4f46c0e17dc381625b4d8dabcf3d2705..d75fa82583662f3636ea776df6ccd0f16145e73f 100644 --- a/lib/libc/include/generic-openbsd/netinet/ip_var.h +++ b/lib/libc/include/generic-openbsd/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.123 2025/07/31 09:05:11 mvs Exp $ */ +/* $OpenBSD: ip_var.h,v 1.127 2026/08/11 14:28:59 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -191,9 +191,10 @@ struct ipqent { */ struct ipq { LIST_ENTRY(ipq) ipq_q; /* to other reass headers */ + u_int ipq_rdomain; /* routing domain for reassembly */ + u_int16_t ipq_id; /* sequence id for reassembly */ u_int8_t ipq_ttl; /* time for reass q to live */ u_int8_t ipq_p; /* protocol of this fragment */ - u_int16_t ipq_id; /* sequence id for reassembly */ struct ipqehead ipq_fragq; /* to ip fragment queue */ struct in_addr ipq_src, ipq_dst; }; @@ -247,10 +248,12 @@ int ip_getmoptions(int, struct ip_moptions *, struct mbuf *); void ip_init(void); struct mbuf* ip_insertoptions(struct mbuf *, struct mbuf *, int *); +int ip_mrouter_active(u_int); int ip_mforward(struct mbuf *, struct ifnet *, int); int ip_optcopy(struct ip *, struct ip *); int ip_output(struct mbuf *, struct mbuf *, struct route *, int, - struct ip_moptions *, const struct ipsec_level *, u_int32_t); + struct ip_moptions *, const struct ipsec_level *, uint32_t); +void ip_randomid_init(void); u_int16_t ip_randomid(void); void ip_send(struct mbuf *); @@ -281,9 +284,6 @@ int rip_disconnect(struct socket *); int rip_shutdown(struct socket *); int rip_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *); -#ifdef MROUTING -extern struct socket *ip_mrouter[]; /* multicast routing daemon */ -#endif #endif /* _KERNEL */ #endif /* _NETINET_IP_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/netinet6/ip6_mroute.h b/lib/libc/include/generic-openbsd/netinet6/ip6_mroute.h index d88ea2ab61e24ec452c4391dfca96feea98841e1..7eba4ef36613f1b758d50e4f520da7272110934b 100644 --- a/lib/libc/include/generic-openbsd/netinet6/ip6_mroute.h +++ b/lib/libc/include/generic-openbsd/netinet6/ip6_mroute.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.h,v 1.25 2025/05/19 04:54:04 jan Exp $ */ +/* $OpenBSD: ip6_mroute.h,v 1.27 2026/09/17 15:56:59 bluhm Exp $ */ /* $KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $ */ /* @@ -146,6 +146,7 @@ struct mrt6stat { u_int64_t mrt6s_q_overflow; /* pkts dropped - Q overflow */ u_int64_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */ u_int64_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */ + u_int64_t mrt6s_hop_limit; /* ip6 hlim not above one */ }; /* @@ -206,6 +207,7 @@ enum mrt6stat_counters { mrt6s_q_overflow, mrt6s_pkt2large, mrt6s_upq_sockfull, + mrt6s_hop_limit, mrt6s_ncounters }; @@ -220,6 +222,8 @@ mrt6stat_inc(enum mrt6stat_counters c) /* How frequent should we look for expired entries (in seconds). */ #define MCAST_EXPIRE_TIMEOUT 30 +extern int ip6_mrtproto; + /* * The kernel's multicast-interface structure. */ diff --git a/lib/libc/include/generic-openbsd/netinet6/ip6_var.h b/lib/libc/include/generic-openbsd/netinet6/ip6_var.h index 2a2112f56713dd07e212970530cb8eaf1441254b..ca2af523ef390a901ad90d2fca58e2e82a338010 100644 --- a/lib/libc/include/generic-openbsd/netinet6/ip6_var.h +++ b/lib/libc/include/generic-openbsd/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.129 2025/12/31 04:10:00 jsg Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.132 2026/09/17 15:56:59 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -138,6 +138,7 @@ struct ip6q { struct in6_addr ip6q_src, ip6q_dst; int ip6q_unfrglen; /* len of unfragmentable part */ int ip6q_nfrag; /* # of fragments */ + u_int ip6q_rdomain; /* routing domain for reassembly */ u_int32_t ip6q_ident; /* fragment identification */ u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */ u_int8_t ip6q_ecn; @@ -164,15 +165,7 @@ struct ip6_moptions { * Control options for outgoing packets */ -/* Routing header related info */ -struct ip6po_rhinfo { - struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */ - struct route ip6po_rhi_route; /* Route to the 1st hop */ -}; -#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr -#define ip6po_route ip6po_rhinfo.ip6po_rhi_route - -struct ip6_pktopts { +struct ip6_pktopts { /* Hoplimit for outgoing packets */ int ip6po_hlim; @@ -185,9 +178,6 @@ struct ip6_pktopts { /* Destination options header (before a routing header) */ struct ip6_dest *ip6po_dest1; - /* Routing header related info. */ - struct ip6po_rhinfo ip6po_rhinfo; - /* Destination options header (after a routing header) */ struct ip6_dest *ip6po_dest2; @@ -310,6 +300,7 @@ int ip6_unknown_opt(struct mbuf **, u_int8_t *, int); int ip6_get_prevhdr(struct mbuf *, int); int ip6_nexthdr(struct mbuf *, int, int, int *); int ip6_lasthdr(struct mbuf *, int, int, int *); +int ip6_mrouter_active(u_int); int ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *, int); int ip6_process_hopopts(struct mbuf **, u_int8_t *, int, u_int32_t *, u_int32_t *); @@ -371,7 +362,7 @@ struct tdb; int ip6_output_ipsec_lookup(struct mbuf *, const struct ipsec_level *, struct tdb **); int ip6_output_ipsec_send(struct tdb *, struct mbuf *, struct route *, - u_int, int, int); + u_int, int); #endif /* IPSEC */ #endif /* _KERNEL */ diff --git a/lib/libc/include/generic-openbsd/nfs/nfs_var.h b/lib/libc/include/generic-openbsd/nfs/nfs_var.h index 73c6f8e0cdbb43eb5927908536922b7194119bf9..c08ec88530215e61817621082ed6b8c30c93d965 100644 --- a/lib/libc/include/generic-openbsd/nfs/nfs_var.h +++ b/lib/libc/include/generic-openbsd/nfs/nfs_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_var.h,v 1.66 2024/09/09 03:50:14 jsg Exp $ */ +/* $OpenBSD: nfs_var.h,v 1.71 2026/06/09 02:55:17 jsg Exp $ */ /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */ /* @@ -68,8 +68,6 @@ int nfs_writerpc(struct vnode *, struct uio *, int *, int *); int nfs_removeit(struct sillyrename *); int nfs_writebp(struct buf *, int); -#define nfs_ioctl ((int (*)(void *))enoioctl) - /* nfs_serv.c */ int nfsrv3_access(struct nfsrv_descript *, struct nfssvc_sock *, struct proc *, struct mbuf **); @@ -148,15 +146,15 @@ int nfs_namei(struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct proc *); void nfsm_adj(struct mbuf *, int, int); void nfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int, - struct vattr *, struct nfsm_info *); + struct vattr *, struct mbuf **); void nfsm_srvpostop_attr(struct nfsrv_descript *, int, struct vattr *, - struct nfsm_info *); + struct mbuf **); void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *, struct nfs_fattr *); int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *, struct nfssvc_sock *, struct mbuf *, int *); int netaddr_match(int, union nethostaddr *, struct mbuf *); -int nfsm_srvsattr(struct mbuf **, struct vattr *, struct mbuf *, caddr_t *); +int nfsm_srvsattr(struct nfsrv_descript *, struct vattr *); /* nfs_subs.c */ struct mbuf *nfsm_reqhead(int); @@ -183,7 +181,7 @@ void nfs_add_tobecommitted_range(struct vnode *, struct buf *); void nfs_del_tobecommitted_range(struct vnode *, struct buf *); void nfs_merge_commit_ranges(struct vnode *); int nfsrv_errmap(struct nfsrv_descript *, int); -void nfsm_fhtom(struct nfsm_info *, struct vnode *, int); +void nfsm_fhtom(struct mbuf **, struct vnode *, int); void nfsm_srvfhtom(struct mbuf **, fhandle_t *, int); /* nfs_syscalls.c */ diff --git a/lib/libc/include/generic-openbsd/nfs/nfsm_subs.h b/lib/libc/include/generic-openbsd/nfs/nfsm_subs.h index d6dcf14622e683ea8715f68fd08e2e90657a5f88..d9349fcdc947a2d09c3e549e731d1e6523fb068b 100644 --- a/lib/libc/include/generic-openbsd/nfs/nfsm_subs.h +++ b/lib/libc/include/generic-openbsd/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.49 2024/09/11 12:22:34 claudio Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.52 2026/06/09 02:52:26 jsg Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -48,7 +48,6 @@ struct nfsm_info { /* Setting up / Tearing down. */ struct mbuf *nmi_md; - struct mbuf *nmi_mb; caddr_t nmi_dpos; int nmi_v3; @@ -56,6 +55,30 @@ struct nfsm_info { int *nmi_errorp; }; +static inline void * +nfsd_dissect(struct nfsrv_descript *nfsd, int s, int *errorp) +{ + caddr_t ret; + int avail, error; + + avail = mtod(nfsd->nd_md, caddr_t) + nfsd->nd_md->m_len - + nfsd->nd_dpos; + if (avail >= s) { + ret = nfsd->nd_dpos; + nfsd->nd_dpos += s; + return ret; + } + error = nfsm_disct(&nfsd->nd_md, &nfsd->nd_dpos, s, avail, &ret); + if (error != 0) { + m_freem(nfsd->nd_mrep); + nfsd->nd_mrep = NULL; + *errorp = error; + return NULL; + } else { + return ret; + } +} + static inline void * nfsm_dissect(struct nfsm_info *infop, int s) { @@ -82,6 +105,27 @@ nfsm_dissect(struct nfsm_info *infop, int s) #define nfsm_rndup(a) (((a)+3)&(~0x3)) +static inline int +nfsd_adv(struct nfsrv_descript *nfsd, int s, int *errorp) +{ + int avail, error; + + avail = mtod(nfsd->nd_md, caddr_t) + nfsd->nd_md->m_len - + nfsd->nd_dpos; + if (avail >= s) { + nfsd->nd_dpos += s; + return 0; + } + error = nfs_adv(&nfsd->nd_md, &nfsd->nd_dpos, s, avail); + if (error != 0) { + m_freem(nfsd->nd_mrep); + nfsd->nd_mrep = NULL; + *errorp = error; + return error; + } + return 0; +} + static inline int nfsm_adv(struct nfsm_info *infop, int s) { @@ -133,6 +177,24 @@ nfsm_postop_attr(struct nfsm_info *infop, struct vnode **vpp, int *attrflagp) return 0; } +static inline int +nfsd_strsiz(struct nfsrv_descript *nfsd, int *lenp, int maxlen, int *errorp) +{ + uint32_t *tl = (uint32_t *)nfsd_dissect(nfsd, NFSX_UNSIGNED, errorp); + int len; + if (tl == NULL) + return 1; + len = fxdr_unsigned(int32_t, *tl); + if (len < 0 || len > maxlen) { + m_freem(nfsd->nd_mrep); + nfsd->nd_mrep = NULL; + *errorp = EBADRPC; + return 1; + } + *lenp = len; + return 0; +} + static inline int nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen) { @@ -151,6 +213,24 @@ nfsm_strsiz(struct nfsm_info *infop, int *lenp, int maxlen) return 0; } +static inline int +nfsd_mtouio(struct nfsrv_descript *nfsd, struct uio *uiop, int len, int *errorp) +{ + int error; + + if (len <= 0) + return 0; + + error = nfsm_mbuftouio(&nfsd->nd_md, uiop, len, &nfsd->nd_dpos); + if (error != 0) { + m_freem(nfsd->nd_mrep); + nfsd->nd_mrep = NULL; + *errorp = error; + return error; + } + return 0; +} + static inline int 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) } static inline int -nfsm_strtom(struct nfsm_info *infop, char *str, size_t len, size_t maxlen) +nfsm_strtom(struct nfsm_info *infop, struct mbuf **mb, + char *str, size_t len, size_t maxlen) { if (len > maxlen) { m_freem(infop->nmi_mreq); @@ -178,7 +259,7 @@ nfsm_strtom(struct nfsm_info *infop, char *str, size_t len, size_t maxlen) *infop->nmi_errorp = ENAMETOOLONG; return 1; } - nfsm_strtombuf(&infop->nmi_mb, str, len); + nfsm_strtombuf(mb, str, len); return 0; } diff --git a/lib/libc/include/generic-openbsd/resolv.h b/lib/libc/include/generic-openbsd/resolv.h index 87b870b02894dd7d24a999ac9a3963634ac497ad..adbde36729074bea7c19dd3f50cd5b8ed22f9be8 100644 --- a/lib/libc/include/generic-openbsd/resolv.h +++ b/lib/libc/include/generic-openbsd/resolv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolv.h,v 1.23 2021/11/22 20:18:27 jca Exp $ */ +/* $OpenBSD: resolv.h,v 1.24 2026/09/05 08:18:23 jsg Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -177,7 +177,7 @@ struct __res_state_ext { #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ #define RES_USEVC 0x00000008 /* use virtual circuit */ #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ -#define RES_IGNTC 0x00000020 /* ignore trucation errors */ +#define RES_IGNTC 0x00000020 /* ignore truncation errors */ #define RES_RECURSE 0x00000040 /* recursion desired */ #define RES_DEFNAMES 0x00000080 /* use default domain name */ #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ diff --git a/lib/libc/include/generic-openbsd/rmd160.h b/lib/libc/include/generic-openbsd/rmd160.h index b227c3fc78447b5831389bd78a6fc1900b3af26a..3ccd7dd793750942174d0959e0375aa8175affb2 100644 --- a/lib/libc/include/generic-openbsd/rmd160.h +++ b/lib/libc/include/generic-openbsd/rmd160.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rmd160.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */ +/* $OpenBSD: rmd160.h,v 1.18 2026/08/31 15:09:14 tb Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -38,20 +38,14 @@ typedef struct RMD160Context { __BEGIN_DECLS void RMD160Init(RMD160_CTX *); -void RMD160Transform(u_int32_t [5], const u_int8_t [RMD160_BLOCK_LENGTH]) - __attribute__((__bounded__(__minbytes__,1,5))) - __attribute__((__bounded__(__minbytes__,2,RMD160_BLOCK_LENGTH))); void RMD160Update(RMD160_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void RMD160Pad(RMD160_CTX *); void RMD160Final(u_int8_t [RMD160_DIGEST_LENGTH], RMD160_CTX *) __attribute__((__bounded__(__minbytes__,1,RMD160_DIGEST_LENGTH))); char *RMD160End(RMD160_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH))); char *RMD160File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH))); -char *RMD160FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH))); char *RMD160Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,RMD160_DIGEST_STRING_LENGTH))); diff --git a/lib/libc/include/generic-openbsd/rpc/auth.h b/lib/libc/include/generic-openbsd/rpc/auth.h index 60b558ed39030e72f5588819c38d0041a8fc86b1..4d1ab5a16adc11f792f3960dabd0f1f7a1e0b866 100644 --- a/lib/libc/include/generic-openbsd/rpc/auth.h +++ b/lib/libc/include/generic-openbsd/rpc/auth.h @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.h,v 1.9 2022/02/14 03:38:59 guenther Exp $ */ +/* $OpenBSD: auth.h,v 1.10 2026/09/05 08:36:42 jsg Exp $ */ /* $NetBSD: auth.h,v 1.7 1995/04/29 05:27:55 cgd Exp $ */ /* @@ -105,7 +105,7 @@ typedef struct __rpc_auth { void (*ah_nextverf)(struct __rpc_auth *); /* nextverf & serialize */ int (*ah_marshal)(struct __rpc_auth *, XDR *); - /* validate varifier */ + /* validate verifier */ int (*ah_validate)(struct __rpc_auth *, struct opaque_auth *); /* refresh credentials */ diff --git a/lib/libc/include/generic-openbsd/sha1.h b/lib/libc/include/generic-openbsd/sha1.h index f98d41c8e5c7dd0b69d4cb6a215781a15388635f..548ccdbe5f599ca1fc1dfc13ddb207f1d2fa9310 100644 --- a/lib/libc/include/generic-openbsd/sha1.h +++ b/lib/libc/include/generic-openbsd/sha1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.h,v 1.24 2012/12/05 23:19:57 deraadt Exp $ */ +/* $OpenBSD: sha1.h,v 1.25 2026/08/31 15:09:14 tb Exp $ */ /* * SHA-1 in C @@ -21,10 +21,6 @@ typedef struct { __BEGIN_DECLS void SHA1Init(SHA1_CTX *); -void SHA1Pad(SHA1_CTX *); -void SHA1Transform(u_int32_t [5], const u_int8_t [SHA1_BLOCK_LENGTH]) - __attribute__((__bounded__(__minbytes__,1,5))) - __attribute__((__bounded__(__minbytes__,2,SHA1_BLOCK_LENGTH))); void SHA1Update(SHA1_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); void SHA1Final(u_int8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *) @@ -33,8 +29,6 @@ char *SHA1End(SHA1_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH))); char *SHA1File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH))); -char *SHA1FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH))); char *SHA1Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA1_DIGEST_STRING_LENGTH))); diff --git a/lib/libc/include/generic-openbsd/sha2.h b/lib/libc/include/generic-openbsd/sha2.h index 79bc16e3fbe05240115509596717ce85cbe450e1..cb67d173a14ae8aa8cdb96bebbab34b0ad6cec65 100644 --- a/lib/libc/include/generic-openbsd/sha2.h +++ b/lib/libc/include/generic-openbsd/sha2.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sha2.h,v 1.10 2016/09/03 17:00:29 tedu Exp $ */ +/* $OpenBSD: sha2.h,v 1.11 2026/08/31 15:09:14 tb Exp $ */ /* * FILE: sha2.h @@ -68,86 +68,66 @@ typedef struct _SHA2_CTX { __BEGIN_DECLS void SHA224Init(SHA2_CTX *); -void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]); void SHA224Update(SHA2_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void SHA224Pad(SHA2_CTX *); void SHA224Final(u_int8_t [SHA224_DIGEST_LENGTH], SHA2_CTX *) __attribute__((__bounded__(__minbytes__,1,SHA224_DIGEST_LENGTH))); char *SHA224End(SHA2_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH))); char *SHA224File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH))); -char *SHA224FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA224_DIGEST_STRING_LENGTH))); char *SHA224Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA224_DIGEST_STRING_LENGTH))); void SHA256Init(SHA2_CTX *); -void SHA256Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void SHA256Pad(SHA2_CTX *); void SHA256Final(u_int8_t [SHA256_DIGEST_LENGTH], SHA2_CTX *) __attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH))); char *SHA256End(SHA2_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); char *SHA256File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); -char *SHA256FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); char *SHA256Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); void SHA384Init(SHA2_CTX *); -void SHA384Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void SHA384Pad(SHA2_CTX *); void SHA384Final(u_int8_t [SHA384_DIGEST_LENGTH], SHA2_CTX *) __attribute__((__bounded__(__minbytes__,1,SHA384_DIGEST_LENGTH))); char *SHA384End(SHA2_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); char *SHA384File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); -char *SHA384FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); char *SHA384Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); void SHA512Init(SHA2_CTX *); -void SHA512Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void SHA512Pad(SHA2_CTX *); void SHA512Final(u_int8_t [SHA512_DIGEST_LENGTH], SHA2_CTX *) __attribute__((__bounded__(__minbytes__,1,SHA512_DIGEST_LENGTH))); char *SHA512End(SHA2_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); char *SHA512File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); -char *SHA512FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); char *SHA512Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); void SHA512_256Init(SHA2_CTX *); -void SHA512_256Transform(u_int64_t state[8], const u_int8_t [SHA512_256_BLOCK_LENGTH]); void SHA512_256Update(SHA2_CTX *, const u_int8_t *, size_t) __attribute__((__bounded__(__string__,2,3))); -void SHA512_256Pad(SHA2_CTX *); void SHA512_256Final(u_int8_t [SHA512_256_DIGEST_LENGTH], SHA2_CTX *) __attribute__((__bounded__(__minbytes__,1,SHA512_256_DIGEST_LENGTH))); char *SHA512_256End(SHA2_CTX *, char *) __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH))); char *SHA512_256File(const char *, char *) __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH))); -char *SHA512_256FileChunk(const char *, char *, off_t, off_t) - __attribute__((__bounded__(__minbytes__,2,SHA512_256_DIGEST_STRING_LENGTH))); char *SHA512_256Data(const u_int8_t *, size_t, char *) __attribute__((__bounded__(__string__,1,2))) __attribute__((__bounded__(__minbytes__,3,SHA512_256_DIGEST_STRING_LENGTH))); diff --git a/lib/libc/include/generic-openbsd/spawn.h b/lib/libc/include/generic-openbsd/spawn.h index 79f2dd47b76777d8cbe5634bcd9d3c5a423e949d..75d968544e98485af381364fa994e0b5fb270bda 100644 --- a/lib/libc/include/generic-openbsd/spawn.h +++ b/lib/libc/include/generic-openbsd/spawn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: spawn.h,v 1.3 2015/05/20 22:50:07 millert Exp $ */ +/* $OpenBSD: spawn.h,v 1.4 2026/08/31 15:12:32 tb Exp $ */ /*- * Copyright (c) 2008 Ed Schouten * All rights reserved. @@ -69,6 +69,11 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t); int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int); int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int); +#if __POSIX_VISIBLE >= 202405 +int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *__restrict, + const char *__restrict); +int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *, int); +#endif /* * Spawn attributes diff --git a/lib/libc/include/generic-openbsd/sys/buf.h b/lib/libc/include/generic-openbsd/sys/buf.h index 864be56101f94a9a80c7f036588a5c4f073b1a86..e4b6a934a90ff7b21e569d126c639fe7792d3d70 100644 --- a/lib/libc/include/generic-openbsd/sys/buf.h +++ b/lib/libc/include/generic-openbsd/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.120 2025/08/14 16:13:52 beck Exp $ */ +/* $OpenBSD: buf.h,v 1.123 2026/08/03 03:27:45 jsg Exp $ */ /* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */ /* @@ -120,7 +120,6 @@ struct buf { LIST_ENTRY(buf) b_list; /* All allocated buffers. */ LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ - int cache; /* which cache are we in */ struct proc *b_proc; /* Associated proc; NULL if kernel. */ volatile long b_flags; /* B_* flags. */ long b_bufsize; /* Allocated buffer size. */ @@ -193,13 +192,12 @@ struct bufcache { #define B_WARM 0x00800000 /* buffer is or has been on the warm queue */ #define B_COLD 0x01000000 /* buffer is on the cold queue */ #define B_BC 0x02000000 /* buffer is managed by the cache */ -#define B_DMA 0x04000000 /* buffer is DMA reachable */ #define B_BITS "\20\001AGE\002NEEDCOMMIT\003ASYNC\004BAD\005BUSY" \ "\006CACHE\007CALL\010DELWRI\011DONE\012EINTR\013ERROR" \ "\014INVAL\015NOCACHE\016PHYS\017RAW\020READ" \ "\021WANTED\022WRITEINPROG\023XXX(FORMAT)\024DEFERRED" \ - "\025SCANNED\026DAEMON\027RELEASED\030WARM\031COLD\032BC\033DMA" + "\025SCANNED\026DAEMON\027RELEASED\030WARM\031COLD\032BC" /* * Zero out the buffer's data area. @@ -262,9 +260,7 @@ struct buf *incore(struct vnode *, daddr_t); void bufcache_take(struct buf *); void bufcache_release(struct buf *); -int buf_flip_high(struct buf *); -void buf_flip_dma(struct buf *); -struct buf *bufcache_getcleanbuf(int, int); +struct buf *bufcache_getcleanbuf(int); struct buf *bufcache_getdirtybuf(void); /* @@ -284,7 +280,6 @@ int buf_dealloc_mem(struct buf *); void buf_fix_mapping(struct buf *, vsize_t); void buf_alloc_pages(struct buf *, vsize_t); void buf_free_pages(struct buf *); -int buf_realloc_pages(struct buf *, struct uvm_constraint_range *, int); void minphys(struct buf *bp); int physio(void (*strategy)(struct buf *), dev_t dev, int flags, diff --git a/lib/libc/include/generic-openbsd/sys/device.h b/lib/libc/include/generic-openbsd/sys/device.h index 6968593939f6b10b78ae954ab496b2cd88eaa07a..62721c1aeddc2194dc424cf48ebbcdb160e10121 100644 --- a/lib/libc/include/generic-openbsd/sys/device.h +++ b/lib/libc/include/generic-openbsd/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.71 2026/03/11 16:18:42 kettenis Exp $ */ +/* $OpenBSD: device.h,v 1.72 2026/09/07 21:30:59 kettenis Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -202,11 +202,13 @@ void config_pending_decr(void); void config_mountroot(struct device *, void (*)(struct device *)); void config_process_deferred_mountroot(void); -int request_sleep(int); -int sleep_state(void *, int); +extern int sleep_mode; #define SLEEP_RESUME 0 #define SLEEP_SUSPEND 1 #define SLEEP_HIBERNATE 2 + +int request_sleep(int); +int sleep_state(void *, int); void sleep_mp(void); void resume_mp(void); int sleep_showstate(void *v, int sleepmode); diff --git a/lib/libc/include/generic-openbsd/sys/dkio.h b/lib/libc/include/generic-openbsd/sys/dkio.h index 853dc8a4479272f1bb230e4308f7c230df703bc7..3b12ca4758fb360f172c17fbd21ec22dd7ff6848 100644 --- a/lib/libc/include/generic-openbsd/sys/dkio.h +++ b/lib/libc/include/generic-openbsd/sys/dkio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dkio.h,v 1.14 2025/11/13 20:59:14 deraadt Exp $ */ +/* $OpenBSD: dkio.h,v 1.15 2026/06/24 17:03:06 krw Exp $ */ /* $NetBSD: dkio.h,v 1.1 1996/01/30 18:21:48 thorpej Exp $ */ /* @@ -50,10 +50,6 @@ #define DIOCGPDINFO _IOR('d', 114, struct disklabel)/* get physical */ #define DIOCRLDINFO _IO('d', 115) /* reload disklabel */ -/* XXX temporary to support the transition to more partitions */ -#define O_disklabel offsetof(struct disklabel, d_partitions[MAXPARTITIONS16]) -#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_disklabel) - struct dk_inquiry { char vendor[64]; char product[128]; diff --git a/lib/libc/include/generic-openbsd/sys/exec.h b/lib/libc/include/generic-openbsd/sys/exec.h index 368dde8a363073e3da78abe00dffaa511e363e1c..54bf7f6de8194703447ee7579c36d26e902ebbdb 100644 --- a/lib/libc/include/generic-openbsd/sys/exec.h +++ b/lib/libc/include/generic-openbsd/sys/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.57 2025/05/24 06:49:16 deraadt Exp $ */ +/* $OpenBSD: exec.h,v 1.61 2026/09/17 19:45:07 dgl Exp $ */ /* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */ /*- @@ -106,9 +106,8 @@ struct exec_vmcmd_set { struct exec_vmcmd evs_start[EXEC_DEFAULT_VMCMD_SETSIZE]; }; -struct elf_args; struct exec_package { - char *ep_name; /* file's name */ + const char *ep_name; /* file's name */ void *ep_hdr; /* file's exec header */ u_int ep_hdrlen; /* length of ep_hdr */ u_int ep_hdrvalid; /* bytes of ep_hdr that are valid */ @@ -123,16 +122,19 @@ struct exec_package { u_long ep_maxsaddr; /* proc's max stack addr ("top") */ u_long ep_minsaddr; /* proc's min stack addr ("bottom") */ u_long ep_ssize; /* size of process's stack */ - u_long ep_entry; /* process's entry point */ + u_long ep_entry; /* process's (maybe ld.so) point */ + u_long ep_entrymain; /* process's (main) entry point */ + u_long ep_phdraddr; /* process's elf phdr location */ + u_long ep_interpaddr; /* process's ld.so location */ u_int ep_flags; /* flags; see below. */ char **ep_fa; /* a fake args vector for scripts */ int ep_fd; /* a file descriptor we're holding */ - struct elf_args *ep_args; /* ELF info */ void *ep_auxinfo; /* userspace auxinfo address */ char *ep_interp; /* name of interpreter if any */ vaddr_t ep_pinstart, ep_pinend; /* executable region */ u_int *ep_pins; /* array of system call offsets */ int ep_npins; /* entries in array */ + char *ep_execpath; /* execve path on userland stack */ }; #define EXEC_INDIR 0x0001 /* script handling already done */ #define EXEC_HASFD 0x0002 /* holding a shell script */ diff --git a/lib/libc/include/generic-openbsd/sys/exec_elf.h b/lib/libc/include/generic-openbsd/sys/exec_elf.h index 2d39ed037dd2a72523c8790b385251f9485b098c..58701092e43c514bf6c47df907bfcdfb295f879b 100644 --- a/lib/libc/include/generic-openbsd/sys/exec_elf.h +++ b/lib/libc/include/generic-openbsd/sys/exec_elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.h,v 1.108 2025/07/31 16:09:59 kettenis Exp $ */ +/* $OpenBSD: exec_elf.h,v 1.112 2026/09/16 03:22:35 deraadt Exp $ */ /* * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. * @@ -734,16 +734,8 @@ enum AuxID { AUX_sun_gid = 2002, /* egid */ AUX_sun_rgid = 2003, /* rgid */ AUX_openbsd_timekeep = 4000, /* userland clock_gettime */ + AUX_openbsd_execpath = 4001, /* realpath'd executable path */ }; - -struct elf_args { - u_long arg_entry; /* program entry point */ - u_long arg_interp; /* Interpreter load address */ - u_long arg_phaddr; /* program header address */ - u_long arg_phentsize; /* Size of program header */ - u_long arg_phnum; /* Number of program headers */ -}; - #endif #if !defined(ELFSIZE) && defined(ARCH_ELFSIZE) @@ -822,7 +814,7 @@ extern Elf_Dyn _DYNAMIC[]; /* * How many entries are in the AuxInfo array we pass to the process? */ -#define ELF_AUX_ENTRIES 11 +#define ELF_AUX_ENTRIES 12 #define ELF_AUX_WORDS (sizeof(AuxInfo) * ELF_AUX_ENTRIES / sizeof(char *)) #define ELFROUNDSIZE sizeof(Elf_Word) diff --git a/lib/libc/include/generic-openbsd/sys/file.h b/lib/libc/include/generic-openbsd/sys/file.h index 047f0514c373b9dd096763c8697f209ec56fe107..1ce84f1bd951761e4120c5a0c9c78b8d99290217 100644 --- a/lib/libc/include/generic-openbsd/sys/file.h +++ b/lib/libc/include/generic-openbsd/sys/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.66 2022/06/20 01:39:44 visa Exp $ */ +/* $OpenBSD: file.h,v 1.67 2026/09/19 17:21:52 dv Exp $ */ /* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */ /* @@ -46,6 +46,7 @@ #define DTYPE_KQUEUE 4 /* event queue */ #define DTYPE_DMABUF 5 /* DMA buffer (for DRM) */ #define DTYPE_SYNC 6 /* sync file (for DRM) */ +#define DTYPE_VMM 7 /* vmm(4) virtual machine */ #ifdef _KERNEL struct proc; diff --git a/lib/libc/include/generic-openbsd/sys/fusebuf.h b/lib/libc/include/generic-openbsd/sys/fusebuf.h index 80e4e3d9424988078c3eb9f608654b18ae6dd0c2..7d1aa8bba8950064a4e4930176d1de2cfd1293a2 100644 --- a/lib/libc/include/generic-openbsd/sys/fusebuf.h +++ b/lib/libc/include/generic-openbsd/sys/fusebuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusebuf.h,v 1.16 2025/09/06 06:15:52 helg Exp $ */ +/* $OpenBSD: fusebuf.h,v 1.17 2026/06/17 13:29:01 helg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * Copyright (c) 2013 Martin Pieuchot @@ -19,36 +19,25 @@ #ifndef _SYS_FUSEBUF_H_ #define _SYS_FUSEBUF_H_ +#include + /* * Maximum size of the read or write buffer sent from the kernel for VFS * syscalls: read, readdir, readlink, write. */ #define FUSEBUFMAXSIZE (4096*1024) -/* header at beginning of each fusebuf: */ -struct fb_hdr { - SIMPLEQ_ENTRY(fusebuf) fh_next; /* next buffer in chain */ - size_t fh_len; /* Amount of data */ - int fh_err; /* errno to pass back */ - int fh_type; /* type of data */ - ino_t fh_ino; /* Inode of this fusebuf */ - uint64_t fh_uuid; /* Uuid to track the answer */ - pid_t fh_tid; /* calling proc thread id */ - uid_t fh_uid; /* calling proc uid */ - gid_t fh_gid; /* calling proc gid */ - mode_t fh_umask; /* calling proc umask */ -}; +/** Linux FUSE kernel interface major version we somewhat emulate. */ +#define FUSE_KERNEL_VERSION 7 -/* header for fuse file operations (like read/write/mkdir): */ -struct fb_io { - uint64_t fi_fd; /* fd where the io is performed */ - ino_t fi_ino; /* ino for the io */ - off_t fi_off; /* offset for the io */ - size_t fi_len; /* Length of data */ - mode_t fi_mode; /* mode for fd */ - uint32_t fi_flags; /* flags on transfer */ - dev_t fi_rdev; /* dev for mknod */ -}; +/** Linux FUSE kernel interface minor version we somewhat emulate. */ +#define FUSE_KERNEL_MINOR_VERSION 19 + +/* + * The root inode is the root of the mounted FUSE file system. + * Also note that inode 0 can't be used for normal purposes. + */ +#define FUSE_ROOT_ID ((ino_t)1) /* * An operation is issued by the kernel through fuse(4) when the @@ -62,43 +51,6 @@ struct fb_io { * When the userland file system answers to this operation it uses * the same ID (fh_uuid). */ -struct fusebuf { - struct fb_hdr fb_hdr; - union { - struct statvfs FD_stat; /* vfs statfs */ - struct stat FD_attr; /* for attr vnops */ - struct fb_io FD_io; /* for file io vnops */ - } FD; - uint8_t *fb_dat; /* data's */ -}; - -#define fb_next fb_hdr.fh_next -#define fb_len fb_hdr.fh_len -#define fb_err fb_hdr.fh_err -#define fb_type fb_hdr.fh_type -#define fb_ino fb_hdr.fh_ino -#define fb_uuid fb_hdr.fh_uuid -#define fb_tid fb_hdr.fh_tid -#define fb_uid fb_hdr.fh_uid -#define fb_gid fb_hdr.fh_gid -#define fb_umask fb_hdr.fh_umask - -#define fb_stat FD.FD_stat -#define fb_attr FD.FD_attr -#define fb_io_fd FD.FD_io.fi_fd -#define fb_io_ino FD.FD_io.fi_ino -#define fb_io_off FD.FD_io.fi_off -#define fb_io_len FD.FD_io.fi_len -#define fb_io_mode FD.FD_io.fi_mode -#define fb_io_flags FD.FD_io.fi_flags -#define fb_io_rdev FD.FD_io.fi_rdev - -/* - * Macros for type conversion - * fbtod(fb,t) - convert fusebuf pointer to data pointer of correct - * type - */ -#define fbtod(fb,t) ((t)((fb)->fb_dat)) /* flags needed by setattr */ #define FUSE_FATTR_MODE (1 << 0) @@ -107,42 +59,368 @@ struct fusebuf { #define FUSE_FATTR_SIZE (1 << 3) #define FUSE_FATTR_ATIME (1 << 4) #define FUSE_FATTR_MTIME (1 << 5) -#define FUSE_FATTR_FH (1 << 6) /* fusebuf types */ -#define FBT_LOOKUP 0 -#define FBT_GETATTR 1 -#define FBT_SETATTR 2 -#define FBT_READLINK 3 -#define FBT_SYMLINK 4 -#define FBT_MKNOD 5 -#define FBT_MKDIR 6 -#define FBT_UNLINK 7 -#define FBT_RMDIR 8 -#define FBT_RENAME 9 -#define FBT_LINK 10 -#define FBT_OPEN 11 -#define FBT_READ 12 -#define FBT_WRITE 13 -#define FBT_STATFS 14 -#define FBT_RELEASE 16 -#define FBT_FSYNC 17 -#define FBT_FLUSH 18 -#define FBT_INIT 19 -#define FBT_OPENDIR 20 -#define FBT_READDIR 21 -#define FBT_RELEASEDIR 22 -#define FBT_FSYNCDIR 23 -#define FBT_ACCESS 24 -#define FBT_DESTROY 26 -#define FBT_RECLAIM 27 +#define FUSE_LOOKUP 1 +#define FUSE_GETATTR 3 +#define FUSE_SETATTR 4 +#define FUSE_READLINK 5 +#define FUSE_SYMLINK 6 +#define FUSE_MKNOD 8 +#define FUSE_MKDIR 9 +#define FUSE_UNLINK 10 +#define FUSE_RMDIR 11 +#define FUSE_RENAME 12 +#define FUSE_LINK 13 +#define FUSE_OPEN 14 +#define FUSE_READ 15 +#define FUSE_WRITE 16 +#define FUSE_STATFS 17 +#define FUSE_RELEASE 18 +#define FUSE_FSYNC 20 +#define FUSE_FLUSH 25 +#define FUSE_INIT 26 +#define FUSE_OPENDIR 27 +#define FUSE_READDIR 28 +#define FUSE_RELEASEDIR 29 +#define FUSE_DESTROY 38 +#define FUSE_FORGET 2 + +struct fuse_attr { + uint64_t ino; + uint64_t size; + uint64_t blocks; + uint64_t atime; + uint64_t mtime; + uint64_t ctime; + uint32_t atimensec; + uint32_t mtimensec; + uint32_t ctimensec; + uint32_t mode; + uint32_t nlink; + uint32_t uid; + uint32_t gid; + uint32_t rdev; + uint32_t blksize; + uint32_t padding; +}; + + +struct fuse_entry_out { + uint64_t nodeid; /* Inode number */ + uint64_t generation; /* Not implemented */ + uint64_t entry_valid; /* Not implemented */ + uint64_t attr_valid; /* Not implemented */ + uint32_t entry_valid_nsec; /* Not implemented */ + uint32_t attr_valid_nsec; /* Not implemented */ + struct fuse_attr attr; +}; + +struct fuse_forget_in { + uint64_t nlookup; +}; + +struct fuse_getattr_in { + uint32_t getattr_flags; /* Not implemented */ + uint32_t dummy; + uint64_t fh; /* Not implemented */ +}; + +struct fuse_attr_out { + uint64_t attr_valid; /* Not implemented */ + uint32_t attr_valid_nsec; /* Not implemented */ + uint32_t dummy; + struct fuse_attr attr; +}; + +struct fuse_mknod_in { + uint32_t mode; + uint32_t rdev; + uint32_t umask; + uint32_t padding; +}; + +struct fuse_mkdir_in { + uint32_t mode; + uint32_t umask; +}; + +struct fuse_rename_in { + uint64_t newdir; +}; + +struct fuse_link_in { + uint64_t oldnodeid; +}; + +struct fuse_setattr_in { + uint32_t valid; + uint32_t padding; + uint64_t fh; + uint64_t size; + uint64_t lock_owner; + uint64_t atime; + uint64_t mtime; + uint64_t unused2; + uint32_t atimensec; + uint32_t mtimensec; + uint32_t unused3; + uint32_t mode; + uint32_t unused4; + uint32_t uid; + uint32_t gid; + uint32_t unused5; +}; + +struct fuse_open_in { + uint32_t flags; + uint32_t unused; +}; + +struct fuse_open_out { + uint64_t fh; + uint32_t open_flags; + uint32_t padding; +}; + +struct fuse_release_in { + uint64_t fh; + uint32_t flags; + uint32_t release_flags; + uint64_t lock_owner; +}; + +struct fuse_flush_in { + uint64_t fh; + uint32_t unused; + uint32_t padding; + uint64_t lock_owner; +}; + +struct fuse_read_in { + uint64_t fh; + uint64_t offset; + uint32_t size; + uint32_t read_flags; + uint64_t lock_owner; + uint32_t flags; + uint32_t padding; +}; + +struct fuse_write_in { + uint64_t fh; + uint64_t offset; + uint32_t size; + uint32_t write_flags; + uint64_t lock_owner; + uint32_t flags; + uint32_t padding; +}; + +struct fuse_write_out { + uint32_t size; + uint32_t padding; +}; + +struct fuse_kstatfs { + uint64_t blocks; + uint64_t bfree; + uint64_t bavail; + uint64_t files; + uint64_t ffree; + uint32_t bsize; + uint32_t namelen; + uint32_t frsize; + uint32_t padding; + uint32_t spare[6]; +}; + +struct fuse_statfs_out { + struct fuse_kstatfs st; +}; + +struct fuse_fsync_in { + uint64_t fh; + uint32_t fsync_flags; //XXX + uint32_t padding; +}; + +struct fuse_init_in { + uint32_t major; + uint32_t minor; + uint32_t max_readahead; + uint32_t flags; +}; + +struct fuse_init_out { + uint32_t major; + uint32_t minor; + uint32_t max_readahead; /* Not implemented */ + uint32_t flags; /* Not implemented */ + uint16_t max_background; /* Not implemented */ + uint16_t congestion_threshold; /* Not implemented */ + uint32_t max_write; +}; + +struct fuse_in_header { + uint32_t len; + uint32_t opcode; + uint64_t unique; + uint64_t nodeid; + uint32_t uid; + uint32_t gid; + uint32_t pid; + uint32_t padding; +}; + +struct fuse_out_header { + uint32_t len; + int32_t error; + uint64_t unique; +}; + +struct fuse_dirent { + uint64_t ino; + uint64_t off; + uint32_t namelen; + uint32_t type; + char name[]; /* unterminated string */ +}; + +#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) +#define FUSE_DIRENT_ALIGN(x) \ + (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) +#define FUSE_DIRENT_SIZE(d) \ + FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) #ifdef _KERNEL +/* + * An operation is issued by the kernel through fuse(4) when the + * userland file system needs to execute an action (mkdir(2), + * link(2), etc). + * + * When the userland file system answers to this operation it uses + * the same ID (fb_uuid). + */ +struct fusebuf { + SIMPLEQ_ENTRY(fusebuf) next; /* next buffer in chain */ + struct fuse_in_header hdr; + int32_t error; /* error returned by daemon */ + size_t op_in_len; /* size of input */ + size_t op_out_len; /* size of output */ + uint8_t op_out_buf; /* whether to expect data */ + union { + union { + struct fuse_forget_in forget; + struct fuse_getattr_in getattr; + struct fuse_setattr_in setattr; + struct fuse_mknod_in mknod; + struct fuse_mkdir_in mkdir; + struct fuse_rename_in rename; + struct fuse_link_in link; + struct fuse_open_in open; + struct fuse_read_in read; + struct fuse_write_in write; + struct fuse_release_in release; + struct fuse_fsync_in fsync; + struct fuse_flush_in flush; + struct fuse_init_in init; + } in; + union { + struct fuse_entry_out entry; + struct fuse_attr_out attr; + struct fuse_open_out open; + struct fuse_write_out write; + struct fuse_statfs_out statfs; + struct fuse_init_out init; + } out; + } op; + uint64_t dat_len; + uint8_t *dat; +}; + +#define fb_dat dat +#define fb_next next +#define fb_err error +#define fb_len dat_len +#define fb_type hdr.opcode +#define fb_uuid hdr.unique +#define fb_ino hdr.nodeid +#define fb_tid hdr.pid +#define fb_uid hdr.uid +#define fb_gid hdr.gid + /* fusebuf prototypes */ struct fusebuf *fb_setup(size_t, ino_t, int, struct proc *); int fb_queue(dev_t, struct fusebuf *); void fb_delete(struct fusebuf *); +#else /* _KERNEL */ + +/* + * Userland fusebuf more directly maps to the protocol binary layout for each + * file operation request (input). This consists of a header followed by an + * optional input struct with data immediately following either the header or + * input struct. + * + * FUSE_LOOKUP: hdr, dat (filename) + * FUSE_GETATTR: hdr, getattr + * FUSE_SETATTR: hdr, setattr + * FUSE_READLINK: hdr + * FUSE_SYMLINK: hdr, dat (source\0target) + * FUSE_MKNOD: hdr, mknod, dat (filename) + * FUSE_MKDIR: hdr, mkdir, dat (dirname) + * FUSE_UNLINK: hdr, dat (filename) + * FUSE_RMDIR: hdr, dat (dirname) + * FUSE_RENAME: hdr, rename, dat (oldname\0newname) + * FUSE_LINK: hdr, dat (source\0target) + * FUSE_OPEN: hdr, open + * FUSE_READ: hdr, read + * FUSE_WRITE: hdr, write, dat + * FUSE_STATFS: hdr, statfs + * FUSE_RELEASE: hdr, release + * FUSE_FSYNC: hdr, fsync + * FUSE_FLUSH: hdr, flush + * FUSE_INIT: hdr, init + * FUSE_OPENDIR: hdr, open + * FUSE_READDIR: hdr, read + * FUSE_RELEASEDIR: hdr, release + * FUSE_DESTROY: hdr + * FUSE_FORGET: hdr, forget + */ +struct fusebuf { + struct fuse_in_header hdr; + union { + struct fuse_forget_in forget; + struct fuse_getattr_in getattr; + struct fuse_setattr_in setattr; + struct fuse_mknod_in mknod; + struct fuse_mkdir_in mkdir; + struct fuse_rename_in rename; + struct fuse_link_in link; + struct fuse_open_in open; + struct fuse_read_in read; + struct fuse_write_in write; + struct fuse_release_in release; + struct fuse_fsync_in fsync; + struct fuse_flush_in flush; + struct fuse_init_in init; + } in; +}; + +#define fb_type hdr.opcode +#define fb_uuid hdr.unique +#define fb_ino hdr.nodeid +#define fb_tid hdr.pid +#define fb_uid hdr.uid +#define fb_gid hdr.gid + +/* + * Macro to get the additional data for operations that have it. + * The data starts immediately after the related input struct. + */ +#define fb_dat(in) (((char *)&(in)) + sizeof(in)) + #endif /* _KERNEL */ #endif /* _SYS_FUSEBUF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/sys/hibernate.h b/lib/libc/include/generic-openbsd/sys/hibernate.h index d7e3176f1963c598c1e8a9eb63ddeaaab119db83..0be10c19c33850631feb9f7e54bffc1c9a9d8435 100644 --- a/lib/libc/include/generic-openbsd/sys/hibernate.h +++ b/lib/libc/include/generic-openbsd/sys/hibernate.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hibernate.h,v 1.51 2025/07/05 09:24:37 jsg Exp $ */ +/* $OpenBSD: hibernate.h,v 1.52 2026/09/06 18:26:41 mglocker Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt @@ -150,6 +150,10 @@ void hibernate_unpack_image(union hibernate_info *); void hibernate_populate_resume_pt(union hibernate_info *, paddr_t, paddr_t); int hibernate_alloc(void); void hibernate_free(void); + +/* MD pmap setup/teardown for suspend-time HIBERNATE_HIBALLOC_PAGE access. */ +int hibernate_pmap_setup_md(void); +void hibernate_pmap_teardown_md(void); void hib_getentropy(char **, size_t *); int hibernate_write(union hibernate_info *, daddr_t, vaddr_t, size_t, int); diff --git a/lib/libc/include/generic-openbsd/sys/limits.h b/lib/libc/include/generic-openbsd/sys/limits.h index fc119cae3527483b3c191097f04ab899b793f554..d0d0c3e1e53f030e2281d112e9295c45800fddfa 100644 --- a/lib/libc/include/generic-openbsd/sys/limits.h +++ b/lib/libc/include/generic-openbsd/sys/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.10 2012/06/30 20:21:10 guenther Exp $ */ +/* $OpenBSD: limits.h,v 1.11 2026/09/26 15:02:53 deraadt Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -79,11 +79,6 @@ /* min value for a signed long long */ #endif -#if __BSD_VISIBLE -# define UID_MAX UINT_MAX /* max value for a uid_t */ -# define GID_MAX UINT_MAX /* max value for a gid_t */ -#endif - #if __XPG_VISIBLE || __POSIX_VISIBLE >= 200809 # ifdef __LP64__ # define LONG_BIT 64 diff --git a/lib/libc/include/generic-openbsd/sys/mbuf.h b/lib/libc/include/generic-openbsd/sys/mbuf.h index bcfcfc048ff810a656d7326b1a6052230db862b5..2bf93ba649ae97b54bcc298a4e1e65bb52fcffc7 100644 --- a/lib/libc/include/generic-openbsd/sys/mbuf.h +++ b/lib/libc/include/generic-openbsd/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.269 2026/02/05 03:26:00 dlg Exp $ */ +/* $OpenBSD: mbuf.h,v 1.271 2026/07/03 11:51:57 dlg Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -145,8 +145,6 @@ struct mbuf_ext { void *ext_arg; u_int ext_free_fn; /* index of free function */ u_int ext_size; /* size of buffer, for ext_free_fn */ - struct mbuf *ext_nextref; - struct mbuf *ext_prevref; #ifdef DEBUG const char *ext_ofile; const char *ext_nfile; @@ -282,13 +280,22 @@ struct mbuf { #define MCLREFDEBUGO(m, file, line) #endif -#define MCLISREFERENCED(m) ((m)->m_ext.ext_nextref != (m)) +int m_ext_refs_shared(struct mbuf *); -#define MCLADDREFERENCE(o, n) m_extref((o), (n)) +static inline int +m_extreferenced(struct mbuf *m) +{ + extern u_int m_extfree_refs_fn; + + if (m->m_ext.ext_free_fn != m_extfree_refs_fn) + return (0); + + return (m_ext_refs_shared(m)); +} + +#define MCLISREFERENCED(m) m_extreferenced(m) #define MCLINITREFERENCE(m) do { \ - (m)->m_ext.ext_prevref = (m); \ - (m)->m_ext.ext_nextref = (m); \ MCLREFDEBUGO((m), __FILE__, __LINE__); \ MCLREFDEBUGN((m), NULL, 0); \ } while (/* CONSTCOND */ 0) @@ -439,8 +446,8 @@ int m_leadingspace(struct mbuf *); int m_trailingspace(struct mbuf *); void m_align(struct mbuf *, int); struct mbuf *m_clget(struct mbuf *, int, u_int); -void m_extref(struct mbuf *, struct mbuf *); void m_pool_init(struct pool *, u_int, u_int, const char *); +void m_pool_noconstraints(void); u_int m_pool_used(void); void m_extfree_pool(caddr_t, u_int, void *); void m_adj(struct mbuf *, int); @@ -454,8 +461,8 @@ int m_apply(struct mbuf *, int, int, int (*)(caddr_t, caddr_t, unsigned int), caddr_t); struct mbuf *m_dup_pkt(struct mbuf *, unsigned int, int); int m_dup_pkthdr(struct mbuf *, struct mbuf *, int); - void m_microtime(const struct mbuf *, struct timeval *); +void mbuf_dma_64bit_enable(void); static inline struct mbuf * m_freemp(struct mbuf **mp) diff --git a/lib/libc/include/generic-openbsd/sys/mount.h b/lib/libc/include/generic-openbsd/sys/mount.h index f863cb68ff9deb64084136409d1683b48ad75b9f..41bd00610a59c54e5bd89f210625016eecf151a6 100644 --- a/lib/libc/include/generic-openbsd/sys/mount.h +++ b/lib/libc/include/generic-openbsd/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.153 2025/01/02 01:19:22 dlg Exp $ */ +/* $OpenBSD: mount.h,v 1.154 2026/06/10 00:04:38 beck Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -478,14 +478,9 @@ struct bcachestats { int64_t numreads; /* total reads started */ int64_t cachehits; /* total reads found in cache */ int64_t busymapped; /* number of busy and mapped buffers */ - int64_t dmapages; /* dma reachable pages in buffer cache */ - int64_t highpages; /* pages above dma region */ int64_t delwribufs; /* delayed write buffers */ int64_t kvaslots; /* kva slots total */ int64_t kvaslots_avail; /* available kva slots */ - int64_t highflips; /* total flips to above DMA */ - int64_t highflops; /* total failed flips to above DMA */ - int64_t dmaflips; /* total flips from high to DMA */ }; #ifdef _KERNEL extern struct bcachestats bcstats; diff --git a/lib/libc/include/generic-openbsd/sys/msg.h b/lib/libc/include/generic-openbsd/sys/msg.h index a7a4f3a5ba62dc92ec476ca934bf2975075eac8e..995b6848f5a21843257d08c0229d52d30ff11c1c 100644 --- a/lib/libc/include/generic-openbsd/sys/msg.h +++ b/lib/libc/include/generic-openbsd/sys/msg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: msg.h,v 1.24 2024/10/27 22:08:25 jsg Exp $ */ +/* $OpenBSD: msg.h,v 1.26 2026/07/08 19:39:33 mvs Exp $ */ /* $NetBSD: msg.h,v 1.9 1996/02/09 18:25:18 christos Exp $ */ /* @@ -77,7 +77,9 @@ struct que { /* for que_flags */ #define MSGQ_READERS 0x01 #define MSGQ_WRITERS 0x02 -#define MSGQ_DYING 0x04 +#define MSGQ_RCVWAIT 0x04 +#define MSGQ_RCVWAITING 0x08 +#define MSGQ_DYING 0x10 #define QREF(q) (q)->que_references++ @@ -104,9 +106,6 @@ struct msginfo { msgssz, /* size of a message segment (see notes above) */ msgseg; /* number of message segments */ }; -#ifdef SYSVMSG -extern struct msginfo msginfo; -#endif int sysctl_sysvmsg(int *, u_int, void *, size_t *); diff --git a/lib/libc/include/generic-openbsd/sys/namei.h b/lib/libc/include/generic-openbsd/sys/namei.h index 1a313cc8623771c49ac41d0ee65ed6cd63c40f14..d18f3c4839028ea7419fbfba2e41a19ce3da353c 100644 --- a/lib/libc/include/generic-openbsd/sys/namei.h +++ b/lib/libc/include/generic-openbsd/sys/namei.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namei.h,v 1.51 2026/03/08 16:41:19 deraadt Exp $ */ +/* $OpenBSD: namei.h,v 1.55 2026/09/17 18:51:39 deraadt Exp $ */ /* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */ /* @@ -51,13 +51,9 @@ struct nameidata { const char *ni_dirp; /* pathname pointer */ int ni_dirfd; /* dirfd from *at() functions */ enum uio_seg ni_segflg; /* location of pathname */ - /* u_long ni_nameiop; namei operation */ - /* u_long ni_flags; flags to namei */ - /* struct proc *ni_proc; process requesting lookup */ /* * Arguments to lookup. */ - /* struct ucred *ni_cred; credentials */ struct vnode *ni_startdir; /* starting directory */ struct vnode *ni_rootdir; /* logical root directory */ uint64_t ni_pledge; /* expected pledge for namei */ @@ -144,11 +140,14 @@ struct nameidata { #define ISLASTCN 0x008000 /* this is last component of pathname */ #define ISSYMLINK 0x010000 /* symlink needs interpretation */ #define REALPATH 0x020000 /* save pathname buffer for realpath */ +#define BPU_LOCALTIME 0x040000 /* /etc/localtime may cross 1 symlink */ #define REQUIREDIR 0x080000 /* must be a directory */ #define STRIPSLASHES 0x100000 /* strip trailing slashes */ #define PDIRUNLOCK 0x200000 /* vfs_lookup() unlocked parent dir */ #define BYPASSUNVEIL 0x400000 /* bypass pledgepath check */ #define KERNELPATH 0x800000 /* access file as kernel, not process */ +#define BPU_ZONEINFO 0x1000000 /* /usr/share/zoneinfo prohibits symlinks */ +#define EXECPATH 0x2000000 /* like REALPATH, but can give up */ /* * Initialization of an nameidata structure. @@ -209,6 +208,7 @@ struct unveil *unveil_lookup(struct vnode *, struct process *, ssize_t *); void unveil_start_relative(struct proc *, struct nameidata *, struct vnode *); void unveil_check_component(struct proc *, struct nameidata *, struct vnode *); int unveil_check_final(struct proc *, struct nameidata *); +int checkzoneinfopath(const char *); extern struct pool namei_pool; @@ -269,7 +269,7 @@ struct nchstats { #define UNVEIL_CREATE 0x04 #define UNVEIL_EXEC 0x08 #define UNVEIL_USERSET 0x10 -#define UNVEIL_PLEDGEOPEN 0X20 +#define UNVEIL_PLEDGEOPEN 0x20 #define UNVEIL_MASK 0x0f #endif /* !_SYS_NAMEI_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/sys/param.h b/lib/libc/include/generic-openbsd/sys/param.h index dcc616bf77ac893787a794ddd071ea40618c0651..878c6471f835ef96c8cab67d4608183df372f8ba 100644 --- a/lib/libc/include/generic-openbsd/sys/param.h +++ b/lib/libc/include/generic-openbsd/sys/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.146 2026/03/11 02:27:20 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.147 2026/07/16 06:21:08 deraadt Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -220,4 +220,4 @@ #endif #define FSCALE (1<<_FSHIFT) -#endif /* !_SYS_PARAM_H_ */ +#endif /* !_SYS_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/sys/pledge.h b/lib/libc/include/generic-openbsd/sys/pledge.h index e16767ea08f2de1bf44f3bcf6c46098b4e0dfed5..a1432e86fdbef4bb3445b13664be9e4449d2d44f 100644 --- a/lib/libc/include/generic-openbsd/sys/pledge.h +++ b/lib/libc/include/generic-openbsd/sys/pledge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pledge.h,v 1.53 2026/02/26 07:42:25 deraadt Exp $ */ +/* $OpenBSD: pledge.h,v 1.55 2026/09/19 17:21:52 dv Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -124,11 +124,12 @@ int pledge_sysctl(struct proc *p, int namelen, int *name, void *new); int pledge_chown(struct proc *p, uid_t, gid_t); int pledge_adjtime(struct proc *p, const void *v); int pledge_sendit(struct proc *p, const void *to); -int pledge_sockopt(struct proc *p, int set, int level, int optname); +struct protosw; +int pledge_sockopt(struct proc *p, int set, const struct protosw *pr, + int level, int optname); int pledge_socket(struct proc *p, int domain, unsigned int state); int pledge_ioctl(struct proc *p, long com, struct file *); int pledge_ioctl_drm(struct proc *p, long com, dev_t device); -int pledge_ioctl_vmm(struct proc *p, long com); int pledge_ioctl_psp(struct proc *p, long com); int pledge_flock(struct proc *p); int pledge_fcntl(struct proc *p, int cmd); diff --git a/lib/libc/include/generic-openbsd/sys/proc.h b/lib/libc/include/generic-openbsd/sys/proc.h index e1d6e62bbcd2aded9d002533dbc3bff23a9500f9..a776f8924fdcd65ac3cfd80748d61997c54acedf 100644 --- a/lib/libc/include/generic-openbsd/sys/proc.h +++ b/lib/libc/include/generic-openbsd/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.397 2025/08/18 04:15:35 dlg Exp $ */ +/* $OpenBSD: proc.h,v 1.401 2026/09/19 17:53:49 gnezdo Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -52,6 +52,7 @@ #include /* For struct sigio */ #include /* For struct refcnt */ #include +#include /* For struct ptrace_state */ #ifdef _KERNEL #include @@ -207,7 +208,7 @@ struct process { pid_t ps_ppid; /* [K|m] Cached parent pid */ int ps_ptmask; /* Ptrace event mask */ - struct ptrace_state *ps_ptstat;/* Ptrace state */ + struct ptrace_state ps_ptstat; /* Ptrace state */ struct process *ps_opptr; /* [K|m] Old parent during ptrace. */ struct rusage *ps_ru; /* sum of stats for dead threads. */ diff --git a/lib/libc/include/generic-openbsd/sys/queue.h b/lib/libc/include/generic-openbsd/sys/queue.h index db4f22bee5fe900e4910ee72a0f4fd3ca17691c5..bfbbd69d126d249fe877d4ee1948a6fb8be49184 100644 --- a/lib/libc/include/generic-openbsd/sys/queue.h +++ b/lib/libc/include/generic-openbsd/sys/queue.h @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.h,v 1.46 2020/12/30 13:33:12 millert Exp $ */ +/* $OpenBSD: queue.h,v 1.47 2026/06/12 01:04:42 millert Exp $ */ /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ /* @@ -589,9 +589,9 @@ struct { \ } while (0) #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((elm), field)) == NULL)\ + if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((listelm), field)) == NULL)\ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ - STAILQ_NEXT((elm), field) = (elm); \ + STAILQ_NEXT((listelm), field) = (elm); \ } while (0) #define STAILQ_REMOVE_HEAD(head, field) do { \ diff --git a/lib/libc/include/generic-openbsd/sys/sem.h b/lib/libc/include/generic-openbsd/sys/sem.h index 621ec97144d460939494ecd9ce65e002ec40763f..895cbaf5160a4dbcd8d2531eb749134e8c40089d 100644 --- a/lib/libc/include/generic-openbsd/sys/sem.h +++ b/lib/libc/include/generic-openbsd/sys/sem.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sem.h,v 1.26 2024/10/26 05:39:03 jsg Exp $ */ +/* $OpenBSD: sem.h,v 1.31 2026/08/20 16:14:20 sthen Exp $ */ /* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */ /* @@ -103,6 +103,7 @@ union semun { #ifdef _KERNEL #include +#include /* * Kernel implementation stuff @@ -110,6 +111,20 @@ union semun { #define SEMVMX 32767 /* semaphore maximum value */ #define SEMAEM 16384 /* adjust on exit max value */ +/* + * In-kernel semaphore implementation + */ +struct semid_ds_kern { + struct ipc_perm sem_perm; /* operation permission struct */ + struct sem *sem_base; /* pointer to first semaphore in set */ + unsigned short sem_nsems; /* number of sems in set */ + time_t sem_otime; /* last operation time */ + time_t sem_ctime; /* last change time */ + /* Times measured in secs since */ + /* 00:00:00 GMT, Jan. 1, 1970 */ + struct refcnt sem_refcnt; +}; + /* * Undo structure (one per process) */ @@ -144,16 +159,17 @@ struct sem_sysctl_info { struct semid_ds semids[1]; }; +extern struct rwlock sysvsem_lock; extern struct seminfo seminfo; /* * Configuration parameters */ #ifndef SEMMNI -#define SEMMNI 10 /* # of semaphore identifiers */ +#define SEMMNI 25 /* # of semaphore identifiers */ #endif #ifndef SEMMNS -#define SEMMNS 60 /* # of semaphores in system */ +#define SEMMNS 350 /* # of semaphores in system */ #endif #ifndef SEMUME #define SEMUME 10 /* max # of undo entries per process */ @@ -173,7 +189,7 @@ extern struct seminfo seminfo; /* actual size of an undo structure */ #define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME) -extern struct semid_ds **sema; /* semaphore id list */ +extern struct semid_ds_kern **sema; /* semaphore id list */ void seminit(void); void semexit(struct process *); diff --git a/lib/libc/include/generic-openbsd/sys/shm.h b/lib/libc/include/generic-openbsd/sys/shm.h index b3e2acabdab4686e95b27c888e7eff78087aa951..4e8ce9bfab2ef8039536551d0a77a3bc344eef7f 100644 --- a/lib/libc/include/generic-openbsd/sys/shm.h +++ b/lib/libc/include/generic-openbsd/sys/shm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: shm.h,v 1.31 2024/10/26 05:39:03 jsg Exp $ */ +/* $OpenBSD: shm.h,v 1.33 2026/09/16 16:37:39 mvs Exp $ */ /* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */ /* @@ -126,8 +126,24 @@ struct shm_sysctl_info { #endif /* __BSD_VISIBLE */ #ifdef _KERNEL +extern struct rwlock sysvshm_lock; extern struct shminfo shminfo; -extern struct shmid_ds **shmsegs; +extern struct shmid_ds_kern **shmsegs; + +struct shmid_ds_kern { + struct ipc_perm shm_perm; /* operation permission structure */ + int shm_segsz; /* size of segment in bytes */ + pid_t shm_lpid; /* process ID of last shm op */ + pid_t shm_cpid; /* process ID of creator */ + uint64_t shm_nattch; /* number of current attaches */ + time_t shm_atime; /* time of last shmat() */ + long __shm_atimensec; + time_t shm_dtime; /* time of last shmdt() */ + long __shm_dtimensec; + time_t shm_ctime; /* time of last change by shmctl() */ + long __shm_ctimensec; + void *shm_internal; /* implementation specific data */ +}; struct vmspace; diff --git a/lib/libc/include/generic-openbsd/sys/socketvar.h b/lib/libc/include/generic-openbsd/sys/socketvar.h index 6837a7cee95899454d071bb561713c826480cd34..c683bff5cbd3e85df782e79628631f53df69f924 100644 --- a/lib/libc/include/generic-openbsd/sys/socketvar.h +++ b/lib/libc/include/generic-openbsd/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.160 2025/10/24 15:09:56 bluhm Exp $ */ +/* $OpenBSD: socketvar.h,v 1.161 2026/06/11 12:50:52 bluhm Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -68,7 +68,7 @@ TAILQ_HEAD(soqhead, socket); */ struct sosplice { struct socket *ssp_socket; /* [mr ms] send data to drain socket */ - struct socket *ssp_soback; /* [ms ms] back ref to source socket */ + struct socket *ssp_soback; /* [mr ms] back ref to source socket */ off_t ssp_len; /* [mr] number of bytes spliced */ off_t ssp_max; /* [I] maximum number of bytes */ struct timeval ssp_idletv; /* [I] idle timeout */ diff --git a/lib/libc/include/generic-openbsd/sys/syscall.h b/lib/libc/include/generic-openbsd/sys/syscall.h index 4ae1c5bab76e4b8f808296c3c220b59e33f0de97..4c36c17d49f4909050b6ef816201125770a5d39b 100644 --- a/lib/libc/include/generic-openbsd/sys/syscall.h +++ b/lib/libc/include/generic-openbsd/sys/syscall.h @@ -1,10 +1,10 @@ -/* $OpenBSD: syscall.h,v 1.284 2026/03/08 16:41:35 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.286 2026/08/12 15:05:21 naddy Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp + * created from; OpenBSD: syscalls.master,v 1.272 2026/06/02 21:46:21 deraadt Exp */ /* syscall: "exit" ret: "void" args: "int" */ @@ -426,7 +426,7 @@ /* syscall: "setsid" ret: "int" args: */ #define SYS_setsid 147 -/* syscall: "quotactl" ret: "int" args: "const char *" "int" "int" "char *" */ +/* syscall: "quotactl" ret: "int" args: "const char *" "int" "int" "void *" */ #define SYS_quotactl 148 /* 149 is obsolete oquota */ @@ -452,9 +452,7 @@ /* 162 is obsolete ogetdomainname */ /* 163 is obsolete osetdomainname */ -/* syscall: "__tmpfd" ret: "int" args: "int" */ -#define SYS___tmpfd 164 - + /* 164 is obsolete __tmpfd */ /* syscall: "sysarch" ret: "int" args: "int" "void *" */ #define SYS_sysarch 165 diff --git a/lib/libc/include/generic-openbsd/sys/syscallargs.h b/lib/libc/include/generic-openbsd/sys/syscallargs.h index bd45b93a35c17878bb805a3512d003745f6ce8b0..e77248f30e51ab608c6caa1376cd77fb9b39d4a9 100644 --- a/lib/libc/include/generic-openbsd/sys/syscallargs.h +++ b/lib/libc/include/generic-openbsd/sys/syscallargs.h @@ -1,10 +1,10 @@ -/* $OpenBSD: syscallargs.h,v 1.287 2026/03/08 16:41:35 deraadt Exp $ */ +/* $OpenBSD: syscallargs.h,v 1.289 2026/08/12 15:05:21 naddy Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp + * created from; OpenBSD: syscalls.master,v 1.272 2026/06/02 21:46:21 deraadt Exp */ #ifdef syscallarg @@ -726,7 +726,7 @@ struct sys_quotactl_args { syscallarg(const char *) path; syscallarg(int) cmd; syscallarg(int) uid; - syscallarg(char *) arg; + syscallarg(void *) arg; }; struct sys_ypconnect_args { @@ -762,10 +762,6 @@ struct sys_getfh_args { syscallarg(fhandle_t *) fhp; }; -struct sys___tmpfd_args { - syscallarg(int) flags; -}; - struct sys_sysarch_args { syscallarg(int) op; syscallarg(void *) parms; @@ -1323,7 +1319,6 @@ int sys_pinsyscalls(struct proc *, void *, register_t *); int sys_mimmutable(struct proc *, void *, register_t *); int sys_waitid(struct proc *, void *, register_t *); int sys_getfh(struct proc *, void *, register_t *); -int sys___tmpfd(struct proc *, void *, register_t *); int sys_sysarch(struct proc *, void *, register_t *); int sys_lseek(struct proc *, void *, register_t *); int sys_truncate(struct proc *, void *, register_t *); diff --git a/lib/libc/include/generic-openbsd/sys/systm.h b/lib/libc/include/generic-openbsd/sys/systm.h index 1a1aad82305068730915fd4bd3697be3e474b50e..e477c103f3d74a80060c9212b59acc1c3a81d185 100644 --- a/lib/libc/include/generic-openbsd/sys/systm.h +++ b/lib/libc/include/generic-openbsd/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.177 2025/07/28 05:08:35 dlg Exp $ */ +/* $OpenBSD: systm.h,v 1.179 2026/04/22 01:51:37 jsg Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -149,8 +149,6 @@ extern void (*v_putc)(int); /* Virtual console putc routine */ */ int nullop(void *); int enodev(void); -int enosys(void); -int enoioctl(void); int enxio(void); int eopnotsupp(void *); diff --git a/lib/libc/include/generic-openbsd/sys/tty.h b/lib/libc/include/generic-openbsd/sys/tty.h index cb60f9347624f9ea4ec815dff28c280fd8b4507c..f919d24125264b2f9f8bf8380f52cda78b27525f 100644 --- a/lib/libc/include/generic-openbsd/sys/tty.h +++ b/lib/libc/include/generic-openbsd/sys/tty.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.h,v 1.45 2025/09/25 08:46:50 mvs Exp $ */ +/* $OpenBSD: tty.h,v 1.46 2026/08/06 20:38:02 claudio Exp $ */ /* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */ /*- @@ -146,7 +146,7 @@ struct itty { short t_lowat; short t_column; int t_state; - struct session *t_session; + pid_t t_session_id; pid_t t_pgrp_pg_id; u_char t_line; }; diff --git a/lib/libc/include/generic-openbsd/sys/videoio.h b/lib/libc/include/generic-openbsd/sys/videoio.h index c996daac60e8e210539c85e18076aa1b96f4599d..5f9ef309add7101f861634b7f35dbf4d2cc9ef4e 100644 --- a/lib/libc/include/generic-openbsd/sys/videoio.h +++ b/lib/libc/include/generic-openbsd/sys/videoio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: videoio.h,v 1.29 2026/02/19 20:42:45 kirill Exp $ */ +/* $OpenBSD: videoio.h,v 1.31 2026/09/13 11:04:09 kirill Exp $ */ /* * Video for Linux Two header file @@ -577,6 +577,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type { V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1, }; +#define V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (V4L2_CID_CODEC_BASE + 238) + /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270) enum v4l2_mpeg_video_mpeg2_level { @@ -4498,6 +4500,10 @@ struct v4l2_pix_format { #define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P') /* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S') /* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Dreamchip RPP-X1 ISP */ +#define V4L2_META_FMT_RPPX1_PARAMS v4l2_fourcc('D', 'R', '1', 'P') /* Dreamchip RPP-X1 Parameters */ +#define V4L2_META_FMT_RPPX1_STATS v4l2_fourcc('D', 'R', '1', 'S') /* Dreamchip RPP-X1 Statistics */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe diff --git a/lib/libc/include/generic-openbsd/unistd.h b/lib/libc/include/generic-openbsd/unistd.h index 913233cd683c97fc83f6d581ea6060116b02520f..906ae0f69fc1d4b96a72b583338be347039e6fa1 100644 --- a/lib/libc/include/generic-openbsd/unistd.h +++ b/lib/libc/include/generic-openbsd/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.113 2025/10/07 12:02:21 brynet Exp $ */ +/* $OpenBSD: unistd.h,v 1.115 2026/08/31 15:21:18 deraadt Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -346,6 +346,9 @@ char *getcwd(char *, size_t) __attribute__((__bounded__(__string__,1,2))); gid_t getegid(void); uid_t geteuid(void); +#if __BSD_VISIBLE +int getexecpath(char *, size_t); +#endif gid_t getgid(void); int getgroups(int, gid_t *); char *getlogin(void); @@ -508,7 +511,7 @@ int mkstemps(char *, int); int nfssvc(int, void *); int profil(void *, size_t, size_t, unsigned long, unsigned int, int) __attribute__ ((__bounded__(__string__,1,2))); -int quotactl(const char *, int, int, char *); +int quotactl(const char *, int, int, void *); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_extern.h b/lib/libc/include/generic-openbsd/uvm/uvm_extern.h index 9df72a98c1d8a3c19bbb3295a43589b263194b8c..9dc24fa48689c5f6883162007532db3bebae28ba 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_extern.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.187 2025/11/13 10:55:51 mpi Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.190 2026/07/24 15:03:50 kettenis Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -139,7 +139,6 @@ typedef int vm_prot_t; #define UVM_PLA_NOWAIT 0x0002 /* can't sleep (need one of the two) */ #define UVM_PLA_ZERO 0x0004 /* zero all pages before returning */ #define UVM_PLA_TRYCONTIG 0x0008 /* try to allocate contig physmem */ -#define UVM_PLA_FAILOK 0x0010 /* caller can handle failure */ #define UVM_PLA_NOWAKE 0x0020 /* don't wake page daemon on failure */ #define UVM_PLA_USERESERVE 0x0040 /* can allocate from kernel reserve */ @@ -358,6 +357,7 @@ extern const struct kmem_pa_mode kp_zero; extern const struct kmem_pa_mode kp_dma; extern const struct kmem_pa_mode kp_dma_contig; extern const struct kmem_pa_mode kp_dma_zero; +extern const struct kmem_pa_mode kp_mbuf_contig; extern const struct kmem_pa_mode kp_pageable; extern const struct kmem_pa_mode kp_none; @@ -398,8 +398,6 @@ int uvm_pagealloc_multi(struct uvm_object *, voff_t, vsize_t, int); void uvm_pagerealloc(struct vm_page *, struct uvm_object *, voff_t); -int uvm_pagerealloc_multi(struct uvm_object *, voff_t, - vsize_t, int, struct uvm_constraint_range *); /* Actually, uvm_page_physload takes PF#s which need their own type */ void uvm_page_physload(paddr_t, paddr_t, paddr_t, paddr_t, int); diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_page.h b/lib/libc/include/generic-openbsd/uvm/uvm_page.h index 14629231014481b2bffea926ef851dd3865eb1f1..9952b659041182f5bda3f047fa89a851c150f656 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_page.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_page.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.h,v 1.73 2025/03/10 18:54:38 mpi Exp $ */ +/* $OpenBSD: uvm_page.h,v 1.74 2026/07/11 13:13:16 kettenis Exp $ */ /* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */ /* @@ -158,7 +158,7 @@ struct vm_page { #define PQ_AOBJ 0x00200000 /* page is part of an anonymous uvm_object */ #define PQ_SWAPBACKED (PQ_ANON|PQ_AOBJ) -#define PQ_ENCRYPT 0x00400000 /* page needs {en,de}cryption */ +#define PQ_ENCRYPT 0x00400000 /* page needs {en,de}cryption */ #define PQ_MASK 0x00ff0000 #define PG_PMAP0 0x01000000 /* Used by some pmaps. */ diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_pager.h b/lib/libc/include/generic-openbsd/uvm/uvm_pager.h index 1196c6a4ec4d98d5a67e4e91f601c65491d2ccd3..5f92a77b6dc022237b714e6141826961bf723217 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_pager.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_pager.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pager.h,v 1.34 2025/12/18 16:05:18 mpi Exp $ */ +/* $OpenBSD: uvm_pager.h,v 1.35 2026/07/07 17:32:56 kettenis Exp $ */ /* $NetBSD: uvm_pager.h,v 1.20 2000/11/27 08:40:05 chs Exp $ */ /* @@ -130,6 +130,7 @@ vaddr_t uvm_pagermapin(struct vm_page **, int, int); void uvm_pagermapout(vaddr_t, int); struct vm_page **uvm_mk_pcluster(struct uvm_object *, struct vm_page **, int *, struct vm_page *, int, voff_t, voff_t); +int uvm_pseg_reserve_available(void); /* Flags to uvm_pagermapin() */ #define UVMPAGER_MAPIN_WAITOK 0x01 /* it's okay to wait */ diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h b/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h index c34dfba7b2032391940ac0bfaf939130a0988d9c..c7926385cf3a454a458fbf1f8a833d0a5e0d809e 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.h,v 1.20 2026/01/28 21:09:41 deraadt Exp $ */ +/* $OpenBSD: uvm_pmemrange.h,v 1.21 2026/07/24 15:03:50 kettenis Exp $ */ /* * Copyright (c) 2009 Ariane van der Steldt @@ -56,53 +56,6 @@ struct uvm_pmemrange { /* pmr, sorted by address */ }; -/* - * Description of failing memory allocation. - * - * Every descriptor corresponds to a request for the page daemon to release - * pages in a given memory range. There is one global descriptor for nowait - * allocations, all others are sitting on the stack of processes waiting for - * physical pages. - * - * There are multiple ways physical pages can become available: - * [1] unmanaged pages are released by shrinkers (bufbackoff(), drmbackoff()...) - * [2] page daemon drops them (we notice because they are freed) - * [3] a process calls free or exit - * - * The buffer cache and page daemon can decide that they don't have the - * ability to make pages available in the requested range. In that case, - * the FAIL bit will be set. - * XXX There's a possibility that a page is no longer on the queues but - * XXX has not yet been freed, or that a page was busy. - * XXX Also, wired pages are not considered for paging, so they could - * XXX cause a failure that may be recoverable. - * - * Locks used to protect struct members in this file: - * F uvm_lock_fpageq - * I immutable after creation - */ -struct uvm_pmalloc { - TAILQ_ENTRY(uvm_pmalloc) pmq; /* [F] next request */ - struct uvm_constraint_range pm_constraint; /* [I] memory range */ - psize_t pm_size; /* [I] # pages */ - int pm_flags; /* [F] states flags */ -}; - -/* - * Indicate to the page daemon that a nowait call failed and it should - * recover at least some memory in the most restricted region (assumed - * to be dma_constraint). - */ -extern struct uvm_pmalloc nowait_pma; /* [F] */ - - -/* - * uvm_pmalloc flags. - */ -#define UVM_PMA_LINKED 0x01 /* uvm_pmalloc is on list */ -#define UVM_PMA_FAIL 0x10 /* page daemon cannot free pages */ -#define UVM_PMA_FREED 0x20 /* at least one page in the range was freed */ - RBT_HEAD(uvm_pmemrange_addr, uvm_pmemrange); TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange); @@ -112,9 +65,6 @@ TAILQ_HEAD(uvm_pmemrange_use, uvm_pmemrange); struct uvm_pmr_control { struct uvm_pmemrange_addr addr; struct uvm_pmemrange_use use; - - /* Only changed while fpageq is locked. */ - TAILQ_HEAD(, uvm_pmalloc) allocs; }; void uvm_pmr_freepages(struct vm_page *, psize_t); diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_swap.h b/lib/libc/include/generic-openbsd/uvm/uvm_swap.h index 1f2600c4a9c86b722d5405a4ac9f790ebd850f83..16a6fefdfa580c814e498f69ec3e99d3f94503e1 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_swap.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_swap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.h,v 1.22 2026/04/11 01:36:23 deraadt Exp $ */ +/* $OpenBSD: uvm_swap.h,v 1.23 2026/07/11 13:13:16 kettenis Exp $ */ /* $NetBSD: uvm_swap.h,v 1.5 2000/01/11 06:57:51 chs Exp $ */ /* @@ -37,7 +37,8 @@ #ifdef _KERNEL -int uvm_swap_dropcluster(struct vm_page **, int, int); +int uvm_swap_dropcluster(struct vm_page **, int, int, + vaddr_t); int uvm_swap_get(struct vm_page *, int, int); int uvm_swap_put(int, struct vm_page **, int, int); int uvm_swap_alloc(int *, boolean_t); @@ -46,12 +47,17 @@ void uvm_swap_markbad(int, int); int uvm_swapisfilled(void); int uvm_swapisfull(void); void uvm_swap_freepages(struct vm_page **, int); +struct swapdev *uvm_swap_getsdp(int); #ifdef HIBERNATE int uvm_hibswap(dev_t, u_long *, u_long *); #endif /* HIBERNATE */ #ifdef UVM_SWAP_ENCRYPT void uvm_swap_initcrypt_all(void); void uvm_swap_finicrypt_all(void); +void uvm_swap_encryptpg(struct swapdev *, caddr_t, caddr_t, + int); +int uvm_swap_decryptpg(struct swapdev *, caddr_t, caddr_t, + int); #endif extern volatile int seb_free; diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_swap_encrypt.h b/lib/libc/include/generic-openbsd/uvm/uvm_swap_encrypt.h index 3b46dfa05b324c725d9d175606202262dab643f0..131ed4d2e16f5a157155cdee406d0caef1fa0279 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_swap_encrypt.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_swap_encrypt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap_encrypt.h,v 1.14 2024/11/07 09:04:55 jsg Exp $ */ +/* $OpenBSD: uvm_swap_encrypt.h,v 1.15 2026/08/13 21:08:17 kettenis Exp $ */ /* * Copyright 1999 Niels Provos @@ -51,6 +51,11 @@ struct swap_key { u_int16_t refcount; /* pages that still need it */ }; +extern int (*swap_key_prepare_fcn)(struct swap_key *, int); +extern void (*swap_key_cleanup_fcn)(void); +extern void (*swap_encrypt_fcn)(caddr_t, caddr_t, u_int64_t, size_t); +extern void (*swap_decrypt_fcn)(caddr_t, caddr_t, u_int64_t, size_t); + int swap_encrypt_ctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *); diff --git a/lib/libc/include/mips64-openbsd-none/machine/_float.h b/lib/libc/include/mips64-openbsd-none/machine/_float.h new file mode 100644 index 0000000000000000000000000000000000000000..6c9717939fcba76197bbb74f2517fbf45ecfe782 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/_float.h @@ -0,0 +1,3 @@ +/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ + +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/cdefs.h b/lib/libc/include/mips64-openbsd-none/machine/cdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..e44353fedfe1e56cc82b7f74e8e03f3753c98167 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/cdefs.h @@ -0,0 +1,3 @@ +/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */ +/* public domain */ +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/disklabel.h b/lib/libc/include/mips64-openbsd-none/machine/disklabel.h new file mode 100644 index 0000000000000000000000000000000000000000..e7758205f60b4f71e05e646714431838d70a82a1 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/disklabel.h @@ -0,0 +1,16 @@ +/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */ +/* public domain */ + +/* + * Standard MBR partition scheme, with the label in the second sector + * of the OpenBSD partition. + */ + +#ifndef _MACHINE_DISKLABEL_H_ +#define _MACHINE_DISKLABEL_H_ + +#define LABELSECTOR 1 /* sector containing label */ +#define LABELOFFSET 0 /* offset of label in sector */ +#define MAXPARTITIONS 16 /* number of partitions */ + +#endif /* _MACHINE_DISKLABEL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/fenv.h b/lib/libc/include/mips64-openbsd-none/machine/fenv.h new file mode 100644 index 0000000000000000000000000000000000000000..08e89fbf323e30d7c88ccce0eb090e4c2cfa5f30 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ +/* public domain */ +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/loadfile_machdep.h b/lib/libc/include/mips64-openbsd-none/machine/loadfile_machdep.h new file mode 100644 index 0000000000000000000000000000000000000000..1486f8ce5c754fca11c37ce27e90e32eeb9a6f9c --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/loadfile_machdep.h @@ -0,0 +1,49 @@ +/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */ +/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define BOOT_ELF +#define ELFSIZE 64 + +#define LOAD_KERNEL LOAD_ALL +#define COUNT_KERNEL COUNT_ALL + +#define LOADADDR(a) (((u_long)(a)) + offset) +#define ALIGNENTRY(a) ((u_long)(a)) +#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) +#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) +#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) +#define WARN(a) (void)(printf a, \ + printf((errno ? ": %s\n" : "\n"), \ + strerror(errno))) +#define PROGRESS(a) (void) printf a +#define ALLOC(a) alloc(a) +#define FREE(a, b) free(a, b) \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h b/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h index 14faf6c185d4774e1375b1e04165437d0e9c297b..482ffa78db08f91d624afbf750e25be29bfa3bba 100644 --- a/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h +++ b/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.56 2026/07/13 13:41:25 kirill Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -96,7 +96,7 @@ struct octeon_config { #define OCTEON_POOL_NELEMS_PKT 4096 #define OCTEON_POOL_NELEMS_WQE 4096 -#define OCTEON_POOL_NELEMS_CMD 32 +#define OCTEON_POOL_NELEMS_CMD 256 #define OCTEON_POOL_NELEMS_SG 4096 #define OCTEON_POOL_NELEMS_XXX_4 0 #define OCTEON_POOL_NELEMS_XXX_5 0 diff --git a/lib/libc/include/mips64-openbsd-none/machine/reloc.h b/lib/libc/include/mips64-openbsd-none/machine/reloc.h new file mode 100644 index 0000000000000000000000000000000000000000..4eb8c01cf15e7d068665c757f2cdb4ca3b1c79ec --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/reloc.h @@ -0,0 +1,5 @@ +/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */ + +/* public domain */ + +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/machine/tcb.h b/lib/libc/include/mips64-openbsd-none/machine/tcb.h new file mode 100644 index 0000000000000000000000000000000000000000..427e19101a005a0836cad7a09118435406234f8d --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/machine/tcb.h @@ -0,0 +1,3 @@ +/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ +/* public domain */ +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/_float.h b/lib/libc/include/mips64-openbsd-none/mips64/_float.h new file mode 100644 index 0000000000000000000000000000000000000000..4bb91f4f9e682dbee56ebd4965149e339fc2aeb9 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/_float.h @@ -0,0 +1,71 @@ +/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _MACHINE__FLOAT_H_ +#define _MACHINE__FLOAT_H_ + +#define __FLT_RADIX 2 /* b */ +#define __FLT_ROUNDS __flt_rounds() +#define __FLT_EVAL_METHOD 0 /* no promotions */ + +#define __FLT_MANT_DIG 24 /* p */ +#define __FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ +#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define __FLT_MIN_EXP (-125) /* emin */ +#define __FLT_MIN 1.17549435E-38F /* b**(emin-1) */ +#define __FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ +#define __FLT_MAX_EXP 128 /* emax */ +#define __FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ +#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ + +#define __DBL_MANT_DIG 53 +#define __DBL_EPSILON 2.2204460492503131E-16 +#define __DBL_DIG 15 +#define __DBL_MIN_EXP (-1021) +#define __DBL_MIN 2.2250738585072014E-308 +#define __DBL_MIN_10_EXP (-307) +#define __DBL_MAX_EXP 1024 +#define __DBL_MAX 1.7976931348623157E+308 +#define __DBL_MAX_10_EXP 308 + +#define __LDBL_MANT_DIG 113 +#define __LDBL_EPSILON 1.92592994438723585305597794258492732e-34L +#define __LDBL_DIG 33 +#define __LDBL_MIN_EXP (-16381) +#define __LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define __LDBL_MIN_10_EXP (-4931) +#define __LDBL_MAX_EXP 16384 +#define __LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define __LDBL_MAX_10_EXP 4932 + +#define __DECIMAL_DIG 36 + +#endif /* _MACHINE__FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/_types.h b/lib/libc/include/mips64-openbsd-none/mips64/_types.h new file mode 100644 index 0000000000000000000000000000000000000000..261df280d0f0e67255ca1bdb05b98bc91c0d8012 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/_types.h @@ -0,0 +1,150 @@ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _MIPS64__TYPES_H_ +#define _MIPS64__TYPES_H_ + +/* + * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned + * value for all data types (int, long, ...). The result is an + * unsigned long and must be cast to any desired pointer type. + * + * _ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define _ALIGNBYTES 7 +#define _STACKALIGNBYTES 15 +#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0) +#define _MAX_PAGE_SHIFT 14 /* maximum possible PAGE_SHIFT */ + +/* + * We need to handle the various ISA levels for sizes. + */ +#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */ +#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */ +#define _MIPS_ISA_MIPS3 3 /* R4000 */ +#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */ +#define _MIPS_ISA_MIPS32 32 /* MIPS32 */ +#define _MIPS_ISA_MIPS64 64 /* MIPS64 */ + +/* 7.18.1.1 Exact-width integer types */ +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +/* 7.18.1.2 Minimum-width integer types */ +typedef __int8_t __int_least8_t; +typedef __uint8_t __uint_least8_t; +typedef __int16_t __int_least16_t; +typedef __uint16_t __uint_least16_t; +typedef __int32_t __int_least32_t; +typedef __uint32_t __uint_least32_t; +typedef __int64_t __int_least64_t; +typedef __uint64_t __uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types */ +typedef __int32_t __int_fast8_t; +typedef __uint32_t __uint_fast8_t; +typedef __int32_t __int_fast16_t; +typedef __uint32_t __uint_fast16_t; +typedef __int32_t __int_fast32_t; +typedef __uint32_t __uint_fast32_t; +typedef __int64_t __int_fast64_t; +typedef __uint64_t __uint_fast64_t; +#define __INT_FAST8_MIN INT32_MIN +#define __INT_FAST16_MIN INT32_MIN +#define __INT_FAST32_MIN INT32_MIN +#define __INT_FAST64_MIN INT64_MIN +#define __INT_FAST8_MAX INT32_MAX +#define __INT_FAST16_MAX INT32_MAX +#define __INT_FAST32_MAX INT32_MAX +#define __INT_FAST64_MAX INT64_MAX +#define __UINT_FAST8_MAX UINT32_MAX +#define __UINT_FAST16_MAX UINT32_MAX +#define __UINT_FAST32_MAX UINT32_MAX +#define __UINT_FAST64_MAX UINT64_MAX + +/* 7.18.1.4 Integer types capable of holding object pointers */ +typedef long __intptr_t; +typedef unsigned long __uintptr_t; + +/* 7.18.1.5 Greatest-width integer types */ +typedef __int64_t __intmax_t; +typedef __uint64_t __uintmax_t; + +/* Register size */ +typedef long __register_t; +typedef long f_register_t; /* XXX */ + +/* VM system types */ +typedef unsigned long __vaddr_t; +typedef unsigned long __paddr_t; +typedef unsigned long __vsize_t; +typedef unsigned long __psize_t; + +/* Standard system types */ +typedef double __double_t; +typedef float __float_t; +typedef long __ptrdiff_t; +typedef unsigned long __size_t; +typedef long __ssize_t; +typedef __builtin_va_list __va_list; + +/* Wide character support types */ +#ifndef __cplusplus +typedef int __wchar_t; +#endif +typedef int __wint_t; +typedef int __rune_t; +typedef void * __wctrans_t; +typedef void * __wctype_t; + +#if defined(_KERNEL) +typedef struct label_t { + long val[14]; +} label_t; +#endif + +/* Feature test macros */ +#define __HAVE_EXEC_MD_MAP + +#endif /* _MIPS64__TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/archtype.h b/lib/libc/include/mips64-openbsd-none/mips64/archtype.h new file mode 100644 index 0000000000000000000000000000000000000000..7ab1da2012ed89195eeb823049f3d5286d239fba --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/archtype.h @@ -0,0 +1,77 @@ +/* $OpenBSD: archtype.h,v 1.16 2012/10/03 21:44:51 miod Exp $ */ +/* + * Copyright (c) 1997-2004 Opsycon AB, Sweden (www.opsycon.se) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_ARCHTYPE_H_ +#define _MIPS64_ARCHTYPE_H_ +/* + * Define architectural identities for the different Mips machines. + */ +#define ACER_PICA_61 0x0001 /* Acer Labs Pica 61 */ +#define MAGNUM 0x0002 /* Mips MAGNUM R4000 */ +#define DESKSTATION_RPC44 0x0003 /* Deskstation rPC44 */ +#define DESKSTATION_TYNE 0x0004 /* Deskstation Tyne */ +#define NKK_AQUARIUS 0x0005 /* NKK R4{67}00 PC */ +#define NEC_R94 0x0006 /* NEC Magnum class */ +#define SNI_RM200 0x0007 /* Siemens Nixdorf RM200 */ + +#define SGI_IP17 0x0011 /* Crimson */ +#define SGI_IP19 0x0012 /* Onyx (!S model Challenge) */ +#define SGI_IP20 0x0013 /* Indigo */ +#define SGI_IP21 0x0014 /* POWER Challenge, POWER Onyx */ +#define SGI_IP22 0x0015 /* Indy, Indigo2, Challenge S */ +#define SGI_IP25 0x0016 /* POWER Challenge R10k */ +#define SGI_IP26 0x0017 /* POWER Indigo2 R8k */ +#define SGI_IP27 0x0018 /* IP27 Origin200/2000 */ +#define SGI_IP28 0x0019 /* POWER Indigo2 R10k */ +#define SGI_OCTANE 0x001a /* IP30 Octane */ +#define SGI_O2 0x001b /* IP32 O2 */ +#define SGI_IP35 0x001c /* IP35 Origin3x0/3x00/Fuel/Tezro */ + +#define ALGOR_P4032 0x0021 /* ALGORITHMICS P-4032 */ +#define ALGOR_P5064 0x0022 /* ALGORITHMICS P-5064 */ + +#define GALILEO_G9 0x0031 /* Galileo GT-64011 Eval board */ +#define GALILEO_EV64240 0x0032 /* Galileo EV64240 Eval board */ +#define GALILEO_EV64340 0x0033 /* Galileo EV64340 Eval board */ + +#define MOMENTUM_CP7000 0x0041 /* Momentum Ocelot */ +#define MOMENTUM_CP7000G 0x0042 /* Momentum Ocelot-G */ +#define MOMENTUM_JAGUAR 0x0043 /* Momentum Jaguar ATX */ + +#define WG4308 0x0052 /* Willowglen 4308 LMD */ +#define WG4309 0x0053 /* Willowglen 4309 LMD */ +#define WG4409 0x0054 /* Willowglen 4409 LMD */ +#define WG8138 0x0055 /* Willowglen 8138 523x VME card */ +#define WG8168 0x0056 /* Willowglen 8168 5231 VME card */ +#define WG6000 0x0057 /* Willowglen CPU-6000 */ +#define WG7000 0x0058 /* Willowglen CPU-7000 */ +#define WG8200 0x0059 /* Willowglen CPU-8200 */ +#define WG8232 0x005a /* Willowglen CPU-8232 */ + +#define LAGUNA 0x00f1 /* Heurikon Laguna VME board */ + +#endif /* !_MIPS64_ARCHTYPE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/asm.h b/lib/libc/include/mips64-openbsd-none/mips64/asm.h new file mode 100644 index 0000000000000000000000000000000000000000..8bc75825519e63bb49863bcc63a1d499e8b44a89 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/asm.h @@ -0,0 +1,360 @@ +/* $OpenBSD: asm.h,v 1.27 2021/05/01 16:11:10 visa Exp $ */ + +/* + * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#ifndef _MIPS64_ASM_H_ +#define _MIPS64_ASM_H_ + +#include + +#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */ +#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */ +#define _MIPS_ISA_MIPS3 3 /* R4000 */ +#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */ +#define _MIPS_ISA_MIPS32 32 /* MIPS32 */ +#define _MIPS_ISA_MIPS64 64 /* MIPS64 */ + +#if !defined(ABICALLS) && !defined(_NO_ABICALLS) +#define ABICALLS .abicalls +#endif + +#if defined(ABICALLS) && !defined(_KERNEL) + ABICALLS +#endif + +#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */ + +#if !defined(__MIPSEL__) && !defined(__MIPSEB__) +#error "__MIPSEL__ or __MIPSEB__ must be defined" +#endif +/* + * Define how to access unaligned data word + */ +#if defined(__MIPSEL__) +#define LWLO lwl +#define LWHI lwr +#define SWLO swl +#define SWHI swr +#define LDLO ldl +#define LDHI ldr +#define SDLO sdl +#define SDHI sdr +#endif +#if defined(__MIPSEB__) +#define LWLO lwr +#define LWHI lwl +#define SWLO swr +#define SWHI swl +#define LDLO ldr +#define LDHI ldl +#define SDLO sdr +#define SDHI sdl +#endif + +/* + * Define programming environment for ABI. + */ +#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE) + +#ifndef _MIPS_SIM +#define _MIPS_SIM 1 +#define _ABIO32 1 +#endif +#ifndef _MIPS_ISA +#define _MIPS_ISA 2 +#define _MIPS_ISA_MIPS2 2 +#endif + +#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32) +#define NARGSAVE 4 + +#define SETUP_GP \ + .set noreorder; \ + .cpload t9; \ + .set reorder; + +#define SAVE_GP(x) \ + .cprestore x + +#define SETUP_GP64(gpoff, name) +#define RESTORE_GP64 +#endif + +#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32) +#define NARGSAVE 0 + +#define SETUP_GP +#define SAVE_GP(x) +#define SETUP_GP64(gpoff, name) \ + .cpsetup t9, gpoff, name +#define RESTORE_GP64 \ + .cpreturn +#endif + +#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31)) + +#else /* defined(ABICALLS) && !defined(_KERNEL) */ + +#define NARGSAVE 4 +#define SETUP_GP +#define SAVE_GP(x) + +#define ALIGNSZ 16 /* Stack layout alignment */ +#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1)) + +#endif + +/* + * Basic register operations based on selected ISA + */ +#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \ + _MIPS_ISA == _MIPS_ISA_MIPS32) +#define REGSZ 4 /* 32 bit mode register size */ +#define LOGREGSZ 2 /* log rsize */ +#define REG_S sw +#define REG_L lw +#define CF_SZ 24 /* Call frame size */ +#define CF_ARGSZ 16 /* Call frame arg size */ +#define CF_RA_OFFS 20 /* Call ra save offset */ +#endif + +#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \ + _MIPS_ISA == _MIPS_ISA_MIPS64) +#define REGSZ 8 /* 64 bit mode register size */ +#define LOGREGSZ 3 /* log rsize */ +#define REG_S sd +#define REG_L ld +#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */ +#define CF_ARGSZ 32 /* Call frame arg size */ +#define CF_RA_OFFS 40 /* Call ra save offset */ +#endif + +#ifndef __LP64__ +#define PTR_L lw +#define PTR_S sw +#define PTR_SUB sub +#define PTR_ADD add +#define PTR_SUBU subu +#define PTR_ADDU addu +#define LI li +#define LA la +#define PTR_SLL sll +#define PTR_SRL srl +#define PTR_VAL .word +#else +#define PTR_L ld +#define PTR_S sd +#define PTR_ADD dadd +#define PTR_SUB dsub +#define PTR_SUBU dsubu +#define PTR_ADDU daddu +#define LI dli +#define LA dla +#define PTR_SLL dsll +#define PTR_SRL dsrl +#define PTR_VAL .dword +#endif + +#define NOP nop +#define DMFC0 dmfc0 +#define DMTC0 dmtc0 +#define MFC0 mfc0 +#define MTC0 mtc0 +#define ERET sync; eret + +/* + * Define -pg profile entry code. + */ +#if defined(XGPROF) || defined(XPROF) +#define MCOUNT \ + PTR_SUBU sp, sp, 64; \ + SAVE_GP(16); \ + sd ra, 56(sp); \ + sd gp, 48(sp); \ + .set noat; \ + .set noreorder; \ + move AT, ra; \ + jal _mcount; \ + PTR_SUBU sp, sp, 16; \ + ld ra, 56(sp); \ + PTR_ADDU sp, sp, 64; \ + .set reorder; \ + .set at; +#else +#define MCOUNT +#endif + +/* + * LEAF(x, fsize) + * + * Declare a leaf routine. + */ +#define LEAF(x, fsize) \ + .align 3; \ + .globl x; \ + .ent x, 0; \ +x: ; \ + .frame sp, fsize, ra; \ + SETUP_GP \ + MCOUNT + +#define ALEAF(x) \ + .globl x; \ +x: + +/* + * NLEAF(x) + * + * Declare a non-profiled leaf routine. + */ +#define NLEAF(x, fsize) \ + .align 3; \ + .globl x; \ + .ent x, 0; \ +x: ; \ + .frame sp, fsize, ra; \ + SETUP_GP + +/* + * NON_LEAF(x) + * + * Declare a non-leaf routine (a routine that makes other C calls). + */ +#define NON_LEAF(x, fsize, retpc) \ + .align 3; \ + .globl x; \ + .ent x, 0; \ +x: ; \ + .frame sp, fsize, retpc; \ + SETUP_GP \ + MCOUNT + +/* + * NNON_LEAF(x) + * + * Declare a non-profiled non-leaf routine + * (a routine that makes other C calls). + */ +#define NNON_LEAF(x, fsize, retpc) \ + .align 3; \ + .globl x; \ + .ent x, 0; \ +x: ; \ + .frame sp, fsize, retpc \ + SETUP_GP + +/* + * END(x) + * + * Mark end of a procedure. + */ +#define END(x) \ + .end x + +/* + * STRONG_ALIAS, WEAK_ALIAS + * Create a strong or weak alias. + */ +#define STRONG_ALIAS(alias,sym) \ + .global alias; alias = sym +#define WEAK_ALIAS(alias,sym) \ + .weak alias; alias = sym + + +/* + * Macros to panic and printf from assembly language. + */ +#define PANIC(msg) \ + LA a0, 9f; \ + jal panic; \ + nop ; \ + MSG(msg) + +#define PRINTF(msg) \ + LA a0, 9f; \ + jal printf; \ + nop ; \ + MSG(msg) + +#define MSG(msg) \ + .rdata; \ +9: .asciiz msg; \ + .text + +#define LOAD_XKPHYS(reg, cca) \ + li reg, cca | 0x10; \ + dsll reg, reg, 59 + +#ifdef MULTIPROCESSOR +#define GET_CPU_INFO(ci, tmp) HW_GET_CPU_INFO(ci, tmp) +#else /* MULTIPROCESSOR */ +#define GET_CPU_INFO(ci, tmp) \ + LA ci, cpu_info_primary +#endif /* MULTIPROCESSOR */ + +/* + * Hazards + */ + +#ifdef CPU_OCTEON +/* + * OCTEON clears hazards in hardware. + */ +#define MFC0_HAZARD /* nothing */ +#define MTC0_HAZARD /* nothing */ +#define MTC0_SR_IE_HAZARD /* nothing */ +#define MTC0_SR_CU_HAZARD /* nothing */ +#define TLB_HAZARD /* nothing */ +#endif + +/* Hazard between {d,}mfc0 of COP_0_VADDR */ +#ifndef PRE_MFC0_ADDR_HAZARD +#define PRE_MFC0_ADDR_HAZARD /* nothing */ +#endif + +/* Hazard after {d,}mfc0 from any register */ +#ifndef MFC0_HAZARD +#define MFC0_HAZARD /* nothing */ +#endif +/* Hazard after {d,}mtc0 to any register */ +#ifndef MTC0_HAZARD +#define MTC0_HAZARD NOP; NOP; NOP; NOP +#endif +/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of interrupts */ +#ifndef MTC0_SR_IE_HAZARD +#define MTC0_SR_IE_HAZARD MTC0_HAZARD +#endif +/* Hazard after {d,}mtc0 to COP_0_SR affecting the state of coprocessors */ +#ifndef MTC0_SR_CU_HAZARD +#define MTC0_SR_CU_HAZARD NOP; NOP +#endif + +/* Hazard before and after a tlbp, tlbr, tlbwi or tlbwr instruction */ +#ifndef TLB_HAZARD +#define TLB_HAZARD NOP; NOP +#endif + +#endif /* !_MIPS64_ASM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/atomic.h b/lib/libc/include/mips64-openbsd-none/mips64/atomic.h new file mode 100644 index 0000000000000000000000000000000000000000..a5b8737ccb0111be9a1994f40d3d43198ed75a1f --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/atomic.h @@ -0,0 +1,214 @@ +/* $OpenBSD: atomic.h,v 1.12 2019/10/28 09:41:37 visa Exp $ */ + +/* Public Domain */ + +#ifndef _MIPS64_ATOMIC_H_ +#define _MIPS64_ATOMIC_H_ + +#if defined(_KERNEL) + +/* wait until the bits to set are clear, and set them */ +static __inline void +atomic_wait_and_setbits_int(volatile unsigned int *uip, unsigned int v) +{ + unsigned int tmp0, tmp1; + + __asm__ volatile ( + "1: ll %0, 0(%2)\n" + " and %1, %0, %3\n" + " bnez %1, 1b\n" + " or %0, %3, %0\n" + " sc %0, 0(%2)\n" + " beqz %0, 1b\n" + " nop\n" : + "=&r"(tmp0), "=&r"(tmp1) : + "r"(uip), "r"(v) : "memory"); +} + +static __inline void +atomic_setbits_int(volatile unsigned int *uip, unsigned int v) +{ + unsigned int tmp; + + __asm__ volatile ( + "1: ll %0, 0(%1)\n" + " or %0, %2, %0\n" + " sc %0, 0(%1)\n" + " beqz %0, 1b\n" + " nop\n" : + "=&r"(tmp) : + "r"(uip), "r"(v) : "memory"); +} + +static __inline void +atomic_clearbits_int(volatile unsigned int *uip, unsigned int v) +{ + unsigned int tmp; + + __asm__ volatile ( + "1: ll %0, 0(%1)\n" + " and %0, %2, %0\n" + " sc %0, 0(%1)\n" + " beqz %0, 1b\n" + " nop\n" : + "=&r"(tmp) : + "r"(uip), "r"(~v) : "memory"); +} + +#endif /* defined(_KERNEL) */ + +static inline unsigned int +_atomic_cas_uint(volatile unsigned int *p, unsigned int o, unsigned int n) +{ + unsigned int rv, wv; + + __asm__ volatile ( + "1: ll %0, %1\n" + " bne %0, %4, 2f\n" + " move %2, %3\n" + " sc %2, %1\n" + " beqz %2, 1b\n" + "2: nop\n" + : "=&r" (rv), "+m" (*p), "=&r" (wv) + : "r" (n), "Ir" (o)); + + return (rv); +} +#define atomic_cas_uint(_p, _o, _n) _atomic_cas_uint((_p), (_o), (_n)) + +static inline unsigned long +_atomic_cas_ulong(volatile unsigned long *p, unsigned long o, unsigned long n) +{ + unsigned long rv, wv; + + __asm__ volatile ( + "1: lld %0, %1\n" + " bne %0, %4, 2f\n" + " move %2, %3\n" + " scd %2, %1\n" + " beqz %2, 1b\n" + "2: nop\n" + : "=&r" (rv), "+m" (*p), "=&r" (wv) + : "r" (n), "Ir" (o)); + + return (rv); +} +#define atomic_cas_ulong(_p, _o, _n) _atomic_cas_ulong((_p), (_o), (_n)) + +static inline void * +_atomic_cas_ptr(volatile void *pp, void *o, void *n) +{ + void * volatile *p = pp; + void *rv, *wv; + + __asm__ volatile ( + "1: lld %0, %1\n" + " bne %0, %4, 2f\n" + " move %2, %3\n" + " scd %2, %1\n" + " beqz %2, 1b\n" + "2: nop\n" + : "=&r" (rv), "+m" (*p), "=&r" (wv) + : "r" (n), "Ir" (o)); + + return (rv); +} +#define atomic_cas_ptr(_p, _o, _n) _atomic_cas_ptr((_p), (_o), (_n)) + + + +static inline unsigned int +_atomic_swap_uint(volatile unsigned int *uip, unsigned int v) +{ + unsigned int o, t; + + __asm__ volatile ( + "1: ll %0, %1\n" + " move %2, %3\n" + " sc %2, %1\n" + " beqz %2, 1b\n" + " nop\n" + : "=&r" (o), "+m" (*uip), "=&r" (t) + : "r" (v)); + + return (o); +} +#define atomic_swap_uint(_p, _v) _atomic_swap_uint((_p), (_v)) + +static inline unsigned long +_atomic_swap_ulong(volatile unsigned long *uip, unsigned long v) +{ + unsigned long o, t; + + __asm__ volatile ( + "1: lld %0, %1\n" + " move %2, %3\n" + " scd %2, %1\n" + " beqz %2, 1b\n" + " nop\n" + : "=&r" (o), "+m" (*uip), "=&r" (t) + : "r" (v)); + + return (o); +} +#define atomic_swap_ulong(_p, _v) _atomic_swap_ulong((_p), (_v)) + + +static inline void * +_atomic_swap_ptr(volatile void *uipp, void *n) +{ + void * volatile *uip = uipp; + void *o, *t; + + __asm__ volatile ( + "1: lld %0, %1\n" + " move %2, %3\n" + " scd %2, %1\n" + " beqz %2, 1b\n" + " nop\n" + : "=&r" (o), "+m" (*uip), "=&r" (t) + : "r" (n)); + + return (o); +} +#define atomic_swap_ptr(_p, _n) _atomic_swap_ptr((_p), (_n)) + +static inline unsigned int +_atomic_add_int_nv(volatile unsigned int *uip, unsigned int v) +{ + unsigned int rv, nv; + + __asm__ volatile ( + "1: ll %0, %1\n" + " addu %2, %0, %3\n" + " sc %2, %1\n" + " beqz %2, 1b\n" + " nop\n" + : "=&r" (rv), "+m" (*uip), "=&r" (nv) + : "Ir" (v)); + + return (rv + v); +} +#define atomic_add_int_nv(_uip, _v) _atomic_add_int_nv((_uip), (_v)) +#define atomic_sub_int_nv(_uip, _v) _atomic_add_int_nv((_uip), 0 - (_v)) + +static inline unsigned long +_atomic_add_long_nv(volatile unsigned long *uip, unsigned long v) +{ + unsigned long rv, nv; + + __asm__ volatile ( + "1: lld %0, %1\n" + " daddu %2, %0, %3\n" + " scd %2, %1\n" + " beqz %2, 1b\n" + " nop\n" + : "=&r" (rv), "+m" (*uip), "=&r" (nv) + : "Ir" (v)); + + return (rv + v); +} +#define atomic_add_long_nv(_uip, _v) _atomic_add_long_nv((_uip), (_v)) +#define atomic_sub_long_nv(_uip, _v) _atomic_add_long_nv((_uip), 0UL - (_v)) + +#endif /* _MIPS64_ATOMIC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/autoconf.h b/lib/libc/include/mips64-openbsd-none/mips64/autoconf.h new file mode 100644 index 0000000000000000000000000000000000000000..8a518cca7fc89a9fe2b466133ef20027f5a3ccc6 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/autoconf.h @@ -0,0 +1,37 @@ +/* $OpenBSD: autoconf.h,v 1.2 2017/06/08 12:02:52 visa Exp $ */ + +/* + * Copyright (c) 2010 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Common defines used by autoconf on all mips64-based platforms. + */ + +#ifndef _MIPS64_AUTOCONF_H_ +#define _MIPS64_AUTOCONF_H_ + +#include /* for struct cpu_hwinfo */ + +struct cpu_attach_args { + struct mainbus_attach_args caa_maa; + struct cpu_hwinfo *caa_hw; +}; + +extern struct cpu_hwinfo bootcpu_hwinfo; + +void unmap_startup(void); + +#endif /* _MIPS64_AUTOCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/cache.h b/lib/libc/include/mips64-openbsd-none/mips64/cache.h new file mode 100644 index 0000000000000000000000000000000000000000..0f7ba849452b50e9d3b4dcd8e4482ebc57a83187 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/cache.h @@ -0,0 +1,107 @@ +/* $OpenBSD: cache.h,v 1.9 2016/12/21 13:59:57 visa Exp $ */ + +/* + * Copyright (c) 2012 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_CACHE_H_ +#define _MIPS64_CACHE_H_ + +/* + * Declare canonical cache functions for a given processor. + * + * The following assumptions are made: + * - only L1 has split instruction and data caches. + * - L1 I$ is virtually indexed. + * + * Processor-specific routines will make extra assumptions. + */ + +#define CACHE_PROTOS(chip) \ +/* Figure out cache configuration */ \ +void chip##_ConfigCache(struct cpu_info *); \ +/* Writeback and invalidate all caches */ \ +void chip##_SyncCache(struct cpu_info *); \ +/* Invalidate all I$ for the given range */ \ +void chip##_InvalidateICache(struct cpu_info *, vaddr_t, size_t); \ +/* Register a given page for I$ invalidation */ \ +void chip##_InvalidateICachePage(struct cpu_info *, vaddr_t); \ +/* Perform postponed I$ invalidation */ \ +void chip##_SyncICache(struct cpu_info *); \ +/* Writeback all D$ for the given page */ \ +void chip##_SyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \ +/* Writeback all D$ for the (currently mapped) given page */ \ +void chip##_HitSyncDCachePage(struct cpu_info *, vaddr_t, paddr_t); \ +/* Writeback all D$ for the given range */ \ +void chip##_HitSyncDCache(struct cpu_info *, vaddr_t, size_t); \ +/* Invalidate all D$ for the given range */ \ +void chip##_HitInvalidateDCache(struct cpu_info *, vaddr_t, size_t); \ +/* Enforce coherency of the given range */ \ +void chip##_IOSyncDCache(struct cpu_info *, vaddr_t, size_t, int); + +/* + * Cavium Octeon. + */ +CACHE_PROTOS(Octeon) + +void Octeon_lock_secondary_cache(struct cpu_info *, paddr_t, size_t); +void Octeon_unlock_secondary_cache(struct cpu_info *, paddr_t, size_t); + +/* + * STC Loongson 2E and 2F. + */ +CACHE_PROTOS(Loongson2) + +/* + * Loongson 3A and 2Gq. + */ +CACHE_PROTOS(Loongson3) + +/* + * MIPS R4000 and R4400. + */ +CACHE_PROTOS(Mips4k) + +/* + * IDT/QED/PMC-Sierra R4600, R4700, R5000, RM52xx, RM7xxx, RM9xxx. + */ +CACHE_PROTOS(Mips5k) + +/* + * MIPS (SGI, really) R8000. + */ +CACHE_PROTOS(tfp) + +/* + * MIPS/NEC R10000/R120000/R140000/R16000. + */ +CACHE_PROTOS(Mips10k) + +/* + * mips64r2-compliant processors. + */ +CACHE_PROTOS(mips64r2) + +/* + * Values used by the IOSyncDCache routine [which acts as the backend of + * bus_dmamap_sync()]. + */ +#define CACHE_SYNC_R 0 /* WB invalidate, WT invalidate */ +#define CACHE_SYNC_W 1 /* WB writeback, WT unaffected */ +#define CACHE_SYNC_X 2 /* WB writeback + invalidate, WT invalidate */ + +extern vaddr_t cache_valias_mask; + +#endif /* _MIPS64_CACHE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/cdefs.h b/lib/libc/include/mips64-openbsd-none/mips64/cdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..685c9d51d52f339806784b95306169535be7e0d0 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/cdefs.h @@ -0,0 +1,43 @@ +/* $OpenBSD: cdefs.h,v 1.6 2013/03/28 17:30:45 martynas Exp $ */ + +/* + * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_CDEFS_H_ +#define _MIPS64_CDEFS_H_ + +#define __strong_alias(alias,sym) \ + __asm__(".global " __STRING(alias) " ; " \ + __STRING(alias) " = " __STRING(sym)) +#define __weak_alias(alias,sym) \ + __asm__(".weak " __STRING(alias) " ; " \ + __STRING(alias) " = " __STRING(sym)) +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning." __STRING(sym) \ + " ; .ascii \"" msg "\" ; .text") +#define __indr_references(sym,msg) /* nothing */ + +#endif /* !_MIPS64_CDEFS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/cpu.h b/lib/libc/include/mips64-openbsd-none/mips64/cpu.h new file mode 100644 index 0000000000000000000000000000000000000000..20177a2555480a354df28fb1aa2e5b1fe907710b --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/cpu.h @@ -0,0 +1,552 @@ +/* $OpenBSD: cpu.h,v 1.151 2025/06/06 00:07:58 deraadt Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell and Rick Macklem. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Copyright (C) 1989 Digital Equipment Corporation. + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies. + * Digital Equipment Corporation makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 + */ + +#ifndef _MIPS64_CPU_H_ +#define _MIPS64_CPU_H_ + +#ifndef _LOCORE + +/* + * MIPS32-style segment definitions. + * They only cover the first 512MB of physical addresses. + */ +#define CKSEG0_BASE 0xffffffff80000000UL +#define CKSEG1_BASE 0xffffffffa0000000UL +#define CKSSEG_BASE 0xffffffffc0000000UL +#define CKSEG3_BASE 0xffffffffe0000000UL +#define CKSEG_SIZE 0x0000000020000000UL + +#define CKSEG0_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1)) +#define CKSEG1_TO_PHYS(x) ((u_long)(x) & (CKSEG_SIZE - 1)) +#define PHYS_TO_CKSEG0(x) ((u_long)(x) | CKSEG0_BASE) +#define PHYS_TO_CKSEG1(x) ((u_long)(x) | CKSEG1_BASE) + +/* + * MIPS64-style segment definitions. + * These allow for 36 bits of addressable physical memory, thus 64GB. + */ + +/* + * Cache Coherency Attributes. + */ +/* r8k only */ +#define CCA_NC_COPROCESSOR 0UL /* uncached, coprocessor ordered */ +/* common to r4, r5k, r8k and r1xk */ +#define CCA_NC 2UL /* uncached, write-around */ +#define CCA_NONCOHERENT 3UL /* cached, non-coherent, write-back */ +/* r8k, r1xk only */ +#define CCA_COHERENT_EXCL 4UL /* cached, coherent, exclusive */ +#define CCA_COHERENT_EXCLWRITE 5UL /* cached, coherent, exclusive write */ +/* r4k only */ +#define CCA_COHERENT_UPDWRITE 6UL /* cached, coherent, update on write */ +/* r1xk only */ +#define CCA_NC_ACCELERATED 7UL /* uncached accelerated */ + +#ifdef TGT_COHERENT +#define CCA_CACHED CCA_COHERENT_EXCLWRITE +#else +#define CCA_CACHED CCA_NONCOHERENT +#endif + +#define XKSSSEG_BASE 0x4000000000000000UL +#define XKPHYS_BASE 0x8000000000000000UL +#define XKSSEG_BASE 0xc000000000000000UL + +#define XKPHYS_TO_PHYS(x) ((paddr_t)(x) & 0x0000000fffffffffUL) +#define PHYS_TO_XKPHYS(x,c) ((paddr_t)(x) | XKPHYS_BASE | ((c) << 59)) +#define IS_XKPHYS(va) (((va) >> 62) == 2) +#define XKPHYS_TO_CCA(x) (((x) >> 59) & 0x07) + +#endif /* _LOCORE */ + +/* + * Exported definitions unique to mips cpu support. + */ + +#if defined(_KERNEL) && !defined(_LOCORE) + +#include +#include +#include +#include +#include +#include + +struct cpu_hwinfo { + uint32_t c0prid; + uint32_t c1prid; + uint32_t clock; /* Hz */ + uint32_t tlbsize; + uint type; + uint32_t l2size; +}; + +/* + * Cache memory configuration. One struct per cache. + */ +struct cache_info { + uint size; /* total cache size */ + uint linesize; /* line size */ + uint setsize; /* set size */ + uint sets; /* number of sets */ +}; + +struct cpu_info { + struct device *ci_dev; /* our device */ + struct cpu_info *ci_self; /* pointer to this structure */ + struct cpu_info *ci_next; /* next cpu */ + struct proc *ci_curproc; + struct user *ci_curprocpaddr; + struct proc *ci_fpuproc; /* pointer to last proc to use FP */ + uint32_t ci_delayconst; + struct cpu_hwinfo + ci_hw; + +#if defined(MULTIPROCESSOR) + struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; +#define __HAVE_UVM_PERCPU + struct uvm_pmr_cache ci_uvm; +#endif + + /* cache information and pending flush state */ + uint ci_cacheconfiguration; + uint64_t ci_cachepending_l1i; + struct cache_info + ci_l1inst, + ci_l1data, + ci_l2, + ci_l3; + + /* function pointers for the cache handling routines */ + void (*ci_SyncCache)(struct cpu_info *); + void (*ci_InvalidateICache)(struct cpu_info *, vaddr_t, + size_t); + void (*ci_InvalidateICachePage)(struct cpu_info *, vaddr_t); + void (*ci_SyncICache)(struct cpu_info *); + void (*ci_SyncDCachePage)(struct cpu_info *, vaddr_t, + paddr_t); + void (*ci_HitSyncDCachePage)(struct cpu_info *, vaddr_t, + paddr_t); + void (*ci_HitSyncDCache)(struct cpu_info *, vaddr_t, size_t); + void (*ci_HitInvalidateDCache)(struct cpu_info *, vaddr_t, + size_t); + void (*ci_IOSyncDCache)(struct cpu_info *, vaddr_t, size_t, + int); + + struct schedstate_percpu + ci_schedstate; + int ci_want_resched; /* need_resched() invoked */ + cpuid_t ci_cpuid; /* our CPU ID */ + uint32_t ci_randseed; /* per cpu random seed */ + volatile int ci_ipl; /* software IPL */ + uint32_t ci_softpending; /* pending soft interrupts */ + int ci_clock_started; + volatile int ci_clock_deferred; /* clock interrupt postponed */ + struct clockqueue + ci_queue; + + struct pmap *ci_curpmap; + uint ci_idepth; /* interrupt depth */ + volatile u_long ci_flags; /* flags; see below */ + volatile int ci_ddb; +#define CI_DDB_RUNNING 0 +#define CI_DDB_SHOULDSTOP 1 +#define CI_DDB_STOPPED 2 +#define CI_DDB_ENTERDDB 3 +#define CI_DDB_INDDB 4 + +#ifdef DIAGNOSTIC + int ci_mutex_level; +#endif +#ifdef GPROF + struct gmonparam *ci_gmon; + struct clockintr ci_gmonclock; +#endif + char ci_panicbuf[512]; +}; + +#define CPUF_PRIMARY 0x01 /* CPU is primary CPU */ +#define CPUF_PRESENT 0x02 /* CPU is present */ +#define CPUF_RUNNING 0x04 /* CPU is running */ + +extern struct cpu_info cpu_info_primary; +extern struct cpu_info *cpu_info_list; +#define CPU_INFO_ITERATOR int +#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \ + ci != NULL; ci = ci->ci_next) + +#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0) + +#define cpu_idle_enter() do { /* nothing */ } while (0) +#define cpu_idle_leave() do { /* nothing */ } while (0) +extern void (*cpu_idle_cycle_func)(void); +#define cpu_idle_cycle() (*cpu_idle_cycle_func)() + +#ifdef MULTIPROCESSOR +#define getcurcpu() hw_getcurcpu() +#define setcurcpu(ci) hw_setcurcpu(ci) +extern struct cpu_info *get_cpu_info(int); +#define curcpu() getcurcpu() +#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) +#define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING) +#define cpu_number() (curcpu()->ci_cpuid) + +void cpu_unidle(struct cpu_info *); +void cpu_boot_secondary_processors(void); +#define cpu_boot_secondary(ci) hw_cpu_boot_secondary(ci) +#define cpu_hatch(ci) hw_cpu_hatch(ci) + +vaddr_t alloc_contiguous_pages(size_t); + +#define MIPS64_IPI_NOP 0x00000001 +#define MIPS64_IPI_RENDEZVOUS 0x00000002 +#define MIPS64_IPI_DDB 0x00000004 +#define MIPS64_NIPIS 3 /* must not exceed 32 */ + +void mips64_ipi_init(void); +void mips64_send_ipi(unsigned int, unsigned int); +void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg); + +#include +#else +#define MAXCPUS 1 +#define curcpu() (&cpu_info_primary) +#define CPU_IS_PRIMARY(ci) 1 +#define CPU_IS_RUNNING(ci) 1 +#define cpu_number() 0UL +#define cpu_unidle(ci) +#define get_cpu_info(i) (&cpu_info_primary) +#endif + +#define CPU_BUSY_CYCLE() __asm volatile ("" ::: "memory") + +extern void (*md_initclock)(void); +extern void (*md_startclock)(struct cpu_info *); +extern void (*md_triggerclock)(void); +void cp0_calibrate(struct cpu_info *); + +unsigned int cpu_rnd_messybits(void); + +#include + +/* + * Arguments to hardclock encapsulate the previous machine state in + * an opaque clockframe. + */ +#define clockframe trapframe /* Use normal trap frame */ + +#define SR_KSU_USER 0x00000010 +#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER) +#define CLKF_PC(framep) ((framep)->pc) +#define CLKF_INTR(framep) (curcpu()->ci_idepth > 1) /* XXX */ + +/* + * This is used during profiling to integrate system time. + */ +#define PROC_PC(p) ((p)->p_md.md_regs->pc) +#define PROC_STACK(p) ((p)->p_md.md_regs->sp) + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +void need_resched(struct cpu_info *); +#define clear_resched(ci) (ci)->ci_want_resched = 0 + +/* + * Give a profiling tick to the current process when the user profiling + * buffer pages are invalid. On MIPS designs, request an ast to send us + * through trap, marking the proc as needing a profiling tick. + */ +#define need_proftick(p) aston(p) + +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +void signotify(struct proc *); + +#define aston(p) ((p)->p_md.md_astpending = 1) + +#define mips_sync() __asm__ volatile ("sync" ::: "memory") + +#endif /* _KERNEL && !_LOCORE */ + +#ifdef _KERNEL +/* + * Values for the code field in a break instruction. + */ +#define BREAK_INSTR 0x0000000d +#define BREAK_VAL_MASK 0x03ff0000 +#define BREAK_VAL_SHIFT 16 +#define BREAK_KDB_VAL 512 +#define BREAK_SSTEP_VAL 513 +#define BREAK_BRKPT_VAL 514 +#define BREAK_SOVER_VAL 515 +#define BREAK_DDB_VAL 516 +#define BREAK_FPUEMUL_VAL 517 +#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT)) +#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT)) +#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT)) +#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT)) +#define BREAK_DDB (BREAK_INSTR | (BREAK_DDB_VAL << BREAK_VAL_SHIFT)) +#define BREAK_FPUEMUL (BREAK_INSTR | (BREAK_FPUEMUL_VAL << BREAK_VAL_SHIFT)) + +#endif /* _KERNEL */ + +/* + * CTL_MACHDEP definitions. + */ +#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ + /* 2 formerly: keyboard reset */ + /* 3 formerly: CPU_LIDSUSPEND */ +#define CPU_LIDACTION 4 /* action caused by lid close */ +#define CPU_MAXID 5 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "allowaperture", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "lidaction", CTLTYPE_INT }, \ +} + +/* + * MIPS CPU types (cp_imp). + */ +#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */ +#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */ +#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */ +#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */ +#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */ +#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */ +#define MIPS_CN50XX 0x06 /* Cavium OCTEON CN50xx MIPS64R2*/ +#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */ +#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */ +#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */ +#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */ +#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */ +#define MIPS_R12000 0x0e /* MIPS R12000 ISA IV */ +#define MIPS_R14000 0x0f /* MIPS R14000 ISA IV */ +#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */ +#define MIPS_R4600 0x20 /* PMCS R4600 Orion ISA III */ +#define MIPS_R4700 0x21 /* PMCS R4700 Orion ISA III */ +#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */ +#define MIPS_R5000 0x23 /* MIPS R5000 CPU ISA IV */ +#define MIPS_RM7000 0x27 /* PMCS RM7000 CPU ISA IV */ +#define MIPS_RM52X0 0x28 /* PMCS RM52X0 CPU ISA IV */ +#define MIPS_RM9000 0x34 /* PMCS RM9000 CPU ISA IV */ +#define MIPS_LOONGSON 0x42 /* STC LoongSon CPU ISA III */ +#define MIPS_VR5400 0x54 /* NEC Vr5400 CPU ISA IV+ */ +#define MIPS_LOONGSON2 0x63 /* STC LoongSon2/3 CPU ISA III+ */ +#define MIPS_CN63XX 0x90 /* Cavium OCTEON II CN6[23]xx MIPS64R2 */ +#define MIPS_CN68XX 0x91 /* Cavium OCTEON II CN68xx MIPS64R2 */ +#define MIPS_CN66XX 0x92 /* Cavium OCTEON II CN66xx MIPS64R2 */ +#define MIPS_CN61XX 0x93 /* Cavium OCTEON II CN6[01]xx MIPS64R2 */ +#define MIPS_CN78XX 0x95 /* Cavium OCTEON III CN7[678]xx MIPS64R2 */ +#define MIPS_CN71XX 0x96 /* Cavium OCTEON III CN7[01]xx MIPS64R2 */ +#define MIPS_CN73XX 0x97 /* Cavium OCTEON III CN7[23]xx MIPS64R2 */ + +/* + * MIPS FPU types. Only soft, rest is the same as cpu type. + */ +#define MIPS_SOFT 0x00 /* Software emulation ISA I */ + + +#if defined(_KERNEL) && !defined(_LOCORE) + +extern register_t protosr; +extern int cpu_has_synced_cp0_count; +extern int cpu_has_userlocal; + +#ifdef FPUEMUL +#define CPU_HAS_FPU(ci) ((ci)->ci_hw.c1prid != 0) +#else +#define CPU_HAS_FPU(ci) 1 +#endif + +struct exec_package; +struct user; + +void tlb_asid_wrap(struct cpu_info *); +void tlb_flush(int); +void tlb_flush_addr(vaddr_t); +void tlb_init(unsigned int); +void tlb_set_page_mask(uint32_t); +void tlb_set_pid(u_int); +void tlb_set_wired(uint32_t); +int tlb_update(vaddr_t, register_t); + +void build_trampoline(vaddr_t, vaddr_t); +void cpu_switchto_asm(struct proc *, struct proc *); +int exec_md_map(struct proc *, struct exec_package *); +void savectx(struct user *, int); + +int copyinsn(struct proc *, vaddr_t, uint32_t *); +void enable_fpu(struct proc *); +void save_fpu(void); +int fpe_branch_emulate(struct proc *, struct trapframe *, uint32_t, + vaddr_t); +void MipsSaveCurFPState(struct proc *); +void MipsSaveCurFPState16(struct proc *); +void MipsSwitchFPState(struct proc *, struct trapframe *); +void MipsSwitchFPState16(struct proc *, struct trapframe *); + +void MipsFPTrap(struct trapframe *); +register_t MipsEmulateBranch(struct trapframe *, vaddr_t, uint32_t, uint32_t); + +int classify_insn(uint32_t); +#define INSNCLASS_NEUTRAL 0 +#define INSNCLASS_CALL 1 +#define INSNCLASS_BRANCH 2 + +/* + * Low level access routines to CPU registers + */ + +void setsoftintr0(void); +void clearsoftintr0(void); +void setsoftintr1(void); +void clearsoftintr1(void); +register_t enableintr(void); +register_t disableintr(void); +register_t getsr(void); +register_t setsr(register_t); + +uint32_t cp0_get_cause(void); +u_int cp0_get_count(void); +register_t cp0_get_config(void); +uint32_t cp0_get_config_1(void); +uint32_t cp0_get_config_2(void); +uint32_t cp0_get_config_3(void); +uint32_t cp0_get_config_4(void); +uint32_t cp0_get_pagegrain(void); +register_t cp0_get_prid(void); +void cp0_reset_cause(register_t); +void cp0_set_compare(u_int); +void cp0_set_config(register_t); +void cp0_set_pagegrain(uint32_t); +void cp0_set_trapbase(register_t); +u_int cp1_get_prid(void); + +static inline uint32_t +cp0_get_hwrena(void) +{ + uint32_t value; + __asm__ volatile ("mfc0 %0, $7" : "=r" (value)); + return value; +} + +static inline void +cp0_set_hwrena(uint32_t value) +{ + __asm__ volatile ("mtc0 %0, $7" : : "r" (value)); +} + +static inline void +cp0_set_userlocal(void *value) +{ + __asm__ volatile ( + " .set push\n" + " .set mips64r2\n" + " dmtc0 %0, $4, 2\n" + " .set pop\n" + : : "r" (value)); +} + +static inline u_long +intr_disable(void) +{ + return disableintr(); +} + +static inline void +intr_restore(u_long sr) +{ + setsr(sr); +} + +/* + * Cache routines (may be overridden) + */ + +#ifndef Mips_SyncCache +#define Mips_SyncCache(ci) \ + ((ci)->ci_SyncCache)(ci) +#endif +#ifndef Mips_InvalidateICache +#define Mips_InvalidateICache(ci, va, l) \ + ((ci)->ci_InvalidateICache)(ci, va, l) +#endif +#ifndef Mips_InvalidateICachePage +#define Mips_InvalidateICachePage(ci, va) \ + ((ci)->ci_InvalidateICachePage)(ci, va) +#endif +#ifndef Mips_SyncICache +#define Mips_SyncICache(ci) \ + ((ci)->ci_SyncICache)(ci) +#endif +#ifndef Mips_SyncDCachePage +#define Mips_SyncDCachePage(ci, va, pa) \ + ((ci)->ci_SyncDCachePage)(ci, va, pa) +#endif +#ifndef Mips_HitSyncDCachePage +#define Mips_HitSyncDCachePage(ci, va, pa) \ + ((ci)->ci_HitSyncDCachePage)(ci, va, pa) +#endif +#ifndef Mips_HitSyncDCache +#define Mips_HitSyncDCache(ci, va, l) \ + ((ci)->ci_HitSyncDCache)(ci, va, l) +#endif +#ifndef Mips_HitInvalidateDCache +#define Mips_HitInvalidateDCache(ci, va, l) \ + ((ci)->ci_HitInvalidateDCache)(ci, va, l) +#endif +#ifndef Mips_IOSyncDCache +#define Mips_IOSyncDCache(ci, va, l, h) \ + ((ci)->ci_IOSyncDCache)(ci, va, l, h) +#endif + +#endif /* _KERNEL && !_LOCORE */ +#endif /* !_MIPS64_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/cpustate.h b/lib/libc/include/mips64-openbsd-none/mips64/cpustate.h new file mode 100644 index 0000000000000000000000000000000000000000..a6ad1d367624f41130462e7aef1b7323bdb0d5ca --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/cpustate.h @@ -0,0 +1,150 @@ +/* $OpenBSD: cpustate.h,v 1.11 2015/09/27 18:17:08 miod Exp $ */ + +/* + * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#define KERN_REG_SIZE (NUMSAVEREGS * REGSZ) +#define KERN_EXC_FRAME_SIZE (CF_SZ + KERN_REG_SIZE + 16) + +#define SAVE_REG(reg, offs, base, bo) \ + REG_S reg, bo + (REGSZ * offs) (base) + +#define RESTORE_REG(reg, offs, base, bo) \ + REG_L reg, bo + (REGSZ * offs) (base) + +/* + * This macro saves the 'scratch' cpu state on stack. + * Macros are generic so no 'special' instructions! + * a0 will have a pointer to the 'frame' on return. + * a1 will have saved STATUS_REG on return. + * a3 will have the exception pc on 'return'. + * No traps, no interrupts if frame = k1 or k0! + * Temp regs are saved with their register number so + * branch emulation etc works properly. + */ +#define SAVE_CPU(frame, bo) \ + SAVE_REG(AT, AST, frame, bo) ;\ + SAVE_REG(v0, V0, frame, bo) ;\ + SAVE_REG(v1, V1, frame, bo) ;\ + SAVE_REG(a0, A0, frame, bo) ;\ + SAVE_REG(a1, A1, frame, bo) ;\ + SAVE_REG(a2, A2, frame, bo) ;\ + SAVE_REG(a3, A3, frame, bo) ;\ + MFC0 a0, COP_0_CAUSE_REG ;\ + MFC0_HAZARD ;\ + SAVE_REG(a4, A4, frame, bo) ;\ + SAVE_REG(a5, A5, frame, bo) ;\ + MFC0 a1, COP_0_STATUS_REG ;\ + MFC0_HAZARD ;\ + SAVE_REG(a6, A6, frame, bo) ;\ + SAVE_REG(a7, A7, frame, bo) ;\ + PRE_MFC0_ADDR_HAZARD ;\ + DMFC0 a2, COP_0_BAD_VADDR ;\ + MFC0_HAZARD ;\ + SAVE_REG(t0, T0, frame, bo) ;\ + SAVE_REG(t1, T1, frame, bo) ;\ + DMFC0 a3, COP_0_EXC_PC ;\ + MFC0_HAZARD ;\ + SAVE_REG(t2, T2, frame, bo) ;\ + SAVE_REG(t3, T3, frame, bo) ;\ + SAVE_REG(t8, T8, frame, bo) ;\ + SAVE_REG(t9, T9, frame, bo) ;\ + SAVE_REG(gp, GP, frame, bo) ;\ + SAVE_REG(ra, RA, frame, bo) ;\ + mflo v0 ;\ + mfhi v1 ;\ + SAVE_REG(v0, MULLO, frame, bo) ;\ + SAVE_REG(v1, MULHI, frame, bo) ;\ + SAVE_REG(a0, CAUSE, frame, bo) ;\ + SAVE_REG(a1, SR, frame, bo) ;\ + SAVE_REG(a2, BADVADDR, frame, bo) ;\ + SAVE_REG(a3, PC, frame, bo) ;\ + SAVE_REG(sp, SP, frame, bo) ;\ + PTR_ADDU a0, frame, bo ;\ + GET_CPU_INFO(v0, v1) ;\ + lw a2, CI_IPL(v0) ;\ + SAVE_REG(a2, CPL, frame, bo) + +/* + * Save 'callee save' registers in frame to aid DDB. + */ +#define SAVE_CPU_SREG(frame, bo) \ + SAVE_REG(s0, S0, frame, bo) ;\ + SAVE_REG(s1, S1, frame, bo) ;\ + SAVE_REG(s2, S2, frame, bo) ;\ + SAVE_REG(s3, S3, frame, bo) ;\ + SAVE_REG(s4, S4, frame, bo) ;\ + SAVE_REG(s5, S5, frame, bo) ;\ + SAVE_REG(s6, S6, frame, bo) ;\ + SAVE_REG(s7, S7, frame, bo) ;\ + SAVE_REG(s8, S8, frame, bo) + +/* + * Restore cpu state. When called a0 = EXC_PC. + */ +#define RESTORE_CPU(frame, bo) \ + RESTORE_REG(t1, SR, frame, bo) ;\ + RESTORE_REG(t2, MULLO, frame, bo) ;\ + RESTORE_REG(t3, MULHI, frame, bo) ;\ + MTC0 t1, COP_0_STATUS_REG ;\ + MTC0_SR_IE_HAZARD ;\ + mtlo t2 ;\ + mthi t3 ;\ + DMTC0 a0, COP_0_EXC_PC ;\ + MTC0_HAZARD ;\ + RESTORE_REG(AT, AST, frame, bo) ;\ + RESTORE_REG(v0, V0, frame, bo) ;\ + RESTORE_REG(v1, V1, frame, bo) ;\ + RESTORE_REG(a0, A0, frame, bo) ;\ + RESTORE_REG(a1, A1, frame, bo) ;\ + RESTORE_REG(a2, A2, frame, bo) ;\ + RESTORE_REG(a3, A3, frame, bo) ;\ + RESTORE_REG(a4, A4, frame, bo) ;\ + RESTORE_REG(a5, A5, frame, bo) ;\ + RESTORE_REG(a6, A6, frame, bo) ;\ + RESTORE_REG(a7, A7, frame, bo) ;\ + RESTORE_REG(t0, T0, frame, bo) ;\ + RESTORE_REG(t1, T1, frame, bo) ;\ + RESTORE_REG(t2, T2, frame, bo) ;\ + RESTORE_REG(t3, T3, frame, bo) ;\ + RESTORE_REG(t8, T8, frame, bo) ;\ + RESTORE_REG(t9, T9, frame, bo) ;\ + RESTORE_REG(gp, GP, frame, bo) ;\ + RESTORE_REG(ra, RA, frame, bo) + +/* + * Restore 'callee save' registers + */ +#define RESTORE_CPU_SREG(frame, bo) \ + RESTORE_REG(s0, S0, frame, bo) ;\ + RESTORE_REG(s1, S1, frame, bo) ;\ + RESTORE_REG(s2, S2, frame, bo) ;\ + RESTORE_REG(s3, S3, frame, bo) ;\ + RESTORE_REG(s4, S4, frame, bo) ;\ + RESTORE_REG(s5, S5, frame, bo) ;\ + RESTORE_REG(s6, S6, frame, bo) ;\ + RESTORE_REG(s7, S7, frame, bo) ;\ + RESTORE_REG(s8, S8, frame, bo) \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/db_machdep.h b/lib/libc/include/mips64-openbsd-none/mips64/db_machdep.h new file mode 100644 index 0000000000000000000000000000000000000000..7dec17ccc290a4f02606df578d5375cf138749a4 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/db_machdep.h @@ -0,0 +1,76 @@ +/* $OpenBSD: db_machdep.h,v 1.21 2021/08/30 08:11:12 jasper Exp $ */ + +/* + * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_DB_MACHDEP_H_ +#define _MIPS64_DB_MACHDEP_H_ + +#include +#include +#include + +#define DB_MACHINE_COMMANDS /* We have machine specific commands */ + +typedef struct trapframe db_regs_t; +extern db_regs_t ddb_regs; + +typedef long db_expr_t; + +#define SOFTWARE_SSTEP /* Need software single step */ +#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */ +vaddr_t next_instr_address(vaddr_t, int); +#define BKPT_SIZE (4) +#define BKPT_SET(ins) (BREAK_DDB) +#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0) + +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK) +#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */ + +#define PC_REGS(regs) ((vaddr_t)(regs)->pc) +#define SET_PC_REGS(regs, value) (regs)->pc = (register_t)(value) + +/* + * Test of instructions to see class. + */ +#define inst_branch(i) (classify_insn(i) == INSNCLASS_BRANCH) +#define inst_trap_return(i) ((i) & 0) +#define inst_call(i) (classify_insn(i) == INSNCLASS_CALL) +#define inst_return(i) ((i) == 0x03e00008) + +void db_machine_init(void); + +int db_enter_ddb(void); +void db_startcpu(int); +void db_stopcpu(int); + +int dbmd_print_insn(uint32_t, vaddr_t, int (*)(const char *, ...)); + +#define DDB_STATE_NOT_RUNNING 0 +#define DDB_STATE_RUNNING 1 +#define DDB_STATE_EXITING 2 + +#endif /* !_MIPS64_DB_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/elf.h b/lib/libc/include/mips64-openbsd-none/mips64/elf.h new file mode 100644 index 0000000000000000000000000000000000000000..1cd8fda26a984ce714b564cd5363545f6cf78064 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/elf.h @@ -0,0 +1,7 @@ +/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */ + +/* + * This file is in the public domain. + */ + +/* Nothing for now */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/endian.h b/lib/libc/include/mips64-openbsd-none/mips64/endian.h new file mode 100644 index 0000000000000000000000000000000000000000..178466dc551c5ec31039c700101cf2ab6847cb57 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/endian.h @@ -0,0 +1,49 @@ +/* $OpenBSD: endian.h,v 1.9 2014/07/12 16:25:08 guenther Exp $ */ + +/* + * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_ENDIAN_H_ +#define _MIPS64_ENDIAN_H_ + +#if defined(__MIPSEL__) +#define _BYTE_ORDER _LITTLE_ENDIAN +#endif +#if defined(__MIPSEB__) +#define _BYTE_ORDER _BIG_ENDIAN +#endif + +#if !defined(_BYTE_ORDER) +#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!" +#endif + +#define __STRICT_ALIGNMENT + +#ifndef __FROM_SYS__ENDIAN +#include +#endif + +#endif /* _MIPS64_ENDIAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/exec.h b/lib/libc/include/mips64-openbsd-none/mips64/exec.h new file mode 100644 index 0000000000000000000000000000000000000000..f946e5fc68432799fbe6684f7f9ebb02f0a40939 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/exec.h @@ -0,0 +1,137 @@ +/* $OpenBSD: exec.h,v 1.10 2022/10/28 15:07:25 kettenis Exp $ */ + +/* + * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_EXEC_H_ +#define _MIPS64_EXEC_H_ + +#define __LDPGSZ 16384 + +#define ARCH_ELFSIZE 64 +#define ELF_TARG_CLASS ELFCLASS64 + +#if defined(__MIPSEB__) +#define ELF_TARG_DATA ELFDATA2MSB +#else +#define ELF_TARG_DATA ELFDATA2LSB +#endif +#define ELF_TARG_MACH EM_MIPS + +/* Information taken from MIPS ABI supplement */ + +/* Architecture dependent Segment types - p_type */ +#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ + +/* Architecture dependent d_tag field for Elf32_Dyn. */ +#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */ +#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ +#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */ +#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ +#define DT_MIPS_FLAGS 0x70000005 /* Flags */ +#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */ +#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */ +#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */ +#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */ +#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */ +#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */ +#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */ +#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ +#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */ +#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ +#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */ +#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Relative address of debug map ptr */ + +#define DT_PROCNUM (DT_MIPS_RLD_MAP_REL - DT_LOPROC + 1) + +/* + * Legal values for e_flags field of Elf32_Ehdr. + */ +#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */ +#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */ +#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */ +#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */ +#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */ +#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ +#define E_MIPS_ARCH_1 0x00000000 +#define E_MIPS_ARCH_2 0x10000000 +#define E_MIPS_ARCH_3 0x20000000 +#define E_MIPS_ARCH_4 0x30000000 +#define EF_MIPS_ABI 0x0000f000 /* ABI level */ +#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */ +#define E_MIPS_ABI_O32 0x00001000 +#define E_MIPS_ABI_O64 0x00002000 +#define E_MIPS_ABI_EABI32 0x00004000 +#define E_MIPS_ABI_EABI64 0x00004000 + +/* + * Mips special sections. + */ +#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ +#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ +#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ + +/* + * Legal values for sh_type field of Elf32_Shdr. + */ +#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ +#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ +#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ +#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ +#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */ +#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ + +/* + * Legal values for sh_flags field of Elf32_Shdr. + */ +#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ + +#if 0 +/* + * Entries found in sections of type SHT_MIPS_GPTAB. + */ +typedef union { + struct { + Elf32_Word gt_current_g_value; /* -G val used in compilation */ + Elf32_Word gt_unused; /* Not used */ + } gt_header; /* First entry in section */ + struct { + Elf32_Word gt_g_value; /* If this val were used for -G */ + Elf32_Word gt_bytes; /* This many bytes would be used */ + } gt_entry; /* Subsequent entries in section */ +} Elf32_gptab; + +/* + * Entry found in sections of type SHT_MIPS_REGINFO. + */ +typedef struct { + Elf32_Word ri_gprmask; /* General registers used */ + Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ + Elf32_Sword ri_gp_value; /* $gp register value */ +} Elf32_RegInfo; +#endif + +#endif /* !_MIPS64_EXEC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/fenv.h b/lib/libc/include/mips64-openbsd-none/mips64/fenv.h new file mode 100644 index 0000000000000000000000000000000000000000..6059d900666e889a211cc50217f5edf32d4f5bac --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/fenv.h @@ -0,0 +1,94 @@ +/* $OpenBSD: fenv.h,v 1.3 2011/05/25 21:46:49 martynas Exp $ */ + +/* + * Copyright (c) 2011 Martynas Venckus + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_FENV_H_ +#define _MIPS64_FENV_H_ + +/* + * Each symbol representing a floating point exception expands to an integer + * constant expression with values, such that bitwise-inclusive ORs of _all + * combinations_ of the constants result in distinct values. + * + * We use such values that allow direct bitwise operations on FPU registers. + */ +#define FE_INEXACT 0x04 +#define FE_UNDERFLOW 0x08 +#define FE_OVERFLOW 0x10 +#define FE_DIVBYZERO 0x20 +#define FE_INVALID 0x40 + +/* + * The following symbol is simply the bitwise-inclusive OR of all floating-point + * exception constants defined above. + */ +#define FE_ALL_EXCEPT (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | \ + FE_DIVBYZERO | FE_INVALID) +#define _MASK_SHIFT 5 + +/* + * Each symbol representing the rounding direction, expands to an integer + * constant expression whose value is distinct non-negative value. + * + * We use such values that allow direct bitwise operations on FPU registers. + */ +#define FE_TONEAREST 0x0 +#define FE_TOWARDZERO 0x1 +#define FE_UPWARD 0x2 +#define FE_DOWNWARD 0x3 + +/* + * The following symbol is simply the bitwise-inclusive OR of all floating-point + * rounding direction constants defined above. + */ +#define _ROUND_MASK (FE_TONEAREST | FE_TOWARDZERO | FE_UPWARD | \ + FE_DOWNWARD) + +/* + * fenv_t represents the entire floating-point environment. + */ +typedef unsigned int fenv_t; + +/* + * The following constant represents the default floating-point environment + * (that is, the one installed at program startup) and has type pointer to + * const-qualified fenv_t. + * + * It can be used as an argument to the functions within the header + * that manage the floating-point environment, namely fesetenv() and + * feupdateenv(). + */ +__BEGIN_DECLS +extern fenv_t __fe_dfl_env; +__END_DECLS +#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env) + +/* + * fexcept_t represents the floating-point status flags collectively, including + * any status the implementation associates with the flags. + * + * A floating-point status flag is a system variable whose value is set (but + * never cleared) when a floating-point exception is raised, which occurs as a + * side effect of exceptional floating-point arithmetic to provide auxiliary + * information. + * + * A floating-point control mode is a system variable whose value may be set by + * the user to affect the subsequent behavior of floating-point arithmetic. + */ +typedef unsigned int fexcept_t; + +#endif /* !_MIPS64_FENV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/fpu.h b/lib/libc/include/mips64-openbsd-none/mips64/fpu.h new file mode 100644 index 0000000000000000000000000000000000000000..d670aed7bd564d6bc057a512e242160e719dff9f --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/fpu.h @@ -0,0 +1,73 @@ +/* $OpenBSD: fpu.h,v 1.2 2012/12/04 05:00:40 deraadt Exp $ */ + +/* + * Copyright (c) 2010 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Layout of the floating-point control/status register (FCR31) + */ + +/* flush denormalized results to zero instead of causing FPCSR_C_E */ +#define FPCSR_FS 0x01000000 + +/* compare condition bits: one bit for MIPS I/II/III, eight bits for MIPS IV */ +#define FPCSR_CONDBIT(c) ((c) == 0 ? 23 : 24 + (c)) +#define FPCSR_CONDVAL(c) (1U << FPCSR_CONDBIT(c)) + +/* cause bits */ +#define FPCSR_C_E 0x00020000 /* unimplemented operation */ +#define FPCSR_C_V 0x00010000 /* invalid operation */ +#define FPCSR_C_Z 0x00008000 /* division by zero */ +#define FPCSR_C_O 0x00004000 /* overflow */ +#define FPCSR_C_U 0x00002000 /* underflow */ +#define FPCSR_C_I 0x00001000 /* inexact */ + +/* enable bits */ +#define FPCSR_E_V 0x00000800 /* invalid operation */ +#define FPCSR_E_Z 0x00000400 /* division by zero */ +#define FPCSR_E_O 0x00000200 /* overflow */ +#define FPCSR_E_U 0x00000100 /* underflow */ +#define FPCSR_E_I 0x00000080 /* inexact */ + +/* flags bits */ +#define FPCSR_F_V 0x00000040 /* invalid operation */ +#define FPCSR_F_Z 0x00000020 /* division by zero */ +#define FPCSR_F_O 0x00000010 /* overflow */ +#define FPCSR_F_U 0x00000008 /* underflow */ +#define FPCSR_F_I 0x00000004 /* inexact */ + +#define FPCSR_C_MASK 0x0003f000 +#define FPCSR_C_SHIFT 12 +#define FPCSR_E_MASK 0x00000f80 +#define FPCSR_E_SHIFT 7 +#define FPCSR_F_MASK 0x0000007c +#define FPCSR_F_SHIFT 2 +#define FPCSR_RM_MASK 0x00000003 /* rounding mode */ + +#ifndef _KERNEL + +/* + * IRIX-compatible interfaces allowing userland to control the state + * of the floating-point control/status register. These are intended + * to let userland control the state of the FS bit. + */ +#include + +__BEGIN_DECLS +int get_fpc_csr(void); +int set_fpc_csr(int); +__END_DECLS +#endif /* _KERNEL */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/frame.h b/lib/libc/include/mips64-openbsd-none/mips64/frame.h new file mode 100644 index 0000000000000000000000000000000000000000..233e911c36a9a13d1e592ee4f9853d0c236420ac --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/frame.h @@ -0,0 +1,114 @@ +/* $OpenBSD: frame.h,v 1.8 2021/04/29 12:49:19 visa Exp $ */ + +/* + * Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#ifndef _MIPS64_FRAME_H_ +#define _MIPS64_FRAME_H_ + +/* + * The layout of this *must* match with regnum.h or bad things + * will happen. libc setjmp/longjmp depends on this as well. + */ +struct trapframe { + register_t zero; + register_t ast; + register_t v0; + register_t v1; + register_t a0; + register_t a1; + register_t a2; + register_t a3; + register_t a4; /* ta0 */ + register_t a5; /* ta1 */ + register_t a6; /* ta2 */ + register_t a7; /* ta3 */ + register_t t0; + register_t t1; + register_t t2; + register_t t3; + register_t s0; + register_t s1; + register_t s2; + register_t s3; + register_t s4; + register_t s5; + register_t s6; + register_t s7; + register_t t8; + register_t t9; + register_t k0; + register_t k1; + register_t gp; + register_t sp; + register_t s8; + register_t ra; + register_t sr; + register_t mullo; + register_t mulhi; + register_t badvaddr; + register_t cause; + register_t pc; + register_t ic; /* unused, was RM7000 ICR */ + register_t ipl; + +/* From here and on, only saved user processes. */ + + f_register_t f0; + f_register_t f1; + f_register_t f2; + f_register_t f3; + f_register_t f4; + f_register_t f5; + f_register_t f6; + f_register_t f7; + f_register_t f8; + f_register_t f9; + f_register_t f10; + f_register_t f11; + f_register_t f12; + f_register_t f13; + f_register_t f14; + f_register_t f15; + f_register_t f16; + f_register_t f17; + f_register_t f18; + f_register_t f19; + f_register_t f20; + f_register_t f21; + f_register_t f22; + f_register_t f23; + f_register_t f24; + f_register_t f25; + f_register_t f26; + f_register_t f27; + f_register_t f28; + f_register_t f29; + f_register_t f30; + f_register_t f31; + register_t fsr; +}; + +#endif /* !_MIPS64_FRAME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/ieee.h b/lib/libc/include/mips64-openbsd-none/mips64/ieee.h new file mode 100644 index 0000000000000000000000000000000000000000..d96b3479fbec3fec86ad310b45b4d6b073613674 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/ieee.h @@ -0,0 +1,169 @@ +/* $OpenBSD: ieee.h,v 1.4 2010/01/23 19:11:21 miod Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. It does *not* define (yet?) any of the rounding + * mode bits, exceptions, and so forth. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACHBITS 20 +#define DBL_FRACLBITS 32 +#define DBL_FRACBITS 52 + +#define EXT_EXPBITS 15 +#define EXT_FRACHBITS 16 +#define EXT_FRACHMBITS 32 +#define EXT_FRACLMBITS 32 +#define EXT_FRACLBITS 32 +#define EXT_FRACBITS 112 + +#define EXT_IMPLICIT_NBIT + +#define EXT_TO_ARRAY32(p, a) do { \ + (a)[0] = (uint32_t)(p)->ext_fracl; \ + (a)[1] = (uint32_t)(p)->ext_fraclm; \ + (a)[2] = (uint32_t)(p)->ext_frachm; \ + (a)[3] = (uint32_t)(p)->ext_frach; \ +} while(0) + +struct ieee_single { +#ifdef __MIPSEB__ + u_int sng_sign:1; + u_int sng_exp:8; + u_int sng_frac:23; +#else + u_int sng_frac:23; + u_int sng_exp:8; + u_int sng_sign:1; +#endif +}; + +struct ieee_double { +#ifdef __MIPSEB__ + u_int dbl_sign:1; + u_int dbl_exp:11; + u_int dbl_frach:20; + u_int dbl_fracl; +#else + u_int dbl_fracl; + u_int dbl_frach:20; + u_int dbl_exp:11; + u_int dbl_sign:1; +#endif +}; + +struct ieee_ext { +#ifdef __MIPSEB__ + u_int ext_sign:1; + u_int ext_exp:15; + u_int ext_frach:16; + u_int ext_frachm; + u_int ext_fraclm; + u_int ext_fracl; +#else + u_int ext_fracl; + u_int ext_fraclm; + u_int ext_frachm; + u_int ext_frach:16; + u_int ext_exp:15; + u_int ext_sign:1; +#endif +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 +#define EXT_EXP_INFNAN 32767 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#define EXT_QUIETNAN (1 << 15) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 +#define EXT_EXP_BIAS 16383 \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/ieeefp.h b/lib/libc/include/mips64-openbsd-none/mips64/ieeefp.h new file mode 100644 index 0000000000000000000000000000000000000000..e3521f45cd0f946e7c5ceb4ecafda9aced50d795 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/ieeefp.h @@ -0,0 +1,46 @@ +/* $OpenBSD: ieeefp.h,v 1.4 2011/03/23 16:54:36 pirofti Exp $ */ + +/* + * Written by J.T. Conklin, Apr 11, 1995 + * Public domain. + */ + +#ifndef _MIPS64_IEEEFP_H_ +#define _MIPS64_IEEEFP_H_ + +typedef int fp_except; +#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ +#define FP_X_UFL 0x02 /* underflow exception */ +#define FP_X_OFL 0x04 /* overflow exception */ +#define FP_X_DZ 0x08 /* divide-by-zero exception */ +#define FP_X_INV 0x10 /* invalid operation exception */ + +typedef enum { + FP_RN=0, /* round to nearest representable number */ + FP_RZ=1, /* round to zero (truncate) */ + FP_RP=2, /* round toward positive infinity */ + FP_RM=3 /* round toward negative infinity */ +} fp_rnd; + +#ifdef _KERNEL + +/* + * Defines for the floating-point completion/emulation code. + */ + +#include +#include +#include +#include + +#define float_raise(bits) \ + do { curproc->p_md.md_regs->fsr |= (bits) << FPCSR_C_SHIFT; } while (0) +#define float_set_inexact() float_raise(FP_X_IMP) +#define float_set_invalid() float_raise(FP_X_INV) + +#define float_get_round(csr) (csr & FPCSR_RM_MASK) +#define fpgetround() float_get_round(curproc->p_md.md_regs->fsr) + +#endif + +#endif /* !_MIPS64_IEEEFP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/kcore.h b/lib/libc/include/mips64-openbsd-none/mips64/kcore.h new file mode 100644 index 0000000000000000000000000000000000000000..5a69401214af28aa88af634148df52c3cdb7d1e5 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/kcore.h @@ -0,0 +1,40 @@ +/* $OpenBSD: kcore.h,v 1.3 2023/01/04 10:59:34 jsg Exp $ */ +/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */ + +/* + * Copyright (c) 1996 Leo Weppelman. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MIPS64_KCORE_H_ +#define _MIPS64_KCORE_H_ + +#define NPHYS_RAM_SEGS 8 + +typedef struct cpu_kcore_hdr { + paddr_t kernel_pa; /* Phys. address of kernel VA 0 */ + int mmutype; + phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS]; +} cpu_kcore_hdr_t; + +#endif /* !_MIPS64_KCORE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/limits.h b/lib/libc/include/mips64-openbsd-none/mips64/limits.h new file mode 100644 index 0000000000000000000000000000000000000000..398deda85270e8b1940be26b3f75dd63292e8a12 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/limits.h @@ -0,0 +1,53 @@ +/* $OpenBSD: limits.h,v 1.8 2015/04/30 13:42:08 millert Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#ifndef _MIPS64_LIMITS_H_ +#define _MIPS64_LIMITS_H_ + +#include + +#if __POSIX_VISIBLE || __XPG_VISIBLE +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ +#endif + +#if __BSD_VISIBLE +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */ + +/* Quads and longs are the same on mips64 */ +#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */ +#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */ +#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */ + +#endif /* __BSD_VISIBLE */ + +#endif /* !_MIPS64_LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/loongson2.h b/lib/libc/include/mips64-openbsd-none/mips64/loongson2.h new file mode 100644 index 0000000000000000000000000000000000000000..ecfab5502497f42445eac78ab68cc92510d5c5a8 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/loongson2.h @@ -0,0 +1,65 @@ +/* $OpenBSD: loongson2.h,v 1.4 2013/01/16 20:28:06 miod Exp $ */ + +/* + * Copyright (c) 2009 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_LOONGSON2_H_ +#define _MIPS64_LOONGSON2_H_ + +/* + * Loongson 2E/2F specific defines + */ + +/* + * Address Window registers physical addresses + * + * The Loongson 2F processor has an AXI crossbar with four possible bus + * masters, each one having four programmable address windows. + * + * Each window is defined with three 64-bit registers: + * - a base address register, defining the address in the master address + * space (base register). + * - an address mask register, defining which address bits are valid in this + * window. A given address matches a window if (addr & mask) == base. + * - the location of the window base in the target, as well at the target + * number itself (mmap register). The lower 20 bits of the address are + * forced as zeroes regardless of their value in this register. + * The translated address is thus (addr & ~mask) | (mmap & ~0xfffff). + */ + +#define LOONGSON_AWR_BASE_ADDRESS 0x3ff00000 + +#define LOONGSON_AWR_BASE(master, window) \ + (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x00) +#define LOONGSON_AWR_SIZE(master, window) \ + (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x20) +#define LOONGSON_AWR_MMAP(master, window) \ + (LOONGSON_AWR_BASE_ADDRESS + (window) * 0x08 + (master) * 0x60 + 0x40) + +/* + * Bits in the diagnostic register + */ + +#define COP_0_DIAG_ITLB_CLEAR 0x04 +#define COP_0_DIAG_BTB_CLEAR 0x02 +#define COP_0_DIAG_RAS_DISABLE 0x01 + +#if defined(_KERNEL) && !defined(_LOCORE) +int loongson2f_cpuspeed(int *); +void loongson2f_setperf(int); +#endif + +#endif /* _MIPS64_LOONGSON2_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/loongson3.h b/lib/libc/include/mips64-openbsd-none/mips64/loongson3.h new file mode 100644 index 0000000000000000000000000000000000000000..8b8633e3a4286d81f3b29b94baf2a1fd5e6442c2 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/loongson3.h @@ -0,0 +1,108 @@ +/* $OpenBSD: loongson3.h,v 1.3 2017/05/10 16:04:21 visa Exp $ */ + +/* + * Copyright (c) 2016 Visa Hankala + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_LOONGSON3_H_ +#define _MIPS64_LOONGSON3_H_ + +/* + * Definitions for Loongson 3A. + */ + +#define LS3_CFG_BASE(node) (0x100000004000ull*(node) + 0x3ff00000) +#define LS3_MEM_BASE(node) (0x100000000000ull*(node)) + +#define LS3_IPI_BASE(n, c) (LS3_CFG_BASE(n) + 0x1000 + 0x100*(c)) +#define LS3_IPI_ISR 0x00 +#define LS3_IPI_IMR 0x04 +#define LS3_IPI_SET 0x08 +#define LS3_IPI_CLEAR 0x0c +#define LS3_IPI_MBOX0 0x20 +#define LS3_IPI_MBOX1 0x28 +#define LS3_IPI_MBOX2 0x30 +#define LS3_IPI_MBOX3 0x38 + +static inline uint32_t +loongson3_get_cpuid(void) +{ + uint32_t tmp; + + asm volatile ( + " .set push\n" + " .set mips64\n" + " mfc0 %0, $15, 1\n" /* EBase */ + " .set pop\n" + : "=r" (tmp)); + + return tmp & 0xf; +} + +#define LS3_COREID(cpuid) ((cpuid) & 3) +#define LS3_NODEID(cpuid) ((cpuid) >> 2) + +/* + * Interrupt router registers + */ + +#define LS3_IRT_ENTRY(node, irq) (LS3_CFG_BASE(node) + 0x1400 + (irq)) +#define LS3_IRT_INTISR(node) (LS3_CFG_BASE(node) + 0x1420) +#define LS3_IRT_INTEN(node) (LS3_CFG_BASE(node) + 0x1424) +#define LS3_IRT_INTENSET(node) (LS3_CFG_BASE(node) + 0x1428) +#define LS3_IRT_INTENCLR(node) (LS3_CFG_BASE(node) + 0x142c) +#define LS3_IRT_INTISR_CORE(node, cpu) (LS3_CFG_BASE(node) + 0x1440 + (cpu)*8) + +/* sys int 0-3 */ +#define LS3_IRT_ENTRY_INT(node, x) LS3_IRT_ENTRY((node), (x)) +/* PCI int 0-3 */ +#define LS3_IRT_ENTRY_PCI(node, x) LS3_IRT_ENTRY((node), 0x04+(x)) +/* LPC int */ +#define LS3_IRT_ENTRY_LPC(node) LS3_IRT_ENTRY((node), 0x0a) +/* HT0 int 0-7 */ +#define LS3_IRT_ENTRY_HT0(node, x) LS3_IRT_ENTRY((node), 0x10+(x)) +/* HT1 int 0-7 */ +#define LS3_IRT_ENTRY_HT1(node, x) LS3_IRT_ENTRY((node), 0x18+(x)) + +#define LS3_IRT_ROUTE(core, intr) ((0x01 << (core)) | (0x10 << (intr))) + +#define LS3_IRQ_INT(x) (x) /* sys int 0-3 */ +#define LS3_IRQ_PCI(x) ((x) + 0x04) /* PCI int 0-3 */ +#define LS3_IRQ_LPC 0x0a /* LPC int */ +#define LS3_IRQ_HT0(x) ((x) + 0x10) /* HT0 int 0-7 */ +#define LS3_IRQ_HT1(x) ((x) + 0x18) /* HT1 int 0-7 */ +#define LS3_IRQ_NUM 32 + +#define LS3_IRQ_IS_HT(irq) ((irq) >= 0x10) + +#define LS3_IRQ_HT_MASK 0xffff0000u + +/* + * Number of HyperTransport interrupt vectors. In reality, each HT interface + * has 256 vectors, but the interrupt code uses only a subset of them. + */ +#define LS3_HT_IRQ_NUM 32 + +/* + * HyperTransport registers + */ + +#define LS3_HT1_MEM_BASE(n) (LS3_MEM_BASE(n)+0x00000e0000000000ull) +#define LS3_HT1_CFG_BASE(n) (LS3_MEM_BASE(n)+0x00000efdfb000000ull) + +#define LS3_HT_ISR_OFFSET(x) (0x80 + (x) * 4) +#define LS3_HT_IMR_OFFSET(x) (0xa0 + (x) * 4) + +#endif /* _MIPS64_LOONGSON3_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/memconf.h b/lib/libc/include/mips64-openbsd-none/mips64/memconf.h new file mode 100644 index 0000000000000000000000000000000000000000..208a60d9c5e39631d20b3e5cf0e13b419db72be6 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/memconf.h @@ -0,0 +1,48 @@ +/* $OpenBSD: memconf.h,v 1.7 2011/05/30 22:25:21 oga Exp $ */ + +/* + * Copyright (c) 1996 Per Fogelstrom + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Memory config list used by pmap_bootstrap. + */ + +#ifndef _MIPS64_MEMCONF_H_ +#define _MIPS64_MEMCONF_H_ + +struct phys_mem_desc { + uint64_t mem_first_page; + uint64_t mem_last_page; +}; + +#ifdef _KERNEL +#ifndef MAXMEMSEGS +#define MAXMEMSEGS 16 +#endif +extern struct phys_mem_desc mem_layout[]; +int memrange_register(uint64_t, uint64_t, uint64_t); +#endif + +#endif /* !_MIPS64_MEMCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/mips_cpu.h b/lib/libc/include/mips64-openbsd-none/mips64/mips_cpu.h new file mode 100644 index 0000000000000000000000000000000000000000..02b7f62d4894702595d6e6d5ec64af6881ac9b69 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/mips_cpu.h @@ -0,0 +1,282 @@ +/* $OpenBSD: mips_cpu.h,v 1.11 2022/12/11 05:07:25 visa Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell and Rick Macklem. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Copyright (C) 1989 Digital Equipment Corporation. + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies. + * Digital Equipment Corporation makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 + */ + +#ifndef _MIPS64_CPUREGS_H_ +#define _MIPS64_CPUREGS_H_ + +#if defined(_KERNEL) || defined(_STANDALONE) + +/* + * Status register. + */ + +#define SR_COP_USABILITY 0x30000000 /* CP0 and CP1 only */ +#define SR_COP_0_BIT 0x10000000 +#define SR_COP_1_BIT 0x20000000 +#define SR_COP_2_BIT 0x40000000 +#define SR_RP 0x08000000 +#define SR_FR_32 0x04000000 +#define SR_RE 0x02000000 +#define SR_DSD 0x01000000 /* Only on R12000 */ +#define SR_BOOT_EXC_VEC 0x00400000 +#define SR_TLB_SHUTDOWN 0x00200000 +#define SR_SOFT_RESET 0x00100000 +#define SR_DIAG_CH 0x00040000 +#define SR_DIAG_CE 0x00020000 +#define SR_DIAG_DE 0x00010000 +#define SR_KX 0x00000080 +#define SR_SX 0x00000040 +#define SR_UX 0x00000020 +#define SR_ERL 0x00000004 +#define SR_EXL 0x00000002 +#define SR_INT_ENAB 0x00000001 + +#define SOFT_INT_MASK_0 0x00000100 +#define SOFT_INT_MASK_1 0x00000200 +#define SR_INT_MASK_0 0x00000400 +#define SR_INT_MASK_1 0x00000800 +#define SR_INT_MASK_2 0x00001000 +#define SR_INT_MASK_3 0x00002000 +#define SR_INT_MASK_4 0x00004000 +#define SR_INT_MASK_5 0x00008000 + +#define SR_XX 0x80000000 +#define SR_KSU_MASK 0x00000018 +#define SR_KSU_SUPER 0x00000008 +#define SR_KSU_KERNEL 0x00000000 +#define SR_INT_MASK 0x0000ff00 +/* SR_KSU_USER is in for CLKF_USERMODE() */ +#ifndef SR_KSU_USER +#define SR_KSU_USER 0x00000010 +#endif + +#define SOFT_INT_MASK (SOFT_INT_MASK_0 | SOFT_INT_MASK_1) + +/* + * Cause register. + */ + +#define CR_BR_DELAY 0x80000000 +#define CR_BR_DELAY_SHIFT 31 +#define CR_EXC_CODE 0x0000007c +#define CR_EXC_CODE_SHIFT 2 +#define CR_COP_ERR 0x30000000 +#define CR_COP1_ERR 0x10000000 +#define CR_COP2_ERR 0x20000000 +#define CR_COP3_ERR 0x20000000 +#define CR_INT_SOFT0 0x00000100 +#define CR_INT_SOFT1 0x00000200 +#define CR_INT_0 0x00000400 +#define CR_INT_1 0x00000800 +#define CR_INT_2 0x00001000 +#define CR_INT_3 0x00002000 +#define CR_INT_4 0x00004000 +#define CR_INT_5 0x00008000 + +#define CR_INT_MASK 0x003fff00 + +/* + * Config register. + */ + +#define CFGR_CCA_MASK 0x00000007 +#define CFGR_CU 0x00000008 +#define CFGR_ICE 0x0000000200000000 +#define CFGR_SMM 0x0000000400000000 + +/* + * Location of exception vectors. + */ + +#define RESET_EXC_VEC (CKSEG1_BASE + 0x1fc00000) +#define TLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000000) +#define XTLB_MISS_EXC_VEC (CKSEG1_BASE + 0x00000080) +#define CACHE_ERR_EXC_VEC (CKSEG1_BASE + 0x00000100) +#define GEN_EXC_VEC (CKSEG1_BASE + 0x00000180) + +/* + * Coprocessor 0 registers + */ + +/* Common subset */ +#define COP_0_COUNT $9 +#define COP_0_TLB_HI $10 +#define COP_0_STATUS_REG $12 +#define COP_0_CAUSE_REG $13 +#define COP_0_EXC_PC $14 +#define COP_0_PRID $15 +#define COP_0_CONFIG $16 + +/* MIPS64 release 2 */ +#define COP_0_USERLOCAL $4, 2 +#define COP_0_TLB_PG_GRAIN $5, 1 +#define COP_0_EBASE $15, 1 + +/* R4000/5000/10000 */ +#define COP_0_TLB_INDEX $0 +#define COP_0_TLB_RANDOM $1 +#define COP_0_TLB_LO0 $2 +#define COP_0_TLB_LO1 $3 +#define COP_0_TLB_CONTEXT $4 +#define COP_0_TLB_PG_MASK $5 +#define COP_0_TLB_WIRED $6 +#define COP_0_BAD_VADDR $8 +#define COP_0_COMPARE $11 +#define COP_0_LLADDR $17 +#define COP_0_WATCH_LO $18 +#define COP_0_WATCH_HI $19 +#define COP_0_TLB_XCONTEXT $20 +#define COP_0_ECC $26 +#define COP_0_CACHE_ERR $27 +#define COP_0_TAG_LO $28 +#define COP_0_TAG_HI $29 +#define COP_0_ERROR_PC $30 + +/* Loongson-2 specific */ +#define COP_0_DIAG $22 + +/* Octeon specific */ +#define COP_0_CVMCTL $9, 7 +#define COP_0_CVMMEMCTL $11, 7 + +/* + * COP_0_COUNT speed divider. + */ +#if defined(CPU_OCTEON) +#define CP0_CYCLE_DIVIDER 1 +#else +#define CP0_CYCLE_DIVIDER 2 +#endif + +/* + * The floating point version and status registers. + */ +#define FPC_ID $0 +#define FPC_CSR $31 + +/* + * Config1 register + */ +#define CONFIG1_M 0x80000000u +#define CONFIG1_MMUSize1 0x7e000000u +#define CONFIG1_MMUSize1_SHIFT 25 +#define CONFIG1_IS 0x01c00000u +#define CONFIG1_IS_SHIFT 22 +#define CONFIG1_IL 0x00380000u +#define CONFIG1_IL_SHIFT 19 +#define CONFIG1_IA 0x00070000u +#define CONFIG1_IA_SHIFT 16 +#define CONFIG1_DS 0x0000e000u +#define CONFIG1_DS_SHIFT 13 +#define CONFIG1_DL 0x00001c00u +#define CONFIG1_DL_SHIFT 10 +#define CONFIG1_DA 0x00000380u +#define CONFIG1_DA_SHIFT 7 +#define CONFIG1_C2 0x00000040u +#define CONFIG1_MD 0x00000020u +#define CONFIG1_PC 0x00000010u +#define CONFIG1_WR 0x00000008u +#define CONFIG1_CA 0x00000004u +#define CONFIG1_EP 0x00000002u +#define CONFIG1_FP 0x00000001u + +/* + * Config3 register + */ +#define CONFIG3_M 0x80000000 +#define CONFIG3_BPG 0x40000000 +#define CONFIG3_CMGCR 0x20000000 +#define CONFIG3_IPLW 0x00600000 +#define CONFIG3_MMAR 0x001c0000 +#define CONFIG3_MCU 0x00020000 +#define CONFIG3_ISAOnExc 0x00010000 +#define CONFIG3_ISA 0x0000c000 +#define CONFIG3_ULRI 0x00002000 +#define CONFIG3_RXI 0x00001000 +#define CONFIG3_DSP2P 0x00000800 +#define CONFIG3_DSPP 0x00000400 +#define CONFIG3_CTXTC 0x00000200 +#define CONFIG3_ITL 0x00000100 +#define CONFIG3_LPA 0x00000080 +#define CONFIG3_VEIC 0x00000040 +#define CONFIG3_VInt 0x00000020 +#define CONFIG3_SP 0x00000010 +#define CONFIG3_CDMM 0x00000008 +#define CONFIG3_MT 0x00000004 +#define CONFIG3_SM 0x00000002 +#define CONFIG3_TL 0x00000001 + +/* + * Config4 register + */ +#define CONFIG4_M 0x80000000u +#define CONFIG4_IE 0x60000000u +#define CONFIG4_AE 0x10000000u +#define CONFIG4_VTLBSizeExt 0x0f000000u /* when MMUExtDef=3 */ +#define CONFIG4_KScrExist 0x00ff0000u +#define CONFIG4_MMUExtDef 0x0000c000u +#define CONFIG4_MMUExtDef_SHIFT 14 +#define CONFIG4_FTLBPageSize 0x00001f00u /* when MMUExtDef=2 or 3 */ +#define CONFIG4_FTLBWays 0x000000f0u /* when MMUExtDef=2 or 3 */ +#define CONFIG4_FTLBSets 0x0000000fu /* when MMUExtDef=2 or 3 */ +#define CONFIG4_MMUSizeExt 0x000000ffu /* when MMUExtDef=1 */ + +/* + * PageGrain register + */ +#define PGRAIN_RIE 0x80000000 +#define PGRAIN_XIE 0x40000000 +#define PGRAIN_ELPA 0x20000000 +#define PGRAIN_ESP 0x10000000 +#define PGRAIN_IEC 0x08000000 + +/* + * HWREna register + */ +#define HWRENA_ULR 0x20000000u +#define HWRENA_CC 0x00000004u + +#endif /* _KERNEL || _STANDALONE */ + +#endif /* !_MIPS64_CPUREGS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/mips_opcode.h b/lib/libc/include/mips64-openbsd-none/mips64/mips_opcode.h new file mode 100644 index 0000000000000000000000000000000000000000..f40d67885bec9e5d105ae7206fbc53fa0c4ab114 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/mips_opcode.h @@ -0,0 +1,347 @@ +/* $OpenBSD: mips_opcode.h,v 1.9 2017/04/20 15:42:26 visa Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_MIPS_OPCODE_H_ +#define _MIPS64_MIPS_OPCODE_H_ + +/* + * Define the instruction formats and opcode values for the + * MIPS instruction set. + */ + +/* + * Define the instruction formats. + */ +typedef union { + unsigned word; + +#if BYTE_ORDER == BIG_ENDIAN + struct { + unsigned op: 6; + unsigned rs: 5; + unsigned rt: 5; + unsigned imm: 16; + } IType; + + struct { + unsigned op: 6; + unsigned target: 26; + } JType; + + struct { + unsigned op: 6; + unsigned rs: 5; + unsigned rt: 5; + unsigned rd: 5; + unsigned shamt: 5; + unsigned func: 6; + } RType; + + struct { + unsigned op: 6; /* COP1 */ + unsigned : 1; /* always '1' */ + unsigned fmt: 4; + unsigned ft: 5; + unsigned fs: 5; + unsigned fd: 5; + unsigned func: 6; + } FRType; + + struct { + unsigned op: 6; /* COP1X */ + unsigned fr: 5; + unsigned ft: 5; + unsigned fs: 5; + unsigned fd: 5; + unsigned op4: 3; + unsigned fmt3: 3; + } FQType; +#endif +#if BYTE_ORDER == LITTLE_ENDIAN + struct { + unsigned imm: 16; + unsigned rt: 5; + unsigned rs: 5; + unsigned op: 6; + } IType; + + struct { + unsigned target: 26; + unsigned op: 6; + } JType; + + struct { + unsigned func: 6; + unsigned shamt: 5; + unsigned rd: 5; + unsigned rt: 5; + unsigned rs: 5; + unsigned op: 6; + } RType; + + struct { + unsigned func: 6; + unsigned fd: 5; + unsigned fs: 5; + unsigned ft: 5; + unsigned fmt: 4; + unsigned : 1; /* always '1' */ + unsigned op: 6; /* COP1 */ + } FRType; + + struct { + unsigned fmt3: 3; + unsigned op4: 3; + unsigned fd: 5; + unsigned fs: 5; + unsigned ft: 5; + unsigned fr: 5; + unsigned op: 6; /* COP1X */ + } FQType; +#endif +} InstFmt; + +/* + * Values for the 'op' field. + */ +#define OP_SPECIAL 000 +#define OP_BCOND 001 +#define OP_J 002 +#define OP_JAL 003 +#define OP_BEQ 004 +#define OP_BNE 005 +#define OP_BLEZ 006 +#define OP_BGTZ 007 + +#define OP_ADDI 010 +#define OP_ADDIU 011 +#define OP_SLTI 012 +#define OP_SLTIU 013 +#define OP_ANDI 014 +#define OP_ORI 015 +#define OP_XORI 016 +#define OP_LUI 017 + +#define OP_COP0 020 +#define OP_COP1 021 +#define OP_COP2 022 +#define OP_COP3 023 +#define OP_COP1X 023 +#define OP_BEQL 024 +#define OP_BNEL 025 +#define OP_BLEZL 026 +#define OP_BGTZL 027 + +#define OP_DADDI 030 +#define OP_DADDIU 031 +#define OP_LDL 032 +#define OP_LDR 033 + +#define OP_SPECIAL3 037 + +#define OP_LB 040 +#define OP_LH 041 +#define OP_LWL 042 +#define OP_LW 043 +#define OP_LBU 044 +#define OP_LHU 045 +#define OP_LWR 046 +#define OP_LWU 047 + +#define OP_SB 050 +#define OP_SH 051 +#define OP_SWL 052 +#define OP_SW 053 +#define OP_SDL 054 +#define OP_SDR 055 +#define OP_SWR 056 +#define OP_CACHE 057 + +#define OP_LL 060 +#define OP_LWC1 061 +#define OP_LWC2 062 +#define OP_LWC3 063 +#define OP_PREF 063 +#define OP_LLD 064 +#define OP_LDC1 065 +#define OP_LDC2 066 +#define OP_LD 067 + +#define OP_SC 070 +#define OP_SWC1 071 +#define OP_SWC2 072 +#define OP_SWC3 073 +#define OP_SCD 074 +#define OP_SDC1 075 +#define OP_SDC2 076 +#define OP_SD 077 + +/* + * Values for the 'func' field when 'op' == OP_SPECIAL. + */ +#define OP_SLL 000 +#define OP_MOVCI 001 +#define OP_SRL 002 +#define OP_SRA 003 +#define OP_SLLV 004 +#define OP_SRLV 006 +#define OP_SRAV 007 + +#define OP_JR 010 +#define OP_JALR 011 +#define OP_MOVZ 012 +#define OP_MOVN 013 +#define OP_SYSCALL 014 +#define OP_BREAK 015 +#define OP_SYNC 017 + +#define OP_MFHI 020 +#define OP_MTHI 021 +#define OP_MFLO 022 +#define OP_MTLO 023 +#define OP_DSLLV 024 +#define OP_DSRLV 026 +#define OP_DSRAV 027 + +#define OP_MULT 030 +#define OP_MULTU 031 +#define OP_DIV 032 +#define OP_DIVU 033 +#define OP_DMULT 034 +#define OP_DMULTU 035 +#define OP_DDIV 036 +#define OP_DDIVU 037 + +#define OP_ADD 040 +#define OP_ADDU 041 +#define OP_SUB 042 +#define OP_SUBU 043 +#define OP_AND 044 +#define OP_OR 045 +#define OP_XOR 046 +#define OP_NOR 047 + +#define OP_SLT 052 +#define OP_SLTU 053 +#define OP_DADD 054 +#define OP_DADDU 055 +#define OP_DSUB 056 +#define OP_DSUBU 057 + +#define OP_TGE 060 +#define OP_TGEU 061 +#define OP_TLT 062 +#define OP_TLTU 063 +#define OP_TEQ 064 +#define OP_TNE 066 + +#define OP_DSLL 070 +#define OP_DSRL 072 +#define OP_DSRA 073 +#define OP_DSLL32 074 +#define OP_DSRL32 076 +#define OP_DSRA32 077 + +/* + * Values for the 'rt' field when 'op' == OP_BCOND. + */ +#define OP_BLTZ 000 +#define OP_BGEZ 001 +#define OP_BLTZL 002 +#define OP_BGEZL 003 + +#define OP_TGEI 010 +#define OP_TGEIU 011 +#define OP_TLTI 012 +#define OP_TLTIU 013 +#define OP_TEQI 014 +#define OP_TNEI 016 + +#define OP_BLTZAL 020 +#define OP_BGEZAL 021 +#define OP_BLTZALL 022 +#define OP_BGEZALL 023 + +/* + * Values for the 'rs' field when 'op' == OP_COPz. + */ +#define OP_MF 000 +#define OP_DMF 001 +#define OP_CF 002 +#define OP_MFH 003 +#define OP_MT 004 +#define OP_DMT 005 +#define OP_CT 006 +#define OP_MTH 007 +#define OP_BC 010 +#define OP_C0MISC 020 /* cop0 only */ +#define OP_TFP_C0MISC 030 /* cop0 only on R8000 */ + +/* + * Values for the 'rt' field when 'op' == OP_COPz. + */ +#define COPz_BC_TF_MASK 0x01 +#define COPz_BC_TRUE 0x01 +#define COPz_BC_FALSE 0x00 +#define COPz_BCL_TF_MASK 0x02 +#define COPz_BCL_TRUE 0x02 +#define COPz_BCL_FALSE 0x00 +#define COPz_BC_CC_MASK 0x1c +#define COPz_BC_CC_SHIFT 2 + +/* + * Values for the 'func' field when 'op' == OP_COP1X. + */ +#define OP_LWXC1 000 +#define OP_LDXC1 001 +#define OP_SWXC1 010 +#define OP_SDXC1 011 +#define OP_PREFX 017 + +/* + * Values for the 'op4' field when 'op' == OP_COP1X. + */ +#define OP_MADD 04 +#define OP_MSUB 05 +#define OP_NMADD 06 +#define OP_NMSUB 07 + +/* + * Values for the 'func' field when 'op' == OP_SPECIAL3. + */ +#define OP_RDHWR 073 + +#endif /* !_MIPS64_MIPS_OPCODE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/mplock.h b/lib/libc/include/mips64-openbsd-none/mips64/mplock.h new file mode 100644 index 0000000000000000000000000000000000000000..a2c480761ec57539f780ccd7e1ccc1fe1ec862a5 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/mplock.h @@ -0,0 +1,10 @@ +/* $OpenBSD: mplock.h,v 1.2 2017/10/21 06:11:22 visa Exp $ */ + +/* public domain */ + +#ifndef _MACHINE_MPLOCK_H_ +#define _MACHINE_MPLOCK_H_ + +#define __USE_MI_MPLOCK + +#endif /* !_MACHINE_MPLOCK_H */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/mutex.h b/lib/libc/include/mips64-openbsd-none/mips64/mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..f5115c3084e8ea620d6739688a599123808004fd --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/mutex.h @@ -0,0 +1,3 @@ +/* $OpenBSD: mutex.h,v 1.5 2018/01/25 15:06:29 mpi Exp $ */ + +#define __USE_MI_MUTEX \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/param.h b/lib/libc/include/mips64-openbsd-none/mips64/param.h new file mode 100644 index 0000000000000000000000000000000000000000..3420605a0d9228d606fd09bbdb5160aa301bf2db --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/param.h @@ -0,0 +1,82 @@ +/* $OpenBSD: param.h,v 1.37 2023/12/14 13:26:49 claudio Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _MIPS64_PARAM_H_ +#define _MIPS64_PARAM_H_ + +#ifdef _KERNEL +#include +#endif + +#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_MASK (PAGE_SIZE - 1) + +#ifdef _KERNEL + +#ifndef KERNBASE +#define KERNBASE 0xffffffff80000000L /* start of kernel virtual */ +#endif + +#define NBPG PAGE_SIZE +#define PGSHIFT PAGE_SHIFT +#define PGOFSET PAGE_MASK + +#define USPACE 16384 +#define UPAGES (USPACE >> PAGE_SHIFT) +#if PAGE_SHIFT > 12 +#define USPACE_ALIGN 0 +#else +#define USPACE_ALIGN (2 * PAGE_SIZE) /* align to an even TLB boundary */ +#endif + +#define NMBCLUSTERS (64 * 1024) /* max cluster allocation */ + +#ifndef MSGBUFSIZE +#if PAGE_SHIFT > 12 +#define MSGBUFSIZE PAGE_SIZE +#else +#define MSGBUFSIZE 8192 +#endif +#endif + +#ifndef _LOCORE +#define DELAY(n) delay(n) +void delay(int); +#endif + +#endif /* _KERNEL */ + +#endif /* _MIPS64_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/pcb.h b/lib/libc/include/mips64-openbsd-none/mips64/pcb.h new file mode 100644 index 0000000000000000000000000000000000000000..bef10d569cdc3045fb198e030b5aaf19c0980151 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/pcb.h @@ -0,0 +1,58 @@ +/* $OpenBSD: pcb.h,v 1.10 2021/10/07 12:40:16 visa Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: pcb.h 1.13 89/04/23 + * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_PCB_H_ +#define _MIPS64_PCB_H_ + +#include + +/* + * MIPS process control block. This is first in the U-area. + */ +struct pcb { + struct trapframe pcb_regs; /* saved CPU and registers */ + struct { + /* val[12] is unused, was RM7000 ICR */ + register_t val[13]; + } pcb_context; /* kernel context for resume */ + int pcb_onfault; /* for copyin/copyout faults */ + void *pcb_segtab; /* copy of pmap pm_segtab */ +}; + +#endif /* !_MIPS64_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/pmap.h b/lib/libc/include/mips64-openbsd-none/mips64/pmap.h new file mode 100644 index 0000000000000000000000000000000000000000..571adc77b869b9340adc271c2ee943bdf6f2cf12 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/pmap.h @@ -0,0 +1,228 @@ +/* $OpenBSD: pmap.h,v 1.55 2025/06/02 18:49:04 claudio Exp $ */ + +/* + * Copyright (c) 1987 Carnegie-Mellon University + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_PMAP_H_ +#define _MIPS64_PMAP_H_ + +#include + +#ifdef _KERNEL + +#include + +/* + * The user address space is currently limited to 1TB (0x0 - 0x10000000000). + * + * The user address space is mapped using a two level structure where + * the virtual addresses bits are split in three groups: + * segment:directory:page:offset + * where: + * - offset are the in-page offsets (PAGE_SHIFT bits) + * - page are the third level page table index + * (PMAP_PGSHIFT - Log2(pt_entry_t) bits) + * - directory are the second level page table (directory) index + * (PMAP_PGSHIFT - Log2(void *) bits) + * - segment are the first level page table (segment) index + * (PMAP_PGSHIFT - Log2(void *) bits) + * + * This scheme allows Segment, directory and page tables have the same size + * (1 << PMAP_PGSHIFT bytes, regardless of the pt_entry_t size) to be able to + * share the same allocator. + * + * Note: The kernel doesn't use the same data structures as user programs. + * All the PTE entries are stored in a single array in Sysmap which is + * dynamically allocated at boot time. + */ + +#if defined(MIPS_PTE64) && PAGE_SHIFT == 12 +#error "Cannot use MIPS_PTE64 with 4KB pages." +#endif + +/* + * Size of page table structs (page tables, page directories, + * and segment table) used by this pmap. + */ + +#define PMAP_PGSHIFT 12 +#define PMAP_PGSIZE (1UL << PMAP_PGSHIFT) + +#define NPDEPG (PMAP_PGSIZE / sizeof(void *)) +#define NPTEPG (PMAP_PGSIZE / sizeof(pt_entry_t)) + +/* + * Segment sizes + */ + +#define SEGSHIFT (PAGE_SHIFT+PMAP_PGSHIFT*2-PTE_LOG-3) +#define DIRSHIFT (PAGE_SHIFT+PMAP_PGSHIFT-PTE_LOG) +#define NBSEG (1UL << SEGSHIFT) +#define NBDIR (1UL << DIRSHIFT) +#define SEGOFSET (NBSEG - 1) +#define DIROFSET (NBDIR - 1) + +#define mips_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET) +#define mips_trunc_dir(x) ((vaddr_t)(x) & ~DIROFSET) +#define mips_round_seg(x) (((vaddr_t)(x) + SEGOFSET) & ~SEGOFSET) +#define mips_round_dir(x) (((vaddr_t)(x) + DIROFSET) & ~DIROFSET) +#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)]) + +/* number of segments entries */ +#define PMAP_SEGTABSIZE (PMAP_PGSIZE / sizeof(void *)) + +struct segtab { + pt_entry_t **seg_tab[PMAP_SEGTABSIZE]; +}; + +struct pmap_asid_info { + u_int pma_asid; /* address space tag */ + u_int pma_asidgen; /* TLB PID generation number */ +}; + +/* + * Machine dependent pmap structure. + */ +typedef struct pmap { + struct mutex pm_mtx; /* pmap lock */ + struct mutex pm_swmtx; /* pmap switch lock */ + int pm_count; /* pmap reference count */ + struct pmap_statistics pm_stats; /* pmap statistics */ + struct segtab *pm_segtab; /* pointers to pages of PTEs */ + struct pmap_asid_info pm_asid[1]; /* ASID information */ +} *pmap_t; + +/* + * Compute the sizeof of a pmap structure. Subtract one because one + * ASID info structure is already included in the pmap structure itself. + */ +#define PMAP_SIZEOF(x) \ + (ALIGN(sizeof(struct pmap) + \ + (sizeof(struct pmap_asid_info) * ((x) - 1)))) + +/* machine-dependent pg_flags */ +#define PGF_UNCACHED PG_PMAP0 /* Page is explicitly uncached */ +#define PGF_CACHED PG_PMAP1 /* Page is currently cached */ +#define PGF_ATTR_MOD PG_PMAP2 +#define PGF_ATTR_REF PG_PMAP3 +#define PGF_PRESERVE (PGF_ATTR_MOD | PGF_ATTR_REF) + +#define PMAP_NOCACHE PMAP_MD0 + +extern struct pmap *const kernel_pmap_ptr; + +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) +#define pmap_kernel() (kernel_pmap_ptr) + +extern pt_entry_t pg_ri; +#define PMAP_CHECK_COPYIN (pg_ri == 0) + +#define PMAP_STEAL_MEMORY /* Enable 'stealing' during boot */ + +#define PMAP_PREFER +extern vaddr_t pmap_prefer_mask; +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() \ + (pmap_prefer_mask ? pmap_prefer_mask + 1 : 0) +/* pmap prefer offset in alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) & pmap_prefer_mask) + +void pmap_bootstrap(void); +int pmap_copyinsn(pmap_t, vaddr_t, uint32_t *); +int pmap_emulate_modify(pmap_t, vaddr_t); +void pmap_page_cache(vm_page_t, u_int); + +#define pmap_init_percpu() do { /* nothing */ } while (0) +#define pmap_unuse_final(p) do { /* nothing yet */ } while (0) +#define pmap_remove_holes(vm) do { /* nothing */ } while (0) + +#define __HAVE_PMAP_DIRECT +vaddr_t pmap_map_direct(vm_page_t); +vm_page_t pmap_unmap_direct(vaddr_t); + +/* + * MD flags to pmap_enter: + */ + +#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK) + +/* Kernel virtual address to page table entry */ +#define kvtopte(va) \ + (Sysmap + (((vaddr_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT)) +/* User virtual address to pte page entry */ +#define uvtopte(va) (((va) >> PAGE_SHIFT) & (NPTEPG -1)) +#define uvtopde(va) (((va) >> DIRSHIFT) & (NPDEPG - 1)) + +static inline pt_entry_t * +pmap_pte_lookup(struct pmap *pmap, vaddr_t va) +{ + pt_entry_t **pde, *pte; + + if ((pde = pmap_segmap(pmap, va)) == NULL) + return NULL; + if ((pte = pde[uvtopde(va)]) == NULL) + return NULL; + return pte + uvtopte(va); +} + +extern pt_entry_t *Sysmap; /* kernel pte table */ +extern u_int Sysmapsize; /* number of pte's in Sysmap */ + +#endif /* _KERNEL */ + +#if !defined(_LOCORE) +typedef struct pv_entry { + struct pv_entry *pv_next; /* next pv_entry */ + struct pmap *pv_pmap; /* pmap where mapping lies */ + vaddr_t pv_va; /* virtual address for mapping */ +} *pv_entry_t; + +struct vm_page_md { + struct mutex pv_mtx; /* pv list lock */ + struct pv_entry pv_ent; /* pv list of this seg */ +}; + +#define VM_MDPAGE_INIT(pg) \ + do { \ + mtx_init(&(pg)->mdpage.pv_mtx, IPL_VM); \ + (pg)->mdpage.pv_ent.pv_next = NULL; \ + (pg)->mdpage.pv_ent.pv_pmap = NULL; \ + (pg)->mdpage.pv_ent.pv_va = 0; \ + } while (0) + +#endif /* !_LOCORE */ + +#endif /* !_MIPS64_PMAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/proc.h b/lib/libc/include/mips64-openbsd-none/mips64/proc.h new file mode 100644 index 0000000000000000000000000000000000000000..987d27cd4bfba46fb538643ed9493333ea761049 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/proc.h @@ -0,0 +1,75 @@ +/* $OpenBSD: proc.h,v 1.11 2017/04/13 03:52:25 guenther Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)proc.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_PROC_H_ +#define _MIPS64_PROC_H_ + +/* + * Machine-dependent part of the proc structure. + */ +struct mdproc { + struct trapframe *md_regs; /* registers on current frame */ + volatile int md_astpending; /* AST pending for this process */ + int md_flags; /* machine-dependent flags */ + vaddr_t md_uarea; /* allocated uarea virtual addr */ + void *md_tcb; /* user-space thread-control-block */ + + /* ptrace fields */ + vaddr_t md_ss_addr; /* single step address */ + uint32_t md_ss_instr; /* saved single step instruction */ + + /* fpu emulation fields */ + vaddr_t md_fppgva; /* vaddr of the branch emulation page */ + vaddr_t md_fpbranchva; /* vaddr of fp branch destination */ + vaddr_t md_fpslotva; /* initial vaddr of delay slot */ + + int32_t md_obsolete[10]; /* Were RM7000-specific data. */ +}; + +/* + * Values for md_flags. + * MDP_FPUSED has two meanings: if the floating point hardware (coprocessor + * #1) is available, it means it has been used; if there is no floating + * point hardware, it means the process is currently running a duplicated + * delay slot, created by the branch emulation logic. + */ +#define MDP_FPUSED 0x00000001 /* floating point coprocessor used */ +#define MDP_PERF 0x00010000 /* Performance counter used */ +#define MDP_WATCH1 0x00020000 /* Watch register 1 used */ +#define MDP_WATCH2 0x00040000 /* Watch register 1 used */ +#define MDP_FORKSAVE 0x0000ffff /* Flags to save when forking */ + +#endif /* !_MIPS64_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/profile.h b/lib/libc/include/mips64-openbsd-none/mips64/profile.h new file mode 100644 index 0000000000000000000000000000000000000000..09470a2561e34ffdac7a252355a2a995e418919f --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/profile.h @@ -0,0 +1,85 @@ +/* $OpenBSD: profile.h,v 1.5 2019/04/19 09:19:22 visa Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)profile.h 8.1 (Berkeley) 6/10/93 + */ +#ifndef _MIPS64_PROFILE_H_ +#define _MIPS64_PROFILE_H_ + +#define _MCOUNT_DECL static void ___mcount + +/*XXX The cprestore instruction is a "dummy" to shut up as(1). */ + +#define MCOUNT \ + __asm(".globl _mcount;" \ + ".type _mcount,@function;" \ + "_mcount:;" \ + ".set noreorder;" \ + ".set noat;" \ + ".cpload $25;" \ + ".cprestore 4;" \ + "sd $4,16($29);" \ + "sd $5,24($29);" \ + "sd $6,32($29);" \ + "sd $7,40($29);" \ + "sd $1,0($29);" \ + "sd $31,8($29);" \ + "move $5,$31;" \ + ".local ___mcount;" \ + "jal ___mcount;" \ + "move $4,$1;" \ + "ld $4,16($29);" \ + "ld $5,24($29);" \ + "ld $6,32($29);" \ + "ld $7,40($29);" \ + "ld $31,8($29);" \ + "ld $1,0($29);" \ + "daddu $29,$29,16;" \ + "j $31;" \ + "move $31,$1;" \ + ".set reorder;" \ + ".set at"); + +#ifdef _KERNEL +/* + * The following two macros do splhigh and splx respectively. + * They have to be defined this way because these are real + * functions on the MIPS, and we do not want to invoke mcount + * recursively. + */ +#define MCOUNT_ENTER s = _splhigh() + +#define MCOUNT_EXIT _splx(s) +#endif /* _KERNEL */ + +#endif /* !_MIPS64_PROFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/pte.h b/lib/libc/include/mips64-openbsd-none/mips64/pte.h new file mode 100644 index 0000000000000000000000000000000000000000..cc5c5d0ba198b041dc169db65c8cd5e83b891cd0 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/pte.h @@ -0,0 +1,160 @@ +/* $OpenBSD: pte.h,v 1.24 2023/01/11 03:17:56 visa Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: pte.h 1.11 89/09/03 + * from: @(#)pte.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * R4000 and R8000 hardware page table entries + */ + +#ifndef _MIPS64_PTE_H_ +#define _MIPS64_PTE_H_ + +#ifndef _LOCORE + +/* + * Structure defining a TLB entry data set. + */ +struct tlb_entry { + u_int64_t tlb_mask; + u_int64_t tlb_hi; + u_int64_t tlb_lo0; + u_int64_t tlb_lo1; +}; + +u_int tlb_get_pid(void); +void tlb_read(unsigned int, struct tlb_entry *); + +#ifdef MIPS_PTE64 +typedef u_int64_t pt_entry_t; +#else +typedef u_int32_t pt_entry_t; +#endif + +#endif /* _LOCORE */ + +#ifdef MIPS_PTE64 +#define PTE_BITS 64 +#define PTE_LOAD ld +#define PTE_LOG 3 +#define PTE_OFFS 8 +#else +#define PTE_BITS 32 +#define PTE_LOAD lwu +#define PTE_LOG 2 +#define PTE_OFFS 4 +#endif + +#if defined(CPU_MIPS64R2) && !defined(CPU_LOONGSON2) +#define PTE_CLEAR_SWBITS(reg) \ + .set push; \ + .set mips64r2; \ + /* Clear SW bits between PG_XI and PG_FRAMEBITS. */ \ + dins reg, zero, PG_FRAMEBITS, (PTE_BITS - 2 - PG_FRAMEBITS); \ + .set pop +#else +#define PTE_CLEAR_SWBITS(reg) \ + /* Clear SW bits left of PG_FRAMEBITS. */ \ + dsll reg, reg, (64 - PG_FRAMEBITS); \ + dsrl reg, reg, (64 - PG_FRAMEBITS) +#endif + +/* entryhi values */ + +#define PG_HVPN (-2 * PAGE_SIZE) /* Hardware page number mask */ +#define PG_ODDPG PAGE_SIZE + +/* Address space ID */ +#define PG_ASID_MASK 0x00000000000000ff +#define PG_ASID_SHIFT 0 +#define MIN_USER_ASID 1 +#define PG_ASID_COUNT 256 /* Number of available ASID */ + +/* entrylo values */ + +#ifdef MIPS_PTE64 +#define PG_FRAMEBITS 60 +#else +#define PG_FRAMEBITS 28 +#endif +#define PG_FRAME ((1ULL << PG_FRAMEBITS) - (1ULL << PG_SHIFT)) +#define PG_SHIFT 6 + +/* software pte bits - not put in entrylo */ +#define PG_WIRED (1ULL << (PG_FRAMEBITS + 1)) +#define PG_RO (1ULL << (PG_FRAMEBITS + 0)) + +#ifdef CPU_MIPS64R2 +#define PG_RI (1ULL << (PG_FRAMEBITS + 3)) +#define PG_XI (1ULL << (PG_FRAMEBITS + 2)) +#else +#define PG_RI 0x00000000 +#define PG_XI 0x00000000 +#endif + +#define PG_NV 0x00000000 +#define PG_G 0x00000001 +#define PG_V 0x00000002 +#define PG_M 0x00000004 +#define PG_CCA_SHIFT 3 + +#define PG_UNCACHED (CCA_NC << PG_CCA_SHIFT) +#define PG_CACHED_NC (CCA_NONCOHERENT << PG_CCA_SHIFT) +#define PG_CACHED_CE (CCA_COHERENT_EXCL << PG_CCA_SHIFT) +#define PG_CACHED_CEW (CCA_COHERENT_EXCLWRITE << PG_CCA_SHIFT) +#define PG_CACHED (CCA_CACHED << PG_CCA_SHIFT) +#define PG_CACHEMODE (7 << PG_CCA_SHIFT) + +#define PG_PROTMASK (PG_M | PG_RO | PG_RI | PG_XI) + +#define pfn_to_pad(pa) ((((paddr_t)pa) & PG_FRAME) << PG_SHIFT) +#define vad_to_pfn(va) (((va) >> PG_SHIFT) & PG_FRAME) + +#define PG_SIZE_4K 0x00000000 +#define PG_SIZE_16K 0x00006000 +#define PG_SIZE_64K 0x0001e000 +#define PG_SIZE_256K 0x0007e000 +#define PG_SIZE_1M 0x001fe000 +#define PG_SIZE_4M 0x007fe000 +#define PG_SIZE_16M 0x01ffe000 +#if PAGE_SHIFT == 12 +#define TLB_PAGE_MASK PG_SIZE_4K +#elif PAGE_SHIFT == 14 +#define TLB_PAGE_MASK PG_SIZE_16K +#endif + +#endif /* !_MIPS64_PTE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/ptrace.h b/lib/libc/include/mips64-openbsd-none/mips64/ptrace.h new file mode 100644 index 0000000000000000000000000000000000000000..000251046bc02a091b0d82f010cccf8372ea3531 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/ptrace.h @@ -0,0 +1,46 @@ +/* $OpenBSD: ptrace.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_PTRACE_H_ +#define _MIPS64_PTRACE_H_ + +/* + * Machine dependent trace commands. + * + */ + +#define PT_GETREGS (PT_FIRSTMACH+0) +#define PT_SETREGS (PT_FIRSTMACH+1) +#define PT_STEP (PT_FIRSTMACH+2) + +#endif /* !_MIPS64_PTRACE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/reg.h b/lib/libc/include/mips64-openbsd-none/mips64/reg.h new file mode 100644 index 0000000000000000000000000000000000000000..38245604ff42012a86bcce96432b6c6409a8da97 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/reg.h @@ -0,0 +1,54 @@ +/* $OpenBSD: reg.h,v 1.5 2021/10/07 12:32:10 visa Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: reg.h 1.1 90/07/09 + * @(#)reg.h 8.2 (Berkeley) 1/11/94 + */ + +#ifndef _MIPS64_REG_H_ +#define _MIPS64_REG_H_ +/* + * Location of the users' stored + * registers relative to ZERO. + * Usage is p->p_regs[XX]. + * + * must be visible to assembly code. + */ +#include + +struct reg { + register_t r_regs[NREGS]; /* numbered as above */ +}; +#endif /* !_MIPS64_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/regdef.h b/lib/libc/include/mips64-openbsd-none/mips64/regdef.h new file mode 100644 index 0000000000000000000000000000000000000000..27c56a035a292209a8b5fd35e0be820f73040012 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/regdef.h @@ -0,0 +1,77 @@ +/* $OpenBSD: regdef.h,v 1.5 2014/03/10 21:10:36 miod Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. This file is derived from the MIPS RISC + * Architecture book by Gerry Kane. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regdef.h 8.1 (Berkeley) 6/10/93 + */ +#ifndef _MIPS64_REGDEF_H_ +#define _MIPS64_REGDEF_H_ + +#define zero $0 /* always zero */ +#define AT $at /* assembler temp */ +#define v0 $2 /* return value */ +#define v1 $3 +#define a0 $4 /* argument registers */ +#define a1 $5 +#define a2 $6 +#define a3 $7 +#define a4 $8 +#define a5 $9 +#define a6 $10 +#define a7 $11 +#define ta0 $8 /* alias */ +#define ta1 $9 +#define ta2 $10 +#define ta3 $11 +#define t0 $12 /* temp registers (not saved across subroutine calls) */ +#define t1 $13 +#define t2 $14 +#define t3 $15 +#define s0 $16 /* saved across subroutine calls (callee saved) */ +#define s1 $17 +#define s2 $18 +#define s3 $19 +#define s4 $20 +#define s5 $21 +#define s6 $22 +#define s7 $23 +#define t8 $24 /* two more temp registers */ +#define t9 $25 +#define k0 $26 /* kernel temporary */ +#define k1 $27 +#define gp $28 /* global pointer */ +#define sp $29 /* stack pointer */ +#define s8 $30 /* one more callee saved */ +#define ra $31 /* return address */ + +#endif /* !_MIPS64_REGDEF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/regnum.h b/lib/libc/include/mips64-openbsd-none/mips64/regnum.h new file mode 100644 index 0000000000000000000000000000000000000000..f11f05e222ff95c9151c83a288e6e93d1fe31f57 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/regnum.h @@ -0,0 +1,119 @@ +/* $OpenBSD: regnum.h,v 1.4 2014/07/09 12:58:08 miod Exp $ */ + +/* + * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_REGNUM_H_ +#define _MIPS64_REGNUM_H_ + +/* + * Location of the saved registers relative to ZERO. + * Usage is p->p_regs[XX]. + */ +#define ZERO 0 +#define AST 1 +#define V0 2 +#define V1 3 +#define A0 4 +#define A1 5 +#define A2 6 +#define A3 7 +#define A4 8 +#define A5 9 +#define A6 10 +#define A7 11 +#define T0 12 +#define T1 13 +#define T2 14 +#define T3 15 +#define S0 16 +#define S1 17 +#define S2 18 +#define S3 19 +#define S4 20 +#define S5 21 +#define S6 22 +#define S7 23 +#define T8 24 +#define T9 25 +#define K0 26 +#define K1 27 +#define GP 28 +#define SP 29 +#define S8 30 +#define RA 31 +#define SR 32 +#define PS SR /* alias for SR */ +#define MULLO 33 +#define MULHI 34 +#define BADVADDR 35 +#define CAUSE 36 +#define PC 37 +#define IC 38 +#define CPL 39 + +#define NUMSAVEREGS 40 /* Number of registers saved in trap */ + +#define FPBASE NUMSAVEREGS +#define F0 (FPBASE+0) +#define F1 (FPBASE+1) +#define F2 (FPBASE+2) +#define F3 (FPBASE+3) +#define F4 (FPBASE+4) +#define F5 (FPBASE+5) +#define F6 (FPBASE+6) +#define F7 (FPBASE+7) +#define F8 (FPBASE+8) +#define F9 (FPBASE+9) +#define F10 (FPBASE+10) +#define F11 (FPBASE+11) +#define F12 (FPBASE+12) +#define F13 (FPBASE+13) +#define F14 (FPBASE+14) +#define F15 (FPBASE+15) +#define F16 (FPBASE+16) +#define F17 (FPBASE+17) +#define F18 (FPBASE+18) +#define F19 (FPBASE+19) +#define F20 (FPBASE+20) +#define F21 (FPBASE+21) +#define F22 (FPBASE+22) +#define F23 (FPBASE+23) +#define F24 (FPBASE+24) +#define F25 (FPBASE+25) +#define F26 (FPBASE+26) +#define F27 (FPBASE+27) +#define F28 (FPBASE+28) +#define F29 (FPBASE+29) +#define F30 (FPBASE+30) +#define F31 (FPBASE+31) +#define FSR (FPBASE+32) + +#define NUMFPREGS 33 + +#define NREGS (NUMSAVEREGS + NUMFPREGS) + +#endif /* !_MIPS64_REGNUM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/reloc.h b/lib/libc/include/mips64-openbsd-none/mips64/reloc.h new file mode 100644 index 0000000000000000000000000000000000000000..c25f3c163d7f1973a1f7dd4262efa9115220a965 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/reloc.h @@ -0,0 +1,54 @@ +/* $OpenBSD: reloc.h,v 1.4 2017/08/13 14:56:09 visa Exp $ */ + +/* + * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _MIPS64_RELOC_H_ +#define _MIPS64_RELOC_H_ + +/* + * Mips relocations. + */ + +#define R_MIPS_NONE 0 /* No reloc */ +#define R_MIPS_16 1 /* Direct 16 bit */ +#define R_MIPS_32 2 /* Direct 32 bit */ +#define R_MIPS_REL32 3 /* PC relative 32 bit */ +#define R_MIPS_26 4 /* Direct 26 bit shifted */ +#define R_MIPS_HI16 5 /* High 16 bit */ +#define R_MIPS_LO16 6 /* Low 16 bit */ +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ +#define R_MIPS_PC16 10 /* PC relative 16 bit */ +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ + +#define R_MIPS_64 18 + +#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32) + +#endif /* !_MIPS64_RELOC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/setjmp.h b/lib/libc/include/mips64-openbsd-none/mips64/setjmp.h new file mode 100644 index 0000000000000000000000000000000000000000..a7f81372b643302cec43055dff972df20b878c8b --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/setjmp.h @@ -0,0 +1,15 @@ +/* $OpenBSD: setjmp.h,v 1.4 2018/01/08 16:44:32 visa Exp $ */ + +/* Public domain */ + +#ifndef _MIPS64_SETJMP_H_ +#define _MIPS64_SETJMP_H_ + +#define _JB_MASK (1 * REGSZ) +#define _JB_PC (2 * REGSZ) +#define _JB_REGS (3 * REGSZ) +#define _JB_FPREGS (37 * REGSZ) + +#define _JBLEN 83 /* size, in longs, of a jmp_buf */ + +#endif /* !_MIPS64_SETJMP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/signal.h b/lib/libc/include/mips64-openbsd-none/mips64/signal.h new file mode 100644 index 0000000000000000000000000000000000000000..2d6f9c1ad86f5a5ea70e7c97c2098378cdbd5226 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/signal.h @@ -0,0 +1,70 @@ +/* $OpenBSD: signal.h,v 1.13 2018/01/08 16:44:32 visa Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)signal.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_SIGNAL_H_ +#define _MIPS64_SIGNAL_H_ + +#include +#include + +/* + * Machine-dependent signal definitions + */ +typedef int sig_atomic_t; + +#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 +/* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * execution of the signal handler. It is also made available + * to the handler to allow it to restore state properly if + * a non-standard exit is performed. + */ +struct sigcontext { + long sc_cookie; + long sc_mask; /* signal mask to restore XXX should be int */ + __register_t sc_pc; /* pc at time of signal */ + __register_t sc_regs[32]; /* processor regs 0 to 31 */ + __register_t mullo; /* mullo and mulhi registers... */ + __register_t mulhi; /* mullo and mulhi registers... */ + f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */ + long sc_fpused; /* fp has been used */ + long sc_fpc_eir; /* floating point exception instruction reg */ + long xxx[8]; /* XXX reserved */ +}; +#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */ + +#endif /* !_MIPS64_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/spinlock.h b/lib/libc/include/mips64-openbsd-none/mips64/spinlock.h new file mode 100644 index 0000000000000000000000000000000000000000..4ca59f45178112695da6a091194d2f066bcdfa96 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/spinlock.h @@ -0,0 +1,11 @@ +/* $OpenBSD: spinlock.h,v 1.5 2017/09/05 02:40:54 guenther Exp $ */ + /* Public domain */ + +#ifndef _MIPS64_SPINLOCK_H_ +#define _MIPS64_SPINLOCK_H_ + +#define _ATOMIC_LOCK_UNLOCKED (0) +#define _ATOMIC_LOCK_LOCKED (1) +typedef int _atomic_lock_t; + +#endif /* !_MIPS64_SPINLOCK_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/sysarch.h b/lib/libc/include/mips64-openbsd-none/mips64/sysarch.h new file mode 100644 index 0000000000000000000000000000000000000000..04171b7d5d6a11c23c0b137c931123ee82fc4379 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/sysarch.h @@ -0,0 +1,52 @@ +/* $OpenBSD: sysarch.h,v 1.2 2012/12/05 23:20:13 deraadt Exp $ */ + +/* + * Copyright (c) 2009 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_SYSARCH_H_ +#define _MIPS64_SYSARCH_H_ + +/* + * Architecture specific syscalls (mips64) + */ + +#define MIPS64_CACHEFLUSH 0 + +/* + * Argument structure and defines to mimic IRIX cacheflush() system call + */ + +struct mips64_cacheflush_args { + vaddr_t va; + size_t sz; + int which; +#define ICACHE 0x01 +#define DCACHE 0x02 +#define BCACHE (ICACHE | DCACHE) +}; + +#ifndef _KERNEL + +#include + +__BEGIN_DECLS +int cacheflush(void *, int, int); +int _flush_cache(char *, int, int); +int sysarch(int, void *); +__END_DECLS +#endif /* _KERNEL */ + +#endif /* _MIPS64_SYSARCH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/tcb.h b/lib/libc/include/mips64-openbsd-none/mips64/tcb.h new file mode 100644 index 0000000000000000000000000000000000000000..eb7bf3bce54545b3976cc142a990ae9faf59d4e7 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/tcb.h @@ -0,0 +1,66 @@ +/* $OpenBSD: tcb.h,v 1.4 2017/04/20 16:07:52 visa Exp $ */ + +/* + * Copyright (c) 2011 Philip Guenther + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_TCB_H_ +#define _MACHINE_TCB_H_ + +#ifdef _KERNEL + +static inline void +__mips64_set_tcb(struct proc *p, void *tcb) +{ +#ifdef CPU_MIPS64R2 + extern int cpu_has_userlocal; + + if (cpu_has_userlocal) + cp0_set_userlocal(tcb); +#endif + + p->p_md.md_tcb = tcb; +} + +#define TCB_SET(p, addr) __mips64_set_tcb(p, addr) +#define TCB_GET(p) ((p)->p_md.md_tcb) + +#else /* _KERNEL */ + +/* ELF TLS ABI calls for small TCB, with static TLS data after it */ +#define TLS_VARIANT 1 + +static inline void * +__mips64_get_tcb(void) +{ + void *tcb; + + /* + * This invokes emulation in kernel if the system does not implement + * the RDHWR instruction or the UserLocal register. + */ + __asm__ volatile ( + " .set push\n" + " .set mips64r2\n" + " rdhwr %0, $29\n" + " .set pop\n" : "=r" (tcb)); + return tcb; +} + +#define TCB_GET() __mips64_get_tcb() + +#endif /* _KERNEL */ + +#endif /* _MACHINE_TCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/timetc.h b/lib/libc/include/mips64-openbsd-none/mips64/timetc.h new file mode 100644 index 0000000000000000000000000000000000000000..8d7039b7063c7bcc66723542a76db95f91899541 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/timetc.h @@ -0,0 +1,23 @@ +/* $OpenBSD: timetc.h,v 1.3 2020/07/18 08:37:43 visa Exp $ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MIPS64_TIMETC_H_ +#define _MIPS64_TIMETC_H_ + +#define TC_CP0_COUNT 1 + +#endif /* _MIPS64_TIMETC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/trap.h b/lib/libc/include/mips64-openbsd-none/mips64/trap.h new file mode 100644 index 0000000000000000000000000000000000000000..2fff7cd58444a028f3a5c1251d705d6ae22bf6e5 --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/trap.h @@ -0,0 +1,127 @@ +/* $OpenBSD: trap.h,v 1.17 2022/01/28 16:20:09 visa Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: trap.h 1.1 90/07/09 + * from: @(#)trap.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MIPS64_TRAP_H_ +#define _MIPS64_TRAP_H_ + +/* + * Trap codes (ExcCode in the cause register); also known in trap.c for + * name strings. + */ + +#define T_INT 0 /* Interrupt pending */ +#define T_TLB_MOD 1 /* TLB modified fault */ +#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */ +#define T_TLB_ST_MISS 3 /* TLB miss on a store */ +#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */ +#define T_ADDR_ERR_ST 5 /* Address error on a store */ +#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */ +#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */ +#define T_SYSCALL 8 /* System call */ +#define T_BREAK 9 /* Breakpoint */ +#define T_RES_INST 10 /* Reserved instruction exception */ +#define T_COP_UNUSABLE 11 /* Coprocessor unusable */ +#define T_OVFLOW 12 /* Arithmetic overflow */ +#define T_TRAP 13 /* Trap instruction */ +#define T_VCEI 14 /* R4k Virtual coherency instruction */ +#define T_FPE 15 /* Floating point exception */ +#define T_IWATCH 16 /* R4k Inst. Watch address reference */ +#define T_C2E 18 /* R5k Coprocessor 2 exception */ +#define T_MDMX 22 /* R5k MDMX unusable */ +#define T_DWATCH 23 /* Data Watch address reference */ +#define T_MCHECK 24 /* Machine check */ +#define T_CACHEERR 30 /* Cache error */ +#define T_VCED 31 /* R4k Virtual coherency data */ + +#define T_USER 0x20 /* user-mode flag or'ed with type */ + +/* + * Defines for trap handler catching kernel accessing memory. + */ +#define KT_COPYERR 1 /* User space copy error */ +#define KT_KCOPYERR 2 /* Kernel space copy error */ +#define KT_DDBERR 3 /* DDB access error */ + +#ifndef _LOCORE + +#if defined(DDB) || defined(DEBUG) + +struct trapdebug { /* trap history buffer for debugging */ + register_t status; + register_t cause; + register_t vadr; + register_t pc; + register_t ra; + register_t sp; + u_int code; + u_int ipl; +}; + +#define trapdebug_enter(ci, frame, cd) \ +do { \ + register_t sr = disableintr(); \ + u_long cpuid = ci->ci_cpuid; \ + struct trapdebug *t; \ + \ + t = trapdebug + TRAPSIZE * cpuid + trppos[cpuid]; \ + t->status = frame->sr; \ + t->cause = frame->cause; \ + t->vadr = frame->badvaddr; \ + t->pc = frame->pc; \ + t->sp = frame->sp; \ + t->ra = frame->ra; \ + t->ipl = frame->ipl; \ + t->code = cd; \ + if (++trppos[cpuid] == TRAPSIZE) \ + trppos[cpuid] = 0; \ + setsr(sr); \ +} while (0) + +#define TRAPSIZE 10 /* Trap log buffer length */ +extern struct trapdebug trapdebug[MAXCPUS * TRAPSIZE]; +extern uint trppos[MAXCPUS]; + +void trapDump(const char *, int (*)(const char *, ...)); + +#else +#define trapdebug_enter(ci, frame, code) +#endif +#endif /* _LOCORE */ + +#endif /* !_MIPS64_TRAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/mips64/vmparam.h b/lib/libc/include/mips64-openbsd-none/mips64/vmparam.h new file mode 100644 index 0000000000000000000000000000000000000000..64dbaaabb8f0d2e33dfdcde3385a34dc5b22a30f --- /dev/null +++ b/lib/libc/include/mips64-openbsd-none/mips64/vmparam.h @@ -0,0 +1,115 @@ +/* $OpenBSD: vmparam.h,v 1.31 2023/11/16 13:47:22 deraadt Exp $ */ +/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: vmparam.h 1.16 91/01/18 + * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 + */ + +#ifndef _MIPS64_VMPARAM_H_ +#define _MIPS64_VMPARAM_H_ + +/* + * Machine dependent constants mips processors. + */ + +#define USRSTACK VM_MAXUSER_ADDRESS /* Start of user stack */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (128*1024*1024) /* max text size */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (128*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (16UL*1024*1024*1024) /* max data size */ +#endif +#ifndef BRKSIZ +#define BRKSIZ MAXDSIZ /* heap gap size */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (2*1024*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ (32*1024*1024) /* max stack size */ +#endif + +#define STACKGAP_RANDOM 256*1024 + +/* + * PTEs for mapping user space into the kernel for physio operations. + * 16 pte's are enough to cover 8 disks * MAXBSIZE. + */ +#ifndef USRIOSIZE +#define USRIOSIZE 32 +#endif + +/* + * PTEs for system V style shared memory. + * This is basically slop for kmempt which we actually allocate (malloc) from. + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 8192 /* 8mb */ +#endif + +#ifndef VM_PHYSSEG_MAX +#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */ +#endif +#ifndef VM_PHYSSEG_STRAT +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH +#endif +#define VM_PHYSSEG_NOADD + +/* user/kernel map constants */ +#define VM_MIN_ADDRESS ((vaddr_t)0x0000000000004000L) +#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000010000000000L) +#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#ifdef _KERNEL +#define VM_MIN_STACK_ADDRESS ((vaddr_t)0x000000c000000000L) +#endif +#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc000000000000000L) +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xc000000040000000L) + +/* map PIE into approximately the first quarter of user va space */ +#define VM_PIE_MIN_ADDR PAGE_SIZE +#define VM_PIE_MAX_ADDR (0x4000000000UL) + +/* virtual sizes (bytes) for various kernel submaps */ +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) + +#endif /* !_MIPS64_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h b/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h index 14faf6c185d4774e1375b1e04165437d0e9c297b..482ffa78db08f91d624afbf750e25be29bfa3bba 100644 --- a/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h +++ b/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.56 2026/07/13 13:41:25 kirill Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -96,7 +96,7 @@ struct octeon_config { #define OCTEON_POOL_NELEMS_PKT 4096 #define OCTEON_POOL_NELEMS_WQE 4096 -#define OCTEON_POOL_NELEMS_CMD 32 +#define OCTEON_POOL_NELEMS_CMD 256 #define OCTEON_POOL_NELEMS_SG 4096 #define OCTEON_POOL_NELEMS_XXX_4 0 #define OCTEON_POOL_NELEMS_XXX_5 0 diff --git a/lib/libc/include/mips64el-openbsd-none/frame.h b/lib/libc/include/mips64el-openbsd-none/frame.h deleted file mode 100644 index d14827e33c0e4797ab96d1648b847715e058d110..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/frame.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/_float.h b/lib/libc/include/mips64el-openbsd-none/loongson/_float.h deleted file mode 100644 index 6c9717939fcba76197bbb74f2517fbf45ecfe782..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/_float.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/_types.h b/lib/libc/include/mips64el-openbsd-none/loongson/_types.h deleted file mode 100644 index 327e3d3e38ff025d3e5bc0b211c50354c5887659..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _types.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h b/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h deleted file mode 100644 index 6e12da5dc5156fdd65bd30db86544c07540d1233..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h +++ /dev/null @@ -1,127 +0,0 @@ -/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */ - -/* - * Copyright (c) 2001 Alexander Guy - * Copyright (c) 1995 John T. Kohl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef _MACHINE_APMVAR_H_ -#define _MACHINE_APMVAR_H_ - -#include - -/* Advanced Power Management (v1.0 and v1.1 specification) - * functions/defines/etc. - */ - -/* These definitions make up the heart of the user-land interface - * to the APM devices. - */ - -#define APM_AC_OFF 0x00 -#define APM_AC_ON 0x01 -#define APM_AC_BACKUP 0x02 -#define APM_AC_UNKNOWN 0xff -#define APM_BATT_HIGH 0x00 -#define APM_BATT_LOW 0x01 -#define APM_BATT_CRITICAL 0x02 -#define APM_BATT_CHARGING 0x03 -#define APM_BATT_UNKNOWN 0xff -#define APM_BATT_LIFE_UNKNOWN 0xff - -#define APM_NOEVENT 0x0000 -#define APM_STANDBY_REQ 0x0001 -#define APM_SUSPEND_REQ 0x0002 -#define APM_NORMAL_RESUME 0x0003 -#define APM_CRIT_RESUME 0x0004 /* suspend/resume happened - without us */ -#define APM_BATTERY_LOW 0x0005 -#define APM_POWER_CHANGE 0x0006 -#define APM_UPDATE_TIME 0x0007 -#define APM_CRIT_SUSPEND_REQ 0x0008 -#define APM_USER_STANDBY_REQ 0x0009 -#define APM_USER_SUSPEND_REQ 0x000A -#define APM_SYS_STANDBY_RESUME 0x000B -#define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */ -#define APM_USER_HIBERNATE_REQ 0x000D -#define APM_EVENT_MASK 0xffff - -#define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK)) -#define APM_EVENT_TYPE(e) ((e) & APM_EVENT_MASK) -#define APM_EVENT_INDEX(e) ((e) >> 16) - -/* - * LP (Laptop Package) - * - * Copyright (C) 1994 by HOSOKAWA Tatsumi - * - * This software may be used, modified, copied, and distributed, in - * both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its - * use. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - */ - -#define APM_BATTERY_ABSENT 4 - -struct apm_power_info { - u_char battery_state; - u_char ac_state; - u_char battery_life; - u_char spare1; - u_int minutes_left; /* estimate */ - u_int spare2[6]; -}; - -struct apm_ctl { - u_int dev; - u_int mode; -}; - -#define APM_IOC_REJECT _IOW('A', 0, struct apm_event_info) /* reject request # */ -#define APM_IOC_STANDBY _IO('A', 1) /* put system into standby */ -#define APM_IOC_SUSPEND _IO('A', 2) /* put system into suspend */ -#define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info) /* fetch battery state */ -#define APM_IOC_DEV_CTL _IOW('A', 5, struct apm_ctl) /* put device into mode */ -#define APM_IOC_PRN_CTL _IOW('A', 6, int ) /* driver power status msg */ -#define APM_PRINT_ON 0 /* driver power status displayed */ -#define APM_PRINT_OFF 1 /* driver power status not displayed */ -#define APM_PRINT_PCT 2 /* driver power status only displayed - if the percentage changes */ -#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */ -#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */ -#define APM_IOC_HIBERNATE _IO('A', 9) /* put system into hibernate */ - -#ifdef _KERNEL -void apm_setinfohook(int (*)(struct apm_power_info *)); -int apm_record_event(u_int, const char *, const char *); -#endif - -#endif /* _MACHINE_APMVAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/asm.h b/lib/libc/include/mips64el-openbsd-none/loongson/asm.h deleted file mode 100644 index 63eab175139b6d2bd0759f45c617f72e4bbce5da..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/asm.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: asm.h,v 1.2 2016/11/18 15:38:14 visa Exp $ */ -/* public domain */ - -#ifdef MULTIPROCESSOR -#define HW_GET_CPU_INFO(ci, tmp) \ - dmfc0 ci, COP_0_ERROR_PC -#endif - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/atomic.h b/lib/libc/include/mips64el-openbsd-none/loongson/atomic.h deleted file mode 100644 index 19aa2fd4f69b6d46c4242ab34787707f57884869..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/atomic.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: atomic.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/autoconf.h b/lib/libc/include/mips64el-openbsd-none/loongson/autoconf.h deleted file mode 100644 index 7292105a5be85a5d60330b6b3dc1cbd65797fa34..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/autoconf.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $OpenBSD: autoconf.h,v 1.17 2017/05/21 13:00:53 visa Exp $ */ - -/* - * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * Definitions used by autoconfiguration. - */ - -#ifndef _MACHINE_AUTOCONF_H_ -#define _MACHINE_AUTOCONF_H_ - -#include - -struct bonito_config; -struct htb_config; -struct mips_isa_chipset; - -/* - * List of legacy I/O ranges. - */ -struct legacy_io_range { - bus_addr_t start; - bus_size_t end; /* inclusive */ -}; - -/* - * Per platform information. - */ -struct platform { - int system_type; -#define LOONGSON_2E 0x0000 /* Generic Loongson 2E system */ -#define LOONGSON_YEELOONG 0x0001 /* Lemote Yeeloong */ -#define LOONGSON_GDIUM 0x0002 /* EMTEC Gdium Liberty */ -#define LOONGSON_FULOONG 0x0003 /* Lemote Fuloong */ -#define LOONGSON_LYNLOONG 0x0004 /* Lemote Lynloong */ -#define LOONGSON_EBT700 0x0005 /* eBenton EBT700 */ -#define LOONGSON_3A 0x0066 /* Loongson 2Gq or 3A based system */ - - char *vendor; - char *product; - - const struct bonito_config *bonito_config; - const struct htb_config *htb_config; - struct mips_isa_chipset *isa_chipset; - const struct legacy_io_range *legacy_io_ranges; - - void (*setup)(void); - void (*device_register)(struct device *, - void *); - - void (*powerdown)(void); - void (*reset)(void); - int (*suspend)(void); - int (*resume)(void); - -#ifdef MULTIPROCESSOR - void (*config_secondary_cpus)( - struct device *, cfprint_t); - void (*boot_secondary_cpu)( - struct cpu_info *); - int (*ipi_establish)(int (*)(void *), - cpuid_t); - void (*ipi_set)(cpuid_t); - void (*ipi_clear)(cpuid_t); -#endif /* MULTIPROCESSOR */ -}; - -#define LOONGSON_MAXCPUS 16 - -extern const struct platform *sys_platform; -extern void *loongson_videobios; -extern uint loongson_cpumask; -extern uint loongson_ver; -extern int nnodes; - -#ifdef MULTIPROCESSOR -extern uint64_t cpu_spinup_a0; -extern uint64_t cpu_spinup_sp; -#endif - -struct mainbus_attach_args { - const char *maa_name; -}; - -extern struct device *bootdv; -extern char bootdev[]; -extern enum devclass bootdev_class; - -extern bus_space_tag_t early_mem_t; -extern bus_space_tag_t early_io_t; - -#define REGVAL8(x) *((volatile uint8_t *)PHYS_TO_XKPHYS((x), CCA_NC)) -#define REGVAL32(x) *((volatile uint32_t *)PHYS_TO_XKPHYS((x), CCA_NC)) -#define REGVAL64(x) *((volatile uint64_t *)PHYS_TO_XKPHYS((x), CCA_NC)) - -#define REGVAL(x) REGVAL32(x) - -#include - -#endif /* _MACHINE_AUTOCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/bus.h b/lib/libc/include/mips64el-openbsd-none/loongson/bus.h deleted file mode 100644 index 24430920dde3d01df663b8b0efaeecf2cf9e31e8..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/bus.h +++ /dev/null @@ -1,513 +0,0 @@ -/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */ - -/* - * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_BUS_H_ -#define _MACHINE_BUS_H_ - -#ifdef __STDC__ -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#endif - -/* - * Bus access types. - */ -struct mips_bus_space; -typedef u_long bus_addr_t; -typedef u_long bus_size_t; -typedef u_long bus_space_handle_t; -typedef struct mips_bus_space *bus_space_tag_t; - -struct mips_bus_space { - bus_addr_t bus_base; - void *bus_private; - u_int8_t (*_space_read_1)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_1)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int8_t); - u_int16_t (*_space_read_2)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_2)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int16_t); - u_int32_t (*_space_read_4)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_4)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int32_t); - u_int64_t (*_space_read_8)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_8)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int64_t); - void (*_space_read_raw_2)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_2)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - void (*_space_read_raw_4)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_4)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - void (*_space_read_raw_8)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_8)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - int (*_space_map)(bus_space_tag_t , bus_addr_t, - bus_size_t, int, bus_space_handle_t *); - void (*_space_unmap)(bus_space_tag_t, bus_space_handle_t, - bus_size_t); - int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t, - bus_size_t, bus_size_t, bus_space_handle_t *); - void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t); - paddr_t (*_space_mmap)(bus_space_tag_t, bus_addr_t, off_t, - int, int); -}; - -#define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o)) -#define bus_space_read_2(t, h, o) (*(t)->_space_read_2)((t), (h), (o)) -#define bus_space_read_4(t, h, o) (*(t)->_space_read_4)((t), (h), (o)) -#define bus_space_read_8(t, h, o) (*(t)->_space_read_8)((t), (h), (o)) - -#define bus_space_write_1(t, h, o, v) (*(t)->_space_write_1)((t), (h), (o), (v)) -#define bus_space_write_2(t, h, o, v) (*(t)->_space_write_2)((t), (h), (o), (v)) -#define bus_space_write_4(t, h, o, v) (*(t)->_space_write_4)((t), (h), (o), (v)) -#define bus_space_write_8(t, h, o, v) (*(t)->_space_write_8)((t), (h), (o), (v)) - -#define bus_space_read_raw_multi_2(t, h, a, b, l) \ - (*(t)->_space_read_raw_2)((t), (h), (a), (b), (l)) -#define bus_space_read_raw_multi_4(t, h, a, b, l) \ - (*(t)->_space_read_raw_4)((t), (h), (a), (b), (l)) -#define bus_space_read_raw_multi_8(t, h, a, b, l) \ - (*(t)->_space_read_raw_8)((t), (h), (a), (b), (l)) - -#define bus_space_write_raw_multi_2(t, h, a, b, l) \ - (*(t)->_space_write_raw_2)((t), (h), (a), (b), (l)) -#define bus_space_write_raw_multi_4(t, h, a, b, l) \ - (*(t)->_space_write_raw_4)((t), (h), (a), (b), (l)) -#define bus_space_write_raw_multi_8(t, h, a, b, l) \ - (*(t)->_space_write_raw_8)((t), (h), (a), (b), (l)) - -#define bus_space_map(t, o, s, c, p) (*(t)->_space_map)((t), (o), (s), (c), (p)) -#define bus_space_unmap(t, h, s) (*(t)->_space_unmap)((t), (h), (s)) -#define bus_space_subregion(t, h, o, s, p) \ - (*(t)->_space_subregion)((t), (h), (o), (s), (p)) - -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 -#define BUS_SPACE_MAP_PREFETCHABLE 0x04 - -#define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h)) -#define bus_space_mmap(t, a, o, p, f) \ - (*(t)->_space_mmap)((t), (a), (o), (p), (f)) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_multi(n,m) \ -static __inline void \ -CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t o, CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, o); \ -} - -bus_space_read_multi(1,8) -bus_space_read_multi(2,16) -bus_space_read_multi(4,32) -bus_space_read_multi(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_region(n,m) \ -static __inline void \ -CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) { \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ - ba += (n); \ - } \ -} - -bus_space_read_region(1,8) -bus_space_read_region(2,16) -bus_space_read_region(4,32) -bus_space_read_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_raw_region(n,m) \ -static __inline void \ -CAT(bus_space_read_raw_region_,n)(bus_space_tag_t bst, \ - bus_space_handle_t bsh, \ - bus_addr_t ba, u_int8_t *x, size_t cnt) \ -{ \ - cnt >>= ((n) >> 1); \ - while (cnt--) { \ - CAT(bus_space_read_raw_multi_,n)(bst, bsh, ba, x, (n)); \ - ba += (n); \ - x += (n); \ - } \ -} - -bus_space_read_raw_region(2,16) -bus_space_read_raw_region(4,32) -bus_space_read_raw_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_multi(n,m) \ -static __inline void \ -CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) \ - CAT(bus_space_write_,n)(bst, bsh, o, *x++); \ -} - -bus_space_write_multi(1,8) -bus_space_write_multi(2,16) -bus_space_write_multi(4,32) -bus_space_write_multi(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_region(n,m) \ -static __inline void \ -CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, const CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) { \ - CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \ - ba += (n); \ - } \ -} - -bus_space_write_region(1,8) -bus_space_write_region(2,16) -bus_space_write_region(4,32) -bus_space_write_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_raw_region(n,m) \ -static __inline void \ -CAT(bus_space_write_raw_region_,n)(bus_space_tag_t bst, \ - bus_space_handle_t bsh, \ - bus_addr_t ba, const u_int8_t *x, size_t cnt) \ -{ \ - cnt >>= ((n) >> 1); \ - while (cnt--) { \ - CAT(bus_space_write_raw_multi_,n)(bst, bsh, ba, x, (n)); \ - ba += (n); \ - x += (n); \ - } \ -} - -bus_space_write_raw_region(2,16) -bus_space_write_raw_region(4,32) -bus_space_write_raw_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_set_region(n,m) \ -static __inline void \ -CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, CAT3(u_int,m,_t) x, size_t cnt) \ -{ \ - while (cnt--) { \ - CAT(bus_space_write_,n)(bst, bsh, ba, x); \ - ba += (n); \ - } \ -} - -bus_space_set_region(1,8) -bus_space_set_region(2,16) -bus_space_set_region(4,32) -bus_space_set_region(8,64) - -/*----------------------------------------------------------------------------*/ -static __inline void -bus_space_copy_1(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - char *s = (char *)(h1 + o1); - char *d = (char *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - - -static __inline void -bus_space_copy_2(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - short *s = (short *)(h1 + o1); - short *d = (short *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -static __inline void -bus_space_copy_4(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - int *s = (int *)(h1 + o1); - int *d = (int *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -static __inline void -bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - int64_t *s = (int64_t *)(h1 + o1); - int64_t *d = (int64_t *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -int generic_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, - bus_space_handle_t *); -void generic_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); -int generic_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, - bus_size_t, bus_space_handle_t *); -void *generic_space_vaddr(bus_space_tag_t, bus_space_handle_t); -uint8_t generic_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint16_t generic_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint32_t generic_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint64_t generic_space_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t); -void generic_space_read_raw_2(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint8_t); -void generic_space_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint16_t); -void generic_space_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint32_t); -void generic_space_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint64_t); -void generic_space_write_raw_2(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -void generic_space_read_raw_4(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_raw_4(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -void generic_space_read_raw_8(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_raw_8(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -paddr_t generic_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); - -/*----------------------------------------------------------------------------*/ -/* - * Bus read/write barrier methods. - * - * void bus_space_barrier(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * bus_size_t len, int flags); - * - */ -static inline void -bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, - bus_size_t length, int flags) -{ - __asm__ volatile ("sync" ::: "memory"); -} -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -#define BUS_DMA_WAITOK 0x0000 -#define BUS_DMA_NOWAIT 0x0001 -#define BUS_DMA_ALLOCNOW 0x0002 -#define BUS_DMA_COHERENT 0x0008 -#define BUS_DMA_BUS1 0x0010 /* placeholders for bus functions... */ -#define BUS_DMA_BUS2 0x0020 -#define BUS_DMA_BUS3 0x0040 -#define BUS_DMA_BUS4 0x0080 -#define BUS_DMA_READ 0x0100 /* mapping is device -> memory only */ -#define BUS_DMA_WRITE 0x0200 /* mapping is memory -> device only */ -#define BUS_DMA_STREAMING 0x0400 /* hint: sequential, unidirectional */ -#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */ -#define BUS_DMA_NOCACHE 0x1000 -#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */ - -/* Forwards needed by prototypes below. */ -struct mbuf; -struct proc; -struct uio; - -#define BUS_DMASYNC_POSTREAD 0x0001 -#define BUS_DMASYNC_POSTWRITE 0x0002 -#define BUS_DMASYNC_PREREAD 0x0004 -#define BUS_DMASYNC_PREWRITE 0x0008 - -typedef struct machine_bus_dma_tag *bus_dma_tag_t; -typedef struct machine_bus_dmamap *bus_dmamap_t; - -/* - * bus_dma_segment_t - * - * Describes a single contiguous DMA transaction. Values - * are suitable for programming into DMA registers. - */ -struct machine_bus_dma_segment { - bus_addr_t ds_addr; /* DMA address */ - bus_size_t ds_len; /* length of transfer */ - - paddr_t _ds_paddr; /* CPU address */ - vaddr_t _ds_vaddr; /* CPU address */ -}; -typedef struct machine_bus_dma_segment bus_dma_segment_t; - -/* - * bus_dma_tag_t - * - * A machine-dependent opaque type describing the implementation of - * DMA for a given bus. - */ - -struct machine_bus_dma_tag { - void *_cookie; /* cookie used in the guts */ - - /* - * DMA mapping methods. - */ - int (*_dmamap_create)(bus_dma_tag_t , bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); - void (*_dmamap_destroy)(bus_dma_tag_t , bus_dmamap_t); - int (*_dmamap_load)(bus_dma_tag_t , bus_dmamap_t, void *, - bus_size_t, struct proc *, int); - int (*_dmamap_load_mbuf)(bus_dma_tag_t , bus_dmamap_t, - struct mbuf *, int); - int (*_dmamap_load_uio)(bus_dma_tag_t , bus_dmamap_t, - struct uio *, int); - int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); - int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); - void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); - void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, - bus_addr_t, bus_size_t, int); - - /* - * DMA memory utility functions. - */ - int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); - void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int); - int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); - void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t); - paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *, - int, off_t, int, int); - - /* - * internal memory address translation information. - */ - bus_addr_t (*_pa_to_device)(paddr_t); - paddr_t (*_device_to_pa)(bus_addr_t); - bus_addr_t _dma_mask; -}; - -#define bus_dmamap_create(t, s, n, m, b, f, p) \ - (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p)) -#define bus_dmamap_destroy(t, p) \ - (*(t)->_dmamap_destroy)((t), (p)) -#define bus_dmamap_load(t, m, b, s, p, f) \ - (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f)) -#define bus_dmamap_load_mbuf(t, m, b, f) \ - (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f)) -#define bus_dmamap_load_uio(t, m, u, f) \ - (*(t)->_dmamap_load_uio)((t), (m), (u), (f)) -#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ - (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) -#define bus_dmamap_unload(t, p) \ - (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, a, l, o) \ - (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0) - -#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ - (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) -#define bus_dmamem_free(t, sg, n) \ - (*(t)->_dmamem_free)((t), (sg), (n)) -#define bus_dmamem_map(t, sg, n, s, k, f) \ - (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f)) -#define bus_dmamem_unmap(t, k, s) \ - (*(t)->_dmamem_unmap)((t), (k), (s)) -#define bus_dmamem_mmap(t, sg, n, o, p, f) \ - (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) - -int _dmamap_create(bus_dma_tag_t, bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); -void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); -int _dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int); -int _dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int); -int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int); -int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); -int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); -void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); -void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, - bus_size_t, int); - -int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); -void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int); -int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); -void _dmamem_unmap(bus_dma_tag_t, caddr_t, size_t); -paddr_t _dmamem_mmap(bus_dma_tag_t, bus_dma_segment_t *, int, off_t, int, int); -int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, - bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t); - -/* - * bus_dmamap_t - * - * Describes a DMA mapping. - */ -struct machine_bus_dmamap { - /* - * PRIVATE MEMBERS: not for use by machine-independent code. - */ - bus_size_t _dm_size; /* largest DMA transfer mappable */ - int _dm_segcnt; /* number of segs this map can map */ - bus_size_t _dm_maxsegsz; /* largest possible segment */ - bus_size_t _dm_boundary; /* don't cross this */ - int _dm_flags; /* misc. flags */ - - void *_dm_cookie; /* cookie for bus-specific functions */ - - /* - * PUBLIC MEMBERS: these are used by machine-independent code. - */ - bus_size_t dm_mapsize; /* size of the mapping */ - int dm_nsegs; /* # valid segments in mapping */ - bus_dma_segment_t dm_segs[1]; /* segments; variable length */ -}; - -#endif /* _MACHINE_BUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/cdefs.h b/lib/libc/include/mips64el-openbsd-none/loongson/cdefs.h deleted file mode 100644 index e44353fedfe1e56cc82b7f74e8e03f3753c98167..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/cdefs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.2 2013/03/28 17:30:45 martynas Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/conf.h b/lib/libc/include/mips64el-openbsd-none/loongson/conf.h deleted file mode 100644 index 8eafed12d4280fe87a48ef344db8d720d17edd55..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: conf.h,v 1.4 2022/06/28 14:43:50 visa Exp $ */ -/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -/* open, close, write, ioctl, kqueue */ -#define cdev_apm_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, \ - (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,n,kqfilter) } - -cdev_decl(apm); \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/cpu.h b/lib/libc/include/mips64el-openbsd-none/loongson/cpu.h deleted file mode 100644 index d3d84bf3dbf9833456225af945c4fb8a2d57af25..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/cpu.h +++ /dev/null @@ -1,103 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.8 2017/07/30 16:05:24 visa Exp $ */ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 - */ - -#ifdef _KERNEL - -#if defined(MULTIPROCESSOR) && !defined(_LOCORE) -#define MAXCPUS 4 -struct cpu_info; -struct cpu_info *hw_getcurcpu(void); -void hw_setcurcpu(struct cpu_info *); -void hw_cpu_boot_secondary(struct cpu_info *); -void hw_cpu_hatch(struct cpu_info *); -void hw_cpu_spinup_trampoline(struct cpu_info *); -int hw_ipi_intr_establish(int (*)(void *), u_long); -void hw_ipi_intr_set(u_long); -void hw_ipi_intr_clear(u_long); -#endif /* MULTIPROCESSOR && !_LOCORE */ - -#if defined(CPU_LOONGSON2) && !defined(CPU_LOONGSON3) -#define Mips_SyncCache(ci) \ - Loongson2_SyncCache((ci)) -#define Mips_InvalidateICache(ci, va, l) \ - Loongson2_InvalidateICache((ci), (va), (l)) -#define Mips_InvalidateICachePage(ci, va) \ - Loongson2_InvalidateICachePage((ci), (va)) -#define Mips_SyncICache(ci) \ - Loongson2_SyncICache((ci)) -#define Mips_SyncDCachePage(ci, va, pa) \ - Loongson2_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCachePage(ci, va, pa) \ - Loongson2_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCache(ci, va, l) \ - Loongson2_HitSyncDCache((ci), (va), (l)) -#define Mips_IOSyncDCache(ci, va, l, h) \ - Loongson2_IOSyncDCache((ci), (va), (l), (h)) -#define Mips_HitInvalidateDCache(ci, va, l) \ - Loongson2_HitInvalidateDCache((ci), (va), (l)) -#endif - -#if defined(CPU_LOONGSON3) && !defined(CPU_LOONGSON2) -#define Mips_SyncCache(ci) \ - Loongson3_SyncCache((ci)) -#define Mips_InvalidateICache(ci, va, l) \ - Loongson3_InvalidateICache((ci), (va), (l)) -#define Mips_InvalidateICachePage(ci, va) \ - Loongson3_InvalidateICachePage((ci), (va)) -#define Mips_SyncICache(ci) \ - Loongson3_SyncICache((ci)) -#define Mips_SyncDCachePage(ci, va, pa) \ - Loongson3_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCachePage(ci, va, pa) \ - Loongson3_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCache(ci, va, l) \ - Loongson3_HitSyncDCache((ci), (va), (l)) -#define Mips_IOSyncDCache(ci, va, l, h) \ - Loongson3_IOSyncDCache((ci), (va), (l), (h)) -#define Mips_HitInvalidateDCache(ci, va, l) \ - Loongson3_HitInvalidateDCache((ci), (va), (l)) -#endif - -#endif /* _KERNEL */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/cpustate.h b/lib/libc/include/mips64el-openbsd-none/loongson/cpustate.h deleted file mode 100644 index f5aff1a41b0821e4223149081bd09917bbd5ead5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/cpustate.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cpustate.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/db_machdep.h b/lib/libc/include/mips64el-openbsd-none/loongson/db_machdep.h deleted file mode 100644 index 3759d833718e73d1721d3c9d4e719e76c39fe568..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/db_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/disklabel.h b/lib/libc/include/mips64el-openbsd-none/loongson/disklabel.h deleted file mode 100644 index e7758205f60b4f71e05e646714431838d70a82a1..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/disklabel.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 15:35:30 krw Exp $ */ -/* public domain */ - -/* - * Standard MBR partition scheme, with the label in the second sector - * of the OpenBSD partition. - */ - -#ifndef _MACHINE_DISKLABEL_H_ -#define _MACHINE_DISKLABEL_H_ - -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ - -#endif /* _MACHINE_DISKLABEL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/elf.h b/lib/libc/include/mips64el-openbsd-none/loongson/elf.h deleted file mode 100644 index 5918df727bdaf3cd8ab2b3b7df5c61cdc0b8b8ef..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/elf.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: elf.h,v 1.1 2024/07/14 19:33:59 miod Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/endian.h b/lib/libc/include/mips64el-openbsd-none/loongson/endian.h deleted file mode 100644 index 2e7392a0828e58ea0353f15ea21bca2453d884eb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: endian.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/exec.h b/lib/libc/include/mips64el-openbsd-none/loongson/exec.h deleted file mode 100644 index 53433783f0c0157fda10cb49ac0566fd0ae354c1..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/exec.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: exec.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/fenv.h b/lib/libc/include/mips64el-openbsd-none/loongson/fenv.h deleted file mode 100644 index 08e89fbf323e30d7c88ccce0eb090e4c2cfa5f30..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/fenv.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/fpu.h b/lib/libc/include/mips64el-openbsd-none/loongson/fpu.h deleted file mode 100644 index 19ee8af41438ceaa59169b2355572d0256f33272..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/fpu.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fpu.h,v 1.1 2010/09/17 00:34:04 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/frame.h b/lib/libc/include/mips64el-openbsd-none/loongson/frame.h deleted file mode 100644 index d14827e33c0e4797ab96d1648b847715e058d110..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/frame.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/ieee.h b/lib/libc/include/mips64el-openbsd-none/loongson/ieee.h deleted file mode 100644 index d390acb3c59f1631bcb889841e5f9d27e9520a2f..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/ieee.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieee.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/ieeefp.h b/lib/libc/include/mips64el-openbsd-none/loongson/ieeefp.h deleted file mode 100644 index 17e880358e20378250fc45526d8c18fa0aef70a6..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/ieeefp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/intr.h b/lib/libc/include/mips64el-openbsd-none/loongson/intr.h deleted file mode 100644 index 64d103bc39aa71a0cb565ab4655c9d7eec4cbc21..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/intr.h +++ /dev/null @@ -1,193 +0,0 @@ -/* $OpenBSD: intr.h,v 1.19 2025/05/10 10:01:03 visa Exp $ */ - -/* - * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MACHINE_INTR_H_ -#define _MACHINE_INTR_H_ - -#define __USE_MI_SOFTINTR - -#include - -/* - * The interrupt level ipl is a logical level; per-platform interrupt - * code will turn it into the appropriate hardware interrupt masks - * values. - * - * Interrupt sources on the CPU are kept enabled regardless of the - * current ipl value; individual hardware sources interrupting while - * logically masked are masked on the fly, remembered as pending, and - * unmasked at the first splx() opportunity. - * - * An exception to this rule is the clock interrupt. Clock interrupts - * are always allowed to happen, but will (of course!) not be serviced - * if logically masked. The reason for this is that clocks usually sit on - * INT5 and cannot be easily masked if external hardware masking is used. - */ - -/* Interrupt priority `levels'; not mutually exclusive. */ -#define IPL_NONE 0 /* nothing */ -#define IPL_SOFTINT 1 /* soft interrupts */ -#define IPL_SOFTCLOCK 1 /* soft clock interrupts */ -#define IPL_SOFTNET 2 /* soft network interrupts */ -#define IPL_SOFTTTY 3 /* soft terminal interrupts */ -#define IPL_SOFTHIGH IPL_SOFTTTY /* highest level of soft interrupts */ -#define IPL_BIO 4 /* block I/O */ -#define IPL_AUDIO IPL_BIO -#define IPL_NET 5 /* network */ -#define IPL_TTY 6 /* terminal */ -#define IPL_VM 7 /* memory allocation */ -#define IPL_CLOCK 8 /* clock */ -#define IPL_STATCLOCK IPL_CLOCK -#define IPL_SCHED 9 /* everything */ -#define IPL_HIGH 9 /* everything */ -#define IPL_IPI 10 /* interprocessor interrupt */ -#define NIPLS 11 /* number of levels */ - -#define IPL_MPFLOOR IPL_TTY - -/* Interrupt priority 'flags'. */ -#define IPL_MPSAFE 0x100 - -/* Interrupt sharing types. */ -#define IST_NONE 0 /* none */ -#define IST_PULSE 1 /* pulsed */ -#define IST_EDGE 2 /* edge-triggered */ -#define IST_LEVEL 3 /* level-triggered */ - -#ifndef _LOCORE - -void softintr(int); - -#define splbio() splraise(IPL_BIO) -#define splnet() splraise(IPL_NET) -#define spltty() splraise(IPL_TTY) -#define splaudio() splraise(IPL_AUDIO) -#define splclock() splraise(IPL_CLOCK) -#define splvm() splraise(IPL_VM) -#define splhigh() splraise(IPL_HIGH) - -#define splsoftclock() splraise(IPL_SOFTCLOCK) -#define splsoftnet() splraise(IPL_SOFTNET) -#define splstatclock() splhigh() - -#define splsched() splhigh() -#define spl0() spllower(0) - -void splinit(void); - -#ifdef DIAGNOSTIC -/* - * Although this function is implemented in MI code, it must be in this MD - * header because we don't want this header to include MI includes. - */ -void splassert_fail(int, int, const char *); -extern int splassert_ctl; -void splassert_check(int, const char *); -#define splassert(__wantipl) do { \ - if (splassert_ctl > 0) { \ - splassert_check(__wantipl, __func__); \ - } \ -} while (0) -#define splsoftassert(wantipl) splassert(wantipl) -#else -#define splassert(X) -#define splsoftassert(X) -#endif - -void register_splx_handler(void (*)(int)); -int splraise(int); -void splx(int); -int spllower(int); - -/* - * Interrupt control struct used by interrupt dispatchers - * to hold interrupt handler info. - */ - -#include - -struct intrhand { - struct intrhand *ih_next; - int (*ih_fun)(void *); - void *ih_arg; - int ih_level; - int ih_irq; - int ih_flags; -#define IH_MPSAFE 0x01 - struct evcount ih_count; -}; - -void intr_barrier(void *); - -/* - * Low level interrupt dispatcher registration data. - */ - -/* Schedule priorities for base interrupts (CPU) */ -#define INTPRI_IPI 0 -#define INTPRI_CLOCK 1 -/* other values are system-specific */ - -#define NLOWINT 4 /* Number of low level registrations possible */ - -extern uint32_t idle_mask; - -struct trapframe; -void set_intr(int, uint32_t, uint32_t(*)(uint32_t, struct trapframe *)); - -uint32_t updateimask(uint32_t); -void dosoftint(void); - -#ifdef MULTIPROCESSOR -extern uint32_t ipi_mask; -#define ENABLEIPI() updateimask(~ipi_mask) -#endif - -struct pic { - void (*pic_eoi)(int); - void (*pic_mask)(int); - void (*pic_unmask)(int); -}; - -#ifdef CPU_LOONGSON3 - -void loongson3_intr_init(void); -void *loongson3_intr_establish(int, int, int (*)(void *), void*, - const char *); -void loongson3_intr_disestablish(void *); -void *loongson3_ht_intr_establish(int, int, int (*)(void *), void*, - const char *); -void loongson3_ht_intr_disestablish(void *); - -void loongson3_register_ht_pic(const struct pic *); - -#endif /* CPU_LOONGSON3 */ - -#endif /* _LOCORE */ - -#endif /* _MACHINE_INTR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/isa_machdep.h b/lib/libc/include/mips64el-openbsd-none/loongson/isa_machdep.h deleted file mode 100644 index 201c218bd3fb5231555a293b7d1d2c3625772613..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/isa_machdep.h +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: isa_machdep.h,v 1.2 2010/05/08 21:59:56 miod Exp $ */ - -/* - * Copyright (c) 2007 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice, this permission notice, and the disclaimer below - * appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_ISA_MACHDEP_H_ -#define _MACHINE_ISA_MACHDEP_H_ - -#include - -#define __NO_ISA_INTR_CHECK - -typedef struct mips_isa_chipset *isa_chipset_tag_t; - -struct mips_isa_chipset { - void *ic_v; - - void (*ic_attach_hook)(struct device *, struct device *, - struct isabus_attach_args *); - void *(*ic_intr_establish)(void *, int, int, int, int (*)(void *), - void *, char *); - void (*ic_intr_disestablish)(void *, void *); -}; - -#define isa_attach_hook(p, s, iba) \ - (*(iba)->iba_ic->ic_attach_hook)((p), (s), (iba)) -#define isa_intr_establish(c, i, t, l, f, a, n) \ - (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (n)) -#define isa_intr_disestablish(c, h) \ - (*(c)->ic_intr_disestablish)((c)->ic_v, (h)) - -void loongson_generic_isa_attach_hook(struct device *, struct device *, - struct isabus_attach_args *); -void loongson_isa_specific_eoi(int); -void loongson_set_isa_imr(uint); - -#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/kcore.h b/lib/libc/include/mips64el-openbsd-none/loongson/kcore.h deleted file mode 100644 index c38fa9f7f6e0ddea59ac1f0ea7850a38a2d22eca..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/kcore.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/limits.h b/lib/libc/include/mips64el-openbsd-none/loongson/limits.h deleted file mode 100644 index 12007d997ad2c9432fc6ad13fabc963fed43c9f2..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: limits.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/loadfile_machdep.h b/lib/libc/include/mips64el-openbsd-none/loongson/loadfile_machdep.h deleted file mode 100644 index 1486f8ce5c754fca11c37ce27e90e32eeb9a6f9c..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/loadfile_machdep.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: loadfile_machdep.h,v 1.2 2015/07/17 20:44:39 miod Exp $ */ -/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:49 thorpej Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define BOOT_ELF -#define ELFSIZE 64 - -#define LOAD_KERNEL LOAD_ALL -#define COUNT_KERNEL COUNT_ALL - -#define LOADADDR(a) (((u_long)(a)) + offset) -#define ALIGNENTRY(a) ((u_long)(a)) -#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) -#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) -#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) -#define WARN(a) (void)(printf a, \ - printf((errno ? ": %s\n" : "\n"), \ - strerror(errno))) -#define PROGRESS(a) (void) printf a -#define ALLOC(a) alloc(a) -#define FREE(a, b) free(a, b) \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/loongson2.h b/lib/libc/include/mips64el-openbsd-none/loongson/loongson2.h deleted file mode 100644 index 05688a8e0f9c45faa85f84be32d74c228bcbd3ab..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/loongson2.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: loongson2.h,v 1.1.1.1 2009/08/06 20:51:44 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/loongson3.h b/lib/libc/include/mips64el-openbsd-none/loongson/loongson3.h deleted file mode 100644 index bcbe6ca7018fb2277e222d0662241f22d4e253bf..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/loongson3.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: loongson3.h,v 1.1 2016/11/06 10:20:33 visa Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/memconf.h b/lib/libc/include/mips64el-openbsd-none/loongson/memconf.h deleted file mode 100644 index c7782048ac7eb9086d64bc2dd8b4d77e3e9d67bb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/memconf.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: memconf.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/mips_opcode.h b/lib/libc/include/mips64el-openbsd-none/loongson/mips_opcode.h deleted file mode 100644 index 5b5cbc3494fdd59ac6aacae953cf3619c6d1530d..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/mips_opcode.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mips_opcode.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/mplock.h b/lib/libc/include/mips64el-openbsd-none/loongson/mplock.h deleted file mode 100644 index dc963887f82cb06ab479ce94fdfddf76e44bb85e..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/mplock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mplock.h,v 1.1 2017/01/19 14:51:02 visa Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/mutex.h b/lib/libc/include/mips64el-openbsd-none/loongson/mutex.h deleted file mode 100644 index 8003e465f6b6905278f3da97386d911071f9056b..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/mutex.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mutex.h,v 1.2 2015/07/08 13:37:31 dlg Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/param.h b/lib/libc/include/mips64el-openbsd-none/loongson/param.h deleted file mode 100644 index 17092fa4a5a093ef5a4cd509b268b4fc28ef0bb5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/param.h +++ /dev/null @@ -1,27 +0,0 @@ -/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */ - -/* Public Domain */ - -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - -#define MACHINE "loongson" -#define _MACHINE loongson -#define MACHINE_ARCH "mips64el" /* not the canonical endianness */ -#define _MACHINE_ARCH mips64el -#define MACHINE_CPU "mips64" -#define _MACHINE_CPU mips64 -#define MID_MACHINE MID_MIPS64 - -/* - * The Loongson level 1 cache expects software to prevent virtual - * aliases. Unfortunately, since this cache is physically tagged, - * this would require all virtual address to have the same bits 14 - * and 13 as their physical addresses, which is not something the - * kernel can guarantee unless the page size is at least 16KB. - */ -#define PAGE_SHIFT 14 - -#include - -#endif /* _MACHINE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/pcb.h b/lib/libc/include/mips64el-openbsd-none/loongson/pcb.h deleted file mode 100644 index e48bfc2f316c00e773efb610642791ad8d374be2..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/pcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/pci_machdep.h b/lib/libc/include/mips64el-openbsd-none/loongson/pci_machdep.h deleted file mode 100644 index ade283806c11d7029d43fe292cb48ad30d3cc5c7..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/pci_machdep.h +++ /dev/null @@ -1,101 +0,0 @@ -/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */ - -/* - * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -typedef struct mips_pci_chipset *pci_chipset_tag_t; -typedef u_long pcitag_t; -typedef u_long pci_intr_handle_t; - -struct pci_attach_args; - -/* - * mips-specific PCI structure and type definitions. - * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. - */ -struct mips_pci_chipset { - void *pc_conf_v; - void (*pc_attach_hook)(struct device *, - struct device *, struct pcibus_attach_args *); - int (*pc_bus_maxdevs)(void *, int); - pcitag_t (*pc_make_tag)(void *, int, int, int); - void (*pc_decompose_tag)(void *, pcitag_t, int *, - int *, int *); - int (*pc_conf_size)(void *, pcitag_t); - pcireg_t (*pc_conf_read)(void *, pcitag_t, int); - void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); - - void *pc_intr_v; - int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *); - const char *(*pc_intr_string)(void *, pci_intr_handle_t); - void *(*pc_intr_establish)(void *, pci_intr_handle_t, - int, int (*)(void *), void *, char *); - void (*pc_intr_disestablish)(void *, void *); -}; - -/* - * Functions provided to machine-independent PCI code. - */ -#define pci_attach_hook(p, s, pba) \ - (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) -#define pci_bus_maxdevs(c, b) \ - (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b)) -#define pci_make_tag(c, b, d, f) \ - (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) -#define pci_decompose_tag(c, t, bp, dp, fp) \ - (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) -#define pci_conf_size(c, t) \ - (*(c)->pc_conf_size)((c)->pc_conf_v, (t)) -#define pci_conf_read(c, t, r) \ - (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) -#define pci_conf_write(c, t, r, v) \ - (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) -#define pci_intr_map(c, ihp) \ - (*(c)->pa_pc->pc_intr_map)((c), (ihp)) -#define pci_intr_map_msi(c, ihp) (-1) -#define pci_intr_map_msix(c, vec, ihp) (-1) -#define pci_intr_string(c, ih) \ - (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) -#define pci_intr_establish(c, ih, l, h, a, nm) \ - (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm)) -#define pci_intr_disestablish(c, iv) \ - (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) -#define pci_probe_device_hook(c, a) (0) - -#define pci_min_powerstate(c, t) (PCI_PMCSR_STATE_D3) -#define pci_set_powerstate_md(c, t, s, p) - -/* PCI view of CPU memory */ -extern paddr_t loongson_dma_base; - -/* - * Functions used during early system configuration. - */ - -extern pcitag_t (*pci_make_tag_early)(int, int, int); -extern pcireg_t (*pci_conf_read_early)(pcitag_t, int); - -#define pci_dev_postattach(a, b) \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/pmap.h b/lib/libc/include/mips64el-openbsd-none/loongson/pmap.h deleted file mode 100644 index eda0b11a3c63e3b7ab53d099b6ca595215ad5302..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/pmap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/pmon.h b/lib/libc/include/mips64el-openbsd-none/loongson/pmon.h deleted file mode 100644 index 7729adb4680ab9e77a1c0d174631e57be336d579..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/pmon.h +++ /dev/null @@ -1,209 +0,0 @@ -/* $OpenBSD: pmon.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */ - -/* - * Copyright (c) 2009, 2012 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_PMON_H_ -#define _MACHINE_PMON_H_ - -#if defined(_KERNEL) || defined(_STANDALONE) - -/* - * PMON2000 callvec definitions - */ - -/* 32-bit compatible types */ -typedef uint32_t pmon_size_t; -typedef int32_t pmon_ssize_t; -typedef int64_t pmon_off_t; - -int pmon_open(const char *, int, ...); -int pmon_close(int); -int pmon_read(int, void *, pmon_size_t); -pmon_ssize_t pmon_write(int, const void *, pmon_size_t); -pmon_off_t pmon_lseek(int, pmon_off_t, int); -int pmon_printf(const char *, ...); -void pmon_cacheflush(void); -char * pmon_gets(char *); - -#define PMON_MAXLN 256 /* internal gets() size limit */ - -extern int32_t pmon_callvec; - -const char *pmon_getarg(const int); -void pmon_init(int32_t, int32_t, int32_t, int32_t, uint32_t); - -#define PMON_ENVTYPE_ENVP 0 -#define PMON_ENVTYPE_EFI 1 -int pmon_getenvtype(void); - -/* - * The new environment interface is a /salmigondis/ of badly thought-out - * structs put together, pretending to be inspired by EFI but conveniently - * omitting key EFI structs because they are deemed non-applicable to - * MIPS systems. - * Of course, some fields are absolute addresses, while others are relative - * pointers, to add to the confusion. - */ - -struct pmon_env_reset { - void (*cold_boot)(void); /* not filled */ - void (*warm_boot)(void); - void (*boot)(unsigned int); /* not filled */ - void (*poweroff)(void); -}; - -/* all values are offsets relative to the beginning of the struct */ -struct pmon_env_ptr { - uint64_t offs_mem; - uint64_t offs_cpu; - uint64_t offs_sys; - uint64_t offs_irq; - uint64_t offs_iface; - uint64_t offs_special; - uint64_t offs_device; -}; - -struct pmon_env_smbios { - uint16_t version; - uint64_t vga_bios; - struct pmon_env_ptr ptrs; -}; - -struct pmon_env_efi { - uint64_t mps; /* not filled */ - uint64_t acpi; /* not filled */ - uint64_t acpi20; /* not filled */ - struct pmon_env_smbios bios; - uint64_t sal_systab; /* not filled */ - uint64_t bootinfo; /* not filled */ -}; - -struct pmon_env { - struct pmon_env_efi efi; - struct pmon_env_reset reset; -}; - -#define PMON_MEM_MAX 128 -struct pmon_env_mem_entry { - uint32_t node; - uint32_t type; -#define PMON_MEM_SYSTEM_LOW 1 /* physical memory <= 256 MB */ -#define PMON_MEM_SYSTEM_HIGH 2 /* physical memory > 256 MB */ -#define PMON_MEM_RESERVED 3 -#define PMON_MEM_PCI_IO 4 -#define PMON_MEM_PCI_MEM 5 -#define PMON_MEM_CPU_REGISTERS 6 -#define PMON_MEM_VIDEO_ROM 7 -#define PMON_MEM_OTHER_ROM 8 -#define PMON_MEM_ACPI_TABLE 9 - uint64_t address; - uint32_t size; -}; -struct pmon_env_mem { - uint16_t version; /* not filled */ - uint32_t nentries; - uint32_t mem_freq; - struct pmon_env_mem_entry mem_map[PMON_MEM_MAX]; -} __packed; - -struct pmon_env_cpu { - uint16_t version; /* not filled */ - uint32_t prid; /* cop0 PrID */ - uint32_t cputype; -/* 0 and 1 are supposedly intended for 2E and 2F, which do NOT provide this - interface; moreover Linux and PMON disagree on the values and have 2E and - 2F swapped. */ -#define PMON_CPUTYPE_LS3A 2 -#define PMON_CPUTYPE_LS3B 3 -#define PMON_CPUTYPE_LS1A 4 -#define PMON_CPUTYPE_LS1B 5 - uint32_t node; /* total number of NUMA nodes */ - uint16_t coreid; /* boot CPU core id */ - uint16_t reserved_cores; /* mask of reserved cores */ - uint32_t speed; - uint32_t ncpus; -} __packed; - -struct pmon_env_sys { - uint16_t version; /* not filled */ - uint32_t ccnuma_smp; - uint32_t double_channel; -} __packed; - -struct pmon_env_irq { - uint16_t version; /* not filled */ - uint16_t size; /* not filled */ - uint16_t rtr_bus; /* not filled */ - uint16_t rtr_devfn; /* not filled */ - uint32_t vendor; /* not filled */ - uint32_t device; /* not filled */ - uint32_t pic_type; -#define PMON_IRQ_PIC_HT 0 -#define PMON_IRQ_PIC_I8259 1 - uint64_t ht_interrupt_bit; - uint64_t ht_enable; - uint32_t node; - uint64_t pci_memory_space_start; - uint64_t pci_memory_space_end; - uint64_t pci_io_space_start; /* not filled */ - uint64_t pci_io_space_end; /* not filled */ - uint64_t pci_cfg_space; /* not filled */ -} __packed; - -struct pmon_env_iface { - uint16_t version; -#define PMON_IFACE_VERSION 0x0001 - uint16_t size; - uint8_t flag; - char description[64]; /* firmware version */ -} __packed; - -#define PMON_RESOURCE_MAX 128 -struct pmon_env_resource { - uint64_t start; - uint64_t end; - char name[64]; - uint32_t flags; -}; -struct pmon_env_special { - uint16_t version; - char name[64]; - uint32_t type; - struct pmon_env_resource resource[PMON_RESOURCE_MAX]; -}; - -struct pmon_env_device { - char name[64]; /* system description */ - uint32_t nentries; - struct pmon_env_resource resource[PMON_RESOURCE_MAX]; -}; - -const char *pmon_getenv(const char *); - -const struct pmon_env_reset *pmon_get_env_reset(void); -const struct pmon_env_smbios *pmon_get_env_smbios(void); -const struct pmon_env_mem *pmon_get_env_mem(void); -const struct pmon_env_cpu *pmon_get_env_cpu(void); -const struct pmon_env_sys *pmon_get_env_sys(void); -const struct pmon_env_irq *pmon_get_env_irq(void); -const struct pmon_env_iface *pmon_get_env_iface(void); -const struct pmon_env_special *pmon_get_env_special(void); -const struct pmon_env_device *pmon_get_env_device(void); - -#endif /* _KERNEL || _STANDALONE */ - -#endif /* _MACHINE_PMON_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/proc.h b/lib/libc/include/mips64el-openbsd-none/loongson/proc.h deleted file mode 100644 index 27b68200cf3e4a6bc41e3b0508c88a0cda1e8f8b..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/proc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: proc.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/profile.h b/lib/libc/include/mips64el-openbsd-none/loongson/profile.h deleted file mode 100644 index d258d1147b2dde2184faa06acd8dd2dd3ff70da7..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/profile.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: profile.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/pte.h b/lib/libc/include/mips64el-openbsd-none/loongson/pte.h deleted file mode 100644 index 24c761d664776bcd5582463e73507b0dbc30b5e5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/pte.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pte.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/ptrace.h b/lib/libc/include/mips64el-openbsd-none/loongson/ptrace.h deleted file mode 100644 index bd8e886725336c5cb7c6446144b24abee4a70994..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/ptrace.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/reg.h b/lib/libc/include/mips64el-openbsd-none/loongson/reg.h deleted file mode 100644 index aeecc496fedcc6c12355b089f99f5854affffcbb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/reg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reg.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/regdef.h b/lib/libc/include/mips64el-openbsd-none/loongson/regdef.h deleted file mode 100644 index 03ae54124e7638aa5f2678b6628d38371ef2f010..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/regdef.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: regdef.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/regnum.h b/lib/libc/include/mips64el-openbsd-none/loongson/regnum.h deleted file mode 100644 index e371c1ed202ebcbbc576b98e86f6505550a93d89..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/regnum.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: regnum.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/reloc.h b/lib/libc/include/mips64el-openbsd-none/loongson/reloc.h deleted file mode 100644 index 4eb8c01cf15e7d068665c757f2cdb4ca3b1c79ec..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/reloc.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.1 2017/08/12 15:33:41 visa Exp $ */ - -/* public domain */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/setjmp.h b/lib/libc/include/mips64el-openbsd-none/loongson/setjmp.h deleted file mode 100644 index c834f0409a59c3a37ba2775a1f0b7f297645be29..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/setjmp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/signal.h b/lib/libc/include/mips64el-openbsd-none/loongson/signal.h deleted file mode 100644 index 7f4d38dee765615d064ae13976aa867a60ba9c91..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/signal.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: signal.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/spinlock.h b/lib/libc/include/mips64el-openbsd-none/loongson/spinlock.h deleted file mode 100644 index 63f58612b808d2e6af8cd6f0354ef2e7d22ef416..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/spinlock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/sysarch.h b/lib/libc/include/mips64el-openbsd-none/loongson/sysarch.h deleted file mode 100644 index 6dac08a77bf53343defb3088b3675f31e91bbdc0..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/sysarch.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: sysarch.h,v 1.1.1.1 2009/11/22 18:12:44 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/tcb.h b/lib/libc/include/mips64el-openbsd-none/loongson/tcb.h deleted file mode 100644 index 427e19101a005a0836cad7a09118435406234f8d..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/tcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/timetc.h b/lib/libc/include/mips64el-openbsd-none/loongson/timetc.h deleted file mode 100644 index d3d291c815ca589d46f697b7f934e546a2490bcc..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/timetc.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: timetc.h,v 1.2 2020/07/18 08:37:43 visa Exp $ */ -/* - * Copyright (c) 2020 Paul Irofti - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_TIMETC_H_ -#define _MACHINE_TIMETC_H_ - -#include - -#endif /* _MACHINE_TIMETC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/trap.h b/lib/libc/include/mips64el-openbsd-none/loongson/trap.h deleted file mode 100644 index c700eedba183ed4dd57238d231a5592197584571..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/trap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: trap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/vmparam.h b/lib/libc/include/mips64el-openbsd-none/loongson/vmparam.h deleted file mode 100644 index c6c4b75cfe65f59dda99fec28215085d0f4e6f77..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/vmparam.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */ -/* public domain */ -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ - -#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */ -#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST - -#include - -#endif /* _MACHINE_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/_types.h b/lib/libc/include/mips64el-openbsd-none/machine/_types.h deleted file mode 100644 index 327e3d3e38ff025d3e5bc0b211c50354c5887659..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _types.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h b/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h deleted file mode 100644 index 6e12da5dc5156fdd65bd30db86544c07540d1233..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h +++ /dev/null @@ -1,127 +0,0 @@ -/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */ - -/* - * Copyright (c) 2001 Alexander Guy - * Copyright (c) 1995 John T. Kohl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef _MACHINE_APMVAR_H_ -#define _MACHINE_APMVAR_H_ - -#include - -/* Advanced Power Management (v1.0 and v1.1 specification) - * functions/defines/etc. - */ - -/* These definitions make up the heart of the user-land interface - * to the APM devices. - */ - -#define APM_AC_OFF 0x00 -#define APM_AC_ON 0x01 -#define APM_AC_BACKUP 0x02 -#define APM_AC_UNKNOWN 0xff -#define APM_BATT_HIGH 0x00 -#define APM_BATT_LOW 0x01 -#define APM_BATT_CRITICAL 0x02 -#define APM_BATT_CHARGING 0x03 -#define APM_BATT_UNKNOWN 0xff -#define APM_BATT_LIFE_UNKNOWN 0xff - -#define APM_NOEVENT 0x0000 -#define APM_STANDBY_REQ 0x0001 -#define APM_SUSPEND_REQ 0x0002 -#define APM_NORMAL_RESUME 0x0003 -#define APM_CRIT_RESUME 0x0004 /* suspend/resume happened - without us */ -#define APM_BATTERY_LOW 0x0005 -#define APM_POWER_CHANGE 0x0006 -#define APM_UPDATE_TIME 0x0007 -#define APM_CRIT_SUSPEND_REQ 0x0008 -#define APM_USER_STANDBY_REQ 0x0009 -#define APM_USER_SUSPEND_REQ 0x000A -#define APM_SYS_STANDBY_RESUME 0x000B -#define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */ -#define APM_USER_HIBERNATE_REQ 0x000D -#define APM_EVENT_MASK 0xffff - -#define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK)) -#define APM_EVENT_TYPE(e) ((e) & APM_EVENT_MASK) -#define APM_EVENT_INDEX(e) ((e) >> 16) - -/* - * LP (Laptop Package) - * - * Copyright (C) 1994 by HOSOKAWA Tatsumi - * - * This software may be used, modified, copied, and distributed, in - * both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its - * use. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - */ - -#define APM_BATTERY_ABSENT 4 - -struct apm_power_info { - u_char battery_state; - u_char ac_state; - u_char battery_life; - u_char spare1; - u_int minutes_left; /* estimate */ - u_int spare2[6]; -}; - -struct apm_ctl { - u_int dev; - u_int mode; -}; - -#define APM_IOC_REJECT _IOW('A', 0, struct apm_event_info) /* reject request # */ -#define APM_IOC_STANDBY _IO('A', 1) /* put system into standby */ -#define APM_IOC_SUSPEND _IO('A', 2) /* put system into suspend */ -#define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info) /* fetch battery state */ -#define APM_IOC_DEV_CTL _IOW('A', 5, struct apm_ctl) /* put device into mode */ -#define APM_IOC_PRN_CTL _IOW('A', 6, int ) /* driver power status msg */ -#define APM_PRINT_ON 0 /* driver power status displayed */ -#define APM_PRINT_OFF 1 /* driver power status not displayed */ -#define APM_PRINT_PCT 2 /* driver power status only displayed - if the percentage changes */ -#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */ -#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */ -#define APM_IOC_HIBERNATE _IO('A', 9) /* put system into hibernate */ - -#ifdef _KERNEL -void apm_setinfohook(int (*)(struct apm_power_info *)); -int apm_record_event(u_int, const char *, const char *); -#endif - -#endif /* _MACHINE_APMVAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/asm.h b/lib/libc/include/mips64el-openbsd-none/machine/asm.h deleted file mode 100644 index 63eab175139b6d2bd0759f45c617f72e4bbce5da..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/asm.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: asm.h,v 1.2 2016/11/18 15:38:14 visa Exp $ */ -/* public domain */ - -#ifdef MULTIPROCESSOR -#define HW_GET_CPU_INFO(ci, tmp) \ - dmfc0 ci, COP_0_ERROR_PC -#endif - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/atomic.h b/lib/libc/include/mips64el-openbsd-none/machine/atomic.h deleted file mode 100644 index 19aa2fd4f69b6d46c4242ab34787707f57884869..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/atomic.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: atomic.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/autoconf.h b/lib/libc/include/mips64el-openbsd-none/machine/autoconf.h deleted file mode 100644 index 7292105a5be85a5d60330b6b3dc1cbd65797fa34..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/autoconf.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $OpenBSD: autoconf.h,v 1.17 2017/05/21 13:00:53 visa Exp $ */ - -/* - * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * Definitions used by autoconfiguration. - */ - -#ifndef _MACHINE_AUTOCONF_H_ -#define _MACHINE_AUTOCONF_H_ - -#include - -struct bonito_config; -struct htb_config; -struct mips_isa_chipset; - -/* - * List of legacy I/O ranges. - */ -struct legacy_io_range { - bus_addr_t start; - bus_size_t end; /* inclusive */ -}; - -/* - * Per platform information. - */ -struct platform { - int system_type; -#define LOONGSON_2E 0x0000 /* Generic Loongson 2E system */ -#define LOONGSON_YEELOONG 0x0001 /* Lemote Yeeloong */ -#define LOONGSON_GDIUM 0x0002 /* EMTEC Gdium Liberty */ -#define LOONGSON_FULOONG 0x0003 /* Lemote Fuloong */ -#define LOONGSON_LYNLOONG 0x0004 /* Lemote Lynloong */ -#define LOONGSON_EBT700 0x0005 /* eBenton EBT700 */ -#define LOONGSON_3A 0x0066 /* Loongson 2Gq or 3A based system */ - - char *vendor; - char *product; - - const struct bonito_config *bonito_config; - const struct htb_config *htb_config; - struct mips_isa_chipset *isa_chipset; - const struct legacy_io_range *legacy_io_ranges; - - void (*setup)(void); - void (*device_register)(struct device *, - void *); - - void (*powerdown)(void); - void (*reset)(void); - int (*suspend)(void); - int (*resume)(void); - -#ifdef MULTIPROCESSOR - void (*config_secondary_cpus)( - struct device *, cfprint_t); - void (*boot_secondary_cpu)( - struct cpu_info *); - int (*ipi_establish)(int (*)(void *), - cpuid_t); - void (*ipi_set)(cpuid_t); - void (*ipi_clear)(cpuid_t); -#endif /* MULTIPROCESSOR */ -}; - -#define LOONGSON_MAXCPUS 16 - -extern const struct platform *sys_platform; -extern void *loongson_videobios; -extern uint loongson_cpumask; -extern uint loongson_ver; -extern int nnodes; - -#ifdef MULTIPROCESSOR -extern uint64_t cpu_spinup_a0; -extern uint64_t cpu_spinup_sp; -#endif - -struct mainbus_attach_args { - const char *maa_name; -}; - -extern struct device *bootdv; -extern char bootdev[]; -extern enum devclass bootdev_class; - -extern bus_space_tag_t early_mem_t; -extern bus_space_tag_t early_io_t; - -#define REGVAL8(x) *((volatile uint8_t *)PHYS_TO_XKPHYS((x), CCA_NC)) -#define REGVAL32(x) *((volatile uint32_t *)PHYS_TO_XKPHYS((x), CCA_NC)) -#define REGVAL64(x) *((volatile uint64_t *)PHYS_TO_XKPHYS((x), CCA_NC)) - -#define REGVAL(x) REGVAL32(x) - -#include - -#endif /* _MACHINE_AUTOCONF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/bus.h b/lib/libc/include/mips64el-openbsd-none/machine/bus.h deleted file mode 100644 index 24430920dde3d01df663b8b0efaeecf2cf9e31e8..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/bus.h +++ /dev/null @@ -1,513 +0,0 @@ -/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */ - -/* - * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_BUS_H_ -#define _MACHINE_BUS_H_ - -#ifdef __STDC__ -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#endif - -/* - * Bus access types. - */ -struct mips_bus_space; -typedef u_long bus_addr_t; -typedef u_long bus_size_t; -typedef u_long bus_space_handle_t; -typedef struct mips_bus_space *bus_space_tag_t; - -struct mips_bus_space { - bus_addr_t bus_base; - void *bus_private; - u_int8_t (*_space_read_1)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_1)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int8_t); - u_int16_t (*_space_read_2)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_2)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int16_t); - u_int32_t (*_space_read_4)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_4)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int32_t); - u_int64_t (*_space_read_8)(bus_space_tag_t , bus_space_handle_t, - bus_size_t); - void (*_space_write_8)(bus_space_tag_t , bus_space_handle_t, - bus_size_t, u_int64_t); - void (*_space_read_raw_2)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_2)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - void (*_space_read_raw_4)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_4)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - void (*_space_read_raw_8)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, u_int8_t *, bus_size_t); - void (*_space_write_raw_8)(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const u_int8_t *, bus_size_t); - int (*_space_map)(bus_space_tag_t , bus_addr_t, - bus_size_t, int, bus_space_handle_t *); - void (*_space_unmap)(bus_space_tag_t, bus_space_handle_t, - bus_size_t); - int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t, - bus_size_t, bus_size_t, bus_space_handle_t *); - void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t); - paddr_t (*_space_mmap)(bus_space_tag_t, bus_addr_t, off_t, - int, int); -}; - -#define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o)) -#define bus_space_read_2(t, h, o) (*(t)->_space_read_2)((t), (h), (o)) -#define bus_space_read_4(t, h, o) (*(t)->_space_read_4)((t), (h), (o)) -#define bus_space_read_8(t, h, o) (*(t)->_space_read_8)((t), (h), (o)) - -#define bus_space_write_1(t, h, o, v) (*(t)->_space_write_1)((t), (h), (o), (v)) -#define bus_space_write_2(t, h, o, v) (*(t)->_space_write_2)((t), (h), (o), (v)) -#define bus_space_write_4(t, h, o, v) (*(t)->_space_write_4)((t), (h), (o), (v)) -#define bus_space_write_8(t, h, o, v) (*(t)->_space_write_8)((t), (h), (o), (v)) - -#define bus_space_read_raw_multi_2(t, h, a, b, l) \ - (*(t)->_space_read_raw_2)((t), (h), (a), (b), (l)) -#define bus_space_read_raw_multi_4(t, h, a, b, l) \ - (*(t)->_space_read_raw_4)((t), (h), (a), (b), (l)) -#define bus_space_read_raw_multi_8(t, h, a, b, l) \ - (*(t)->_space_read_raw_8)((t), (h), (a), (b), (l)) - -#define bus_space_write_raw_multi_2(t, h, a, b, l) \ - (*(t)->_space_write_raw_2)((t), (h), (a), (b), (l)) -#define bus_space_write_raw_multi_4(t, h, a, b, l) \ - (*(t)->_space_write_raw_4)((t), (h), (a), (b), (l)) -#define bus_space_write_raw_multi_8(t, h, a, b, l) \ - (*(t)->_space_write_raw_8)((t), (h), (a), (b), (l)) - -#define bus_space_map(t, o, s, c, p) (*(t)->_space_map)((t), (o), (s), (c), (p)) -#define bus_space_unmap(t, h, s) (*(t)->_space_unmap)((t), (h), (s)) -#define bus_space_subregion(t, h, o, s, p) \ - (*(t)->_space_subregion)((t), (h), (o), (s), (p)) - -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 -#define BUS_SPACE_MAP_PREFETCHABLE 0x04 - -#define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h)) -#define bus_space_mmap(t, a, o, p, f) \ - (*(t)->_space_mmap)((t), (a), (o), (p), (f)) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_multi(n,m) \ -static __inline void \ -CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t o, CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, o); \ -} - -bus_space_read_multi(1,8) -bus_space_read_multi(2,16) -bus_space_read_multi(4,32) -bus_space_read_multi(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_region(n,m) \ -static __inline void \ -CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) { \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ - ba += (n); \ - } \ -} - -bus_space_read_region(1,8) -bus_space_read_region(2,16) -bus_space_read_region(4,32) -bus_space_read_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_read_raw_region(n,m) \ -static __inline void \ -CAT(bus_space_read_raw_region_,n)(bus_space_tag_t bst, \ - bus_space_handle_t bsh, \ - bus_addr_t ba, u_int8_t *x, size_t cnt) \ -{ \ - cnt >>= ((n) >> 1); \ - while (cnt--) { \ - CAT(bus_space_read_raw_multi_,n)(bst, bsh, ba, x, (n)); \ - ba += (n); \ - x += (n); \ - } \ -} - -bus_space_read_raw_region(2,16) -bus_space_read_raw_region(4,32) -bus_space_read_raw_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_multi(n,m) \ -static __inline void \ -CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) \ - CAT(bus_space_write_,n)(bst, bsh, o, *x++); \ -} - -bus_space_write_multi(1,8) -bus_space_write_multi(2,16) -bus_space_write_multi(4,32) -bus_space_write_multi(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_region(n,m) \ -static __inline void \ -CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, const CAT3(u_int,m,_t) *x, size_t cnt) \ -{ \ - while (cnt--) { \ - CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \ - ba += (n); \ - } \ -} - -bus_space_write_region(1,8) -bus_space_write_region(2,16) -bus_space_write_region(4,32) -bus_space_write_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_write_raw_region(n,m) \ -static __inline void \ -CAT(bus_space_write_raw_region_,n)(bus_space_tag_t bst, \ - bus_space_handle_t bsh, \ - bus_addr_t ba, const u_int8_t *x, size_t cnt) \ -{ \ - cnt >>= ((n) >> 1); \ - while (cnt--) { \ - CAT(bus_space_write_raw_multi_,n)(bst, bsh, ba, x, (n)); \ - ba += (n); \ - x += (n); \ - } \ -} - -bus_space_write_raw_region(2,16) -bus_space_write_raw_region(4,32) -bus_space_write_raw_region(8,64) - -/*----------------------------------------------------------------------------*/ -#define bus_space_set_region(n,m) \ -static __inline void \ -CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, CAT3(u_int,m,_t) x, size_t cnt) \ -{ \ - while (cnt--) { \ - CAT(bus_space_write_,n)(bst, bsh, ba, x); \ - ba += (n); \ - } \ -} - -bus_space_set_region(1,8) -bus_space_set_region(2,16) -bus_space_set_region(4,32) -bus_space_set_region(8,64) - -/*----------------------------------------------------------------------------*/ -static __inline void -bus_space_copy_1(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - char *s = (char *)(h1 + o1); - char *d = (char *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - - -static __inline void -bus_space_copy_2(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - short *s = (short *)(h1 + o1); - short *d = (short *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -static __inline void -bus_space_copy_4(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - int *s = (int *)(h1 + o1); - int *d = (int *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -static __inline void -bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1, - bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - int64_t *s = (int64_t *)(h1 + o1); - int64_t *d = (int64_t *)(h2 + o2); - - while (c--) - *d++ = *s++; -} - -int generic_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, - bus_space_handle_t *); -void generic_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); -int generic_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, - bus_size_t, bus_space_handle_t *); -void *generic_space_vaddr(bus_space_tag_t, bus_space_handle_t); -uint8_t generic_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint16_t generic_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint32_t generic_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t); -uint64_t generic_space_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t); -void generic_space_read_raw_2(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint8_t); -void generic_space_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint16_t); -void generic_space_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint32_t); -void generic_space_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, - uint64_t); -void generic_space_write_raw_2(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -void generic_space_read_raw_4(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_raw_4(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -void generic_space_read_raw_8(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, uint8_t *, bus_size_t); -void generic_space_write_raw_8(bus_space_tag_t, bus_space_handle_t, - bus_addr_t, const uint8_t *, bus_size_t); -paddr_t generic_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); - -/*----------------------------------------------------------------------------*/ -/* - * Bus read/write barrier methods. - * - * void bus_space_barrier(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * bus_size_t len, int flags); - * - */ -static inline void -bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, - bus_size_t length, int flags) -{ - __asm__ volatile ("sync" ::: "memory"); -} -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -#define BUS_DMA_WAITOK 0x0000 -#define BUS_DMA_NOWAIT 0x0001 -#define BUS_DMA_ALLOCNOW 0x0002 -#define BUS_DMA_COHERENT 0x0008 -#define BUS_DMA_BUS1 0x0010 /* placeholders for bus functions... */ -#define BUS_DMA_BUS2 0x0020 -#define BUS_DMA_BUS3 0x0040 -#define BUS_DMA_BUS4 0x0080 -#define BUS_DMA_READ 0x0100 /* mapping is device -> memory only */ -#define BUS_DMA_WRITE 0x0200 /* mapping is memory -> device only */ -#define BUS_DMA_STREAMING 0x0400 /* hint: sequential, unidirectional */ -#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */ -#define BUS_DMA_NOCACHE 0x1000 -#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */ - -/* Forwards needed by prototypes below. */ -struct mbuf; -struct proc; -struct uio; - -#define BUS_DMASYNC_POSTREAD 0x0001 -#define BUS_DMASYNC_POSTWRITE 0x0002 -#define BUS_DMASYNC_PREREAD 0x0004 -#define BUS_DMASYNC_PREWRITE 0x0008 - -typedef struct machine_bus_dma_tag *bus_dma_tag_t; -typedef struct machine_bus_dmamap *bus_dmamap_t; - -/* - * bus_dma_segment_t - * - * Describes a single contiguous DMA transaction. Values - * are suitable for programming into DMA registers. - */ -struct machine_bus_dma_segment { - bus_addr_t ds_addr; /* DMA address */ - bus_size_t ds_len; /* length of transfer */ - - paddr_t _ds_paddr; /* CPU address */ - vaddr_t _ds_vaddr; /* CPU address */ -}; -typedef struct machine_bus_dma_segment bus_dma_segment_t; - -/* - * bus_dma_tag_t - * - * A machine-dependent opaque type describing the implementation of - * DMA for a given bus. - */ - -struct machine_bus_dma_tag { - void *_cookie; /* cookie used in the guts */ - - /* - * DMA mapping methods. - */ - int (*_dmamap_create)(bus_dma_tag_t , bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); - void (*_dmamap_destroy)(bus_dma_tag_t , bus_dmamap_t); - int (*_dmamap_load)(bus_dma_tag_t , bus_dmamap_t, void *, - bus_size_t, struct proc *, int); - int (*_dmamap_load_mbuf)(bus_dma_tag_t , bus_dmamap_t, - struct mbuf *, int); - int (*_dmamap_load_uio)(bus_dma_tag_t , bus_dmamap_t, - struct uio *, int); - int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); - int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); - void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); - void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, - bus_addr_t, bus_size_t, int); - - /* - * DMA memory utility functions. - */ - int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); - void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int); - int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); - void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t); - paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *, - int, off_t, int, int); - - /* - * internal memory address translation information. - */ - bus_addr_t (*_pa_to_device)(paddr_t); - paddr_t (*_device_to_pa)(bus_addr_t); - bus_addr_t _dma_mask; -}; - -#define bus_dmamap_create(t, s, n, m, b, f, p) \ - (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p)) -#define bus_dmamap_destroy(t, p) \ - (*(t)->_dmamap_destroy)((t), (p)) -#define bus_dmamap_load(t, m, b, s, p, f) \ - (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f)) -#define bus_dmamap_load_mbuf(t, m, b, f) \ - (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f)) -#define bus_dmamap_load_uio(t, m, u, f) \ - (*(t)->_dmamap_load_uio)((t), (m), (u), (f)) -#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ - (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) -#define bus_dmamap_unload(t, p) \ - (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, a, l, o) \ - (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0) - -#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ - (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) -#define bus_dmamem_free(t, sg, n) \ - (*(t)->_dmamem_free)((t), (sg), (n)) -#define bus_dmamem_map(t, sg, n, s, k, f) \ - (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f)) -#define bus_dmamem_unmap(t, k, s) \ - (*(t)->_dmamem_unmap)((t), (k), (s)) -#define bus_dmamem_mmap(t, sg, n, o, p, f) \ - (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) - -int _dmamap_create(bus_dma_tag_t, bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); -void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); -int _dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int); -int _dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int); -int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int); -int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); -int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); -void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); -void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, - bus_size_t, int); - -int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); -void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int); -int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); -void _dmamem_unmap(bus_dma_tag_t, caddr_t, size_t); -paddr_t _dmamem_mmap(bus_dma_tag_t, bus_dma_segment_t *, int, off_t, int, int); -int _dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, - bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t); - -/* - * bus_dmamap_t - * - * Describes a DMA mapping. - */ -struct machine_bus_dmamap { - /* - * PRIVATE MEMBERS: not for use by machine-independent code. - */ - bus_size_t _dm_size; /* largest DMA transfer mappable */ - int _dm_segcnt; /* number of segs this map can map */ - bus_size_t _dm_maxsegsz; /* largest possible segment */ - bus_size_t _dm_boundary; /* don't cross this */ - int _dm_flags; /* misc. flags */ - - void *_dm_cookie; /* cookie for bus-specific functions */ - - /* - * PUBLIC MEMBERS: these are used by machine-independent code. - */ - bus_size_t dm_mapsize; /* size of the mapping */ - int dm_nsegs; /* # valid segments in mapping */ - bus_dma_segment_t dm_segs[1]; /* segments; variable length */ -}; - -#endif /* _MACHINE_BUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/conf.h b/lib/libc/include/mips64el-openbsd-none/machine/conf.h deleted file mode 100644 index 8eafed12d4280fe87a48ef344db8d720d17edd55..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: conf.h,v 1.4 2022/06/28 14:43:50 visa Exp $ */ -/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -/* open, close, write, ioctl, kqueue */ -#define cdev_apm_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, \ - (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,n,kqfilter) } - -cdev_decl(apm); \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/cpu.h b/lib/libc/include/mips64el-openbsd-none/machine/cpu.h deleted file mode 100644 index d3d84bf3dbf9833456225af945c4fb8a2d57af25..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/cpu.h +++ /dev/null @@ -1,103 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.8 2017/07/30 16:05:24 visa Exp $ */ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 - */ - -#ifdef _KERNEL - -#if defined(MULTIPROCESSOR) && !defined(_LOCORE) -#define MAXCPUS 4 -struct cpu_info; -struct cpu_info *hw_getcurcpu(void); -void hw_setcurcpu(struct cpu_info *); -void hw_cpu_boot_secondary(struct cpu_info *); -void hw_cpu_hatch(struct cpu_info *); -void hw_cpu_spinup_trampoline(struct cpu_info *); -int hw_ipi_intr_establish(int (*)(void *), u_long); -void hw_ipi_intr_set(u_long); -void hw_ipi_intr_clear(u_long); -#endif /* MULTIPROCESSOR && !_LOCORE */ - -#if defined(CPU_LOONGSON2) && !defined(CPU_LOONGSON3) -#define Mips_SyncCache(ci) \ - Loongson2_SyncCache((ci)) -#define Mips_InvalidateICache(ci, va, l) \ - Loongson2_InvalidateICache((ci), (va), (l)) -#define Mips_InvalidateICachePage(ci, va) \ - Loongson2_InvalidateICachePage((ci), (va)) -#define Mips_SyncICache(ci) \ - Loongson2_SyncICache((ci)) -#define Mips_SyncDCachePage(ci, va, pa) \ - Loongson2_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCachePage(ci, va, pa) \ - Loongson2_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCache(ci, va, l) \ - Loongson2_HitSyncDCache((ci), (va), (l)) -#define Mips_IOSyncDCache(ci, va, l, h) \ - Loongson2_IOSyncDCache((ci), (va), (l), (h)) -#define Mips_HitInvalidateDCache(ci, va, l) \ - Loongson2_HitInvalidateDCache((ci), (va), (l)) -#endif - -#if defined(CPU_LOONGSON3) && !defined(CPU_LOONGSON2) -#define Mips_SyncCache(ci) \ - Loongson3_SyncCache((ci)) -#define Mips_InvalidateICache(ci, va, l) \ - Loongson3_InvalidateICache((ci), (va), (l)) -#define Mips_InvalidateICachePage(ci, va) \ - Loongson3_InvalidateICachePage((ci), (va)) -#define Mips_SyncICache(ci) \ - Loongson3_SyncICache((ci)) -#define Mips_SyncDCachePage(ci, va, pa) \ - Loongson3_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCachePage(ci, va, pa) \ - Loongson3_SyncDCachePage((ci), (va), (pa)) -#define Mips_HitSyncDCache(ci, va, l) \ - Loongson3_HitSyncDCache((ci), (va), (l)) -#define Mips_IOSyncDCache(ci, va, l, h) \ - Loongson3_IOSyncDCache((ci), (va), (l), (h)) -#define Mips_HitInvalidateDCache(ci, va, l) \ - Loongson3_HitInvalidateDCache((ci), (va), (l)) -#endif - -#endif /* _KERNEL */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/cpustate.h b/lib/libc/include/mips64el-openbsd-none/machine/cpustate.h deleted file mode 100644 index f5aff1a41b0821e4223149081bd09917bbd5ead5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/cpustate.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cpustate.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/db_machdep.h b/lib/libc/include/mips64el-openbsd-none/machine/db_machdep.h deleted file mode 100644 index 3759d833718e73d1721d3c9d4e719e76c39fe568..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/db_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/elf.h b/lib/libc/include/mips64el-openbsd-none/machine/elf.h deleted file mode 100644 index 5918df727bdaf3cd8ab2b3b7df5c61cdc0b8b8ef..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/elf.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: elf.h,v 1.1 2024/07/14 19:33:59 miod Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/endian.h b/lib/libc/include/mips64el-openbsd-none/machine/endian.h deleted file mode 100644 index 2e7392a0828e58ea0353f15ea21bca2453d884eb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: endian.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/exec.h b/lib/libc/include/mips64el-openbsd-none/machine/exec.h deleted file mode 100644 index 53433783f0c0157fda10cb49ac0566fd0ae354c1..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/exec.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: exec.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/fpu.h b/lib/libc/include/mips64el-openbsd-none/machine/fpu.h deleted file mode 100644 index 19ee8af41438ceaa59169b2355572d0256f33272..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/fpu.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fpu.h,v 1.1 2010/09/17 00:34:04 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/frame.h b/lib/libc/include/mips64el-openbsd-none/machine/frame.h deleted file mode 100644 index d14827e33c0e4797ab96d1648b847715e058d110..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/frame.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: frame.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/ieee.h b/lib/libc/include/mips64el-openbsd-none/machine/ieee.h deleted file mode 100644 index d390acb3c59f1631bcb889841e5f9d27e9520a2f..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/ieee.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieee.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/ieeefp.h b/lib/libc/include/mips64el-openbsd-none/machine/ieeefp.h deleted file mode 100644 index 17e880358e20378250fc45526d8c18fa0aef70a6..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/ieeefp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/intr.h b/lib/libc/include/mips64el-openbsd-none/machine/intr.h deleted file mode 100644 index 64d103bc39aa71a0cb565ab4655c9d7eec4cbc21..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/intr.h +++ /dev/null @@ -1,193 +0,0 @@ -/* $OpenBSD: intr.h,v 1.19 2025/05/10 10:01:03 visa Exp $ */ - -/* - * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MACHINE_INTR_H_ -#define _MACHINE_INTR_H_ - -#define __USE_MI_SOFTINTR - -#include - -/* - * The interrupt level ipl is a logical level; per-platform interrupt - * code will turn it into the appropriate hardware interrupt masks - * values. - * - * Interrupt sources on the CPU are kept enabled regardless of the - * current ipl value; individual hardware sources interrupting while - * logically masked are masked on the fly, remembered as pending, and - * unmasked at the first splx() opportunity. - * - * An exception to this rule is the clock interrupt. Clock interrupts - * are always allowed to happen, but will (of course!) not be serviced - * if logically masked. The reason for this is that clocks usually sit on - * INT5 and cannot be easily masked if external hardware masking is used. - */ - -/* Interrupt priority `levels'; not mutually exclusive. */ -#define IPL_NONE 0 /* nothing */ -#define IPL_SOFTINT 1 /* soft interrupts */ -#define IPL_SOFTCLOCK 1 /* soft clock interrupts */ -#define IPL_SOFTNET 2 /* soft network interrupts */ -#define IPL_SOFTTTY 3 /* soft terminal interrupts */ -#define IPL_SOFTHIGH IPL_SOFTTTY /* highest level of soft interrupts */ -#define IPL_BIO 4 /* block I/O */ -#define IPL_AUDIO IPL_BIO -#define IPL_NET 5 /* network */ -#define IPL_TTY 6 /* terminal */ -#define IPL_VM 7 /* memory allocation */ -#define IPL_CLOCK 8 /* clock */ -#define IPL_STATCLOCK IPL_CLOCK -#define IPL_SCHED 9 /* everything */ -#define IPL_HIGH 9 /* everything */ -#define IPL_IPI 10 /* interprocessor interrupt */ -#define NIPLS 11 /* number of levels */ - -#define IPL_MPFLOOR IPL_TTY - -/* Interrupt priority 'flags'. */ -#define IPL_MPSAFE 0x100 - -/* Interrupt sharing types. */ -#define IST_NONE 0 /* none */ -#define IST_PULSE 1 /* pulsed */ -#define IST_EDGE 2 /* edge-triggered */ -#define IST_LEVEL 3 /* level-triggered */ - -#ifndef _LOCORE - -void softintr(int); - -#define splbio() splraise(IPL_BIO) -#define splnet() splraise(IPL_NET) -#define spltty() splraise(IPL_TTY) -#define splaudio() splraise(IPL_AUDIO) -#define splclock() splraise(IPL_CLOCK) -#define splvm() splraise(IPL_VM) -#define splhigh() splraise(IPL_HIGH) - -#define splsoftclock() splraise(IPL_SOFTCLOCK) -#define splsoftnet() splraise(IPL_SOFTNET) -#define splstatclock() splhigh() - -#define splsched() splhigh() -#define spl0() spllower(0) - -void splinit(void); - -#ifdef DIAGNOSTIC -/* - * Although this function is implemented in MI code, it must be in this MD - * header because we don't want this header to include MI includes. - */ -void splassert_fail(int, int, const char *); -extern int splassert_ctl; -void splassert_check(int, const char *); -#define splassert(__wantipl) do { \ - if (splassert_ctl > 0) { \ - splassert_check(__wantipl, __func__); \ - } \ -} while (0) -#define splsoftassert(wantipl) splassert(wantipl) -#else -#define splassert(X) -#define splsoftassert(X) -#endif - -void register_splx_handler(void (*)(int)); -int splraise(int); -void splx(int); -int spllower(int); - -/* - * Interrupt control struct used by interrupt dispatchers - * to hold interrupt handler info. - */ - -#include - -struct intrhand { - struct intrhand *ih_next; - int (*ih_fun)(void *); - void *ih_arg; - int ih_level; - int ih_irq; - int ih_flags; -#define IH_MPSAFE 0x01 - struct evcount ih_count; -}; - -void intr_barrier(void *); - -/* - * Low level interrupt dispatcher registration data. - */ - -/* Schedule priorities for base interrupts (CPU) */ -#define INTPRI_IPI 0 -#define INTPRI_CLOCK 1 -/* other values are system-specific */ - -#define NLOWINT 4 /* Number of low level registrations possible */ - -extern uint32_t idle_mask; - -struct trapframe; -void set_intr(int, uint32_t, uint32_t(*)(uint32_t, struct trapframe *)); - -uint32_t updateimask(uint32_t); -void dosoftint(void); - -#ifdef MULTIPROCESSOR -extern uint32_t ipi_mask; -#define ENABLEIPI() updateimask(~ipi_mask) -#endif - -struct pic { - void (*pic_eoi)(int); - void (*pic_mask)(int); - void (*pic_unmask)(int); -}; - -#ifdef CPU_LOONGSON3 - -void loongson3_intr_init(void); -void *loongson3_intr_establish(int, int, int (*)(void *), void*, - const char *); -void loongson3_intr_disestablish(void *); -void *loongson3_ht_intr_establish(int, int, int (*)(void *), void*, - const char *); -void loongson3_ht_intr_disestablish(void *); - -void loongson3_register_ht_pic(const struct pic *); - -#endif /* CPU_LOONGSON3 */ - -#endif /* _LOCORE */ - -#endif /* _MACHINE_INTR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/isa_machdep.h b/lib/libc/include/mips64el-openbsd-none/machine/isa_machdep.h deleted file mode 100644 index 201c218bd3fb5231555a293b7d1d2c3625772613..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/isa_machdep.h +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: isa_machdep.h,v 1.2 2010/05/08 21:59:56 miod Exp $ */ - -/* - * Copyright (c) 2007 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice, this permission notice, and the disclaimer below - * appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_ISA_MACHDEP_H_ -#define _MACHINE_ISA_MACHDEP_H_ - -#include - -#define __NO_ISA_INTR_CHECK - -typedef struct mips_isa_chipset *isa_chipset_tag_t; - -struct mips_isa_chipset { - void *ic_v; - - void (*ic_attach_hook)(struct device *, struct device *, - struct isabus_attach_args *); - void *(*ic_intr_establish)(void *, int, int, int, int (*)(void *), - void *, char *); - void (*ic_intr_disestablish)(void *, void *); -}; - -#define isa_attach_hook(p, s, iba) \ - (*(iba)->iba_ic->ic_attach_hook)((p), (s), (iba)) -#define isa_intr_establish(c, i, t, l, f, a, n) \ - (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (n)) -#define isa_intr_disestablish(c, h) \ - (*(c)->ic_intr_disestablish)((c)->ic_v, (h)) - -void loongson_generic_isa_attach_hook(struct device *, struct device *, - struct isabus_attach_args *); -void loongson_isa_specific_eoi(int); -void loongson_set_isa_imr(uint); - -#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/kcore.h b/lib/libc/include/mips64el-openbsd-none/machine/kcore.h deleted file mode 100644 index c38fa9f7f6e0ddea59ac1f0ea7850a38a2d22eca..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/kcore.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/limits.h b/lib/libc/include/mips64el-openbsd-none/machine/limits.h deleted file mode 100644 index 12007d997ad2c9432fc6ad13fabc963fed43c9f2..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: limits.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/loongson2.h b/lib/libc/include/mips64el-openbsd-none/machine/loongson2.h deleted file mode 100644 index 05688a8e0f9c45faa85f84be32d74c228bcbd3ab..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/loongson2.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: loongson2.h,v 1.1.1.1 2009/08/06 20:51:44 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/loongson3.h b/lib/libc/include/mips64el-openbsd-none/machine/loongson3.h deleted file mode 100644 index bcbe6ca7018fb2277e222d0662241f22d4e253bf..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/loongson3.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: loongson3.h,v 1.1 2016/11/06 10:20:33 visa Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/memconf.h b/lib/libc/include/mips64el-openbsd-none/machine/memconf.h deleted file mode 100644 index c7782048ac7eb9086d64bc2dd8b4d77e3e9d67bb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/memconf.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: memconf.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/mips_opcode.h b/lib/libc/include/mips64el-openbsd-none/machine/mips_opcode.h deleted file mode 100644 index 5b5cbc3494fdd59ac6aacae953cf3619c6d1530d..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/mips_opcode.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mips_opcode.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/mplock.h b/lib/libc/include/mips64el-openbsd-none/machine/mplock.h deleted file mode 100644 index dc963887f82cb06ab479ce94fdfddf76e44bb85e..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/mplock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mplock.h,v 1.1 2017/01/19 14:51:02 visa Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/mutex.h b/lib/libc/include/mips64el-openbsd-none/machine/mutex.h deleted file mode 100644 index 8003e465f6b6905278f3da97386d911071f9056b..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/mutex.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mutex.h,v 1.2 2015/07/08 13:37:31 dlg Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/param.h b/lib/libc/include/mips64el-openbsd-none/machine/param.h deleted file mode 100644 index 17092fa4a5a093ef5a4cd509b268b4fc28ef0bb5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/param.h +++ /dev/null @@ -1,27 +0,0 @@ -/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */ - -/* Public Domain */ - -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - -#define MACHINE "loongson" -#define _MACHINE loongson -#define MACHINE_ARCH "mips64el" /* not the canonical endianness */ -#define _MACHINE_ARCH mips64el -#define MACHINE_CPU "mips64" -#define _MACHINE_CPU mips64 -#define MID_MACHINE MID_MIPS64 - -/* - * The Loongson level 1 cache expects software to prevent virtual - * aliases. Unfortunately, since this cache is physically tagged, - * this would require all virtual address to have the same bits 14 - * and 13 as their physical addresses, which is not something the - * kernel can guarantee unless the page size is at least 16KB. - */ -#define PAGE_SHIFT 14 - -#include - -#endif /* _MACHINE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/pcb.h b/lib/libc/include/mips64el-openbsd-none/machine/pcb.h deleted file mode 100644 index e48bfc2f316c00e773efb610642791ad8d374be2..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/pcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.1.1.1 2009/07/31 09:26:25 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/pci_machdep.h b/lib/libc/include/mips64el-openbsd-none/machine/pci_machdep.h deleted file mode 100644 index ade283806c11d7029d43fe292cb48ad30d3cc5c7..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/pci_machdep.h +++ /dev/null @@ -1,101 +0,0 @@ -/* $OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $ */ - -/* - * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -typedef struct mips_pci_chipset *pci_chipset_tag_t; -typedef u_long pcitag_t; -typedef u_long pci_intr_handle_t; - -struct pci_attach_args; - -/* - * mips-specific PCI structure and type definitions. - * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. - */ -struct mips_pci_chipset { - void *pc_conf_v; - void (*pc_attach_hook)(struct device *, - struct device *, struct pcibus_attach_args *); - int (*pc_bus_maxdevs)(void *, int); - pcitag_t (*pc_make_tag)(void *, int, int, int); - void (*pc_decompose_tag)(void *, pcitag_t, int *, - int *, int *); - int (*pc_conf_size)(void *, pcitag_t); - pcireg_t (*pc_conf_read)(void *, pcitag_t, int); - void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); - - void *pc_intr_v; - int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *); - const char *(*pc_intr_string)(void *, pci_intr_handle_t); - void *(*pc_intr_establish)(void *, pci_intr_handle_t, - int, int (*)(void *), void *, char *); - void (*pc_intr_disestablish)(void *, void *); -}; - -/* - * Functions provided to machine-independent PCI code. - */ -#define pci_attach_hook(p, s, pba) \ - (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) -#define pci_bus_maxdevs(c, b) \ - (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b)) -#define pci_make_tag(c, b, d, f) \ - (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) -#define pci_decompose_tag(c, t, bp, dp, fp) \ - (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) -#define pci_conf_size(c, t) \ - (*(c)->pc_conf_size)((c)->pc_conf_v, (t)) -#define pci_conf_read(c, t, r) \ - (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) -#define pci_conf_write(c, t, r, v) \ - (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) -#define pci_intr_map(c, ihp) \ - (*(c)->pa_pc->pc_intr_map)((c), (ihp)) -#define pci_intr_map_msi(c, ihp) (-1) -#define pci_intr_map_msix(c, vec, ihp) (-1) -#define pci_intr_string(c, ih) \ - (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) -#define pci_intr_establish(c, ih, l, h, a, nm) \ - (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm)) -#define pci_intr_disestablish(c, iv) \ - (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) -#define pci_probe_device_hook(c, a) (0) - -#define pci_min_powerstate(c, t) (PCI_PMCSR_STATE_D3) -#define pci_set_powerstate_md(c, t, s, p) - -/* PCI view of CPU memory */ -extern paddr_t loongson_dma_base; - -/* - * Functions used during early system configuration. - */ - -extern pcitag_t (*pci_make_tag_early)(int, int, int); -extern pcireg_t (*pci_conf_read_early)(pcitag_t, int); - -#define pci_dev_postattach(a, b) \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/pmap.h b/lib/libc/include/mips64el-openbsd-none/machine/pmap.h deleted file mode 100644 index eda0b11a3c63e3b7ab53d099b6ca595215ad5302..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/pmap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/pmon.h b/lib/libc/include/mips64el-openbsd-none/machine/pmon.h deleted file mode 100644 index 7729adb4680ab9e77a1c0d174631e57be336d579..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/pmon.h +++ /dev/null @@ -1,209 +0,0 @@ -/* $OpenBSD: pmon.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */ - -/* - * Copyright (c) 2009, 2012 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_PMON_H_ -#define _MACHINE_PMON_H_ - -#if defined(_KERNEL) || defined(_STANDALONE) - -/* - * PMON2000 callvec definitions - */ - -/* 32-bit compatible types */ -typedef uint32_t pmon_size_t; -typedef int32_t pmon_ssize_t; -typedef int64_t pmon_off_t; - -int pmon_open(const char *, int, ...); -int pmon_close(int); -int pmon_read(int, void *, pmon_size_t); -pmon_ssize_t pmon_write(int, const void *, pmon_size_t); -pmon_off_t pmon_lseek(int, pmon_off_t, int); -int pmon_printf(const char *, ...); -void pmon_cacheflush(void); -char * pmon_gets(char *); - -#define PMON_MAXLN 256 /* internal gets() size limit */ - -extern int32_t pmon_callvec; - -const char *pmon_getarg(const int); -void pmon_init(int32_t, int32_t, int32_t, int32_t, uint32_t); - -#define PMON_ENVTYPE_ENVP 0 -#define PMON_ENVTYPE_EFI 1 -int pmon_getenvtype(void); - -/* - * The new environment interface is a /salmigondis/ of badly thought-out - * structs put together, pretending to be inspired by EFI but conveniently - * omitting key EFI structs because they are deemed non-applicable to - * MIPS systems. - * Of course, some fields are absolute addresses, while others are relative - * pointers, to add to the confusion. - */ - -struct pmon_env_reset { - void (*cold_boot)(void); /* not filled */ - void (*warm_boot)(void); - void (*boot)(unsigned int); /* not filled */ - void (*poweroff)(void); -}; - -/* all values are offsets relative to the beginning of the struct */ -struct pmon_env_ptr { - uint64_t offs_mem; - uint64_t offs_cpu; - uint64_t offs_sys; - uint64_t offs_irq; - uint64_t offs_iface; - uint64_t offs_special; - uint64_t offs_device; -}; - -struct pmon_env_smbios { - uint16_t version; - uint64_t vga_bios; - struct pmon_env_ptr ptrs; -}; - -struct pmon_env_efi { - uint64_t mps; /* not filled */ - uint64_t acpi; /* not filled */ - uint64_t acpi20; /* not filled */ - struct pmon_env_smbios bios; - uint64_t sal_systab; /* not filled */ - uint64_t bootinfo; /* not filled */ -}; - -struct pmon_env { - struct pmon_env_efi efi; - struct pmon_env_reset reset; -}; - -#define PMON_MEM_MAX 128 -struct pmon_env_mem_entry { - uint32_t node; - uint32_t type; -#define PMON_MEM_SYSTEM_LOW 1 /* physical memory <= 256 MB */ -#define PMON_MEM_SYSTEM_HIGH 2 /* physical memory > 256 MB */ -#define PMON_MEM_RESERVED 3 -#define PMON_MEM_PCI_IO 4 -#define PMON_MEM_PCI_MEM 5 -#define PMON_MEM_CPU_REGISTERS 6 -#define PMON_MEM_VIDEO_ROM 7 -#define PMON_MEM_OTHER_ROM 8 -#define PMON_MEM_ACPI_TABLE 9 - uint64_t address; - uint32_t size; -}; -struct pmon_env_mem { - uint16_t version; /* not filled */ - uint32_t nentries; - uint32_t mem_freq; - struct pmon_env_mem_entry mem_map[PMON_MEM_MAX]; -} __packed; - -struct pmon_env_cpu { - uint16_t version; /* not filled */ - uint32_t prid; /* cop0 PrID */ - uint32_t cputype; -/* 0 and 1 are supposedly intended for 2E and 2F, which do NOT provide this - interface; moreover Linux and PMON disagree on the values and have 2E and - 2F swapped. */ -#define PMON_CPUTYPE_LS3A 2 -#define PMON_CPUTYPE_LS3B 3 -#define PMON_CPUTYPE_LS1A 4 -#define PMON_CPUTYPE_LS1B 5 - uint32_t node; /* total number of NUMA nodes */ - uint16_t coreid; /* boot CPU core id */ - uint16_t reserved_cores; /* mask of reserved cores */ - uint32_t speed; - uint32_t ncpus; -} __packed; - -struct pmon_env_sys { - uint16_t version; /* not filled */ - uint32_t ccnuma_smp; - uint32_t double_channel; -} __packed; - -struct pmon_env_irq { - uint16_t version; /* not filled */ - uint16_t size; /* not filled */ - uint16_t rtr_bus; /* not filled */ - uint16_t rtr_devfn; /* not filled */ - uint32_t vendor; /* not filled */ - uint32_t device; /* not filled */ - uint32_t pic_type; -#define PMON_IRQ_PIC_HT 0 -#define PMON_IRQ_PIC_I8259 1 - uint64_t ht_interrupt_bit; - uint64_t ht_enable; - uint32_t node; - uint64_t pci_memory_space_start; - uint64_t pci_memory_space_end; - uint64_t pci_io_space_start; /* not filled */ - uint64_t pci_io_space_end; /* not filled */ - uint64_t pci_cfg_space; /* not filled */ -} __packed; - -struct pmon_env_iface { - uint16_t version; -#define PMON_IFACE_VERSION 0x0001 - uint16_t size; - uint8_t flag; - char description[64]; /* firmware version */ -} __packed; - -#define PMON_RESOURCE_MAX 128 -struct pmon_env_resource { - uint64_t start; - uint64_t end; - char name[64]; - uint32_t flags; -}; -struct pmon_env_special { - uint16_t version; - char name[64]; - uint32_t type; - struct pmon_env_resource resource[PMON_RESOURCE_MAX]; -}; - -struct pmon_env_device { - char name[64]; /* system description */ - uint32_t nentries; - struct pmon_env_resource resource[PMON_RESOURCE_MAX]; -}; - -const char *pmon_getenv(const char *); - -const struct pmon_env_reset *pmon_get_env_reset(void); -const struct pmon_env_smbios *pmon_get_env_smbios(void); -const struct pmon_env_mem *pmon_get_env_mem(void); -const struct pmon_env_cpu *pmon_get_env_cpu(void); -const struct pmon_env_sys *pmon_get_env_sys(void); -const struct pmon_env_irq *pmon_get_env_irq(void); -const struct pmon_env_iface *pmon_get_env_iface(void); -const struct pmon_env_special *pmon_get_env_special(void); -const struct pmon_env_device *pmon_get_env_device(void); - -#endif /* _KERNEL || _STANDALONE */ - -#endif /* _MACHINE_PMON_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/proc.h b/lib/libc/include/mips64el-openbsd-none/machine/proc.h deleted file mode 100644 index 27b68200cf3e4a6bc41e3b0508c88a0cda1e8f8b..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/proc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: proc.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/profile.h b/lib/libc/include/mips64el-openbsd-none/machine/profile.h deleted file mode 100644 index d258d1147b2dde2184faa06acd8dd2dd3ff70da7..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/profile.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: profile.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/pte.h b/lib/libc/include/mips64el-openbsd-none/machine/pte.h deleted file mode 100644 index 24c761d664776bcd5582463e73507b0dbc30b5e5..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/pte.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pte.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/ptrace.h b/lib/libc/include/mips64el-openbsd-none/machine/ptrace.h deleted file mode 100644 index bd8e886725336c5cb7c6446144b24abee4a70994..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/ptrace.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/reg.h b/lib/libc/include/mips64el-openbsd-none/machine/reg.h deleted file mode 100644 index aeecc496fedcc6c12355b089f99f5854affffcbb..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/reg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reg.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/regdef.h b/lib/libc/include/mips64el-openbsd-none/machine/regdef.h deleted file mode 100644 index 03ae54124e7638aa5f2678b6628d38371ef2f010..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/regdef.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: regdef.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/regnum.h b/lib/libc/include/mips64el-openbsd-none/machine/regnum.h deleted file mode 100644 index e371c1ed202ebcbbc576b98e86f6505550a93d89..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/regnum.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: regnum.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/setjmp.h b/lib/libc/include/mips64el-openbsd-none/machine/setjmp.h deleted file mode 100644 index c834f0409a59c3a37ba2775a1f0b7f297645be29..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/setjmp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/signal.h b/lib/libc/include/mips64el-openbsd-none/machine/signal.h deleted file mode 100644 index 7f4d38dee765615d064ae13976aa867a60ba9c91..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/signal.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: signal.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/spinlock.h b/lib/libc/include/mips64el-openbsd-none/machine/spinlock.h deleted file mode 100644 index 63f58612b808d2e6af8cd6f0354ef2e7d22ef416..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/spinlock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/sysarch.h b/lib/libc/include/mips64el-openbsd-none/machine/sysarch.h deleted file mode 100644 index 6dac08a77bf53343defb3088b3675f31e91bbdc0..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/sysarch.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: sysarch.h,v 1.1.1.1 2009/11/22 18:12:44 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/timetc.h b/lib/libc/include/mips64el-openbsd-none/machine/timetc.h deleted file mode 100644 index d3d291c815ca589d46f697b7f934e546a2490bcc..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/timetc.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $OpenBSD: timetc.h,v 1.2 2020/07/18 08:37:43 visa Exp $ */ -/* - * Copyright (c) 2020 Paul Irofti - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_TIMETC_H_ -#define _MACHINE_TIMETC_H_ - -#include - -#endif /* _MACHINE_TIMETC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/trap.h b/lib/libc/include/mips64el-openbsd-none/machine/trap.h deleted file mode 100644 index c700eedba183ed4dd57238d231a5592197584571..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/trap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: trap.h,v 1.1.1.1 2009/07/31 09:26:26 miod Exp $ */ -/* public domain */ -#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/vmparam.h b/lib/libc/include/mips64el-openbsd-none/machine/vmparam.h deleted file mode 100644 index c6c4b75cfe65f59dda99fec28215085d0f4e6f77..0000000000000000000000000000000000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/vmparam.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.5 2017/05/21 13:00:53 visa Exp $ */ -/* public domain */ -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ - -#define VM_PHYSSEG_MAX 8 /* Max number of physical memory segments */ -#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST - -#include - -#endif /* _MACHINE_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/_types.h b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/_types.h index e3d855f9a0dbee945b8d523c47ee2affe8ba5580..d6d4ef442c04de36f6bb09c7206fc60a0b0dd0ea 100644 --- a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/_types.h +++ b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,12 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -struct __va_list_tag; -typedef struct __va_list_tag * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/elf.h b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/elf.h index d1a121fff937d23eb097ed8964b5fe495edccd89..3b2da29dc98ddc3e0e1530d2908ae9e3e414e365 100644 --- a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/elf.h +++ b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */ +/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */ /* * This file is in the public domain. @@ -54,6 +54,7 @@ extern unsigned long hwcap2; #define PPC_FEATURE2_ISEL 0x08000000 #define PPC_FEATURE2_TAR 0x04000000 #define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000 +#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 #define PPC_FEATURE2_HTM_NOSC 0x01000000 #define PPC_FEATURE2_ARCH_3_00 0x00800000 #define PPC_FEATURE2_HAS_IEEE128 0x00400000 diff --git a/lib/libc/include/powerpc64-openbsd-none/machine/_types.h b/lib/libc/include/powerpc64-openbsd-none/machine/_types.h index c8b810163d813fdd1339779133064866bb5de929..4e331ed8a28849a74d596e6c0af855d917a0c315 100644 --- a/lib/libc/include/powerpc64-openbsd-none/machine/_types.h +++ b/lib/libc/include/powerpc64-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.4 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.5 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -123,11 +123,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/powerpc64-openbsd-none/machine/elf.h b/lib/libc/include/powerpc64-openbsd-none/machine/elf.h index d1a121fff937d23eb097ed8964b5fe495edccd89..3b2da29dc98ddc3e0e1530d2908ae9e3e414e365 100644 --- a/lib/libc/include/powerpc64-openbsd-none/machine/elf.h +++ b/lib/libc/include/powerpc64-openbsd-none/machine/elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */ +/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */ /* * This file is in the public domain. @@ -54,6 +54,7 @@ extern unsigned long hwcap2; #define PPC_FEATURE2_ISEL 0x08000000 #define PPC_FEATURE2_TAR 0x04000000 #define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000 +#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 #define PPC_FEATURE2_HTM_NOSC 0x01000000 #define PPC_FEATURE2_ARCH_3_00 0x00800000 #define PPC_FEATURE2_HAS_IEEE128 0x00400000 diff --git a/lib/libc/include/powerpc64-openbsd-none/powerpc64/_types.h b/lib/libc/include/powerpc64-openbsd-none/powerpc64/_types.h index c8b810163d813fdd1339779133064866bb5de929..4e331ed8a28849a74d596e6c0af855d917a0c315 100644 --- a/lib/libc/include/powerpc64-openbsd-none/powerpc64/_types.h +++ b/lib/libc/include/powerpc64-openbsd-none/powerpc64/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.4 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.5 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -123,11 +123,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/powerpc64-openbsd-none/powerpc64/elf.h b/lib/libc/include/powerpc64-openbsd-none/powerpc64/elf.h index d1a121fff937d23eb097ed8964b5fe495edccd89..3b2da29dc98ddc3e0e1530d2908ae9e3e414e365 100644 --- a/lib/libc/include/powerpc64-openbsd-none/powerpc64/elf.h +++ b/lib/libc/include/powerpc64-openbsd-none/powerpc64/elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.h,v 1.3 2025/02/19 18:25:03 jca Exp $ */ +/* $OpenBSD: elf.h,v 1.4 2026/07/21 19:37:06 gkoehler Exp $ */ /* * This file is in the public domain. @@ -54,6 +54,7 @@ extern unsigned long hwcap2; #define PPC_FEATURE2_ISEL 0x08000000 #define PPC_FEATURE2_TAR 0x04000000 #define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000 +#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 #define PPC_FEATURE2_HTM_NOSC 0x01000000 #define PPC_FEATURE2_ARCH_3_00 0x00800000 #define PPC_FEATURE2_HAS_IEEE128 0x00400000 diff --git a/lib/libc/include/riscv64-openbsd-none/machine/_types.h b/lib/libc/include/riscv64-openbsd-none/machine/_types.h index b5c1227f1e6ee8bfb02e03c04c71c91269a1868c..36530ad8866789a76513ddc2a75e5fdcf578e459 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/_types.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.5 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.6 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -124,11 +124,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/riscv64-openbsd-none/machine/bus.h b/lib/libc/include/riscv64-openbsd-none/machine/bus.h index 85999dfe9d44bf5a60520261340a4cc7232c9dc3..0efce8e152e17b031739fd13d96deb833a56ec57 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/bus.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.8 2025/08/03 14:03:12 jca Exp $ */ +/* $OpenBSD: bus.h,v 1.10 2026/06/22 21:12:12 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -371,6 +371,7 @@ struct machine_bus_dma_segment { paddr_t _ds_paddr; /* CPU address */ vaddr_t _ds_vaddr; /* CPU address */ + vaddr_t _ds_bounce_va; /* mapped bounced data */ int _ds_coherent; /* Coherently mapped */ }; typedef struct machine_bus_dma_segment bus_dma_segment_t; @@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t; struct machine_bus_dma_tag { void *_cookie; /* cookie used in the guts */ int _flags; /* misc. flags */ + paddr_t _low; /* lowest DMA-reachable address */ + paddr_t _high; /* highest DMA-reachable address */ /* * DMA mapping methods. @@ -401,7 +404,8 @@ struct machine_bus_dma_tag { int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, + int *, int *, int); void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -459,6 +463,8 @@ struct machine_bus_dma_tag { #define bus_dmamem_mmap(t, sg, n, o, p, f) \ (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) +void bus_dma_init(void); + int _dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _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); int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, int *, + int *, int); void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -501,6 +508,13 @@ struct machine_bus_dmamap { void *_dm_cookie; /* cookie for bus-specific functions */ + struct vm_page **_dm_pages; /* replacement pages */ + vaddr_t _dm_pgva; /* those above -- mapped */ + int _dm_npages; /* number of pages allocated */ + int _dm_nused; /* number of pages replaced */ + paddr_t _dm_low; /* lowest DMA-reachable address */ + paddr_t _dm_high; /* highest DMA-reachable address */ + /* * PUBLIC MEMBERS: these are used by machine-independent code. */ diff --git a/lib/libc/include/riscv64-openbsd-none/machine/cpu.h b/lib/libc/include/riscv64-openbsd-none/machine/cpu.h index cb55a811b59437be0822b8c34eb498ebbc7b61ce..392bb13c4cee9af472d069e38774a72538813979 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.28 2026/07/07 12:12:44 kettenis Exp $ */ /* * Copyright (c) 2019 Mike Larkin @@ -26,11 +26,13 @@ /* CTL_MACHDEP definitions. */ #define CPU_COMPATIBLE 1 /* compatible property */ -#define CPU_MAXID 2 /* number of valid machdep ids */ +#define CPU_LED_BLINK 2 /* int: blink leds? */ +#define CPU_MAXID 3 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "compatible", CTLTYPE_STRING }, \ + { "led_blink", CTLTYPE_INT }, \ } #ifdef _KERNEL @@ -42,6 +44,8 @@ #include #include +void cpu_identify_cleanup(void); + /* All the CLKF_* macros take a struct clockframe * as an argument. */ #define clockframe trapframe @@ -263,14 +267,29 @@ void delay (unsigned); extern void (*cpu_startclock_fcn)(void); +extern unsigned long riscv_hwcap; +extern size_t riscv_vlenb; + void fpu_save(struct proc *, struct trapframe *); void fpu_load(struct proc *); +int vector_instruction(register_t stval); +void vector_save(struct proc *, struct trapframe *); +void vector_load(struct proc *); + extern int cpu_errata_sifive_cip_1200; #define cpu_idle_enter() do { /* nothing */ } while (0) #define cpu_idle_leave() do { /* nothing */ } while (0) +struct blink_led { + void (*bl_func)(void *, int); + void *bl_arg; + SLIST_ENTRY(blink_led) bl_next; +}; + +void blink_led_register(struct blink_led *); + #endif /* _KERNEL */ #ifdef MULTIPROCESSOR diff --git a/lib/libc/include/riscv64-openbsd-none/machine/elf.h b/lib/libc/include/riscv64-openbsd-none/machine/elf.h index 651c966fb81c5c0760003241863f039a16c6abbf..32cd29d7331f8a68b69563ff82368ae123f9fabd 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/elf.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.h,v 1.3 2024/07/14 09:48:49 jca Exp $ */ +/* $OpenBSD: elf.h,v 1.4 2026/05/02 14:09:17 jsing Exp $ */ /*- * Copyright (c) 1996-1997 John D. Polstra. @@ -27,7 +27,7 @@ */ #ifndef _MACHINE_ELF_H_ -#define _MACHINE_ELF_H_ +#define _MACHINE_ELF_H_ /* * ELF definitions for the RISC-V architecture. @@ -35,18 +35,62 @@ #ifdef _KERNEL # define __HAVE_CPU_HWCAP -extern unsigned long hwcap; +# define __HAVE_CPU_HWCAP2 +extern unsigned long hwcap; +extern unsigned long hwcap2; #endif /* _KERNEL */ /* Flags passed in AT_HWCAP */ -#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a')) -#define HWCAP_ISA_I HWCAP_ISA_BIT('i') -#define HWCAP_ISA_M HWCAP_ISA_BIT('m') -#define HWCAP_ISA_A HWCAP_ISA_BIT('a') -#define HWCAP_ISA_F HWCAP_ISA_BIT('f') -#define HWCAP_ISA_D HWCAP_ISA_BIT('d') -#define HWCAP_ISA_C HWCAP_ISA_BIT('c') -#define HWCAP_ISA_G \ +#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a')) +#define HWCAP_ISA_I HWCAP_ISA_BIT('i') +#define HWCAP_ISA_M HWCAP_ISA_BIT('m') +#define HWCAP_ISA_A HWCAP_ISA_BIT('a') +#define HWCAP_ISA_F HWCAP_ISA_BIT('f') +#define HWCAP_ISA_D HWCAP_ISA_BIT('d') +#define HWCAP_ISA_G \ (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D) +#define HWCAP_ISA_B HWCAP_ISA_BIT('b') +#define HWCAP_ISA_C HWCAP_ISA_BIT('c') +#define HWCAP_ISA_H HWCAP_ISA_BIT('h') +#define HWCAP_ISA_V HWCAP_ISA_BIT('v') + +#ifdef _KERNEL +/* Kernel Used Extensions */ +#define HWCAP_ISA_K_OFFSET 32 +#define HWCAP_ISA_K_BIT(n) (1UL << (HWCAP_ISA_K_OFFSET + (n))) +#define HWCAP_ISA_K_MASK (0xffffUL << HWCAP_ISA_K_OFFSET) +#define HWCAP_ISA_ZICBOM HWCAP_ISA_K_BIT(0) /* Cache Block Management */ +#define HWCAP_ISA_ZICBOP HWCAP_ISA_K_BIT(1) /* Cache Block Prefetch */ +#define HWCAP_ISA_ZICBOZ HWCAP_ISA_K_BIT(2) /* Cache Block Zero */ + +/* Supervisor Extensions */ +#define HWCAP_ISA_S_OFFSET 48 +#define HWCAP_ISA_S_BIT(n) (1UL << (HWCAP_ISA_S_OFFSET + (n))) +#define HWCAP_ISA_S_MASK (0xffffUL << HWCAP_ISA_S_OFFSET) +#define HWCAP_ISA_SVNAPOT HWCAP_ISA_S_BIT(0) /* NAPOT Translation */ +#define HWCAP_ISA_SVPBMT HWCAP_ISA_S_BIT(1) /* Page-Based Memory Types */ +#define HWCAP_ISA_SVINVAL HWCAP_ISA_S_BIT(2) /* Cache Invalidation */ +#define HWCAP_ISA_SSTC HWCAP_ISA_S_BIT(3) /* Timer Interrupts */ +#define HWCAP_ISA_SCOFPMF HWCAP_ISA_S_BIT(4) /* Count Overflow */ +#define HWCAP_ISA_SSNPM HWCAP_ISA_S_BIT(5) /* Pointer Masking */ +#endif /* _KERNEL */ + +/* Flags passed in AT_HWCAP2 */ +#define HWCAP2_ISA_ZBA (1UL << 0) /* Address Generation */ +#define HWCAP2_ISA_ZBB (1UL << 1) /* Basic Bit Manipulation */ +#define HWCAP2_ISA_ZBC (1UL << 2) /* Carry-Less Multiplication */ +#define HWCAP2_ISA_ZBS (1UL << 3) /* Single-Bit */ +#define HWCAP2_ISA_ZFH (1UL << 4) /* Scalar Half Precision FP */ +#define HWCAP2_ISA_ZKT (1UL << 5) /* Data-Independent Execution */ +#define HWCAP2_ISA_ZVBB (1UL << 6) /* Vector Basic Bit Manipulation */ +#define HWCAP2_ISA_ZVBC (1UL << 7) /* Vector Carry-less Multiplication */ +#define HWCAP2_ISA_ZVFH (1UL << 8) /* Vector Half Precision FP */ +#define HWCAP2_ISA_ZVKG (1UL << 9) /* Vector GCM/GMAC */ +#define HWCAP2_ISA_ZVKNED (1UL << 10) /* Vector AES Block Cipher */ +#define HWCAP2_ISA_ZVKNHA (1UL << 11) /* Vector SHA-256 */ +#define HWCAP2_ISA_ZVKNHB (1UL << 12) /* Vector SHA-512 */ +#define HWCAP2_ISA_ZVKSED (1UL << 13) /* Vector ShangMi SM4 */ +#define HWCAP2_ISA_ZVKSH (1UL << 14) /* Vector ShangMi SM3 */ +#define HWCAP2_ISA_ZVKT (1UL << 15) /* Vector Data-Independent Execution */ #endif /* !_MACHINE_ELF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/machine/pcb.h b/lib/libc/include/riscv64-openbsd-none/machine/pcb.h index a1b6cb9e47409b0600a513384bc93ae95739feb6..af61df17626e012b234f9ac0d26696d0992c2fa6 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/pcb.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcb.h,v 1.4 2024/10/15 09:16:39 jsg Exp $ */ +/* $OpenBSD: pcb.h,v 1.5 2026/05/09 17:38:50 jsing Exp $ */ /* * Copyright (c) 2016 Dale Rahn @@ -31,11 +31,13 @@ struct pcb { u_int pcb_flags; #define PCB_FPU 0x00000001 /* Process had FPU initialized */ #define PCB_SINGLESTEP 0x00000002 /* Single step process */ +#define PCB_VECTOR 0x00000004 /* Process had vector initialized */ struct trapframe *pcb_tf; - register_t pcb_sp; // stack pointer of switchframe + register_t pcb_sp; /* stack pointer of switchframe */ - caddr_t pcb_onfault; // On fault handler - struct fpreg pcb_fpstate; // Floating Point state */ + caddr_t pcb_onfault; /* On fault handler */ + struct fpreg pcb_fpstate; /* Floating Point state */ + struct vreg *pcb_vstate; /* Vector state */ }; #endif /* _MACHINE_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/machine/reg.h b/lib/libc/include/riscv64-openbsd-none/machine/reg.h index f80b13d4aa2fc703581d191d41eeced37f2330ca..c742bfd0629df9d1ad8e2df83e2ce672273b54b8 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/reg.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.2 2021/05/12 01:20:52 jsg Exp $ */ +/* $OpenBSD: reg.h,v 1.3 2026/05/09 17:38:50 jsing Exp $ */ /*- * Copyright (c) 2019 Brian Bamsch @@ -57,4 +57,12 @@ struct fpreg { uint64_t fp_fcsr; /* floating-point control register */ }; +struct vreg { + uint64_t v_vtype; /* vector type control register */ + uint64_t v_vl; /* vector length control register */ + uint64_t v_vstart; /* vector start control register */ + uint64_t v_vcsr; /* vector control and status register */ + uint8_t v_vdata[]; /* vector register data (sized based on vlenb) */ +}; + #endif /* !_MACHINE_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/machine/riscvreg.h b/lib/libc/include/riscv64-openbsd-none/machine/riscvreg.h index cf19db3ca1d3e654c02b16034478097ac58e62b0..a009fe60b90d31b680d7ffc42f3d7b5b0a9b243e 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/riscvreg.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/riscvreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: riscvreg.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: riscvreg.h,v 1.8 2026/07/24 10:51:00 kettenis Exp $ */ /*- * Copyright (c) 2019 Brian Bamsch @@ -67,6 +67,8 @@ #define MSTATUS_SPIE (1 << 5) #define MSTATUS_MPIE (1 << 7) #define MSTATUS_SPP (1 << 8) +#define MSTATUS_VS_SHIFT 9 +#define MSTATUS_VS_MASK (0x3 << MSTATUS_VS_SHIFT) #define MSTATUS_MPP_SHIFT 11 #define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT) #define MSTATUS_FS_SHIFT 13 @@ -90,6 +92,12 @@ #define SSTATUS_UPIE (1 << 4) #define SSTATUS_SPIE (1 << 5) #define SSTATUS_SPP (1 << 8) +#define SSTATUS_VS_SHIFT 9 +#define SSTATUS_VS_MASK (0x3 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_OFF (0x0 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_INITIAL (0x1 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_CLEAN (0x2 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_DIRTY (0x3 << SSTATUS_VS_SHIFT) #define SSTATUS_FS_SHIFT 13 #define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT) #define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT) @@ -154,6 +162,9 @@ #define UIP_UTIP (1 << 4) #define UIP_UEIP (1 << 8) +#define STOPEI_ID_MASK (0x7ff << STOPEI_ID_SHIFT) +#define STOPEI_ID_SHIFT 16 + #define PPN(pa) ((pa) >> PAGE_SHIFT) #define SATP_PPN_SHIFT 0 #define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT) @@ -191,18 +202,27 @@ #define INSN_SIZE 4 #define INSN_C_SIZE 2 +/* + * The maximum vector register length in bits (VLEN) is 65,536, as + * documented in section 31.2 of the The RISC-V Instruction Set Manual, + * Volume I: Unprivileged Architecture (Version 20260120). + */ +#define VLEN_MAX 65536 +#define VLEN_BYTES_MAX (VLEN_MAX / 8) + // Check if val can fit in the CSR immediate form #define CSR_ZIMM(val) \ (__builtin_constant_p(val) && ((u_long)(val) < 32)) #define csr_swap(csr, val) \ -({ if (CSR_ZIMM(val)) \ +({ u_long ret; \ + if (CSR_ZIMM(val)) \ __asm volatile("csrrwi %0, " #csr ", %1" \ - : "=r" (val) : "i" (val)); \ + : "=r" (ret) : "i" (val)); \ else \ - __asm volatile("csrrw %0, " #csr ", %1" \ - : "=r" (val) : "r" (val)); \ - val; \ + __asm volatile("csrrw %0, " #csr ", %1" \ + : "=r" (ret) : "r" (val)); \ + ret; \ }) #define csr_write(csr, val) \ diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/_types.h b/lib/libc/include/riscv64-openbsd-none/riscv64/_types.h index b5c1227f1e6ee8bfb02e03c04c71c91269a1868c..36530ad8866789a76513ddc2a75e5fdcf578e459 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/_types.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.5 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.6 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -124,11 +124,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/bus.h b/lib/libc/include/riscv64-openbsd-none/riscv64/bus.h index 85999dfe9d44bf5a60520261340a4cc7232c9dc3..0efce8e152e17b031739fd13d96deb833a56ec57 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/bus.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.8 2025/08/03 14:03:12 jca Exp $ */ +/* $OpenBSD: bus.h,v 1.10 2026/06/22 21:12:12 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -371,6 +371,7 @@ struct machine_bus_dma_segment { paddr_t _ds_paddr; /* CPU address */ vaddr_t _ds_vaddr; /* CPU address */ + vaddr_t _ds_bounce_va; /* mapped bounced data */ int _ds_coherent; /* Coherently mapped */ }; typedef struct machine_bus_dma_segment bus_dma_segment_t; @@ -385,6 +386,8 @@ typedef struct machine_bus_dma_segment bus_dma_segment_t; struct machine_bus_dma_tag { void *_cookie; /* cookie used in the guts */ int _flags; /* misc. flags */ + paddr_t _low; /* lowest DMA-reachable address */ + paddr_t _high; /* highest DMA-reachable address */ /* * DMA mapping methods. @@ -401,7 +404,8 @@ struct machine_bus_dma_tag { int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int (*_dmamap_load_buffer)(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, + int *, int *, int); void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -459,6 +463,8 @@ struct machine_bus_dma_tag { #define bus_dmamem_mmap(t, sg, n, o, p, f) \ (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) +void bus_dma_init(void); + int _dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _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); int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int, paddr_t *, int *, int); + bus_size_t, struct proc *, int, paddr_t *, int *, int *, + int *, int); void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); @@ -501,6 +508,13 @@ struct machine_bus_dmamap { void *_dm_cookie; /* cookie for bus-specific functions */ + struct vm_page **_dm_pages; /* replacement pages */ + vaddr_t _dm_pgva; /* those above -- mapped */ + int _dm_npages; /* number of pages allocated */ + int _dm_nused; /* number of pages replaced */ + paddr_t _dm_low; /* lowest DMA-reachable address */ + paddr_t _dm_high; /* highest DMA-reachable address */ + /* * PUBLIC MEMBERS: these are used by machine-independent code. */ diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h b/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h index cb55a811b59437be0822b8c34eb498ebbc7b61ce..392bb13c4cee9af472d069e38774a72538813979 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.28 2026/07/07 12:12:44 kettenis Exp $ */ /* * Copyright (c) 2019 Mike Larkin @@ -26,11 +26,13 @@ /* CTL_MACHDEP definitions. */ #define CPU_COMPATIBLE 1 /* compatible property */ -#define CPU_MAXID 2 /* number of valid machdep ids */ +#define CPU_LED_BLINK 2 /* int: blink leds? */ +#define CPU_MAXID 3 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "compatible", CTLTYPE_STRING }, \ + { "led_blink", CTLTYPE_INT }, \ } #ifdef _KERNEL @@ -42,6 +44,8 @@ #include #include +void cpu_identify_cleanup(void); + /* All the CLKF_* macros take a struct clockframe * as an argument. */ #define clockframe trapframe @@ -263,14 +267,29 @@ void delay (unsigned); extern void (*cpu_startclock_fcn)(void); +extern unsigned long riscv_hwcap; +extern size_t riscv_vlenb; + void fpu_save(struct proc *, struct trapframe *); void fpu_load(struct proc *); +int vector_instruction(register_t stval); +void vector_save(struct proc *, struct trapframe *); +void vector_load(struct proc *); + extern int cpu_errata_sifive_cip_1200; #define cpu_idle_enter() do { /* nothing */ } while (0) #define cpu_idle_leave() do { /* nothing */ } while (0) +struct blink_led { + void (*bl_func)(void *, int); + void *bl_arg; + SLIST_ENTRY(blink_led) bl_next; +}; + +void blink_led_register(struct blink_led *); + #endif /* _KERNEL */ #ifdef MULTIPROCESSOR diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/elf.h b/lib/libc/include/riscv64-openbsd-none/riscv64/elf.h index 651c966fb81c5c0760003241863f039a16c6abbf..32cd29d7331f8a68b69563ff82368ae123f9fabd 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/elf.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.h,v 1.3 2024/07/14 09:48:49 jca Exp $ */ +/* $OpenBSD: elf.h,v 1.4 2026/05/02 14:09:17 jsing Exp $ */ /*- * Copyright (c) 1996-1997 John D. Polstra. @@ -27,7 +27,7 @@ */ #ifndef _MACHINE_ELF_H_ -#define _MACHINE_ELF_H_ +#define _MACHINE_ELF_H_ /* * ELF definitions for the RISC-V architecture. @@ -35,18 +35,62 @@ #ifdef _KERNEL # define __HAVE_CPU_HWCAP -extern unsigned long hwcap; +# define __HAVE_CPU_HWCAP2 +extern unsigned long hwcap; +extern unsigned long hwcap2; #endif /* _KERNEL */ /* Flags passed in AT_HWCAP */ -#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a')) -#define HWCAP_ISA_I HWCAP_ISA_BIT('i') -#define HWCAP_ISA_M HWCAP_ISA_BIT('m') -#define HWCAP_ISA_A HWCAP_ISA_BIT('a') -#define HWCAP_ISA_F HWCAP_ISA_BIT('f') -#define HWCAP_ISA_D HWCAP_ISA_BIT('d') -#define HWCAP_ISA_C HWCAP_ISA_BIT('c') -#define HWCAP_ISA_G \ +#define HWCAP_ISA_BIT(c) (1 << ((c) - 'a')) +#define HWCAP_ISA_I HWCAP_ISA_BIT('i') +#define HWCAP_ISA_M HWCAP_ISA_BIT('m') +#define HWCAP_ISA_A HWCAP_ISA_BIT('a') +#define HWCAP_ISA_F HWCAP_ISA_BIT('f') +#define HWCAP_ISA_D HWCAP_ISA_BIT('d') +#define HWCAP_ISA_G \ (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D) +#define HWCAP_ISA_B HWCAP_ISA_BIT('b') +#define HWCAP_ISA_C HWCAP_ISA_BIT('c') +#define HWCAP_ISA_H HWCAP_ISA_BIT('h') +#define HWCAP_ISA_V HWCAP_ISA_BIT('v') + +#ifdef _KERNEL +/* Kernel Used Extensions */ +#define HWCAP_ISA_K_OFFSET 32 +#define HWCAP_ISA_K_BIT(n) (1UL << (HWCAP_ISA_K_OFFSET + (n))) +#define HWCAP_ISA_K_MASK (0xffffUL << HWCAP_ISA_K_OFFSET) +#define HWCAP_ISA_ZICBOM HWCAP_ISA_K_BIT(0) /* Cache Block Management */ +#define HWCAP_ISA_ZICBOP HWCAP_ISA_K_BIT(1) /* Cache Block Prefetch */ +#define HWCAP_ISA_ZICBOZ HWCAP_ISA_K_BIT(2) /* Cache Block Zero */ + +/* Supervisor Extensions */ +#define HWCAP_ISA_S_OFFSET 48 +#define HWCAP_ISA_S_BIT(n) (1UL << (HWCAP_ISA_S_OFFSET + (n))) +#define HWCAP_ISA_S_MASK (0xffffUL << HWCAP_ISA_S_OFFSET) +#define HWCAP_ISA_SVNAPOT HWCAP_ISA_S_BIT(0) /* NAPOT Translation */ +#define HWCAP_ISA_SVPBMT HWCAP_ISA_S_BIT(1) /* Page-Based Memory Types */ +#define HWCAP_ISA_SVINVAL HWCAP_ISA_S_BIT(2) /* Cache Invalidation */ +#define HWCAP_ISA_SSTC HWCAP_ISA_S_BIT(3) /* Timer Interrupts */ +#define HWCAP_ISA_SCOFPMF HWCAP_ISA_S_BIT(4) /* Count Overflow */ +#define HWCAP_ISA_SSNPM HWCAP_ISA_S_BIT(5) /* Pointer Masking */ +#endif /* _KERNEL */ + +/* Flags passed in AT_HWCAP2 */ +#define HWCAP2_ISA_ZBA (1UL << 0) /* Address Generation */ +#define HWCAP2_ISA_ZBB (1UL << 1) /* Basic Bit Manipulation */ +#define HWCAP2_ISA_ZBC (1UL << 2) /* Carry-Less Multiplication */ +#define HWCAP2_ISA_ZBS (1UL << 3) /* Single-Bit */ +#define HWCAP2_ISA_ZFH (1UL << 4) /* Scalar Half Precision FP */ +#define HWCAP2_ISA_ZKT (1UL << 5) /* Data-Independent Execution */ +#define HWCAP2_ISA_ZVBB (1UL << 6) /* Vector Basic Bit Manipulation */ +#define HWCAP2_ISA_ZVBC (1UL << 7) /* Vector Carry-less Multiplication */ +#define HWCAP2_ISA_ZVFH (1UL << 8) /* Vector Half Precision FP */ +#define HWCAP2_ISA_ZVKG (1UL << 9) /* Vector GCM/GMAC */ +#define HWCAP2_ISA_ZVKNED (1UL << 10) /* Vector AES Block Cipher */ +#define HWCAP2_ISA_ZVKNHA (1UL << 11) /* Vector SHA-256 */ +#define HWCAP2_ISA_ZVKNHB (1UL << 12) /* Vector SHA-512 */ +#define HWCAP2_ISA_ZVKSED (1UL << 13) /* Vector ShangMi SM4 */ +#define HWCAP2_ISA_ZVKSH (1UL << 14) /* Vector ShangMi SM3 */ +#define HWCAP2_ISA_ZVKT (1UL << 15) /* Vector Data-Independent Execution */ #endif /* !_MACHINE_ELF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/pcb.h b/lib/libc/include/riscv64-openbsd-none/riscv64/pcb.h index a1b6cb9e47409b0600a513384bc93ae95739feb6..af61df17626e012b234f9ac0d26696d0992c2fa6 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/pcb.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcb.h,v 1.4 2024/10/15 09:16:39 jsg Exp $ */ +/* $OpenBSD: pcb.h,v 1.5 2026/05/09 17:38:50 jsing Exp $ */ /* * Copyright (c) 2016 Dale Rahn @@ -31,11 +31,13 @@ struct pcb { u_int pcb_flags; #define PCB_FPU 0x00000001 /* Process had FPU initialized */ #define PCB_SINGLESTEP 0x00000002 /* Single step process */ +#define PCB_VECTOR 0x00000004 /* Process had vector initialized */ struct trapframe *pcb_tf; - register_t pcb_sp; // stack pointer of switchframe + register_t pcb_sp; /* stack pointer of switchframe */ - caddr_t pcb_onfault; // On fault handler - struct fpreg pcb_fpstate; // Floating Point state */ + caddr_t pcb_onfault; /* On fault handler */ + struct fpreg pcb_fpstate; /* Floating Point state */ + struct vreg *pcb_vstate; /* Vector state */ }; #endif /* _MACHINE_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/reg.h b/lib/libc/include/riscv64-openbsd-none/riscv64/reg.h index f80b13d4aa2fc703581d191d41eeced37f2330ca..c742bfd0629df9d1ad8e2df83e2ce672273b54b8 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/reg.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.2 2021/05/12 01:20:52 jsg Exp $ */ +/* $OpenBSD: reg.h,v 1.3 2026/05/09 17:38:50 jsing Exp $ */ /*- * Copyright (c) 2019 Brian Bamsch @@ -57,4 +57,12 @@ struct fpreg { uint64_t fp_fcsr; /* floating-point control register */ }; +struct vreg { + uint64_t v_vtype; /* vector type control register */ + uint64_t v_vl; /* vector length control register */ + uint64_t v_vstart; /* vector start control register */ + uint64_t v_vcsr; /* vector control and status register */ + uint8_t v_vdata[]; /* vector register data (sized based on vlenb) */ +}; + #endif /* !_MACHINE_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/riscvreg.h b/lib/libc/include/riscv64-openbsd-none/riscv64/riscvreg.h index cf19db3ca1d3e654c02b16034478097ac58e62b0..a009fe60b90d31b680d7ffc42f3d7b5b0a9b243e 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/riscvreg.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/riscvreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: riscvreg.h,v 1.5 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: riscvreg.h,v 1.8 2026/07/24 10:51:00 kettenis Exp $ */ /*- * Copyright (c) 2019 Brian Bamsch @@ -67,6 +67,8 @@ #define MSTATUS_SPIE (1 << 5) #define MSTATUS_MPIE (1 << 7) #define MSTATUS_SPP (1 << 8) +#define MSTATUS_VS_SHIFT 9 +#define MSTATUS_VS_MASK (0x3 << MSTATUS_VS_SHIFT) #define MSTATUS_MPP_SHIFT 11 #define MSTATUS_MPP_MASK (0x3 << MSTATUS_MPP_SHIFT) #define MSTATUS_FS_SHIFT 13 @@ -90,6 +92,12 @@ #define SSTATUS_UPIE (1 << 4) #define SSTATUS_SPIE (1 << 5) #define SSTATUS_SPP (1 << 8) +#define SSTATUS_VS_SHIFT 9 +#define SSTATUS_VS_MASK (0x3 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_OFF (0x0 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_INITIAL (0x1 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_CLEAN (0x2 << SSTATUS_VS_SHIFT) +#define SSTATUS_VS_DIRTY (0x3 << SSTATUS_VS_SHIFT) #define SSTATUS_FS_SHIFT 13 #define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT) #define SSTATUS_FS_OFF (0x0 << SSTATUS_FS_SHIFT) @@ -154,6 +162,9 @@ #define UIP_UTIP (1 << 4) #define UIP_UEIP (1 << 8) +#define STOPEI_ID_MASK (0x7ff << STOPEI_ID_SHIFT) +#define STOPEI_ID_SHIFT 16 + #define PPN(pa) ((pa) >> PAGE_SHIFT) #define SATP_PPN_SHIFT 0 #define SATP_PPN_MASK (0xfffffffffffULL << SATP_PPN_SHIFT) @@ -191,18 +202,27 @@ #define INSN_SIZE 4 #define INSN_C_SIZE 2 +/* + * The maximum vector register length in bits (VLEN) is 65,536, as + * documented in section 31.2 of the The RISC-V Instruction Set Manual, + * Volume I: Unprivileged Architecture (Version 20260120). + */ +#define VLEN_MAX 65536 +#define VLEN_BYTES_MAX (VLEN_MAX / 8) + // Check if val can fit in the CSR immediate form #define CSR_ZIMM(val) \ (__builtin_constant_p(val) && ((u_long)(val) < 32)) #define csr_swap(csr, val) \ -({ if (CSR_ZIMM(val)) \ +({ u_long ret; \ + if (CSR_ZIMM(val)) \ __asm volatile("csrrwi %0, " #csr ", %1" \ - : "=r" (val) : "i" (val)); \ + : "=r" (ret) : "i" (val)); \ else \ - __asm volatile("csrrw %0, " #csr ", %1" \ - : "=r" (val) : "r" (val)); \ - val; \ + __asm volatile("csrrw %0, " #csr ", %1" \ + : "=r" (ret) : "r" (val)); \ + ret; \ }) #define csr_write(csr, val) \ diff --git a/lib/libc/include/sparc64-openbsd-none/machine/_types.h b/lib/libc/include/sparc64-openbsd-none/machine/_types.h index b0d11eb13a20cabcb551efe7c23783083043123d..6e5c37bce3e88a97577e57701f720e26bdfa9ea3 100644 --- a/lib/libc/include/sparc64-openbsd-none/machine/_types.h +++ b/lib/libc/include/sparc64-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/sparc64-openbsd-none/sparc64/_types.h b/lib/libc/include/sparc64-openbsd-none/sparc64/_types.h index b0d11eb13a20cabcb551efe7c23783083043123d..6e5c37bce3e88a97577e57701f720e26bdfa9ea3 100644 --- a/lib/libc/include/sparc64-openbsd-none/sparc64/_types.h +++ b/lib/libc/include/sparc64-openbsd-none/sparc64/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/x86-openbsd-none/i386/_types.h b/lib/libc/include/x86-openbsd-none/i386/_types.h index b9c612f1bb4a8eadd97c7d4dd85b119e705c7d4a..b3bf0c94fc4c35e7a74f3026074ac3d4e36f7dbd 100644 --- a/lib/libc/include/x86-openbsd-none/i386/_types.h +++ b/lib/libc/include/x86-openbsd-none/i386/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef long double __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/x86-openbsd-none/i386/i82489reg.h b/lib/libc/include/x86-openbsd-none/i386/i82489reg.h index bb3c256cfb899617a33cc972ae8a48a372df6d87..54bcde2a1457fb7f85c9c43490ac8ad18a90facc 100644 --- a/lib/libc/include/x86-openbsd-none/i386/i82489reg.h +++ b/lib/libc/include/x86-openbsd-none/i386/i82489reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */ +/* $OpenBSD: i82489reg.h,v 1.6 2026/09/19 07:04:46 jsg Exp $ */ /* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */ /*- @@ -110,7 +110,7 @@ # define LAPIC_LVTT_VEC_MASK 0x000000ff # define LAPIC_LVTT_DS 0x00001000 # define LAPIC_LVTT_M 0x00010000 -# define LAPIC_LVTT_TM 0x00020000 +# define LAPIC_LVTT_TM 0x00060000 # define LAPIC_LVTT_TM_ONESHOT 0x00000000 # define LAPIC_LVTT_TM_PERIODIC 0x00020000 # define LAPIC_LVTT_TM_TSCDL 0x00040000 diff --git a/lib/libc/include/x86-openbsd-none/i386/specialreg.h b/lib/libc/include/x86-openbsd-none/i386/specialreg.h index d6872cec0b00679bbe9163bbdbb68360ca41767a..85104d1a842169fd5e91af6698be3d7534008f13 100644 --- a/lib/libc/include/x86-openbsd-none/i386/specialreg.h +++ b/lib/libc/include/x86-openbsd-none/i386/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.87 2026/05/14 01:39:38 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */ /*- @@ -535,6 +535,9 @@ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ #define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ +#define MSR_BP_CFG 0xc001102e +#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */ + #define IPM_C1E_CMP_HLT 0x10000000 #define IPM_SMI_CMP_HLT 0x08000000 diff --git a/lib/libc/include/x86-openbsd-none/machine/_types.h b/lib/libc/include/x86-openbsd-none/machine/_types.h index b9c612f1bb4a8eadd97c7d4dd85b119e705c7d4a..b3bf0c94fc4c35e7a74f3026074ac3d4e36f7dbd 100644 --- a/lib/libc/include/x86-openbsd-none/machine/_types.h +++ b/lib/libc/include/x86-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.26 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef long double __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/x86-openbsd-none/machine/i82489reg.h b/lib/libc/include/x86-openbsd-none/machine/i82489reg.h index bb3c256cfb899617a33cc972ae8a48a372df6d87..54bcde2a1457fb7f85c9c43490ac8ad18a90facc 100644 --- a/lib/libc/include/x86-openbsd-none/machine/i82489reg.h +++ b/lib/libc/include/x86-openbsd-none/machine/i82489reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */ +/* $OpenBSD: i82489reg.h,v 1.6 2026/09/19 07:04:46 jsg Exp $ */ /* $NetBSD: i82489reg.h,v 1.1.2.1 2000/02/20 16:30:27 sommerfeld Exp $ */ /*- @@ -110,7 +110,7 @@ # define LAPIC_LVTT_VEC_MASK 0x000000ff # define LAPIC_LVTT_DS 0x00001000 # define LAPIC_LVTT_M 0x00010000 -# define LAPIC_LVTT_TM 0x00020000 +# define LAPIC_LVTT_TM 0x00060000 # define LAPIC_LVTT_TM_ONESHOT 0x00000000 # define LAPIC_LVTT_TM_PERIODIC 0x00020000 # define LAPIC_LVTT_TM_TSCDL 0x00040000 diff --git a/lib/libc/include/x86-openbsd-none/machine/specialreg.h b/lib/libc/include/x86-openbsd-none/machine/specialreg.h index d6872cec0b00679bbe9163bbdbb68360ca41767a..85104d1a842169fd5e91af6698be3d7534008f13 100644 --- a/lib/libc/include/x86-openbsd-none/machine/specialreg.h +++ b/lib/libc/include/x86-openbsd-none/machine/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.87 2026/05/14 01:39:38 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */ /*- @@ -535,6 +535,9 @@ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ #define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ +#define MSR_BP_CFG 0xc001102e +#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */ + #define IPM_C1E_CMP_HLT 0x10000000 #define IPM_SMI_CMP_HLT 0x08000000 diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/_types.h b/lib/libc/include/x86_64-openbsd-none/amd64/_types.h index 6d48c5e0337ad2a3fcdc5497996ffd8d5efc6fce..e6976f252e0f7b5c9e59ffeaca724265a9fea0b1 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/_types.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.19 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.20 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/bus.h b/lib/libc/include/x86_64-openbsd-none/amd64/bus.h index 140e3a73f3d476c60a61e8a599e10dfb145fc5e8..76b0193482ac26eb6aa348ce05f9d19b2bac2223 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/bus.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.37 2025/08/23 10:15:49 sf Exp $ */ +/* $OpenBSD: bus.h,v 1.38 2026/04/19 09:59:22 kettenis Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -671,6 +671,8 @@ struct bus_dmamap { bus_dma_segment_t dm_segs[1]; /* segments; variable length */ }; +void bus_dma_init(void); + int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h b/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h index cc0b57cdb6a47a06b9fc003db5310834e4a6e60c..28608fe42cc4c310aa44cab0e8c7f513e25394d3 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.186 2026/09/08 21:01:59 daniel Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -170,6 +170,7 @@ struct cpu_info { u_int32_t ci_feature_sefflags_ebx;/* [I] */ u_int32_t ci_feature_sefflags_ecx;/* [I] */ u_int32_t ci_feature_sefflags_edx;/* [I] */ + u_int32_t ci_feature_sefflags_2_edx;/* [I] */ u_int32_t ci_feature_amdspec_ebx; /* [I] */ u_int32_t ci_feature_amdsev_eax; /* [I] */ u_int32_t ci_feature_amdsev_ebx; /* [I] */ diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h b/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h index 0f7b5cccf2295c7062a1346d70dca43b9124e157..787641ca870dee13f43a72f7fbcc97248394760b 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.48 2026/07/28 15:08:06 hshoexer Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void) wbinvd(); return 0; } - -static inline int -wbinvd_on_all_cpus_acked(void) -{ - wbinvd(); - return 0; -} #endif /* MULTIPROCESSOR */ static __inline void diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h b/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h index 159b8d57273af87d64158b70d1daf97f87ad11fa..589ef42e21689095303e6b2755c144548005dbab 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */ +/* $OpenBSD: ghcb.h,v 1.8 2026/08/19 08:56:28 hshoexer Exp $ */ /* * Copyright (c) 2024, 2025 Hans-Joerg Hoexer @@ -19,6 +19,8 @@ #ifndef _MACHINE_GHCB_H_ #define _MACHINE_GHCB_H_ +#ifdef AMDSEV + #ifndef _LOCORE #include @@ -42,6 +44,19 @@ #define GHCB_MAX 0xFFF +#endif /* !_LOCORE */ + +/* Definitions used with the MSR protocol */ +#define MSR_PROTO_CPUID_REQ 0x4 +#define MSR_PROTO_CPUID_RESP 0x5 +#define MSR_PROTO_PREFERRED_GHCB_PA_REQ 0x10 +#define MSR_PROTO_PREFERRED_GHCB_PA_RESP 0x11 +#define MSR_PROTO_REGISTER_GHCB_PA_REQ 0x12 +#define MSR_PROTO_REGISTER_GHCB_PA_RESP 0x13 +#define MSR_PROTO_TERMINATION_REQ 0x100 + +#ifndef _LOCORE + struct ghcb_sa { uint8_t v_pad0[0xcb]; /* 000h-0CAh */ uint8_t v_cpl; /* 0CBh */ @@ -102,14 +117,6 @@ struct ghcb_sync { int sz_c; int sz_d; }; -#endif /* !_LOCORE */ - -/* Definitions used with the MSR protocol */ -#define MSR_PROTO_CPUID_REQ 0x4 -#define MSR_PROTO_CPUID_RESP 0x5 -#define MSR_PROTO_TERMINATE 0x100 - -#ifndef _LOCORE extern vaddr_t ghcb_vaddr; extern paddr_t ghcb_paddr; @@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v) #endif /* !_LOCORE */ +#else /* !AMDSEV */ + +/* Definitions used with the MSR protocol */ +#define MSR_PROTO_TERMINATION_REQ 0x100 + +#endif /* AMDSEV */ + #endif /* !_MACHINE_GHCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/i82489reg.h b/lib/libc/include/x86_64-openbsd-none/amd64/i82489reg.h index 788c516ac729c1fe16d917fec321c06c83b74172..0fa4bb70e18d682e2b5982d5204b9fe328d78357 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/i82489reg.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/i82489reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */ +/* $OpenBSD: i82489reg.h,v 1.9 2026/09/19 16:11:07 mlarkin Exp $ */ /* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -73,6 +73,8 @@ #define LAPIC_IRR 0x200 #define LAPIC_ESR 0x280 /* Err status. R */ +#define LAPIC_LVT_CMCI 0x2f0 /* Corrected machine chk LVT */ + #define LAPIC_ICRLO 0x300 /* Int. cmd. RW */ # define LAPIC_DLMODE_MASK 0x00000700 # define LAPIC_DLMODE_FIXED 0x00000000 @@ -82,6 +84,7 @@ # define LAPIC_DLMODE_NMI 0x00000400 # define LAPIC_DLMODE_INIT 0x00000500 # define LAPIC_DLMODE_STARTUP 0x00000600 +# define LAPIC_DLMODE_EXTINT 0x00000700 # define LAPIC_DSTMODE_LOG 0x00000800 @@ -110,11 +113,12 @@ # define LAPIC_LVTT_VEC_MASK 0x000000ff # define LAPIC_LVTT_DS 0x00001000 # define LAPIC_LVTT_M 0x00010000 -# define LAPIC_LVTT_TM 0x00020000 +# define LAPIC_LVTT_TM 0x00060000 # define LAPIC_LVTT_TM_ONESHOT 0x00000000 # define LAPIC_LVTT_TM_PERIODIC 0x00020000 # define LAPIC_LVTT_TM_TSCDL 0x00040000 +#define LAPIC_LVT_THERM 0x330 /* Thermal sensor LVT */ #define LAPIC_PCINT 0x340 #define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */ # define LAPIC_LVT_PERIODIC 0x00020000 @@ -144,6 +148,31 @@ #define LAPIC_IRQ_MASK(i) (1 << ((i) + 1)) #define MSR_X2APIC_BASE 0x800 -#define MSR_X2APIC_EOI (MSR_X2APIC_BASE+0x0b) /* End Int. W */ -#define MSR_X2APIC_ID (MSR_X2APIC_BASE+0x02) /* ID. RW */ +#define MSR_X2APIC_END 0x83f +#define MSR_X2APIC_ID (MSR_X2APIC_BASE + 0x02) /* ID. R */ +#define MSR_X2APIC_VERSION (MSR_X2APIC_BASE + 0x03) /* Version. R */ +#define MSR_X2APIC_TPR (MSR_X2APIC_BASE + 0x08) /* Task prio. RW */ +#define MSR_X2APIC_PPR (MSR_X2APIC_BASE + 0x0a) /* Processor prio. R */ +#define MSR_X2APIC_EOI (MSR_X2APIC_BASE + 0x0b) /* End Int. W */ +#define MSR_X2APIC_LDR (MSR_X2APIC_BASE + 0x0d) /* Logical dest. R */ +#define MSR_X2APIC_SVR (MSR_X2APIC_BASE + 0x0f) /* Spurious intvec RW */ +#define MSR_X2APIC_ISR0 (MSR_X2APIC_BASE + 0x10) /* ISR 31:0. R */ +#define MSR_X2APIC_ISR7 (MSR_X2APIC_BASE + 0x17) /* ISR 255:224. R */ +#define MSR_X2APIC_TMR0 (MSR_X2APIC_BASE + 0x18) /* TMR 31:0. R */ +#define MSR_X2APIC_TMR7 (MSR_X2APIC_BASE + 0x1f) /* TMR 255:224. R */ +#define MSR_X2APIC_IRR0 (MSR_X2APIC_BASE + 0x20) /* IRR 31:0. R */ +#define MSR_X2APIC_IRR7 (MSR_X2APIC_BASE + 0x27) /* IRR 255:224. R */ +#define MSR_X2APIC_ESR (MSR_X2APIC_BASE + 0x28) /* Error status RW */ +#define MSR_X2APIC_LVT_CMCI (MSR_X2APIC_BASE + 0x2f) /* CMCI LVT. RW */ +#define MSR_X2APIC_ICR (MSR_X2APIC_BASE + 0x30) /* ICR. RW */ +#define MSR_X2APIC_LVT_TIMER (MSR_X2APIC_BASE + 0x32) /* Timer LVT. RW */ +#define MSR_X2APIC_LVT_THERM (MSR_X2APIC_BASE + 0x33) /* Thermal LVT. RW */ +#define MSR_X2APIC_LVT_PCINT (MSR_X2APIC_BASE + 0x34) /* Perf LVT. RW */ +#define MSR_X2APIC_LVT_LINT0 (MSR_X2APIC_BASE + 0x35) /* LINT0 LVT. RW */ +#define MSR_X2APIC_LVT_LINT1 (MSR_X2APIC_BASE + 0x36) /* LINT1 LVT. RW */ +#define MSR_X2APIC_LVT_ERROR (MSR_X2APIC_BASE + 0x37) /* Error LVT. RW */ +#define MSR_X2APIC_TIMER_ICR (MSR_X2APIC_BASE + 0x38) /* Initial count RW */ +#define MSR_X2APIC_TIMER_CCR (MSR_X2APIC_BASE + 0x39) /* Current count R */ +#define MSR_X2APIC_TIMER_DCR (MSR_X2APIC_BASE + 0x3e) /* Divisor config RW */ +#define MSR_X2APIC_SELF_IPI (MSR_X2APIC_BASE + 0x3f) /* Self IPI. W */ #define X2APIC_ID_MASK 0xff \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/pci_machdep.h b/lib/libc/include/x86_64-openbsd-none/amd64/pci_machdep.h index 6804596ff5a3d7f98bb1fb113b33b696e359b595..c89d9146d5b5eaa3537184fdc82ceabcce250fa3 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/pci_machdep.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.32 2025/01/23 11:24:34 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.33 2026/07/25 22:57:22 chris Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ /* @@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int); pci_chipset_tag_t pci_lookup_segment(int, int); +int acpipci_domain_to_seg(int); #define __HAVE_PCI_MSIX diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/pmap.h b/lib/libc/include/x86_64-openbsd-none/amd64/pmap.h index 1b1c88897834c1ed82a0fc7034762b3c6c28f2ff..635ce4f11da0215bd19b287605e92c95b937fcf9 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/pmap.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.94 2025/07/07 00:55:15 jsg Exp $ */ +/* $OpenBSD: pmap.h,v 1.95 2026/06/04 05:22:04 mlarkin Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -92,11 +92,8 @@ * The other levels are kept as physical pages in 3 UVM objects and are * temporarily mapped for virtual access when needed. * - * The other obvious difference from i386 is that it has a direct map of all - * physical memory in the VA range: - * - * 0xfffffd8000000000 - 0xffffff7fffffffff - * + * The other obvious difference from i386 is that it has a direct map of + * physical memory in a randomized VA subrange of the direct-map window. * The direct map is used in some cases to access PTEs of non-current pmaps. * * Note that address space is signed, so the layout for 48 bits is: @@ -104,8 +101,8 @@ * +---------------------------------+ 0xffffffffffffffff * | Kernel Image | * +---------------------------------+ 0xffffff8000000000 - * | Direct Map | - * +---------------------------------+ 0xfffffd8000000000 + * | Direct Map Window | + * +---------------------------------+ 0xffffee0000000000 * ~ ~ * | | * | Kernel Space | @@ -139,13 +136,23 @@ */ #define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) -#define L4_SLOT_PTE 255 -#define L4_SLOT_KERN 256 -#define L4_SLOT_KERNBASE 511 -#define NUM_L4_SLOT_DIRECT 4 -#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - NUM_L4_SLOT_DIRECT) +#define L4_SLOT_PTE 255 +#define L4_SLOT_KERN 256 +#define L4_SLOT_KERNBASE 511 +#define DIRECT_MAP_PML4_SLOTS 4 +#define DIRECT_MAP_START_CHOICES 32 +#define DIRECT_MAP_START_MASK (DIRECT_MAP_START_CHOICES - 1) +#define DIRECT_MAP_RESERVED_PML4_SLOTS (DIRECT_MAP_PML4_SLOTS + \ + DIRECT_MAP_START_CHOICES - 1) +#define DIRECT_MAP_SIZE ((vaddr_t)DIRECT_MAP_PML4_SLOTS * NBPD_L4) +#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - \ + DIRECT_MAP_RESERVED_PML4_SLOTS) #define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1) +#if (DIRECT_MAP_START_CHOICES & DIRECT_MAP_START_MASK) != 0 +#error DIRECT_MAP_START_CHOICES must be a power of two +#endif + #define PDIR_SLOT_KERN L4_SLOT_KERN #define PDIR_SLOT_PTE L4_SLOT_PTE #define PDIR_SLOT_DIRECT L4_SLOT_DIRECT @@ -160,9 +167,7 @@ */ #define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4)) -#define PMAP_DIRECT_BASE (VA_SIGN_NEG((L4_SLOT_DIRECT * NBPD_L4))) -#define PMAP_DIRECT_END (VA_SIGN_NEG(((L4_SLOT_DIRECT + \ - NUM_L4_SLOT_DIRECT) * NBPD_L4))) +extern vaddr_t pmap_direct_base, pmap_direct_end; #define L1_BASE PTE_BASE @@ -498,8 +503,8 @@ kvtopte(vaddr_t va) return (PTE_BASE + pl1_i(va)); } -#define PMAP_DIRECT_MAP(pa) ((vaddr_t)PMAP_DIRECT_BASE + (pa)) -#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - PMAP_DIRECT_BASE) +#define PMAP_DIRECT_MAP(pa) ((vaddr_t)pmap_direct_base + (pa)) +#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base) #define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va)) diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h b/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h index 7f3b7d6c84a9213d9d4eaf4ee97dfa1349276fc9..eb8c05a04a718062a6b1b0f184eed509859790f7 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.129 2026/09/19 16:11:07 mlarkin Exp $ */ /* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ /* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */ @@ -281,6 +281,11 @@ ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \ "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" ) +/* SEFF subleaf 2 EDX bits */ +#define SEFF2EDX_BHI_CTRL 0x00000010 /* BHI_DIS_S supported */ +#define SEFF2_EDX_BITS \ + ("\20" "\05BHI_CTRL" ) + /* * Thermal and Power Management (CPUID function 0x6) EAX bits */ @@ -465,6 +470,7 @@ #define APICBASE_BSP 0x100 #define APICBASE_ENABLE_X2APIC 0x400 #define APICBASE_GLOBAL_ENABLE 0x800 +#define APICBASE_ADDRESS_MASK 0x000ffffffffff000ULL #define MSR_EBL_CR_POWERON 0x02a #define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */ #define MSR_TEST_CTL 0x033 @@ -474,6 +480,7 @@ #define SPEC_CTRL_IBRS (1ULL << 0) #define SPEC_CTRL_STIBP (1ULL << 1) #define SPEC_CTRL_SSBD (1ULL << 2) +#define SPEC_CTRL_BHI_DIS_S (1ULL << 10) #define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */ #define PRED_CMD_IBPB (1ULL << 0) #define MSR_BIOS_UPDT_TRIG 0x079 @@ -710,6 +717,9 @@ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ #define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ +#define MSR_BP_CFG 0xc001102e +#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */ + #define IPM_C1E_CMP_HLT 0x10000000 #define IPM_SMI_CMP_HLT 0x08000000 @@ -734,6 +744,7 @@ #define MSR_SEV_STATUS 0xc0010131 #define SEV_STAT_ENABLED 0x00000001 #define SEV_STAT_ES_ENABLED 0x00000002 +#define SEV_STAT_SNP_ACTIVE 0x00000004 #define MSR_LS_CFG 0xc0011020 #define LS_CFG_DIS_LS2_SQUISH 0x02000000 @@ -1357,6 +1368,8 @@ #define VMCS_GUEST_IA32_LDTR_AR 0x4820 #define VMCS_GUEST_IA32_TR_AR 0x4822 #define VMCS_GUEST_INTERRUPTIBILITY_ST 0x4824 +#define VMX_INT_STATE_BLOCK_STI (1 << 0) +#define VMX_INT_STATE_BLOCK_MOVSS (1 << 1) #define VMCS_GUEST_ACTIVITY_STATE 0x4826 #define VMCS_GUEST_SMBASE 0x4828 #define VMCS_GUEST_IA32_SYSENTER_CS 0x482A @@ -1405,6 +1418,8 @@ #define VMCS_GUEST_IA32_SYSENTER_ESP 0x6824 #define VMCS_GUEST_IA32_SYSENTER_EIP 0x6826 #define VMCS_GUEST_IA32_S_CET 0x6828 +#define VMCS_GUEST_SSP 0x682A +#define VMCS_GUEST_IA32_INTR_SSP_TABLE 0x682C /* Natural-width host state fields */ #define VMCS_HOST_IA32_CR0 0x6C00 @@ -1420,6 +1435,8 @@ #define VMCS_HOST_IA32_RSP 0x6C14 #define VMCS_HOST_IA32_RIP 0x6C16 #define VMCS_HOST_IA32_S_CET 0x6C18 +#define VMCS_HOST_SSP 0x6C1A +#define VMCS_HOST_IA32_INTR_SSP_TABLE 0x6C1C #define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x0 #define IA32_VMX_INVVPID_SINGLE_CTX 0x1 @@ -1450,6 +1467,7 @@ #define MSR_AMD_VM_HSAVE_PA 0xc0010117 #define CPUID_AMD_SVM_CAP 0x8000000A #define AMD_SVM_NESTED_PAGING_CAP (1 << 0) +#define AMD_SVM_NRIP_SAVE_CAP (1 << 3) #define AMD_SVM_VMCB_CLEAN_CAP (1 << 5) #define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6) #define AMD_SVM_DECODE_ASSIST_CAP (1 << 7) diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/vmmvar.h b/lib/libc/include/x86_64-openbsd-none/amd64/vmmvar.h index 03006e307225ba4f611b604f3f1806b626047c52..4e6c82fac1c0aaaaa7b18ba8c67c07de9c401d46 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/vmmvar.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.117 2025/09/17 18:37:44 sf Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.123 2026/09/22 08:21:39 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -23,6 +23,8 @@ #ifndef _LOCORE +struct vm; + #define VMM_HV_SIGNATURE "OpenBSDVMM58" /* VMX: Basic Exit Reasons */ @@ -87,6 +89,8 @@ #define VMX_EXIT_XSAVES 63 #define VMX_EXIT_XRSTORS 64 +#define VM_EXIT_APICBASE 0xFFFC +#define VM_EXIT_X2APIC 0xFFFD #define VM_EXIT_TERMINATED 0xFFFE #define VM_EXIT_NONE 0xFFFF @@ -348,10 +352,25 @@ struct vm_exit_inout { struct vm_exit_eptviolation { uint8_t vee_fault_type; /* type of vm exit */ uint8_t vee_insn_info; /* bitfield */ -#define VEE_LEN_VALID 0x1 /* vee_insn_len is valid */ -#define VEE_BYTES_VALID 0x2 /* vee_insn_bytes is valid */ +#define VEE_LEN_VALID (1 << 0) /* vee_insn_len is valid */ +#define VEE_BYTES_VALID (1 << 1) /* vee_insn_bytes is valid */ +#define VEE_GPA_VALID (1 << 2) /* vee_gpa is valid */ uint8_t vee_insn_len; /* [VMX] instruction length */ uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */ + uint64_t vee_gpa; /* GPA that caused the fault */ +}; + +/* Userspace-assisted x2APIC MSR access. */ +struct vm_exit_x2apic { + uint32_t vex_msr; + uint8_t vex_write; + uint8_t vex_pad[3]; + uint64_t vex_data; +}; + +/* Guest-visible IA32_APIC_BASE mode change. */ +struct vm_exit_apicbase { + uint64_t vea_value; }; /* @@ -469,6 +488,8 @@ struct vm_exit { union { struct vm_exit_inout vei; /* IN/OUT exit */ struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/ + struct vm_exit_apicbase vea; /* APICBASE mode exit */ + struct vm_exit_x2apic vex; /* x2APIC MSR exit */ }; struct vcpu_reg_state vrs; @@ -477,7 +498,6 @@ struct vm_exit { struct vm_intr_params { /* Input parameters to VMM_IOC_INTR */ - uint32_t vip_vm_id; uint32_t vip_vcpu_id; uint16_t vip_intr; }; @@ -495,7 +515,6 @@ struct vm_rwregs_params { * Input/output parameters to VMM_IOC_READREGS / * VMM_IOC_WRITEREGS */ - uint32_t vrwp_vm_id; uint32_t vrwp_vcpu_id; uint64_t vrwp_mask; struct vcpu_reg_state vrwp_regs; @@ -522,7 +541,6 @@ struct vm_rwregs_params { * direct cache access (CPUIDECX_DCA) * x2APIC (CPUIDECX_X2APIC) * apic deadline (CPUIDECX_DEADLINE) - * apic (CPUID_APIC) * psn (CPUID_PSN) * self snoop (CPUID_SS) * hyperthreading (CPUID_HTT) @@ -537,7 +555,7 @@ struct vm_rwregs_params { CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE) #define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX) #define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \ - CPUID_HTT | CPUID_DS | CPUID_APIC | \ + CPUID_HTT | CPUID_DS | \ CPUID_PSN | CPUID_SS | CPUID_PBE | \ CPUID_MTRR | CPUID_MCE | CPUID_MCA) #define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \ @@ -976,6 +994,7 @@ struct vcpu { struct vm_exit vc_exit; /* [v] */ uint16_t vc_intr; /* [v] */ + u_int vc_intr_latch; /* [a] */ uint8_t vc_irqready; /* [v] */ uint8_t vc_fpuinited; /* [v] */ @@ -991,6 +1010,7 @@ struct vcpu { /* Shadowed MSRs */ uint64_t vc_shadow_pat; /* [v] */ + uint64_t vc_apicbase; /* [v] */ /* Userland Protection Keys */ uint32_t vc_pkru; /* [v] */ @@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *); int vmm_probe_machdep(struct device *, void *, void *); void vmm_attach_machdep(struct device *, struct device *, void *); void vmm_activate_machdep(struct device *, int); -int vmmioctl_machdep(dev_t, u_long, caddr_t, int, struct proc *); -int pledge_ioctl_vmm_machdep(struct proc *, long); int vmm_start(void); int vmm_stop(void); int vm_impl_init(struct vm *, struct proc *); void vm_impl_deinit(struct vm *); int vcpu_init(struct vcpu *, struct vm_create_params *); void vcpu_deinit(struct vcpu *); -int vm_rwregs(struct vm_rwregs_params *, int); +int vm_rwregs(struct vm *, struct vm_rwregs_params *, int); int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *); -int svm_get_vmsa_pa(uint32_t, uint32_t, uint64_t *); +int svm_get_vmsa_pa(struct proc *, struct file *, uint32_t, uint64_t *); #endif /* _KERNEL */ diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/vmparam.h b/lib/libc/include/x86_64-openbsd-none/amd64/vmparam.h index dc577330a2478aa5516bf4de3591918142422568..463a650b1150c92d304aff1a0e88de66a5938f92 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/vmparam.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.25 2024/11/08 01:44:52 jsg Exp $ */ +/* $OpenBSD: vmparam.h,v 1.26 2026/06/22 00:27:33 jsg Exp $ */ /* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */ /*- @@ -98,7 +98,7 @@ #define VM_MIN_STACK_ADDRESS 0x0000600000000000 #endif #define VM_MIN_KERNEL_ADDRESS 0xffff800000000000 -#define VM_MAX_KERNEL_ADDRESS 0xffff800100000000 +#define VM_MAX_KERNEL_ADDRESS 0xffff808000000000 /* map PIE into approximately the first quarter of user va space */ #define VM_PIE_MIN_ADDR VM_MIN_ADDRESS diff --git a/lib/libc/include/x86_64-openbsd-none/machine/_types.h b/lib/libc/include/x86_64-openbsd-none/machine/_types.h index 6d48c5e0337ad2a3fcdc5497996ffd8d5efc6fce..e6976f252e0f7b5c9e59ffeaca724265a9fea0b1 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/_types.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.19 2023/07/02 19:02:27 cheloha Exp $ */ +/* $OpenBSD: _types.h,v 1.20 2026/08/31 10:58:08 tb Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -122,11 +122,7 @@ typedef float __float_t; typedef long __ptrdiff_t; typedef unsigned long __size_t; typedef long __ssize_t; -#if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; -#else -typedef char * __va_list; -#endif /* Wide character support types */ #ifndef __cplusplus diff --git a/lib/libc/include/x86_64-openbsd-none/machine/bus.h b/lib/libc/include/x86_64-openbsd-none/machine/bus.h index 140e3a73f3d476c60a61e8a599e10dfb145fc5e8..76b0193482ac26eb6aa348ce05f9d19b2bac2223 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/bus.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.37 2025/08/23 10:15:49 sf Exp $ */ +/* $OpenBSD: bus.h,v 1.38 2026/04/19 09:59:22 kettenis Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -671,6 +671,8 @@ struct bus_dmamap { bus_dma_segment_t dm_segs[1]; /* segments; variable length */ }; +void bus_dma_init(void); + int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); diff --git a/lib/libc/include/x86_64-openbsd-none/machine/cpu.h b/lib/libc/include/x86_64-openbsd-none/machine/cpu.h index cc0b57cdb6a47a06b9fc003db5310834e4a6e60c..28608fe42cc4c310aa44cab0e8c7f513e25394d3 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.186 2026/09/08 21:01:59 daniel Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -170,6 +170,7 @@ struct cpu_info { u_int32_t ci_feature_sefflags_ebx;/* [I] */ u_int32_t ci_feature_sefflags_ecx;/* [I] */ u_int32_t ci_feature_sefflags_edx;/* [I] */ + u_int32_t ci_feature_sefflags_2_edx;/* [I] */ u_int32_t ci_feature_amdspec_ebx; /* [I] */ u_int32_t ci_feature_amdsev_eax; /* [I] */ u_int32_t ci_feature_amdsev_ebx; /* [I] */ diff --git a/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h b/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h index 0f7b5cccf2295c7062a1346d70dca43b9124e157..787641ca870dee13f43a72f7fbcc97248394760b 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.48 2026/07/28 15:08:06 hshoexer Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -311,13 +311,6 @@ wbinvd_on_all_cpus(void) wbinvd(); return 0; } - -static inline int -wbinvd_on_all_cpus_acked(void) -{ - wbinvd(); - return 0; -} #endif /* MULTIPROCESSOR */ static __inline void diff --git a/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h b/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h index 159b8d57273af87d64158b70d1daf97f87ad11fa..589ef42e21689095303e6b2755c144548005dbab 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */ +/* $OpenBSD: ghcb.h,v 1.8 2026/08/19 08:56:28 hshoexer Exp $ */ /* * Copyright (c) 2024, 2025 Hans-Joerg Hoexer @@ -19,6 +19,8 @@ #ifndef _MACHINE_GHCB_H_ #define _MACHINE_GHCB_H_ +#ifdef AMDSEV + #ifndef _LOCORE #include @@ -42,6 +44,19 @@ #define GHCB_MAX 0xFFF +#endif /* !_LOCORE */ + +/* Definitions used with the MSR protocol */ +#define MSR_PROTO_CPUID_REQ 0x4 +#define MSR_PROTO_CPUID_RESP 0x5 +#define MSR_PROTO_PREFERRED_GHCB_PA_REQ 0x10 +#define MSR_PROTO_PREFERRED_GHCB_PA_RESP 0x11 +#define MSR_PROTO_REGISTER_GHCB_PA_REQ 0x12 +#define MSR_PROTO_REGISTER_GHCB_PA_RESP 0x13 +#define MSR_PROTO_TERMINATION_REQ 0x100 + +#ifndef _LOCORE + struct ghcb_sa { uint8_t v_pad0[0xcb]; /* 000h-0CAh */ uint8_t v_cpl; /* 0CBh */ @@ -102,14 +117,6 @@ struct ghcb_sync { int sz_c; int sz_d; }; -#endif /* !_LOCORE */ - -/* Definitions used with the MSR protocol */ -#define MSR_PROTO_CPUID_REQ 0x4 -#define MSR_PROTO_CPUID_RESP 0x5 -#define MSR_PROTO_TERMINATE 0x100 - -#ifndef _LOCORE extern vaddr_t ghcb_vaddr; extern paddr_t ghcb_paddr; @@ -249,4 +256,11 @@ ghcb_io_write_4(uint16_t port, uint32_t v) #endif /* !_LOCORE */ +#else /* !AMDSEV */ + +/* Definitions used with the MSR protocol */ +#define MSR_PROTO_TERMINATION_REQ 0x100 + +#endif /* AMDSEV */ + #endif /* !_MACHINE_GHCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/i82489reg.h b/lib/libc/include/x86_64-openbsd-none/machine/i82489reg.h index 788c516ac729c1fe16d917fec321c06c83b74172..0fa4bb70e18d682e2b5982d5204b9fe328d78357 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/i82489reg.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/i82489reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489reg.h,v 1.5 2019/07/26 04:35:38 kevlo Exp $ */ +/* $OpenBSD: i82489reg.h,v 1.9 2026/09/19 16:11:07 mlarkin Exp $ */ /* $NetBSD: i82489reg.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -73,6 +73,8 @@ #define LAPIC_IRR 0x200 #define LAPIC_ESR 0x280 /* Err status. R */ +#define LAPIC_LVT_CMCI 0x2f0 /* Corrected machine chk LVT */ + #define LAPIC_ICRLO 0x300 /* Int. cmd. RW */ # define LAPIC_DLMODE_MASK 0x00000700 # define LAPIC_DLMODE_FIXED 0x00000000 @@ -82,6 +84,7 @@ # define LAPIC_DLMODE_NMI 0x00000400 # define LAPIC_DLMODE_INIT 0x00000500 # define LAPIC_DLMODE_STARTUP 0x00000600 +# define LAPIC_DLMODE_EXTINT 0x00000700 # define LAPIC_DSTMODE_LOG 0x00000800 @@ -110,11 +113,12 @@ # define LAPIC_LVTT_VEC_MASK 0x000000ff # define LAPIC_LVTT_DS 0x00001000 # define LAPIC_LVTT_M 0x00010000 -# define LAPIC_LVTT_TM 0x00020000 +# define LAPIC_LVTT_TM 0x00060000 # define LAPIC_LVTT_TM_ONESHOT 0x00000000 # define LAPIC_LVTT_TM_PERIODIC 0x00020000 # define LAPIC_LVTT_TM_TSCDL 0x00040000 +#define LAPIC_LVT_THERM 0x330 /* Thermal sensor LVT */ #define LAPIC_PCINT 0x340 #define LAPIC_LVINT0 0x350 /* Loc.vec (LINT0) RW */ # define LAPIC_LVT_PERIODIC 0x00020000 @@ -144,6 +148,31 @@ #define LAPIC_IRQ_MASK(i) (1 << ((i) + 1)) #define MSR_X2APIC_BASE 0x800 -#define MSR_X2APIC_EOI (MSR_X2APIC_BASE+0x0b) /* End Int. W */ -#define MSR_X2APIC_ID (MSR_X2APIC_BASE+0x02) /* ID. RW */ +#define MSR_X2APIC_END 0x83f +#define MSR_X2APIC_ID (MSR_X2APIC_BASE + 0x02) /* ID. R */ +#define MSR_X2APIC_VERSION (MSR_X2APIC_BASE + 0x03) /* Version. R */ +#define MSR_X2APIC_TPR (MSR_X2APIC_BASE + 0x08) /* Task prio. RW */ +#define MSR_X2APIC_PPR (MSR_X2APIC_BASE + 0x0a) /* Processor prio. R */ +#define MSR_X2APIC_EOI (MSR_X2APIC_BASE + 0x0b) /* End Int. W */ +#define MSR_X2APIC_LDR (MSR_X2APIC_BASE + 0x0d) /* Logical dest. R */ +#define MSR_X2APIC_SVR (MSR_X2APIC_BASE + 0x0f) /* Spurious intvec RW */ +#define MSR_X2APIC_ISR0 (MSR_X2APIC_BASE + 0x10) /* ISR 31:0. R */ +#define MSR_X2APIC_ISR7 (MSR_X2APIC_BASE + 0x17) /* ISR 255:224. R */ +#define MSR_X2APIC_TMR0 (MSR_X2APIC_BASE + 0x18) /* TMR 31:0. R */ +#define MSR_X2APIC_TMR7 (MSR_X2APIC_BASE + 0x1f) /* TMR 255:224. R */ +#define MSR_X2APIC_IRR0 (MSR_X2APIC_BASE + 0x20) /* IRR 31:0. R */ +#define MSR_X2APIC_IRR7 (MSR_X2APIC_BASE + 0x27) /* IRR 255:224. R */ +#define MSR_X2APIC_ESR (MSR_X2APIC_BASE + 0x28) /* Error status RW */ +#define MSR_X2APIC_LVT_CMCI (MSR_X2APIC_BASE + 0x2f) /* CMCI LVT. RW */ +#define MSR_X2APIC_ICR (MSR_X2APIC_BASE + 0x30) /* ICR. RW */ +#define MSR_X2APIC_LVT_TIMER (MSR_X2APIC_BASE + 0x32) /* Timer LVT. RW */ +#define MSR_X2APIC_LVT_THERM (MSR_X2APIC_BASE + 0x33) /* Thermal LVT. RW */ +#define MSR_X2APIC_LVT_PCINT (MSR_X2APIC_BASE + 0x34) /* Perf LVT. RW */ +#define MSR_X2APIC_LVT_LINT0 (MSR_X2APIC_BASE + 0x35) /* LINT0 LVT. RW */ +#define MSR_X2APIC_LVT_LINT1 (MSR_X2APIC_BASE + 0x36) /* LINT1 LVT. RW */ +#define MSR_X2APIC_LVT_ERROR (MSR_X2APIC_BASE + 0x37) /* Error LVT. RW */ +#define MSR_X2APIC_TIMER_ICR (MSR_X2APIC_BASE + 0x38) /* Initial count RW */ +#define MSR_X2APIC_TIMER_CCR (MSR_X2APIC_BASE + 0x39) /* Current count R */ +#define MSR_X2APIC_TIMER_DCR (MSR_X2APIC_BASE + 0x3e) /* Divisor config RW */ +#define MSR_X2APIC_SELF_IPI (MSR_X2APIC_BASE + 0x3f) /* Self IPI. W */ #define X2APIC_ID_MASK 0xff \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/pci_machdep.h b/lib/libc/include/x86_64-openbsd-none/machine/pci_machdep.h index 6804596ff5a3d7f98bb1fb113b33b696e359b595..c89d9146d5b5eaa3537184fdc82ceabcce250fa3 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/pci_machdep.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.32 2025/01/23 11:24:34 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.33 2026/07/25 22:57:22 chris Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ /* @@ -104,6 +104,7 @@ void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); void pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int); pci_chipset_tag_t pci_lookup_segment(int, int); +int acpipci_domain_to_seg(int); #define __HAVE_PCI_MSIX diff --git a/lib/libc/include/x86_64-openbsd-none/machine/pmap.h b/lib/libc/include/x86_64-openbsd-none/machine/pmap.h index 1b1c88897834c1ed82a0fc7034762b3c6c28f2ff..635ce4f11da0215bd19b287605e92c95b937fcf9 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/pmap.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.94 2025/07/07 00:55:15 jsg Exp $ */ +/* $OpenBSD: pmap.h,v 1.95 2026/06/04 05:22:04 mlarkin Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -92,11 +92,8 @@ * The other levels are kept as physical pages in 3 UVM objects and are * temporarily mapped for virtual access when needed. * - * The other obvious difference from i386 is that it has a direct map of all - * physical memory in the VA range: - * - * 0xfffffd8000000000 - 0xffffff7fffffffff - * + * The other obvious difference from i386 is that it has a direct map of + * physical memory in a randomized VA subrange of the direct-map window. * The direct map is used in some cases to access PTEs of non-current pmaps. * * Note that address space is signed, so the layout for 48 bits is: @@ -104,8 +101,8 @@ * +---------------------------------+ 0xffffffffffffffff * | Kernel Image | * +---------------------------------+ 0xffffff8000000000 - * | Direct Map | - * +---------------------------------+ 0xfffffd8000000000 + * | Direct Map Window | + * +---------------------------------+ 0xffffee0000000000 * ~ ~ * | | * | Kernel Space | @@ -139,13 +136,23 @@ */ #define VA_SIGN_POS(va) ((va) & ~VA_SIGN_MASK) -#define L4_SLOT_PTE 255 -#define L4_SLOT_KERN 256 -#define L4_SLOT_KERNBASE 511 -#define NUM_L4_SLOT_DIRECT 4 -#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - NUM_L4_SLOT_DIRECT) +#define L4_SLOT_PTE 255 +#define L4_SLOT_KERN 256 +#define L4_SLOT_KERNBASE 511 +#define DIRECT_MAP_PML4_SLOTS 4 +#define DIRECT_MAP_START_CHOICES 32 +#define DIRECT_MAP_START_MASK (DIRECT_MAP_START_CHOICES - 1) +#define DIRECT_MAP_RESERVED_PML4_SLOTS (DIRECT_MAP_PML4_SLOTS + \ + DIRECT_MAP_START_CHOICES - 1) +#define DIRECT_MAP_SIZE ((vaddr_t)DIRECT_MAP_PML4_SLOTS * NBPD_L4) +#define L4_SLOT_DIRECT (L4_SLOT_KERNBASE - \ + DIRECT_MAP_RESERVED_PML4_SLOTS) #define L4_SLOT_EARLY (L4_SLOT_DIRECT - 1) +#if (DIRECT_MAP_START_CHOICES & DIRECT_MAP_START_MASK) != 0 +#error DIRECT_MAP_START_CHOICES must be a power of two +#endif + #define PDIR_SLOT_KERN L4_SLOT_KERN #define PDIR_SLOT_PTE L4_SLOT_PTE #define PDIR_SLOT_DIRECT L4_SLOT_DIRECT @@ -160,9 +167,7 @@ */ #define PTE_BASE ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4)) -#define PMAP_DIRECT_BASE (VA_SIGN_NEG((L4_SLOT_DIRECT * NBPD_L4))) -#define PMAP_DIRECT_END (VA_SIGN_NEG(((L4_SLOT_DIRECT + \ - NUM_L4_SLOT_DIRECT) * NBPD_L4))) +extern vaddr_t pmap_direct_base, pmap_direct_end; #define L1_BASE PTE_BASE @@ -498,8 +503,8 @@ kvtopte(vaddr_t va) return (PTE_BASE + pl1_i(va)); } -#define PMAP_DIRECT_MAP(pa) ((vaddr_t)PMAP_DIRECT_BASE + (pa)) -#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - PMAP_DIRECT_BASE) +#define PMAP_DIRECT_MAP(pa) ((vaddr_t)pmap_direct_base + (pa)) +#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base) #define pmap_map_direct(pg) PMAP_DIRECT_MAP(VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(PMAP_DIRECT_UNMAP(va)) diff --git a/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h b/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h index 7f3b7d6c84a9213d9d4eaf4ee97dfa1349276fc9..eb8c05a04a718062a6b1b0f184eed509859790f7 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.129 2026/09/19 16:11:07 mlarkin Exp $ */ /* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ /* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */ @@ -281,6 +281,11 @@ ("\20" "\03AVX512FNNIW" "\04AVX512FMAPS" "\012SRBDS_CTRL" "\013MD_CLEAR" \ "\016TSXFA" "\025IBT" "\033IBRS,IBPB" "\034STIBP" "\035L1DF" "\040SSBD" ) +/* SEFF subleaf 2 EDX bits */ +#define SEFF2EDX_BHI_CTRL 0x00000010 /* BHI_DIS_S supported */ +#define SEFF2_EDX_BITS \ + ("\20" "\05BHI_CTRL" ) + /* * Thermal and Power Management (CPUID function 0x6) EAX bits */ @@ -465,6 +470,7 @@ #define APICBASE_BSP 0x100 #define APICBASE_ENABLE_X2APIC 0x400 #define APICBASE_GLOBAL_ENABLE 0x800 +#define APICBASE_ADDRESS_MASK 0x000ffffffffff000ULL #define MSR_EBL_CR_POWERON 0x02a #define MSR_EBC_FREQUENCY_ID 0x02c /* Pentium 4 only */ #define MSR_TEST_CTL 0x033 @@ -474,6 +480,7 @@ #define SPEC_CTRL_IBRS (1ULL << 0) #define SPEC_CTRL_STIBP (1ULL << 1) #define SPEC_CTRL_SSBD (1ULL << 2) +#define SPEC_CTRL_BHI_DIS_S (1ULL << 10) #define MSR_PRED_CMD 0x049 /* Speculation Control IBPB */ #define PRED_CMD_IBPB (1ULL << 0) #define MSR_BIOS_UPDT_TRIG 0x079 @@ -710,6 +717,9 @@ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ #define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ +#define MSR_BP_CFG 0xc001102e +#define BP_CFG_33 (1ULL << 33) /* op cache chickenbit, AMD-SB-7052 */ + #define IPM_C1E_CMP_HLT 0x10000000 #define IPM_SMI_CMP_HLT 0x08000000 @@ -734,6 +744,7 @@ #define MSR_SEV_STATUS 0xc0010131 #define SEV_STAT_ENABLED 0x00000001 #define SEV_STAT_ES_ENABLED 0x00000002 +#define SEV_STAT_SNP_ACTIVE 0x00000004 #define MSR_LS_CFG 0xc0011020 #define LS_CFG_DIS_LS2_SQUISH 0x02000000 @@ -1357,6 +1368,8 @@ #define VMCS_GUEST_IA32_LDTR_AR 0x4820 #define VMCS_GUEST_IA32_TR_AR 0x4822 #define VMCS_GUEST_INTERRUPTIBILITY_ST 0x4824 +#define VMX_INT_STATE_BLOCK_STI (1 << 0) +#define VMX_INT_STATE_BLOCK_MOVSS (1 << 1) #define VMCS_GUEST_ACTIVITY_STATE 0x4826 #define VMCS_GUEST_SMBASE 0x4828 #define VMCS_GUEST_IA32_SYSENTER_CS 0x482A @@ -1405,6 +1418,8 @@ #define VMCS_GUEST_IA32_SYSENTER_ESP 0x6824 #define VMCS_GUEST_IA32_SYSENTER_EIP 0x6826 #define VMCS_GUEST_IA32_S_CET 0x6828 +#define VMCS_GUEST_SSP 0x682A +#define VMCS_GUEST_IA32_INTR_SSP_TABLE 0x682C /* Natural-width host state fields */ #define VMCS_HOST_IA32_CR0 0x6C00 @@ -1420,6 +1435,8 @@ #define VMCS_HOST_IA32_RSP 0x6C14 #define VMCS_HOST_IA32_RIP 0x6C16 #define VMCS_HOST_IA32_S_CET 0x6C18 +#define VMCS_HOST_SSP 0x6C1A +#define VMCS_HOST_IA32_INTR_SSP_TABLE 0x6C1C #define IA32_VMX_INVVPID_INDIV_ADDR_CTX 0x0 #define IA32_VMX_INVVPID_SINGLE_CTX 0x1 @@ -1450,6 +1467,7 @@ #define MSR_AMD_VM_HSAVE_PA 0xc0010117 #define CPUID_AMD_SVM_CAP 0x8000000A #define AMD_SVM_NESTED_PAGING_CAP (1 << 0) +#define AMD_SVM_NRIP_SAVE_CAP (1 << 3) #define AMD_SVM_VMCB_CLEAN_CAP (1 << 5) #define AMD_SVM_FLUSH_BY_ASID_CAP (1 << 6) #define AMD_SVM_DECODE_ASSIST_CAP (1 << 7) diff --git a/lib/libc/include/x86_64-openbsd-none/machine/vmmvar.h b/lib/libc/include/x86_64-openbsd-none/machine/vmmvar.h index 03006e307225ba4f611b604f3f1806b626047c52..4e6c82fac1c0aaaaa7b18ba8c67c07de9c401d46 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/vmmvar.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.117 2025/09/17 18:37:44 sf Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.123 2026/09/22 08:21:39 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -23,6 +23,8 @@ #ifndef _LOCORE +struct vm; + #define VMM_HV_SIGNATURE "OpenBSDVMM58" /* VMX: Basic Exit Reasons */ @@ -87,6 +89,8 @@ #define VMX_EXIT_XSAVES 63 #define VMX_EXIT_XRSTORS 64 +#define VM_EXIT_APICBASE 0xFFFC +#define VM_EXIT_X2APIC 0xFFFD #define VM_EXIT_TERMINATED 0xFFFE #define VM_EXIT_NONE 0xFFFF @@ -348,10 +352,25 @@ struct vm_exit_inout { struct vm_exit_eptviolation { uint8_t vee_fault_type; /* type of vm exit */ uint8_t vee_insn_info; /* bitfield */ -#define VEE_LEN_VALID 0x1 /* vee_insn_len is valid */ -#define VEE_BYTES_VALID 0x2 /* vee_insn_bytes is valid */ +#define VEE_LEN_VALID (1 << 0) /* vee_insn_len is valid */ +#define VEE_BYTES_VALID (1 << 1) /* vee_insn_bytes is valid */ +#define VEE_GPA_VALID (1 << 2) /* vee_gpa is valid */ uint8_t vee_insn_len; /* [VMX] instruction length */ uint8_t vee_insn_bytes[15]; /* [SVM] bytes at {R,E,}IP */ + uint64_t vee_gpa; /* GPA that caused the fault */ +}; + +/* Userspace-assisted x2APIC MSR access. */ +struct vm_exit_x2apic { + uint32_t vex_msr; + uint8_t vex_write; + uint8_t vex_pad[3]; + uint64_t vex_data; +}; + +/* Guest-visible IA32_APIC_BASE mode change. */ +struct vm_exit_apicbase { + uint64_t vea_value; }; /* @@ -469,6 +488,8 @@ struct vm_exit { union { struct vm_exit_inout vei; /* IN/OUT exit */ struct vm_exit_eptviolation vee; /* EPT VIOLATION exit*/ + struct vm_exit_apicbase vea; /* APICBASE mode exit */ + struct vm_exit_x2apic vex; /* x2APIC MSR exit */ }; struct vcpu_reg_state vrs; @@ -477,7 +498,6 @@ struct vm_exit { struct vm_intr_params { /* Input parameters to VMM_IOC_INTR */ - uint32_t vip_vm_id; uint32_t vip_vcpu_id; uint16_t vip_intr; }; @@ -495,7 +515,6 @@ struct vm_rwregs_params { * Input/output parameters to VMM_IOC_READREGS / * VMM_IOC_WRITEREGS */ - uint32_t vrwp_vm_id; uint32_t vrwp_vcpu_id; uint64_t vrwp_mask; struct vcpu_reg_state vrwp_regs; @@ -522,7 +541,6 @@ struct vm_rwregs_params { * direct cache access (CPUIDECX_DCA) * x2APIC (CPUIDECX_X2APIC) * apic deadline (CPUIDECX_DEADLINE) - * apic (CPUID_APIC) * psn (CPUID_PSN) * self snoop (CPUID_SS) * hyperthreading (CPUID_HTT) @@ -537,7 +555,7 @@ struct vm_rwregs_params { CPUIDECX_DCA | CPUIDECX_X2APIC | CPUIDECX_DEADLINE) #define VMM_ECPUIDECX_MASK ~(CPUIDECX_SVM | CPUIDECX_MWAITX) #define VMM_CPUIDEDX_MASK ~(CPUID_ACPI | CPUID_TM | \ - CPUID_HTT | CPUID_DS | CPUID_APIC | \ + CPUID_HTT | CPUID_DS | \ CPUID_PSN | CPUID_SS | CPUID_PBE | \ CPUID_MTRR | CPUID_MCE | CPUID_MCA) #define VMM_AMDSPEC_EBX_MASK ~(CPUIDEBX_IBPB | CPUIDEBX_IBRS | \ @@ -976,6 +994,7 @@ struct vcpu { struct vm_exit vc_exit; /* [v] */ uint16_t vc_intr; /* [v] */ + u_int vc_intr_latch; /* [a] */ uint8_t vc_irqready; /* [v] */ uint8_t vc_fpuinited; /* [v] */ @@ -991,6 +1010,7 @@ struct vcpu { /* Shadowed MSRs */ uint64_t vc_shadow_pat; /* [v] */ + uint64_t vc_apicbase; /* [v] */ /* Userland Protection Keys */ uint32_t vc_pkru; /* [v] */ @@ -1056,17 +1076,15 @@ void vmclear_on_cpu(struct cpu_info *); int vmm_probe_machdep(struct device *, void *, void *); void vmm_attach_machdep(struct device *, struct device *, void *); void vmm_activate_machdep(struct device *, int); -int vmmioctl_machdep(dev_t, u_long, caddr_t, int, struct proc *); -int pledge_ioctl_vmm_machdep(struct proc *, long); int vmm_start(void); int vmm_stop(void); int vm_impl_init(struct vm *, struct proc *); void vm_impl_deinit(struct vm *); int vcpu_init(struct vcpu *, struct vm_create_params *); void vcpu_deinit(struct vcpu *); -int vm_rwregs(struct vm_rwregs_params *, int); +int vm_rwregs(struct vm *, struct vm_rwregs_params *, int); int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *); -int svm_get_vmsa_pa(uint32_t, uint32_t, uint64_t *); +int svm_get_vmsa_pa(struct proc *, struct file *, uint32_t, uint64_t *); #endif /* _KERNEL */ diff --git a/lib/libc/include/x86_64-openbsd-none/machine/vmparam.h b/lib/libc/include/x86_64-openbsd-none/machine/vmparam.h index dc577330a2478aa5516bf4de3591918142422568..463a650b1150c92d304aff1a0e88de66a5938f92 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/vmparam.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.25 2024/11/08 01:44:52 jsg Exp $ */ +/* $OpenBSD: vmparam.h,v 1.26 2026/06/22 00:27:33 jsg Exp $ */ /* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */ /*- @@ -98,7 +98,7 @@ #define VM_MIN_STACK_ADDRESS 0x0000600000000000 #endif #define VM_MIN_KERNEL_ADDRESS 0xffff800000000000 -#define VM_MAX_KERNEL_ADDRESS 0xffff800100000000 +#define VM_MAX_KERNEL_ADDRESS 0xffff808000000000 /* map PIE into approximately the first quarter of user va space */ #define VM_PIE_MIN_ADDR VM_MIN_ADDRESS diff --git a/tools/process_headers.zig b/tools/process_headers.zig index 976f17b18207bd12bd915a64b4318d9543e63399..5859eebd22fa04cadeaa62f8fb0842e2287d8f8a 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -108,7 +108,6 @@ const openbsd_targets = [_]LibCTarget{ .{ .arch = .arm, .abi = .eabi }, .{ .arch = .aarch64, .abi = .none }, .{ .arch = .mips64, .abi = .none }, - .{ .arch = .mips64el, .abi = .none }, .{ .arch = .powerpc, .abi = .eabihf }, .{ .arch = .powerpc64, .abi = .none }, .{ .arch = .riscv64, .abi = .none }, @@ -238,7 +237,6 @@ pub fn main(init: std.process.Init) !void { .arm => "armv7", .aarch64 => "arm64", .mips64 => "octeon", - .mips64el => "loongson", .powerpc => "macppc", .x86 => "i386", .x86_64 => "amd64",