1178172Simp/*- 2178172Simp * Copyright (c) 1982, 1990 The Regents of the University of California. 3178172Simp * All rights reserved. 4178172Simp * 5178172Simp * This code is derived from software contributed to Berkeley by 6178172Simp * William Jolitz. 7178172Simp * 8178172Simp * Redistribution and use in source and binary forms, with or without 9178172Simp * modification, are permitted provided that the following conditions 10178172Simp * are met: 11178172Simp * 1. Redistributions of source code must retain the above copyright 12178172Simp * notice, this list of conditions and the following disclaimer. 13178172Simp * 2. Redistributions in binary form must reproduce the above copyright 14178172Simp * notice, this list of conditions and the following disclaimer in the 15178172Simp * documentation and/or other materials provided with the distribution. 16178172Simp * 4. Neither the name of the University nor the names of its contributors 17178172Simp * may be used to endorse or promote products derived from this software 18178172Simp * without specific prior written permission. 19178172Simp * 20178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30178172Simp * SUCH DAMAGE. 31178172Simp * 32178172Simp * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 33178172Simp * from: src/sys/i386/i386/genassym.c,v 1.86.2.1 2000/05/16 06:58:06 dillon 34178172Simp * JNPR: genassym.c,v 1.4 2007/08/09 11:23:32 katta 35178172Simp */ 36178172Simp 37178172Simp#include <sys/cdefs.h> 38178172Simp__FBSDID("$FreeBSD$"); 39178172Simp 40178172Simp#include <sys/param.h> 41178172Simp#include <sys/systm.h> 42178172Simp#include <sys/assym.h> 43178172Simp#include <machine/pte.h> 44178172Simp#include <sys/proc.h> 45178172Simp#include <sys/errno.h> 46178172Simp#include <sys/lock.h> 47178172Simp#include <sys/mutex.h> 48178172Simp#include <sys/socket.h> 49178172Simp#include <sys/resourcevar.h> 50178172Simp#include <sys/ucontext.h> 51178172Simp#include <sys/vmmeter.h> 52178172Simp#include <vm/vm.h> 53178172Simp#include <vm/vm_param.h> 54178172Simp#include <vm/pmap.h> 55178172Simp#include <vm/vm_map.h> 56206829Sjmallett#include <machine/cpuregs.h> 57178172Simp#include <machine/pcb.h> 58178172Simp#include <machine/sigframe.h> 59178172Simp#include <machine/proc.h> 60178172Simp 61229677Sgonzo#ifdef CPU_CNMIPS 62229677Sgonzo#include <machine/octeon_cop2.h> 63229677Sgonzo#endif 64229677Sgonzo 65178172Simp#ifndef offsetof 66178172Simp#define offsetof(t,m) (int)((&((t *)0L)->m)) 67178172Simp#endif 68178172Simp 69178172SimpASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 70178172SimpASSYM(TD_UPTE, offsetof(struct thread, td_md.md_upte)); 71206819SjmallettASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); 72178172SimpASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 73178172SimpASSYM(TD_LOCK, offsetof(struct thread, td_lock)); 74229677SgonzoASSYM(TD_MDFLAGS, offsetof(struct thread, td_md.md_flags)); 75178172Simp 76178172SimpASSYM(U_PCB_REGS, offsetof(struct pcb, pcb_regs.zero)); 77178172SimpASSYM(U_PCB_CONTEXT, offsetof(struct pcb, pcb_context)); 78178172SimpASSYM(U_PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); 79178172SimpASSYM(U_PCB_FPREGS, offsetof(struct pcb, pcb_regs.f0)); 80178172Simp 81178172SimpASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); 82178172SimpASSYM(PC_SEGBASE, offsetof(struct pcpu, pc_segbase)); 83178172SimpASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); 84178172SimpASSYM(PC_FPCURTHREAD, offsetof(struct pcpu, pc_fpcurthread)); 85178172SimpASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 86178172Simp 87178172SimpASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS); 88178172SimpASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); 89178172SimpASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); 90232449Sjmallett#ifdef COMPAT_FREEBSD32 91232449SjmallettASSYM(SIGF32_UC, offsetof(struct sigframe32, sf_uc)); 92232449Sjmallett#endif 93178172SimpASSYM(SIGFPE, SIGFPE); 94202046SimpASSYM(PAGE_SHIFT, PAGE_SHIFT); 95206746SjmallettASSYM(PAGE_SIZE, PAGE_SIZE); 96210846SjchandraASSYM(PDRSHIFT, PDRSHIFT); 97178172SimpASSYM(SEGSHIFT, SEGSHIFT); 98178172SimpASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); 99178172SimpASSYM(TDF_ASTPENDING, TDF_ASTPENDING); 100202046SimpASSYM(MAXCOMLEN, MAXCOMLEN); 101229677SgonzoASSYM(MDTD_COP2USED, MDTD_COP2USED); 102206829Sjmallett 103206829SjmallettASSYM(MIPS_KSEG0_START, MIPS_KSEG0_START); 104206829SjmallettASSYM(MIPS_KSEG1_START, MIPS_KSEG1_START); 105206829SjmallettASSYM(MIPS_KSEG2_START, MIPS_KSEG2_START); 106210638SjchandraASSYM(MIPS_XKSEG_START, MIPS_XKSEG_START); 107229677Sgonzo 108229677Sgonzo#ifdef CPU_CNMIPS 109229677SgonzoASSYM(TD_COP2OWNER, offsetof(struct thread, td_md.md_cop2owner)); 110229677SgonzoASSYM(TD_COP2, offsetof(struct thread, td_md.md_cop2)); 111229677SgonzoASSYM(TD_UCOP2, offsetof(struct thread, td_md.md_ucop2)); 112229677SgonzoASSYM(COP2_CRC_IV_OFFSET, offsetof(struct octeon_cop2_state, crc_iv)); 113229677SgonzoASSYM(COP2_CRC_LENGTH_OFFSET, offsetof(struct octeon_cop2_state, crc_length)); 114229677SgonzoASSYM(COP2_CRC_POLY_OFFSET, offsetof(struct octeon_cop2_state, crc_poly)); 115229677SgonzoASSYM(COP2_LLM_DAT0_OFFSET, offsetof(struct octeon_cop2_state, llm_dat)); 116229677SgonzoASSYM(COP2_LLM_DAT1_OFFSET, offsetof(struct octeon_cop2_state, llm_dat) + 8); 117229677SgonzoASSYM(COP2_3DES_IV_OFFSET, offsetof(struct octeon_cop2_state, _3des_iv)); 118229677SgonzoASSYM(COP2_3DES_KEY0_OFFSET, offsetof(struct octeon_cop2_state, _3des_key)); 119229677SgonzoASSYM(COP2_3DES_KEY1_OFFSET, offsetof(struct octeon_cop2_state, _3des_key) + 8); 120229677SgonzoASSYM(COP2_3DES_KEY2_OFFSET, offsetof(struct octeon_cop2_state, _3des_key) + 16); 121229677SgonzoASSYM(COP2_3DES_RESULT_OFFSET, offsetof(struct octeon_cop2_state, _3des_result)); 122229677SgonzoASSYM(COP2_AES_INP0_OFFSET, offsetof(struct octeon_cop2_state, aes_inp0)); 123229677SgonzoASSYM(COP2_AES_IV0_OFFSET, offsetof(struct octeon_cop2_state, aes_iv)); 124229677SgonzoASSYM(COP2_AES_IV1_OFFSET, offsetof(struct octeon_cop2_state, aes_iv) + 8); 125229677SgonzoASSYM(COP2_AES_KEY0_OFFSET, offsetof(struct octeon_cop2_state, aes_key)); 126229677SgonzoASSYM(COP2_AES_KEY1_OFFSET, offsetof(struct octeon_cop2_state, aes_key) + 8); 127229677SgonzoASSYM(COP2_AES_KEY2_OFFSET, offsetof(struct octeon_cop2_state, aes_key) + 16); 128229677SgonzoASSYM(COP2_AES_KEY3_OFFSET, offsetof(struct octeon_cop2_state, aes_key) + 24); 129229677SgonzoASSYM(COP2_AES_KEYLEN_OFFSET, offsetof(struct octeon_cop2_state, aes_keylen)); 130229677SgonzoASSYM(COP2_AES_RESULT0_OFFSET, offsetof(struct octeon_cop2_state, aes_result)); 131229677SgonzoASSYM(COP2_AES_RESULT1_OFFSET, offsetof(struct octeon_cop2_state, aes_result) + 8); 132229677SgonzoASSYM(COP2_HSH_DATW0_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw)); 133229677SgonzoASSYM(COP2_HSH_DATW1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 8); 134229677SgonzoASSYM(COP2_HSH_DATW2_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 16); 135229677SgonzoASSYM(COP2_HSH_DATW3_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 24); 136229677SgonzoASSYM(COP2_HSH_DATW4_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 32); 137229677SgonzoASSYM(COP2_HSH_DATW5_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 40); 138229677SgonzoASSYM(COP2_HSH_DATW6_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 48); 139229677SgonzoASSYM(COP2_HSH_DATW7_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 56); 140229677SgonzoASSYM(COP2_HSH_DATW8_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 64); 141229677SgonzoASSYM(COP2_HSH_DATW9_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 72); 142229677SgonzoASSYM(COP2_HSH_DATW10_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 80); 143229677SgonzoASSYM(COP2_HSH_DATW11_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 88); 144229677SgonzoASSYM(COP2_HSH_DATW12_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 96); 145229677SgonzoASSYM(COP2_HSH_DATW13_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 104); 146229677SgonzoASSYM(COP2_HSH_DATW14_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 112); 147229677SgonzoASSYM(COP2_HSH_IVW0_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw)); 148229677SgonzoASSYM(COP2_HSH_IVW1_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 8); 149229677SgonzoASSYM(COP2_HSH_IVW2_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 16); 150229677SgonzoASSYM(COP2_HSH_IVW3_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 24); 151229677SgonzoASSYM(COP2_HSH_IVW4_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 32); 152229677SgonzoASSYM(COP2_HSH_IVW5_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 40); 153229677SgonzoASSYM(COP2_HSH_IVW6_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 48); 154229677SgonzoASSYM(COP2_HSH_IVW7_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 56); 155229677SgonzoASSYM(COP2_GFM_MULT0_OFFSET, offsetof(struct octeon_cop2_state, gfm_mult)); 156229677SgonzoASSYM(COP2_GFM_MULT1_OFFSET, offsetof(struct octeon_cop2_state, gfm_mult) + 8); 157229677SgonzoASSYM(COP2_GFM_POLY_OFFSET, offsetof(struct octeon_cop2_state, gfm_poly)); 158229677SgonzoASSYM(COP2_GFM_RESULT0_OFFSET, offsetof(struct octeon_cop2_state, gfm_result)); 159229677SgonzoASSYM(COP2_GFM_RESULT1_OFFSET, offsetof(struct octeon_cop2_state, gfm_result) + 8); 160229677SgonzoASSYM(COP2_HSH_DATW0_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw)); 161229677SgonzoASSYM(COP2_HSH_DATW1_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 8); 162229677SgonzoASSYM(COP2_HSH_DATW2_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 16); 163229677SgonzoASSYM(COP2_HSH_DATW3_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 24); 164229677SgonzoASSYM(COP2_HSH_DATW4_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 32); 165229677SgonzoASSYM(COP2_HSH_DATW5_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 40); 166229677SgonzoASSYM(COP2_HSH_DATW6_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_datw) + 48); 167229677SgonzoASSYM(COP2_HSH_IVW0_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw)); 168229677SgonzoASSYM(COP2_HSH_IVW1_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 8); 169229677SgonzoASSYM(COP2_HSH_IVW2_PASS1_OFFSET, offsetof(struct octeon_cop2_state, hsh_ivw) + 16); 170229677Sgonzo#endif 171