authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-29 16:25:16+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-29 16:48:28+02:00
logcbf9d3c570aa1404b0948741948def324044cf7c
tree9c15d83cedd4d4cdd81167b510e53dc03c23bbde
parentaeebb131c858751a2585da4ad92beb76ae7925f1
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

libc: Remove riscv32-netbsd-none and riscv64-netbsd-none headers.

These were not intended to be included as NetBSD's RISC-V port has not had an official release yet.

78 files changed, 0 insertions(+), 5586 deletions(-)

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