diff --git a/lib/compiler/aro_translate_c.zig b/lib/compiler/aro_translate_c.zig index 9485bc79d2..e064cfa345 100644 --- a/lib/compiler/aro_translate_c.zig +++ b/lib/compiler/aro_translate_c.zig @@ -1206,7 +1206,7 @@ pub const PatternList = struct { /// Assumes that `ms` represents a tokenized function-like macro. fn buildArgsHash(allocator: mem.Allocator, ms: MacroSlicer, hash: *ArgsPositionMap) MacroProcessingError!void { assert(ms.tokens.len > 2); - assert(ms.tokens[0].id == .identifier or ms.tokens[0].id == .extended_identifier); + assert(ms.tokens[0].id.isMacroIdentifier()); assert(ms.tokens[1].id == .l_paren); var i: usize = 2; diff --git a/lib/compiler_rt.zig b/lib/compiler_rt.zig index 3644a6bb75..e17dea2b4c 100644 --- a/lib/compiler_rt.zig +++ b/lib/compiler_rt.zig @@ -265,7 +265,7 @@ comptime { _ = @import("compiler_rt/ssp.zig"); } - if (!builtin.link_libc and builtin.abi == .msvc) { + if (!builtin.link_libc and builtin.os.tag == .windows and (builtin.abi == .none or builtin.abi == .msvc)) { @export(&_fltused, .{ .name = "_fltused", .linkage = common.linkage, .visibility = common.visibility }); } } diff --git a/lib/compiler_rt/aulldiv.zig b/lib/compiler_rt/aulldiv.zig index 6832b66d01..2f57ab1687 100644 --- a/lib/compiler_rt/aulldiv.zig +++ b/lib/compiler_rt/aulldiv.zig @@ -8,7 +8,7 @@ const common = @import("common.zig"); pub const panic = common.panic; comptime { - if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and !builtin.link_libc) { + if (arch == .x86 and common.want_windows_msvc_or_itanium_abi and !builtin.link_libc) { // Don't let LLVM apply the stdcall name mangling on those MSVC builtins @export(&_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility }); @export(&_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility }); diff --git a/lib/compiler_rt/aullrem.zig b/lib/compiler_rt/aullrem.zig index 3934225c8c..df50ef7381 100644 --- a/lib/compiler_rt/aullrem.zig +++ b/lib/compiler_rt/aullrem.zig @@ -8,7 +8,7 @@ const common = @import("common.zig"); pub const panic = common.panic; comptime { - if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and !builtin.link_libc) { + if (arch == .x86 and common.want_windows_msvc_or_itanium_abi and !builtin.link_libc) { // Don't let LLVM apply the stdcall name mangling on those MSVC builtins @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility }); @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility }); diff --git a/lib/compiler_rt/common.zig b/lib/compiler_rt/common.zig index a5b9166630..1962296706 100644 --- a/lib/compiler_rt/common.zig +++ b/lib/compiler_rt/common.zig @@ -52,6 +52,11 @@ pub const want_aeabi = switch (builtin.abi) { // Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed. pub const want_windows_arm_abi = builtin.cpu.arch.isArm() and (builtin.os.tag == .windows or builtin.os.tag == .uefi) and (builtin.abi.isGnu() or !builtin.link_libc); +pub const want_windows_msvc_or_itanium_abi = switch (builtin.abi) { + .none, .msvc, .itanium => builtin.os.tag == .windows, + else => false, +}; + pub const want_ppc_abi = builtin.cpu.arch.isPowerPC(); pub const want_float_exceptions = !builtin.cpu.arch.isWasm(); diff --git a/lib/libc/include/riscv32-netbsd-none/float.h b/lib/libc/include/riscv32-netbsd-none/float.h deleted file mode 100644 index 8344122e92..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/float.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_FLOAT_H_ -#define _RISCV_FLOAT_H_ - -#include - -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ -#define LDBL_DIG __LDBL_DIG__ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ -#define LDBL_EPSILON __LDBL_EPSILON__ -#define LDBL_MIN __LDBL_MIN__ -#define LDBL_MAX __LDBL_MAX__ - -#include - -#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE)) \ - || (__STDC_VERSION__ - 0) >= 199901L \ - || (_POSIX_C_SOURCE - 0) >= 200112L \ - || ((_XOPEN_SOURCE - 0) >= 600) \ - || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) -#define DECIMAL_DIG __DECIMAL_DIG__ -#endif - -#endif /* !_RISCV_FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/ansi.h b/lib/libc/include/riscv32-netbsd-none/machine/ansi.h deleted file mode 100644 index 1d43bb7d2e..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/ansi.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: ansi.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/aout_machdep.h b/lib/libc/include/riscv32-netbsd-none/machine/aout_machdep.h deleted file mode 100644 index a82e366d96..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/aout_machdep.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: aout_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_AOUT_MACHDEP_H_ -#define _RISCV_AOUT_MACHDEP_H_ - -#define cpu_exec_aout_makecmds(p, epp) ENOEXEC - -/* Size of a page in an object file. */ -#define AOUT_LDPGSZ 4096 - -#endif /* !_RISCV_AOUT_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/asm.h b/lib/libc/include/riscv32-netbsd-none/machine/asm.h deleted file mode 100644 index ede1e0b204..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/asm.h +++ /dev/null @@ -1,266 +0,0 @@ -/* $NetBSD: asm.h,v 1.6 2021/05/01 07:05:07 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_ASM_H -#define _RISCV_ASM_H - -#define _C_LABEL(x) x - -#define __CONCAT(x,y) x ## y -#define __STRING(x) #x - -#define ___CONCAT(x,y) __CONCAT(x,y) - -/* - * Define -pg profile entry code. - * Must always be noreorder, must never use a macro instruction - * Final addiu to t9 must always equal the size of this _KERN_MCOUNT - */ -#define _KERN_MCOUNT \ - .set push; \ - subi sp, sp, CALLFRAME_SIZE; \ - REG_S a0, CALLFRAME_S0(sp); \ - REG_S ra, CALLFRAME_RA(sp); \ - move a0, ra; \ - call _mcount \ - REG_L ra, CALLFRAME_RA(sp); \ - REG_L a0, CALLFRAME_S0(sp); \ - addi sp, sp, CALLFRAME_SIZ; \ - .set pop; - -#ifdef GPROF -#define _PROF_PROLOGUE _KERN_MCOUNT -#else -#define _PROF_PROLOGUE -#endif - -#ifdef __PIC__ -#define PLT(x) x##@plt -#else -#define PLT(x) x -#endif - -/* - * WEAK_ALIAS: create a weak alias. - */ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym -/* - * STRONG_ALIAS: create a strong alias. - */ -#define STRONG_ALIAS(alias,sym) \ - .globl alias; \ - alias = sym - -/* - * WARN_REFERENCES: create a warning if the specified symbol is referenced. - */ -#define WARN_REFERENCES(sym,msg) \ - .pushsection __CONCAT(.gnu.warning.,sym); \ - .ascii msg; \ - .popsection - -#define _ENTRY(x) \ - .globl _C_LABEL(x); \ - .type _C_LABEL(x), @function; \ - _C_LABEL(x): - -#define ENTRY_NP(x) .text; .align 2; _ENTRY(x) -#define ENTRY(x) ENTRY_NP(x); _PROF_PROLOGUE -#define END(x) .size _C_LABEL(x), . - _C_LABEL(x) - -/* - * Macros to panic and printf from assembly language. - */ -#define PANIC(msg) \ - la a0, 9f; \ - call _C_LABEL(panic); \ - MSG(msg) - -#define PRINTF(msg) \ - la a0, 9f; \ - call _C_LABEL(printf); \ - MSG(msg) - -#define MSG(msg) \ - .pushsection .rodata.str1.8,"aMS",@progbits,1; \ -9: .asciiz msg; \ - .popsection - -#define ASMSTR(str) \ - .asciiz str; \ - .align 3 - -#define __RCSID(x) .pushsection ".ident","MS",@progbits,1; \ - .asciz x; \ - .popsection -#define RCSID(name) __RCSID(name) - -#if defined(_LP64) -#define SZREG 8 -#else -#define SZREG 4 -#endif - -#define ALSK 15 /* stack alignment */ -#define ALMASK -15 /* stack alignment */ -#define SZFPREG 8 -#define FP_L fld -#define FP_S fsd - -/* - * standard callframe { - * register_t cf_sp; frame pointer - * register_t cf_ra; return address - * }; - */ -#define CALLFRAME_SIZ (SZREG * 4) -#define CALLFRAME_S1 (CALLFRAME_SIZ - 4 * SZREG) -#define CALLFRAME_S0 (CALLFRAME_SIZ - 3 * SZREG) -#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG) -#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG) - -/* - * These macros hide the use of rv32 and rv64 instructions from the - * assembler to prevent the assembler from generating 64-bit style - * ABI calls. - */ -#define PTR_ADD add -#define PTR_ADDI addi -#define PTR_SUB sub -#define PTR_SUBI subi -#define PTR_LA la -#define PTR_SLLI slli -#define PTR_SLL sll -#define PTR_SRLI srli -#define PTR_SRL srl -#define PTR_SRAI srai -#define PTR_SRA sra -#if _LP64 -#define PTR_L ld -#define PTR_S sd -#define PTR_LR lr.d -#define PTR_SC sc.d -#define PTR_WORD .dword -#define PTR_SCALESHIFT 3 -#else -#define PTR_L lw -#define PTR_S sw -#define PTR_LR lr.w -#define PTR_SC sc.w -#define PTR_WORD .word -#define PTR_SCALESHIFT 2 -#endif - -#define INT_L lw -#define INT_LA la -#define INT_S sw -#define INT_LR lr.w -#define INT_SC sc.w -#define INT_WORD .word -#define INT_SCALESHIFT 2 -#ifdef _LP64 -#define INT_ADD addw -#define INT_ADDI addwi -#define INT_SUB subw -#define INT_SUBI subwi -#define INT_SLL sllwi -#define INT_SLLV sllw -#define INT_SRL srlwi -#define INT_SRLV srlw -#define INT_SRA srawi -#define INT_SRAV sraw -#else -#define INT_ADD add -#define INT_ADDI addi -#define INT_SUB sub -#define INT_SUBI subi -#define INT_SLLI slli -#define INT_SLL sll -#define INT_SRLI srli -#define INT_SRL srl -#define INT_SRAI srai -#define INT_SRA sra -#endif - -#define LONG_LA la -#define LONG_ADD add -#define LONG_ADDI addi -#define LONG_SUB sub -#define LONG_SUBI subi -#define LONG_SLLI slli -#define LONG_SLL sll -#define LONG_SRLI srli -#define LONG_SRL srl -#define LONG_SRAI srai -#define LONG_SRA sra -#ifdef _LP64 -#define LONG_L ld -#define LONG_S sd -#define LONG_LR lr.d -#define LONG_SC sc.d -#define LONG_WORD .quad -#define LONG_SCALESHIFT 3 -#else -#define LONG_L lw -#define LONG_S sw -#define LONG_LR lr.w -#define LONG_SC sc.w -#define LONG_WORD .word -#define LONG_SCALESHIFT 2 -#endif - -#define REG_LI li -#define REG_ADD add -#define REG_SLLI slli -#define REG_SLL sll -#define REG_SRLI srli -#define REG_SRL srl -#define REG_SRAI srai -#define REG_SRA sra -#if _LP64 -#define REG_L ld -#define REG_S sd -#define REG_LR lr.d -#define REG_SC sc.d -#define REG_SCALESHIFT 3 -#else -#define REG_L lw -#define REG_S sw -#define REG_LR lr.w -#define REG_SC sc.w -#define REG_SCALESHIFT 2 -#endif - -#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off) - -#endif /* _RISCV_ASM_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/bswap.h b/lib/libc/include/riscv32-netbsd-none/machine/bswap.h deleted file mode 100644 index c1b997f37c..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/bswap.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: bswap.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef _RISCV_BSWAP_H_ -#define _RISCV_BSWAP_H_ - -#include - -#define __BSWAP_RENAME -#include - -#endif /* _RISCV_BSWAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/cdefs.h b/lib/libc/include/riscv32-netbsd-none/machine/cdefs.h deleted file mode 100644 index 3994a71b31..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/cdefs.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $NetBSD: cdefs.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef _RISCV_CDEFS_H_ -#define _RISCV_CDEFS_H_ - -#define __ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1U) - -#endif /* _RISCV_CDEFS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/cpu.h b/lib/libc/include/riscv32-netbsd-none/machine/cpu.h deleted file mode 100644 index 694e2cad26..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/cpu.h +++ /dev/null @@ -1,153 +0,0 @@ -/* $NetBSD: cpu.h,v 1.9 2022/11/17 09:50:23 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_CPU_H_ -#define _RISCV_CPU_H_ - -#if defined(_KERNEL) || defined(_KMEMUSER) - -struct clockframe { - vaddr_t cf_epc; - register_t cf_status; - int cf_intr_depth; -}; - -#define CLKF_USERMODE(cf) (((cf)->cf_status & SR_SPP) == 0) -#define CLKF_PC(cf) ((cf)->cf_epc) -#define CLKF_INTR(cf) ((cf)->cf_intr_depth > 0) - -#include -#include -#include -#include - -struct cpu_info { - struct cpu_data ci_data; - device_t ci_dev; - cpuid_t ci_cpuid; - struct lwp *ci_curlwp; - struct lwp *ci_onproc; /* current user LWP / kthread */ - struct lwp *ci_softlwps[SOFTINT_COUNT]; - struct trapframe *ci_ddb_regs; - - uint64_t ci_lastintr; - - int ci_mtx_oldspl; - int ci_mtx_count; - - int ci_want_resched; - int ci_cpl; - u_int ci_softints; - volatile u_int ci_intr_depth; - - tlb_asid_t ci_pmap_asid_cur; - - union pmap_segtab *ci_pmap_user_segtab; -#ifdef _LP64 - union pmap_segtab *ci_pmap_user_seg0tab; -#endif - - struct evcnt ci_ev_fpu_saves; - struct evcnt ci_ev_fpu_loads; - struct evcnt ci_ev_fpu_reenables; -#if defined(GPROF) && defined(MULTIPROCESSOR) - struct gmonparam *ci_gmon; /* MI per-cpu GPROF */ -#endif -}; - -#endif /* _KERNEL || _KMEMUSER */ - -#ifdef _KERNEL - -extern struct cpu_info cpu_info_store; - -// This is also in -struct lwp; -static inline struct cpu_info *lwp_getcpu(struct lwp *); - -register struct lwp *riscv_curlwp __asm("tp"); -#define curlwp riscv_curlwp -#define curcpu() lwp_getcpu(curlwp) - -static inline cpuid_t -cpu_number(void) -{ -#ifdef MULTIPROCESSOR - return curcpu()->ci_cpuid; -#else - return 0; -#endif -} - -void cpu_proc_fork(struct proc *, struct proc *); -void cpu_signotify(struct lwp *); -void cpu_need_proftick(struct lwp *l); -void cpu_boot_secondary_processors(void); - -#define CPU_INFO_ITERATOR cpuid_t -#ifdef MULTIPROCESSOR -#define CPU_INFO_FOREACH(cii, ci) \ - (cii) = 0; ((ci) = cpu_infos[cii]) != NULL; (cii)++ -#else -#define CPU_INFO_FOREACH(cii, ci) \ - (cii) = 0, (ci) = curcpu(); (cii) == 0; (cii)++ -#endif - -#define CPU_INFO_CURPMAP(ci) (curlwp->l_proc->p_vmspace->vm_map.pmap) - -static inline void -cpu_dosoftints(void) -{ - extern void dosoftints(void); - struct cpu_info * const ci = curcpu(); - if (ci->ci_intr_depth == 0 - && (ci->ci_data.cpu_softints >> ci->ci_cpl) > 0) - dosoftints(); -} - -static inline bool -cpu_intr_p(void) -{ - return curcpu()->ci_intr_depth > 0; -} - -#define LWP_PC(l) cpu_lwp_pc(l) - -vaddr_t cpu_lwp_pc(struct lwp *); - -static inline void -cpu_idle(void) -{ -} - -#endif /* _KERNEL */ - -#endif /* _RISCV_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/disklabel.h b/lib/libc/include/riscv32-netbsd-none/machine/disklabel.h deleted file mode 100644 index e147d8f9a5..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/disklabel.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_DISKLABEL_H_ -#define _RISCV_DISKLABEL_H_ - -#define LABELUSESMBR 1 /* use MBR partitionning */ -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ -#define RAW_PART 2 /* raw partition: XX?c */ - -#if HAVE_NBTOOL_CONFIG_H -#include -#include -#else -#include -#include -#endif /* HAVE_NBTOOL_CONFIG_H */ - -struct cpu_disklabel { - struct mbr_partition mbrparts[MBR_PART_COUNT]; -#define __HAVE_DISKLABEL_DKBAD - struct dkbad bad; -}; - -#ifdef _KERNEL -struct buf; -struct disklabel; - -/* for readdisklabel. rv != 0 -> matches, msg == NULL -> success */ -int mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *, - struct cpu_disklabel *, const char **, int *, int *); - -/* for writedisklabel. rv == 0 -> doesn't match, rv > 0 -> success */ -int mbr_label_locate(dev_t, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *); -#endif /* _KERNEL */ - -#endif /* _RISCV_DISKLABEL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/elf_machdep.h b/lib/libc/include/riscv32-netbsd-none/machine/elf_machdep.h deleted file mode 100644 index 6bce6a3f5d..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/elf_machdep.h +++ /dev/null @@ -1,144 +0,0 @@ -/* $NetBSD: elf_machdep.h,v 1.9 2022/12/03 08:54:38 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_ELF_MACHDEP_H_ -#define _RISCV_ELF_MACHDEP_H_ - -#define ELF32_MACHDEP_ID EM_RISCV -#define ELF64_MACHDEP_ID EM_RISCV - -#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB -#define ELF64_MACHDEP_ENDIANNESS ELFDATA2LSB - -#define ELF32_MACHDEP_ID_CASES \ - case EM_RISCV: \ - break; - -#define ELF64_MACHDEP_ID_CASES \ - case EM_RISCV: \ - break; - -#ifdef _LP64 -#define KERN_ELFSIZE 64 -#define ARCH_ELFSIZE 64 /* MD native binary size */ -#else -#define KERN_ELFSIZE 32 -#define ARCH_ELFSIZE 32 /* MD native binary size */ -#endif - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Processor specific relocation types */ - -#define R_RISCV_NONE 0 -#define R_RISCV_32 1 // A -#define R_RISCV_64 2 -#define R_RISCV_RELATIVE 3 -#define R_RISCV_COPY 4 -#define R_RISCV_JMP_SLOT 5 -#define R_RISCV_TLS_DTPMOD32 6 -#define R_RISCV_TLS_DTPMOD64 7 -#define R_RISCV_TLS_DTPREL32 8 -#define R_RISCV_TLS_DTPREL64 9 -#define R_RISCV_TLS_TPREL32 10 -#define R_RISCV_TLS_TPREL64 11 - -/* The rest are not used by the dynamic linker */ -#define R_RISCV_BRANCH 16 // (A - P) & 0xffff -#define R_RISCV_JAL 17 // A & 0xff -#define R_RISCV_CALL 18 // (A - P) & 0xff -#define R_RISCV_CALL_PLT 19 -#define R_RISCV_GOT_HI20 20 -#define R_RISCV_TLS_GOT_HI20 21 -#define R_RISCV_TLS_GD_HI20 22 -#define R_RISCV_PCREL_HI20 23 -#define R_RISCV_PCREL_LO12_I 24 -#define R_RISCV_PCREL_LO12_S 25 -#define R_RISCV_HI20 26 // A & 0xffff -#define R_RISCV_LO12_I 27 // (A >> 16) & 0xffff -#define R_RISCV_LO12_S 28 // (S + A - P) >> 2 -#define R_RISCV_TPREL_HI20 29 -#define R_RISCV_TPREL_LO12_I 30 -#define R_RISCV_TPREL_LO12_S 31 -#define R_RISCV_TPREL_ADD 32 -#define R_RISCV_ADD8 33 -#define R_RISCV_ADD16 34 -#define R_RISCV_ADD32 35 -#define R_RISCV_ADD64 36 -#define R_RISCV_SUB8 37 -#define R_RISCV_SUB16 38 -#define R_RISCV_SUB32 39 -#define R_RISCV_SUB64 40 -#define R_RISCV_GNU_VTINHERIT 41 // A & 0xffff -#define R_RISCV_GNU_VTENTRY 42 -#define R_RISCV_ALIGN 43 -#define R_RISCV_RVC_BRANCH 44 -#define R_RISCV_RVC_JUMP 45 -#define R_RISCV_RVC_LUI 46 -#define R_RISCV_GPREL_I 47 -#define R_RISCV_GPREL_S 48 -#define R_RISCV_TPREL_I 49 -#define R_RISCV_TPREL_S 50 -#define R_RISCV_RELAX 51 -#define R_RISCV_SUB6 52 -#define R_RISCV_SET6 53 -#define R_RISCV_SET8 54 -#define R_RISCV_SET16 55 -#define R_RISCV_SET32 56 -#define R_RISCV_32_PCREL 57 - -/* These are aliases we can use R_TYPESZ */ -#define R_RISCV_ADDR32 R_RISCV_32 -#define R_RISCV_ADDR64 R_RISCV_64 - -#define R_TYPE(name) R_RISCV_ ## name -#if ELFSIZE == 32 -#define R_TYPESZ(name) R_RISCV_ ## name ## 32 -#else -#define R_TYPESZ(name) R_RISCV_ ## name ## 64 -#endif - -#ifdef _KERNEL -#ifdef ELFSIZE -#define ELF_MD_PROBE_FUNC ELFNAME2(cpu_netbsd,probe) -#endif - -struct exec_package; - -int cpu_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *, - vaddr_t *); - -int cpu_netbsd_elf64_probe(struct lwp *, struct exec_package *, void *, char *, - vaddr_t *); - -#endif /* _KERNEL */ - -#endif /* _RISCV_ELF_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/endian.h b/lib/libc/include/riscv32-netbsd-none/machine/endian.h deleted file mode 100644 index 856beaaacb..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: endian.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/endian_machdep.h b/lib/libc/include/riscv32-netbsd-none/machine/endian_machdep.h deleted file mode 100644 index 99f8f2065c..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/endian_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: endian_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#define _BYTE_ORDER _LITTLE_ENDIAN \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/fenv.h b/lib/libc/include/riscv32-netbsd-none/machine/fenv.h deleted file mode 100644 index f82b74150b..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/fenv.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $NetBSD: fenv.h,v 1.3 2020/03/14 16:12:16 skrll Exp $ */ - -/* - * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 - * Public domain. - */ - -#ifndef _RISCV_FENV_H_ -#define _RISCV_FENV_H_ - -typedef int fenv_t; /* FPSCR */ -typedef int fexcept_t; - -#define FE_INEXACT 0x00 /* Result inexact */ -#define FE_UNDERFLOW 0x02 /* Result underflowed */ -#define FE_OVERFLOW 0x04 /* Result overflowed */ -#define FE_DIVBYZERO 0x08 /* divide-by-zero */ -#define FE_INVALID 0x10 /* Result invalid */ - -#define FE_ALL_EXCEPT 0x1f - -#define FE_TONEAREST 0 /* round to nearest representable number */ -#define FE_TOWARDZERO 1 /* round to zero (truncate) */ -#define FE_DOWNWARD 2 /* round toward negative infinity */ -#define FE_UPWARD 3 /* round toward positive infinity */ - -__BEGIN_DECLS - -/* Default floating-point environment */ -extern const fenv_t __fe_dfl_env; -#define FE_DFL_ENV (&__fe_dfl_env) - -__END_DECLS - -#endif /* _RISCV_FENV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/float.h b/lib/libc/include/riscv32-netbsd-none/machine/float.h deleted file mode 100644 index 8344122e92..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/float.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_FLOAT_H_ -#define _RISCV_FLOAT_H_ - -#include - -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ -#define LDBL_DIG __LDBL_DIG__ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ -#define LDBL_EPSILON __LDBL_EPSILON__ -#define LDBL_MIN __LDBL_MIN__ -#define LDBL_MAX __LDBL_MAX__ - -#include - -#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE)) \ - || (__STDC_VERSION__ - 0) >= 199901L \ - || (_POSIX_C_SOURCE - 0) >= 200112L \ - || ((_XOPEN_SOURCE - 0) >= 600) \ - || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) -#define DECIMAL_DIG __DECIMAL_DIG__ -#endif - -#endif /* !_RISCV_FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/ieee.h b/lib/libc/include/riscv32-netbsd-none/machine/ieee.h deleted file mode 100644 index 7f66694249..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/ieee.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: ieee.h,v 1.2 2019/04/13 15:57:31 maya Exp $ */ - -#include /* for #define __HAVE_LONG_DOUBLE 128 */ -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/ieeefp.h b/lib/libc/include/riscv32-netbsd-none/machine/ieeefp.h deleted file mode 100644 index 842a0c9ead..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/ieeefp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: ieeefp.h,v 1.2 2020/03/14 16:12:16 skrll Exp $ */ - -/* - * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 - * Public domain. - */ - -#ifndef _RISCV_IEEEFP_H_ -#define _RISCV_IEEEFP_H_ - -#include - -#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) - -#include - -#if !defined(_ISOC99_SOURCE) - -/* Exception type (used by fpsetmask() et al.) */ - -typedef int fp_except; - -/* Bit defines for fp_except */ - -#define FP_X_INV FE_INVALID /* invalid operation exception */ -#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */ -#define FP_X_OFL FE_OVERFLOW /* overflow exception */ -#define FP_X_UFL FE_UNDERFLOW /* underflow exception */ -#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */ - -/* Rounding modes */ - -typedef enum { - FP_RN=FE_TONEAREST, /* round to nearest representable number */ - FP_RP=FE_UPWARD, /* round toward positive infinity */ - FP_RM=FE_DOWNWARD, /* round toward negative infinity */ - FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */ -} fp_rnd; - -#endif /* !_ISOC99_SOURCE */ - -#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */ - -#endif /* _RISCV_IEEEFP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/int_const.h b/lib/libc/include/riscv32-netbsd-none/machine/int_const.h deleted file mode 100644 index f83b16fbd1..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/int_const.h +++ /dev/null @@ -1,20 +0,0 @@ -/* $NetBSD: int_const.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef __INTMAX_C_SUFFIX__ - -#define __INT8_C_SUFFIX__ -#define __INT16_C_SUFFIX__ -#define __INT32_C_SUFFIX__ -#define __INT64_C_SUFFIX__ LL - -#define __UINT8_C_SUFFIX__ -#define __UINT16_C_SUFFIX__ -#define __UINT32_C_SUFFIX__ -#define __UINT64_C_SUFFIX__ ULL - -#define __INTMAX_C_SUFFIX__ LL -#define __UINTMAX_C_SUFFIX__ ULL - -#endif - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/int_fmtio.h b/lib/libc/include/riscv32-netbsd-none/machine/int_fmtio.h deleted file mode 100644 index 81c47b4ebc..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/int_fmtio.h +++ /dev/null @@ -1,381 +0,0 @@ -/* $NetBSD: int_fmtio.h,v 1.4 2019/04/17 11:01:19 mrg Exp $ */ - -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * 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. - */ - -#ifndef _RISCV_INT_FMTIO_H_ -#define _RISCV_INT_FMTIO_H_ - -#ifdef __INTPTR_FMTd__ -#include -#else -/* - * 7.8.1 Macros for format specifiers - */ - -/* fprintf macros for signed integers */ -#define PRId8 "hhd" /* int8_t */ -#define PRId16 "hd" /* int16_t */ -#define PRId32 "d" /* int32_t */ -#ifdef _LP64 -#define PRId64 "ld" /* int64_t */ -#else -#define PRId64 "lld" /* int64_t */ -#endif -#define PRIdLEAST8 "hhd" /* int_least8_t */ -#define PRIdLEAST16 "hd" /* int_least16_t */ -#define PRIdLEAST32 "d" /* int_least32_t */ -#ifdef _LP64 -#define PRIdLEAST64 "ld" /* int_least64_t */ -#define PRIdFAST8 "d" /* int_fast8_t */ -#define PRIdFAST16 "d" /* int_fast16_t */ -#else -#define PRIdLEAST64 "lld" /* int_least64_t */ -#define PRIdFAST8 "hhd" /* int_fast8_t */ -#define PRIdFAST16 "hd" /* int_fast16_t */ -#endif -#define PRIdFAST32 "d" /* int_fast32_t */ -#ifdef _LP64 -#define PRIdFAST64 "ld" /* int_fast64_t */ -#define PRIdMAX "ld" /* intmax_t */ -#else -#define PRIdFAST64 "lld" /* int_fast64_t */ -#define PRIdMAX "lld" /* intmax_t */ -#endif -#define PRIdPTR "ld" /* intptr_t */ - -#define PRIi8 "hhi" /* int8_t */ -#define PRIi16 "hi" /* int16_t */ -#define PRIi32 "i" /* int32_t */ -#ifdef _LP64 -#define PRIi64 "li" /* int64_t */ -#else -#define PRIi64 "lli" /* int64_t */ -#endif -#define PRIiLEAST8 "hhi" /* int_least8_t */ -#define PRIiLEAST16 "hi" /* int_least16_t */ -#define PRIiLEAST32 "i" /* int_least32_t */ -#ifdef _LP64 -#define PRIiLEAST64 "li" /* int_least64_t */ -#define PRIiFAST8 "i" /* int_fast8_t */ -#define PRIiFAST16 "i" /* int_fast16_t */ -#else -#define PRIiLEAST64 "lli" /* int_least64_t */ -#define PRIiFAST8 "hhi" /* int_fast8_t */ -#define PRIiFAST16 "hi" /* int_fast16_t */ -#endif -#define PRIiFAST32 "i" /* int_fast32_t */ -#ifdef _LP64 -#define PRIiFAST64 "li" /* int_fast64_t */ -#define PRIiMAX "li" /* intmax_t */ -#else -#define PRIiFAST64 "lli" /* int_fast64_t */ -#define PRIiMAX "lli" /* intmax_t */ -#endif -#define PRIiPTR "li" /* intptr_t */ - -/* fprintf macros for unsigned integers */ - -#define PRIo8 "hho" /* uint8_t */ -#define PRIo16 "ho" /* uint16_t */ -#define PRIo32 "o" /* uint32_t */ -#ifdef _LP64 -#define PRIo64 "lo" /* uint64_t */ -#else -#define PRIo64 "llo" /* uint64_t */ -#endif -#define PRIoLEAST8 "o" /* uint_least8_t */ -#define PRIoLEAST16 "hho" /* uint_least16_t */ -#define PRIoLEAST32 "ho" /* uint_least32_t */ -#ifdef _LP64 -#define PRIoLEAST64 "lo" /* uint_least64_t */ -#define PRIoFAST8 "o" /* uint_fast8_t */ -#define PRIoFAST16 "o" /* uint_fast16_t */ -#else -#define PRIoLEAST64 "llo" /* uint_least64_t */ -#define PRIoFAST8 "hho" /* uint_fast8_t */ -#define PRIoFAST16 "ho" /* uint_fast16_t */ -#endif -#define PRIoFAST32 "o" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIoFAST64 "lo" /* uint_fast64_t */ -#define PRIoMAX "lo" /* uintmax_t */ -#else -#define PRIoFAST64 "llo" /* uint_fast64_t */ -#define PRIoMAX "llo" /* uintmax_t */ -#endif -#define PRIoPTR "lo" /* uintptr_t */ - -#define PRIu8 "hhu" /* uint8_t */ -#define PRIu16 "hu" /* uint16_t */ -#define PRIu32 "u" /* uint32_t */ -#ifdef _LP64 -#define PRIu64 "lu" /* uint64_t */ -#else -#define PRIu64 "llu" /* uint64_t */ -#endif -#define PRIuLEAST8 "hhu" /* uint_least8_t */ -#define PRIuLEAST16 "hu" /* uint_least16_t */ -#define PRIuLEAST32 "u" /* uint_least32_t */ -#ifdef _LP64 -#define PRIuLEAST64 "lu" /* uint_least64_t */ -#define PRIuFAST8 "u" /* uint_fast8_t */ -#define PRIuFAST16 "u" /* uint_fast16_t */ -#else -#define PRIuLEAST64 "llu" /* uint_least64_t */ -#define PRIuFAST8 "hhu" /* uint_fast8_t */ -#define PRIuFAST16 "hu" /* uint_fast16_t */ -#endif -#define PRIuFAST32 "u" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIuFAST64 "lu" /* uint_fast64_t */ -#define PRIuMAX "lu" /* uintmax_t */ -#else -#define PRIuFAST64 "llu" /* uint_fast64_t */ -#define PRIuMAX "llu" /* uintmax_t */ -#endif -#define PRIuPTR "lu" /* uintptr_t */ - -#define PRIx8 "hhx" /* uint8_t */ -#define PRIx16 "hx" /* uint16_t */ -#define PRIx32 "x" /* uint32_t */ -#ifdef _LP64 -#define PRIx64 "lx" /* uint64_t */ -#else -#define PRIx64 "llx" /* uint64_t */ -#endif -#define PRIxLEAST8 "x" /* uint_least8_t */ -#define PRIxLEAST16 "x" /* uint_least16_t */ -#define PRIxLEAST32 "x" /* uint_least32_t */ -#ifdef _LP64 -#define PRIxLEAST64 "lx" /* uint_least64_t */ -#define PRIxFAST8 "x" /* uint_fast8_t */ -#define PRIxFAST16 "x" /* uint_fast16_t */ -#else -#define PRIxLEAST64 "llx" /* uint_least64_t */ -#define PRIxFAST8 "hhx" /* uint_fast8_t */ -#define PRIxFAST16 "hx" /* uint_fast16_t */ -#endif -#define PRIxFAST32 "x" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIxFAST64 "lx" /* uint_fast64_t */ -#define PRIxMAX "lx" /* uintmax_t */ -#else -#define PRIxFAST64 "llx" /* uint_fast64_t */ -#define PRIxMAX "llx" /* uintmax_t */ -#endif -#define PRIxPTR "lx" /* uintptr_t */ - -#define PRIX8 "hhX" /* uint8_t */ -#define PRIX16 "hX" /* uint16_t */ -#define PRIX32 "X" /* uint32_t */ -#ifdef _LP64 -#define PRIX64 "lX" /* uint64_t */ -#else -#define PRIX64 "llX" /* uint64_t */ -#endif -#define PRIXLEAST8 "X" /* uint_least8_t */ -#define PRIXLEAST16 "X" /* uint_least16_t */ -#define PRIXLEAST32 "X" /* uint_least32_t */ -#ifdef _LP64 -#define PRIXLEAST64 "lX" /* uint_least64_t */ -#define PRIXFAST8 "X" /* uint_fast8_t */ -#define PRIXFAST16 "X" /* uint_fast16_t */ -#else -#define PRIXLEAST64 "llX" /* uint_least64_t */ -#define PRIXFAST8 "hhX" /* uint_fast8_t */ -#define PRIXFAST16 "hX" /* uint_fast16_t */ -#endif -#define PRIXFAST32 "X" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIXFAST64 "lX" /* uint_fast64_t */ -#define PRIXMAX "lX" /* uintmax_t */ -#else -#define PRIXFAST64 "llX" /* uint_fast64_t */ -#define PRIXMAX "llX" /* uintmax_t */ -#endif -#define PRIXPTR "lX" /* uintptr_t */ - -/* fscanf macros for signed integers */ - -#define SCNd8 "hhd" /* int8_t */ -#define SCNd16 "hd" /* int16_t */ -#define SCNd32 "d" /* int32_t */ -#ifdef _LP64 -#define SCNd64 "ld" /* int64_t */ -#else -#define SCNd64 "lld" /* int64_t */ -#endif -#define SCNdLEAST8 "hhd" /* int_least8_t */ -#define SCNdLEAST16 "hd" /* int_least16_t */ -#define SCNdLEAST32 "d" /* int_least32_t */ -#ifdef _LP64 -#define SCNdLEAST64 "ld" /* int_least64_t */ -#define SCNdFAST8 "d" /* int_fast8_t */ -#define SCNdFAST16 "d" /* int_fast16_t */ -#else -#define SCNdLEAST64 "lld" /* int_least64_t */ -#define SCNdFAST8 "hhd" /* int_fast8_t */ -#define SCNdFAST16 "hd" /* int_fast16_t */ -#endif -#define SCNdFAST32 "d" /* int_fast32_t */ -#ifdef _LP64 -#define SCNdFAST64 "ld" /* int_fast64_t */ -#define SCNdMAX "ld" /* intmax_t */ -#else -#define SCNdFAST64 "lld" /* int_fast64_t */ -#define SCNdMAX "lld" /* intmax_t */ -#endif -#define SCNdPTR "ld" /* intptr_t */ - -#define SCNi8 "hhi" /* int8_t */ -#define SCNi16 "hi" /* int16_t */ -#define SCNi32 "i" /* int32_t */ -#ifdef _LP64 -#define SCNi64 "li" /* int64_t */ -#else -#define SCNi64 "lli" /* int64_t */ -#endif -#define SCNiLEAST8 "hhi" /* int_least8_t */ -#define SCNiLEAST16 "hi" /* int_least16_t */ -#define SCNiLEAST32 "i" /* int_least32_t */ -#ifdef _LP64 -#define SCNiLEAST64 "li" /* int_least64_t */ -#define SCNiFAST8 "i" /* int_fast8_t */ -#define SCNiFAST16 "i" /* int_fast16_t */ -#else -#define SCNiLEAST64 "lli" /* int_least64_t */ -#define SCNiFAST8 "hhi" /* int_fast8_t */ -#define SCNiFAST16 "hi" /* int_fast16_t */ -#endif -#define SCNiFAST32 "i" /* int_fast32_t */ -#ifdef _LP64 -#define SCNiFAST64 "li" /* int_fast64_t */ -#define SCNiMAX "li" /* intmax_t */ -#else -#define SCNiFAST64 "lli" /* int_fast64_t */ -#define SCNiMAX "lli" /* intmax_t */ -#endif -#define SCNiPTR "li" /* intptr_t */ - -/* fscanf macros for unsigned integers */ - -#define SCNo8 "hho" /* uint8_t */ -#define SCNo16 "ho" /* uint16_t */ -#define SCNo32 "o" /* uint32_t */ -#ifdef _LP64 -#define SCNo64 "lo" /* uint64_t */ -#else -#define SCNo64 "llo" /* uint64_t */ -#endif -#define SCNoLEAST8 "hho" /* uint_least8_t */ -#define SCNoLEAST16 "ho" /* uint_least16_t */ -#define SCNoLEAST32 "o" /* uint_least32_t */ -#ifdef _LP64 -#define SCNoLEAST64 "lo" /* uint_least64_t */ -#define SCNoFAST8 "o" /* uint_fast8_t */ -#define SCNoFAST16 "o" /* uint_fast16_t */ -#else -#define SCNoLEAST64 "llo" /* uint_least64_t */ -#define SCNoFAST8 "hho" /* uint_fast8_t */ -#define SCNoFAST16 "ho" /* uint_fast16_t */ -#endif -#define SCNoFAST32 "o" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNoFAST64 "lo" /* uint_fast64_t */ -#define SCNoMAX "lo" /* uintmax_t */ -#else -#define SCNoFAST64 "llo" /* uint_fast64_t */ -#define SCNoMAX "llo" /* uintmax_t */ -#endif -#define SCNoPTR "lo" /* uintptr_t */ - -#define SCNu8 "hhu" /* uint8_t */ -#define SCNu16 "hu" /* uint16_t */ -#define SCNu32 "u" /* uint32_t */ -#ifdef _LP64 -#define SCNu64 "lu" /* uint64_t */ -#else -#define SCNu64 "llu" /* uint64_t */ -#endif -#define SCNuLEAST8 "hhu" /* uint_least8_t */ -#define SCNuLEAST16 "hu" /* uint_least16_t */ -#define SCNuLEAST32 "u" /* uint_least32_t */ -#ifdef _LP64 -#define SCNuLEAST64 "lu" /* uint_least64_t */ -#define SCNuFAST8 "u" /* uint_fast8_t */ -#define SCNuFAST16 "u" /* uint_fast16_t */ -#else -#define SCNuLEAST64 "llu" /* uint_least64_t */ -#define SCNuFAST8 "hhu" /* uint_fast8_t */ -#define SCNuFAST16 "hu" /* uint_fast16_t */ -#endif -#define SCNuFAST32 "u" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNuFAST64 "lu" /* uint_fast64_t */ -#define SCNuMAX "lu" /* uintmax_t */ -#else -#define SCNuFAST64 "llu" /* uint_fast64_t */ -#define SCNuMAX "llu" /* uintmax_t */ -#endif -#define SCNuPTR "lu" /* uintptr_t */ - -#define SCNx8 "hhx" /* uint8_t */ -#define SCNx16 "hx" /* uint16_t */ -#define SCNx32 "x" /* uint32_t */ -#ifdef _LP64 -#define SCNx64 "lx" /* uint64_t */ -#else -#define SCNx64 "llx" /* uint64_t */ -#endif -#define SCNxLEAST8 "hhx" /* uint_least8_t */ -#define SCNxLEAST16 "hx" /* uint_least16_t */ -#define SCNxLEAST32 "x" /* uint_least32_t */ -#ifdef _LP64 -#define SCNxLEAST64 "lx" /* uint_least64_t */ -#define SCNxFAST8 "x" /* uint_fast8_t */ -#define SCNxFAST16 "x" /* uint_fast16_t */ -#else -#define SCNxLEAST64 "llx" /* uint_least64_t */ -#define SCNxFAST8 "hhx" /* uint_fast8_t */ -#define SCNxFAST16 "hx" /* uint_fast16_t */ -#endif -#define SCNxFAST32 "x" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNxFAST64 "lx" /* uint_fast64_t */ -#define SCNxMAX "lx" /* uintmax_t */ -#else -#define SCNxFAST64 "llx" /* uint_fast64_t */ -#define SCNxMAX "llx" /* uintmax_t */ -#endif -#define SCNxPTR "lx" /* uintptr_t */ - -#endif /* !__INTPTR_FMTd__ */ - -#endif /* !_RISCV_INT_FMTIO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/int_limits.h b/lib/libc/include/riscv32-netbsd-none/machine/int_limits.h deleted file mode 100644 index 34dd6a1713..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/int_limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/int_mwgwtypes.h b/lib/libc/include/riscv32-netbsd-none/machine/int_mwgwtypes.h deleted file mode 100644 index 2387962db5..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/int_mwgwtypes.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_mwgwtypes.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/int_types.h b/lib/libc/include/riscv32-netbsd-none/machine/int_types.h deleted file mode 100644 index 29dc9d0f76..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/int_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_types.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/kcore.h b/lib/libc/include/riscv32-netbsd-none/machine/kcore.h deleted file mode 100644 index a52b7e9f3a..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/kcore.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: kcore.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_KCORE_H_ -#define _RISCV_KCORE_H_ - -typedef struct cpu_kcore_hdr { - uint64_t kh_misc[8]; - phys_ram_seg_t kh_ramsegs[0]; -} cpu_kcore_hdr_t; - -#endif /* _RISCV_KCORE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/limits.h b/lib/libc/include/riscv32-netbsd-none/machine/limits.h deleted file mode 100644 index 8161008ba5..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/lock.h b/lib/libc/include/riscv32-netbsd-none/machine/lock.h deleted file mode 100644 index 6ae00ebbc2..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/lock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: lock.h,v 1.4 2015/06/26 14:27:35 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/math.h b/lib/libc/include/riscv32-netbsd-none/machine/math.h deleted file mode 100644 index 4988e730e9..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/math.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: math.h,v 1.3 2019/04/16 07:40:02 maya Exp $ */ - -#define __HAVE_NANF -#define __HAVE_LONG_DOUBLE 128 \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/mcontext.h b/lib/libc/include/riscv32-netbsd-none/machine/mcontext.h deleted file mode 100644 index 64729bb363..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/mcontext.h +++ /dev/null @@ -1,170 +0,0 @@ -/* $NetBSD: mcontext.h,v 1.6 2020/03/14 16:12:16 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ -#ifndef _RISCV_MCONTEXT_H_ -#define _RISCV_MCONTEXT_H_ - -/* - */ - -#define _NGREG 32 /* GR1-31 */ -#define _NFREG 33 /* F0-31, FCSR */ - -/* - * This fragment is common to and - */ -#ifndef _BSD_FPREG_T_ -union __fpreg { - __uint64_t u_u64; - double u_d; -}; -#define _BSD_FPREG_T_ union __fpreg -#endif - -typedef __uint64_t __greg_t; -typedef __greg_t __gregset_t[_NGREG]; -typedef __uint32_t __greg32_t; -typedef __greg32_t __gregset32_t[_NGREG]; -typedef _BSD_FPREG_T_ __fregset_t[_NFREG]; - -#define _REG_X1 0 -#define _REG_X2 1 -#define _REG_X3 2 -#define _REG_X4 3 -#define _REG_X5 4 -#define _REG_X6 5 -#define _REG_X7 6 -#define _REG_X8 7 -#define _REG_X9 8 -#define _REG_X10 9 -#define _REG_X11 10 -#define _REG_X12 11 -#define _REG_X13 12 -#define _REG_X14 13 -#define _REG_X15 14 -#define _REG_X16 15 -#define _REG_X17 16 -#define _REG_X18 17 -#define _REG_X19 18 -#define _REG_X20 19 -#define _REG_X21 20 -#define _REG_X22 21 -#define _REG_X23 22 -#define _REG_X24 23 -#define _REG_X25 24 -#define _REG_X26 25 -#define _REG_X27 26 -#define _REG_X28 27 -#define _REG_X29 28 -#define _REG_X30 29 -#define _REG_X31 30 -#define _REG_PC 31 - -#define _REG_RA _REG_X1 -#define _REG_SP _REG_X2 -#define _REG_GP _REG_X3 -#define _REG_TP _REG_X4 -#define _REG_S0 _REG_X8 -#define _REG_RV _REG_X10 -#define _REG_A0 _REG_X10 - -#define _REG_F0 0 -#define _REG_FPCSR 32 - -typedef struct { - __gregset_t __gregs; /* General Purpose Register set */ - __fregset_t __fregs; /* Floating Point Register set */ - __greg_t __private; /* copy of l_private */ - __greg_t __spare[8]; /* future proof */ -} mcontext_t; - -typedef struct { - __gregset32_t __gregs; /* General Purpose Register set */ - __fregset_t __fregs; /* Floating Point Register set */ - __greg32_t __private; /* copy of l_private */ - __greg32_t __spare[8]; /* future proof */ -} mcontext32_t; - -/* Machine-dependent uc_flags */ -#define _UC_SETSTACK 0x00010000 /* see */ -#define _UC_CLRSTACK 0x00020000 /* see */ -#define _UC_TLSBASE 0x00080000 /* see */ - -#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP]) -#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_S0]) -#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC]) -#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RV]) - -#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc) - -#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || defined(__LIBPTHREAD_SOURCE__) -#include - -/* - * On RISCV, since displacements are signed 12-bit values, the TCB pointer is - * not and points to the first static entry. - */ -#define TLS_TP_OFFSET 0x0 -#define TLS_DTV_OFFSET 0x800 -__CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb) < 0x800); - -static __inline void * -__lwp_getprivate_fast(void) -{ - void *__tp; - __asm("move %0,tp" : "=r"(__tp)); - return __tp; -} - -static __inline void * -__lwp_gettcb_fast(void) -{ - void *__tcb; - - __asm __volatile( - "addi %[__tcb],tp,%[__offset]" - : [__tcb] "=r" (__tcb) - : [__offset] "n" (-(TLS_TP_OFFSET + sizeof(struct tls_tcb)))); - - return __tcb; -} - -static __inline void -__lwp_settcb(void *__tcb) -{ - __asm __volatile( - "addi tp,%[__tcb],%[__offset]" - : - : [__tcb] "r" (__tcb), - [__offset] "n" (TLS_TP_OFFSET + sizeof(struct tls_tcb))); -} -#endif /* _RTLD_SOURCE || _LIBC_SOURCE || __LIBPTHREAD_SOURCE__ */ - -#endif /* !_RISCV_MCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/mutex.h b/lib/libc/include/riscv32-netbsd-none/machine/mutex.h deleted file mode 100644 index d89733fa70..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/mutex.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $NetBSD: mutex.h,v 1.4.4.1 2023/08/09 17:42:03 martin Exp $ */ - -/*- - * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe and Andrew Doran. - * - * 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. - */ - -#ifndef _RISCV_MUTEX_H_ -#define _RISCV_MUTEX_H_ - -#include - -#ifndef __MUTEX_PRIVATE - -struct kmutex { - uintptr_t mtx_pad1; -}; - -#else /* __MUTEX_PRIVATE */ - -#include - -#include - -#include - -struct kmutex { - volatile uintptr_t mtx_owner; -}; - -#ifdef _LP64 -#define MTX_ASMOP_SFX ".d" // doubleword atomic op -#else -#define MTX_ASMOP_SFX ".w" // word atomic op -#endif - -#define MTX_LOCK __BIT(8) // just one bit -#define MTX_IPL __BITS(7,4) // only need 4 bits - -#undef MUTEX_SPIN_IPL // override -#define MUTEX_SPIN_IPL(a) riscv_mutex_spin_ipl(a) -#define MUTEX_INITIALIZE_SPIN_IPL(a,b) riscv_mutex_initialize_spin_ipl(a,b) -#define MUTEX_SPINBIT_LOCK_INIT(a) riscv_mutex_spinbit_lock_init(a) -#define MUTEX_SPINBIT_LOCK_TRY(a) riscv_mutex_spinbit_lock_try(a) -#define MUTEX_SPINBIT_LOCKED_P(a) riscv_mutex_spinbit_locked_p(a) -#define MUTEX_SPINBIT_LOCK_UNLOCK(a) riscv_mutex_spinbit_lock_unlock(a) - -static inline ipl_cookie_t -riscv_mutex_spin_ipl(kmutex_t *__mtx) -{ - return (ipl_cookie_t){._spl = __SHIFTOUT(__mtx->mtx_owner, MTX_IPL)}; -} - -static inline void -riscv_mutex_initialize_spin_ipl(kmutex_t *__mtx, int ipl) -{ - __mtx->mtx_owner = (__mtx->mtx_owner & ~MTX_IPL) - | __SHIFTIN(ipl, MTX_IPL); -} - -static inline void -riscv_mutex_spinbit_lock_init(kmutex_t *__mtx) -{ - __mtx->mtx_owner &= ~MTX_LOCK; -} - -static inline bool -riscv_mutex_spinbit_locked_p(const kmutex_t *__mtx) -{ - return (__mtx->mtx_owner & MTX_LOCK) != 0; -} - -static inline bool -riscv_mutex_spinbit_lock_try(kmutex_t *__mtx) -{ - uintptr_t __old; - __asm __volatile( - "amoor" MTX_ASMOP_SFX ".aq\t%0, %1, (%2)" - : "=r"(__old) - : "r"(MTX_LOCK), "r"(__mtx)); - return (__old & MTX_LOCK) == 0; -} - -static inline void -riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx) -{ - __asm __volatile( - "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)" - :: "r"(~MTX_LOCK), "r"(__mtx)); -} - -#if 0 -#define __HAVE_MUTEX_STUBS 1 -#define __HAVE_SPIN_MUTEX_STUBS 1 -#endif -#define __HAVE_SIMPLE_MUTEXES 1 - -#endif /* __MUTEX_PRIVATE */ - -#endif /* _RISCV_MUTEX_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/param.h b/lib/libc/include/riscv32-netbsd-none/machine/param.h deleted file mode 100644 index 7f465d7f09..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/param.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $NetBSD: param.h,v 1.7 2022/10/12 07:50:00 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PARAM_H_ -#define _RISCV_PARAM_H_ - -#ifdef _KERNEL_OPT -#include "opt_param.h" -#endif - -/* - * Machine dependent constants for all OpenRISC processors - */ - -/* - * For KERNEL code: - * MACHINE must be defined by the individual port. This is so that - * uname returns the correct thing, etc. - * - * For non-KERNEL code: - * If ELF, MACHINE and MACHINE_ARCH are forced to "or1k/or1k". - */ - -#ifdef _LP64 -#define _MACHINE_ARCH riscv64 -#define MACHINE_ARCH "riscv64" -#define _MACHINE_ARCH32 riscv32 -#define MACHINE_ARCH32 "riscv32" -#else -#define _MACHINE_ARCH riscv32 -#define MACHINE_ARCH "riscv32" -#endif -#define _MACHINE riscv -#define MACHINE "riscv" - -#define MID_MACHINE MID_RISCV - -/* RISCV-specific macro to align a stack pointer (downwards). */ -#define STACK_ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1) -#define ALIGNBYTES32 __BIGGEST_ALIGNMENT__ - -#define NKMEMPAGES_MIN_DEFAULT ((128UL * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_UNLIMITED 1 - -#define PGSHIFT 12 -#define NBPG (1 << PGSHIFT) -#define PGOFSET (NBPG - 1) - -#define UPAGES 2 -#define USPACE (UPAGES << PGSHIFT) -#define USPACE_ALIGN NBPG - -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than NBPG (the software page size), and - * NBPG % MCLBYTES must be zero. - */ -#define MSIZE 512 /* size of an mbuf */ - -#ifndef MCLSHIFT -#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ - /* 2K cluster can hold Ether frame */ -#endif /* MCLSHIFT */ - -#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ - -#ifndef MSGBUFSIZE -#define MSGBUFSIZE 65536 /* default message buffer size */ -#endif - -#define MAXCPUS 32 - -#ifdef _KERNEL -void delay(unsigned long); -#define DELAY(x) delay(x) -#endif - -#endif /* _RISCV_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/pcb.h b/lib/libc/include/riscv32-netbsd-none/machine/pcb.h deleted file mode 100644 index 0c99e1f84b..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/pcb.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: pcb.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PCB_H_ -#define _RISCV_PCB_H_ - -#include - -struct pcb { - struct fpreg pcb_fpregs; -}; - -struct md_coredump { - struct reg reg; - struct fpreg fpreg; -}; - -#endif /* _RISCV_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/pmap.h b/lib/libc/include/riscv32-netbsd-none/machine/pmap.h deleted file mode 100644 index 3e5fc1c95e..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/pmap.h +++ /dev/null @@ -1,213 +0,0 @@ -/* $NetBSD: pmap.h,v 1.13 2022/10/20 07:18:11 skrll Exp $ */ - -/* - * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas (of 3am Software Foundry), Maxime Villard, and - * Nick Hudson. - * - * 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. - */ - -#ifndef _RISCV_PMAP_H_ -#define _RISCV_PMAP_H_ - -#ifdef _KERNEL_OPT -#include "opt_modular.h" -#endif - -#if !defined(_MODULE) - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define PMAP_SEGTABSIZE NPTEPG -#define PMAP_PDETABSIZE NPTEPG - -#ifdef _LP64 -#define PTPSHIFT 3 -/* This is SV48. */ -//#define SEGLENGTH + SEGSHIFT + SEGSHIFT */ - -/* This is SV39. */ -#define XSEGSHIFT (SEGSHIFT + SEGLENGTH) -#define NBXSEG (1ULL << XSEGSHIFT) -#define XSEGOFSET (NBXSEG - 1) /* byte offset into xsegment */ -#define XSEGLENGTH (PGSHIFT - 3) -#define NXSEGPG (1 << XSEGLENGTH) -#else -#define PTPSHIFT 2 -#define XSEGSHIFT SEGSHIFT -#endif - -#define SEGLENGTH (PGSHIFT - PTPSHIFT) -#define SEGSHIFT (SEGLENGTH + PGSHIFT) -#define NBSEG (1 << SEGSHIFT) /* bytes/segment */ -#define SEGOFSET (NBSEG - 1) /* byte offset into segment */ - -#define KERNEL_PID 0 - -#define PMAP_HWPAGEWALKER 1 -#define PMAP_TLB_MAX 1 -#ifdef _LP64 -#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE)) -#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE)) -#else -#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)0xdeadbeef) -#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)0xdeadbeef) -#endif -#define PMAP_TLB_NUM_PIDS (__SHIFTOUT_MASK(SATP_ASID) + 1) -#define PMAP_TLB_BITMAP_LENGTH PMAP_TLB_NUM_PIDS -#define PMAP_TLB_FLUSH_ASID_ON_RESET false - -#define pmap_phys_address(x) (x) - -#ifndef __BSD_PTENTRY_T__ -#define __BSD_PTENTRY_T__ -#ifdef _LP64 -#define PRIxPTE PRIx64 -#else -#define PRIxPTE PRIx32 -#endif -#endif /* __BSD_PTENTRY_T__ */ - -#define PMAP_NEED_PROCWR -static inline void -pmap_procwr(struct proc *p, vaddr_t va, vsize_t len) -{ - __asm __volatile("fence\trw,rw; fence.i" ::: "memory"); -} - -#include -#include - -#define PMAP_GROWKERNEL -#define PMAP_STEAL_MEMORY - -#ifdef _KERNEL - -#define __HAVE_PMAP_MD -struct pmap_md { - paddr_t md_ppn; - pd_entry_t *md_pdetab; -}; - -struct vm_page * - pmap_md_alloc_poolpage(int flags); -vaddr_t pmap_md_map_poolpage(paddr_t, vsize_t); -void pmap_md_unmap_poolpage(vaddr_t, vsize_t); -bool pmap_md_direct_mapped_vaddr_p(vaddr_t); -bool pmap_md_io_vaddr_p(vaddr_t); -paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t); -vaddr_t pmap_md_direct_map_paddr(paddr_t); -void pmap_md_init(void); - -void pmap_md_xtab_activate(struct pmap *, struct lwp *); -void pmap_md_xtab_deactivate(struct pmap *); -void pmap_md_pdetab_init(struct pmap *); -bool pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t); - -void pmap_bootstrap(vaddr_t kstart, vaddr_t kend); - -extern vaddr_t pmap_direct_base; -extern vaddr_t pmap_direct_end; -#define PMAP_DIRECT_MAP(pa) (pmap_direct_base + (pa)) -#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base) - -#define MEGAPAGE_TRUNC(x) ((x) & ~SEGOFSET) -#define MEGAPAGE_ROUND(x) MEGAPAGE_TRUNC((x) + SEGOFSET) - -#ifdef __PMAP_PRIVATE - -static inline bool -pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte) -{ - // TLB not walked and so not called. - return false; -} - -static inline void -pmap_md_page_syncicache(struct vm_page_md *mdpg, const kcpuset_t *kc) -{ - __asm __volatile("fence\trw,rw; fence.i" ::: "memory"); -} - -/* - * Virtual Cache Alias helper routines. Not a problem for RISCV CPUs. - */ -static inline bool -pmap_md_vca_add(struct vm_page_md *mdpg, vaddr_t va, pt_entry_t *nptep) -{ - return false; -} - -static inline void -pmap_md_vca_remove(struct vm_page_md *mdpg, vaddr_t va) -{ -} - -static inline void -pmap_md_vca_clean(struct vm_page_md *mdpg, vaddr_t va, int op) -{ -} - -static inline size_t -pmap_md_tlb_asid_max(void) -{ - return PMAP_TLB_NUM_PIDS - 1; -} - -#endif /* __PMAP_PRIVATE */ -#endif /* _KERNEL */ - -#include - -#endif /* !_MODULE */ - -#if defined(MODULAR) || defined(_MODULE) -/* - * Define a compatible vm_page_md so that struct vm_page is the same size - * whether we are using modules or not. - */ -#ifndef __HAVE_VM_PAGE_MD -#define __HAVE_VM_PAGE_MD - -struct vm_page_md { - uintptr_t mdpg_dummy[3]; -}; -__CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*3); - -#endif /* !__HAVE_VM_PAGE_MD */ - -#endif /* MODULAR || _MODULE */ - -#endif /* !_RISCV_PMAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/proc.h b/lib/libc/include/riscv32-netbsd-none/machine/proc.h deleted file mode 100644 index 480bde9e69..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/proc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $NetBSD: proc.h,v 1.3 2015/03/31 06:47:47 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PROC_H_ -#define _RISCV_PROC_H_ - -#include -#include - -struct lwp; - -/* - * Machine-dependent part of the lwp structure for RISCV - */ -struct trapframe; - -struct mdlwp { - struct trapframe *md_utf; /* trapframe from userspace */ - struct trapframe *md_ktf; /* trapframe from userspace */ - struct faultbuf *md_onfault; /* registers to store on fault */ - register_t md_usp; /* for locore.S */ - vaddr_t md_ss_addr; /* single step address for ptrace */ - int md_ss_instr; /* single step instruction for ptrace */ - volatile int md_astpending; /* AST pending on return to userland */ -#if 0 -#if USPACE > PAGE_SIZE - int md_upte[USPACE/4096]; /* ptes for mapping u page */ -#else - int md_dpte[USPACE/4096]; /* dummy ptes to keep the same */ -#endif -#endif -}; - -struct mdproc { - /* syscall entry for this process */ - void (*md_syscall)(struct trapframe *); -}; - -#ifdef _KERNEL -#define LWP0_CPU_INFO &cpu_info_store /* staticly set in lwp0 */ -#endif /* _KERNEL */ - -#endif /* _RISCV_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/profile.h b/lib/libc/include/riscv32-netbsd-none/machine/profile.h deleted file mode 100644 index bd0bc48516..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/profile.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $NetBSD: profile.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PROFILE_H_ -#define _RISCV_PROFILE_H_ - -#define _MCOUNT_DECL void _mcount - -/* - * Cannot implement mcount in C as GCC will trash the ip register when it - * pushes a trapframe. Pity we cannot insert assembly before the function - * prologue. - */ - -#define MCOUNT_ASM_NAME "__mcount" -#define PLTSYM - -#if 0 -#define MCOUNT \ - __asm(".text"); \ - __asm(".align 0"); \ - __asm(".type " MCOUNT_ASM_NAME ",@function"); \ - __asm(".global " MCOUNT_ASM_NAME); \ - __asm(MCOUNT_ASM_NAME ":"); \ - /* \ - * Preserve registers that are trashed during mcount \ - */ \ - __asm("sub sp, sp, #80"); \ - __asm("stp x29, x30, [sp, #64]"); \ - __asm("add x29, sp, #64"); \ - __asm("stp x0, x1, [x29, #0]"); \ - __asm("stp x2, x3, [x29, #16]"); \ - __asm("stp x4, x5, [x29, #32]"); \ - __asm("stp x6, x7, [x29, #48]"); \ - /* \ - * find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * frompcindex = pc pushed by call into self. \ - */ \ - __asm("mov x0, x19"); \ - /* \ - * selfpc = pc pushed by mcount call \ - */ \ - __asm("mov x1, x30"); \ - /* \ - * Call the real mcount code \ - */ \ - __asm("bl " ___STRING(_C_LABEL(_mcount))); \ - /* \ - * Restore registers that were trashed during mcount \ - */ \ - __asm("ldp x0, x1, [x29, #0]"); \ - __asm("ldp x2, x3, [x29, #16]"); \ - __asm("ldp x4, x5, [x29, #32]"); \ - __asm("ldp x6, x7, [x29, #48]"); \ - __asm("ldp x29, x30, [x29, #64]"); \ - __asm("add sp, sp, #80"); \ - __asm("ret"); \ - __asm(".size " MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME); -#endif - -#endif /* _RISCV_PROFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/ptrace.h b/lib/libc/include/riscv32-netbsd-none/machine/ptrace.h deleted file mode 100644 index 8c240294f2..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/ptrace.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: ptrace.h,v 1.3 2019/06/18 21:18:12 kamil Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PTRACE_H_ -#define _RISCV_PTRACE_H_ - -/* - * RISCV-dependent ptrace definitions. - * Note that PT_STEP is _not_ supported. - */ -#define PT_GETREGS (PT_FIRSTMACH + 0) -#define PT_SETREGS (PT_FIRSTMACH + 1) -#define PT_GETFPREGS (PT_FIRSTMACH + 2) -#define PT_SETFPREGS (PT_FIRSTMACH + 3) - -#define PT_MACHDEP_STRINGS \ - "PT_GETREGS", \ - "PT_SETREGS", \ - "PT_GETFPREGS", \ - "PT_SETFPREGS" - -#include -#define PTRACE_REG_PC(r) (r)->r_pc -#define PTRACE_REG_FP(r) (r)->r_reg[7] -#define PTRACE_REG_SET_PC(r, v) (r)->r_pc = (v) -#define PTRACE_REG_SP(r) (r)->r_reg[1] -#define PTRACE_REG_INTRV(r) (r)->r_reg[9] - -#endif /* _RISCV_PTRACE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/reg.h b/lib/libc/include/riscv32-netbsd-none/machine/reg.h deleted file mode 100644 index 5428f3df0f..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/reg.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $NetBSD: reg.h,v 1.10 2022/12/13 22:25:08 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_REG_H_ -#define _RISCV_REG_H_ - -// x0 = 0 -// x1 = ra (return address) Caller -// x2 = sp (stack pointer) Callee -// x3 = gp (global pointer) -// x4 = tp (thread pointer) -// x5 - x7 = t0 - t2 (temporary) Caller -// x8 = s0/fp (saved register / frame pointer) Callee -// x9 = s1 (saved register) Callee -// x10 - x11 = a0 - a1 (arguments/return values) Caller -// x12 - x17 = a2 - a7 (arguments) Caller -// x18 - x27 = s2 - s11 (saved registers) Callee -// x28 - x31 = t3 - t6 (temporaries) Caller - -struct reg { // synced with register_t in -#ifdef _LP64 - __uint64_t r_reg[31]; /* x0 is always 0 */ - __uint64_t r_pc; -#else - __uint32_t r_reg[31]; /* x0 is always 0 */ - __uint32_t r_pc; -#endif -}; - -#ifdef _LP64 -struct reg32 { // synced with register_t in - __uint32_t r_reg[31]; /* x0 is always 0 */ - __uint32_t r_pc; -}; -#endif - -#define _XREG(n) ((n) - 1) -#define _X_RA _XREG(1) -#define _X_SP _XREG(2) -#define _X_GP _XREG(3) -#define _X_TP _XREG(4) -#define _X_T0 _XREG(5) -#define _X_T1 _XREG(6) -#define _X_T2 _XREG(7) -#define _X_S0 _XREG(8) -#define _X_S1 _XREG(9) -#define _X_A0 _XREG(10) -#define _X_A1 _XREG(11) -#define _X_A2 _XREG(12) -#define _X_A3 _XREG(13) -#define _X_A4 _XREG(14) -#define _X_A5 _XREG(15) -#define _X_A6 _XREG(16) -#define _X_A7 _XREG(17) -#define _X_S2 _XREG(18) -#define _X_S3 _XREG(19) -#define _X_S4 _XREG(20) -#define _X_S5 _XREG(21) -#define _X_S6 _XREG(22) -#define _X_S7 _XREG(23) -#define _X_S8 _XREG(24) -#define _X_S9 _XREG(25) -#define _X_S10 _XREG(26) -#define _X_S11 _XREG(27) -#define _X_T3 _XREG(28) -#define _X_T4 _XREG(29) -#define _X_T5 _XREG(30) -#define _X_T6 _XREG(31) - -// f0 - f7 = ft0 - ft7 (FP temporaries) Caller -// following layout is similar to integer registers above -// f8 - f9 = fs0 - fs1 (FP saved registers) Callee -// f10 - f11 = fa0 - fa1 (FP arguments/return values) Caller -// f12 - f17 = fa2 - fa7 (FP arguments) Caller -// f18 - f27 = fs2 - fa11 (FP saved registers) Callee -// f28 - f31 = ft8 - ft11 (FP temporaries) Caller - -/* - * This fragment is common to and - */ -#ifndef _BSD_FPREG_T_ -union __fpreg { - __uint64_t u_u64; - double u_d; -}; -#define _BSD_FPREG_T_ union __fpreg -#endif - -/* - * 32 double precision floating point, 1 CSR - */ -struct fpreg { - _BSD_FPREG_T_ r_fpreg[33]; -}; -#define r_fcsr r_fpreg[32].u_u64 - -#endif /* _RISCV_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/rwlock.h b/lib/libc/include/riscv32-netbsd-none/machine/rwlock.h deleted file mode 100644 index 43e43a204c..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/rwlock.h +++ /dev/null @@ -1 +0,0 @@ -/* $NetBSD: rwlock.h,v 1.2 2019/11/29 20:04:53 riastradh Exp $ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/setjmp.h b/lib/libc/include/riscv32-netbsd-none/machine/setjmp.h deleted file mode 100644 index a675abd0ac..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/setjmp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: setjmp.h,v 1.2 2015/03/27 06:57:21 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - - /* magic + 16 reg + 1 fcsr + 12 fp + 4 sigmask + 8 spare */ -#define _JBLEN (_JB_SIGMASK + 4 + 8) -#define _JB_MAGIC 0 -#define _JB_RA 1 -#define _JB_SP 2 -#define _JB_GP 3 -#define _JB_TP 4 -#define _JB_S0 5 -#define _JB_S1 6 -#define _JB_S2 7 -#define _JB_S3 8 -#define _JB_S4 9 -#define _JB_S5 10 -#define _JB_S6 11 -#define _JB_S7 12 -#define _JB_S8 13 -#define _JB_S9 14 -#define _JB_S10 15 -#define _JB_S11 16 -#define _JB_FCSR 17 - -#define _JB_FS0 18 -#define _JB_FS1 (_JB_FS0 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS2 (_JB_FS1 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS3 (_JB_FS2 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS4 (_JB_FS3 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS5 (_JB_FS4 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS6 (_JB_FS5 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS7 (_JB_FS6 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS8 (_JB_FS7 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS9 (_JB_FS8 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS10 (_JB_FS9 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS11 (_JB_FS10 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) - -#define _JB_SIGMASK (_JB_FS11 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) - -#ifndef _BSD_JBSLOT_T_ -#define _BSD_JBSLOT_T_ long long -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/signal.h b/lib/libc/include/riscv32-netbsd-none/machine/signal.h deleted file mode 100644 index 5fbfc5b9af..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/signal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $NetBSD: signal.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_SIGNAL_H_ -#define _RISCV_SIGNAL_H_ - -#ifndef _LOCORE -typedef __SIG_ATOMIC_TYPE__ sig_atomic_t; -#endif - -#endif /* _RISCV_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/types.h b/lib/libc/include/riscv32-netbsd-none/machine/types.h deleted file mode 100644 index 00998f8744..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/types.h +++ /dev/null @@ -1,116 +0,0 @@ -/* $NetBSD: types.h,v 1.15 2022/11/08 13:34:17 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_TYPES_H_ -#define _RISCV_TYPES_H_ - -#include -#include -#include - -#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE) - -/* XLEN is the native base integer ISA width */ -#define XLEN (sizeof(long) * NBBY) - -typedef __uint64_t paddr_t; -typedef __uint64_t psize_t; -#define PRIxPADDR PRIx64 -#define PRIxPSIZE PRIx64 -#define PRIuPSIZE PRIu64 - -typedef __UINTPTR_TYPE__ vaddr_t; -typedef __UINTPTR_TYPE__ vsize_t; -#define PRIxVADDR PRIxPTR -#define PRIxVSIZE PRIxPTR -#define PRIuVSIZE PRIuPTR - -#ifdef _LP64 // match -#define PRIxREGISTER PRIx64 -typedef __int64_t register_t; -typedef __uint64_t uregister_t; -#else -#define PRIxREGISTER PRIx32 -typedef __int32_t register_t; -typedef __uint32_t uregister_t; -#endif -typedef signed int register32_t; -typedef unsigned int uregister32_t; -#define PRIxREGISTER32 "x" - -typedef unsigned int tlb_asid_t; -#endif - -#if defined(_KERNEL) -typedef struct label_t { /* Used by setjmp & longjmp */ - register_t lb_reg[16]; /* */ - __uint32_t lb_sr; -} label_t; -#endif - -typedef unsigned int __cpu_simple_lock_nv_t; -#ifdef _LP64 -typedef __int64_t __register_t; -#else -typedef __int32_t __register_t; -#endif - -#define __SIMPLELOCK_LOCKED 1 -#define __SIMPLELOCK_UNLOCKED 0 - -#define __HAVE_COMMON___TLS_GET_ADDR -#define __HAVE_COMPAT_NETBSD32 -#define __HAVE_CPU_COUNTER -#define __HAVE_CPU_DATA_FIRST -#define __HAVE_FAST_SOFTINTS -#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS -#define __HAVE_NEW_STYLE_BUS_H -#define __HAVE_SYSCALL_INTERN -#define __HAVE_TLS_VARIANT_I -/* XXX temporary */ -#define __HAVE_UNLOCKED_PMAP -#define __HAVE___LWP_GETPRIVATE_FAST - -#ifdef __LP64 -#define __HAVE_ATOMIC64_OPS -#define __HAVE_CPU_UAREA_ROUTINES -#endif - -//#if defined(_KERNEL) -//#define __HAVE_RAS -//#endif - -#if defined(_KERNEL) || defined(_KMEMUSER) -#define PCU_FPU 0 -#define PCU_UNIT_COUNT 1 -#endif - -#endif /* _RISCV_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/vmparam.h b/lib/libc/include/riscv32-netbsd-none/machine/vmparam.h deleted file mode 100644 index 7ad87f53dd..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/vmparam.h +++ /dev/null @@ -1,203 +0,0 @@ -/* $NetBSD: vmparam.h,v 1.13 2022/10/16 06:14:53 skrll Exp $ */ - -/*- - * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry, and Nick Hudson. - * - * 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. - */ - -#ifndef _RISCV_VMPARAM_H_ -#define _RISCV_VMPARAM_H_ - -#include - -#ifdef _KERNEL_OPT -#include "opt_multiprocessor.h" -#endif - -/* - * Machine dependent VM constants for RISCV. - */ - -/* - * We use a 4K page on both RV64 and RV32 systems. - * Override PAGE_* definitions to compile-time constants. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) - -/* - * USRSTACK is the top (end) of the user stack. - * - * USRSTACK needs to start a page below the maxuser address so that a memory - * access with a maximum displacement (0x7ff) won't cross into the kernel's - * address space. We use PAGE_SIZE instead of 0x800 since these need to be - * page-aligned. - */ -#define USRSTACK (VM_MAXUSER_ADDRESS-PAGE_SIZE) /* Start of user stack */ -#define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS32-PAGE_SIZE) - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (128*1024*1024) /* max text size */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (256*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (1536*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (4*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (120*1024*1024) /* max stack size */ -#endif - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef DFLDSIZ32 -#define DFLDSIZ32 DFLDSIZ /* initial data size limit */ -#endif -#ifndef MAXDSIZ32 -#define MAXDSIZ32 MAXDSIZ /* max data size */ -#endif -#ifndef DFLSSIZ32 -#define DFLSSIZ32 DFLTSIZ /* initial stack size limit */ -#endif -#ifndef MAXSSIZ32 -#define MAXSSIZ32 MAXSSIZ /* max stack size */ -#endif - -/* - * PTEs for mapping user space into the kernel for phyio operations. - * The default PTE number is enough to cover 8 disks * MAXBSIZE. - */ -#ifndef USRIOSIZE -#define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8) -#endif - -/* - * User/kernel map constants. - */ -#define VM_MIN_ADDRESS ((vaddr_t)0x00000000) -#ifdef _LP64 /* Sv39 / Sv48 / Sv57 */ -/* - * kernel virtual space layout: - * 0xffff_ffc0_0000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss) - * (0xffff_ffc0_4000_0000 +1GiB) KERNEL VM start of KVA - * (0xffff_ffd0_0000_0000 64GiB) reserved - * 0xffff_ffe0_0000_0000 - 128GiB direct mapping - */ -#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000004000000000 - 16 * PAGE_SIZE) -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffc000000000) -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000) - -#else /* Sv32 */ -#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */ -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */ -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xffffffffc0000000 */ - -#endif -#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS -#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */ -#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE) -#define VM_KERNEL_DTB_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */ -#define VM_KERNEL_IO_BASE (VM_KERNEL_DTB_BASE + VM_KERNEL_DTB_SIZE) -#define VM_KERNEL_IO_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */ - -#define VM_KERNEL_RESERVED (VM_KERNEL_SIZE + VM_KERNEL_DTB_SIZE + VM_KERNEL_IO_SIZE) - -#define VM_KERNEL_VM_BASE (VM_MIN_KERNEL_ADDRESS + VM_KERNEL_RESERVED) -#define VM_KERNEL_VM_SIZE (VM_MAX_KERNEL_ADDRESS - VM_KERNEL_VM_BASE) - -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MAXUSER_ADDRESS32 ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */ - -#ifdef _LP64 -/* - * Since we have the address space, we map all of physical memory (RAM) - * using gigapages on SV39, terapages on SV48 and petapages on SV57. - */ -#define RISCV_DIRECTMAP_MASK ((vaddr_t) 0xffffffe000000000L) -#define RISCV_DIRECTMAP_SIZE (-RISCV_DIRECTMAP_MASK - PAGE_SIZE) /* 128GiB */ -#define RISCV_DIRECTMAP_START RISCV_DIRECTMAP_MASK -#define RISCV_DIRECTMAP_END (RISCV_DIRECTMAP_START + RISCV_DIRECTMAP_SIZE) -#define RISCV_KVA_P(va) (((vaddr_t) (va) & RISCV_DIRECTMAP_MASK) != 0) -#define RISCV_PA_TO_KVA(pa) ((vaddr_t) ((pa) | RISCV_DIRECTMAP_START)) -#define RISCV_KVA_TO_PA(va) ((paddr_t) ((va) & ~RISCV_DIRECTMAP_MASK)) -#endif - -/* - * The address to which unspecified mapping requests default - */ -#define __USE_TOPDOWN_VM - -#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \ - trunc_page(USRSTACK - MAXSSIZ - (sz) - user_stack_guard_size) -#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \ - round_page((vaddr_t)(da) + (vsize_t)maxdmap) - -#define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \ - trunc_page(USRSTACK32 - MAXSSIZ32 - (sz) - user_stack_guard_size) -#define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \ - round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32) - -/* virtual sizes (bytes) for various kernel submaps */ -#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) - -/* VM_PHYSSEG_MAX defined by platform-dependent code. */ -#ifndef VM_PHYSSEG_MAX -#define VM_PHYSSEG_MAX 16 -#endif -#if VM_PHYSSEG_MAX == 1 -#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST -#else -#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH -#endif -#define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */ - -#ifndef VM_NFREELIST -#define VM_NFREELIST 2 /* 2 distinct memory segments */ -#define VM_FREELIST_DEFAULT 0 -#define VM_FREELIST_DIRECTMAP 1 -#endif - -#ifdef _KERNEL -#define UVM_KM_VMFREELIST riscv_poolpage_vmfreelist -extern int riscv_poolpage_vmfreelist; - -#ifdef _LP64 -void * cpu_uarea_alloc(bool); -bool cpu_uarea_free(void *); -#endif -#endif - -#endif /* ! _RISCV_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-netbsd-none/machine/wchar_limits.h b/lib/libc/include/riscv32-netbsd-none/machine/wchar_limits.h deleted file mode 100644 index 195aa2a8ea..0000000000 --- a/lib/libc/include/riscv32-netbsd-none/machine/wchar_limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: wchar_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/float.h b/lib/libc/include/riscv64-netbsd-none/float.h deleted file mode 100644 index 8344122e92..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/float.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_FLOAT_H_ -#define _RISCV_FLOAT_H_ - -#include - -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ -#define LDBL_DIG __LDBL_DIG__ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ -#define LDBL_EPSILON __LDBL_EPSILON__ -#define LDBL_MIN __LDBL_MIN__ -#define LDBL_MAX __LDBL_MAX__ - -#include - -#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE)) \ - || (__STDC_VERSION__ - 0) >= 199901L \ - || (_POSIX_C_SOURCE - 0) >= 200112L \ - || ((_XOPEN_SOURCE - 0) >= 600) \ - || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) -#define DECIMAL_DIG __DECIMAL_DIG__ -#endif - -#endif /* !_RISCV_FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/ansi.h b/lib/libc/include/riscv64-netbsd-none/machine/ansi.h deleted file mode 100644 index 1d43bb7d2e..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/ansi.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: ansi.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/aout_machdep.h b/lib/libc/include/riscv64-netbsd-none/machine/aout_machdep.h deleted file mode 100644 index a82e366d96..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/aout_machdep.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: aout_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_AOUT_MACHDEP_H_ -#define _RISCV_AOUT_MACHDEP_H_ - -#define cpu_exec_aout_makecmds(p, epp) ENOEXEC - -/* Size of a page in an object file. */ -#define AOUT_LDPGSZ 4096 - -#endif /* !_RISCV_AOUT_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/asm.h b/lib/libc/include/riscv64-netbsd-none/machine/asm.h deleted file mode 100644 index ede1e0b204..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/asm.h +++ /dev/null @@ -1,266 +0,0 @@ -/* $NetBSD: asm.h,v 1.6 2021/05/01 07:05:07 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_ASM_H -#define _RISCV_ASM_H - -#define _C_LABEL(x) x - -#define __CONCAT(x,y) x ## y -#define __STRING(x) #x - -#define ___CONCAT(x,y) __CONCAT(x,y) - -/* - * Define -pg profile entry code. - * Must always be noreorder, must never use a macro instruction - * Final addiu to t9 must always equal the size of this _KERN_MCOUNT - */ -#define _KERN_MCOUNT \ - .set push; \ - subi sp, sp, CALLFRAME_SIZE; \ - REG_S a0, CALLFRAME_S0(sp); \ - REG_S ra, CALLFRAME_RA(sp); \ - move a0, ra; \ - call _mcount \ - REG_L ra, CALLFRAME_RA(sp); \ - REG_L a0, CALLFRAME_S0(sp); \ - addi sp, sp, CALLFRAME_SIZ; \ - .set pop; - -#ifdef GPROF -#define _PROF_PROLOGUE _KERN_MCOUNT -#else -#define _PROF_PROLOGUE -#endif - -#ifdef __PIC__ -#define PLT(x) x##@plt -#else -#define PLT(x) x -#endif - -/* - * WEAK_ALIAS: create a weak alias. - */ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym -/* - * STRONG_ALIAS: create a strong alias. - */ -#define STRONG_ALIAS(alias,sym) \ - .globl alias; \ - alias = sym - -/* - * WARN_REFERENCES: create a warning if the specified symbol is referenced. - */ -#define WARN_REFERENCES(sym,msg) \ - .pushsection __CONCAT(.gnu.warning.,sym); \ - .ascii msg; \ - .popsection - -#define _ENTRY(x) \ - .globl _C_LABEL(x); \ - .type _C_LABEL(x), @function; \ - _C_LABEL(x): - -#define ENTRY_NP(x) .text; .align 2; _ENTRY(x) -#define ENTRY(x) ENTRY_NP(x); _PROF_PROLOGUE -#define END(x) .size _C_LABEL(x), . - _C_LABEL(x) - -/* - * Macros to panic and printf from assembly language. - */ -#define PANIC(msg) \ - la a0, 9f; \ - call _C_LABEL(panic); \ - MSG(msg) - -#define PRINTF(msg) \ - la a0, 9f; \ - call _C_LABEL(printf); \ - MSG(msg) - -#define MSG(msg) \ - .pushsection .rodata.str1.8,"aMS",@progbits,1; \ -9: .asciiz msg; \ - .popsection - -#define ASMSTR(str) \ - .asciiz str; \ - .align 3 - -#define __RCSID(x) .pushsection ".ident","MS",@progbits,1; \ - .asciz x; \ - .popsection -#define RCSID(name) __RCSID(name) - -#if defined(_LP64) -#define SZREG 8 -#else -#define SZREG 4 -#endif - -#define ALSK 15 /* stack alignment */ -#define ALMASK -15 /* stack alignment */ -#define SZFPREG 8 -#define FP_L fld -#define FP_S fsd - -/* - * standard callframe { - * register_t cf_sp; frame pointer - * register_t cf_ra; return address - * }; - */ -#define CALLFRAME_SIZ (SZREG * 4) -#define CALLFRAME_S1 (CALLFRAME_SIZ - 4 * SZREG) -#define CALLFRAME_S0 (CALLFRAME_SIZ - 3 * SZREG) -#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG) -#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG) - -/* - * These macros hide the use of rv32 and rv64 instructions from the - * assembler to prevent the assembler from generating 64-bit style - * ABI calls. - */ -#define PTR_ADD add -#define PTR_ADDI addi -#define PTR_SUB sub -#define PTR_SUBI subi -#define PTR_LA la -#define PTR_SLLI slli -#define PTR_SLL sll -#define PTR_SRLI srli -#define PTR_SRL srl -#define PTR_SRAI srai -#define PTR_SRA sra -#if _LP64 -#define PTR_L ld -#define PTR_S sd -#define PTR_LR lr.d -#define PTR_SC sc.d -#define PTR_WORD .dword -#define PTR_SCALESHIFT 3 -#else -#define PTR_L lw -#define PTR_S sw -#define PTR_LR lr.w -#define PTR_SC sc.w -#define PTR_WORD .word -#define PTR_SCALESHIFT 2 -#endif - -#define INT_L lw -#define INT_LA la -#define INT_S sw -#define INT_LR lr.w -#define INT_SC sc.w -#define INT_WORD .word -#define INT_SCALESHIFT 2 -#ifdef _LP64 -#define INT_ADD addw -#define INT_ADDI addwi -#define INT_SUB subw -#define INT_SUBI subwi -#define INT_SLL sllwi -#define INT_SLLV sllw -#define INT_SRL srlwi -#define INT_SRLV srlw -#define INT_SRA srawi -#define INT_SRAV sraw -#else -#define INT_ADD add -#define INT_ADDI addi -#define INT_SUB sub -#define INT_SUBI subi -#define INT_SLLI slli -#define INT_SLL sll -#define INT_SRLI srli -#define INT_SRL srl -#define INT_SRAI srai -#define INT_SRA sra -#endif - -#define LONG_LA la -#define LONG_ADD add -#define LONG_ADDI addi -#define LONG_SUB sub -#define LONG_SUBI subi -#define LONG_SLLI slli -#define LONG_SLL sll -#define LONG_SRLI srli -#define LONG_SRL srl -#define LONG_SRAI srai -#define LONG_SRA sra -#ifdef _LP64 -#define LONG_L ld -#define LONG_S sd -#define LONG_LR lr.d -#define LONG_SC sc.d -#define LONG_WORD .quad -#define LONG_SCALESHIFT 3 -#else -#define LONG_L lw -#define LONG_S sw -#define LONG_LR lr.w -#define LONG_SC sc.w -#define LONG_WORD .word -#define LONG_SCALESHIFT 2 -#endif - -#define REG_LI li -#define REG_ADD add -#define REG_SLLI slli -#define REG_SLL sll -#define REG_SRLI srli -#define REG_SRL srl -#define REG_SRAI srai -#define REG_SRA sra -#if _LP64 -#define REG_L ld -#define REG_S sd -#define REG_LR lr.d -#define REG_SC sc.d -#define REG_SCALESHIFT 3 -#else -#define REG_L lw -#define REG_S sw -#define REG_LR lr.w -#define REG_SC sc.w -#define REG_SCALESHIFT 2 -#endif - -#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off) - -#endif /* _RISCV_ASM_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/bswap.h b/lib/libc/include/riscv64-netbsd-none/machine/bswap.h deleted file mode 100644 index c1b997f37c..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/bswap.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: bswap.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef _RISCV_BSWAP_H_ -#define _RISCV_BSWAP_H_ - -#include - -#define __BSWAP_RENAME -#include - -#endif /* _RISCV_BSWAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/cdefs.h b/lib/libc/include/riscv64-netbsd-none/machine/cdefs.h deleted file mode 100644 index 3994a71b31..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/cdefs.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $NetBSD: cdefs.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef _RISCV_CDEFS_H_ -#define _RISCV_CDEFS_H_ - -#define __ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1U) - -#endif /* _RISCV_CDEFS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/cpu.h b/lib/libc/include/riscv64-netbsd-none/machine/cpu.h deleted file mode 100644 index 694e2cad26..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/cpu.h +++ /dev/null @@ -1,153 +0,0 @@ -/* $NetBSD: cpu.h,v 1.9 2022/11/17 09:50:23 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_CPU_H_ -#define _RISCV_CPU_H_ - -#if defined(_KERNEL) || defined(_KMEMUSER) - -struct clockframe { - vaddr_t cf_epc; - register_t cf_status; - int cf_intr_depth; -}; - -#define CLKF_USERMODE(cf) (((cf)->cf_status & SR_SPP) == 0) -#define CLKF_PC(cf) ((cf)->cf_epc) -#define CLKF_INTR(cf) ((cf)->cf_intr_depth > 0) - -#include -#include -#include -#include - -struct cpu_info { - struct cpu_data ci_data; - device_t ci_dev; - cpuid_t ci_cpuid; - struct lwp *ci_curlwp; - struct lwp *ci_onproc; /* current user LWP / kthread */ - struct lwp *ci_softlwps[SOFTINT_COUNT]; - struct trapframe *ci_ddb_regs; - - uint64_t ci_lastintr; - - int ci_mtx_oldspl; - int ci_mtx_count; - - int ci_want_resched; - int ci_cpl; - u_int ci_softints; - volatile u_int ci_intr_depth; - - tlb_asid_t ci_pmap_asid_cur; - - union pmap_segtab *ci_pmap_user_segtab; -#ifdef _LP64 - union pmap_segtab *ci_pmap_user_seg0tab; -#endif - - struct evcnt ci_ev_fpu_saves; - struct evcnt ci_ev_fpu_loads; - struct evcnt ci_ev_fpu_reenables; -#if defined(GPROF) && defined(MULTIPROCESSOR) - struct gmonparam *ci_gmon; /* MI per-cpu GPROF */ -#endif -}; - -#endif /* _KERNEL || _KMEMUSER */ - -#ifdef _KERNEL - -extern struct cpu_info cpu_info_store; - -// This is also in -struct lwp; -static inline struct cpu_info *lwp_getcpu(struct lwp *); - -register struct lwp *riscv_curlwp __asm("tp"); -#define curlwp riscv_curlwp -#define curcpu() lwp_getcpu(curlwp) - -static inline cpuid_t -cpu_number(void) -{ -#ifdef MULTIPROCESSOR - return curcpu()->ci_cpuid; -#else - return 0; -#endif -} - -void cpu_proc_fork(struct proc *, struct proc *); -void cpu_signotify(struct lwp *); -void cpu_need_proftick(struct lwp *l); -void cpu_boot_secondary_processors(void); - -#define CPU_INFO_ITERATOR cpuid_t -#ifdef MULTIPROCESSOR -#define CPU_INFO_FOREACH(cii, ci) \ - (cii) = 0; ((ci) = cpu_infos[cii]) != NULL; (cii)++ -#else -#define CPU_INFO_FOREACH(cii, ci) \ - (cii) = 0, (ci) = curcpu(); (cii) == 0; (cii)++ -#endif - -#define CPU_INFO_CURPMAP(ci) (curlwp->l_proc->p_vmspace->vm_map.pmap) - -static inline void -cpu_dosoftints(void) -{ - extern void dosoftints(void); - struct cpu_info * const ci = curcpu(); - if (ci->ci_intr_depth == 0 - && (ci->ci_data.cpu_softints >> ci->ci_cpl) > 0) - dosoftints(); -} - -static inline bool -cpu_intr_p(void) -{ - return curcpu()->ci_intr_depth > 0; -} - -#define LWP_PC(l) cpu_lwp_pc(l) - -vaddr_t cpu_lwp_pc(struct lwp *); - -static inline void -cpu_idle(void) -{ -} - -#endif /* _KERNEL */ - -#endif /* _RISCV_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/disklabel.h b/lib/libc/include/riscv64-netbsd-none/machine/disklabel.h deleted file mode 100644 index e147d8f9a5..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/disklabel.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_DISKLABEL_H_ -#define _RISCV_DISKLABEL_H_ - -#define LABELUSESMBR 1 /* use MBR partitionning */ -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ -#define RAW_PART 2 /* raw partition: XX?c */ - -#if HAVE_NBTOOL_CONFIG_H -#include -#include -#else -#include -#include -#endif /* HAVE_NBTOOL_CONFIG_H */ - -struct cpu_disklabel { - struct mbr_partition mbrparts[MBR_PART_COUNT]; -#define __HAVE_DISKLABEL_DKBAD - struct dkbad bad; -}; - -#ifdef _KERNEL -struct buf; -struct disklabel; - -/* for readdisklabel. rv != 0 -> matches, msg == NULL -> success */ -int mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *, - struct cpu_disklabel *, const char **, int *, int *); - -/* for writedisklabel. rv == 0 -> doesn't match, rv > 0 -> success */ -int mbr_label_locate(dev_t, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *); -#endif /* _KERNEL */ - -#endif /* _RISCV_DISKLABEL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/elf_machdep.h b/lib/libc/include/riscv64-netbsd-none/machine/elf_machdep.h deleted file mode 100644 index 6bce6a3f5d..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/elf_machdep.h +++ /dev/null @@ -1,144 +0,0 @@ -/* $NetBSD: elf_machdep.h,v 1.9 2022/12/03 08:54:38 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_ELF_MACHDEP_H_ -#define _RISCV_ELF_MACHDEP_H_ - -#define ELF32_MACHDEP_ID EM_RISCV -#define ELF64_MACHDEP_ID EM_RISCV - -#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB -#define ELF64_MACHDEP_ENDIANNESS ELFDATA2LSB - -#define ELF32_MACHDEP_ID_CASES \ - case EM_RISCV: \ - break; - -#define ELF64_MACHDEP_ID_CASES \ - case EM_RISCV: \ - break; - -#ifdef _LP64 -#define KERN_ELFSIZE 64 -#define ARCH_ELFSIZE 64 /* MD native binary size */ -#else -#define KERN_ELFSIZE 32 -#define ARCH_ELFSIZE 32 /* MD native binary size */ -#endif - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Processor specific relocation types */ - -#define R_RISCV_NONE 0 -#define R_RISCV_32 1 // A -#define R_RISCV_64 2 -#define R_RISCV_RELATIVE 3 -#define R_RISCV_COPY 4 -#define R_RISCV_JMP_SLOT 5 -#define R_RISCV_TLS_DTPMOD32 6 -#define R_RISCV_TLS_DTPMOD64 7 -#define R_RISCV_TLS_DTPREL32 8 -#define R_RISCV_TLS_DTPREL64 9 -#define R_RISCV_TLS_TPREL32 10 -#define R_RISCV_TLS_TPREL64 11 - -/* The rest are not used by the dynamic linker */ -#define R_RISCV_BRANCH 16 // (A - P) & 0xffff -#define R_RISCV_JAL 17 // A & 0xff -#define R_RISCV_CALL 18 // (A - P) & 0xff -#define R_RISCV_CALL_PLT 19 -#define R_RISCV_GOT_HI20 20 -#define R_RISCV_TLS_GOT_HI20 21 -#define R_RISCV_TLS_GD_HI20 22 -#define R_RISCV_PCREL_HI20 23 -#define R_RISCV_PCREL_LO12_I 24 -#define R_RISCV_PCREL_LO12_S 25 -#define R_RISCV_HI20 26 // A & 0xffff -#define R_RISCV_LO12_I 27 // (A >> 16) & 0xffff -#define R_RISCV_LO12_S 28 // (S + A - P) >> 2 -#define R_RISCV_TPREL_HI20 29 -#define R_RISCV_TPREL_LO12_I 30 -#define R_RISCV_TPREL_LO12_S 31 -#define R_RISCV_TPREL_ADD 32 -#define R_RISCV_ADD8 33 -#define R_RISCV_ADD16 34 -#define R_RISCV_ADD32 35 -#define R_RISCV_ADD64 36 -#define R_RISCV_SUB8 37 -#define R_RISCV_SUB16 38 -#define R_RISCV_SUB32 39 -#define R_RISCV_SUB64 40 -#define R_RISCV_GNU_VTINHERIT 41 // A & 0xffff -#define R_RISCV_GNU_VTENTRY 42 -#define R_RISCV_ALIGN 43 -#define R_RISCV_RVC_BRANCH 44 -#define R_RISCV_RVC_JUMP 45 -#define R_RISCV_RVC_LUI 46 -#define R_RISCV_GPREL_I 47 -#define R_RISCV_GPREL_S 48 -#define R_RISCV_TPREL_I 49 -#define R_RISCV_TPREL_S 50 -#define R_RISCV_RELAX 51 -#define R_RISCV_SUB6 52 -#define R_RISCV_SET6 53 -#define R_RISCV_SET8 54 -#define R_RISCV_SET16 55 -#define R_RISCV_SET32 56 -#define R_RISCV_32_PCREL 57 - -/* These are aliases we can use R_TYPESZ */ -#define R_RISCV_ADDR32 R_RISCV_32 -#define R_RISCV_ADDR64 R_RISCV_64 - -#define R_TYPE(name) R_RISCV_ ## name -#if ELFSIZE == 32 -#define R_TYPESZ(name) R_RISCV_ ## name ## 32 -#else -#define R_TYPESZ(name) R_RISCV_ ## name ## 64 -#endif - -#ifdef _KERNEL -#ifdef ELFSIZE -#define ELF_MD_PROBE_FUNC ELFNAME2(cpu_netbsd,probe) -#endif - -struct exec_package; - -int cpu_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *, - vaddr_t *); - -int cpu_netbsd_elf64_probe(struct lwp *, struct exec_package *, void *, char *, - vaddr_t *); - -#endif /* _KERNEL */ - -#endif /* _RISCV_ELF_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/endian.h b/lib/libc/include/riscv64-netbsd-none/machine/endian.h deleted file mode 100644 index 856beaaacb..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: endian.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/endian_machdep.h b/lib/libc/include/riscv64-netbsd-none/machine/endian_machdep.h deleted file mode 100644 index 99f8f2065c..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/endian_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: endian_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#define _BYTE_ORDER _LITTLE_ENDIAN \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/fenv.h b/lib/libc/include/riscv64-netbsd-none/machine/fenv.h deleted file mode 100644 index f82b74150b..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/fenv.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $NetBSD: fenv.h,v 1.3 2020/03/14 16:12:16 skrll Exp $ */ - -/* - * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 - * Public domain. - */ - -#ifndef _RISCV_FENV_H_ -#define _RISCV_FENV_H_ - -typedef int fenv_t; /* FPSCR */ -typedef int fexcept_t; - -#define FE_INEXACT 0x00 /* Result inexact */ -#define FE_UNDERFLOW 0x02 /* Result underflowed */ -#define FE_OVERFLOW 0x04 /* Result overflowed */ -#define FE_DIVBYZERO 0x08 /* divide-by-zero */ -#define FE_INVALID 0x10 /* Result invalid */ - -#define FE_ALL_EXCEPT 0x1f - -#define FE_TONEAREST 0 /* round to nearest representable number */ -#define FE_TOWARDZERO 1 /* round to zero (truncate) */ -#define FE_DOWNWARD 2 /* round toward negative infinity */ -#define FE_UPWARD 3 /* round toward positive infinity */ - -__BEGIN_DECLS - -/* Default floating-point environment */ -extern const fenv_t __fe_dfl_env; -#define FE_DFL_ENV (&__fe_dfl_env) - -__END_DECLS - -#endif /* _RISCV_FENV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/float.h b/lib/libc/include/riscv64-netbsd-none/machine/float.h deleted file mode 100644 index 8344122e92..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/float.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_FLOAT_H_ -#define _RISCV_FLOAT_H_ - -#include - -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ -#define LDBL_DIG __LDBL_DIG__ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ -#define LDBL_EPSILON __LDBL_EPSILON__ -#define LDBL_MIN __LDBL_MIN__ -#define LDBL_MAX __LDBL_MAX__ - -#include - -#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \ - && !defined(_XOPEN_SOURCE)) \ - || (__STDC_VERSION__ - 0) >= 199901L \ - || (_POSIX_C_SOURCE - 0) >= 200112L \ - || ((_XOPEN_SOURCE - 0) >= 600) \ - || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) -#define DECIMAL_DIG __DECIMAL_DIG__ -#endif - -#endif /* !_RISCV_FLOAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/ieee.h b/lib/libc/include/riscv64-netbsd-none/machine/ieee.h deleted file mode 100644 index 7f66694249..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/ieee.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: ieee.h,v 1.2 2019/04/13 15:57:31 maya Exp $ */ - -#include /* for #define __HAVE_LONG_DOUBLE 128 */ -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/ieeefp.h b/lib/libc/include/riscv64-netbsd-none/machine/ieeefp.h deleted file mode 100644 index 842a0c9ead..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/ieeefp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: ieeefp.h,v 1.2 2020/03/14 16:12:16 skrll Exp $ */ - -/* - * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 - * Public domain. - */ - -#ifndef _RISCV_IEEEFP_H_ -#define _RISCV_IEEEFP_H_ - -#include - -#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) - -#include - -#if !defined(_ISOC99_SOURCE) - -/* Exception type (used by fpsetmask() et al.) */ - -typedef int fp_except; - -/* Bit defines for fp_except */ - -#define FP_X_INV FE_INVALID /* invalid operation exception */ -#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */ -#define FP_X_OFL FE_OVERFLOW /* overflow exception */ -#define FP_X_UFL FE_UNDERFLOW /* underflow exception */ -#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */ - -/* Rounding modes */ - -typedef enum { - FP_RN=FE_TONEAREST, /* round to nearest representable number */ - FP_RP=FE_UPWARD, /* round toward positive infinity */ - FP_RM=FE_DOWNWARD, /* round toward negative infinity */ - FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */ -} fp_rnd; - -#endif /* !_ISOC99_SOURCE */ - -#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */ - -#endif /* _RISCV_IEEEFP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/int_const.h b/lib/libc/include/riscv64-netbsd-none/machine/int_const.h deleted file mode 100644 index f83b16fbd1..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/int_const.h +++ /dev/null @@ -1,20 +0,0 @@ -/* $NetBSD: int_const.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#ifndef __INTMAX_C_SUFFIX__ - -#define __INT8_C_SUFFIX__ -#define __INT16_C_SUFFIX__ -#define __INT32_C_SUFFIX__ -#define __INT64_C_SUFFIX__ LL - -#define __UINT8_C_SUFFIX__ -#define __UINT16_C_SUFFIX__ -#define __UINT32_C_SUFFIX__ -#define __UINT64_C_SUFFIX__ ULL - -#define __INTMAX_C_SUFFIX__ LL -#define __UINTMAX_C_SUFFIX__ ULL - -#endif - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/int_fmtio.h b/lib/libc/include/riscv64-netbsd-none/machine/int_fmtio.h deleted file mode 100644 index 81c47b4ebc..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/int_fmtio.h +++ /dev/null @@ -1,381 +0,0 @@ -/* $NetBSD: int_fmtio.h,v 1.4 2019/04/17 11:01:19 mrg Exp $ */ - -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * 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. - */ - -#ifndef _RISCV_INT_FMTIO_H_ -#define _RISCV_INT_FMTIO_H_ - -#ifdef __INTPTR_FMTd__ -#include -#else -/* - * 7.8.1 Macros for format specifiers - */ - -/* fprintf macros for signed integers */ -#define PRId8 "hhd" /* int8_t */ -#define PRId16 "hd" /* int16_t */ -#define PRId32 "d" /* int32_t */ -#ifdef _LP64 -#define PRId64 "ld" /* int64_t */ -#else -#define PRId64 "lld" /* int64_t */ -#endif -#define PRIdLEAST8 "hhd" /* int_least8_t */ -#define PRIdLEAST16 "hd" /* int_least16_t */ -#define PRIdLEAST32 "d" /* int_least32_t */ -#ifdef _LP64 -#define PRIdLEAST64 "ld" /* int_least64_t */ -#define PRIdFAST8 "d" /* int_fast8_t */ -#define PRIdFAST16 "d" /* int_fast16_t */ -#else -#define PRIdLEAST64 "lld" /* int_least64_t */ -#define PRIdFAST8 "hhd" /* int_fast8_t */ -#define PRIdFAST16 "hd" /* int_fast16_t */ -#endif -#define PRIdFAST32 "d" /* int_fast32_t */ -#ifdef _LP64 -#define PRIdFAST64 "ld" /* int_fast64_t */ -#define PRIdMAX "ld" /* intmax_t */ -#else -#define PRIdFAST64 "lld" /* int_fast64_t */ -#define PRIdMAX "lld" /* intmax_t */ -#endif -#define PRIdPTR "ld" /* intptr_t */ - -#define PRIi8 "hhi" /* int8_t */ -#define PRIi16 "hi" /* int16_t */ -#define PRIi32 "i" /* int32_t */ -#ifdef _LP64 -#define PRIi64 "li" /* int64_t */ -#else -#define PRIi64 "lli" /* int64_t */ -#endif -#define PRIiLEAST8 "hhi" /* int_least8_t */ -#define PRIiLEAST16 "hi" /* int_least16_t */ -#define PRIiLEAST32 "i" /* int_least32_t */ -#ifdef _LP64 -#define PRIiLEAST64 "li" /* int_least64_t */ -#define PRIiFAST8 "i" /* int_fast8_t */ -#define PRIiFAST16 "i" /* int_fast16_t */ -#else -#define PRIiLEAST64 "lli" /* int_least64_t */ -#define PRIiFAST8 "hhi" /* int_fast8_t */ -#define PRIiFAST16 "hi" /* int_fast16_t */ -#endif -#define PRIiFAST32 "i" /* int_fast32_t */ -#ifdef _LP64 -#define PRIiFAST64 "li" /* int_fast64_t */ -#define PRIiMAX "li" /* intmax_t */ -#else -#define PRIiFAST64 "lli" /* int_fast64_t */ -#define PRIiMAX "lli" /* intmax_t */ -#endif -#define PRIiPTR "li" /* intptr_t */ - -/* fprintf macros for unsigned integers */ - -#define PRIo8 "hho" /* uint8_t */ -#define PRIo16 "ho" /* uint16_t */ -#define PRIo32 "o" /* uint32_t */ -#ifdef _LP64 -#define PRIo64 "lo" /* uint64_t */ -#else -#define PRIo64 "llo" /* uint64_t */ -#endif -#define PRIoLEAST8 "o" /* uint_least8_t */ -#define PRIoLEAST16 "hho" /* uint_least16_t */ -#define PRIoLEAST32 "ho" /* uint_least32_t */ -#ifdef _LP64 -#define PRIoLEAST64 "lo" /* uint_least64_t */ -#define PRIoFAST8 "o" /* uint_fast8_t */ -#define PRIoFAST16 "o" /* uint_fast16_t */ -#else -#define PRIoLEAST64 "llo" /* uint_least64_t */ -#define PRIoFAST8 "hho" /* uint_fast8_t */ -#define PRIoFAST16 "ho" /* uint_fast16_t */ -#endif -#define PRIoFAST32 "o" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIoFAST64 "lo" /* uint_fast64_t */ -#define PRIoMAX "lo" /* uintmax_t */ -#else -#define PRIoFAST64 "llo" /* uint_fast64_t */ -#define PRIoMAX "llo" /* uintmax_t */ -#endif -#define PRIoPTR "lo" /* uintptr_t */ - -#define PRIu8 "hhu" /* uint8_t */ -#define PRIu16 "hu" /* uint16_t */ -#define PRIu32 "u" /* uint32_t */ -#ifdef _LP64 -#define PRIu64 "lu" /* uint64_t */ -#else -#define PRIu64 "llu" /* uint64_t */ -#endif -#define PRIuLEAST8 "hhu" /* uint_least8_t */ -#define PRIuLEAST16 "hu" /* uint_least16_t */ -#define PRIuLEAST32 "u" /* uint_least32_t */ -#ifdef _LP64 -#define PRIuLEAST64 "lu" /* uint_least64_t */ -#define PRIuFAST8 "u" /* uint_fast8_t */ -#define PRIuFAST16 "u" /* uint_fast16_t */ -#else -#define PRIuLEAST64 "llu" /* uint_least64_t */ -#define PRIuFAST8 "hhu" /* uint_fast8_t */ -#define PRIuFAST16 "hu" /* uint_fast16_t */ -#endif -#define PRIuFAST32 "u" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIuFAST64 "lu" /* uint_fast64_t */ -#define PRIuMAX "lu" /* uintmax_t */ -#else -#define PRIuFAST64 "llu" /* uint_fast64_t */ -#define PRIuMAX "llu" /* uintmax_t */ -#endif -#define PRIuPTR "lu" /* uintptr_t */ - -#define PRIx8 "hhx" /* uint8_t */ -#define PRIx16 "hx" /* uint16_t */ -#define PRIx32 "x" /* uint32_t */ -#ifdef _LP64 -#define PRIx64 "lx" /* uint64_t */ -#else -#define PRIx64 "llx" /* uint64_t */ -#endif -#define PRIxLEAST8 "x" /* uint_least8_t */ -#define PRIxLEAST16 "x" /* uint_least16_t */ -#define PRIxLEAST32 "x" /* uint_least32_t */ -#ifdef _LP64 -#define PRIxLEAST64 "lx" /* uint_least64_t */ -#define PRIxFAST8 "x" /* uint_fast8_t */ -#define PRIxFAST16 "x" /* uint_fast16_t */ -#else -#define PRIxLEAST64 "llx" /* uint_least64_t */ -#define PRIxFAST8 "hhx" /* uint_fast8_t */ -#define PRIxFAST16 "hx" /* uint_fast16_t */ -#endif -#define PRIxFAST32 "x" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIxFAST64 "lx" /* uint_fast64_t */ -#define PRIxMAX "lx" /* uintmax_t */ -#else -#define PRIxFAST64 "llx" /* uint_fast64_t */ -#define PRIxMAX "llx" /* uintmax_t */ -#endif -#define PRIxPTR "lx" /* uintptr_t */ - -#define PRIX8 "hhX" /* uint8_t */ -#define PRIX16 "hX" /* uint16_t */ -#define PRIX32 "X" /* uint32_t */ -#ifdef _LP64 -#define PRIX64 "lX" /* uint64_t */ -#else -#define PRIX64 "llX" /* uint64_t */ -#endif -#define PRIXLEAST8 "X" /* uint_least8_t */ -#define PRIXLEAST16 "X" /* uint_least16_t */ -#define PRIXLEAST32 "X" /* uint_least32_t */ -#ifdef _LP64 -#define PRIXLEAST64 "lX" /* uint_least64_t */ -#define PRIXFAST8 "X" /* uint_fast8_t */ -#define PRIXFAST16 "X" /* uint_fast16_t */ -#else -#define PRIXLEAST64 "llX" /* uint_least64_t */ -#define PRIXFAST8 "hhX" /* uint_fast8_t */ -#define PRIXFAST16 "hX" /* uint_fast16_t */ -#endif -#define PRIXFAST32 "X" /* uint_fast32_t */ -#ifdef _LP64 -#define PRIXFAST64 "lX" /* uint_fast64_t */ -#define PRIXMAX "lX" /* uintmax_t */ -#else -#define PRIXFAST64 "llX" /* uint_fast64_t */ -#define PRIXMAX "llX" /* uintmax_t */ -#endif -#define PRIXPTR "lX" /* uintptr_t */ - -/* fscanf macros for signed integers */ - -#define SCNd8 "hhd" /* int8_t */ -#define SCNd16 "hd" /* int16_t */ -#define SCNd32 "d" /* int32_t */ -#ifdef _LP64 -#define SCNd64 "ld" /* int64_t */ -#else -#define SCNd64 "lld" /* int64_t */ -#endif -#define SCNdLEAST8 "hhd" /* int_least8_t */ -#define SCNdLEAST16 "hd" /* int_least16_t */ -#define SCNdLEAST32 "d" /* int_least32_t */ -#ifdef _LP64 -#define SCNdLEAST64 "ld" /* int_least64_t */ -#define SCNdFAST8 "d" /* int_fast8_t */ -#define SCNdFAST16 "d" /* int_fast16_t */ -#else -#define SCNdLEAST64 "lld" /* int_least64_t */ -#define SCNdFAST8 "hhd" /* int_fast8_t */ -#define SCNdFAST16 "hd" /* int_fast16_t */ -#endif -#define SCNdFAST32 "d" /* int_fast32_t */ -#ifdef _LP64 -#define SCNdFAST64 "ld" /* int_fast64_t */ -#define SCNdMAX "ld" /* intmax_t */ -#else -#define SCNdFAST64 "lld" /* int_fast64_t */ -#define SCNdMAX "lld" /* intmax_t */ -#endif -#define SCNdPTR "ld" /* intptr_t */ - -#define SCNi8 "hhi" /* int8_t */ -#define SCNi16 "hi" /* int16_t */ -#define SCNi32 "i" /* int32_t */ -#ifdef _LP64 -#define SCNi64 "li" /* int64_t */ -#else -#define SCNi64 "lli" /* int64_t */ -#endif -#define SCNiLEAST8 "hhi" /* int_least8_t */ -#define SCNiLEAST16 "hi" /* int_least16_t */ -#define SCNiLEAST32 "i" /* int_least32_t */ -#ifdef _LP64 -#define SCNiLEAST64 "li" /* int_least64_t */ -#define SCNiFAST8 "i" /* int_fast8_t */ -#define SCNiFAST16 "i" /* int_fast16_t */ -#else -#define SCNiLEAST64 "lli" /* int_least64_t */ -#define SCNiFAST8 "hhi" /* int_fast8_t */ -#define SCNiFAST16 "hi" /* int_fast16_t */ -#endif -#define SCNiFAST32 "i" /* int_fast32_t */ -#ifdef _LP64 -#define SCNiFAST64 "li" /* int_fast64_t */ -#define SCNiMAX "li" /* intmax_t */ -#else -#define SCNiFAST64 "lli" /* int_fast64_t */ -#define SCNiMAX "lli" /* intmax_t */ -#endif -#define SCNiPTR "li" /* intptr_t */ - -/* fscanf macros for unsigned integers */ - -#define SCNo8 "hho" /* uint8_t */ -#define SCNo16 "ho" /* uint16_t */ -#define SCNo32 "o" /* uint32_t */ -#ifdef _LP64 -#define SCNo64 "lo" /* uint64_t */ -#else -#define SCNo64 "llo" /* uint64_t */ -#endif -#define SCNoLEAST8 "hho" /* uint_least8_t */ -#define SCNoLEAST16 "ho" /* uint_least16_t */ -#define SCNoLEAST32 "o" /* uint_least32_t */ -#ifdef _LP64 -#define SCNoLEAST64 "lo" /* uint_least64_t */ -#define SCNoFAST8 "o" /* uint_fast8_t */ -#define SCNoFAST16 "o" /* uint_fast16_t */ -#else -#define SCNoLEAST64 "llo" /* uint_least64_t */ -#define SCNoFAST8 "hho" /* uint_fast8_t */ -#define SCNoFAST16 "ho" /* uint_fast16_t */ -#endif -#define SCNoFAST32 "o" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNoFAST64 "lo" /* uint_fast64_t */ -#define SCNoMAX "lo" /* uintmax_t */ -#else -#define SCNoFAST64 "llo" /* uint_fast64_t */ -#define SCNoMAX "llo" /* uintmax_t */ -#endif -#define SCNoPTR "lo" /* uintptr_t */ - -#define SCNu8 "hhu" /* uint8_t */ -#define SCNu16 "hu" /* uint16_t */ -#define SCNu32 "u" /* uint32_t */ -#ifdef _LP64 -#define SCNu64 "lu" /* uint64_t */ -#else -#define SCNu64 "llu" /* uint64_t */ -#endif -#define SCNuLEAST8 "hhu" /* uint_least8_t */ -#define SCNuLEAST16 "hu" /* uint_least16_t */ -#define SCNuLEAST32 "u" /* uint_least32_t */ -#ifdef _LP64 -#define SCNuLEAST64 "lu" /* uint_least64_t */ -#define SCNuFAST8 "u" /* uint_fast8_t */ -#define SCNuFAST16 "u" /* uint_fast16_t */ -#else -#define SCNuLEAST64 "llu" /* uint_least64_t */ -#define SCNuFAST8 "hhu" /* uint_fast8_t */ -#define SCNuFAST16 "hu" /* uint_fast16_t */ -#endif -#define SCNuFAST32 "u" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNuFAST64 "lu" /* uint_fast64_t */ -#define SCNuMAX "lu" /* uintmax_t */ -#else -#define SCNuFAST64 "llu" /* uint_fast64_t */ -#define SCNuMAX "llu" /* uintmax_t */ -#endif -#define SCNuPTR "lu" /* uintptr_t */ - -#define SCNx8 "hhx" /* uint8_t */ -#define SCNx16 "hx" /* uint16_t */ -#define SCNx32 "x" /* uint32_t */ -#ifdef _LP64 -#define SCNx64 "lx" /* uint64_t */ -#else -#define SCNx64 "llx" /* uint64_t */ -#endif -#define SCNxLEAST8 "hhx" /* uint_least8_t */ -#define SCNxLEAST16 "hx" /* uint_least16_t */ -#define SCNxLEAST32 "x" /* uint_least32_t */ -#ifdef _LP64 -#define SCNxLEAST64 "lx" /* uint_least64_t */ -#define SCNxFAST8 "x" /* uint_fast8_t */ -#define SCNxFAST16 "x" /* uint_fast16_t */ -#else -#define SCNxLEAST64 "llx" /* uint_least64_t */ -#define SCNxFAST8 "hhx" /* uint_fast8_t */ -#define SCNxFAST16 "hx" /* uint_fast16_t */ -#endif -#define SCNxFAST32 "x" /* uint_fast32_t */ -#ifdef _LP64 -#define SCNxFAST64 "lx" /* uint_fast64_t */ -#define SCNxMAX "lx" /* uintmax_t */ -#else -#define SCNxFAST64 "llx" /* uint_fast64_t */ -#define SCNxMAX "llx" /* uintmax_t */ -#endif -#define SCNxPTR "lx" /* uintptr_t */ - -#endif /* !__INTPTR_FMTd__ */ - -#endif /* !_RISCV_INT_FMTIO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/int_limits.h b/lib/libc/include/riscv64-netbsd-none/machine/int_limits.h deleted file mode 100644 index 34dd6a1713..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/int_limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/int_mwgwtypes.h b/lib/libc/include/riscv64-netbsd-none/machine/int_mwgwtypes.h deleted file mode 100644 index 2387962db5..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/int_mwgwtypes.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_mwgwtypes.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/int_types.h b/lib/libc/include/riscv64-netbsd-none/machine/int_types.h deleted file mode 100644 index 29dc9d0f76..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/int_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: int_types.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/kcore.h b/lib/libc/include/riscv64-netbsd-none/machine/kcore.h deleted file mode 100644 index a52b7e9f3a..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/kcore.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: kcore.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_KCORE_H_ -#define _RISCV_KCORE_H_ - -typedef struct cpu_kcore_hdr { - uint64_t kh_misc[8]; - phys_ram_seg_t kh_ramsegs[0]; -} cpu_kcore_hdr_t; - -#endif /* _RISCV_KCORE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/limits.h b/lib/libc/include/riscv64-netbsd-none/machine/limits.h deleted file mode 100644 index 8161008ba5..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/lock.h b/lib/libc/include/riscv64-netbsd-none/machine/lock.h deleted file mode 100644 index 6ae00ebbc2..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/lock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: lock.h,v 1.4 2015/06/26 14:27:35 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/math.h b/lib/libc/include/riscv64-netbsd-none/machine/math.h deleted file mode 100644 index 4988e730e9..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/math.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: math.h,v 1.3 2019/04/16 07:40:02 maya Exp $ */ - -#define __HAVE_NANF -#define __HAVE_LONG_DOUBLE 128 \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/mcontext.h b/lib/libc/include/riscv64-netbsd-none/machine/mcontext.h deleted file mode 100644 index 64729bb363..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/mcontext.h +++ /dev/null @@ -1,170 +0,0 @@ -/* $NetBSD: mcontext.h,v 1.6 2020/03/14 16:12:16 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ -#ifndef _RISCV_MCONTEXT_H_ -#define _RISCV_MCONTEXT_H_ - -/* - */ - -#define _NGREG 32 /* GR1-31 */ -#define _NFREG 33 /* F0-31, FCSR */ - -/* - * This fragment is common to and - */ -#ifndef _BSD_FPREG_T_ -union __fpreg { - __uint64_t u_u64; - double u_d; -}; -#define _BSD_FPREG_T_ union __fpreg -#endif - -typedef __uint64_t __greg_t; -typedef __greg_t __gregset_t[_NGREG]; -typedef __uint32_t __greg32_t; -typedef __greg32_t __gregset32_t[_NGREG]; -typedef _BSD_FPREG_T_ __fregset_t[_NFREG]; - -#define _REG_X1 0 -#define _REG_X2 1 -#define _REG_X3 2 -#define _REG_X4 3 -#define _REG_X5 4 -#define _REG_X6 5 -#define _REG_X7 6 -#define _REG_X8 7 -#define _REG_X9 8 -#define _REG_X10 9 -#define _REG_X11 10 -#define _REG_X12 11 -#define _REG_X13 12 -#define _REG_X14 13 -#define _REG_X15 14 -#define _REG_X16 15 -#define _REG_X17 16 -#define _REG_X18 17 -#define _REG_X19 18 -#define _REG_X20 19 -#define _REG_X21 20 -#define _REG_X22 21 -#define _REG_X23 22 -#define _REG_X24 23 -#define _REG_X25 24 -#define _REG_X26 25 -#define _REG_X27 26 -#define _REG_X28 27 -#define _REG_X29 28 -#define _REG_X30 29 -#define _REG_X31 30 -#define _REG_PC 31 - -#define _REG_RA _REG_X1 -#define _REG_SP _REG_X2 -#define _REG_GP _REG_X3 -#define _REG_TP _REG_X4 -#define _REG_S0 _REG_X8 -#define _REG_RV _REG_X10 -#define _REG_A0 _REG_X10 - -#define _REG_F0 0 -#define _REG_FPCSR 32 - -typedef struct { - __gregset_t __gregs; /* General Purpose Register set */ - __fregset_t __fregs; /* Floating Point Register set */ - __greg_t __private; /* copy of l_private */ - __greg_t __spare[8]; /* future proof */ -} mcontext_t; - -typedef struct { - __gregset32_t __gregs; /* General Purpose Register set */ - __fregset_t __fregs; /* Floating Point Register set */ - __greg32_t __private; /* copy of l_private */ - __greg32_t __spare[8]; /* future proof */ -} mcontext32_t; - -/* Machine-dependent uc_flags */ -#define _UC_SETSTACK 0x00010000 /* see */ -#define _UC_CLRSTACK 0x00020000 /* see */ -#define _UC_TLSBASE 0x00080000 /* see */ - -#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP]) -#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_S0]) -#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC]) -#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RV]) - -#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc) - -#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || defined(__LIBPTHREAD_SOURCE__) -#include - -/* - * On RISCV, since displacements are signed 12-bit values, the TCB pointer is - * not and points to the first static entry. - */ -#define TLS_TP_OFFSET 0x0 -#define TLS_DTV_OFFSET 0x800 -__CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb) < 0x800); - -static __inline void * -__lwp_getprivate_fast(void) -{ - void *__tp; - __asm("move %0,tp" : "=r"(__tp)); - return __tp; -} - -static __inline void * -__lwp_gettcb_fast(void) -{ - void *__tcb; - - __asm __volatile( - "addi %[__tcb],tp,%[__offset]" - : [__tcb] "=r" (__tcb) - : [__offset] "n" (-(TLS_TP_OFFSET + sizeof(struct tls_tcb)))); - - return __tcb; -} - -static __inline void -__lwp_settcb(void *__tcb) -{ - __asm __volatile( - "addi tp,%[__tcb],%[__offset]" - : - : [__tcb] "r" (__tcb), - [__offset] "n" (TLS_TP_OFFSET + sizeof(struct tls_tcb))); -} -#endif /* _RTLD_SOURCE || _LIBC_SOURCE || __LIBPTHREAD_SOURCE__ */ - -#endif /* !_RISCV_MCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/mutex.h b/lib/libc/include/riscv64-netbsd-none/machine/mutex.h deleted file mode 100644 index d89733fa70..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/mutex.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $NetBSD: mutex.h,v 1.4.4.1 2023/08/09 17:42:03 martin Exp $ */ - -/*- - * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe and Andrew Doran. - * - * 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. - */ - -#ifndef _RISCV_MUTEX_H_ -#define _RISCV_MUTEX_H_ - -#include - -#ifndef __MUTEX_PRIVATE - -struct kmutex { - uintptr_t mtx_pad1; -}; - -#else /* __MUTEX_PRIVATE */ - -#include - -#include - -#include - -struct kmutex { - volatile uintptr_t mtx_owner; -}; - -#ifdef _LP64 -#define MTX_ASMOP_SFX ".d" // doubleword atomic op -#else -#define MTX_ASMOP_SFX ".w" // word atomic op -#endif - -#define MTX_LOCK __BIT(8) // just one bit -#define MTX_IPL __BITS(7,4) // only need 4 bits - -#undef MUTEX_SPIN_IPL // override -#define MUTEX_SPIN_IPL(a) riscv_mutex_spin_ipl(a) -#define MUTEX_INITIALIZE_SPIN_IPL(a,b) riscv_mutex_initialize_spin_ipl(a,b) -#define MUTEX_SPINBIT_LOCK_INIT(a) riscv_mutex_spinbit_lock_init(a) -#define MUTEX_SPINBIT_LOCK_TRY(a) riscv_mutex_spinbit_lock_try(a) -#define MUTEX_SPINBIT_LOCKED_P(a) riscv_mutex_spinbit_locked_p(a) -#define MUTEX_SPINBIT_LOCK_UNLOCK(a) riscv_mutex_spinbit_lock_unlock(a) - -static inline ipl_cookie_t -riscv_mutex_spin_ipl(kmutex_t *__mtx) -{ - return (ipl_cookie_t){._spl = __SHIFTOUT(__mtx->mtx_owner, MTX_IPL)}; -} - -static inline void -riscv_mutex_initialize_spin_ipl(kmutex_t *__mtx, int ipl) -{ - __mtx->mtx_owner = (__mtx->mtx_owner & ~MTX_IPL) - | __SHIFTIN(ipl, MTX_IPL); -} - -static inline void -riscv_mutex_spinbit_lock_init(kmutex_t *__mtx) -{ - __mtx->mtx_owner &= ~MTX_LOCK; -} - -static inline bool -riscv_mutex_spinbit_locked_p(const kmutex_t *__mtx) -{ - return (__mtx->mtx_owner & MTX_LOCK) != 0; -} - -static inline bool -riscv_mutex_spinbit_lock_try(kmutex_t *__mtx) -{ - uintptr_t __old; - __asm __volatile( - "amoor" MTX_ASMOP_SFX ".aq\t%0, %1, (%2)" - : "=r"(__old) - : "r"(MTX_LOCK), "r"(__mtx)); - return (__old & MTX_LOCK) == 0; -} - -static inline void -riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx) -{ - __asm __volatile( - "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)" - :: "r"(~MTX_LOCK), "r"(__mtx)); -} - -#if 0 -#define __HAVE_MUTEX_STUBS 1 -#define __HAVE_SPIN_MUTEX_STUBS 1 -#endif -#define __HAVE_SIMPLE_MUTEXES 1 - -#endif /* __MUTEX_PRIVATE */ - -#endif /* _RISCV_MUTEX_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/param.h b/lib/libc/include/riscv64-netbsd-none/machine/param.h deleted file mode 100644 index 7f465d7f09..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/param.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $NetBSD: param.h,v 1.7 2022/10/12 07:50:00 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PARAM_H_ -#define _RISCV_PARAM_H_ - -#ifdef _KERNEL_OPT -#include "opt_param.h" -#endif - -/* - * Machine dependent constants for all OpenRISC processors - */ - -/* - * For KERNEL code: - * MACHINE must be defined by the individual port. This is so that - * uname returns the correct thing, etc. - * - * For non-KERNEL code: - * If ELF, MACHINE and MACHINE_ARCH are forced to "or1k/or1k". - */ - -#ifdef _LP64 -#define _MACHINE_ARCH riscv64 -#define MACHINE_ARCH "riscv64" -#define _MACHINE_ARCH32 riscv32 -#define MACHINE_ARCH32 "riscv32" -#else -#define _MACHINE_ARCH riscv32 -#define MACHINE_ARCH "riscv32" -#endif -#define _MACHINE riscv -#define MACHINE "riscv" - -#define MID_MACHINE MID_RISCV - -/* RISCV-specific macro to align a stack pointer (downwards). */ -#define STACK_ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1) -#define ALIGNBYTES32 __BIGGEST_ALIGNMENT__ - -#define NKMEMPAGES_MIN_DEFAULT ((128UL * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_UNLIMITED 1 - -#define PGSHIFT 12 -#define NBPG (1 << PGSHIFT) -#define PGOFSET (NBPG - 1) - -#define UPAGES 2 -#define USPACE (UPAGES << PGSHIFT) -#define USPACE_ALIGN NBPG - -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than NBPG (the software page size), and - * NBPG % MCLBYTES must be zero. - */ -#define MSIZE 512 /* size of an mbuf */ - -#ifndef MCLSHIFT -#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ - /* 2K cluster can hold Ether frame */ -#endif /* MCLSHIFT */ - -#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ - -#ifndef MSGBUFSIZE -#define MSGBUFSIZE 65536 /* default message buffer size */ -#endif - -#define MAXCPUS 32 - -#ifdef _KERNEL -void delay(unsigned long); -#define DELAY(x) delay(x) -#endif - -#endif /* _RISCV_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/pcb.h b/lib/libc/include/riscv64-netbsd-none/machine/pcb.h deleted file mode 100644 index 0c99e1f84b..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/pcb.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: pcb.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PCB_H_ -#define _RISCV_PCB_H_ - -#include - -struct pcb { - struct fpreg pcb_fpregs; -}; - -struct md_coredump { - struct reg reg; - struct fpreg fpreg; -}; - -#endif /* _RISCV_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/pmap.h b/lib/libc/include/riscv64-netbsd-none/machine/pmap.h deleted file mode 100644 index 3e5fc1c95e..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/pmap.h +++ /dev/null @@ -1,213 +0,0 @@ -/* $NetBSD: pmap.h,v 1.13 2022/10/20 07:18:11 skrll Exp $ */ - -/* - * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas (of 3am Software Foundry), Maxime Villard, and - * Nick Hudson. - * - * 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. - */ - -#ifndef _RISCV_PMAP_H_ -#define _RISCV_PMAP_H_ - -#ifdef _KERNEL_OPT -#include "opt_modular.h" -#endif - -#if !defined(_MODULE) - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define PMAP_SEGTABSIZE NPTEPG -#define PMAP_PDETABSIZE NPTEPG - -#ifdef _LP64 -#define PTPSHIFT 3 -/* This is SV48. */ -//#define SEGLENGTH + SEGSHIFT + SEGSHIFT */ - -/* This is SV39. */ -#define XSEGSHIFT (SEGSHIFT + SEGLENGTH) -#define NBXSEG (1ULL << XSEGSHIFT) -#define XSEGOFSET (NBXSEG - 1) /* byte offset into xsegment */ -#define XSEGLENGTH (PGSHIFT - 3) -#define NXSEGPG (1 << XSEGLENGTH) -#else -#define PTPSHIFT 2 -#define XSEGSHIFT SEGSHIFT -#endif - -#define SEGLENGTH (PGSHIFT - PTPSHIFT) -#define SEGSHIFT (SEGLENGTH + PGSHIFT) -#define NBSEG (1 << SEGSHIFT) /* bytes/segment */ -#define SEGOFSET (NBSEG - 1) /* byte offset into segment */ - -#define KERNEL_PID 0 - -#define PMAP_HWPAGEWALKER 1 -#define PMAP_TLB_MAX 1 -#ifdef _LP64 -#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE)) -#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE)) -#else -#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)0xdeadbeef) -#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)0xdeadbeef) -#endif -#define PMAP_TLB_NUM_PIDS (__SHIFTOUT_MASK(SATP_ASID) + 1) -#define PMAP_TLB_BITMAP_LENGTH PMAP_TLB_NUM_PIDS -#define PMAP_TLB_FLUSH_ASID_ON_RESET false - -#define pmap_phys_address(x) (x) - -#ifndef __BSD_PTENTRY_T__ -#define __BSD_PTENTRY_T__ -#ifdef _LP64 -#define PRIxPTE PRIx64 -#else -#define PRIxPTE PRIx32 -#endif -#endif /* __BSD_PTENTRY_T__ */ - -#define PMAP_NEED_PROCWR -static inline void -pmap_procwr(struct proc *p, vaddr_t va, vsize_t len) -{ - __asm __volatile("fence\trw,rw; fence.i" ::: "memory"); -} - -#include -#include - -#define PMAP_GROWKERNEL -#define PMAP_STEAL_MEMORY - -#ifdef _KERNEL - -#define __HAVE_PMAP_MD -struct pmap_md { - paddr_t md_ppn; - pd_entry_t *md_pdetab; -}; - -struct vm_page * - pmap_md_alloc_poolpage(int flags); -vaddr_t pmap_md_map_poolpage(paddr_t, vsize_t); -void pmap_md_unmap_poolpage(vaddr_t, vsize_t); -bool pmap_md_direct_mapped_vaddr_p(vaddr_t); -bool pmap_md_io_vaddr_p(vaddr_t); -paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t); -vaddr_t pmap_md_direct_map_paddr(paddr_t); -void pmap_md_init(void); - -void pmap_md_xtab_activate(struct pmap *, struct lwp *); -void pmap_md_xtab_deactivate(struct pmap *); -void pmap_md_pdetab_init(struct pmap *); -bool pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t); - -void pmap_bootstrap(vaddr_t kstart, vaddr_t kend); - -extern vaddr_t pmap_direct_base; -extern vaddr_t pmap_direct_end; -#define PMAP_DIRECT_MAP(pa) (pmap_direct_base + (pa)) -#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base) - -#define MEGAPAGE_TRUNC(x) ((x) & ~SEGOFSET) -#define MEGAPAGE_ROUND(x) MEGAPAGE_TRUNC((x) + SEGOFSET) - -#ifdef __PMAP_PRIVATE - -static inline bool -pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte) -{ - // TLB not walked and so not called. - return false; -} - -static inline void -pmap_md_page_syncicache(struct vm_page_md *mdpg, const kcpuset_t *kc) -{ - __asm __volatile("fence\trw,rw; fence.i" ::: "memory"); -} - -/* - * Virtual Cache Alias helper routines. Not a problem for RISCV CPUs. - */ -static inline bool -pmap_md_vca_add(struct vm_page_md *mdpg, vaddr_t va, pt_entry_t *nptep) -{ - return false; -} - -static inline void -pmap_md_vca_remove(struct vm_page_md *mdpg, vaddr_t va) -{ -} - -static inline void -pmap_md_vca_clean(struct vm_page_md *mdpg, vaddr_t va, int op) -{ -} - -static inline size_t -pmap_md_tlb_asid_max(void) -{ - return PMAP_TLB_NUM_PIDS - 1; -} - -#endif /* __PMAP_PRIVATE */ -#endif /* _KERNEL */ - -#include - -#endif /* !_MODULE */ - -#if defined(MODULAR) || defined(_MODULE) -/* - * Define a compatible vm_page_md so that struct vm_page is the same size - * whether we are using modules or not. - */ -#ifndef __HAVE_VM_PAGE_MD -#define __HAVE_VM_PAGE_MD - -struct vm_page_md { - uintptr_t mdpg_dummy[3]; -}; -__CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*3); - -#endif /* !__HAVE_VM_PAGE_MD */ - -#endif /* MODULAR || _MODULE */ - -#endif /* !_RISCV_PMAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/proc.h b/lib/libc/include/riscv64-netbsd-none/machine/proc.h deleted file mode 100644 index 480bde9e69..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/proc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $NetBSD: proc.h,v 1.3 2015/03/31 06:47:47 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PROC_H_ -#define _RISCV_PROC_H_ - -#include -#include - -struct lwp; - -/* - * Machine-dependent part of the lwp structure for RISCV - */ -struct trapframe; - -struct mdlwp { - struct trapframe *md_utf; /* trapframe from userspace */ - struct trapframe *md_ktf; /* trapframe from userspace */ - struct faultbuf *md_onfault; /* registers to store on fault */ - register_t md_usp; /* for locore.S */ - vaddr_t md_ss_addr; /* single step address for ptrace */ - int md_ss_instr; /* single step instruction for ptrace */ - volatile int md_astpending; /* AST pending on return to userland */ -#if 0 -#if USPACE > PAGE_SIZE - int md_upte[USPACE/4096]; /* ptes for mapping u page */ -#else - int md_dpte[USPACE/4096]; /* dummy ptes to keep the same */ -#endif -#endif -}; - -struct mdproc { - /* syscall entry for this process */ - void (*md_syscall)(struct trapframe *); -}; - -#ifdef _KERNEL -#define LWP0_CPU_INFO &cpu_info_store /* staticly set in lwp0 */ -#endif /* _KERNEL */ - -#endif /* _RISCV_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/profile.h b/lib/libc/include/riscv64-netbsd-none/machine/profile.h deleted file mode 100644 index bd0bc48516..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/profile.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $NetBSD: profile.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PROFILE_H_ -#define _RISCV_PROFILE_H_ - -#define _MCOUNT_DECL void _mcount - -/* - * Cannot implement mcount in C as GCC will trash the ip register when it - * pushes a trapframe. Pity we cannot insert assembly before the function - * prologue. - */ - -#define MCOUNT_ASM_NAME "__mcount" -#define PLTSYM - -#if 0 -#define MCOUNT \ - __asm(".text"); \ - __asm(".align 0"); \ - __asm(".type " MCOUNT_ASM_NAME ",@function"); \ - __asm(".global " MCOUNT_ASM_NAME); \ - __asm(MCOUNT_ASM_NAME ":"); \ - /* \ - * Preserve registers that are trashed during mcount \ - */ \ - __asm("sub sp, sp, #80"); \ - __asm("stp x29, x30, [sp, #64]"); \ - __asm("add x29, sp, #64"); \ - __asm("stp x0, x1, [x29, #0]"); \ - __asm("stp x2, x3, [x29, #16]"); \ - __asm("stp x4, x5, [x29, #32]"); \ - __asm("stp x6, x7, [x29, #48]"); \ - /* \ - * find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * frompcindex = pc pushed by call into self. \ - */ \ - __asm("mov x0, x19"); \ - /* \ - * selfpc = pc pushed by mcount call \ - */ \ - __asm("mov x1, x30"); \ - /* \ - * Call the real mcount code \ - */ \ - __asm("bl " ___STRING(_C_LABEL(_mcount))); \ - /* \ - * Restore registers that were trashed during mcount \ - */ \ - __asm("ldp x0, x1, [x29, #0]"); \ - __asm("ldp x2, x3, [x29, #16]"); \ - __asm("ldp x4, x5, [x29, #32]"); \ - __asm("ldp x6, x7, [x29, #48]"); \ - __asm("ldp x29, x30, [x29, #64]"); \ - __asm("add sp, sp, #80"); \ - __asm("ret"); \ - __asm(".size " MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME); -#endif - -#endif /* _RISCV_PROFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/ptrace.h b/lib/libc/include/riscv64-netbsd-none/machine/ptrace.h deleted file mode 100644 index 8c240294f2..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/ptrace.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: ptrace.h,v 1.3 2019/06/18 21:18:12 kamil Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_PTRACE_H_ -#define _RISCV_PTRACE_H_ - -/* - * RISCV-dependent ptrace definitions. - * Note that PT_STEP is _not_ supported. - */ -#define PT_GETREGS (PT_FIRSTMACH + 0) -#define PT_SETREGS (PT_FIRSTMACH + 1) -#define PT_GETFPREGS (PT_FIRSTMACH + 2) -#define PT_SETFPREGS (PT_FIRSTMACH + 3) - -#define PT_MACHDEP_STRINGS \ - "PT_GETREGS", \ - "PT_SETREGS", \ - "PT_GETFPREGS", \ - "PT_SETFPREGS" - -#include -#define PTRACE_REG_PC(r) (r)->r_pc -#define PTRACE_REG_FP(r) (r)->r_reg[7] -#define PTRACE_REG_SET_PC(r, v) (r)->r_pc = (v) -#define PTRACE_REG_SP(r) (r)->r_reg[1] -#define PTRACE_REG_INTRV(r) (r)->r_reg[9] - -#endif /* _RISCV_PTRACE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/reg.h b/lib/libc/include/riscv64-netbsd-none/machine/reg.h deleted file mode 100644 index 5428f3df0f..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/reg.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $NetBSD: reg.h,v 1.10 2022/12/13 22:25:08 skrll Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_REG_H_ -#define _RISCV_REG_H_ - -// x0 = 0 -// x1 = ra (return address) Caller -// x2 = sp (stack pointer) Callee -// x3 = gp (global pointer) -// x4 = tp (thread pointer) -// x5 - x7 = t0 - t2 (temporary) Caller -// x8 = s0/fp (saved register / frame pointer) Callee -// x9 = s1 (saved register) Callee -// x10 - x11 = a0 - a1 (arguments/return values) Caller -// x12 - x17 = a2 - a7 (arguments) Caller -// x18 - x27 = s2 - s11 (saved registers) Callee -// x28 - x31 = t3 - t6 (temporaries) Caller - -struct reg { // synced with register_t in -#ifdef _LP64 - __uint64_t r_reg[31]; /* x0 is always 0 */ - __uint64_t r_pc; -#else - __uint32_t r_reg[31]; /* x0 is always 0 */ - __uint32_t r_pc; -#endif -}; - -#ifdef _LP64 -struct reg32 { // synced with register_t in - __uint32_t r_reg[31]; /* x0 is always 0 */ - __uint32_t r_pc; -}; -#endif - -#define _XREG(n) ((n) - 1) -#define _X_RA _XREG(1) -#define _X_SP _XREG(2) -#define _X_GP _XREG(3) -#define _X_TP _XREG(4) -#define _X_T0 _XREG(5) -#define _X_T1 _XREG(6) -#define _X_T2 _XREG(7) -#define _X_S0 _XREG(8) -#define _X_S1 _XREG(9) -#define _X_A0 _XREG(10) -#define _X_A1 _XREG(11) -#define _X_A2 _XREG(12) -#define _X_A3 _XREG(13) -#define _X_A4 _XREG(14) -#define _X_A5 _XREG(15) -#define _X_A6 _XREG(16) -#define _X_A7 _XREG(17) -#define _X_S2 _XREG(18) -#define _X_S3 _XREG(19) -#define _X_S4 _XREG(20) -#define _X_S5 _XREG(21) -#define _X_S6 _XREG(22) -#define _X_S7 _XREG(23) -#define _X_S8 _XREG(24) -#define _X_S9 _XREG(25) -#define _X_S10 _XREG(26) -#define _X_S11 _XREG(27) -#define _X_T3 _XREG(28) -#define _X_T4 _XREG(29) -#define _X_T5 _XREG(30) -#define _X_T6 _XREG(31) - -// f0 - f7 = ft0 - ft7 (FP temporaries) Caller -// following layout is similar to integer registers above -// f8 - f9 = fs0 - fs1 (FP saved registers) Callee -// f10 - f11 = fa0 - fa1 (FP arguments/return values) Caller -// f12 - f17 = fa2 - fa7 (FP arguments) Caller -// f18 - f27 = fs2 - fa11 (FP saved registers) Callee -// f28 - f31 = ft8 - ft11 (FP temporaries) Caller - -/* - * This fragment is common to and - */ -#ifndef _BSD_FPREG_T_ -union __fpreg { - __uint64_t u_u64; - double u_d; -}; -#define _BSD_FPREG_T_ union __fpreg -#endif - -/* - * 32 double precision floating point, 1 CSR - */ -struct fpreg { - _BSD_FPREG_T_ r_fpreg[33]; -}; -#define r_fcsr r_fpreg[32].u_u64 - -#endif /* _RISCV_REG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/rwlock.h b/lib/libc/include/riscv64-netbsd-none/machine/rwlock.h deleted file mode 100644 index 43e43a204c..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/rwlock.h +++ /dev/null @@ -1 +0,0 @@ -/* $NetBSD: rwlock.h,v 1.2 2019/11/29 20:04:53 riastradh Exp $ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/setjmp.h b/lib/libc/include/riscv64-netbsd-none/machine/setjmp.h deleted file mode 100644 index a675abd0ac..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/setjmp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: setjmp.h,v 1.2 2015/03/27 06:57:21 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - - /* magic + 16 reg + 1 fcsr + 12 fp + 4 sigmask + 8 spare */ -#define _JBLEN (_JB_SIGMASK + 4 + 8) -#define _JB_MAGIC 0 -#define _JB_RA 1 -#define _JB_SP 2 -#define _JB_GP 3 -#define _JB_TP 4 -#define _JB_S0 5 -#define _JB_S1 6 -#define _JB_S2 7 -#define _JB_S3 8 -#define _JB_S4 9 -#define _JB_S5 10 -#define _JB_S6 11 -#define _JB_S7 12 -#define _JB_S8 13 -#define _JB_S9 14 -#define _JB_S10 15 -#define _JB_S11 16 -#define _JB_FCSR 17 - -#define _JB_FS0 18 -#define _JB_FS1 (_JB_FS0 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS2 (_JB_FS1 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS3 (_JB_FS2 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS4 (_JB_FS3 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS5 (_JB_FS4 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS6 (_JB_FS5 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS7 (_JB_FS6 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS8 (_JB_FS7 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS9 (_JB_FS8 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS10 (_JB_FS9 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) -#define _JB_FS11 (_JB_FS10 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) - -#define _JB_SIGMASK (_JB_FS11 + sizeof(double) / sizeof(_BSD_JBSLOT_T_)) - -#ifndef _BSD_JBSLOT_T_ -#define _BSD_JBSLOT_T_ long long -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/signal.h b/lib/libc/include/riscv64-netbsd-none/machine/signal.h deleted file mode 100644 index 5fbfc5b9af..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/signal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $NetBSD: signal.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_SIGNAL_H_ -#define _RISCV_SIGNAL_H_ - -#ifndef _LOCORE -typedef __SIG_ATOMIC_TYPE__ sig_atomic_t; -#endif - -#endif /* _RISCV_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/types.h b/lib/libc/include/riscv64-netbsd-none/machine/types.h deleted file mode 100644 index 00998f8744..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/types.h +++ /dev/null @@ -1,116 +0,0 @@ -/* $NetBSD: types.h,v 1.15 2022/11/08 13:34:17 simonb Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * 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. - */ - -#ifndef _RISCV_TYPES_H_ -#define _RISCV_TYPES_H_ - -#include -#include -#include - -#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE) - -/* XLEN is the native base integer ISA width */ -#define XLEN (sizeof(long) * NBBY) - -typedef __uint64_t paddr_t; -typedef __uint64_t psize_t; -#define PRIxPADDR PRIx64 -#define PRIxPSIZE PRIx64 -#define PRIuPSIZE PRIu64 - -typedef __UINTPTR_TYPE__ vaddr_t; -typedef __UINTPTR_TYPE__ vsize_t; -#define PRIxVADDR PRIxPTR -#define PRIxVSIZE PRIxPTR -#define PRIuVSIZE PRIuPTR - -#ifdef _LP64 // match -#define PRIxREGISTER PRIx64 -typedef __int64_t register_t; -typedef __uint64_t uregister_t; -#else -#define PRIxREGISTER PRIx32 -typedef __int32_t register_t; -typedef __uint32_t uregister_t; -#endif -typedef signed int register32_t; -typedef unsigned int uregister32_t; -#define PRIxREGISTER32 "x" - -typedef unsigned int tlb_asid_t; -#endif - -#if defined(_KERNEL) -typedef struct label_t { /* Used by setjmp & longjmp */ - register_t lb_reg[16]; /* */ - __uint32_t lb_sr; -} label_t; -#endif - -typedef unsigned int __cpu_simple_lock_nv_t; -#ifdef _LP64 -typedef __int64_t __register_t; -#else -typedef __int32_t __register_t; -#endif - -#define __SIMPLELOCK_LOCKED 1 -#define __SIMPLELOCK_UNLOCKED 0 - -#define __HAVE_COMMON___TLS_GET_ADDR -#define __HAVE_COMPAT_NETBSD32 -#define __HAVE_CPU_COUNTER -#define __HAVE_CPU_DATA_FIRST -#define __HAVE_FAST_SOFTINTS -#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS -#define __HAVE_NEW_STYLE_BUS_H -#define __HAVE_SYSCALL_INTERN -#define __HAVE_TLS_VARIANT_I -/* XXX temporary */ -#define __HAVE_UNLOCKED_PMAP -#define __HAVE___LWP_GETPRIVATE_FAST - -#ifdef __LP64 -#define __HAVE_ATOMIC64_OPS -#define __HAVE_CPU_UAREA_ROUTINES -#endif - -//#if defined(_KERNEL) -//#define __HAVE_RAS -//#endif - -#if defined(_KERNEL) || defined(_KMEMUSER) -#define PCU_FPU 0 -#define PCU_UNIT_COUNT 1 -#endif - -#endif /* _RISCV_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/vmparam.h b/lib/libc/include/riscv64-netbsd-none/machine/vmparam.h deleted file mode 100644 index 7ad87f53dd..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/vmparam.h +++ /dev/null @@ -1,203 +0,0 @@ -/* $NetBSD: vmparam.h,v 1.13 2022/10/16 06:14:53 skrll Exp $ */ - -/*- - * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry, and Nick Hudson. - * - * 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. - */ - -#ifndef _RISCV_VMPARAM_H_ -#define _RISCV_VMPARAM_H_ - -#include - -#ifdef _KERNEL_OPT -#include "opt_multiprocessor.h" -#endif - -/* - * Machine dependent VM constants for RISCV. - */ - -/* - * We use a 4K page on both RV64 and RV32 systems. - * Override PAGE_* definitions to compile-time constants. - */ -#define PAGE_SHIFT PGSHIFT -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) - -/* - * USRSTACK is the top (end) of the user stack. - * - * USRSTACK needs to start a page below the maxuser address so that a memory - * access with a maximum displacement (0x7ff) won't cross into the kernel's - * address space. We use PAGE_SIZE instead of 0x800 since these need to be - * page-aligned. - */ -#define USRSTACK (VM_MAXUSER_ADDRESS-PAGE_SIZE) /* Start of user stack */ -#define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS32-PAGE_SIZE) - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (128*1024*1024) /* max text size */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (256*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (1536*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (4*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (120*1024*1024) /* max stack size */ -#endif - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef DFLDSIZ32 -#define DFLDSIZ32 DFLDSIZ /* initial data size limit */ -#endif -#ifndef MAXDSIZ32 -#define MAXDSIZ32 MAXDSIZ /* max data size */ -#endif -#ifndef DFLSSIZ32 -#define DFLSSIZ32 DFLTSIZ /* initial stack size limit */ -#endif -#ifndef MAXSSIZ32 -#define MAXSSIZ32 MAXSSIZ /* max stack size */ -#endif - -/* - * PTEs for mapping user space into the kernel for phyio operations. - * The default PTE number is enough to cover 8 disks * MAXBSIZE. - */ -#ifndef USRIOSIZE -#define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8) -#endif - -/* - * User/kernel map constants. - */ -#define VM_MIN_ADDRESS ((vaddr_t)0x00000000) -#ifdef _LP64 /* Sv39 / Sv48 / Sv57 */ -/* - * kernel virtual space layout: - * 0xffff_ffc0_0000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss) - * (0xffff_ffc0_4000_0000 +1GiB) KERNEL VM start of KVA - * (0xffff_ffd0_0000_0000 64GiB) reserved - * 0xffff_ffe0_0000_0000 - 128GiB direct mapping - */ -#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000004000000000 - 16 * PAGE_SIZE) -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffc000000000) -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000) - -#else /* Sv32 */ -#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */ -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */ -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xffffffffc0000000 */ - -#endif -#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS -#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */ -#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE) -#define VM_KERNEL_DTB_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */ -#define VM_KERNEL_IO_BASE (VM_KERNEL_DTB_BASE + VM_KERNEL_DTB_SIZE) -#define VM_KERNEL_IO_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */ - -#define VM_KERNEL_RESERVED (VM_KERNEL_SIZE + VM_KERNEL_DTB_SIZE + VM_KERNEL_IO_SIZE) - -#define VM_KERNEL_VM_BASE (VM_MIN_KERNEL_ADDRESS + VM_KERNEL_RESERVED) -#define VM_KERNEL_VM_SIZE (VM_MAX_KERNEL_ADDRESS - VM_KERNEL_VM_BASE) - -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MAXUSER_ADDRESS32 ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */ - -#ifdef _LP64 -/* - * Since we have the address space, we map all of physical memory (RAM) - * using gigapages on SV39, terapages on SV48 and petapages on SV57. - */ -#define RISCV_DIRECTMAP_MASK ((vaddr_t) 0xffffffe000000000L) -#define RISCV_DIRECTMAP_SIZE (-RISCV_DIRECTMAP_MASK - PAGE_SIZE) /* 128GiB */ -#define RISCV_DIRECTMAP_START RISCV_DIRECTMAP_MASK -#define RISCV_DIRECTMAP_END (RISCV_DIRECTMAP_START + RISCV_DIRECTMAP_SIZE) -#define RISCV_KVA_P(va) (((vaddr_t) (va) & RISCV_DIRECTMAP_MASK) != 0) -#define RISCV_PA_TO_KVA(pa) ((vaddr_t) ((pa) | RISCV_DIRECTMAP_START)) -#define RISCV_KVA_TO_PA(va) ((paddr_t) ((va) & ~RISCV_DIRECTMAP_MASK)) -#endif - -/* - * The address to which unspecified mapping requests default - */ -#define __USE_TOPDOWN_VM - -#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \ - trunc_page(USRSTACK - MAXSSIZ - (sz) - user_stack_guard_size) -#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \ - round_page((vaddr_t)(da) + (vsize_t)maxdmap) - -#define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \ - trunc_page(USRSTACK32 - MAXSSIZ32 - (sz) - user_stack_guard_size) -#define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \ - round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32) - -/* virtual sizes (bytes) for various kernel submaps */ -#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) - -/* VM_PHYSSEG_MAX defined by platform-dependent code. */ -#ifndef VM_PHYSSEG_MAX -#define VM_PHYSSEG_MAX 16 -#endif -#if VM_PHYSSEG_MAX == 1 -#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST -#else -#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH -#endif -#define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */ - -#ifndef VM_NFREELIST -#define VM_NFREELIST 2 /* 2 distinct memory segments */ -#define VM_FREELIST_DEFAULT 0 -#define VM_FREELIST_DIRECTMAP 1 -#endif - -#ifdef _KERNEL -#define UVM_KM_VMFREELIST riscv_poolpage_vmfreelist -extern int riscv_poolpage_vmfreelist; - -#ifdef _LP64 -void * cpu_uarea_alloc(bool); -bool cpu_uarea_free(void *); -#endif -#endif - -#endif /* ! _RISCV_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-netbsd-none/machine/wchar_limits.h b/lib/libc/include/riscv64-netbsd-none/machine/wchar_limits.h deleted file mode 100644 index 195aa2a8ea..0000000000 --- a/lib/libc/include/riscv64-netbsd-none/machine/wchar_limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: wchar_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ - -#include \ No newline at end of file diff --git a/lib/std/c.zig b/lib/std/c.zig index 69b4b443f1..25d45ae8a6 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -8005,8 +8005,9 @@ pub const pthread_rwlock_t = switch (native_os) { .netbsd => extern struct { magic: c_uint = 0x99990009, interlock: switch (builtin.cpu.arch) { - .aarch64, .sparc, .x86_64, .x86 => u8, - .arm, .powerpc => c_int, + .aarch64, .aarch64_be, .m68k, .sparc, .sparc64, .x86, .x86_64 => u8, + .arm, .armeb, .powerpc => c_int, + .mips, .mipsel, .mips64, .mips64el => c_uint, else => unreachable, } = 0, rblocked_first: ?*u8 = null, @@ -10385,12 +10386,20 @@ pub const sigaction = switch (native_os) { /// Zig's version of SIGRTMIN. Actually a function. pub fn sigrtmin() u8 { - return @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))); + return switch (native_os) { + .freebsd => 65, + .netbsd => 33, + else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), + }; } /// Zig's version of SIGRTMAX. Actually a function. pub fn sigrtmax() u8 { - return @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))); + return switch (native_os) { + .freebsd => 126, + .netbsd => 63, + else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))), + }; } pub const sigfillset = switch (native_os) { @@ -11255,7 +11264,7 @@ const private = struct { extern "c" fn __msync13(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int; extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int; extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; - extern "c" fn __sigfillset14(set: ?*sigset_t) void; + extern "c" fn __sigfillset14(set: ?*sigset_t) c_int; extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; diff --git a/lib/std/posix/test.zig b/lib/std/posix/test.zig index ce1e7950d1..776fe615b3 100644 --- a/lib/std/posix/test.zig +++ b/lib/std/posix/test.zig @@ -889,10 +889,10 @@ test "sigset empty/full" { // Some signals (i.e., 32 - 34 on glibc/musl) are not allowed to be added to a // sigset by the C library, so avoid testing them. fn reserved_signo(i: usize) bool { - if (native_os == .macos) { - return false; - } - return builtin.link_libc and (i >= 32 and i < posix.sigrtmin()); + if (native_os == .macos) return false; + if (!builtin.link_libc) return false; + const max = if (native_os == .netbsd) 32 else 31; + return i > max and i < posix.sigrtmin(); } test "sigset add/del" { diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index d0836c23f1..3cb867f763 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -174,7 +174,6 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none }, .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabihf }, - .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabihf }, .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi }, .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabihf }, .{ .cpu_arch = .powerpc, .os_tag = .haiku, .abi = .eabi }, @@ -285,7 +284,6 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .musl }, .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .none }, - .{ .cpu_arch = .x86, .os_tag = .freebsd, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .freestanding, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .haiku, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .hurd, .abi = .gnu }, diff --git a/test/tests.zig b/test/tests.zig index 6a4c2f4ef7..03fb566f0b 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -45,6 +45,8 @@ const test_targets = blk: { // lot of branches) @setEvalBranchQuota(50000); break :blk [_]TestTarget{ + // Native Targets + .{}, .{ .link_libc = true, @@ -52,6 +54,7 @@ const test_targets = blk: { .{ .single_threaded = true, }, + .{ .optimize_mode = .ReleaseFast, }, @@ -94,121 +97,82 @@ const test_targets = blk: { }, .link_libc = true, }, + + // FreeBSD Targets + .{ .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, + .cpu_arch = .aarch64, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, .abi = .none, }, - .use_llvm = false, - .use_lld = false, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 }, - .os_tag = .linux, - .abi = .none, - }, - .use_llvm = false, - .use_lld = false, - .pic = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 }, - .os_tag = .linux, - .abi = .none, - }, - .use_llvm = false, - .use_lld = false, - .strip = true, - }, - // Doesn't support new liveness - //.{ - // .target = .{ - // .cpu_arch = .aarch64, - // .os_tag = .linux, - // }, - // .use_llvm = false, - // .use_lld = false, - //}, - .{ - .target = .{ - .cpu_arch = .wasm32, - .os_tag = .wasi, - }, - .use_llvm = false, - .use_lld = false, - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "spirv64-vulkan", - .cpu_features = "vulkan_v1_2+physical_storage_buffer+int64+float16+float64", - }) catch unreachable, - .use_llvm = false, - .use_lld = false, - .skip_modules = &.{ "c-import", "zigc", "std" }, - }, - // https://github.com/ziglang/zig/issues/13623 - //.{ - // .target = .{ - // .cpu_arch = .arm, - // .os_tag = .linux, - // }, - // .use_llvm = false, - // .use_lld = false, - //}, - // https://github.com/ziglang/zig/issues/13623 - //.{ - // .target = std.Target.Query.parse(.{ - // .arch_os_abi = "arm-linux-none", - // .cpu_features = "generic+v8a", - // }) catch unreachable, - // .use_llvm = false, - // .use_lld = false, - //}, - // Doesn't support new liveness - //.{ - // .target = .{ - // .cpu_arch = .aarch64, - // .os_tag = .macos, - // .abi = .none, - // }, - // .use_llvm = false, - // .use_lld = false, - //}, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .macos, - .abi = .none, - }, - .use_llvm = false, - .use_lld = false, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .windows, - .abi = .gnu, - }, - .use_llvm = false, - .use_lld = false, + .link_libc = true, }, .{ .target = .{ - .cpu_arch = .wasm32, - .os_tag = .wasi, + .cpu_arch = .arm, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, + .abi = .eabihf, }, - .link_libc = false, + .link_libc = true, + // https://github.com/ziglang/zig/issues/23949 + .skip_modules = &.{"std"}, }, + .{ .target = .{ - .cpu_arch = .wasm32, - .os_tag = .wasi, + .cpu_arch = .powerpc64, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .powerpc64le, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .riscv64, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, + .abi = .none, }, .link_libc = true, }, @@ -216,104 +180,19 @@ const test_targets = blk: { .{ .target = .{ .cpu_arch = .x86_64, - .os_tag = .linux, + .os_tag = .freebsd, + // Remove this when we bump our baseline to 14.0.0. + .os_version_min = .{ .semver = .{ + .major = 14, + .minor = 0, + .patch = 0, + } }, .abi = .none, }, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .gnu, - }, .link_libc = true, }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .gnux32, - }, - .link_libc = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .musl, - }, - .link_libc = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .musl, - }, - .linkage = .dynamic, - .link_libc = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .muslx32, - }, - .link_libc = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .muslx32, - }, - .linkage = .dynamic, - .link_libc = true, - .extra_target = true, - }, - .{ - .target = .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .musl, - }, - .link_libc = true, - .use_lld = false, - }, - .{ - .target = .{ - .cpu_arch = .x86, - .os_tag = .linux, - .abi = .none, - }, - }, - .{ - .target = .{ - .cpu_arch = .x86, - .os_tag = .linux, - .abi = .musl, - }, - .link_libc = true, - }, - .{ - .target = .{ - .cpu_arch = .x86, - .os_tag = .linux, - .abi = .musl, - }, - .linkage = .dynamic, - .link_libc = true, - .extra_target = true, - }, - .{ - .target = .{ - .cpu_arch = .x86, - .os_tag = .linux, - .abi = .gnu, - }, - .link_libc = true, - }, + // Linux Targets .{ .target = .{ @@ -347,14 +226,6 @@ const test_targets = blk: { }, .link_libc = true, }, - .{ - .target = .{ - .cpu_arch = .aarch64, - .os_tag = .windows, - .abi = .gnu, - }, - .link_libc = true, - }, .{ .target = .{ @@ -528,71 +399,6 @@ const test_targets = blk: { .link_libc = true, }, - // Calls are normally lowered to branch instructions that only support +/- 16 MB range when - // targeting Thumb. This easily becomes insufficient for our test binaries, so use long - // calls to avoid out-of-range relocations. - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumb-linux-eabi", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumb-linux-eabihf", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumb-linux-musleabi", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .link_libc = true, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumb-linux-musleabihf", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .link_libc = true, - .pic = false, // Long calls don't work with PIC. - }, - - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumbeb-linux-eabi", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumbeb-linux-eabihf", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumbeb-linux-musleabi", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .link_libc = true, - .pic = false, // Long calls don't work with PIC. - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "thumbeb-linux-musleabihf", - .cpu_features = "baseline+long_calls", - }) catch unreachable, - .link_libc = true, - .pic = false, // Long calls don't work with PIC. - }, - .{ .target = .{ .cpu_arch = .hexagon, @@ -632,6 +438,7 @@ const test_targets = blk: { .os_tag = .linux, .abi = .none, }, + // https://github.com/ziglang/zig/issues/23696 .skip_modules = &.{"std"}, }, .{ @@ -641,6 +448,7 @@ const test_targets = blk: { .abi = .musl, }, .link_libc = true, + // https://github.com/ziglang/zig/issues/23696 .skip_modules = &.{"std"}, }, .{ @@ -651,6 +459,7 @@ const test_targets = blk: { }, .linkage = .dynamic, .link_libc = true, + // https://github.com/ziglang/zig/issues/23696 .skip_modules = &.{"std"}, .extra_target = true, }, @@ -661,6 +470,7 @@ const test_targets = blk: { .abi = .gnu, }, .link_libc = true, + // https://github.com/ziglang/zig/issues/23696 .skip_modules = &.{"std"}, }, @@ -1061,20 +871,6 @@ const test_targets = blk: { .link_libc = true, }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "riscv32-linux-none", - .cpu_features = "baseline-d-f", - }) catch unreachable, - }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "riscv32-linux-musl", - .cpu_features = "baseline-d-f", - }) catch unreachable, - .link_libc = true, - }, - .{ .target = .{ .cpu_arch = .riscv32, @@ -1082,6 +878,12 @@ const test_targets = blk: { .abi = .none, }, }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "riscv32-linux-none", + .cpu_features = "baseline-d-f", + }) catch unreachable, + }, .{ .target = .{ .cpu_arch = .riscv32, @@ -1100,6 +902,13 @@ const test_targets = blk: { .link_libc = true, .extra_target = true, }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "riscv32-linux-musl", + .cpu_features = "baseline-d-f", + }) catch unreachable, + .link_libc = true, + }, .{ .target = .{ .cpu_arch = .riscv32, @@ -1112,17 +921,11 @@ const test_targets = blk: { .{ .target = std.Target.Query.parse(.{ .arch_os_abi = "riscv64-linux-none", - .cpu_features = "baseline-d-f", + .cpu_features = "baseline+v+zbb", }) catch unreachable, + .use_llvm = false, + .use_lld = false, }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "riscv64-linux-musl", - .cpu_features = "baseline-d-f", - }) catch unreachable, - .link_libc = true, - }, - .{ .target = .{ .cpu_arch = .riscv64, @@ -1130,6 +933,12 @@ const test_targets = blk: { .abi = .none, }, }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "riscv64-linux-none", + .cpu_features = "baseline-d-f", + }) catch unreachable, + }, .{ .target = .{ .cpu_arch = .riscv64, @@ -1148,6 +957,13 @@ const test_targets = blk: { .link_libc = true, .extra_target = true, }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "riscv64-linux-musl", + .cpu_features = "baseline-d-f", + }) catch unreachable, + .link_libc = true, + }, .{ .target = .{ .cpu_arch = .riscv64, @@ -1157,15 +973,6 @@ const test_targets = blk: { .link_libc = true, }, - .{ - .target = std.Target.Query.parse(.{ - .arch_os_abi = "riscv64-linux-musl", - .cpu_features = "baseline+v+zbb", - }) catch unreachable, - .use_llvm = false, - .use_lld = false, - }, - .{ .target = .{ .cpu_arch = .s390x, @@ -1201,13 +1008,205 @@ const test_targets = blk: { .link_libc = true, }, + // Calls are normally lowered to branch instructions that only support +/- 16 MB range when + // targeting Thumb. This easily becomes insufficient for our test binaries, so use long + // calls to avoid out-of-range relocations. + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumb-linux-eabi", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumb-linux-eabihf", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumb-linux-musleabi", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .link_libc = true, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumb-linux-musleabihf", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .link_libc = true, + .pic = false, // Long calls don't work with PIC. + }, + + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumbeb-linux-eabi", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumbeb-linux-eabihf", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumbeb-linux-musleabi", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .link_libc = true, + .pic = false, // Long calls don't work with PIC. + }, + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "thumbeb-linux-musleabihf", + .cpu_features = "baseline+long_calls", + }) catch unreachable, + .link_libc = true, + .pic = false, // Long calls don't work with PIC. + }, + .{ .target = .{ - .cpu_arch = .x86_64, - .os_tag = .macos, + .cpu_arch = .x86, + .os_tag = .linux, .abi = .none, }, }, + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .linux, + .abi = .musl, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .linux, + .abi = .musl, + }, + .linkage = .dynamic, + .link_libc = true, + .extra_target = true, + }, + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .linux, + .abi = .gnu, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .none, + }, + .use_llvm = false, + .use_lld = false, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 }, + .os_tag = .linux, + .abi = .none, + }, + .use_llvm = false, + .use_lld = false, + .pic = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 }, + .os_tag = .linux, + .abi = .none, + }, + .use_llvm = false, + .use_lld = false, + .strip = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .none, + }, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .gnu, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .gnux32, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .musl, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .musl, + }, + .linkage = .dynamic, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .muslx32, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .muslx32, + }, + .linkage = .dynamic, + .link_libc = true, + .extra_target = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .musl, + }, + .link_libc = true, + .use_lld = false, + }, + + // macOS Targets .{ .target = .{ @@ -1219,20 +1218,299 @@ const test_targets = blk: { .{ .target = .{ - .cpu_arch = .x86, - .os_tag = .windows, - .abi = .msvc, + .cpu_arch = .x86_64, + .os_tag = .macos, + .abi = .none, }, + .use_llvm = false, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .macos, + .abi = .none, + }, + }, + + // NetBSD Targets + + .{ + .target = .{ + .cpu_arch = .aarch64, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .aarch64_be, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .arm, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabi, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .arm, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabihf, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .armeb, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabi, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .armeb, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabihf, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .mips, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabi, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .mips, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabihf, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .mipsel, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabi, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .mipsel, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabihf, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .powerpc, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabi, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .powerpc, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .eabihf, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, }, .{ .target = .{ .cpu_arch = .x86_64, + .os_tag = .netbsd, + // Remove this when we bump our baseline to 10.1.0. + .os_version_min = .{ .semver = .{ + .major = 10, + .minor = 1, + .patch = 0, + } }, + .abi = .none, + }, + .link_libc = true, + }, + + // SPIR-V Targets + + .{ + .target = std.Target.Query.parse(.{ + .arch_os_abi = "spirv64-vulkan", + .cpu_features = "vulkan_v1_2+physical_storage_buffer+int64+float16+float64", + }) catch unreachable, + .use_llvm = false, + .use_lld = false, + .skip_modules = &.{ "c-import", "zigc", "std" }, + }, + + // WASI Targets + + .{ + .target = .{ + .cpu_arch = .wasm32, + .os_tag = .wasi, + .abi = .none, + }, + .use_llvm = false, + .use_lld = false, + }, + .{ + .target = .{ + .cpu_arch = .wasm32, + .os_tag = .wasi, + .abi = .none, + }, + }, + .{ + .target = .{ + .cpu_arch = .wasm32, + .os_tag = .wasi, + .abi = .musl, + }, + .link_libc = true, + }, + + // Windows Targets + + .{ + .target = .{ + .cpu_arch = .aarch64, + .os_tag = .windows, + .abi = .none, + }, + }, + .{ + .target = .{ + .cpu_arch = .aarch64, + .os_tag = .windows, + .abi = .gnu, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .aarch64, .os_tag = .windows, .abi = .msvc, }, + .link_libc = true, }, + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .windows, + .abi = .none, + }, + }, .{ .target = .{ .cpu_arch = .x86, @@ -1241,7 +1519,56 @@ const test_targets = blk: { }, .link_libc = true, }, + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .windows, + .abi = .msvc, + }, + .link_libc = true, + }, + + .{ + .target = .{ + .cpu_arch = .thumb, + .os_tag = .windows, + .abi = .none, + }, + }, + // https://github.com/ziglang/zig/issues/24016 + // .{ + // .target = .{ + // .cpu_arch = .thumb, + // .os_tag = .windows, + // .abi = .gnu, + // }, + // .link_libc = true, + // }, + .{ + .target = .{ + .cpu_arch = .thumb, + .os_tag = .windows, + .abi = .msvc, + }, + .link_libc = true, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .windows, + .abi = .none, + }, + .use_llvm = false, + .use_lld = false, + }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .windows, + .abi = .none, + }, + }, .{ .target = .{ .cpu_arch = .x86_64, @@ -1250,6 +1577,14 @@ const test_targets = blk: { }, .link_libc = true, }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .windows, + .abi = .msvc, + }, + .link_libc = true, + }, }; }; @@ -1263,14 +1598,68 @@ const CAbiTarget = struct { }; const c_abi_targets = [_]CAbiTarget{ + // Native Targets + .{}, + + // Linux Targets + .{ .target = .{ - .cpu_arch = .x86_64, + .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl, }, }, + + .{ + .target = .{ + .cpu_arch = .arm, + .os_tag = .linux, + .abi = .musleabihf, + }, + }, + + .{ + .target = .{ + .cpu_arch = .mips, + .os_tag = .linux, + .abi = .musleabihf, + }, + }, + + .{ + .target = .{ + .cpu_arch = .powerpc, + .os_tag = .linux, + .abi = .musleabihf, + }, + }, + + .{ + .target = .{ + .cpu_arch = .powerpc64le, + .os_tag = .linux, + .abi = .musl, + }, + }, + + .{ + .target = .{ + .cpu_arch = .riscv64, + .os_tag = .linux, + .abi = .musl, + }, + }, + + .{ + .target = .{ + .cpu_arch = .x86, + .os_tag = .linux, + .abi = .musl, + }, + }, + .{ .target = .{ .cpu_arch = .x86_64, @@ -1307,39 +1696,14 @@ const c_abi_targets = [_]CAbiTarget{ }, .{ .target = .{ - .cpu_arch = .x86, - .os_tag = .linux, - .abi = .musl, - }, - }, - .{ - .target = .{ - .cpu_arch = .aarch64, - .os_tag = .linux, - .abi = .musl, - }, - }, - .{ - .target = .{ - .cpu_arch = .arm, - .os_tag = .linux, - .abi = .musleabihf, - }, - }, - .{ - .target = .{ - .cpu_arch = .mips, - .os_tag = .linux, - .abi = .musleabihf, - }, - }, - .{ - .target = .{ - .cpu_arch = .riscv64, + .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl, }, }, + + // WASI Targets + .{ .target = .{ .cpu_arch = .wasm32, @@ -1347,20 +1711,9 @@ const c_abi_targets = [_]CAbiTarget{ .abi = .musl, }, }, - .{ - .target = .{ - .cpu_arch = .powerpc, - .os_tag = .linux, - .abi = .musleabihf, - }, - }, - .{ - .target = .{ - .cpu_arch = .powerpc64le, - .os_tag = .linux, - .abi = .musl, - }, - }, + + // Windows Targets + .{ .target = .{ .cpu_arch = .x86, @@ -1776,6 +2129,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { if (options.skip_libc and test_target.link_libc == true) continue; + // We can't provide MSVC libc when cross-compiling. + if (target.abi == .msvc and test_target.link_libc == true and builtin.os.tag != .windows) + continue; + if (options.skip_single_threaded and test_target.single_threaded == true) continue;