1/*- 2 * Copyright (c) 2015-2016 Ruslan Bukin <br@bsdpad.com> 3 * All rights reserved. 4 * 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. 8 * 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). 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 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. 21 * 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 32 * SUCH DAMAGE. 33 */ 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/assym.h> 38#include <sys/proc.h> 39#include <sys/mbuf.h> 40#include <sys/vmmeter.h> 41#include <sys/bus.h> 42#include <vm/vm.h> 43#include <vm/vm_param.h> 44#include <vm/pmap.h> 45#include <vm/vm_map.h> 46 47#include <machine/riscvreg.h> 48#include <machine/frame.h> 49#include <machine/pcb.h> 50#include <machine/cpu.h> 51#include <machine/proc.h> 52#include <machine/cpufunc.h> 53#include <machine/pte.h> 54#include <machine/intr.h> 55#include <machine/machdep.h> 56#include <machine/vmparam.h> 57 58ASSYM(KERNBASE, KERNBASE); 59ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); 60ASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS); 61ASSYM(PMAP_MAPDEV_EARLY_SIZE, PMAP_MAPDEV_EARLY_SIZE); 62 63ASSYM(PM_SATP, offsetof(struct pmap, pm_satp)); 64 65ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); 66ASSYM(PCB_SIZE, sizeof(struct pcb)); 67ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra)); 68ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); 69ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp)); 70ASSYM(PCB_TP, offsetof(struct pcb, pcb_tp)); 71ASSYM(PCB_S, offsetof(struct pcb, pcb_s)); 72ASSYM(PCB_X, offsetof(struct pcb, pcb_x)); 73ASSYM(PCB_FCSR, offsetof(struct pcb, pcb_fcsr)); 74 75ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); 76 77ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 78ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 79 80ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 81ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 82ASSYM(TD_AST, offsetof(struct thread, td_ast)); 83ASSYM(TD_PROC, offsetof(struct thread, td_proc)); 84ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); 85ASSYM(TD_MD, offsetof(struct thread, td_md)); 86ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 87 88ASSYM(TF_SIZE, roundup2(sizeof(struct trapframe), STACKALIGNBYTES + 1)); 89ASSYM(TF_RA, offsetof(struct trapframe, tf_ra)); 90ASSYM(TF_SP, offsetof(struct trapframe, tf_sp)); 91ASSYM(TF_GP, offsetof(struct trapframe, tf_gp)); 92ASSYM(TF_TP, offsetof(struct trapframe, tf_tp)); 93ASSYM(TF_T, offsetof(struct trapframe, tf_t)); 94ASSYM(TF_S, offsetof(struct trapframe, tf_s)); 95ASSYM(TF_A, offsetof(struct trapframe, tf_a)); 96ASSYM(TF_SEPC, offsetof(struct trapframe, tf_sepc)); 97ASSYM(TF_STVAL, offsetof(struct trapframe, tf_stval)); 98ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause)); 99ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus)); 100 101ASSYM(RISCV_BOOTPARAMS_SIZE, sizeof(struct riscv_bootparams)); 102ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct riscv_bootparams, kern_phys)); 103ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams, 104 kern_stack)); 105ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, dtbp_phys)); 106ASSYM(RISCV_BOOTPARAMS_MODULEP, offsetof(struct riscv_bootparams, modulep)); 107