authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-03 17:05:15-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-06-03 17:05:15-04:00
log826e1c30ba81884e1a8fad8664b3da17953d89d1
treeb59c603f8a00a95c2a7ef79b6b2cc1eff155a0d1
parent80170d017b59950d4e8e8bd6da7c3c3b80b0730b
parentcbf9d3c570aa1404b0948741948def324044cf7c
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #24013 from alexrp/test-matrix

More target coverage in the module test matrix

87 files changed, 743 insertions(+), 5960 deletions(-)

lib/compiler/aro_translate_c.zig+1-1
...@@ -1206,7 +1206,7 @@ pub const PatternList = struct {...@@ -1206,7 +1206,7 @@ pub const PatternList = struct {
1206 /// Assumes that `ms` represents a tokenized function-like macro.1206 /// Assumes that `ms` represents a tokenized function-like macro.
1207 fn buildArgsHash(allocator: mem.Allocator, ms: MacroSlicer, hash: *ArgsPositionMap) MacroProcessingError!void {1207 fn buildArgsHash(allocator: mem.Allocator, ms: MacroSlicer, hash: *ArgsPositionMap) MacroProcessingError!void {
1208 assert(ms.tokens.len > 2);1208 assert(ms.tokens.len > 2);
1209 assert(ms.tokens[0].id == .identifier or ms.tokens[0].id == .extended_identifier);1209 assert(ms.tokens[0].id.isMacroIdentifier());
1210 assert(ms.tokens[1].id == .l_paren);1210 assert(ms.tokens[1].id == .l_paren);
12111211
1212 var i: usize = 2;1212 var i: usize = 2;
lib/compiler_rt.zig+1-1
...@@ -265,7 +265,7 @@ comptime {...@@ -265,7 +265,7 @@ comptime {
265 _ = @import("compiler_rt/ssp.zig");265 _ = @import("compiler_rt/ssp.zig");
266 }266 }
267267
268 if (!builtin.link_libc and builtin.abi == .msvc) {268 if (!builtin.link_libc and builtin.os.tag == .windows and (builtin.abi == .none or builtin.abi == .msvc)) {
269 @export(&_fltused, .{ .name = "_fltused", .linkage = common.linkage, .visibility = common.visibility });269 @export(&_fltused, .{ .name = "_fltused", .linkage = common.linkage, .visibility = common.visibility });
270 }270 }
271}271}
lib/compiler_rt/aulldiv.zig+1-1
...@@ -8,7 +8,7 @@ const common = @import("common.zig");...@@ -8,7 +8,7 @@ const common = @import("common.zig");
8pub const panic = common.panic;8pub const panic = common.panic;
99
10comptime {10comptime {
11 if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and !builtin.link_libc) {11 if (arch == .x86 and common.want_windows_msvc_or_itanium_abi and !builtin.link_libc) {
12 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins12 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
13 @export(&_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility });13 @export(&_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility });
14 @export(&_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility });14 @export(&_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility });
lib/compiler_rt/aullrem.zig+1-1
...@@ -8,7 +8,7 @@ const common = @import("common.zig");...@@ -8,7 +8,7 @@ const common = @import("common.zig");
8pub const panic = common.panic;8pub const panic = common.panic;
99
10comptime {10comptime {
11 if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and !builtin.link_libc) {11 if (arch == .x86 and common.want_windows_msvc_or_itanium_abi and !builtin.link_libc) {
12 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins12 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
13 @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility });13 @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility });
14 @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility });14 @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility });
lib/compiler_rt/common.zig+5
...@@ -52,6 +52,11 @@ pub const want_aeabi = switch (builtin.abi) {...@@ -52,6 +52,11 @@ pub const want_aeabi = switch (builtin.abi) {
52// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.52// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.
53pub 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);53pub 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);
5454
55pub const want_windows_msvc_or_itanium_abi = switch (builtin.abi) {
56 .none, .msvc, .itanium => builtin.os.tag == .windows,
57 else => false,
58};
59
55pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();60pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();
5661
57pub const want_float_exceptions = !builtin.cpu.arch.isWasm();62pub const want_float_exceptions = !builtin.cpu.arch.isWasm();
lib/libc/include/riscv32-netbsd-none/float.h deleted-58
...@@ -1,58 +0,0 @@
1/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_FLOAT_H_
33#define _RISCV_FLOAT_H_
34
35#include <sys/cdefs.h>
36
37#define LDBL_MANT_DIG __LDBL_MANT_DIG__
38#define LDBL_DIG __LDBL_DIG__
39#define LDBL_MIN_EXP __LDBL_MIN_EXP__
40#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
41#define LDBL_MAX_EXP __LDBL_MAX_EXP__
42#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
43#define LDBL_EPSILON __LDBL_EPSILON__
44#define LDBL_MIN __LDBL_MIN__
45#define LDBL_MAX __LDBL_MAX__
46
47#include <sys/float_ieee754.h>
48
49#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \
50 && !defined(_XOPEN_SOURCE)) \
51 || (__STDC_VERSION__ - 0) >= 199901L \
52 || (_POSIX_C_SOURCE - 0) >= 200112L \
53 || ((_XOPEN_SOURCE - 0) >= 600) \
54 || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
55#define DECIMAL_DIG __DECIMAL_DIG__
56#endif
57
58#endif /* !_RISCV_FLOAT_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/ansi.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: ansi.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_ansi.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/aout_machdep.h deleted-40
...@@ -1,40 +0,0 @@
1/* $NetBSD: aout_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_AOUT_MACHDEP_H_
33#define _RISCV_AOUT_MACHDEP_H_
34
35#define cpu_exec_aout_makecmds(p, epp) ENOEXEC
36
37/* Size of a page in an object file. */
38#define AOUT_LDPGSZ 4096
39
40#endif /* !_RISCV_AOUT_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/asm.h deleted-266
...@@ -1,266 +0,0 @@
1/* $NetBSD: asm.h,v 1.6 2021/05/01 07:05:07 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_ASM_H
33#define _RISCV_ASM_H
34
35#define _C_LABEL(x) x
36
37#define __CONCAT(x,y) x ## y
38#define __STRING(x) #x
39
40#define ___CONCAT(x,y) __CONCAT(x,y)
41
42/*
43 * Define -pg profile entry code.
44 * Must always be noreorder, must never use a macro instruction
45 * Final addiu to t9 must always equal the size of this _KERN_MCOUNT
46 */
47#define _KERN_MCOUNT \
48 .set push; \
49 subi sp, sp, CALLFRAME_SIZE; \
50 REG_S a0, CALLFRAME_S0(sp); \
51 REG_S ra, CALLFRAME_RA(sp); \
52 move a0, ra; \
53 call _mcount \
54 REG_L ra, CALLFRAME_RA(sp); \
55 REG_L a0, CALLFRAME_S0(sp); \
56 addi sp, sp, CALLFRAME_SIZ; \
57 .set pop;
58
59#ifdef GPROF
60#define _PROF_PROLOGUE _KERN_MCOUNT
61#else
62#define _PROF_PROLOGUE
63#endif
64
65#ifdef __PIC__
66#define PLT(x) x##@plt
67#else
68#define PLT(x) x
69#endif
70
71/*
72 * WEAK_ALIAS: create a weak alias.
73 */
74#define WEAK_ALIAS(alias,sym) \
75 .weak alias; \
76 alias = sym
77/*
78 * STRONG_ALIAS: create a strong alias.
79 */
80#define STRONG_ALIAS(alias,sym) \
81 .globl alias; \
82 alias = sym
83
84/*
85 * WARN_REFERENCES: create a warning if the specified symbol is referenced.
86 */
87#define WARN_REFERENCES(sym,msg) \
88 .pushsection __CONCAT(.gnu.warning.,sym); \
89 .ascii msg; \
90 .popsection
91
92#define _ENTRY(x) \
93 .globl _C_LABEL(x); \
94 .type _C_LABEL(x), @function; \
95 _C_LABEL(x):
96
97#define ENTRY_NP(x) .text; .align 2; _ENTRY(x)
98#define ENTRY(x) ENTRY_NP(x); _PROF_PROLOGUE
99#define END(x) .size _C_LABEL(x), . - _C_LABEL(x)
100
101/*
102 * Macros to panic and printf from assembly language.
103 */
104#define PANIC(msg) \
105 la a0, 9f; \
106 call _C_LABEL(panic); \
107 MSG(msg)
108
109#define PRINTF(msg) \
110 la a0, 9f; \
111 call _C_LABEL(printf); \
112 MSG(msg)
113
114#define MSG(msg) \
115 .pushsection .rodata.str1.8,"aMS",@progbits,1; \
1169: .asciiz msg; \
117 .popsection
118
119#define ASMSTR(str) \
120 .asciiz str; \
121 .align 3
122
123#define __RCSID(x) .pushsection ".ident","MS",@progbits,1; \
124 .asciz x; \
125 .popsection
126#define RCSID(name) __RCSID(name)
127
128#if defined(_LP64)
129#define SZREG 8
130#else
131#define SZREG 4
132#endif
133
134#define ALSK 15 /* stack alignment */
135#define ALMASK -15 /* stack alignment */
136#define SZFPREG 8
137#define FP_L fld
138#define FP_S fsd
139
140/*
141 * standard callframe {
142 * register_t cf_sp; frame pointer
143 * register_t cf_ra; return address
144 * };
145 */
146#define CALLFRAME_SIZ (SZREG * 4)
147#define CALLFRAME_S1 (CALLFRAME_SIZ - 4 * SZREG)
148#define CALLFRAME_S0 (CALLFRAME_SIZ - 3 * SZREG)
149#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG)
150#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG)
151
152/*
153 * These macros hide the use of rv32 and rv64 instructions from the
154 * assembler to prevent the assembler from generating 64-bit style
155 * ABI calls.
156 */
157#define PTR_ADD add
158#define PTR_ADDI addi
159#define PTR_SUB sub
160#define PTR_SUBI subi
161#define PTR_LA la
162#define PTR_SLLI slli
163#define PTR_SLL sll
164#define PTR_SRLI srli
165#define PTR_SRL srl
166#define PTR_SRAI srai
167#define PTR_SRA sra
168#if _LP64
169#define PTR_L ld
170#define PTR_S sd
171#define PTR_LR lr.d
172#define PTR_SC sc.d
173#define PTR_WORD .dword
174#define PTR_SCALESHIFT 3
175#else
176#define PTR_L lw
177#define PTR_S sw
178#define PTR_LR lr.w
179#define PTR_SC sc.w
180#define PTR_WORD .word
181#define PTR_SCALESHIFT 2
182#endif
183
184#define INT_L lw
185#define INT_LA la
186#define INT_S sw
187#define INT_LR lr.w
188#define INT_SC sc.w
189#define INT_WORD .word
190#define INT_SCALESHIFT 2
191#ifdef _LP64
192#define INT_ADD addw
193#define INT_ADDI addwi
194#define INT_SUB subw
195#define INT_SUBI subwi
196#define INT_SLL sllwi
197#define INT_SLLV sllw
198#define INT_SRL srlwi
199#define INT_SRLV srlw
200#define INT_SRA srawi
201#define INT_SRAV sraw
202#else
203#define INT_ADD add
204#define INT_ADDI addi
205#define INT_SUB sub
206#define INT_SUBI subi
207#define INT_SLLI slli
208#define INT_SLL sll
209#define INT_SRLI srli
210#define INT_SRL srl
211#define INT_SRAI srai
212#define INT_SRA sra
213#endif
214
215#define LONG_LA la
216#define LONG_ADD add
217#define LONG_ADDI addi
218#define LONG_SUB sub
219#define LONG_SUBI subi
220#define LONG_SLLI slli
221#define LONG_SLL sll
222#define LONG_SRLI srli
223#define LONG_SRL srl
224#define LONG_SRAI srai
225#define LONG_SRA sra
226#ifdef _LP64
227#define LONG_L ld
228#define LONG_S sd
229#define LONG_LR lr.d
230#define LONG_SC sc.d
231#define LONG_WORD .quad
232#define LONG_SCALESHIFT 3
233#else
234#define LONG_L lw
235#define LONG_S sw
236#define LONG_LR lr.w
237#define LONG_SC sc.w
238#define LONG_WORD .word
239#define LONG_SCALESHIFT 2
240#endif
241
242#define REG_LI li
243#define REG_ADD add
244#define REG_SLLI slli
245#define REG_SLL sll
246#define REG_SRLI srli
247#define REG_SRL srl
248#define REG_SRAI srai
249#define REG_SRA sra
250#if _LP64
251#define REG_L ld
252#define REG_S sd
253#define REG_LR lr.d
254#define REG_SC sc.d
255#define REG_SCALESHIFT 3
256#else
257#define REG_L lw
258#define REG_S sw
259#define REG_LR lr.w
260#define REG_SC sc.w
261#define REG_SCALESHIFT 2
262#endif
263
264#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off)
265
266#endif /* _RISCV_ASM_H */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/bswap.h deleted-11
...@@ -1,11 +0,0 @@
1/* $NetBSD: bswap.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef _RISCV_BSWAP_H_
4#define _RISCV_BSWAP_H_
5
6#include <riscv/byte_swap.h>
7
8#define __BSWAP_RENAME
9#include <sys/bswap.h>
10
11#endif /* _RISCV_BSWAP_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/cdefs.h deleted-8
...@@ -1,8 +0,0 @@
1/* $NetBSD: cdefs.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef _RISCV_CDEFS_H_
4#define _RISCV_CDEFS_H_
5
6#define __ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1U)
7
8#endif /* _RISCV_CDEFS_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/cpu.h deleted-153
...@@ -1,153 +0,0 @@
1/* $NetBSD: cpu.h,v 1.9 2022/11/17 09:50:23 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_CPU_H_
33#define _RISCV_CPU_H_
34
35#if defined(_KERNEL) || defined(_KMEMUSER)
36
37struct clockframe {
38 vaddr_t cf_epc;
39 register_t cf_status;
40 int cf_intr_depth;
41};
42
43#define CLKF_USERMODE(cf) (((cf)->cf_status & SR_SPP) == 0)
44#define CLKF_PC(cf) ((cf)->cf_epc)
45#define CLKF_INTR(cf) ((cf)->cf_intr_depth > 0)
46
47#include <sys/cpu_data.h>
48#include <sys/device_if.h>
49#include <sys/evcnt.h>
50#include <sys/intr.h>
51
52struct cpu_info {
53 struct cpu_data ci_data;
54 device_t ci_dev;
55 cpuid_t ci_cpuid;
56 struct lwp *ci_curlwp;
57 struct lwp *ci_onproc; /* current user LWP / kthread */
58 struct lwp *ci_softlwps[SOFTINT_COUNT];
59 struct trapframe *ci_ddb_regs;
60
61 uint64_t ci_lastintr;
62
63 int ci_mtx_oldspl;
64 int ci_mtx_count;
65
66 int ci_want_resched;
67 int ci_cpl;
68 u_int ci_softints;
69 volatile u_int ci_intr_depth;
70
71 tlb_asid_t ci_pmap_asid_cur;
72
73 union pmap_segtab *ci_pmap_user_segtab;
74#ifdef _LP64
75 union pmap_segtab *ci_pmap_user_seg0tab;
76#endif
77
78 struct evcnt ci_ev_fpu_saves;
79 struct evcnt ci_ev_fpu_loads;
80 struct evcnt ci_ev_fpu_reenables;
81#if defined(GPROF) && defined(MULTIPROCESSOR)
82 struct gmonparam *ci_gmon; /* MI per-cpu GPROF */
83#endif
84};
85
86#endif /* _KERNEL || _KMEMUSER */
87
88#ifdef _KERNEL
89
90extern struct cpu_info cpu_info_store;
91
92// This is also in <sys/lwp.h>
93struct lwp;
94static inline struct cpu_info *lwp_getcpu(struct lwp *);
95
96register struct lwp *riscv_curlwp __asm("tp");
97#define curlwp riscv_curlwp
98#define curcpu() lwp_getcpu(curlwp)
99
100static inline cpuid_t
101cpu_number(void)
102{
103#ifdef MULTIPROCESSOR
104 return curcpu()->ci_cpuid;
105#else
106 return 0;
107#endif
108}
109
110void cpu_proc_fork(struct proc *, struct proc *);
111void cpu_signotify(struct lwp *);
112void cpu_need_proftick(struct lwp *l);
113void cpu_boot_secondary_processors(void);
114
115#define CPU_INFO_ITERATOR cpuid_t
116#ifdef MULTIPROCESSOR
117#define CPU_INFO_FOREACH(cii, ci) \
118 (cii) = 0; ((ci) = cpu_infos[cii]) != NULL; (cii)++
119#else
120#define CPU_INFO_FOREACH(cii, ci) \
121 (cii) = 0, (ci) = curcpu(); (cii) == 0; (cii)++
122#endif
123
124#define CPU_INFO_CURPMAP(ci) (curlwp->l_proc->p_vmspace->vm_map.pmap)
125
126static inline void
127cpu_dosoftints(void)
128{
129 extern void dosoftints(void);
130 struct cpu_info * const ci = curcpu();
131 if (ci->ci_intr_depth == 0
132 && (ci->ci_data.cpu_softints >> ci->ci_cpl) > 0)
133 dosoftints();
134}
135
136static inline bool
137cpu_intr_p(void)
138{
139 return curcpu()->ci_intr_depth > 0;
140}
141
142#define LWP_PC(l) cpu_lwp_pc(l)
143
144vaddr_t cpu_lwp_pc(struct lwp *);
145
146static inline void
147cpu_idle(void)
148{
149}
150
151#endif /* _KERNEL */
152
153#endif /* _RISCV_CPU_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/disklabel.h deleted-68
...@@ -1,68 +0,0 @@
1/* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_DISKLABEL_H_
33#define _RISCV_DISKLABEL_H_
34
35#define LABELUSESMBR 1 /* use MBR partitionning */
36#define LABELSECTOR 1 /* sector containing label */
37#define LABELOFFSET 0 /* offset of label in sector */
38#define MAXPARTITIONS 16 /* number of partitions */
39#define RAW_PART 2 /* raw partition: XX?c */
40
41#if HAVE_NBTOOL_CONFIG_H
42#include <nbinclude/sys/dkbad.h>
43#include <nbinclude/sys/bootblock.h>
44#else
45#include <sys/dkbad.h>
46#include <sys/bootblock.h>
47#endif /* HAVE_NBTOOL_CONFIG_H */
48
49struct cpu_disklabel {
50 struct mbr_partition mbrparts[MBR_PART_COUNT];
51#define __HAVE_DISKLABEL_DKBAD
52 struct dkbad bad;
53};
54
55#ifdef _KERNEL
56struct buf;
57struct disklabel;
58
59/* for readdisklabel. rv != 0 -> matches, msg == NULL -> success */
60int mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *,
61 struct cpu_disklabel *, const char **, int *, int *);
62
63/* for writedisklabel. rv == 0 -> doesn't match, rv > 0 -> success */
64int mbr_label_locate(dev_t, void (*)(struct buf *),
65 struct disklabel *, struct cpu_disklabel *, int *, int *);
66#endif /* _KERNEL */
67
68#endif /* _RISCV_DISKLABEL_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/elf_machdep.h deleted-144
...@@ -1,144 +0,0 @@
1/* $NetBSD: elf_machdep.h,v 1.9 2022/12/03 08:54:38 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_ELF_MACHDEP_H_
33#define _RISCV_ELF_MACHDEP_H_
34
35#define ELF32_MACHDEP_ID EM_RISCV
36#define ELF64_MACHDEP_ID EM_RISCV
37
38#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
39#define ELF64_MACHDEP_ENDIANNESS ELFDATA2LSB
40
41#define ELF32_MACHDEP_ID_CASES \
42 case EM_RISCV: \
43 break;
44
45#define ELF64_MACHDEP_ID_CASES \
46 case EM_RISCV: \
47 break;
48
49#ifdef _LP64
50#define KERN_ELFSIZE 64
51#define ARCH_ELFSIZE 64 /* MD native binary size */
52#else
53#define KERN_ELFSIZE 32
54#define ARCH_ELFSIZE 32 /* MD native binary size */
55#endif
56
57/* Processor specific flags for the ELF header e_flags field. */
58
59/* Processor specific relocation types */
60
61#define R_RISCV_NONE 0
62#define R_RISCV_32 1 // A
63#define R_RISCV_64 2
64#define R_RISCV_RELATIVE 3
65#define R_RISCV_COPY 4
66#define R_RISCV_JMP_SLOT 5
67#define R_RISCV_TLS_DTPMOD32 6
68#define R_RISCV_TLS_DTPMOD64 7
69#define R_RISCV_TLS_DTPREL32 8
70#define R_RISCV_TLS_DTPREL64 9
71#define R_RISCV_TLS_TPREL32 10
72#define R_RISCV_TLS_TPREL64 11
73
74/* The rest are not used by the dynamic linker */
75#define R_RISCV_BRANCH 16 // (A - P) & 0xffff
76#define R_RISCV_JAL 17 // A & 0xff
77#define R_RISCV_CALL 18 // (A - P) & 0xff
78#define R_RISCV_CALL_PLT 19
79#define R_RISCV_GOT_HI20 20
80#define R_RISCV_TLS_GOT_HI20 21
81#define R_RISCV_TLS_GD_HI20 22
82#define R_RISCV_PCREL_HI20 23
83#define R_RISCV_PCREL_LO12_I 24
84#define R_RISCV_PCREL_LO12_S 25
85#define R_RISCV_HI20 26 // A & 0xffff
86#define R_RISCV_LO12_I 27 // (A >> 16) & 0xffff
87#define R_RISCV_LO12_S 28 // (S + A - P) >> 2
88#define R_RISCV_TPREL_HI20 29
89#define R_RISCV_TPREL_LO12_I 30
90#define R_RISCV_TPREL_LO12_S 31
91#define R_RISCV_TPREL_ADD 32
92#define R_RISCV_ADD8 33
93#define R_RISCV_ADD16 34
94#define R_RISCV_ADD32 35
95#define R_RISCV_ADD64 36
96#define R_RISCV_SUB8 37
97#define R_RISCV_SUB16 38
98#define R_RISCV_SUB32 39
99#define R_RISCV_SUB64 40
100#define R_RISCV_GNU_VTINHERIT 41 // A & 0xffff
101#define R_RISCV_GNU_VTENTRY 42
102#define R_RISCV_ALIGN 43
103#define R_RISCV_RVC_BRANCH 44
104#define R_RISCV_RVC_JUMP 45
105#define R_RISCV_RVC_LUI 46
106#define R_RISCV_GPREL_I 47
107#define R_RISCV_GPREL_S 48
108#define R_RISCV_TPREL_I 49
109#define R_RISCV_TPREL_S 50
110#define R_RISCV_RELAX 51
111#define R_RISCV_SUB6 52
112#define R_RISCV_SET6 53
113#define R_RISCV_SET8 54
114#define R_RISCV_SET16 55
115#define R_RISCV_SET32 56
116#define R_RISCV_32_PCREL 57
117
118/* These are aliases we can use R_TYPESZ */
119#define R_RISCV_ADDR32 R_RISCV_32
120#define R_RISCV_ADDR64 R_RISCV_64
121
122#define R_TYPE(name) R_RISCV_ ## name
123#if ELFSIZE == 32
124#define R_TYPESZ(name) R_RISCV_ ## name ## 32
125#else
126#define R_TYPESZ(name) R_RISCV_ ## name ## 64
127#endif
128
129#ifdef _KERNEL
130#ifdef ELFSIZE
131#define ELF_MD_PROBE_FUNC ELFNAME2(cpu_netbsd,probe)
132#endif
133
134struct exec_package;
135
136int cpu_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
137 vaddr_t *);
138
139int cpu_netbsd_elf64_probe(struct lwp *, struct exec_package *, void *, char *,
140 vaddr_t *);
141
142#endif /* _KERNEL */
143
144#endif /* _RISCV_ELF_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/endian.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: endian.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/endian.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/endian_machdep.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: endian_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#define _BYTE_ORDER _LITTLE_ENDIAN
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/fenv.h deleted-35
...@@ -1,35 +0,0 @@
1/* $NetBSD: fenv.h,v 1.3 2020/03/14 16:12:16 skrll Exp $ */
2
3/*
4 * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5 * Public domain.
6 */
7
8#ifndef _RISCV_FENV_H_
9#define _RISCV_FENV_H_
10
11typedef int fenv_t; /* FPSCR */
12typedef int fexcept_t;
13
14#define FE_INEXACT 0x00 /* Result inexact */
15#define FE_UNDERFLOW 0x02 /* Result underflowed */
16#define FE_OVERFLOW 0x04 /* Result overflowed */
17#define FE_DIVBYZERO 0x08 /* divide-by-zero */
18#define FE_INVALID 0x10 /* Result invalid */
19
20#define FE_ALL_EXCEPT 0x1f
21
22#define FE_TONEAREST 0 /* round to nearest representable number */
23#define FE_TOWARDZERO 1 /* round to zero (truncate) */
24#define FE_DOWNWARD 2 /* round toward negative infinity */
25#define FE_UPWARD 3 /* round toward positive infinity */
26
27__BEGIN_DECLS
28
29/* Default floating-point environment */
30extern const fenv_t __fe_dfl_env;
31#define FE_DFL_ENV (&__fe_dfl_env)
32
33__END_DECLS
34
35#endif /* _RISCV_FENV_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/float.h deleted-58
...@@ -1,58 +0,0 @@
1/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_FLOAT_H_
33#define _RISCV_FLOAT_H_
34
35#include <sys/cdefs.h>
36
37#define LDBL_MANT_DIG __LDBL_MANT_DIG__
38#define LDBL_DIG __LDBL_DIG__
39#define LDBL_MIN_EXP __LDBL_MIN_EXP__
40#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
41#define LDBL_MAX_EXP __LDBL_MAX_EXP__
42#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
43#define LDBL_EPSILON __LDBL_EPSILON__
44#define LDBL_MIN __LDBL_MIN__
45#define LDBL_MAX __LDBL_MAX__
46
47#include <sys/float_ieee754.h>
48
49#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \
50 && !defined(_XOPEN_SOURCE)) \
51 || (__STDC_VERSION__ - 0) >= 199901L \
52 || (_POSIX_C_SOURCE - 0) >= 200112L \
53 || ((_XOPEN_SOURCE - 0) >= 600) \
54 || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
55#define DECIMAL_DIG __DECIMAL_DIG__
56#endif
57
58#endif /* !_RISCV_FLOAT_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/ieee.h deleted-4
...@@ -1,4 +0,0 @@
1/* $NetBSD: ieee.h,v 1.2 2019/04/13 15:57:31 maya Exp $ */
2
3#include <riscv/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
4#include <sys/ieee754.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/ieeefp.h deleted-44
...@@ -1,44 +0,0 @@
1/* $NetBSD: ieeefp.h,v 1.2 2020/03/14 16:12:16 skrll Exp $ */
2
3/*
4 * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5 * Public domain.
6 */
7
8#ifndef _RISCV_IEEEFP_H_
9#define _RISCV_IEEEFP_H_
10
11#include <sys/featuretest.h>
12
13#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
14
15#include <riscv/fenv.h>
16
17#if !defined(_ISOC99_SOURCE)
18
19/* Exception type (used by fpsetmask() et al.) */
20
21typedef int fp_except;
22
23/* Bit defines for fp_except */
24
25#define FP_X_INV FE_INVALID /* invalid operation exception */
26#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
27#define FP_X_OFL FE_OVERFLOW /* overflow exception */
28#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
29#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */
30
31/* Rounding modes */
32
33typedef enum {
34 FP_RN=FE_TONEAREST, /* round to nearest representable number */
35 FP_RP=FE_UPWARD, /* round toward positive infinity */
36 FP_RM=FE_DOWNWARD, /* round toward negative infinity */
37 FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */
38} fp_rnd;
39
40#endif /* !_ISOC99_SOURCE */
41
42#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
43
44#endif /* _RISCV_IEEEFP_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/int_const.h deleted-20
...@@ -1,20 +0,0 @@
1/* $NetBSD: int_const.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef __INTMAX_C_SUFFIX__
4
5#define __INT8_C_SUFFIX__
6#define __INT16_C_SUFFIX__
7#define __INT32_C_SUFFIX__
8#define __INT64_C_SUFFIX__ LL
9
10#define __UINT8_C_SUFFIX__
11#define __UINT16_C_SUFFIX__
12#define __UINT32_C_SUFFIX__
13#define __UINT64_C_SUFFIX__ ULL
14
15#define __INTMAX_C_SUFFIX__ LL
16#define __UINTMAX_C_SUFFIX__ ULL
17
18#endif
19
20#include <sys/common_int_const.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/int_fmtio.h deleted-381
...@@ -1,381 +0,0 @@
1/* $NetBSD: int_fmtio.h,v 1.4 2019/04/17 11:01:19 mrg Exp $ */
2
3/*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_INT_FMTIO_H_
33#define _RISCV_INT_FMTIO_H_
34
35#ifdef __INTPTR_FMTd__
36#include <sys/common_int_fmtio.h>
37#else
38/*
39 * 7.8.1 Macros for format specifiers
40 */
41
42/* fprintf macros for signed integers */
43#define PRId8 "hhd" /* int8_t */
44#define PRId16 "hd" /* int16_t */
45#define PRId32 "d" /* int32_t */
46#ifdef _LP64
47#define PRId64 "ld" /* int64_t */
48#else
49#define PRId64 "lld" /* int64_t */
50#endif
51#define PRIdLEAST8 "hhd" /* int_least8_t */
52#define PRIdLEAST16 "hd" /* int_least16_t */
53#define PRIdLEAST32 "d" /* int_least32_t */
54#ifdef _LP64
55#define PRIdLEAST64 "ld" /* int_least64_t */
56#define PRIdFAST8 "d" /* int_fast8_t */
57#define PRIdFAST16 "d" /* int_fast16_t */
58#else
59#define PRIdLEAST64 "lld" /* int_least64_t */
60#define PRIdFAST8 "hhd" /* int_fast8_t */
61#define PRIdFAST16 "hd" /* int_fast16_t */
62#endif
63#define PRIdFAST32 "d" /* int_fast32_t */
64#ifdef _LP64
65#define PRIdFAST64 "ld" /* int_fast64_t */
66#define PRIdMAX "ld" /* intmax_t */
67#else
68#define PRIdFAST64 "lld" /* int_fast64_t */
69#define PRIdMAX "lld" /* intmax_t */
70#endif
71#define PRIdPTR "ld" /* intptr_t */
72
73#define PRIi8 "hhi" /* int8_t */
74#define PRIi16 "hi" /* int16_t */
75#define PRIi32 "i" /* int32_t */
76#ifdef _LP64
77#define PRIi64 "li" /* int64_t */
78#else
79#define PRIi64 "lli" /* int64_t */
80#endif
81#define PRIiLEAST8 "hhi" /* int_least8_t */
82#define PRIiLEAST16 "hi" /* int_least16_t */
83#define PRIiLEAST32 "i" /* int_least32_t */
84#ifdef _LP64
85#define PRIiLEAST64 "li" /* int_least64_t */
86#define PRIiFAST8 "i" /* int_fast8_t */
87#define PRIiFAST16 "i" /* int_fast16_t */
88#else
89#define PRIiLEAST64 "lli" /* int_least64_t */
90#define PRIiFAST8 "hhi" /* int_fast8_t */
91#define PRIiFAST16 "hi" /* int_fast16_t */
92#endif
93#define PRIiFAST32 "i" /* int_fast32_t */
94#ifdef _LP64
95#define PRIiFAST64 "li" /* int_fast64_t */
96#define PRIiMAX "li" /* intmax_t */
97#else
98#define PRIiFAST64 "lli" /* int_fast64_t */
99#define PRIiMAX "lli" /* intmax_t */
100#endif
101#define PRIiPTR "li" /* intptr_t */
102
103/* fprintf macros for unsigned integers */
104
105#define PRIo8 "hho" /* uint8_t */
106#define PRIo16 "ho" /* uint16_t */
107#define PRIo32 "o" /* uint32_t */
108#ifdef _LP64
109#define PRIo64 "lo" /* uint64_t */
110#else
111#define PRIo64 "llo" /* uint64_t */
112#endif
113#define PRIoLEAST8 "o" /* uint_least8_t */
114#define PRIoLEAST16 "hho" /* uint_least16_t */
115#define PRIoLEAST32 "ho" /* uint_least32_t */
116#ifdef _LP64
117#define PRIoLEAST64 "lo" /* uint_least64_t */
118#define PRIoFAST8 "o" /* uint_fast8_t */
119#define PRIoFAST16 "o" /* uint_fast16_t */
120#else
121#define PRIoLEAST64 "llo" /* uint_least64_t */
122#define PRIoFAST8 "hho" /* uint_fast8_t */
123#define PRIoFAST16 "ho" /* uint_fast16_t */
124#endif
125#define PRIoFAST32 "o" /* uint_fast32_t */
126#ifdef _LP64
127#define PRIoFAST64 "lo" /* uint_fast64_t */
128#define PRIoMAX "lo" /* uintmax_t */
129#else
130#define PRIoFAST64 "llo" /* uint_fast64_t */
131#define PRIoMAX "llo" /* uintmax_t */
132#endif
133#define PRIoPTR "lo" /* uintptr_t */
134
135#define PRIu8 "hhu" /* uint8_t */
136#define PRIu16 "hu" /* uint16_t */
137#define PRIu32 "u" /* uint32_t */
138#ifdef _LP64
139#define PRIu64 "lu" /* uint64_t */
140#else
141#define PRIu64 "llu" /* uint64_t */
142#endif
143#define PRIuLEAST8 "hhu" /* uint_least8_t */
144#define PRIuLEAST16 "hu" /* uint_least16_t */
145#define PRIuLEAST32 "u" /* uint_least32_t */
146#ifdef _LP64
147#define PRIuLEAST64 "lu" /* uint_least64_t */
148#define PRIuFAST8 "u" /* uint_fast8_t */
149#define PRIuFAST16 "u" /* uint_fast16_t */
150#else
151#define PRIuLEAST64 "llu" /* uint_least64_t */
152#define PRIuFAST8 "hhu" /* uint_fast8_t */
153#define PRIuFAST16 "hu" /* uint_fast16_t */
154#endif
155#define PRIuFAST32 "u" /* uint_fast32_t */
156#ifdef _LP64
157#define PRIuFAST64 "lu" /* uint_fast64_t */
158#define PRIuMAX "lu" /* uintmax_t */
159#else
160#define PRIuFAST64 "llu" /* uint_fast64_t */
161#define PRIuMAX "llu" /* uintmax_t */
162#endif
163#define PRIuPTR "lu" /* uintptr_t */
164
165#define PRIx8 "hhx" /* uint8_t */
166#define PRIx16 "hx" /* uint16_t */
167#define PRIx32 "x" /* uint32_t */
168#ifdef _LP64
169#define PRIx64 "lx" /* uint64_t */
170#else
171#define PRIx64 "llx" /* uint64_t */
172#endif
173#define PRIxLEAST8 "x" /* uint_least8_t */
174#define PRIxLEAST16 "x" /* uint_least16_t */
175#define PRIxLEAST32 "x" /* uint_least32_t */
176#ifdef _LP64
177#define PRIxLEAST64 "lx" /* uint_least64_t */
178#define PRIxFAST8 "x" /* uint_fast8_t */
179#define PRIxFAST16 "x" /* uint_fast16_t */
180#else
181#define PRIxLEAST64 "llx" /* uint_least64_t */
182#define PRIxFAST8 "hhx" /* uint_fast8_t */
183#define PRIxFAST16 "hx" /* uint_fast16_t */
184#endif
185#define PRIxFAST32 "x" /* uint_fast32_t */
186#ifdef _LP64
187#define PRIxFAST64 "lx" /* uint_fast64_t */
188#define PRIxMAX "lx" /* uintmax_t */
189#else
190#define PRIxFAST64 "llx" /* uint_fast64_t */
191#define PRIxMAX "llx" /* uintmax_t */
192#endif
193#define PRIxPTR "lx" /* uintptr_t */
194
195#define PRIX8 "hhX" /* uint8_t */
196#define PRIX16 "hX" /* uint16_t */
197#define PRIX32 "X" /* uint32_t */
198#ifdef _LP64
199#define PRIX64 "lX" /* uint64_t */
200#else
201#define PRIX64 "llX" /* uint64_t */
202#endif
203#define PRIXLEAST8 "X" /* uint_least8_t */
204#define PRIXLEAST16 "X" /* uint_least16_t */
205#define PRIXLEAST32 "X" /* uint_least32_t */
206#ifdef _LP64
207#define PRIXLEAST64 "lX" /* uint_least64_t */
208#define PRIXFAST8 "X" /* uint_fast8_t */
209#define PRIXFAST16 "X" /* uint_fast16_t */
210#else
211#define PRIXLEAST64 "llX" /* uint_least64_t */
212#define PRIXFAST8 "hhX" /* uint_fast8_t */
213#define PRIXFAST16 "hX" /* uint_fast16_t */
214#endif
215#define PRIXFAST32 "X" /* uint_fast32_t */
216#ifdef _LP64
217#define PRIXFAST64 "lX" /* uint_fast64_t */
218#define PRIXMAX "lX" /* uintmax_t */
219#else
220#define PRIXFAST64 "llX" /* uint_fast64_t */
221#define PRIXMAX "llX" /* uintmax_t */
222#endif
223#define PRIXPTR "lX" /* uintptr_t */
224
225/* fscanf macros for signed integers */
226
227#define SCNd8 "hhd" /* int8_t */
228#define SCNd16 "hd" /* int16_t */
229#define SCNd32 "d" /* int32_t */
230#ifdef _LP64
231#define SCNd64 "ld" /* int64_t */
232#else
233#define SCNd64 "lld" /* int64_t */
234#endif
235#define SCNdLEAST8 "hhd" /* int_least8_t */
236#define SCNdLEAST16 "hd" /* int_least16_t */
237#define SCNdLEAST32 "d" /* int_least32_t */
238#ifdef _LP64
239#define SCNdLEAST64 "ld" /* int_least64_t */
240#define SCNdFAST8 "d" /* int_fast8_t */
241#define SCNdFAST16 "d" /* int_fast16_t */
242#else
243#define SCNdLEAST64 "lld" /* int_least64_t */
244#define SCNdFAST8 "hhd" /* int_fast8_t */
245#define SCNdFAST16 "hd" /* int_fast16_t */
246#endif
247#define SCNdFAST32 "d" /* int_fast32_t */
248#ifdef _LP64
249#define SCNdFAST64 "ld" /* int_fast64_t */
250#define SCNdMAX "ld" /* intmax_t */
251#else
252#define SCNdFAST64 "lld" /* int_fast64_t */
253#define SCNdMAX "lld" /* intmax_t */
254#endif
255#define SCNdPTR "ld" /* intptr_t */
256
257#define SCNi8 "hhi" /* int8_t */
258#define SCNi16 "hi" /* int16_t */
259#define SCNi32 "i" /* int32_t */
260#ifdef _LP64
261#define SCNi64 "li" /* int64_t */
262#else
263#define SCNi64 "lli" /* int64_t */
264#endif
265#define SCNiLEAST8 "hhi" /* int_least8_t */
266#define SCNiLEAST16 "hi" /* int_least16_t */
267#define SCNiLEAST32 "i" /* int_least32_t */
268#ifdef _LP64
269#define SCNiLEAST64 "li" /* int_least64_t */
270#define SCNiFAST8 "i" /* int_fast8_t */
271#define SCNiFAST16 "i" /* int_fast16_t */
272#else
273#define SCNiLEAST64 "lli" /* int_least64_t */
274#define SCNiFAST8 "hhi" /* int_fast8_t */
275#define SCNiFAST16 "hi" /* int_fast16_t */
276#endif
277#define SCNiFAST32 "i" /* int_fast32_t */
278#ifdef _LP64
279#define SCNiFAST64 "li" /* int_fast64_t */
280#define SCNiMAX "li" /* intmax_t */
281#else
282#define SCNiFAST64 "lli" /* int_fast64_t */
283#define SCNiMAX "lli" /* intmax_t */
284#endif
285#define SCNiPTR "li" /* intptr_t */
286
287/* fscanf macros for unsigned integers */
288
289#define SCNo8 "hho" /* uint8_t */
290#define SCNo16 "ho" /* uint16_t */
291#define SCNo32 "o" /* uint32_t */
292#ifdef _LP64
293#define SCNo64 "lo" /* uint64_t */
294#else
295#define SCNo64 "llo" /* uint64_t */
296#endif
297#define SCNoLEAST8 "hho" /* uint_least8_t */
298#define SCNoLEAST16 "ho" /* uint_least16_t */
299#define SCNoLEAST32 "o" /* uint_least32_t */
300#ifdef _LP64
301#define SCNoLEAST64 "lo" /* uint_least64_t */
302#define SCNoFAST8 "o" /* uint_fast8_t */
303#define SCNoFAST16 "o" /* uint_fast16_t */
304#else
305#define SCNoLEAST64 "llo" /* uint_least64_t */
306#define SCNoFAST8 "hho" /* uint_fast8_t */
307#define SCNoFAST16 "ho" /* uint_fast16_t */
308#endif
309#define SCNoFAST32 "o" /* uint_fast32_t */
310#ifdef _LP64
311#define SCNoFAST64 "lo" /* uint_fast64_t */
312#define SCNoMAX "lo" /* uintmax_t */
313#else
314#define SCNoFAST64 "llo" /* uint_fast64_t */
315#define SCNoMAX "llo" /* uintmax_t */
316#endif
317#define SCNoPTR "lo" /* uintptr_t */
318
319#define SCNu8 "hhu" /* uint8_t */
320#define SCNu16 "hu" /* uint16_t */
321#define SCNu32 "u" /* uint32_t */
322#ifdef _LP64
323#define SCNu64 "lu" /* uint64_t */
324#else
325#define SCNu64 "llu" /* uint64_t */
326#endif
327#define SCNuLEAST8 "hhu" /* uint_least8_t */
328#define SCNuLEAST16 "hu" /* uint_least16_t */
329#define SCNuLEAST32 "u" /* uint_least32_t */
330#ifdef _LP64
331#define SCNuLEAST64 "lu" /* uint_least64_t */
332#define SCNuFAST8 "u" /* uint_fast8_t */
333#define SCNuFAST16 "u" /* uint_fast16_t */
334#else
335#define SCNuLEAST64 "llu" /* uint_least64_t */
336#define SCNuFAST8 "hhu" /* uint_fast8_t */
337#define SCNuFAST16 "hu" /* uint_fast16_t */
338#endif
339#define SCNuFAST32 "u" /* uint_fast32_t */
340#ifdef _LP64
341#define SCNuFAST64 "lu" /* uint_fast64_t */
342#define SCNuMAX "lu" /* uintmax_t */
343#else
344#define SCNuFAST64 "llu" /* uint_fast64_t */
345#define SCNuMAX "llu" /* uintmax_t */
346#endif
347#define SCNuPTR "lu" /* uintptr_t */
348
349#define SCNx8 "hhx" /* uint8_t */
350#define SCNx16 "hx" /* uint16_t */
351#define SCNx32 "x" /* uint32_t */
352#ifdef _LP64
353#define SCNx64 "lx" /* uint64_t */
354#else
355#define SCNx64 "llx" /* uint64_t */
356#endif
357#define SCNxLEAST8 "hhx" /* uint_least8_t */
358#define SCNxLEAST16 "hx" /* uint_least16_t */
359#define SCNxLEAST32 "x" /* uint_least32_t */
360#ifdef _LP64
361#define SCNxLEAST64 "lx" /* uint_least64_t */
362#define SCNxFAST8 "x" /* uint_fast8_t */
363#define SCNxFAST16 "x" /* uint_fast16_t */
364#else
365#define SCNxLEAST64 "llx" /* uint_least64_t */
366#define SCNxFAST8 "hhx" /* uint_fast8_t */
367#define SCNxFAST16 "hx" /* uint_fast16_t */
368#endif
369#define SCNxFAST32 "x" /* uint_fast32_t */
370#ifdef _LP64
371#define SCNxFAST64 "lx" /* uint_fast64_t */
372#define SCNxMAX "lx" /* uintmax_t */
373#else
374#define SCNxFAST64 "llx" /* uint_fast64_t */
375#define SCNxMAX "llx" /* uintmax_t */
376#endif
377#define SCNxPTR "lx" /* uintptr_t */
378
379#endif /* !__INTPTR_FMTd__ */
380
381#endif /* !_RISCV_INT_FMTIO_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/int_limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_limits.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/int_mwgwtypes.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_mwgwtypes.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_mwgwtypes.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/int_types.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_types.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_types.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/kcore.h deleted-40
...@@ -1,40 +0,0 @@
1/* $NetBSD: kcore.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_KCORE_H_
33#define _RISCV_KCORE_H_
34
35typedef struct cpu_kcore_hdr {
36 uint64_t kh_misc[8];
37 phys_ram_seg_t kh_ramsegs[0];
38} cpu_kcore_hdr_t;
39
40#endif /* _RISCV_KCORE_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_limits.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/lock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: lock.h,v 1.4 2015/06/26 14:27:35 matt Exp $ */
2
3#include <sys/common_lock.h>
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/math.h deleted-4
...@@ -1,4 +0,0 @@
1/* $NetBSD: math.h,v 1.3 2019/04/16 07:40:02 maya Exp $ */
2
3#define __HAVE_NANF
4#define __HAVE_LONG_DOUBLE 128
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/mcontext.h deleted-170
...@@ -1,170 +0,0 @@
1/* $NetBSD: mcontext.h,v 1.6 2020/03/14 16:12:16 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31#ifndef _RISCV_MCONTEXT_H_
32#define _RISCV_MCONTEXT_H_
33
34/*
35 */
36
37#define _NGREG 32 /* GR1-31 */
38#define _NFREG 33 /* F0-31, FCSR */
39
40/*
41 * This fragment is common to <riscv/mcontext.h> and <riscv/reg.h>
42 */
43#ifndef _BSD_FPREG_T_
44union __fpreg {
45 __uint64_t u_u64;
46 double u_d;
47};
48#define _BSD_FPREG_T_ union __fpreg
49#endif
50
51typedef __uint64_t __greg_t;
52typedef __greg_t __gregset_t[_NGREG];
53typedef __uint32_t __greg32_t;
54typedef __greg32_t __gregset32_t[_NGREG];
55typedef _BSD_FPREG_T_ __fregset_t[_NFREG];
56
57#define _REG_X1 0
58#define _REG_X2 1
59#define _REG_X3 2
60#define _REG_X4 3
61#define _REG_X5 4
62#define _REG_X6 5
63#define _REG_X7 6
64#define _REG_X8 7
65#define _REG_X9 8
66#define _REG_X10 9
67#define _REG_X11 10
68#define _REG_X12 11
69#define _REG_X13 12
70#define _REG_X14 13
71#define _REG_X15 14
72#define _REG_X16 15
73#define _REG_X17 16
74#define _REG_X18 17
75#define _REG_X19 18
76#define _REG_X20 19
77#define _REG_X21 20
78#define _REG_X22 21
79#define _REG_X23 22
80#define _REG_X24 23
81#define _REG_X25 24
82#define _REG_X26 25
83#define _REG_X27 26
84#define _REG_X28 27
85#define _REG_X29 28
86#define _REG_X30 29
87#define _REG_X31 30
88#define _REG_PC 31
89
90#define _REG_RA _REG_X1
91#define _REG_SP _REG_X2
92#define _REG_GP _REG_X3
93#define _REG_TP _REG_X4
94#define _REG_S0 _REG_X8
95#define _REG_RV _REG_X10
96#define _REG_A0 _REG_X10
97
98#define _REG_F0 0
99#define _REG_FPCSR 32
100
101typedef struct {
102 __gregset_t __gregs; /* General Purpose Register set */
103 __fregset_t __fregs; /* Floating Point Register set */
104 __greg_t __private; /* copy of l_private */
105 __greg_t __spare[8]; /* future proof */
106} mcontext_t;
107
108typedef struct {
109 __gregset32_t __gregs; /* General Purpose Register set */
110 __fregset_t __fregs; /* Floating Point Register set */
111 __greg32_t __private; /* copy of l_private */
112 __greg32_t __spare[8]; /* future proof */
113} mcontext32_t;
114
115/* Machine-dependent uc_flags */
116#define _UC_SETSTACK 0x00010000 /* see <sys/ucontext.h> */
117#define _UC_CLRSTACK 0x00020000 /* see <sys/ucontext.h> */
118#define _UC_TLSBASE 0x00080000 /* see <sys/ucontext.h> */
119
120#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])
121#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_S0])
122#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC])
123#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RV])
124
125#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
126
127#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || defined(__LIBPTHREAD_SOURCE__)
128#include <sys/tls.h>
129
130/*
131 * On RISCV, since displacements are signed 12-bit values, the TCB pointer is
132 * not and points to the first static entry.
133 */
134#define TLS_TP_OFFSET 0x0
135#define TLS_DTV_OFFSET 0x800
136__CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb) < 0x800);
137
138static __inline void *
139__lwp_getprivate_fast(void)
140{
141 void *__tp;
142 __asm("move %0,tp" : "=r"(__tp));
143 return __tp;
144}
145
146static __inline void *
147__lwp_gettcb_fast(void)
148{
149 void *__tcb;
150
151 __asm __volatile(
152 "addi %[__tcb],tp,%[__offset]"
153 : [__tcb] "=r" (__tcb)
154 : [__offset] "n" (-(TLS_TP_OFFSET + sizeof(struct tls_tcb))));
155
156 return __tcb;
157}
158
159static __inline void
160__lwp_settcb(void *__tcb)
161{
162 __asm __volatile(
163 "addi tp,%[__tcb],%[__offset]"
164 :
165 : [__tcb] "r" (__tcb),
166 [__offset] "n" (TLS_TP_OFFSET + sizeof(struct tls_tcb)));
167}
168#endif /* _RTLD_SOURCE || _LIBC_SOURCE || __LIBPTHREAD_SOURCE__ */
169
170#endif /* !_RISCV_MCONTEXT_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/mutex.h deleted-124
...@@ -1,124 +0,0 @@
1/* $NetBSD: mutex.h,v 1.4.4.1 2023/08/09 17:42:03 martin Exp $ */
2
3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe and Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_MUTEX_H_
33#define _RISCV_MUTEX_H_
34
35#include <sys/types.h>
36
37#ifndef __MUTEX_PRIVATE
38
39struct kmutex {
40 uintptr_t mtx_pad1;
41};
42
43#else /* __MUTEX_PRIVATE */
44
45#include <sys/cdefs.h>
46
47#include <sys/param.h>
48
49#include <machine/intr.h>
50
51struct kmutex {
52 volatile uintptr_t mtx_owner;
53};
54
55#ifdef _LP64
56#define MTX_ASMOP_SFX ".d" // doubleword atomic op
57#else
58#define MTX_ASMOP_SFX ".w" // word atomic op
59#endif
60
61#define MTX_LOCK __BIT(8) // just one bit
62#define MTX_IPL __BITS(7,4) // only need 4 bits
63
64#undef MUTEX_SPIN_IPL // override <sys/mutex.h>
65#define MUTEX_SPIN_IPL(a) riscv_mutex_spin_ipl(a)
66#define MUTEX_INITIALIZE_SPIN_IPL(a,b) riscv_mutex_initialize_spin_ipl(a,b)
67#define MUTEX_SPINBIT_LOCK_INIT(a) riscv_mutex_spinbit_lock_init(a)
68#define MUTEX_SPINBIT_LOCK_TRY(a) riscv_mutex_spinbit_lock_try(a)
69#define MUTEX_SPINBIT_LOCKED_P(a) riscv_mutex_spinbit_locked_p(a)
70#define MUTEX_SPINBIT_LOCK_UNLOCK(a) riscv_mutex_spinbit_lock_unlock(a)
71
72static inline ipl_cookie_t
73riscv_mutex_spin_ipl(kmutex_t *__mtx)
74{
75 return (ipl_cookie_t){._spl = __SHIFTOUT(__mtx->mtx_owner, MTX_IPL)};
76}
77
78static inline void
79riscv_mutex_initialize_spin_ipl(kmutex_t *__mtx, int ipl)
80{
81 __mtx->mtx_owner = (__mtx->mtx_owner & ~MTX_IPL)
82 | __SHIFTIN(ipl, MTX_IPL);
83}
84
85static inline void
86riscv_mutex_spinbit_lock_init(kmutex_t *__mtx)
87{
88 __mtx->mtx_owner &= ~MTX_LOCK;
89}
90
91static inline bool
92riscv_mutex_spinbit_locked_p(const kmutex_t *__mtx)
93{
94 return (__mtx->mtx_owner & MTX_LOCK) != 0;
95}
96
97static inline bool
98riscv_mutex_spinbit_lock_try(kmutex_t *__mtx)
99{
100 uintptr_t __old;
101 __asm __volatile(
102 "amoor" MTX_ASMOP_SFX ".aq\t%0, %1, (%2)"
103 : "=r"(__old)
104 : "r"(MTX_LOCK), "r"(__mtx));
105 return (__old & MTX_LOCK) == 0;
106}
107
108static inline void
109riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx)
110{
111 __asm __volatile(
112 "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)"
113 :: "r"(~MTX_LOCK), "r"(__mtx));
114}
115
116#if 0
117#define __HAVE_MUTEX_STUBS 1
118#define __HAVE_SPIN_MUTEX_STUBS 1
119#endif
120#define __HAVE_SIMPLE_MUTEXES 1
121
122#endif /* __MUTEX_PRIVATE */
123
124#endif /* _RISCV_MUTEX_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/param.h deleted-106
...@@ -1,106 +0,0 @@
1/* $NetBSD: param.h,v 1.7 2022/10/12 07:50:00 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PARAM_H_
33#define _RISCV_PARAM_H_
34
35#ifdef _KERNEL_OPT
36#include "opt_param.h"
37#endif
38
39/*
40 * Machine dependent constants for all OpenRISC processors
41 */
42
43/*
44 * For KERNEL code:
45 * MACHINE must be defined by the individual port. This is so that
46 * uname returns the correct thing, etc.
47 *
48 * For non-KERNEL code:
49 * If ELF, MACHINE and MACHINE_ARCH are forced to "or1k/or1k".
50 */
51
52#ifdef _LP64
53#define _MACHINE_ARCH riscv64
54#define MACHINE_ARCH "riscv64"
55#define _MACHINE_ARCH32 riscv32
56#define MACHINE_ARCH32 "riscv32"
57#else
58#define _MACHINE_ARCH riscv32
59#define MACHINE_ARCH "riscv32"
60#endif
61#define _MACHINE riscv
62#define MACHINE "riscv"
63
64#define MID_MACHINE MID_RISCV
65
66/* RISCV-specific macro to align a stack pointer (downwards). */
67#define STACK_ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1)
68#define ALIGNBYTES32 __BIGGEST_ALIGNMENT__
69
70#define NKMEMPAGES_MIN_DEFAULT ((128UL * 1024 * 1024) >> PAGE_SHIFT)
71#define NKMEMPAGES_MAX_UNLIMITED 1
72
73#define PGSHIFT 12
74#define NBPG (1 << PGSHIFT)
75#define PGOFSET (NBPG - 1)
76
77#define UPAGES 2
78#define USPACE (UPAGES << PGSHIFT)
79#define USPACE_ALIGN NBPG
80
81/*
82 * Constants related to network buffer management.
83 * MCLBYTES must be no larger than NBPG (the software page size), and
84 * NBPG % MCLBYTES must be zero.
85 */
86#define MSIZE 512 /* size of an mbuf */
87
88#ifndef MCLSHIFT
89#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
90 /* 2K cluster can hold Ether frame */
91#endif /* MCLSHIFT */
92
93#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
94
95#ifndef MSGBUFSIZE
96#define MSGBUFSIZE 65536 /* default message buffer size */
97#endif
98
99#define MAXCPUS 32
100
101#ifdef _KERNEL
102void delay(unsigned long);
103#define DELAY(x) delay(x)
104#endif
105
106#endif /* _RISCV_PARAM_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/pcb.h deleted-46
...@@ -1,46 +0,0 @@
1/* $NetBSD: pcb.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PCB_H_
33#define _RISCV_PCB_H_
34
35#include <riscv/reg.h>
36
37struct pcb {
38 struct fpreg pcb_fpregs;
39};
40
41struct md_coredump {
42 struct reg reg;
43 struct fpreg fpreg;
44};
45
46#endif /* _RISCV_PCB_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/pmap.h deleted-213
...@@ -1,213 +0,0 @@
1/* $NetBSD: pmap.h,v 1.13 2022/10/20 07:18:11 skrll Exp $ */
2
3/*
4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas (of 3am Software Foundry), Maxime Villard, and
9 * Nick Hudson.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef _RISCV_PMAP_H_
34#define _RISCV_PMAP_H_
35
36#ifdef _KERNEL_OPT
37#include "opt_modular.h"
38#endif
39
40#if !defined(_MODULE)
41
42#include <sys/cdefs.h>
43#include <sys/types.h>
44#include <sys/pool.h>
45#include <sys/evcnt.h>
46
47#include <uvm/uvm_physseg.h>
48#include <uvm/pmap/vmpagemd.h>
49
50#include <riscv/pte.h>
51#include <riscv/sysreg.h>
52
53#define PMAP_SEGTABSIZE NPTEPG
54#define PMAP_PDETABSIZE NPTEPG
55
56#ifdef _LP64
57#define PTPSHIFT 3
58/* This is SV48. */
59//#define SEGLENGTH + SEGSHIFT + SEGSHIFT */
60
61/* This is SV39. */
62#define XSEGSHIFT (SEGSHIFT + SEGLENGTH)
63#define NBXSEG (1ULL << XSEGSHIFT)
64#define XSEGOFSET (NBXSEG - 1) /* byte offset into xsegment */
65#define XSEGLENGTH (PGSHIFT - 3)
66#define NXSEGPG (1 << XSEGLENGTH)
67#else
68#define PTPSHIFT 2
69#define XSEGSHIFT SEGSHIFT
70#endif
71
72#define SEGLENGTH (PGSHIFT - PTPSHIFT)
73#define SEGSHIFT (SEGLENGTH + PGSHIFT)
74#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
75#define SEGOFSET (NBSEG - 1) /* byte offset into segment */
76
77#define KERNEL_PID 0
78
79#define PMAP_HWPAGEWALKER 1
80#define PMAP_TLB_MAX 1
81#ifdef _LP64
82#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
83#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
84#else
85#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)0xdeadbeef)
86#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)0xdeadbeef)
87#endif
88#define PMAP_TLB_NUM_PIDS (__SHIFTOUT_MASK(SATP_ASID) + 1)
89#define PMAP_TLB_BITMAP_LENGTH PMAP_TLB_NUM_PIDS
90#define PMAP_TLB_FLUSH_ASID_ON_RESET false
91
92#define pmap_phys_address(x) (x)
93
94#ifndef __BSD_PTENTRY_T__
95#define __BSD_PTENTRY_T__
96#ifdef _LP64
97#define PRIxPTE PRIx64
98#else
99#define PRIxPTE PRIx32
100#endif
101#endif /* __BSD_PTENTRY_T__ */
102
103#define PMAP_NEED_PROCWR
104static inline void
105pmap_procwr(struct proc *p, vaddr_t va, vsize_t len)
106{
107 __asm __volatile("fence\trw,rw; fence.i" ::: "memory");
108}
109
110#include <uvm/pmap/tlb.h>
111#include <uvm/pmap/pmap_tlb.h>
112
113#define PMAP_GROWKERNEL
114#define PMAP_STEAL_MEMORY
115
116#ifdef _KERNEL
117
118#define __HAVE_PMAP_MD
119struct pmap_md {
120 paddr_t md_ppn;
121 pd_entry_t *md_pdetab;
122};
123
124struct vm_page *
125 pmap_md_alloc_poolpage(int flags);
126vaddr_t pmap_md_map_poolpage(paddr_t, vsize_t);
127void pmap_md_unmap_poolpage(vaddr_t, vsize_t);
128bool pmap_md_direct_mapped_vaddr_p(vaddr_t);
129bool pmap_md_io_vaddr_p(vaddr_t);
130paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t);
131vaddr_t pmap_md_direct_map_paddr(paddr_t);
132void pmap_md_init(void);
133
134void pmap_md_xtab_activate(struct pmap *, struct lwp *);
135void pmap_md_xtab_deactivate(struct pmap *);
136void pmap_md_pdetab_init(struct pmap *);
137bool pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t);
138
139void pmap_bootstrap(vaddr_t kstart, vaddr_t kend);
140
141extern vaddr_t pmap_direct_base;
142extern vaddr_t pmap_direct_end;
143#define PMAP_DIRECT_MAP(pa) (pmap_direct_base + (pa))
144#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base)
145
146#define MEGAPAGE_TRUNC(x) ((x) & ~SEGOFSET)
147#define MEGAPAGE_ROUND(x) MEGAPAGE_TRUNC((x) + SEGOFSET)
148
149#ifdef __PMAP_PRIVATE
150
151static inline bool
152pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte)
153{
154 // TLB not walked and so not called.
155 return false;
156}
157
158static inline void
159pmap_md_page_syncicache(struct vm_page_md *mdpg, const kcpuset_t *kc)
160{
161 __asm __volatile("fence\trw,rw; fence.i" ::: "memory");
162}
163
164/*
165 * Virtual Cache Alias helper routines. Not a problem for RISCV CPUs.
166 */
167static inline bool
168pmap_md_vca_add(struct vm_page_md *mdpg, vaddr_t va, pt_entry_t *nptep)
169{
170 return false;
171}
172
173static inline void
174pmap_md_vca_remove(struct vm_page_md *mdpg, vaddr_t va)
175{
176}
177
178static inline void
179pmap_md_vca_clean(struct vm_page_md *mdpg, vaddr_t va, int op)
180{
181}
182
183static inline size_t
184pmap_md_tlb_asid_max(void)
185{
186 return PMAP_TLB_NUM_PIDS - 1;
187}
188
189#endif /* __PMAP_PRIVATE */
190#endif /* _KERNEL */
191
192#include <uvm/pmap/pmap.h>
193
194#endif /* !_MODULE */
195
196#if defined(MODULAR) || defined(_MODULE)
197/*
198 * Define a compatible vm_page_md so that struct vm_page is the same size
199 * whether we are using modules or not.
200 */
201#ifndef __HAVE_VM_PAGE_MD
202#define __HAVE_VM_PAGE_MD
203
204struct vm_page_md {
205 uintptr_t mdpg_dummy[3];
206};
207__CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*3);
208
209#endif /* !__HAVE_VM_PAGE_MD */
210
211#endif /* MODULAR || _MODULE */
212
213#endif /* !_RISCV_PMAP_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/proc.h deleted-71
...@@ -1,71 +0,0 @@
1/* $NetBSD: proc.h,v 1.3 2015/03/31 06:47:47 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PROC_H_
33#define _RISCV_PROC_H_
34
35#include <sys/param.h>
36#include <riscv/vmparam.h>
37
38struct lwp;
39
40/*
41 * Machine-dependent part of the lwp structure for RISCV
42 */
43struct trapframe;
44
45struct mdlwp {
46 struct trapframe *md_utf; /* trapframe from userspace */
47 struct trapframe *md_ktf; /* trapframe from userspace */
48 struct faultbuf *md_onfault; /* registers to store on fault */
49 register_t md_usp; /* for locore.S */
50 vaddr_t md_ss_addr; /* single step address for ptrace */
51 int md_ss_instr; /* single step instruction for ptrace */
52 volatile int md_astpending; /* AST pending on return to userland */
53#if 0
54#if USPACE > PAGE_SIZE
55 int md_upte[USPACE/4096]; /* ptes for mapping u page */
56#else
57 int md_dpte[USPACE/4096]; /* dummy ptes to keep the same */
58#endif
59#endif
60};
61
62struct mdproc {
63 /* syscall entry for this process */
64 void (*md_syscall)(struct trapframe *);
65};
66
67#ifdef _KERNEL
68#define LWP0_CPU_INFO &cpu_info_store /* staticly set in lwp0 */
69#endif /* _KERNEL */
70
71#endif /* _RISCV_PROC_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/profile.h deleted-91
...@@ -1,91 +0,0 @@
1/* $NetBSD: profile.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PROFILE_H_
33#define _RISCV_PROFILE_H_
34
35#define _MCOUNT_DECL void _mcount
36
37/*
38 * Cannot implement mcount in C as GCC will trash the ip register when it
39 * pushes a trapframe. Pity we cannot insert assembly before the function
40 * prologue.
41 */
42
43#define MCOUNT_ASM_NAME "__mcount"
44#define PLTSYM
45
46#if 0
47#define MCOUNT \
48 __asm(".text"); \
49 __asm(".align 0"); \
50 __asm(".type " MCOUNT_ASM_NAME ",@function"); \
51 __asm(".global " MCOUNT_ASM_NAME); \
52 __asm(MCOUNT_ASM_NAME ":"); \
53 /* \
54 * Preserve registers that are trashed during mcount \
55 */ \
56 __asm("sub sp, sp, #80"); \
57 __asm("stp x29, x30, [sp, #64]"); \
58 __asm("add x29, sp, #64"); \
59 __asm("stp x0, x1, [x29, #0]"); \
60 __asm("stp x2, x3, [x29, #16]"); \
61 __asm("stp x4, x5, [x29, #32]"); \
62 __asm("stp x6, x7, [x29, #48]"); \
63 /* \
64 * find the return address for mcount, \
65 * and the return address for mcount's caller. \
66 * \
67 * frompcindex = pc pushed by call into self. \
68 */ \
69 __asm("mov x0, x19"); \
70 /* \
71 * selfpc = pc pushed by mcount call \
72 */ \
73 __asm("mov x1, x30"); \
74 /* \
75 * Call the real mcount code \
76 */ \
77 __asm("bl " ___STRING(_C_LABEL(_mcount))); \
78 /* \
79 * Restore registers that were trashed during mcount \
80 */ \
81 __asm("ldp x0, x1, [x29, #0]"); \
82 __asm("ldp x2, x3, [x29, #16]"); \
83 __asm("ldp x4, x5, [x29, #32]"); \
84 __asm("ldp x6, x7, [x29, #48]"); \
85 __asm("ldp x29, x30, [x29, #64]"); \
86 __asm("add sp, sp, #80"); \
87 __asm("ret"); \
88 __asm(".size " MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME);
89#endif
90
91#endif /* _RISCV_PROFILE_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/ptrace.h deleted-57
...@@ -1,57 +0,0 @@
1/* $NetBSD: ptrace.h,v 1.3 2019/06/18 21:18:12 kamil Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PTRACE_H_
33#define _RISCV_PTRACE_H_
34
35/*
36 * RISCV-dependent ptrace definitions.
37 * Note that PT_STEP is _not_ supported.
38 */
39#define PT_GETREGS (PT_FIRSTMACH + 0)
40#define PT_SETREGS (PT_FIRSTMACH + 1)
41#define PT_GETFPREGS (PT_FIRSTMACH + 2)
42#define PT_SETFPREGS (PT_FIRSTMACH + 3)
43
44#define PT_MACHDEP_STRINGS \
45 "PT_GETREGS", \
46 "PT_SETREGS", \
47 "PT_GETFPREGS", \
48 "PT_SETFPREGS"
49
50#include <machine/reg.h>
51#define PTRACE_REG_PC(r) (r)->r_pc
52#define PTRACE_REG_FP(r) (r)->r_reg[7]
53#define PTRACE_REG_SET_PC(r, v) (r)->r_pc = (v)
54#define PTRACE_REG_SP(r) (r)->r_reg[1]
55#define PTRACE_REG_INTRV(r) (r)->r_reg[9]
56
57#endif /* _RISCV_PTRACE_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/reg.h deleted-125
...@@ -1,125 +0,0 @@
1/* $NetBSD: reg.h,v 1.10 2022/12/13 22:25:08 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_REG_H_
33#define _RISCV_REG_H_
34
35// x0 = 0
36// x1 = ra (return address) Caller
37// x2 = sp (stack pointer) Callee
38// x3 = gp (global pointer)
39// x4 = tp (thread pointer)
40// x5 - x7 = t0 - t2 (temporary) Caller
41// x8 = s0/fp (saved register / frame pointer) Callee
42// x9 = s1 (saved register) Callee
43// x10 - x11 = a0 - a1 (arguments/return values) Caller
44// x12 - x17 = a2 - a7 (arguments) Caller
45// x18 - x27 = s2 - s11 (saved registers) Callee
46// x28 - x31 = t3 - t6 (temporaries) Caller
47
48struct reg { // synced with register_t in <riscv/types.h>
49#ifdef _LP64
50 __uint64_t r_reg[31]; /* x0 is always 0 */
51 __uint64_t r_pc;
52#else
53 __uint32_t r_reg[31]; /* x0 is always 0 */
54 __uint32_t r_pc;
55#endif
56};
57
58#ifdef _LP64
59struct reg32 { // synced with register_t in <riscv/types.h>
60 __uint32_t r_reg[31]; /* x0 is always 0 */
61 __uint32_t r_pc;
62};
63#endif
64
65#define _XREG(n) ((n) - 1)
66#define _X_RA _XREG(1)
67#define _X_SP _XREG(2)
68#define _X_GP _XREG(3)
69#define _X_TP _XREG(4)
70#define _X_T0 _XREG(5)
71#define _X_T1 _XREG(6)
72#define _X_T2 _XREG(7)
73#define _X_S0 _XREG(8)
74#define _X_S1 _XREG(9)
75#define _X_A0 _XREG(10)
76#define _X_A1 _XREG(11)
77#define _X_A2 _XREG(12)
78#define _X_A3 _XREG(13)
79#define _X_A4 _XREG(14)
80#define _X_A5 _XREG(15)
81#define _X_A6 _XREG(16)
82#define _X_A7 _XREG(17)
83#define _X_S2 _XREG(18)
84#define _X_S3 _XREG(19)
85#define _X_S4 _XREG(20)
86#define _X_S5 _XREG(21)
87#define _X_S6 _XREG(22)
88#define _X_S7 _XREG(23)
89#define _X_S8 _XREG(24)
90#define _X_S9 _XREG(25)
91#define _X_S10 _XREG(26)
92#define _X_S11 _XREG(27)
93#define _X_T3 _XREG(28)
94#define _X_T4 _XREG(29)
95#define _X_T5 _XREG(30)
96#define _X_T6 _XREG(31)
97
98// f0 - f7 = ft0 - ft7 (FP temporaries) Caller
99// following layout is similar to integer registers above
100// f8 - f9 = fs0 - fs1 (FP saved registers) Callee
101// f10 - f11 = fa0 - fa1 (FP arguments/return values) Caller
102// f12 - f17 = fa2 - fa7 (FP arguments) Caller
103// f18 - f27 = fs2 - fa11 (FP saved registers) Callee
104// f28 - f31 = ft8 - ft11 (FP temporaries) Caller
105
106/*
107 * This fragment is common to <riscv/mcontext.h> and <riscv/reg.h>
108 */
109#ifndef _BSD_FPREG_T_
110union __fpreg {
111 __uint64_t u_u64;
112 double u_d;
113};
114#define _BSD_FPREG_T_ union __fpreg
115#endif
116
117/*
118 * 32 double precision floating point, 1 CSR
119 */
120struct fpreg {
121 _BSD_FPREG_T_ r_fpreg[33];
122};
123#define r_fcsr r_fpreg[32].u_u64
124
125#endif /* _RISCV_REG_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/rwlock.h deleted-1
...@@ -1 +0,0 @@
1/* $NetBSD: rwlock.h,v 1.2 2019/11/29 20:04:53 riastradh Exp $ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/setjmp.h deleted-70
...@@ -1,70 +0,0 @@
1/* $NetBSD: setjmp.h,v 1.2 2015/03/27 06:57:21 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /* magic + 16 reg + 1 fcsr + 12 fp + 4 sigmask + 8 spare */
33#define _JBLEN (_JB_SIGMASK + 4 + 8)
34#define _JB_MAGIC 0
35#define _JB_RA 1
36#define _JB_SP 2
37#define _JB_GP 3
38#define _JB_TP 4
39#define _JB_S0 5
40#define _JB_S1 6
41#define _JB_S2 7
42#define _JB_S3 8
43#define _JB_S4 9
44#define _JB_S5 10
45#define _JB_S6 11
46#define _JB_S7 12
47#define _JB_S8 13
48#define _JB_S9 14
49#define _JB_S10 15
50#define _JB_S11 16
51#define _JB_FCSR 17
52
53#define _JB_FS0 18
54#define _JB_FS1 (_JB_FS0 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
55#define _JB_FS2 (_JB_FS1 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
56#define _JB_FS3 (_JB_FS2 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
57#define _JB_FS4 (_JB_FS3 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
58#define _JB_FS5 (_JB_FS4 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
59#define _JB_FS6 (_JB_FS5 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
60#define _JB_FS7 (_JB_FS6 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
61#define _JB_FS8 (_JB_FS7 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
62#define _JB_FS9 (_JB_FS8 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
63#define _JB_FS10 (_JB_FS9 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
64#define _JB_FS11 (_JB_FS10 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
65
66#define _JB_SIGMASK (_JB_FS11 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
67
68#ifndef _BSD_JBSLOT_T_
69#define _BSD_JBSLOT_T_ long long
70#endif
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/signal.h deleted-39
...@@ -1,39 +0,0 @@
1/* $NetBSD: signal.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_SIGNAL_H_
33#define _RISCV_SIGNAL_H_
34
35#ifndef _LOCORE
36typedef __SIG_ATOMIC_TYPE__ sig_atomic_t;
37#endif
38
39#endif /* _RISCV_SIGNAL_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/types.h deleted-116
...@@ -1,116 +0,0 @@
1/* $NetBSD: types.h,v 1.15 2022/11/08 13:34:17 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_TYPES_H_
33#define _RISCV_TYPES_H_
34
35#include <sys/cdefs.h>
36#include <sys/featuretest.h>
37#include <riscv/int_types.h>
38
39#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
40
41/* XLEN is the native base integer ISA width */
42#define XLEN (sizeof(long) * NBBY)
43
44typedef __uint64_t paddr_t;
45typedef __uint64_t psize_t;
46#define PRIxPADDR PRIx64
47#define PRIxPSIZE PRIx64
48#define PRIuPSIZE PRIu64
49
50typedef __UINTPTR_TYPE__ vaddr_t;
51typedef __UINTPTR_TYPE__ vsize_t;
52#define PRIxVADDR PRIxPTR
53#define PRIxVSIZE PRIxPTR
54#define PRIuVSIZE PRIuPTR
55
56#ifdef _LP64 // match <riscv/reg.h>
57#define PRIxREGISTER PRIx64
58typedef __int64_t register_t;
59typedef __uint64_t uregister_t;
60#else
61#define PRIxREGISTER PRIx32
62typedef __int32_t register_t;
63typedef __uint32_t uregister_t;
64#endif
65typedef signed int register32_t;
66typedef unsigned int uregister32_t;
67#define PRIxREGISTER32 "x"
68
69typedef unsigned int tlb_asid_t;
70#endif
71
72#if defined(_KERNEL)
73typedef struct label_t { /* Used by setjmp & longjmp */
74 register_t lb_reg[16]; /* */
75 __uint32_t lb_sr;
76} label_t;
77#endif
78
79typedef unsigned int __cpu_simple_lock_nv_t;
80#ifdef _LP64
81typedef __int64_t __register_t;
82#else
83typedef __int32_t __register_t;
84#endif
85
86#define __SIMPLELOCK_LOCKED 1
87#define __SIMPLELOCK_UNLOCKED 0
88
89#define __HAVE_COMMON___TLS_GET_ADDR
90#define __HAVE_COMPAT_NETBSD32
91#define __HAVE_CPU_COUNTER
92#define __HAVE_CPU_DATA_FIRST
93#define __HAVE_FAST_SOFTINTS
94#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
95#define __HAVE_NEW_STYLE_BUS_H
96#define __HAVE_SYSCALL_INTERN
97#define __HAVE_TLS_VARIANT_I
98/* XXX temporary */
99#define __HAVE_UNLOCKED_PMAP
100#define __HAVE___LWP_GETPRIVATE_FAST
101
102#ifdef __LP64
103#define __HAVE_ATOMIC64_OPS
104#define __HAVE_CPU_UAREA_ROUTINES
105#endif
106
107//#if defined(_KERNEL)
108//#define __HAVE_RAS
109//#endif
110
111#if defined(_KERNEL) || defined(_KMEMUSER)
112#define PCU_FPU 0
113#define PCU_UNIT_COUNT 1
114#endif
115
116#endif /* _RISCV_TYPES_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/vmparam.h deleted-203
...@@ -1,203 +0,0 @@
1/* $NetBSD: vmparam.h,v 1.13 2022/10/16 06:14:53 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry, and Nick Hudson.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_VMPARAM_H_
33#define _RISCV_VMPARAM_H_
34
35#include <riscv/param.h>
36
37#ifdef _KERNEL_OPT
38#include "opt_multiprocessor.h"
39#endif
40
41/*
42 * Machine dependent VM constants for RISCV.
43 */
44
45/*
46 * We use a 4K page on both RV64 and RV32 systems.
47 * Override PAGE_* definitions to compile-time constants.
48 */
49#define PAGE_SHIFT PGSHIFT
50#define PAGE_SIZE (1 << PAGE_SHIFT)
51#define PAGE_MASK (PAGE_SIZE - 1)
52
53/*
54 * USRSTACK is the top (end) of the user stack.
55 *
56 * USRSTACK needs to start a page below the maxuser address so that a memory
57 * access with a maximum displacement (0x7ff) won't cross into the kernel's
58 * address space. We use PAGE_SIZE instead of 0x800 since these need to be
59 * page-aligned.
60 */
61#define USRSTACK (VM_MAXUSER_ADDRESS-PAGE_SIZE) /* Start of user stack */
62#define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS32-PAGE_SIZE)
63
64/*
65 * Virtual memory related constants, all in bytes
66 */
67#ifndef MAXTSIZ
68#define MAXTSIZ (128*1024*1024) /* max text size */
69#endif
70#ifndef DFLDSIZ
71#define DFLDSIZ (256*1024*1024) /* initial data size limit */
72#endif
73#ifndef MAXDSIZ
74#define MAXDSIZ (1536*1024*1024) /* max data size */
75#endif
76#ifndef DFLSSIZ
77#define DFLSSIZ (4*1024*1024) /* initial stack size limit */
78#endif
79#ifndef MAXSSIZ
80#define MAXSSIZ (120*1024*1024) /* max stack size */
81#endif
82
83/*
84 * Virtual memory related constants, all in bytes
85 */
86#ifndef DFLDSIZ32
87#define DFLDSIZ32 DFLDSIZ /* initial data size limit */
88#endif
89#ifndef MAXDSIZ32
90#define MAXDSIZ32 MAXDSIZ /* max data size */
91#endif
92#ifndef DFLSSIZ32
93#define DFLSSIZ32 DFLTSIZ /* initial stack size limit */
94#endif
95#ifndef MAXSSIZ32
96#define MAXSSIZ32 MAXSSIZ /* max stack size */
97#endif
98
99/*
100 * PTEs for mapping user space into the kernel for phyio operations.
101 * The default PTE number is enough to cover 8 disks * MAXBSIZE.
102 */
103#ifndef USRIOSIZE
104#define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8)
105#endif
106
107/*
108 * User/kernel map constants.
109 */
110#define VM_MIN_ADDRESS ((vaddr_t)0x00000000)
111#ifdef _LP64 /* Sv39 / Sv48 / Sv57 */
112/*
113 * kernel virtual space layout:
114 * 0xffff_ffc0_0000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss)
115 * (0xffff_ffc0_4000_0000 +1GiB) KERNEL VM start of KVA
116 * (0xffff_ffd0_0000_0000 64GiB) reserved
117 * 0xffff_ffe0_0000_0000 - 128GiB direct mapping
118 */
119#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000004000000000 - 16 * PAGE_SIZE)
120#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffc000000000)
121#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)
122
123#else /* Sv32 */
124#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */
125#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */
126#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xffffffffc0000000 */
127
128#endif
129#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS
130#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */
131#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)
132#define VM_KERNEL_DTB_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */
133#define VM_KERNEL_IO_BASE (VM_KERNEL_DTB_BASE + VM_KERNEL_DTB_SIZE)
134#define VM_KERNEL_IO_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */
135
136#define VM_KERNEL_RESERVED (VM_KERNEL_SIZE + VM_KERNEL_DTB_SIZE + VM_KERNEL_IO_SIZE)
137
138#define VM_KERNEL_VM_BASE (VM_MIN_KERNEL_ADDRESS + VM_KERNEL_RESERVED)
139#define VM_KERNEL_VM_SIZE (VM_MAX_KERNEL_ADDRESS - VM_KERNEL_VM_BASE)
140
141#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
142#define VM_MAXUSER_ADDRESS32 ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */
143
144#ifdef _LP64
145/*
146 * Since we have the address space, we map all of physical memory (RAM)
147 * using gigapages on SV39, terapages on SV48 and petapages on SV57.
148 */
149#define RISCV_DIRECTMAP_MASK ((vaddr_t) 0xffffffe000000000L)
150#define RISCV_DIRECTMAP_SIZE (-RISCV_DIRECTMAP_MASK - PAGE_SIZE) /* 128GiB */
151#define RISCV_DIRECTMAP_START RISCV_DIRECTMAP_MASK
152#define RISCV_DIRECTMAP_END (RISCV_DIRECTMAP_START + RISCV_DIRECTMAP_SIZE)
153#define RISCV_KVA_P(va) (((vaddr_t) (va) & RISCV_DIRECTMAP_MASK) != 0)
154#define RISCV_PA_TO_KVA(pa) ((vaddr_t) ((pa) | RISCV_DIRECTMAP_START))
155#define RISCV_KVA_TO_PA(va) ((paddr_t) ((va) & ~RISCV_DIRECTMAP_MASK))
156#endif
157
158/*
159 * The address to which unspecified mapping requests default
160 */
161#define __USE_TOPDOWN_VM
162
163#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \
164 trunc_page(USRSTACK - MAXSSIZ - (sz) - user_stack_guard_size)
165#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \
166 round_page((vaddr_t)(da) + (vsize_t)maxdmap)
167
168#define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \
169 trunc_page(USRSTACK32 - MAXSSIZ32 - (sz) - user_stack_guard_size)
170#define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \
171 round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32)
172
173/* virtual sizes (bytes) for various kernel submaps */
174#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
175
176/* VM_PHYSSEG_MAX defined by platform-dependent code. */
177#ifndef VM_PHYSSEG_MAX
178#define VM_PHYSSEG_MAX 16
179#endif
180#if VM_PHYSSEG_MAX == 1
181#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
182#else
183#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
184#endif
185#define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */
186
187#ifndef VM_NFREELIST
188#define VM_NFREELIST 2 /* 2 distinct memory segments */
189#define VM_FREELIST_DEFAULT 0
190#define VM_FREELIST_DIRECTMAP 1
191#endif
192
193#ifdef _KERNEL
194#define UVM_KM_VMFREELIST riscv_poolpage_vmfreelist
195extern int riscv_poolpage_vmfreelist;
196
197#ifdef _LP64
198void * cpu_uarea_alloc(bool);
199bool cpu_uarea_free(void *);
200#endif
201#endif
202
203#endif /* ! _RISCV_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/riscv32-netbsd-none/machine/wchar_limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: wchar_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_wchar_limits.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/float.h deleted-58
...@@ -1,58 +0,0 @@
1/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_FLOAT_H_
33#define _RISCV_FLOAT_H_
34
35#include <sys/cdefs.h>
36
37#define LDBL_MANT_DIG __LDBL_MANT_DIG__
38#define LDBL_DIG __LDBL_DIG__
39#define LDBL_MIN_EXP __LDBL_MIN_EXP__
40#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
41#define LDBL_MAX_EXP __LDBL_MAX_EXP__
42#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
43#define LDBL_EPSILON __LDBL_EPSILON__
44#define LDBL_MIN __LDBL_MIN__
45#define LDBL_MAX __LDBL_MAX__
46
47#include <sys/float_ieee754.h>
48
49#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \
50 && !defined(_XOPEN_SOURCE)) \
51 || (__STDC_VERSION__ - 0) >= 199901L \
52 || (_POSIX_C_SOURCE - 0) >= 200112L \
53 || ((_XOPEN_SOURCE - 0) >= 600) \
54 || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
55#define DECIMAL_DIG __DECIMAL_DIG__
56#endif
57
58#endif /* !_RISCV_FLOAT_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/ansi.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: ansi.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_ansi.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/aout_machdep.h deleted-40
...@@ -1,40 +0,0 @@
1/* $NetBSD: aout_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_AOUT_MACHDEP_H_
33#define _RISCV_AOUT_MACHDEP_H_
34
35#define cpu_exec_aout_makecmds(p, epp) ENOEXEC
36
37/* Size of a page in an object file. */
38#define AOUT_LDPGSZ 4096
39
40#endif /* !_RISCV_AOUT_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/asm.h deleted-266
...@@ -1,266 +0,0 @@
1/* $NetBSD: asm.h,v 1.6 2021/05/01 07:05:07 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_ASM_H
33#define _RISCV_ASM_H
34
35#define _C_LABEL(x) x
36
37#define __CONCAT(x,y) x ## y
38#define __STRING(x) #x
39
40#define ___CONCAT(x,y) __CONCAT(x,y)
41
42/*
43 * Define -pg profile entry code.
44 * Must always be noreorder, must never use a macro instruction
45 * Final addiu to t9 must always equal the size of this _KERN_MCOUNT
46 */
47#define _KERN_MCOUNT \
48 .set push; \
49 subi sp, sp, CALLFRAME_SIZE; \
50 REG_S a0, CALLFRAME_S0(sp); \
51 REG_S ra, CALLFRAME_RA(sp); \
52 move a0, ra; \
53 call _mcount \
54 REG_L ra, CALLFRAME_RA(sp); \
55 REG_L a0, CALLFRAME_S0(sp); \
56 addi sp, sp, CALLFRAME_SIZ; \
57 .set pop;
58
59#ifdef GPROF
60#define _PROF_PROLOGUE _KERN_MCOUNT
61#else
62#define _PROF_PROLOGUE
63#endif
64
65#ifdef __PIC__
66#define PLT(x) x##@plt
67#else
68#define PLT(x) x
69#endif
70
71/*
72 * WEAK_ALIAS: create a weak alias.
73 */
74#define WEAK_ALIAS(alias,sym) \
75 .weak alias; \
76 alias = sym
77/*
78 * STRONG_ALIAS: create a strong alias.
79 */
80#define STRONG_ALIAS(alias,sym) \
81 .globl alias; \
82 alias = sym
83
84/*
85 * WARN_REFERENCES: create a warning if the specified symbol is referenced.
86 */
87#define WARN_REFERENCES(sym,msg) \
88 .pushsection __CONCAT(.gnu.warning.,sym); \
89 .ascii msg; \
90 .popsection
91
92#define _ENTRY(x) \
93 .globl _C_LABEL(x); \
94 .type _C_LABEL(x), @function; \
95 _C_LABEL(x):
96
97#define ENTRY_NP(x) .text; .align 2; _ENTRY(x)
98#define ENTRY(x) ENTRY_NP(x); _PROF_PROLOGUE
99#define END(x) .size _C_LABEL(x), . - _C_LABEL(x)
100
101/*
102 * Macros to panic and printf from assembly language.
103 */
104#define PANIC(msg) \
105 la a0, 9f; \
106 call _C_LABEL(panic); \
107 MSG(msg)
108
109#define PRINTF(msg) \
110 la a0, 9f; \
111 call _C_LABEL(printf); \
112 MSG(msg)
113
114#define MSG(msg) \
115 .pushsection .rodata.str1.8,"aMS",@progbits,1; \
1169: .asciiz msg; \
117 .popsection
118
119#define ASMSTR(str) \
120 .asciiz str; \
121 .align 3
122
123#define __RCSID(x) .pushsection ".ident","MS",@progbits,1; \
124 .asciz x; \
125 .popsection
126#define RCSID(name) __RCSID(name)
127
128#if defined(_LP64)
129#define SZREG 8
130#else
131#define SZREG 4
132#endif
133
134#define ALSK 15 /* stack alignment */
135#define ALMASK -15 /* stack alignment */
136#define SZFPREG 8
137#define FP_L fld
138#define FP_S fsd
139
140/*
141 * standard callframe {
142 * register_t cf_sp; frame pointer
143 * register_t cf_ra; return address
144 * };
145 */
146#define CALLFRAME_SIZ (SZREG * 4)
147#define CALLFRAME_S1 (CALLFRAME_SIZ - 4 * SZREG)
148#define CALLFRAME_S0 (CALLFRAME_SIZ - 3 * SZREG)
149#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG)
150#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG)
151
152/*
153 * These macros hide the use of rv32 and rv64 instructions from the
154 * assembler to prevent the assembler from generating 64-bit style
155 * ABI calls.
156 */
157#define PTR_ADD add
158#define PTR_ADDI addi
159#define PTR_SUB sub
160#define PTR_SUBI subi
161#define PTR_LA la
162#define PTR_SLLI slli
163#define PTR_SLL sll
164#define PTR_SRLI srli
165#define PTR_SRL srl
166#define PTR_SRAI srai
167#define PTR_SRA sra
168#if _LP64
169#define PTR_L ld
170#define PTR_S sd
171#define PTR_LR lr.d
172#define PTR_SC sc.d
173#define PTR_WORD .dword
174#define PTR_SCALESHIFT 3
175#else
176#define PTR_L lw
177#define PTR_S sw
178#define PTR_LR lr.w
179#define PTR_SC sc.w
180#define PTR_WORD .word
181#define PTR_SCALESHIFT 2
182#endif
183
184#define INT_L lw
185#define INT_LA la
186#define INT_S sw
187#define INT_LR lr.w
188#define INT_SC sc.w
189#define INT_WORD .word
190#define INT_SCALESHIFT 2
191#ifdef _LP64
192#define INT_ADD addw
193#define INT_ADDI addwi
194#define INT_SUB subw
195#define INT_SUBI subwi
196#define INT_SLL sllwi
197#define INT_SLLV sllw
198#define INT_SRL srlwi
199#define INT_SRLV srlw
200#define INT_SRA srawi
201#define INT_SRAV sraw
202#else
203#define INT_ADD add
204#define INT_ADDI addi
205#define INT_SUB sub
206#define INT_SUBI subi
207#define INT_SLLI slli
208#define INT_SLL sll
209#define INT_SRLI srli
210#define INT_SRL srl
211#define INT_SRAI srai
212#define INT_SRA sra
213#endif
214
215#define LONG_LA la
216#define LONG_ADD add
217#define LONG_ADDI addi
218#define LONG_SUB sub
219#define LONG_SUBI subi
220#define LONG_SLLI slli
221#define LONG_SLL sll
222#define LONG_SRLI srli
223#define LONG_SRL srl
224#define LONG_SRAI srai
225#define LONG_SRA sra
226#ifdef _LP64
227#define LONG_L ld
228#define LONG_S sd
229#define LONG_LR lr.d
230#define LONG_SC sc.d
231#define LONG_WORD .quad
232#define LONG_SCALESHIFT 3
233#else
234#define LONG_L lw
235#define LONG_S sw
236#define LONG_LR lr.w
237#define LONG_SC sc.w
238#define LONG_WORD .word
239#define LONG_SCALESHIFT 2
240#endif
241
242#define REG_LI li
243#define REG_ADD add
244#define REG_SLLI slli
245#define REG_SLL sll
246#define REG_SRLI srli
247#define REG_SRL srl
248#define REG_SRAI srai
249#define REG_SRA sra
250#if _LP64
251#define REG_L ld
252#define REG_S sd
253#define REG_LR lr.d
254#define REG_SC sc.d
255#define REG_SCALESHIFT 3
256#else
257#define REG_L lw
258#define REG_S sw
259#define REG_LR lr.w
260#define REG_SC sc.w
261#define REG_SCALESHIFT 2
262#endif
263
264#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off)
265
266#endif /* _RISCV_ASM_H */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/bswap.h deleted-11
...@@ -1,11 +0,0 @@
1/* $NetBSD: bswap.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef _RISCV_BSWAP_H_
4#define _RISCV_BSWAP_H_
5
6#include <riscv/byte_swap.h>
7
8#define __BSWAP_RENAME
9#include <sys/bswap.h>
10
11#endif /* _RISCV_BSWAP_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/cdefs.h deleted-8
...@@ -1,8 +0,0 @@
1/* $NetBSD: cdefs.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef _RISCV_CDEFS_H_
4#define _RISCV_CDEFS_H_
5
6#define __ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1U)
7
8#endif /* _RISCV_CDEFS_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/cpu.h deleted-153
...@@ -1,153 +0,0 @@
1/* $NetBSD: cpu.h,v 1.9 2022/11/17 09:50:23 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_CPU_H_
33#define _RISCV_CPU_H_
34
35#if defined(_KERNEL) || defined(_KMEMUSER)
36
37struct clockframe {
38 vaddr_t cf_epc;
39 register_t cf_status;
40 int cf_intr_depth;
41};
42
43#define CLKF_USERMODE(cf) (((cf)->cf_status & SR_SPP) == 0)
44#define CLKF_PC(cf) ((cf)->cf_epc)
45#define CLKF_INTR(cf) ((cf)->cf_intr_depth > 0)
46
47#include <sys/cpu_data.h>
48#include <sys/device_if.h>
49#include <sys/evcnt.h>
50#include <sys/intr.h>
51
52struct cpu_info {
53 struct cpu_data ci_data;
54 device_t ci_dev;
55 cpuid_t ci_cpuid;
56 struct lwp *ci_curlwp;
57 struct lwp *ci_onproc; /* current user LWP / kthread */
58 struct lwp *ci_softlwps[SOFTINT_COUNT];
59 struct trapframe *ci_ddb_regs;
60
61 uint64_t ci_lastintr;
62
63 int ci_mtx_oldspl;
64 int ci_mtx_count;
65
66 int ci_want_resched;
67 int ci_cpl;
68 u_int ci_softints;
69 volatile u_int ci_intr_depth;
70
71 tlb_asid_t ci_pmap_asid_cur;
72
73 union pmap_segtab *ci_pmap_user_segtab;
74#ifdef _LP64
75 union pmap_segtab *ci_pmap_user_seg0tab;
76#endif
77
78 struct evcnt ci_ev_fpu_saves;
79 struct evcnt ci_ev_fpu_loads;
80 struct evcnt ci_ev_fpu_reenables;
81#if defined(GPROF) && defined(MULTIPROCESSOR)
82 struct gmonparam *ci_gmon; /* MI per-cpu GPROF */
83#endif
84};
85
86#endif /* _KERNEL || _KMEMUSER */
87
88#ifdef _KERNEL
89
90extern struct cpu_info cpu_info_store;
91
92// This is also in <sys/lwp.h>
93struct lwp;
94static inline struct cpu_info *lwp_getcpu(struct lwp *);
95
96register struct lwp *riscv_curlwp __asm("tp");
97#define curlwp riscv_curlwp
98#define curcpu() lwp_getcpu(curlwp)
99
100static inline cpuid_t
101cpu_number(void)
102{
103#ifdef MULTIPROCESSOR
104 return curcpu()->ci_cpuid;
105#else
106 return 0;
107#endif
108}
109
110void cpu_proc_fork(struct proc *, struct proc *);
111void cpu_signotify(struct lwp *);
112void cpu_need_proftick(struct lwp *l);
113void cpu_boot_secondary_processors(void);
114
115#define CPU_INFO_ITERATOR cpuid_t
116#ifdef MULTIPROCESSOR
117#define CPU_INFO_FOREACH(cii, ci) \
118 (cii) = 0; ((ci) = cpu_infos[cii]) != NULL; (cii)++
119#else
120#define CPU_INFO_FOREACH(cii, ci) \
121 (cii) = 0, (ci) = curcpu(); (cii) == 0; (cii)++
122#endif
123
124#define CPU_INFO_CURPMAP(ci) (curlwp->l_proc->p_vmspace->vm_map.pmap)
125
126static inline void
127cpu_dosoftints(void)
128{
129 extern void dosoftints(void);
130 struct cpu_info * const ci = curcpu();
131 if (ci->ci_intr_depth == 0
132 && (ci->ci_data.cpu_softints >> ci->ci_cpl) > 0)
133 dosoftints();
134}
135
136static inline bool
137cpu_intr_p(void)
138{
139 return curcpu()->ci_intr_depth > 0;
140}
141
142#define LWP_PC(l) cpu_lwp_pc(l)
143
144vaddr_t cpu_lwp_pc(struct lwp *);
145
146static inline void
147cpu_idle(void)
148{
149}
150
151#endif /* _KERNEL */
152
153#endif /* _RISCV_CPU_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/disklabel.h deleted-68
...@@ -1,68 +0,0 @@
1/* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_DISKLABEL_H_
33#define _RISCV_DISKLABEL_H_
34
35#define LABELUSESMBR 1 /* use MBR partitionning */
36#define LABELSECTOR 1 /* sector containing label */
37#define LABELOFFSET 0 /* offset of label in sector */
38#define MAXPARTITIONS 16 /* number of partitions */
39#define RAW_PART 2 /* raw partition: XX?c */
40
41#if HAVE_NBTOOL_CONFIG_H
42#include <nbinclude/sys/dkbad.h>
43#include <nbinclude/sys/bootblock.h>
44#else
45#include <sys/dkbad.h>
46#include <sys/bootblock.h>
47#endif /* HAVE_NBTOOL_CONFIG_H */
48
49struct cpu_disklabel {
50 struct mbr_partition mbrparts[MBR_PART_COUNT];
51#define __HAVE_DISKLABEL_DKBAD
52 struct dkbad bad;
53};
54
55#ifdef _KERNEL
56struct buf;
57struct disklabel;
58
59/* for readdisklabel. rv != 0 -> matches, msg == NULL -> success */
60int mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *,
61 struct cpu_disklabel *, const char **, int *, int *);
62
63/* for writedisklabel. rv == 0 -> doesn't match, rv > 0 -> success */
64int mbr_label_locate(dev_t, void (*)(struct buf *),
65 struct disklabel *, struct cpu_disklabel *, int *, int *);
66#endif /* _KERNEL */
67
68#endif /* _RISCV_DISKLABEL_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/elf_machdep.h deleted-144
...@@ -1,144 +0,0 @@
1/* $NetBSD: elf_machdep.h,v 1.9 2022/12/03 08:54:38 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_ELF_MACHDEP_H_
33#define _RISCV_ELF_MACHDEP_H_
34
35#define ELF32_MACHDEP_ID EM_RISCV
36#define ELF64_MACHDEP_ID EM_RISCV
37
38#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
39#define ELF64_MACHDEP_ENDIANNESS ELFDATA2LSB
40
41#define ELF32_MACHDEP_ID_CASES \
42 case EM_RISCV: \
43 break;
44
45#define ELF64_MACHDEP_ID_CASES \
46 case EM_RISCV: \
47 break;
48
49#ifdef _LP64
50#define KERN_ELFSIZE 64
51#define ARCH_ELFSIZE 64 /* MD native binary size */
52#else
53#define KERN_ELFSIZE 32
54#define ARCH_ELFSIZE 32 /* MD native binary size */
55#endif
56
57/* Processor specific flags for the ELF header e_flags field. */
58
59/* Processor specific relocation types */
60
61#define R_RISCV_NONE 0
62#define R_RISCV_32 1 // A
63#define R_RISCV_64 2
64#define R_RISCV_RELATIVE 3
65#define R_RISCV_COPY 4
66#define R_RISCV_JMP_SLOT 5
67#define R_RISCV_TLS_DTPMOD32 6
68#define R_RISCV_TLS_DTPMOD64 7
69#define R_RISCV_TLS_DTPREL32 8
70#define R_RISCV_TLS_DTPREL64 9
71#define R_RISCV_TLS_TPREL32 10
72#define R_RISCV_TLS_TPREL64 11
73
74/* The rest are not used by the dynamic linker */
75#define R_RISCV_BRANCH 16 // (A - P) & 0xffff
76#define R_RISCV_JAL 17 // A & 0xff
77#define R_RISCV_CALL 18 // (A - P) & 0xff
78#define R_RISCV_CALL_PLT 19
79#define R_RISCV_GOT_HI20 20
80#define R_RISCV_TLS_GOT_HI20 21
81#define R_RISCV_TLS_GD_HI20 22
82#define R_RISCV_PCREL_HI20 23
83#define R_RISCV_PCREL_LO12_I 24
84#define R_RISCV_PCREL_LO12_S 25
85#define R_RISCV_HI20 26 // A & 0xffff
86#define R_RISCV_LO12_I 27 // (A >> 16) & 0xffff
87#define R_RISCV_LO12_S 28 // (S + A - P) >> 2
88#define R_RISCV_TPREL_HI20 29
89#define R_RISCV_TPREL_LO12_I 30
90#define R_RISCV_TPREL_LO12_S 31
91#define R_RISCV_TPREL_ADD 32
92#define R_RISCV_ADD8 33
93#define R_RISCV_ADD16 34
94#define R_RISCV_ADD32 35
95#define R_RISCV_ADD64 36
96#define R_RISCV_SUB8 37
97#define R_RISCV_SUB16 38
98#define R_RISCV_SUB32 39
99#define R_RISCV_SUB64 40
100#define R_RISCV_GNU_VTINHERIT 41 // A & 0xffff
101#define R_RISCV_GNU_VTENTRY 42
102#define R_RISCV_ALIGN 43
103#define R_RISCV_RVC_BRANCH 44
104#define R_RISCV_RVC_JUMP 45
105#define R_RISCV_RVC_LUI 46
106#define R_RISCV_GPREL_I 47
107#define R_RISCV_GPREL_S 48
108#define R_RISCV_TPREL_I 49
109#define R_RISCV_TPREL_S 50
110#define R_RISCV_RELAX 51
111#define R_RISCV_SUB6 52
112#define R_RISCV_SET6 53
113#define R_RISCV_SET8 54
114#define R_RISCV_SET16 55
115#define R_RISCV_SET32 56
116#define R_RISCV_32_PCREL 57
117
118/* These are aliases we can use R_TYPESZ */
119#define R_RISCV_ADDR32 R_RISCV_32
120#define R_RISCV_ADDR64 R_RISCV_64
121
122#define R_TYPE(name) R_RISCV_ ## name
123#if ELFSIZE == 32
124#define R_TYPESZ(name) R_RISCV_ ## name ## 32
125#else
126#define R_TYPESZ(name) R_RISCV_ ## name ## 64
127#endif
128
129#ifdef _KERNEL
130#ifdef ELFSIZE
131#define ELF_MD_PROBE_FUNC ELFNAME2(cpu_netbsd,probe)
132#endif
133
134struct exec_package;
135
136int cpu_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
137 vaddr_t *);
138
139int cpu_netbsd_elf64_probe(struct lwp *, struct exec_package *, void *, char *,
140 vaddr_t *);
141
142#endif /* _KERNEL */
143
144#endif /* _RISCV_ELF_MACHDEP_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/endian.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: endian.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/endian.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/endian_machdep.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: endian_machdep.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#define _BYTE_ORDER _LITTLE_ENDIAN
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/fenv.h deleted-35
...@@ -1,35 +0,0 @@
1/* $NetBSD: fenv.h,v 1.3 2020/03/14 16:12:16 skrll Exp $ */
2
3/*
4 * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5 * Public domain.
6 */
7
8#ifndef _RISCV_FENV_H_
9#define _RISCV_FENV_H_
10
11typedef int fenv_t; /* FPSCR */
12typedef int fexcept_t;
13
14#define FE_INEXACT 0x00 /* Result inexact */
15#define FE_UNDERFLOW 0x02 /* Result underflowed */
16#define FE_OVERFLOW 0x04 /* Result overflowed */
17#define FE_DIVBYZERO 0x08 /* divide-by-zero */
18#define FE_INVALID 0x10 /* Result invalid */
19
20#define FE_ALL_EXCEPT 0x1f
21
22#define FE_TONEAREST 0 /* round to nearest representable number */
23#define FE_TOWARDZERO 1 /* round to zero (truncate) */
24#define FE_DOWNWARD 2 /* round toward negative infinity */
25#define FE_UPWARD 3 /* round toward positive infinity */
26
27__BEGIN_DECLS
28
29/* Default floating-point environment */
30extern const fenv_t __fe_dfl_env;
31#define FE_DFL_ENV (&__fe_dfl_env)
32
33__END_DECLS
34
35#endif /* _RISCV_FENV_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/float.h deleted-58
...@@ -1,58 +0,0 @@
1/* $NetBSD: float.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_FLOAT_H_
33#define _RISCV_FLOAT_H_
34
35#include <sys/cdefs.h>
36
37#define LDBL_MANT_DIG __LDBL_MANT_DIG__
38#define LDBL_DIG __LDBL_DIG__
39#define LDBL_MIN_EXP __LDBL_MIN_EXP__
40#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
41#define LDBL_MAX_EXP __LDBL_MAX_EXP__
42#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
43#define LDBL_EPSILON __LDBL_EPSILON__
44#define LDBL_MIN __LDBL_MIN__
45#define LDBL_MAX __LDBL_MAX__
46
47#include <sys/float_ieee754.h>
48
49#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) \
50 && !defined(_XOPEN_SOURCE)) \
51 || (__STDC_VERSION__ - 0) >= 199901L \
52 || (_POSIX_C_SOURCE - 0) >= 200112L \
53 || ((_XOPEN_SOURCE - 0) >= 600) \
54 || defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
55#define DECIMAL_DIG __DECIMAL_DIG__
56#endif
57
58#endif /* !_RISCV_FLOAT_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/ieee.h deleted-4
...@@ -1,4 +0,0 @@
1/* $NetBSD: ieee.h,v 1.2 2019/04/13 15:57:31 maya Exp $ */
2
3#include <riscv/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
4#include <sys/ieee754.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/ieeefp.h deleted-44
...@@ -1,44 +0,0 @@
1/* $NetBSD: ieeefp.h,v 1.2 2020/03/14 16:12:16 skrll Exp $ */
2
3/*
4 * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5 * Public domain.
6 */
7
8#ifndef _RISCV_IEEEFP_H_
9#define _RISCV_IEEEFP_H_
10
11#include <sys/featuretest.h>
12
13#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
14
15#include <riscv/fenv.h>
16
17#if !defined(_ISOC99_SOURCE)
18
19/* Exception type (used by fpsetmask() et al.) */
20
21typedef int fp_except;
22
23/* Bit defines for fp_except */
24
25#define FP_X_INV FE_INVALID /* invalid operation exception */
26#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
27#define FP_X_OFL FE_OVERFLOW /* overflow exception */
28#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
29#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */
30
31/* Rounding modes */
32
33typedef enum {
34 FP_RN=FE_TONEAREST, /* round to nearest representable number */
35 FP_RP=FE_UPWARD, /* round toward positive infinity */
36 FP_RM=FE_DOWNWARD, /* round toward negative infinity */
37 FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */
38} fp_rnd;
39
40#endif /* !_ISOC99_SOURCE */
41
42#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
43
44#endif /* _RISCV_IEEEFP_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/int_const.h deleted-20
...@@ -1,20 +0,0 @@
1/* $NetBSD: int_const.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#ifndef __INTMAX_C_SUFFIX__
4
5#define __INT8_C_SUFFIX__
6#define __INT16_C_SUFFIX__
7#define __INT32_C_SUFFIX__
8#define __INT64_C_SUFFIX__ LL
9
10#define __UINT8_C_SUFFIX__
11#define __UINT16_C_SUFFIX__
12#define __UINT32_C_SUFFIX__
13#define __UINT64_C_SUFFIX__ ULL
14
15#define __INTMAX_C_SUFFIX__ LL
16#define __UINTMAX_C_SUFFIX__ ULL
17
18#endif
19
20#include <sys/common_int_const.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/int_fmtio.h deleted-381
...@@ -1,381 +0,0 @@
1/* $NetBSD: int_fmtio.h,v 1.4 2019/04/17 11:01:19 mrg Exp $ */
2
3/*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_INT_FMTIO_H_
33#define _RISCV_INT_FMTIO_H_
34
35#ifdef __INTPTR_FMTd__
36#include <sys/common_int_fmtio.h>
37#else
38/*
39 * 7.8.1 Macros for format specifiers
40 */
41
42/* fprintf macros for signed integers */
43#define PRId8 "hhd" /* int8_t */
44#define PRId16 "hd" /* int16_t */
45#define PRId32 "d" /* int32_t */
46#ifdef _LP64
47#define PRId64 "ld" /* int64_t */
48#else
49#define PRId64 "lld" /* int64_t */
50#endif
51#define PRIdLEAST8 "hhd" /* int_least8_t */
52#define PRIdLEAST16 "hd" /* int_least16_t */
53#define PRIdLEAST32 "d" /* int_least32_t */
54#ifdef _LP64
55#define PRIdLEAST64 "ld" /* int_least64_t */
56#define PRIdFAST8 "d" /* int_fast8_t */
57#define PRIdFAST16 "d" /* int_fast16_t */
58#else
59#define PRIdLEAST64 "lld" /* int_least64_t */
60#define PRIdFAST8 "hhd" /* int_fast8_t */
61#define PRIdFAST16 "hd" /* int_fast16_t */
62#endif
63#define PRIdFAST32 "d" /* int_fast32_t */
64#ifdef _LP64
65#define PRIdFAST64 "ld" /* int_fast64_t */
66#define PRIdMAX "ld" /* intmax_t */
67#else
68#define PRIdFAST64 "lld" /* int_fast64_t */
69#define PRIdMAX "lld" /* intmax_t */
70#endif
71#define PRIdPTR "ld" /* intptr_t */
72
73#define PRIi8 "hhi" /* int8_t */
74#define PRIi16 "hi" /* int16_t */
75#define PRIi32 "i" /* int32_t */
76#ifdef _LP64
77#define PRIi64 "li" /* int64_t */
78#else
79#define PRIi64 "lli" /* int64_t */
80#endif
81#define PRIiLEAST8 "hhi" /* int_least8_t */
82#define PRIiLEAST16 "hi" /* int_least16_t */
83#define PRIiLEAST32 "i" /* int_least32_t */
84#ifdef _LP64
85#define PRIiLEAST64 "li" /* int_least64_t */
86#define PRIiFAST8 "i" /* int_fast8_t */
87#define PRIiFAST16 "i" /* int_fast16_t */
88#else
89#define PRIiLEAST64 "lli" /* int_least64_t */
90#define PRIiFAST8 "hhi" /* int_fast8_t */
91#define PRIiFAST16 "hi" /* int_fast16_t */
92#endif
93#define PRIiFAST32 "i" /* int_fast32_t */
94#ifdef _LP64
95#define PRIiFAST64 "li" /* int_fast64_t */
96#define PRIiMAX "li" /* intmax_t */
97#else
98#define PRIiFAST64 "lli" /* int_fast64_t */
99#define PRIiMAX "lli" /* intmax_t */
100#endif
101#define PRIiPTR "li" /* intptr_t */
102
103/* fprintf macros for unsigned integers */
104
105#define PRIo8 "hho" /* uint8_t */
106#define PRIo16 "ho" /* uint16_t */
107#define PRIo32 "o" /* uint32_t */
108#ifdef _LP64
109#define PRIo64 "lo" /* uint64_t */
110#else
111#define PRIo64 "llo" /* uint64_t */
112#endif
113#define PRIoLEAST8 "o" /* uint_least8_t */
114#define PRIoLEAST16 "hho" /* uint_least16_t */
115#define PRIoLEAST32 "ho" /* uint_least32_t */
116#ifdef _LP64
117#define PRIoLEAST64 "lo" /* uint_least64_t */
118#define PRIoFAST8 "o" /* uint_fast8_t */
119#define PRIoFAST16 "o" /* uint_fast16_t */
120#else
121#define PRIoLEAST64 "llo" /* uint_least64_t */
122#define PRIoFAST8 "hho" /* uint_fast8_t */
123#define PRIoFAST16 "ho" /* uint_fast16_t */
124#endif
125#define PRIoFAST32 "o" /* uint_fast32_t */
126#ifdef _LP64
127#define PRIoFAST64 "lo" /* uint_fast64_t */
128#define PRIoMAX "lo" /* uintmax_t */
129#else
130#define PRIoFAST64 "llo" /* uint_fast64_t */
131#define PRIoMAX "llo" /* uintmax_t */
132#endif
133#define PRIoPTR "lo" /* uintptr_t */
134
135#define PRIu8 "hhu" /* uint8_t */
136#define PRIu16 "hu" /* uint16_t */
137#define PRIu32 "u" /* uint32_t */
138#ifdef _LP64
139#define PRIu64 "lu" /* uint64_t */
140#else
141#define PRIu64 "llu" /* uint64_t */
142#endif
143#define PRIuLEAST8 "hhu" /* uint_least8_t */
144#define PRIuLEAST16 "hu" /* uint_least16_t */
145#define PRIuLEAST32 "u" /* uint_least32_t */
146#ifdef _LP64
147#define PRIuLEAST64 "lu" /* uint_least64_t */
148#define PRIuFAST8 "u" /* uint_fast8_t */
149#define PRIuFAST16 "u" /* uint_fast16_t */
150#else
151#define PRIuLEAST64 "llu" /* uint_least64_t */
152#define PRIuFAST8 "hhu" /* uint_fast8_t */
153#define PRIuFAST16 "hu" /* uint_fast16_t */
154#endif
155#define PRIuFAST32 "u" /* uint_fast32_t */
156#ifdef _LP64
157#define PRIuFAST64 "lu" /* uint_fast64_t */
158#define PRIuMAX "lu" /* uintmax_t */
159#else
160#define PRIuFAST64 "llu" /* uint_fast64_t */
161#define PRIuMAX "llu" /* uintmax_t */
162#endif
163#define PRIuPTR "lu" /* uintptr_t */
164
165#define PRIx8 "hhx" /* uint8_t */
166#define PRIx16 "hx" /* uint16_t */
167#define PRIx32 "x" /* uint32_t */
168#ifdef _LP64
169#define PRIx64 "lx" /* uint64_t */
170#else
171#define PRIx64 "llx" /* uint64_t */
172#endif
173#define PRIxLEAST8 "x" /* uint_least8_t */
174#define PRIxLEAST16 "x" /* uint_least16_t */
175#define PRIxLEAST32 "x" /* uint_least32_t */
176#ifdef _LP64
177#define PRIxLEAST64 "lx" /* uint_least64_t */
178#define PRIxFAST8 "x" /* uint_fast8_t */
179#define PRIxFAST16 "x" /* uint_fast16_t */
180#else
181#define PRIxLEAST64 "llx" /* uint_least64_t */
182#define PRIxFAST8 "hhx" /* uint_fast8_t */
183#define PRIxFAST16 "hx" /* uint_fast16_t */
184#endif
185#define PRIxFAST32 "x" /* uint_fast32_t */
186#ifdef _LP64
187#define PRIxFAST64 "lx" /* uint_fast64_t */
188#define PRIxMAX "lx" /* uintmax_t */
189#else
190#define PRIxFAST64 "llx" /* uint_fast64_t */
191#define PRIxMAX "llx" /* uintmax_t */
192#endif
193#define PRIxPTR "lx" /* uintptr_t */
194
195#define PRIX8 "hhX" /* uint8_t */
196#define PRIX16 "hX" /* uint16_t */
197#define PRIX32 "X" /* uint32_t */
198#ifdef _LP64
199#define PRIX64 "lX" /* uint64_t */
200#else
201#define PRIX64 "llX" /* uint64_t */
202#endif
203#define PRIXLEAST8 "X" /* uint_least8_t */
204#define PRIXLEAST16 "X" /* uint_least16_t */
205#define PRIXLEAST32 "X" /* uint_least32_t */
206#ifdef _LP64
207#define PRIXLEAST64 "lX" /* uint_least64_t */
208#define PRIXFAST8 "X" /* uint_fast8_t */
209#define PRIXFAST16 "X" /* uint_fast16_t */
210#else
211#define PRIXLEAST64 "llX" /* uint_least64_t */
212#define PRIXFAST8 "hhX" /* uint_fast8_t */
213#define PRIXFAST16 "hX" /* uint_fast16_t */
214#endif
215#define PRIXFAST32 "X" /* uint_fast32_t */
216#ifdef _LP64
217#define PRIXFAST64 "lX" /* uint_fast64_t */
218#define PRIXMAX "lX" /* uintmax_t */
219#else
220#define PRIXFAST64 "llX" /* uint_fast64_t */
221#define PRIXMAX "llX" /* uintmax_t */
222#endif
223#define PRIXPTR "lX" /* uintptr_t */
224
225/* fscanf macros for signed integers */
226
227#define SCNd8 "hhd" /* int8_t */
228#define SCNd16 "hd" /* int16_t */
229#define SCNd32 "d" /* int32_t */
230#ifdef _LP64
231#define SCNd64 "ld" /* int64_t */
232#else
233#define SCNd64 "lld" /* int64_t */
234#endif
235#define SCNdLEAST8 "hhd" /* int_least8_t */
236#define SCNdLEAST16 "hd" /* int_least16_t */
237#define SCNdLEAST32 "d" /* int_least32_t */
238#ifdef _LP64
239#define SCNdLEAST64 "ld" /* int_least64_t */
240#define SCNdFAST8 "d" /* int_fast8_t */
241#define SCNdFAST16 "d" /* int_fast16_t */
242#else
243#define SCNdLEAST64 "lld" /* int_least64_t */
244#define SCNdFAST8 "hhd" /* int_fast8_t */
245#define SCNdFAST16 "hd" /* int_fast16_t */
246#endif
247#define SCNdFAST32 "d" /* int_fast32_t */
248#ifdef _LP64
249#define SCNdFAST64 "ld" /* int_fast64_t */
250#define SCNdMAX "ld" /* intmax_t */
251#else
252#define SCNdFAST64 "lld" /* int_fast64_t */
253#define SCNdMAX "lld" /* intmax_t */
254#endif
255#define SCNdPTR "ld" /* intptr_t */
256
257#define SCNi8 "hhi" /* int8_t */
258#define SCNi16 "hi" /* int16_t */
259#define SCNi32 "i" /* int32_t */
260#ifdef _LP64
261#define SCNi64 "li" /* int64_t */
262#else
263#define SCNi64 "lli" /* int64_t */
264#endif
265#define SCNiLEAST8 "hhi" /* int_least8_t */
266#define SCNiLEAST16 "hi" /* int_least16_t */
267#define SCNiLEAST32 "i" /* int_least32_t */
268#ifdef _LP64
269#define SCNiLEAST64 "li" /* int_least64_t */
270#define SCNiFAST8 "i" /* int_fast8_t */
271#define SCNiFAST16 "i" /* int_fast16_t */
272#else
273#define SCNiLEAST64 "lli" /* int_least64_t */
274#define SCNiFAST8 "hhi" /* int_fast8_t */
275#define SCNiFAST16 "hi" /* int_fast16_t */
276#endif
277#define SCNiFAST32 "i" /* int_fast32_t */
278#ifdef _LP64
279#define SCNiFAST64 "li" /* int_fast64_t */
280#define SCNiMAX "li" /* intmax_t */
281#else
282#define SCNiFAST64 "lli" /* int_fast64_t */
283#define SCNiMAX "lli" /* intmax_t */
284#endif
285#define SCNiPTR "li" /* intptr_t */
286
287/* fscanf macros for unsigned integers */
288
289#define SCNo8 "hho" /* uint8_t */
290#define SCNo16 "ho" /* uint16_t */
291#define SCNo32 "o" /* uint32_t */
292#ifdef _LP64
293#define SCNo64 "lo" /* uint64_t */
294#else
295#define SCNo64 "llo" /* uint64_t */
296#endif
297#define SCNoLEAST8 "hho" /* uint_least8_t */
298#define SCNoLEAST16 "ho" /* uint_least16_t */
299#define SCNoLEAST32 "o" /* uint_least32_t */
300#ifdef _LP64
301#define SCNoLEAST64 "lo" /* uint_least64_t */
302#define SCNoFAST8 "o" /* uint_fast8_t */
303#define SCNoFAST16 "o" /* uint_fast16_t */
304#else
305#define SCNoLEAST64 "llo" /* uint_least64_t */
306#define SCNoFAST8 "hho" /* uint_fast8_t */
307#define SCNoFAST16 "ho" /* uint_fast16_t */
308#endif
309#define SCNoFAST32 "o" /* uint_fast32_t */
310#ifdef _LP64
311#define SCNoFAST64 "lo" /* uint_fast64_t */
312#define SCNoMAX "lo" /* uintmax_t */
313#else
314#define SCNoFAST64 "llo" /* uint_fast64_t */
315#define SCNoMAX "llo" /* uintmax_t */
316#endif
317#define SCNoPTR "lo" /* uintptr_t */
318
319#define SCNu8 "hhu" /* uint8_t */
320#define SCNu16 "hu" /* uint16_t */
321#define SCNu32 "u" /* uint32_t */
322#ifdef _LP64
323#define SCNu64 "lu" /* uint64_t */
324#else
325#define SCNu64 "llu" /* uint64_t */
326#endif
327#define SCNuLEAST8 "hhu" /* uint_least8_t */
328#define SCNuLEAST16 "hu" /* uint_least16_t */
329#define SCNuLEAST32 "u" /* uint_least32_t */
330#ifdef _LP64
331#define SCNuLEAST64 "lu" /* uint_least64_t */
332#define SCNuFAST8 "u" /* uint_fast8_t */
333#define SCNuFAST16 "u" /* uint_fast16_t */
334#else
335#define SCNuLEAST64 "llu" /* uint_least64_t */
336#define SCNuFAST8 "hhu" /* uint_fast8_t */
337#define SCNuFAST16 "hu" /* uint_fast16_t */
338#endif
339#define SCNuFAST32 "u" /* uint_fast32_t */
340#ifdef _LP64
341#define SCNuFAST64 "lu" /* uint_fast64_t */
342#define SCNuMAX "lu" /* uintmax_t */
343#else
344#define SCNuFAST64 "llu" /* uint_fast64_t */
345#define SCNuMAX "llu" /* uintmax_t */
346#endif
347#define SCNuPTR "lu" /* uintptr_t */
348
349#define SCNx8 "hhx" /* uint8_t */
350#define SCNx16 "hx" /* uint16_t */
351#define SCNx32 "x" /* uint32_t */
352#ifdef _LP64
353#define SCNx64 "lx" /* uint64_t */
354#else
355#define SCNx64 "llx" /* uint64_t */
356#endif
357#define SCNxLEAST8 "hhx" /* uint_least8_t */
358#define SCNxLEAST16 "hx" /* uint_least16_t */
359#define SCNxLEAST32 "x" /* uint_least32_t */
360#ifdef _LP64
361#define SCNxLEAST64 "lx" /* uint_least64_t */
362#define SCNxFAST8 "x" /* uint_fast8_t */
363#define SCNxFAST16 "x" /* uint_fast16_t */
364#else
365#define SCNxLEAST64 "llx" /* uint_least64_t */
366#define SCNxFAST8 "hhx" /* uint_fast8_t */
367#define SCNxFAST16 "hx" /* uint_fast16_t */
368#endif
369#define SCNxFAST32 "x" /* uint_fast32_t */
370#ifdef _LP64
371#define SCNxFAST64 "lx" /* uint_fast64_t */
372#define SCNxMAX "lx" /* uintmax_t */
373#else
374#define SCNxFAST64 "llx" /* uint_fast64_t */
375#define SCNxMAX "llx" /* uintmax_t */
376#endif
377#define SCNxPTR "lx" /* uintptr_t */
378
379#endif /* !__INTPTR_FMTd__ */
380
381#endif /* !_RISCV_INT_FMTIO_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/int_limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_limits.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/int_mwgwtypes.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_mwgwtypes.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_mwgwtypes.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/int_types.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: int_types.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_int_types.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/kcore.h deleted-40
...@@ -1,40 +0,0 @@
1/* $NetBSD: kcore.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_KCORE_H_
33#define _RISCV_KCORE_H_
34
35typedef struct cpu_kcore_hdr {
36 uint64_t kh_misc[8];
37 phys_ram_seg_t kh_ramsegs[0];
38} cpu_kcore_hdr_t;
39
40#endif /* _RISCV_KCORE_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_limits.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/lock.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: lock.h,v 1.4 2015/06/26 14:27:35 matt Exp $ */
2
3#include <sys/common_lock.h>
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/math.h deleted-4
...@@ -1,4 +0,0 @@
1/* $NetBSD: math.h,v 1.3 2019/04/16 07:40:02 maya Exp $ */
2
3#define __HAVE_NANF
4#define __HAVE_LONG_DOUBLE 128
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/mcontext.h deleted-170
...@@ -1,170 +0,0 @@
1/* $NetBSD: mcontext.h,v 1.6 2020/03/14 16:12:16 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31#ifndef _RISCV_MCONTEXT_H_
32#define _RISCV_MCONTEXT_H_
33
34/*
35 */
36
37#define _NGREG 32 /* GR1-31 */
38#define _NFREG 33 /* F0-31, FCSR */
39
40/*
41 * This fragment is common to <riscv/mcontext.h> and <riscv/reg.h>
42 */
43#ifndef _BSD_FPREG_T_
44union __fpreg {
45 __uint64_t u_u64;
46 double u_d;
47};
48#define _BSD_FPREG_T_ union __fpreg
49#endif
50
51typedef __uint64_t __greg_t;
52typedef __greg_t __gregset_t[_NGREG];
53typedef __uint32_t __greg32_t;
54typedef __greg32_t __gregset32_t[_NGREG];
55typedef _BSD_FPREG_T_ __fregset_t[_NFREG];
56
57#define _REG_X1 0
58#define _REG_X2 1
59#define _REG_X3 2
60#define _REG_X4 3
61#define _REG_X5 4
62#define _REG_X6 5
63#define _REG_X7 6
64#define _REG_X8 7
65#define _REG_X9 8
66#define _REG_X10 9
67#define _REG_X11 10
68#define _REG_X12 11
69#define _REG_X13 12
70#define _REG_X14 13
71#define _REG_X15 14
72#define _REG_X16 15
73#define _REG_X17 16
74#define _REG_X18 17
75#define _REG_X19 18
76#define _REG_X20 19
77#define _REG_X21 20
78#define _REG_X22 21
79#define _REG_X23 22
80#define _REG_X24 23
81#define _REG_X25 24
82#define _REG_X26 25
83#define _REG_X27 26
84#define _REG_X28 27
85#define _REG_X29 28
86#define _REG_X30 29
87#define _REG_X31 30
88#define _REG_PC 31
89
90#define _REG_RA _REG_X1
91#define _REG_SP _REG_X2
92#define _REG_GP _REG_X3
93#define _REG_TP _REG_X4
94#define _REG_S0 _REG_X8
95#define _REG_RV _REG_X10
96#define _REG_A0 _REG_X10
97
98#define _REG_F0 0
99#define _REG_FPCSR 32
100
101typedef struct {
102 __gregset_t __gregs; /* General Purpose Register set */
103 __fregset_t __fregs; /* Floating Point Register set */
104 __greg_t __private; /* copy of l_private */
105 __greg_t __spare[8]; /* future proof */
106} mcontext_t;
107
108typedef struct {
109 __gregset32_t __gregs; /* General Purpose Register set */
110 __fregset_t __fregs; /* Floating Point Register set */
111 __greg32_t __private; /* copy of l_private */
112 __greg32_t __spare[8]; /* future proof */
113} mcontext32_t;
114
115/* Machine-dependent uc_flags */
116#define _UC_SETSTACK 0x00010000 /* see <sys/ucontext.h> */
117#define _UC_CLRSTACK 0x00020000 /* see <sys/ucontext.h> */
118#define _UC_TLSBASE 0x00080000 /* see <sys/ucontext.h> */
119
120#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])
121#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_S0])
122#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC])
123#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RV])
124
125#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
126
127#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || defined(__LIBPTHREAD_SOURCE__)
128#include <sys/tls.h>
129
130/*
131 * On RISCV, since displacements are signed 12-bit values, the TCB pointer is
132 * not and points to the first static entry.
133 */
134#define TLS_TP_OFFSET 0x0
135#define TLS_DTV_OFFSET 0x800
136__CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb) < 0x800);
137
138static __inline void *
139__lwp_getprivate_fast(void)
140{
141 void *__tp;
142 __asm("move %0,tp" : "=r"(__tp));
143 return __tp;
144}
145
146static __inline void *
147__lwp_gettcb_fast(void)
148{
149 void *__tcb;
150
151 __asm __volatile(
152 "addi %[__tcb],tp,%[__offset]"
153 : [__tcb] "=r" (__tcb)
154 : [__offset] "n" (-(TLS_TP_OFFSET + sizeof(struct tls_tcb))));
155
156 return __tcb;
157}
158
159static __inline void
160__lwp_settcb(void *__tcb)
161{
162 __asm __volatile(
163 "addi tp,%[__tcb],%[__offset]"
164 :
165 : [__tcb] "r" (__tcb),
166 [__offset] "n" (TLS_TP_OFFSET + sizeof(struct tls_tcb)));
167}
168#endif /* _RTLD_SOURCE || _LIBC_SOURCE || __LIBPTHREAD_SOURCE__ */
169
170#endif /* !_RISCV_MCONTEXT_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/mutex.h deleted-124
...@@ -1,124 +0,0 @@
1/* $NetBSD: mutex.h,v 1.4.4.1 2023/08/09 17:42:03 martin Exp $ */
2
3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe and Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_MUTEX_H_
33#define _RISCV_MUTEX_H_
34
35#include <sys/types.h>
36
37#ifndef __MUTEX_PRIVATE
38
39struct kmutex {
40 uintptr_t mtx_pad1;
41};
42
43#else /* __MUTEX_PRIVATE */
44
45#include <sys/cdefs.h>
46
47#include <sys/param.h>
48
49#include <machine/intr.h>
50
51struct kmutex {
52 volatile uintptr_t mtx_owner;
53};
54
55#ifdef _LP64
56#define MTX_ASMOP_SFX ".d" // doubleword atomic op
57#else
58#define MTX_ASMOP_SFX ".w" // word atomic op
59#endif
60
61#define MTX_LOCK __BIT(8) // just one bit
62#define MTX_IPL __BITS(7,4) // only need 4 bits
63
64#undef MUTEX_SPIN_IPL // override <sys/mutex.h>
65#define MUTEX_SPIN_IPL(a) riscv_mutex_spin_ipl(a)
66#define MUTEX_INITIALIZE_SPIN_IPL(a,b) riscv_mutex_initialize_spin_ipl(a,b)
67#define MUTEX_SPINBIT_LOCK_INIT(a) riscv_mutex_spinbit_lock_init(a)
68#define MUTEX_SPINBIT_LOCK_TRY(a) riscv_mutex_spinbit_lock_try(a)
69#define MUTEX_SPINBIT_LOCKED_P(a) riscv_mutex_spinbit_locked_p(a)
70#define MUTEX_SPINBIT_LOCK_UNLOCK(a) riscv_mutex_spinbit_lock_unlock(a)
71
72static inline ipl_cookie_t
73riscv_mutex_spin_ipl(kmutex_t *__mtx)
74{
75 return (ipl_cookie_t){._spl = __SHIFTOUT(__mtx->mtx_owner, MTX_IPL)};
76}
77
78static inline void
79riscv_mutex_initialize_spin_ipl(kmutex_t *__mtx, int ipl)
80{
81 __mtx->mtx_owner = (__mtx->mtx_owner & ~MTX_IPL)
82 | __SHIFTIN(ipl, MTX_IPL);
83}
84
85static inline void
86riscv_mutex_spinbit_lock_init(kmutex_t *__mtx)
87{
88 __mtx->mtx_owner &= ~MTX_LOCK;
89}
90
91static inline bool
92riscv_mutex_spinbit_locked_p(const kmutex_t *__mtx)
93{
94 return (__mtx->mtx_owner & MTX_LOCK) != 0;
95}
96
97static inline bool
98riscv_mutex_spinbit_lock_try(kmutex_t *__mtx)
99{
100 uintptr_t __old;
101 __asm __volatile(
102 "amoor" MTX_ASMOP_SFX ".aq\t%0, %1, (%2)"
103 : "=r"(__old)
104 : "r"(MTX_LOCK), "r"(__mtx));
105 return (__old & MTX_LOCK) == 0;
106}
107
108static inline void
109riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx)
110{
111 __asm __volatile(
112 "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)"
113 :: "r"(~MTX_LOCK), "r"(__mtx));
114}
115
116#if 0
117#define __HAVE_MUTEX_STUBS 1
118#define __HAVE_SPIN_MUTEX_STUBS 1
119#endif
120#define __HAVE_SIMPLE_MUTEXES 1
121
122#endif /* __MUTEX_PRIVATE */
123
124#endif /* _RISCV_MUTEX_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/param.h deleted-106
...@@ -1,106 +0,0 @@
1/* $NetBSD: param.h,v 1.7 2022/10/12 07:50:00 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PARAM_H_
33#define _RISCV_PARAM_H_
34
35#ifdef _KERNEL_OPT
36#include "opt_param.h"
37#endif
38
39/*
40 * Machine dependent constants for all OpenRISC processors
41 */
42
43/*
44 * For KERNEL code:
45 * MACHINE must be defined by the individual port. This is so that
46 * uname returns the correct thing, etc.
47 *
48 * For non-KERNEL code:
49 * If ELF, MACHINE and MACHINE_ARCH are forced to "or1k/or1k".
50 */
51
52#ifdef _LP64
53#define _MACHINE_ARCH riscv64
54#define MACHINE_ARCH "riscv64"
55#define _MACHINE_ARCH32 riscv32
56#define MACHINE_ARCH32 "riscv32"
57#else
58#define _MACHINE_ARCH riscv32
59#define MACHINE_ARCH "riscv32"
60#endif
61#define _MACHINE riscv
62#define MACHINE "riscv"
63
64#define MID_MACHINE MID_RISCV
65
66/* RISCV-specific macro to align a stack pointer (downwards). */
67#define STACK_ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1)
68#define ALIGNBYTES32 __BIGGEST_ALIGNMENT__
69
70#define NKMEMPAGES_MIN_DEFAULT ((128UL * 1024 * 1024) >> PAGE_SHIFT)
71#define NKMEMPAGES_MAX_UNLIMITED 1
72
73#define PGSHIFT 12
74#define NBPG (1 << PGSHIFT)
75#define PGOFSET (NBPG - 1)
76
77#define UPAGES 2
78#define USPACE (UPAGES << PGSHIFT)
79#define USPACE_ALIGN NBPG
80
81/*
82 * Constants related to network buffer management.
83 * MCLBYTES must be no larger than NBPG (the software page size), and
84 * NBPG % MCLBYTES must be zero.
85 */
86#define MSIZE 512 /* size of an mbuf */
87
88#ifndef MCLSHIFT
89#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
90 /* 2K cluster can hold Ether frame */
91#endif /* MCLSHIFT */
92
93#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
94
95#ifndef MSGBUFSIZE
96#define MSGBUFSIZE 65536 /* default message buffer size */
97#endif
98
99#define MAXCPUS 32
100
101#ifdef _KERNEL
102void delay(unsigned long);
103#define DELAY(x) delay(x)
104#endif
105
106#endif /* _RISCV_PARAM_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/pcb.h deleted-46
...@@ -1,46 +0,0 @@
1/* $NetBSD: pcb.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PCB_H_
33#define _RISCV_PCB_H_
34
35#include <riscv/reg.h>
36
37struct pcb {
38 struct fpreg pcb_fpregs;
39};
40
41struct md_coredump {
42 struct reg reg;
43 struct fpreg fpreg;
44};
45
46#endif /* _RISCV_PCB_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/pmap.h deleted-213
...@@ -1,213 +0,0 @@
1/* $NetBSD: pmap.h,v 1.13 2022/10/20 07:18:11 skrll Exp $ */
2
3/*
4 * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas (of 3am Software Foundry), Maxime Villard, and
9 * Nick Hudson.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef _RISCV_PMAP_H_
34#define _RISCV_PMAP_H_
35
36#ifdef _KERNEL_OPT
37#include "opt_modular.h"
38#endif
39
40#if !defined(_MODULE)
41
42#include <sys/cdefs.h>
43#include <sys/types.h>
44#include <sys/pool.h>
45#include <sys/evcnt.h>
46
47#include <uvm/uvm_physseg.h>
48#include <uvm/pmap/vmpagemd.h>
49
50#include <riscv/pte.h>
51#include <riscv/sysreg.h>
52
53#define PMAP_SEGTABSIZE NPTEPG
54#define PMAP_PDETABSIZE NPTEPG
55
56#ifdef _LP64
57#define PTPSHIFT 3
58/* This is SV48. */
59//#define SEGLENGTH + SEGSHIFT + SEGSHIFT */
60
61/* This is SV39. */
62#define XSEGSHIFT (SEGSHIFT + SEGLENGTH)
63#define NBXSEG (1ULL << XSEGSHIFT)
64#define XSEGOFSET (NBXSEG - 1) /* byte offset into xsegment */
65#define XSEGLENGTH (PGSHIFT - 3)
66#define NXSEGPG (1 << XSEGLENGTH)
67#else
68#define PTPSHIFT 2
69#define XSEGSHIFT SEGSHIFT
70#endif
71
72#define SEGLENGTH (PGSHIFT - PTPSHIFT)
73#define SEGSHIFT (SEGLENGTH + PGSHIFT)
74#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
75#define SEGOFSET (NBSEG - 1) /* byte offset into segment */
76
77#define KERNEL_PID 0
78
79#define PMAP_HWPAGEWALKER 1
80#define PMAP_TLB_MAX 1
81#ifdef _LP64
82#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
83#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
84#else
85#define PMAP_INVALID_PDETAB_ADDRESS ((pmap_pdetab_t *)0xdeadbeef)
86#define PMAP_INVALID_SEGTAB_ADDRESS ((pmap_segtab_t *)0xdeadbeef)
87#endif
88#define PMAP_TLB_NUM_PIDS (__SHIFTOUT_MASK(SATP_ASID) + 1)
89#define PMAP_TLB_BITMAP_LENGTH PMAP_TLB_NUM_PIDS
90#define PMAP_TLB_FLUSH_ASID_ON_RESET false
91
92#define pmap_phys_address(x) (x)
93
94#ifndef __BSD_PTENTRY_T__
95#define __BSD_PTENTRY_T__
96#ifdef _LP64
97#define PRIxPTE PRIx64
98#else
99#define PRIxPTE PRIx32
100#endif
101#endif /* __BSD_PTENTRY_T__ */
102
103#define PMAP_NEED_PROCWR
104static inline void
105pmap_procwr(struct proc *p, vaddr_t va, vsize_t len)
106{
107 __asm __volatile("fence\trw,rw; fence.i" ::: "memory");
108}
109
110#include <uvm/pmap/tlb.h>
111#include <uvm/pmap/pmap_tlb.h>
112
113#define PMAP_GROWKERNEL
114#define PMAP_STEAL_MEMORY
115
116#ifdef _KERNEL
117
118#define __HAVE_PMAP_MD
119struct pmap_md {
120 paddr_t md_ppn;
121 pd_entry_t *md_pdetab;
122};
123
124struct vm_page *
125 pmap_md_alloc_poolpage(int flags);
126vaddr_t pmap_md_map_poolpage(paddr_t, vsize_t);
127void pmap_md_unmap_poolpage(vaddr_t, vsize_t);
128bool pmap_md_direct_mapped_vaddr_p(vaddr_t);
129bool pmap_md_io_vaddr_p(vaddr_t);
130paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t);
131vaddr_t pmap_md_direct_map_paddr(paddr_t);
132void pmap_md_init(void);
133
134void pmap_md_xtab_activate(struct pmap *, struct lwp *);
135void pmap_md_xtab_deactivate(struct pmap *);
136void pmap_md_pdetab_init(struct pmap *);
137bool pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t);
138
139void pmap_bootstrap(vaddr_t kstart, vaddr_t kend);
140
141extern vaddr_t pmap_direct_base;
142extern vaddr_t pmap_direct_end;
143#define PMAP_DIRECT_MAP(pa) (pmap_direct_base + (pa))
144#define PMAP_DIRECT_UNMAP(va) ((paddr_t)(va) - pmap_direct_base)
145
146#define MEGAPAGE_TRUNC(x) ((x) & ~SEGOFSET)
147#define MEGAPAGE_ROUND(x) MEGAPAGE_TRUNC((x) + SEGOFSET)
148
149#ifdef __PMAP_PRIVATE
150
151static inline bool
152pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte)
153{
154 // TLB not walked and so not called.
155 return false;
156}
157
158static inline void
159pmap_md_page_syncicache(struct vm_page_md *mdpg, const kcpuset_t *kc)
160{
161 __asm __volatile("fence\trw,rw; fence.i" ::: "memory");
162}
163
164/*
165 * Virtual Cache Alias helper routines. Not a problem for RISCV CPUs.
166 */
167static inline bool
168pmap_md_vca_add(struct vm_page_md *mdpg, vaddr_t va, pt_entry_t *nptep)
169{
170 return false;
171}
172
173static inline void
174pmap_md_vca_remove(struct vm_page_md *mdpg, vaddr_t va)
175{
176}
177
178static inline void
179pmap_md_vca_clean(struct vm_page_md *mdpg, vaddr_t va, int op)
180{
181}
182
183static inline size_t
184pmap_md_tlb_asid_max(void)
185{
186 return PMAP_TLB_NUM_PIDS - 1;
187}
188
189#endif /* __PMAP_PRIVATE */
190#endif /* _KERNEL */
191
192#include <uvm/pmap/pmap.h>
193
194#endif /* !_MODULE */
195
196#if defined(MODULAR) || defined(_MODULE)
197/*
198 * Define a compatible vm_page_md so that struct vm_page is the same size
199 * whether we are using modules or not.
200 */
201#ifndef __HAVE_VM_PAGE_MD
202#define __HAVE_VM_PAGE_MD
203
204struct vm_page_md {
205 uintptr_t mdpg_dummy[3];
206};
207__CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*3);
208
209#endif /* !__HAVE_VM_PAGE_MD */
210
211#endif /* MODULAR || _MODULE */
212
213#endif /* !_RISCV_PMAP_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/proc.h deleted-71
...@@ -1,71 +0,0 @@
1/* $NetBSD: proc.h,v 1.3 2015/03/31 06:47:47 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PROC_H_
33#define _RISCV_PROC_H_
34
35#include <sys/param.h>
36#include <riscv/vmparam.h>
37
38struct lwp;
39
40/*
41 * Machine-dependent part of the lwp structure for RISCV
42 */
43struct trapframe;
44
45struct mdlwp {
46 struct trapframe *md_utf; /* trapframe from userspace */
47 struct trapframe *md_ktf; /* trapframe from userspace */
48 struct faultbuf *md_onfault; /* registers to store on fault */
49 register_t md_usp; /* for locore.S */
50 vaddr_t md_ss_addr; /* single step address for ptrace */
51 int md_ss_instr; /* single step instruction for ptrace */
52 volatile int md_astpending; /* AST pending on return to userland */
53#if 0
54#if USPACE > PAGE_SIZE
55 int md_upte[USPACE/4096]; /* ptes for mapping u page */
56#else
57 int md_dpte[USPACE/4096]; /* dummy ptes to keep the same */
58#endif
59#endif
60};
61
62struct mdproc {
63 /* syscall entry for this process */
64 void (*md_syscall)(struct trapframe *);
65};
66
67#ifdef _KERNEL
68#define LWP0_CPU_INFO &cpu_info_store /* staticly set in lwp0 */
69#endif /* _KERNEL */
70
71#endif /* _RISCV_PROC_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/profile.h deleted-91
...@@ -1,91 +0,0 @@
1/* $NetBSD: profile.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PROFILE_H_
33#define _RISCV_PROFILE_H_
34
35#define _MCOUNT_DECL void _mcount
36
37/*
38 * Cannot implement mcount in C as GCC will trash the ip register when it
39 * pushes a trapframe. Pity we cannot insert assembly before the function
40 * prologue.
41 */
42
43#define MCOUNT_ASM_NAME "__mcount"
44#define PLTSYM
45
46#if 0
47#define MCOUNT \
48 __asm(".text"); \
49 __asm(".align 0"); \
50 __asm(".type " MCOUNT_ASM_NAME ",@function"); \
51 __asm(".global " MCOUNT_ASM_NAME); \
52 __asm(MCOUNT_ASM_NAME ":"); \
53 /* \
54 * Preserve registers that are trashed during mcount \
55 */ \
56 __asm("sub sp, sp, #80"); \
57 __asm("stp x29, x30, [sp, #64]"); \
58 __asm("add x29, sp, #64"); \
59 __asm("stp x0, x1, [x29, #0]"); \
60 __asm("stp x2, x3, [x29, #16]"); \
61 __asm("stp x4, x5, [x29, #32]"); \
62 __asm("stp x6, x7, [x29, #48]"); \
63 /* \
64 * find the return address for mcount, \
65 * and the return address for mcount's caller. \
66 * \
67 * frompcindex = pc pushed by call into self. \
68 */ \
69 __asm("mov x0, x19"); \
70 /* \
71 * selfpc = pc pushed by mcount call \
72 */ \
73 __asm("mov x1, x30"); \
74 /* \
75 * Call the real mcount code \
76 */ \
77 __asm("bl " ___STRING(_C_LABEL(_mcount))); \
78 /* \
79 * Restore registers that were trashed during mcount \
80 */ \
81 __asm("ldp x0, x1, [x29, #0]"); \
82 __asm("ldp x2, x3, [x29, #16]"); \
83 __asm("ldp x4, x5, [x29, #32]"); \
84 __asm("ldp x6, x7, [x29, #48]"); \
85 __asm("ldp x29, x30, [x29, #64]"); \
86 __asm("add sp, sp, #80"); \
87 __asm("ret"); \
88 __asm(".size " MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME);
89#endif
90
91#endif /* _RISCV_PROFILE_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/ptrace.h deleted-57
...@@ -1,57 +0,0 @@
1/* $NetBSD: ptrace.h,v 1.3 2019/06/18 21:18:12 kamil Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_PTRACE_H_
33#define _RISCV_PTRACE_H_
34
35/*
36 * RISCV-dependent ptrace definitions.
37 * Note that PT_STEP is _not_ supported.
38 */
39#define PT_GETREGS (PT_FIRSTMACH + 0)
40#define PT_SETREGS (PT_FIRSTMACH + 1)
41#define PT_GETFPREGS (PT_FIRSTMACH + 2)
42#define PT_SETFPREGS (PT_FIRSTMACH + 3)
43
44#define PT_MACHDEP_STRINGS \
45 "PT_GETREGS", \
46 "PT_SETREGS", \
47 "PT_GETFPREGS", \
48 "PT_SETFPREGS"
49
50#include <machine/reg.h>
51#define PTRACE_REG_PC(r) (r)->r_pc
52#define PTRACE_REG_FP(r) (r)->r_reg[7]
53#define PTRACE_REG_SET_PC(r, v) (r)->r_pc = (v)
54#define PTRACE_REG_SP(r) (r)->r_reg[1]
55#define PTRACE_REG_INTRV(r) (r)->r_reg[9]
56
57#endif /* _RISCV_PTRACE_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/reg.h deleted-125
...@@ -1,125 +0,0 @@
1/* $NetBSD: reg.h,v 1.10 2022/12/13 22:25:08 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_REG_H_
33#define _RISCV_REG_H_
34
35// x0 = 0
36// x1 = ra (return address) Caller
37// x2 = sp (stack pointer) Callee
38// x3 = gp (global pointer)
39// x4 = tp (thread pointer)
40// x5 - x7 = t0 - t2 (temporary) Caller
41// x8 = s0/fp (saved register / frame pointer) Callee
42// x9 = s1 (saved register) Callee
43// x10 - x11 = a0 - a1 (arguments/return values) Caller
44// x12 - x17 = a2 - a7 (arguments) Caller
45// x18 - x27 = s2 - s11 (saved registers) Callee
46// x28 - x31 = t3 - t6 (temporaries) Caller
47
48struct reg { // synced with register_t in <riscv/types.h>
49#ifdef _LP64
50 __uint64_t r_reg[31]; /* x0 is always 0 */
51 __uint64_t r_pc;
52#else
53 __uint32_t r_reg[31]; /* x0 is always 0 */
54 __uint32_t r_pc;
55#endif
56};
57
58#ifdef _LP64
59struct reg32 { // synced with register_t in <riscv/types.h>
60 __uint32_t r_reg[31]; /* x0 is always 0 */
61 __uint32_t r_pc;
62};
63#endif
64
65#define _XREG(n) ((n) - 1)
66#define _X_RA _XREG(1)
67#define _X_SP _XREG(2)
68#define _X_GP _XREG(3)
69#define _X_TP _XREG(4)
70#define _X_T0 _XREG(5)
71#define _X_T1 _XREG(6)
72#define _X_T2 _XREG(7)
73#define _X_S0 _XREG(8)
74#define _X_S1 _XREG(9)
75#define _X_A0 _XREG(10)
76#define _X_A1 _XREG(11)
77#define _X_A2 _XREG(12)
78#define _X_A3 _XREG(13)
79#define _X_A4 _XREG(14)
80#define _X_A5 _XREG(15)
81#define _X_A6 _XREG(16)
82#define _X_A7 _XREG(17)
83#define _X_S2 _XREG(18)
84#define _X_S3 _XREG(19)
85#define _X_S4 _XREG(20)
86#define _X_S5 _XREG(21)
87#define _X_S6 _XREG(22)
88#define _X_S7 _XREG(23)
89#define _X_S8 _XREG(24)
90#define _X_S9 _XREG(25)
91#define _X_S10 _XREG(26)
92#define _X_S11 _XREG(27)
93#define _X_T3 _XREG(28)
94#define _X_T4 _XREG(29)
95#define _X_T5 _XREG(30)
96#define _X_T6 _XREG(31)
97
98// f0 - f7 = ft0 - ft7 (FP temporaries) Caller
99// following layout is similar to integer registers above
100// f8 - f9 = fs0 - fs1 (FP saved registers) Callee
101// f10 - f11 = fa0 - fa1 (FP arguments/return values) Caller
102// f12 - f17 = fa2 - fa7 (FP arguments) Caller
103// f18 - f27 = fs2 - fa11 (FP saved registers) Callee
104// f28 - f31 = ft8 - ft11 (FP temporaries) Caller
105
106/*
107 * This fragment is common to <riscv/mcontext.h> and <riscv/reg.h>
108 */
109#ifndef _BSD_FPREG_T_
110union __fpreg {
111 __uint64_t u_u64;
112 double u_d;
113};
114#define _BSD_FPREG_T_ union __fpreg
115#endif
116
117/*
118 * 32 double precision floating point, 1 CSR
119 */
120struct fpreg {
121 _BSD_FPREG_T_ r_fpreg[33];
122};
123#define r_fcsr r_fpreg[32].u_u64
124
125#endif /* _RISCV_REG_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/rwlock.h deleted-1
...@@ -1 +0,0 @@
1/* $NetBSD: rwlock.h,v 1.2 2019/11/29 20:04:53 riastradh Exp $ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/setjmp.h deleted-70
...@@ -1,70 +0,0 @@
1/* $NetBSD: setjmp.h,v 1.2 2015/03/27 06:57:21 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /* magic + 16 reg + 1 fcsr + 12 fp + 4 sigmask + 8 spare */
33#define _JBLEN (_JB_SIGMASK + 4 + 8)
34#define _JB_MAGIC 0
35#define _JB_RA 1
36#define _JB_SP 2
37#define _JB_GP 3
38#define _JB_TP 4
39#define _JB_S0 5
40#define _JB_S1 6
41#define _JB_S2 7
42#define _JB_S3 8
43#define _JB_S4 9
44#define _JB_S5 10
45#define _JB_S6 11
46#define _JB_S7 12
47#define _JB_S8 13
48#define _JB_S9 14
49#define _JB_S10 15
50#define _JB_S11 16
51#define _JB_FCSR 17
52
53#define _JB_FS0 18
54#define _JB_FS1 (_JB_FS0 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
55#define _JB_FS2 (_JB_FS1 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
56#define _JB_FS3 (_JB_FS2 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
57#define _JB_FS4 (_JB_FS3 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
58#define _JB_FS5 (_JB_FS4 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
59#define _JB_FS6 (_JB_FS5 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
60#define _JB_FS7 (_JB_FS6 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
61#define _JB_FS8 (_JB_FS7 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
62#define _JB_FS9 (_JB_FS8 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
63#define _JB_FS10 (_JB_FS9 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
64#define _JB_FS11 (_JB_FS10 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
65
66#define _JB_SIGMASK (_JB_FS11 + sizeof(double) / sizeof(_BSD_JBSLOT_T_))
67
68#ifndef _BSD_JBSLOT_T_
69#define _BSD_JBSLOT_T_ long long
70#endif
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/signal.h deleted-39
...@@ -1,39 +0,0 @@
1/* $NetBSD: signal.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_SIGNAL_H_
33#define _RISCV_SIGNAL_H_
34
35#ifndef _LOCORE
36typedef __SIG_ATOMIC_TYPE__ sig_atomic_t;
37#endif
38
39#endif /* _RISCV_SIGNAL_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/types.h deleted-116
...@@ -1,116 +0,0 @@
1/* $NetBSD: types.h,v 1.15 2022/11/08 13:34:17 simonb Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_TYPES_H_
33#define _RISCV_TYPES_H_
34
35#include <sys/cdefs.h>
36#include <sys/featuretest.h>
37#include <riscv/int_types.h>
38
39#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
40
41/* XLEN is the native base integer ISA width */
42#define XLEN (sizeof(long) * NBBY)
43
44typedef __uint64_t paddr_t;
45typedef __uint64_t psize_t;
46#define PRIxPADDR PRIx64
47#define PRIxPSIZE PRIx64
48#define PRIuPSIZE PRIu64
49
50typedef __UINTPTR_TYPE__ vaddr_t;
51typedef __UINTPTR_TYPE__ vsize_t;
52#define PRIxVADDR PRIxPTR
53#define PRIxVSIZE PRIxPTR
54#define PRIuVSIZE PRIuPTR
55
56#ifdef _LP64 // match <riscv/reg.h>
57#define PRIxREGISTER PRIx64
58typedef __int64_t register_t;
59typedef __uint64_t uregister_t;
60#else
61#define PRIxREGISTER PRIx32
62typedef __int32_t register_t;
63typedef __uint32_t uregister_t;
64#endif
65typedef signed int register32_t;
66typedef unsigned int uregister32_t;
67#define PRIxREGISTER32 "x"
68
69typedef unsigned int tlb_asid_t;
70#endif
71
72#if defined(_KERNEL)
73typedef struct label_t { /* Used by setjmp & longjmp */
74 register_t lb_reg[16]; /* */
75 __uint32_t lb_sr;
76} label_t;
77#endif
78
79typedef unsigned int __cpu_simple_lock_nv_t;
80#ifdef _LP64
81typedef __int64_t __register_t;
82#else
83typedef __int32_t __register_t;
84#endif
85
86#define __SIMPLELOCK_LOCKED 1
87#define __SIMPLELOCK_UNLOCKED 0
88
89#define __HAVE_COMMON___TLS_GET_ADDR
90#define __HAVE_COMPAT_NETBSD32
91#define __HAVE_CPU_COUNTER
92#define __HAVE_CPU_DATA_FIRST
93#define __HAVE_FAST_SOFTINTS
94#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
95#define __HAVE_NEW_STYLE_BUS_H
96#define __HAVE_SYSCALL_INTERN
97#define __HAVE_TLS_VARIANT_I
98/* XXX temporary */
99#define __HAVE_UNLOCKED_PMAP
100#define __HAVE___LWP_GETPRIVATE_FAST
101
102#ifdef __LP64
103#define __HAVE_ATOMIC64_OPS
104#define __HAVE_CPU_UAREA_ROUTINES
105#endif
106
107//#if defined(_KERNEL)
108//#define __HAVE_RAS
109//#endif
110
111#if defined(_KERNEL) || defined(_KMEMUSER)
112#define PCU_FPU 0
113#define PCU_UNIT_COUNT 1
114#endif
115
116#endif /* _RISCV_TYPES_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/vmparam.h deleted-203
...@@ -1,203 +0,0 @@
1/* $NetBSD: vmparam.h,v 1.13 2022/10/16 06:14:53 skrll Exp $ */
2
3/*-
4 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry, and Nick Hudson.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _RISCV_VMPARAM_H_
33#define _RISCV_VMPARAM_H_
34
35#include <riscv/param.h>
36
37#ifdef _KERNEL_OPT
38#include "opt_multiprocessor.h"
39#endif
40
41/*
42 * Machine dependent VM constants for RISCV.
43 */
44
45/*
46 * We use a 4K page on both RV64 and RV32 systems.
47 * Override PAGE_* definitions to compile-time constants.
48 */
49#define PAGE_SHIFT PGSHIFT
50#define PAGE_SIZE (1 << PAGE_SHIFT)
51#define PAGE_MASK (PAGE_SIZE - 1)
52
53/*
54 * USRSTACK is the top (end) of the user stack.
55 *
56 * USRSTACK needs to start a page below the maxuser address so that a memory
57 * access with a maximum displacement (0x7ff) won't cross into the kernel's
58 * address space. We use PAGE_SIZE instead of 0x800 since these need to be
59 * page-aligned.
60 */
61#define USRSTACK (VM_MAXUSER_ADDRESS-PAGE_SIZE) /* Start of user stack */
62#define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS32-PAGE_SIZE)
63
64/*
65 * Virtual memory related constants, all in bytes
66 */
67#ifndef MAXTSIZ
68#define MAXTSIZ (128*1024*1024) /* max text size */
69#endif
70#ifndef DFLDSIZ
71#define DFLDSIZ (256*1024*1024) /* initial data size limit */
72#endif
73#ifndef MAXDSIZ
74#define MAXDSIZ (1536*1024*1024) /* max data size */
75#endif
76#ifndef DFLSSIZ
77#define DFLSSIZ (4*1024*1024) /* initial stack size limit */
78#endif
79#ifndef MAXSSIZ
80#define MAXSSIZ (120*1024*1024) /* max stack size */
81#endif
82
83/*
84 * Virtual memory related constants, all in bytes
85 */
86#ifndef DFLDSIZ32
87#define DFLDSIZ32 DFLDSIZ /* initial data size limit */
88#endif
89#ifndef MAXDSIZ32
90#define MAXDSIZ32 MAXDSIZ /* max data size */
91#endif
92#ifndef DFLSSIZ32
93#define DFLSSIZ32 DFLTSIZ /* initial stack size limit */
94#endif
95#ifndef MAXSSIZ32
96#define MAXSSIZ32 MAXSSIZ /* max stack size */
97#endif
98
99/*
100 * PTEs for mapping user space into the kernel for phyio operations.
101 * The default PTE number is enough to cover 8 disks * MAXBSIZE.
102 */
103#ifndef USRIOSIZE
104#define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8)
105#endif
106
107/*
108 * User/kernel map constants.
109 */
110#define VM_MIN_ADDRESS ((vaddr_t)0x00000000)
111#ifdef _LP64 /* Sv39 / Sv48 / Sv57 */
112/*
113 * kernel virtual space layout:
114 * 0xffff_ffc0_0000_0000 - 64GiB KERNEL VM Space (inc. text/data/bss)
115 * (0xffff_ffc0_4000_0000 +1GiB) KERNEL VM start of KVA
116 * (0xffff_ffd0_0000_0000 64GiB) reserved
117 * 0xffff_ffe0_0000_0000 - 128GiB direct mapping
118 */
119#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000004000000000 - 16 * PAGE_SIZE)
120#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffc000000000)
121#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xffffffd000000000)
122
123#else /* Sv32 */
124#define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */
125#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xffffffff80000000 */
126#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xffffffffc0000000 */
127
128#endif
129#define VM_KERNEL_BASE VM_MIN_KERNEL_ADDRESS
130#define VM_KERNEL_SIZE 0x2000000 /* 32 MiB (8 / 16 megapages) */
131#define VM_KERNEL_DTB_BASE (VM_KERNEL_BASE + VM_KERNEL_SIZE)
132#define VM_KERNEL_DTB_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */
133#define VM_KERNEL_IO_BASE (VM_KERNEL_DTB_BASE + VM_KERNEL_DTB_SIZE)
134#define VM_KERNEL_IO_SIZE 0x1000000 /* 16 MiB (4 / 8 megapages) */
135
136#define VM_KERNEL_RESERVED (VM_KERNEL_SIZE + VM_KERNEL_DTB_SIZE + VM_KERNEL_IO_SIZE)
137
138#define VM_KERNEL_VM_BASE (VM_MIN_KERNEL_ADDRESS + VM_KERNEL_RESERVED)
139#define VM_KERNEL_VM_SIZE (VM_MAX_KERNEL_ADDRESS - VM_KERNEL_VM_BASE)
140
141#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
142#define VM_MAXUSER_ADDRESS32 ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */
143
144#ifdef _LP64
145/*
146 * Since we have the address space, we map all of physical memory (RAM)
147 * using gigapages on SV39, terapages on SV48 and petapages on SV57.
148 */
149#define RISCV_DIRECTMAP_MASK ((vaddr_t) 0xffffffe000000000L)
150#define RISCV_DIRECTMAP_SIZE (-RISCV_DIRECTMAP_MASK - PAGE_SIZE) /* 128GiB */
151#define RISCV_DIRECTMAP_START RISCV_DIRECTMAP_MASK
152#define RISCV_DIRECTMAP_END (RISCV_DIRECTMAP_START + RISCV_DIRECTMAP_SIZE)
153#define RISCV_KVA_P(va) (((vaddr_t) (va) & RISCV_DIRECTMAP_MASK) != 0)
154#define RISCV_PA_TO_KVA(pa) ((vaddr_t) ((pa) | RISCV_DIRECTMAP_START))
155#define RISCV_KVA_TO_PA(va) ((paddr_t) ((va) & ~RISCV_DIRECTMAP_MASK))
156#endif
157
158/*
159 * The address to which unspecified mapping requests default
160 */
161#define __USE_TOPDOWN_VM
162
163#define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \
164 trunc_page(USRSTACK - MAXSSIZ - (sz) - user_stack_guard_size)
165#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \
166 round_page((vaddr_t)(da) + (vsize_t)maxdmap)
167
168#define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \
169 trunc_page(USRSTACK32 - MAXSSIZ32 - (sz) - user_stack_guard_size)
170#define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \
171 round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32)
172
173/* virtual sizes (bytes) for various kernel submaps */
174#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
175
176/* VM_PHYSSEG_MAX defined by platform-dependent code. */
177#ifndef VM_PHYSSEG_MAX
178#define VM_PHYSSEG_MAX 16
179#endif
180#if VM_PHYSSEG_MAX == 1
181#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
182#else
183#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
184#endif
185#define VM_PHYSSEG_NOADD /* can add RAM after vm_mem_init */
186
187#ifndef VM_NFREELIST
188#define VM_NFREELIST 2 /* 2 distinct memory segments */
189#define VM_FREELIST_DEFAULT 0
190#define VM_FREELIST_DIRECTMAP 1
191#endif
192
193#ifdef _KERNEL
194#define UVM_KM_VMFREELIST riscv_poolpage_vmfreelist
195extern int riscv_poolpage_vmfreelist;
196
197#ifdef _LP64
198void * cpu_uarea_alloc(bool);
199bool cpu_uarea_free(void *);
200#endif
201#endif
202
203#endif /* ! _RISCV_VMPARAM_H_ */
\ No newline at end of file
lib/libc/include/riscv64-netbsd-none/machine/wchar_limits.h deleted-3
...@@ -1,3 +0,0 @@
1/* $NetBSD: wchar_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
2
3#include <sys/common_wchar_limits.h>
\ No newline at end of file
lib/std/c.zig+14-5
...@@ -8005,8 +8005,9 @@ pub const pthread_rwlock_t = switch (native_os) {...@@ -8005,8 +8005,9 @@ pub const pthread_rwlock_t = switch (native_os) {
8005 .netbsd => extern struct {8005 .netbsd => extern struct {
8006 magic: c_uint = 0x99990009,8006 magic: c_uint = 0x99990009,
8007 interlock: switch (builtin.cpu.arch) {8007 interlock: switch (builtin.cpu.arch) {
8008 .aarch64, .sparc, .x86_64, .x86 => u8,8008 .aarch64, .aarch64_be, .m68k, .sparc, .sparc64, .x86, .x86_64 => u8,
8009 .arm, .powerpc => c_int,8009 .arm, .armeb, .powerpc => c_int,
8010 .mips, .mipsel, .mips64, .mips64el => c_uint,
8010 else => unreachable,8011 else => unreachable,
8011 } = 0,8012 } = 0,
8012 rblocked_first: ?*u8 = null,8013 rblocked_first: ?*u8 = null,
...@@ -10385,12 +10386,20 @@ pub const sigaction = switch (native_os) {...@@ -10385,12 +10386,20 @@ pub const sigaction = switch (native_os) {
1038510386
10386/// Zig's version of SIGRTMIN. Actually a function.10387/// Zig's version of SIGRTMIN. Actually a function.
10387pub fn sigrtmin() u8 {10388pub fn sigrtmin() u8 {
10388 return @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin())));10389 return switch (native_os) {
10390 .freebsd => 65,
10391 .netbsd => 33,
10392 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))),
10393 };
10389}10394}
1039010395
10391/// Zig's version of SIGRTMAX. Actually a function.10396/// Zig's version of SIGRTMAX. Actually a function.
10392pub fn sigrtmax() u8 {10397pub fn sigrtmax() u8 {
10393 return @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax())));10398 return switch (native_os) {
10399 .freebsd => 126,
10400 .netbsd => 63,
10401 else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))),
10402 };
10394}10403}
1039510404
10396pub const sigfillset = switch (native_os) {10405pub const sigfillset = switch (native_os) {
...@@ -11255,7 +11264,7 @@ const private = struct {...@@ -11255,7 +11264,7 @@ const private = struct {
11255 extern "c" fn __msync13(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int;11264 extern "c" fn __msync13(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int;
11256 extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int;11265 extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int;
11257 extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int;11266 extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int;
11258 extern "c" fn __sigfillset14(set: ?*sigset_t) void;11267 extern "c" fn __sigfillset14(set: ?*sigset_t) c_int;
11259 extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int;11268 extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int;
11260 extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int;11269 extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int;
11261 extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int;11270 extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int;
lib/std/posix/test.zig+4-4
...@@ -889,10 +889,10 @@ test "sigset empty/full" {...@@ -889,10 +889,10 @@ test "sigset empty/full" {
889// Some signals (i.e., 32 - 34 on glibc/musl) are not allowed to be added to a889// Some signals (i.e., 32 - 34 on glibc/musl) are not allowed to be added to a
890// sigset by the C library, so avoid testing them.890// sigset by the C library, so avoid testing them.
891fn reserved_signo(i: usize) bool {891fn reserved_signo(i: usize) bool {
892 if (native_os == .macos) {892 if (native_os == .macos) return false;
893 return false;893 if (!builtin.link_libc) return false;
894 }894 const max = if (native_os == .netbsd) 32 else 31;
895 return builtin.link_libc and (i >= 32 and i < posix.sigrtmin());895 return i > max and i < posix.sigrtmin();
896}896}
897897
898test "sigset add/del" {898test "sigset add/del" {
test/llvm_targets.zig-2
...@@ -174,7 +174,6 @@ const targets = [_]std.Target.Query{...@@ -174,7 +174,6 @@ const targets = [_]std.Target.Query{
174 .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none },174 .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none },
175175
176 .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabihf },176 .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabihf },
177 .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabihf },
178 .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi },177 .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi },
179 .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabihf },178 .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabihf },
180 .{ .cpu_arch = .powerpc, .os_tag = .haiku, .abi = .eabi },179 .{ .cpu_arch = .powerpc, .os_tag = .haiku, .abi = .eabi },
...@@ -285,7 +284,6 @@ const targets = [_]std.Target.Query{...@@ -285,7 +284,6 @@ const targets = [_]std.Target.Query{
285 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .musl },284 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .musl },
286 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .none },285 .{ .cpu_arch = .wasm64, .os_tag = .wasi, .abi = .none },
287286
288 .{ .cpu_arch = .x86, .os_tag = .freebsd, .abi = .none },
289 .{ .cpu_arch = .x86, .os_tag = .freestanding, .abi = .none },287 .{ .cpu_arch = .x86, .os_tag = .freestanding, .abi = .none },
290 .{ .cpu_arch = .x86, .os_tag = .haiku, .abi = .none },288 .{ .cpu_arch = .x86, .os_tag = .haiku, .abi = .none },
291 .{ .cpu_arch = .x86, .os_tag = .hurd, .abi = .gnu },289 .{ .cpu_arch = .x86, .os_tag = .hurd, .abi = .gnu },
test/tests.zig+716-359
...@@ -45,6 +45,8 @@ const test_targets = blk: {...@@ -45,6 +45,8 @@ const test_targets = blk: {
45 // lot of branches)45 // lot of branches)
46 @setEvalBranchQuota(50000);46 @setEvalBranchQuota(50000);
47 break :blk [_]TestTarget{47 break :blk [_]TestTarget{
48 // Native Targets
49
48 .{},50 .{},
49 .{51 .{
50 .link_libc = true,52 .link_libc = true,
...@@ -52,6 +54,7 @@ const test_targets = blk: {...@@ -52,6 +54,7 @@ const test_targets = blk: {
52 .{54 .{
53 .single_threaded = true,55 .single_threaded = true,
54 },56 },
57
55 .{58 .{
56 .optimize_mode = .ReleaseFast,59 .optimize_mode = .ReleaseFast,
57 },60 },
...@@ -94,227 +97,103 @@ const test_targets = blk: {...@@ -94,227 +97,103 @@ const test_targets = blk: {
94 },97 },
95 .link_libc = true,98 .link_libc = true,
96 },99 },
97 .{
98 .target = .{
99 .cpu_arch = .x86_64,
100 .os_tag = .linux,
101 .abi = .none,
102 },
103 .use_llvm = false,
104 .use_lld = false,
105 },
106 .{
107 .target = .{
108 .cpu_arch = .x86_64,
109 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
110 .os_tag = .linux,
111 .abi = .none,
112 },
113 .use_llvm = false,
114 .use_lld = false,
115 .pic = true,
116 },
117 .{
118 .target = .{
119 .cpu_arch = .x86_64,
120 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
121 .os_tag = .linux,
122 .abi = .none,
123 },
124 .use_llvm = false,
125 .use_lld = false,
126 .strip = true,
127 },
128 // Doesn't support new liveness
129 //.{
130 // .target = .{
131 // .cpu_arch = .aarch64,
132 // .os_tag = .linux,
133 // },
134 // .use_llvm = false,
135 // .use_lld = false,
136 //},
137 .{
138 .target = .{
139 .cpu_arch = .wasm32,
140 .os_tag = .wasi,
141 },
142 .use_llvm = false,
143 .use_lld = false,
144 },
145 .{
146 .target = std.Target.Query.parse(.{
147 .arch_os_abi = "spirv64-vulkan",
148 .cpu_features = "vulkan_v1_2+physical_storage_buffer+int64+float16+float64",
149 }) catch unreachable,
150 .use_llvm = false,
151 .use_lld = false,
152 .skip_modules = &.{ "c-import", "zigc", "std" },
153 },
154 // https://github.com/ziglang/zig/issues/13623
155 //.{
156 // .target = .{
157 // .cpu_arch = .arm,
158 // .os_tag = .linux,
159 // },
160 // .use_llvm = false,
161 // .use_lld = false,
162 //},
163 // https://github.com/ziglang/zig/issues/13623
164 //.{
165 // .target = std.Target.Query.parse(.{
166 // .arch_os_abi = "arm-linux-none",
167 // .cpu_features = "generic+v8a",
168 // }) catch unreachable,
169 // .use_llvm = false,
170 // .use_lld = false,
171 //},
172 // Doesn't support new liveness
173 //.{
174 // .target = .{
175 // .cpu_arch = .aarch64,
176 // .os_tag = .macos,
177 // .abi = .none,
178 // },
179 // .use_llvm = false,
180 // .use_lld = false,
181 //},
182 .{
183 .target = .{
184 .cpu_arch = .x86_64,
185 .os_tag = .macos,
186 .abi = .none,
187 },
188 .use_llvm = false,
189 .use_lld = false,
190 },
191 .{
192 .target = .{
193 .cpu_arch = .x86_64,
194 .os_tag = .windows,
195 .abi = .gnu,
196 },
197 .use_llvm = false,
198 .use_lld = false,
199 },
200100
201 .{101 // FreeBSD Targets
202 .target = .{
203 .cpu_arch = .wasm32,
204 .os_tag = .wasi,
205 },
206 .link_libc = false,
207 },
208 .{
209 .target = .{
210 .cpu_arch = .wasm32,
211 .os_tag = .wasi,
212 },
213 .link_libc = true,
214 },
215102
216 .{103 .{
217 .target = .{104 .target = .{
218 .cpu_arch = .x86_64,105 .cpu_arch = .aarch64,
219 .os_tag = .linux,106 .os_tag = .freebsd,
107 // Remove this when we bump our baseline to 14.0.0.
108 .os_version_min = .{ .semver = .{
109 .major = 14,
110 .minor = 0,
111 .patch = 0,
112 } },
220 .abi = .none,113 .abi = .none,
221 },114 },
222 },
223 .{
224 .target = .{
225 .cpu_arch = .x86_64,
226 .os_tag = .linux,
227 .abi = .gnu,
228 },
229 .link_libc = true,
230 },
231 .{
232 .target = .{
233 .cpu_arch = .x86_64,
234 .os_tag = .linux,
235 .abi = .gnux32,
236 },
237 .link_libc = true,
238 },
239 .{
240 .target = .{
241 .cpu_arch = .x86_64,
242 .os_tag = .linux,
243 .abi = .musl,
244 },
245 .link_libc = true,
246 },
247 .{
248 .target = .{
249 .cpu_arch = .x86_64,
250 .os_tag = .linux,
251 .abi = .musl,
252 },
253 .linkage = .dynamic,
254 .link_libc = true,
255 },
256 .{
257 .target = .{
258 .cpu_arch = .x86_64,
259 .os_tag = .linux,
260 .abi = .muslx32,
261 },
262 .link_libc = true,115 .link_libc = true,
263 },116 },
117
264 .{118 .{
265 .target = .{119 .target = .{
266 .cpu_arch = .x86_64,120 .cpu_arch = .arm,
267 .os_tag = .linux,121 .os_tag = .freebsd,
268 .abi = .muslx32,122 // Remove this when we bump our baseline to 14.0.0.
123 .os_version_min = .{ .semver = .{
124 .major = 14,
125 .minor = 0,
126 .patch = 0,
127 } },
128 .abi = .eabihf,
269 },129 },
270 .linkage = .dynamic,
271 .link_libc = true,130 .link_libc = true,
272 .extra_target = true,131 // https://github.com/ziglang/zig/issues/23949
132 .skip_modules = &.{"std"},
273 },133 },
134
274 .{135 .{
275 .target = .{136 .target = .{
276 .cpu_arch = .x86_64,137 .cpu_arch = .powerpc64,
277 .os_tag = .linux,138 .os_tag = .freebsd,
278 .abi = .musl,139 // Remove this when we bump our baseline to 14.0.0.
140 .os_version_min = .{ .semver = .{
141 .major = 14,
142 .minor = 0,
143 .patch = 0,
144 } },
145 .abi = .none,
279 },146 },
280 .link_libc = true,147 .link_libc = true,
281 .use_lld = false,
282 },148 },
283149
284 .{150 .{
285 .target = .{151 .target = .{
286 .cpu_arch = .x86,152 .cpu_arch = .powerpc64le,
287 .os_tag = .linux,153 .os_tag = .freebsd,
154 // Remove this when we bump our baseline to 14.0.0.
155 .os_version_min = .{ .semver = .{
156 .major = 14,
157 .minor = 0,
158 .patch = 0,
159 } },
288 .abi = .none,160 .abi = .none,
289 },161 },
290 },
291 .{
292 .target = .{
293 .cpu_arch = .x86,
294 .os_tag = .linux,
295 .abi = .musl,
296 },
297 .link_libc = true,162 .link_libc = true,
298 },163 },
164
299 .{165 .{
300 .target = .{166 .target = .{
301 .cpu_arch = .x86,167 .cpu_arch = .riscv64,
302 .os_tag = .linux,168 .os_tag = .freebsd,
303 .abi = .musl,169 // Remove this when we bump our baseline to 14.0.0.
170 .os_version_min = .{ .semver = .{
171 .major = 14,
172 .minor = 0,
173 .patch = 0,
174 } },
175 .abi = .none,
304 },176 },
305 .linkage = .dynamic,
306 .link_libc = true,177 .link_libc = true,
307 .extra_target = true,
308 },178 },
179
309 .{180 .{
310 .target = .{181 .target = .{
311 .cpu_arch = .x86,182 .cpu_arch = .x86_64,
312 .os_tag = .linux,183 .os_tag = .freebsd,
313 .abi = .gnu,184 // Remove this when we bump our baseline to 14.0.0.
185 .os_version_min = .{ .semver = .{
186 .major = 14,
187 .minor = 0,
188 .patch = 0,
189 } },
190 .abi = .none,
314 },191 },
315 .link_libc = true,192 .link_libc = true,
316 },193 },
317194
195 // Linux Targets
196
318 .{197 .{
319 .target = .{198 .target = .{
320 .cpu_arch = .aarch64,199 .cpu_arch = .aarch64,
...@@ -347,14 +226,6 @@ const test_targets = blk: {...@@ -347,14 +226,6 @@ const test_targets = blk: {
347 },226 },
348 .link_libc = true,227 .link_libc = true,
349 },228 },
350 .{
351 .target = .{
352 .cpu_arch = .aarch64,
353 .os_tag = .windows,
354 .abi = .gnu,
355 },
356 .link_libc = true,
357 },
358229
359 .{230 .{
360 .target = .{231 .target = .{
...@@ -528,71 +399,6 @@ const test_targets = blk: {...@@ -528,71 +399,6 @@ const test_targets = blk: {
528 .link_libc = true,399 .link_libc = true,
529 },400 },
530401
531 // Calls are normally lowered to branch instructions that only support +/- 16 MB range when
532 // targeting Thumb. This easily becomes insufficient for our test binaries, so use long
533 // calls to avoid out-of-range relocations.
534 .{
535 .target = std.Target.Query.parse(.{
536 .arch_os_abi = "thumb-linux-eabi",
537 .cpu_features = "baseline+long_calls",
538 }) catch unreachable,
539 .pic = false, // Long calls don't work with PIC.
540 },
541 .{
542 .target = std.Target.Query.parse(.{
543 .arch_os_abi = "thumb-linux-eabihf",
544 .cpu_features = "baseline+long_calls",
545 }) catch unreachable,
546 .pic = false, // Long calls don't work with PIC.
547 },
548 .{
549 .target = std.Target.Query.parse(.{
550 .arch_os_abi = "thumb-linux-musleabi",
551 .cpu_features = "baseline+long_calls",
552 }) catch unreachable,
553 .link_libc = true,
554 .pic = false, // Long calls don't work with PIC.
555 },
556 .{
557 .target = std.Target.Query.parse(.{
558 .arch_os_abi = "thumb-linux-musleabihf",
559 .cpu_features = "baseline+long_calls",
560 }) catch unreachable,
561 .link_libc = true,
562 .pic = false, // Long calls don't work with PIC.
563 },
564
565 .{
566 .target = std.Target.Query.parse(.{
567 .arch_os_abi = "thumbeb-linux-eabi",
568 .cpu_features = "baseline+long_calls",
569 }) catch unreachable,
570 .pic = false, // Long calls don't work with PIC.
571 },
572 .{
573 .target = std.Target.Query.parse(.{
574 .arch_os_abi = "thumbeb-linux-eabihf",
575 .cpu_features = "baseline+long_calls",
576 }) catch unreachable,
577 .pic = false, // Long calls don't work with PIC.
578 },
579 .{
580 .target = std.Target.Query.parse(.{
581 .arch_os_abi = "thumbeb-linux-musleabi",
582 .cpu_features = "baseline+long_calls",
583 }) catch unreachable,
584 .link_libc = true,
585 .pic = false, // Long calls don't work with PIC.
586 },
587 .{
588 .target = std.Target.Query.parse(.{
589 .arch_os_abi = "thumbeb-linux-musleabihf",
590 .cpu_features = "baseline+long_calls",
591 }) catch unreachable,
592 .link_libc = true,
593 .pic = false, // Long calls don't work with PIC.
594 },
595
596 .{402 .{
597 .target = .{403 .target = .{
598 .cpu_arch = .hexagon,404 .cpu_arch = .hexagon,
...@@ -632,6 +438,7 @@ const test_targets = blk: {...@@ -632,6 +438,7 @@ const test_targets = blk: {
632 .os_tag = .linux,438 .os_tag = .linux,
633 .abi = .none,439 .abi = .none,
634 },440 },
441 // https://github.com/ziglang/zig/issues/23696
635 .skip_modules = &.{"std"},442 .skip_modules = &.{"std"},
636 },443 },
637 .{444 .{
...@@ -641,6 +448,7 @@ const test_targets = blk: {...@@ -641,6 +448,7 @@ const test_targets = blk: {
641 .abi = .musl,448 .abi = .musl,
642 },449 },
643 .link_libc = true,450 .link_libc = true,
451 // https://github.com/ziglang/zig/issues/23696
644 .skip_modules = &.{"std"},452 .skip_modules = &.{"std"},
645 },453 },
646 .{454 .{
...@@ -651,6 +459,7 @@ const test_targets = blk: {...@@ -651,6 +459,7 @@ const test_targets = blk: {
651 },459 },
652 .linkage = .dynamic,460 .linkage = .dynamic,
653 .link_libc = true,461 .link_libc = true,
462 // https://github.com/ziglang/zig/issues/23696
654 .skip_modules = &.{"std"},463 .skip_modules = &.{"std"},
655 .extra_target = true,464 .extra_target = true,
656 },465 },
...@@ -661,6 +470,7 @@ const test_targets = blk: {...@@ -661,6 +470,7 @@ const test_targets = blk: {
661 .abi = .gnu,470 .abi = .gnu,
662 },471 },
663 .link_libc = true,472 .link_libc = true,
473 // https://github.com/ziglang/zig/issues/23696
664 .skip_modules = &.{"std"},474 .skip_modules = &.{"std"},
665 },475 },
666476
...@@ -1062,25 +872,25 @@ const test_targets = blk: {...@@ -1062,25 +872,25 @@ const test_targets = blk: {
1062 },872 },
1063873
1064 .{874 .{
1065 .target = std.Target.Query.parse(.{875 .target = .{
1066 .arch_os_abi = "riscv32-linux-none",876 .cpu_arch = .riscv32,
1067 .cpu_features = "baseline-d-f",877 .os_tag = .linux,
1068 }) catch unreachable,878 .abi = .none,
879 },
1069 },880 },
1070 .{881 .{
1071 .target = std.Target.Query.parse(.{882 .target = std.Target.Query.parse(.{
1072 .arch_os_abi = "riscv32-linux-musl",883 .arch_os_abi = "riscv32-linux-none",
1073 .cpu_features = "baseline-d-f",884 .cpu_features = "baseline-d-f",
1074 }) catch unreachable,885 }) catch unreachable,
1075 .link_libc = true,
1076 },886 },
1077
1078 .{887 .{
1079 .target = .{888 .target = .{
1080 .cpu_arch = .riscv32,889 .cpu_arch = .riscv32,
1081 .os_tag = .linux,890 .os_tag = .linux,
1082 .abi = .none,891 .abi = .musl,
1083 },892 },
893 .link_libc = true,
1084 },894 },
1085 .{895 .{
1086 .target = .{896 .target = .{
...@@ -1088,165 +898,690 @@ const test_targets = blk: {...@@ -1088,165 +898,690 @@ const test_targets = blk: {
1088 .os_tag = .linux,898 .os_tag = .linux,
1089 .abi = .musl,899 .abi = .musl,
1090 },900 },
901 .linkage = .dynamic,
1091 .link_libc = true,902 .link_libc = true,
903 .extra_target = true,
1092 },904 },
905 .{
906 .target = std.Target.Query.parse(.{
907 .arch_os_abi = "riscv32-linux-musl",
908 .cpu_features = "baseline-d-f",
909 }) catch unreachable,
910 .link_libc = true,
911 },
912 .{
913 .target = .{
914 .cpu_arch = .riscv32,
915 .os_tag = .linux,
916 .abi = .gnu,
917 },
918 .link_libc = true,
919 },
920
921 .{
922 .target = std.Target.Query.parse(.{
923 .arch_os_abi = "riscv64-linux-none",
924 .cpu_features = "baseline+v+zbb",
925 }) catch unreachable,
926 .use_llvm = false,
927 .use_lld = false,
928 },
929 .{
930 .target = .{
931 .cpu_arch = .riscv64,
932 .os_tag = .linux,
933 .abi = .none,
934 },
935 },
936 .{
937 .target = std.Target.Query.parse(.{
938 .arch_os_abi = "riscv64-linux-none",
939 .cpu_features = "baseline-d-f",
940 }) catch unreachable,
941 },
942 .{
943 .target = .{
944 .cpu_arch = .riscv64,
945 .os_tag = .linux,
946 .abi = .musl,
947 },
948 .link_libc = true,
949 },
950 .{
951 .target = .{
952 .cpu_arch = .riscv64,
953 .os_tag = .linux,
954 .abi = .musl,
955 },
956 .linkage = .dynamic,
957 .link_libc = true,
958 .extra_target = true,
959 },
960 .{
961 .target = std.Target.Query.parse(.{
962 .arch_os_abi = "riscv64-linux-musl",
963 .cpu_features = "baseline-d-f",
964 }) catch unreachable,
965 .link_libc = true,
966 },
967 .{
968 .target = .{
969 .cpu_arch = .riscv64,
970 .os_tag = .linux,
971 .abi = .gnu,
972 },
973 .link_libc = true,
974 },
975
976 .{
977 .target = .{
978 .cpu_arch = .s390x,
979 .os_tag = .linux,
980 .abi = .none,
981 },
982 },
983 .{
984 .target = .{
985 .cpu_arch = .s390x,
986 .os_tag = .linux,
987 .abi = .musl,
988 },
989 .link_libc = true,
990 },
991 // Currently hangs in qemu-s390x.
992 // .{
993 // .target = .{
994 // .cpu_arch = .s390x,
995 // .os_tag = .linux,
996 // .abi = .musl,
997 // },
998 // .linkage = .dynamic,
999 // .link_libc = true,
1000 // .extra_target = true,
1001 // },
1002 .{
1003 .target = .{
1004 .cpu_arch = .s390x,
1005 .os_tag = .linux,
1006 .abi = .gnu,
1007 },
1008 .link_libc = true,
1009 },
1010
1011 // Calls are normally lowered to branch instructions that only support +/- 16 MB range when
1012 // targeting Thumb. This easily becomes insufficient for our test binaries, so use long
1013 // calls to avoid out-of-range relocations.
1014 .{
1015 .target = std.Target.Query.parse(.{
1016 .arch_os_abi = "thumb-linux-eabi",
1017 .cpu_features = "baseline+long_calls",
1018 }) catch unreachable,
1019 .pic = false, // Long calls don't work with PIC.
1020 },
1021 .{
1022 .target = std.Target.Query.parse(.{
1023 .arch_os_abi = "thumb-linux-eabihf",
1024 .cpu_features = "baseline+long_calls",
1025 }) catch unreachable,
1026 .pic = false, // Long calls don't work with PIC.
1027 },
1028 .{
1029 .target = std.Target.Query.parse(.{
1030 .arch_os_abi = "thumb-linux-musleabi",
1031 .cpu_features = "baseline+long_calls",
1032 }) catch unreachable,
1033 .link_libc = true,
1034 .pic = false, // Long calls don't work with PIC.
1035 },
1036 .{
1037 .target = std.Target.Query.parse(.{
1038 .arch_os_abi = "thumb-linux-musleabihf",
1039 .cpu_features = "baseline+long_calls",
1040 }) catch unreachable,
1041 .link_libc = true,
1042 .pic = false, // Long calls don't work with PIC.
1043 },
1044
1045 .{
1046 .target = std.Target.Query.parse(.{
1047 .arch_os_abi = "thumbeb-linux-eabi",
1048 .cpu_features = "baseline+long_calls",
1049 }) catch unreachable,
1050 .pic = false, // Long calls don't work with PIC.
1051 },
1052 .{
1053 .target = std.Target.Query.parse(.{
1054 .arch_os_abi = "thumbeb-linux-eabihf",
1055 .cpu_features = "baseline+long_calls",
1056 }) catch unreachable,
1057 .pic = false, // Long calls don't work with PIC.
1058 },
1059 .{
1060 .target = std.Target.Query.parse(.{
1061 .arch_os_abi = "thumbeb-linux-musleabi",
1062 .cpu_features = "baseline+long_calls",
1063 }) catch unreachable,
1064 .link_libc = true,
1065 .pic = false, // Long calls don't work with PIC.
1066 },
1067 .{
1068 .target = std.Target.Query.parse(.{
1069 .arch_os_abi = "thumbeb-linux-musleabihf",
1070 .cpu_features = "baseline+long_calls",
1071 }) catch unreachable,
1072 .link_libc = true,
1073 .pic = false, // Long calls don't work with PIC.
1074 },
1075
1076 .{
1077 .target = .{
1078 .cpu_arch = .x86,
1079 .os_tag = .linux,
1080 .abi = .none,
1081 },
1082 },
1083 .{
1084 .target = .{
1085 .cpu_arch = .x86,
1086 .os_tag = .linux,
1087 .abi = .musl,
1088 },
1089 .link_libc = true,
1090 },
1091 .{
1092 .target = .{
1093 .cpu_arch = .x86,
1094 .os_tag = .linux,
1095 .abi = .musl,
1096 },
1097 .linkage = .dynamic,
1098 .link_libc = true,
1099 .extra_target = true,
1100 },
1101 .{
1102 .target = .{
1103 .cpu_arch = .x86,
1104 .os_tag = .linux,
1105 .abi = .gnu,
1106 },
1107 .link_libc = true,
1108 },
1109
1110 .{
1111 .target = .{
1112 .cpu_arch = .x86_64,
1113 .os_tag = .linux,
1114 .abi = .none,
1115 },
1116 .use_llvm = false,
1117 .use_lld = false,
1118 },
1119 .{
1120 .target = .{
1121 .cpu_arch = .x86_64,
1122 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
1123 .os_tag = .linux,
1124 .abi = .none,
1125 },
1126 .use_llvm = false,
1127 .use_lld = false,
1128 .pic = true,
1129 },
1130 .{
1131 .target = .{
1132 .cpu_arch = .x86_64,
1133 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
1134 .os_tag = .linux,
1135 .abi = .none,
1136 },
1137 .use_llvm = false,
1138 .use_lld = false,
1139 .strip = true,
1140 },
1141 .{
1142 .target = .{
1143 .cpu_arch = .x86_64,
1144 .os_tag = .linux,
1145 .abi = .none,
1146 },
1147 },
1148 .{
1149 .target = .{
1150 .cpu_arch = .x86_64,
1151 .os_tag = .linux,
1152 .abi = .gnu,
1153 },
1154 .link_libc = true,
1155 },
1156 .{
1157 .target = .{
1158 .cpu_arch = .x86_64,
1159 .os_tag = .linux,
1160 .abi = .gnux32,
1161 },
1162 .link_libc = true,
1163 },
1164 .{
1165 .target = .{
1166 .cpu_arch = .x86_64,
1167 .os_tag = .linux,
1168 .abi = .musl,
1169 },
1170 .link_libc = true,
1171 },
1172 .{
1173 .target = .{
1174 .cpu_arch = .x86_64,
1175 .os_tag = .linux,
1176 .abi = .musl,
1177 },
1178 .linkage = .dynamic,
1179 .link_libc = true,
1180 },
1181 .{
1182 .target = .{
1183 .cpu_arch = .x86_64,
1184 .os_tag = .linux,
1185 .abi = .muslx32,
1186 },
1187 .link_libc = true,
1188 },
1189 .{
1190 .target = .{
1191 .cpu_arch = .x86_64,
1192 .os_tag = .linux,
1193 .abi = .muslx32,
1194 },
1195 .linkage = .dynamic,
1196 .link_libc = true,
1197 .extra_target = true,
1198 },
1199 .{
1200 .target = .{
1201 .cpu_arch = .x86_64,
1202 .os_tag = .linux,
1203 .abi = .musl,
1204 },
1205 .link_libc = true,
1206 .use_lld = false,
1207 },
1208
1209 // macOS Targets
1210
1211 .{
1212 .target = .{
1213 .cpu_arch = .aarch64,
1214 .os_tag = .macos,
1215 .abi = .none,
1216 },
1217 },
1218
1219 .{
1220 .target = .{
1221 .cpu_arch = .x86_64,
1222 .os_tag = .macos,
1223 .abi = .none,
1224 },
1225 .use_llvm = false,
1226 },
1227 .{
1228 .target = .{
1229 .cpu_arch = .x86_64,
1230 .os_tag = .macos,
1231 .abi = .none,
1232 },
1233 },
1234
1235 // NetBSD Targets
1236
1237 .{
1238 .target = .{
1239 .cpu_arch = .aarch64,
1240 .os_tag = .netbsd,
1241 // Remove this when we bump our baseline to 10.1.0.
1242 .os_version_min = .{ .semver = .{
1243 .major = 10,
1244 .minor = 1,
1245 .patch = 0,
1246 } },
1247 .abi = .none,
1248 },
1249 .link_libc = true,
1250 },
1251
1252 .{
1253 .target = .{
1254 .cpu_arch = .aarch64_be,
1255 .os_tag = .netbsd,
1256 // Remove this when we bump our baseline to 10.1.0.
1257 .os_version_min = .{ .semver = .{
1258 .major = 10,
1259 .minor = 1,
1260 .patch = 0,
1261 } },
1262 .abi = .none,
1263 },
1264 .link_libc = true,
1265 },
1266
1267 .{
1268 .target = .{
1269 .cpu_arch = .arm,
1270 .os_tag = .netbsd,
1271 // Remove this when we bump our baseline to 10.1.0.
1272 .os_version_min = .{ .semver = .{
1273 .major = 10,
1274 .minor = 1,
1275 .patch = 0,
1276 } },
1277 .abi = .eabi,
1278 },
1279 .link_libc = true,
1280 },
1281 .{
1282 .target = .{
1283 .cpu_arch = .arm,
1284 .os_tag = .netbsd,
1285 // Remove this when we bump our baseline to 10.1.0.
1286 .os_version_min = .{ .semver = .{
1287 .major = 10,
1288 .minor = 1,
1289 .patch = 0,
1290 } },
1291 .abi = .eabihf,
1292 },
1293 .link_libc = true,
1294 },
1295
1093 .{1296 .{
1094 .target = .{1297 .target = .{
1095 .cpu_arch = .riscv32,1298 .cpu_arch = .armeb,
1096 .os_tag = .linux,1299 .os_tag = .netbsd,
1097 .abi = .musl,1300 // Remove this when we bump our baseline to 10.1.0.
1301 .os_version_min = .{ .semver = .{
1302 .major = 10,
1303 .minor = 1,
1304 .patch = 0,
1305 } },
1306 .abi = .eabi,
1098 },1307 },
1099 .linkage = .dynamic,
1100 .link_libc = true,1308 .link_libc = true,
1101 .extra_target = true,
1102 },1309 },
1103 .{1310 .{
1104 .target = .{1311 .target = .{
1105 .cpu_arch = .riscv32,1312 .cpu_arch = .armeb,
1106 .os_tag = .linux,1313 .os_tag = .netbsd,
1107 .abi = .gnu,1314 // Remove this when we bump our baseline to 10.1.0.
1315 .os_version_min = .{ .semver = .{
1316 .major = 10,
1317 .minor = 1,
1318 .patch = 0,
1319 } },
1320 .abi = .eabihf,
1108 },1321 },
1109 .link_libc = true,1322 .link_libc = true,
1110 },1323 },
11111324
1112 .{1325 .{
1113 .target = std.Target.Query.parse(.{1326 .target = .{
1114 .arch_os_abi = "riscv64-linux-none",1327 .cpu_arch = .mips,
1115 .cpu_features = "baseline-d-f",1328 .os_tag = .netbsd,
1116 }) catch unreachable,1329 // Remove this when we bump our baseline to 10.1.0.
1330 .os_version_min = .{ .semver = .{
1331 .major = 10,
1332 .minor = 1,
1333 .patch = 0,
1334 } },
1335 .abi = .eabi,
1336 },
1337 .link_libc = true,
1117 },1338 },
1118 .{1339 .{
1119 .target = std.Target.Query.parse(.{1340 .target = .{
1120 .arch_os_abi = "riscv64-linux-musl",1341 .cpu_arch = .mips,
1121 .cpu_features = "baseline-d-f",1342 .os_tag = .netbsd,
1122 }) catch unreachable,1343 // Remove this when we bump our baseline to 10.1.0.
1344 .os_version_min = .{ .semver = .{
1345 .major = 10,
1346 .minor = 1,
1347 .patch = 0,
1348 } },
1349 .abi = .eabihf,
1350 },
1123 .link_libc = true,1351 .link_libc = true,
1124 },1352 },
11251353
1126 .{1354 .{
1127 .target = .{1355 .target = .{
1128 .cpu_arch = .riscv64,1356 .cpu_arch = .mipsel,
1129 .os_tag = .linux,1357 .os_tag = .netbsd,
1130 .abi = .none,1358 // Remove this when we bump our baseline to 10.1.0.
1359 .os_version_min = .{ .semver = .{
1360 .major = 10,
1361 .minor = 1,
1362 .patch = 0,
1363 } },
1364 .abi = .eabi,
1131 },1365 },
1366 .link_libc = true,
1132 },1367 },
1133 .{1368 .{
1134 .target = .{1369 .target = .{
1135 .cpu_arch = .riscv64,1370 .cpu_arch = .mipsel,
1136 .os_tag = .linux,1371 .os_tag = .netbsd,
1137 .abi = .musl,1372 // Remove this when we bump our baseline to 10.1.0.
1373 .os_version_min = .{ .semver = .{
1374 .major = 10,
1375 .minor = 1,
1376 .patch = 0,
1377 } },
1378 .abi = .eabihf,
1138 },1379 },
1139 .link_libc = true,1380 .link_libc = true,
1140 },1381 },
1382
1141 .{1383 .{
1142 .target = .{1384 .target = .{
1143 .cpu_arch = .riscv64,1385 .cpu_arch = .powerpc,
1144 .os_tag = .linux,1386 .os_tag = .netbsd,
1145 .abi = .musl,1387 // Remove this when we bump our baseline to 10.1.0.
1388 .os_version_min = .{ .semver = .{
1389 .major = 10,
1390 .minor = 1,
1391 .patch = 0,
1392 } },
1393 .abi = .eabi,
1146 },1394 },
1147 .linkage = .dynamic,
1148 .link_libc = true,1395 .link_libc = true,
1149 .extra_target = true,
1150 },1396 },
1151 .{1397 .{
1152 .target = .{1398 .target = .{
1153 .cpu_arch = .riscv64,1399 .cpu_arch = .powerpc,
1154 .os_tag = .linux,1400 .os_tag = .netbsd,
1155 .abi = .gnu,1401 // Remove this when we bump our baseline to 10.1.0.
1402 .os_version_min = .{ .semver = .{
1403 .major = 10,
1404 .minor = 1,
1405 .patch = 0,
1406 } },
1407 .abi = .eabihf,
1408 },
1409 .link_libc = true,
1410 },
1411
1412 .{
1413 .target = .{
1414 .cpu_arch = .x86,
1415 .os_tag = .netbsd,
1416 // Remove this when we bump our baseline to 10.1.0.
1417 .os_version_min = .{ .semver = .{
1418 .major = 10,
1419 .minor = 1,
1420 .patch = 0,
1421 } },
1422 .abi = .none,
1423 },
1424 .link_libc = true,
1425 },
1426
1427 .{
1428 .target = .{
1429 .cpu_arch = .x86_64,
1430 .os_tag = .netbsd,
1431 // Remove this when we bump our baseline to 10.1.0.
1432 .os_version_min = .{ .semver = .{
1433 .major = 10,
1434 .minor = 1,
1435 .patch = 0,
1436 } },
1437 .abi = .none,
1156 },1438 },
1157 .link_libc = true,1439 .link_libc = true,
1158 },1440 },
11591441
1442 // SPIR-V Targets
1443
1160 .{1444 .{
1161 .target = std.Target.Query.parse(.{1445 .target = std.Target.Query.parse(.{
1162 .arch_os_abi = "riscv64-linux-musl",1446 .arch_os_abi = "spirv64-vulkan",
1163 .cpu_features = "baseline+v+zbb",1447 .cpu_features = "vulkan_v1_2+physical_storage_buffer+int64+float16+float64",
1164 }) catch unreachable,1448 }) catch unreachable,
1165 .use_llvm = false,1449 .use_llvm = false,
1166 .use_lld = false,1450 .use_lld = false,
1451 .skip_modules = &.{ "c-import", "zigc", "std" },
1167 },1452 },
11681453
1454 // WASI Targets
1455
1169 .{1456 .{
1170 .target = .{1457 .target = .{
1171 .cpu_arch = .s390x,1458 .cpu_arch = .wasm32,
1172 .os_tag = .linux,1459 .os_tag = .wasi,
1173 .abi = .none,1460 .abi = .none,
1174 },1461 },
1462 .use_llvm = false,
1463 .use_lld = false,
1175 },1464 },
1176 .{1465 .{
1177 .target = .{1466 .target = .{
1178 .cpu_arch = .s390x,1467 .cpu_arch = .wasm32,
1179 .os_tag = .linux,1468 .os_tag = .wasi,
1469 .abi = .none,
1470 },
1471 },
1472 .{
1473 .target = .{
1474 .cpu_arch = .wasm32,
1475 .os_tag = .wasi,
1180 .abi = .musl,1476 .abi = .musl,
1181 },1477 },
1182 .link_libc = true,1478 .link_libc = true,
1183 },1479 },
1184 // Currently hangs in qemu-s390x.1480
1185 // .{1481 // Windows Targets
1186 // .target = .{1482
1187 // .cpu_arch = .s390x,
1188 // .os_tag = .linux,
1189 // .abi = .musl,
1190 // },
1191 // .linkage = .dynamic,
1192 // .link_libc = true,
1193 // .extra_target = true,
1194 // },
1195 .{1483 .{
1196 .target = .{1484 .target = .{
1197 .cpu_arch = .s390x,1485 .cpu_arch = .aarch64,
1198 .os_tag = .linux,1486 .os_tag = .windows,
1487 .abi = .none,
1488 },
1489 },
1490 .{
1491 .target = .{
1492 .cpu_arch = .aarch64,
1493 .os_tag = .windows,
1199 .abi = .gnu,1494 .abi = .gnu,
1200 },1495 },
1201 .link_libc = true,1496 .link_libc = true,
1202 },1497 },
1203
1204 .{1498 .{
1205 .target = .{1499 .target = .{
1206 .cpu_arch = .x86_64,1500 .cpu_arch = .aarch64,
1207 .os_tag = .macos,1501 .os_tag = .windows,
1208 .abi = .none,1502 .abi = .msvc,
1209 },1503 },
1504 .link_libc = true,
1210 },1505 },
12111506
1212 .{1507 .{
1213 .target = .{1508 .target = .{
1214 .cpu_arch = .aarch64,1509 .cpu_arch = .x86,
1215 .os_tag = .macos,1510 .os_tag = .windows,
1216 .abi = .none,1511 .abi = .none,
1217 },1512 },
1218 },1513 },
12191514 .{
1515 .target = .{
1516 .cpu_arch = .x86,
1517 .os_tag = .windows,
1518 .abi = .gnu,
1519 },
1520 .link_libc = true,
1521 },
1220 .{1522 .{
1221 .target = .{1523 .target = .{
1222 .cpu_arch = .x86,1524 .cpu_arch = .x86,
1223 .os_tag = .windows,1525 .os_tag = .windows,
1224 .abi = .msvc,1526 .abi = .msvc,
1225 },1527 },
1528 .link_libc = true,
1226 },1529 },
12271530
1228 .{1531 .{
1229 .target = .{1532 .target = .{
1230 .cpu_arch = .x86_64,1533 .cpu_arch = .thumb,
1534 .os_tag = .windows,
1535 .abi = .none,
1536 },
1537 },
1538 // https://github.com/ziglang/zig/issues/24016
1539 // .{
1540 // .target = .{
1541 // .cpu_arch = .thumb,
1542 // .os_tag = .windows,
1543 // .abi = .gnu,
1544 // },
1545 // .link_libc = true,
1546 // },
1547 .{
1548 .target = .{
1549 .cpu_arch = .thumb,
1231 .os_tag = .windows,1550 .os_tag = .windows,
1232 .abi = .msvc,1551 .abi = .msvc,
1233 },1552 },
1553 .link_libc = true,
1234 },1554 },
12351555
1236 .{1556 .{
1237 .target = .{1557 .target = .{
1238 .cpu_arch = .x86,1558 .cpu_arch = .x86_64,
1559 .os_tag = .windows,
1560 .abi = .none,
1561 },
1562 .use_llvm = false,
1563 .use_lld = false,
1564 },
1565 .{
1566 .target = .{
1567 .cpu_arch = .x86_64,
1568 .os_tag = .windows,
1569 .abi = .none,
1570 },
1571 },
1572 .{
1573 .target = .{
1574 .cpu_arch = .x86_64,
1239 .os_tag = .windows,1575 .os_tag = .windows,
1240 .abi = .gnu,1576 .abi = .gnu,
1241 },1577 },
1242 .link_libc = true,1578 .link_libc = true,
1243 },1579 },
1244
1245 .{1580 .{
1246 .target = .{1581 .target = .{
1247 .cpu_arch = .x86_64,1582 .cpu_arch = .x86_64,
1248 .os_tag = .windows,1583 .os_tag = .windows,
1249 .abi = .gnu,1584 .abi = .msvc,
1250 },1585 },
1251 .link_libc = true,1586 .link_libc = true,
1252 },1587 },
...@@ -1263,104 +1598,122 @@ const CAbiTarget = struct {...@@ -1263,104 +1598,122 @@ const CAbiTarget = struct {
1263};1598};
12641599
1265const c_abi_targets = [_]CAbiTarget{1600const c_abi_targets = [_]CAbiTarget{
1601 // Native Targets
1602
1266 .{},1603 .{},
1604
1605 // Linux Targets
1606
1267 .{1607 .{
1268 .target = .{1608 .target = .{
1269 .cpu_arch = .x86_64,1609 .cpu_arch = .aarch64,
1270 .os_tag = .linux,1610 .os_tag = .linux,
1271 .abi = .musl,1611 .abi = .musl,
1272 },1612 },
1273 },1613 },
1614
1274 .{1615 .{
1275 .target = .{1616 .target = .{
1276 .cpu_arch = .x86_64,1617 .cpu_arch = .arm,
1277 .os_tag = .linux,1618 .os_tag = .linux,
1278 .abi = .musl,1619 .abi = .musleabihf,
1279 },1620 },
1280 .use_llvm = false,
1281 .use_lld = false,
1282 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1283 },1621 },
1622
1284 .{1623 .{
1285 .target = .{1624 .target = .{
1286 .cpu_arch = .x86_64,1625 .cpu_arch = .mips,
1287 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
1288 .os_tag = .linux,1626 .os_tag = .linux,
1289 .abi = .musl,1627 .abi = .musleabihf,
1290 },1628 },
1291 .use_llvm = false,
1292 .use_lld = false,
1293 .strip = true,
1294 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1295 },1629 },
1630
1296 .{1631 .{
1297 .target = .{1632 .target = .{
1298 .cpu_arch = .x86_64,1633 .cpu_arch = .powerpc,
1299 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
1300 .os_tag = .linux,1634 .os_tag = .linux,
1301 .abi = .musl,1635 .abi = .musleabihf,
1302 },1636 },
1303 .use_llvm = false,
1304 .use_lld = false,
1305 .pic = true,
1306 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1307 },1637 },
1638
1308 .{1639 .{
1309 .target = .{1640 .target = .{
1310 .cpu_arch = .x86,1641 .cpu_arch = .powerpc64le,
1311 .os_tag = .linux,1642 .os_tag = .linux,
1312 .abi = .musl,1643 .abi = .musl,
1313 },1644 },
1314 },1645 },
1646
1315 .{1647 .{
1316 .target = .{1648 .target = .{
1317 .cpu_arch = .aarch64,1649 .cpu_arch = .riscv64,
1318 .os_tag = .linux,1650 .os_tag = .linux,
1319 .abi = .musl,1651 .abi = .musl,
1320 },1652 },
1321 },1653 },
1654
1322 .{1655 .{
1323 .target = .{1656 .target = .{
1324 .cpu_arch = .arm,1657 .cpu_arch = .x86,
1325 .os_tag = .linux,1658 .os_tag = .linux,
1326 .abi = .musleabihf,1659 .abi = .musl,
1327 },1660 },
1328 },1661 },
1662
1329 .{1663 .{
1330 .target = .{1664 .target = .{
1331 .cpu_arch = .mips,1665 .cpu_arch = .x86_64,
1332 .os_tag = .linux,1666 .os_tag = .linux,
1333 .abi = .musleabihf,1667 .abi = .musl,
1334 },1668 },
1669 .use_llvm = false,
1670 .use_lld = false,
1671 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1335 },1672 },
1336 .{1673 .{
1337 .target = .{1674 .target = .{
1338 .cpu_arch = .riscv64,1675 .cpu_arch = .x86_64,
1676 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
1339 .os_tag = .linux,1677 .os_tag = .linux,
1340 .abi = .musl,1678 .abi = .musl,
1341 },1679 },
1680 .use_llvm = false,
1681 .use_lld = false,
1682 .strip = true,
1683 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1342 },1684 },
1343 .{1685 .{
1344 .target = .{1686 .target = .{
1345 .cpu_arch = .wasm32,1687 .cpu_arch = .x86_64,
1346 .os_tag = .wasi,1688 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
1689 .os_tag = .linux,
1347 .abi = .musl,1690 .abi = .musl,
1348 },1691 },
1692 .use_llvm = false,
1693 .use_lld = false,
1694 .pic = true,
1695 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
1349 },1696 },
1350 .{1697 .{
1351 .target = .{1698 .target = .{
1352 .cpu_arch = .powerpc,1699 .cpu_arch = .x86_64,
1353 .os_tag = .linux,1700 .os_tag = .linux,
1354 .abi = .musleabihf,1701 .abi = .musl,
1355 },1702 },
1356 },1703 },
1704
1705 // WASI Targets
1706
1357 .{1707 .{
1358 .target = .{1708 .target = .{
1359 .cpu_arch = .powerpc64le,1709 .cpu_arch = .wasm32,
1360 .os_tag = .linux,1710 .os_tag = .wasi,
1361 .abi = .musl,1711 .abi = .musl,
1362 },1712 },
1363 },1713 },
1714
1715 // Windows Targets
1716
1364 .{1717 .{
1365 .target = .{1718 .target = .{
1366 .cpu_arch = .x86,1719 .cpu_arch = .x86,
...@@ -1776,6 +2129,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1776,6 +2129,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1776 if (options.skip_libc and test_target.link_libc == true)2129 if (options.skip_libc and test_target.link_libc == true)
1777 continue;2130 continue;
17782131
2132 // We can't provide MSVC libc when cross-compiling.
2133 if (target.abi == .msvc and test_target.link_libc == true and builtin.os.tag != .windows)
2134 continue;
2135
1779 if (options.skip_single_threaded and test_target.single_threaded == true)2136 if (options.skip_single_threaded and test_target.single_threaded == true)
1780 continue;2137 continue;
17812138