2 * Copyright (c) 2015-2016 Ruslan Bukin <br@bsdpad.com>
5 * Portions of this software were developed by SRI International and the
6 * University of Cambridge Computer Laboratory under DARPA/AFRL contract
7 * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
9 * Portions of this software were developed by the University of Cambridge
10 * Computer Laboratory as part of the CTSRD Project, with support from the
11 * UK Higher Education Innovation Fund (HEIF).
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/assym.h>
43 #include <sys/vmmeter.h>
46 #include <vm/vm_param.h>
48 #include <vm/vm_map.h>
50 #include <machine/riscvreg.h>
51 #include <machine/frame.h>
52 #include <machine/pcb.h>
53 #include <machine/cpu.h>
54 #include <machine/proc.h>
55 #include <machine/cpufunc.h>
56 #include <machine/pte.h>
57 #include <machine/intr.h>
58 #include <machine/machdep.h>
59 #include <machine/vmparam.h>
61 ASSYM(KERNBASE, KERNBASE);
62 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
63 ASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS);
64 ASSYM(VM_EARLY_DTB_ADDRESS, VM_EARLY_DTB_ADDRESS);
65 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
66 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
68 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
69 ASSYM(PCB_SIZE, sizeof(struct pcb));
70 ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra));
71 ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
72 ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp));
73 ASSYM(PCB_TP, offsetof(struct pcb, pcb_tp));
74 ASSYM(PCB_S, offsetof(struct pcb, pcb_s));
75 ASSYM(PCB_X, offsetof(struct pcb, pcb_x));
76 ASSYM(PCB_FCSR, offsetof(struct pcb, pcb_fcsr));
78 ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
80 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
81 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
83 ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
84 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
85 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
86 ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
87 ASSYM(TD_MD, offsetof(struct thread, td_md));
88 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
90 ASSYM(TF_SIZE, sizeof(struct trapframe));
91 ASSYM(TF_RA, offsetof(struct trapframe, tf_ra));
92 ASSYM(TF_SP, offsetof(struct trapframe, tf_sp));
93 ASSYM(TF_GP, offsetof(struct trapframe, tf_gp));
94 ASSYM(TF_TP, offsetof(struct trapframe, tf_tp));
95 ASSYM(TF_T, offsetof(struct trapframe, tf_t));
96 ASSYM(TF_S, offsetof(struct trapframe, tf_s));
97 ASSYM(TF_A, offsetof(struct trapframe, tf_a));
98 ASSYM(TF_SEPC, offsetof(struct trapframe, tf_sepc));
99 ASSYM(TF_STVAL, offsetof(struct trapframe, tf_stval));
100 ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause));
101 ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus));
103 ASSYM(RISCV_BOOTPARAMS_SIZE, sizeof(struct riscv_bootparams));
104 ASSYM(RISCV_BOOTPARAMS_KERN_L1PT, offsetof(struct riscv_bootparams, kern_l1pt));
105 ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct riscv_bootparams, kern_phys));
106 ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams,
108 ASSYM(RISCV_BOOTPARAMS_DTBP_VIRT, offsetof(struct riscv_bootparams, dtbp_virt));
109 ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, dtbp_phys));
110 ASSYM(RISCV_BOOTPARAMS_MODULEP, offsetof(struct riscv_bootparams, modulep));