1 /* 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * All advertising materials mentioning features or use of this software 10 * must display the following acknowledgement: 11 * This product includes software developed by the University of 12 * California, Lawrence Berkeley Laboratories. 13 * 14 * %sccs.include.redist.c% 15 * 16 * @(#)genassym.c 7.3 (Berkeley) 10/11/92 17 * 18 * from: $Header: genassym.c,v 1.12 92/06/28 10:13:01 mccanne $ (LBL) 19 */ 20 21 #include <sys/param.h> 22 #include <sys/buf.h> 23 #include <sys/proc.h> 24 #include <sys/map.h> 25 #include <sys/proc.h> 26 #include <sys/mbuf.h> 27 #include <sys/msgbuf.h> 28 #include <sys/syscall.h> 29 #include <sys/user.h> 30 31 #include <machine/pmap.h> 32 #include <machine/psl.h> 33 34 #ifdef notyet 35 #include <sparc/dev/zsreg.h> 36 #include <sparc/dev/zsvar.h> 37 #endif 38 #include <sparc/dev/bsd_audioreg.h> 39 #include <sparc/dev/bsd_audiovar.h> 40 41 #include <sparc/sparc/intreg.h> 42 43 #include <stdio.h> 44 /*#include <stddef.h>*/ 45 46 #ifndef offsetof 47 #define offsetof(str, mem) ((size_t)&((str *)0)->mem) 48 #endif 49 50 #define off(what, str, mem) def(what, (int)offsetof(str, mem)) 51 52 void 53 def(what, where) 54 char *what; 55 int where; 56 { 57 58 if (printf("#define\t%s\t%d\n", what, where) < 0) { 59 perror("printf"); 60 exit(1); 61 } 62 } 63 64 void 65 flush() 66 { 67 68 if (fflush(stdout)) { 69 perror("fflush"); 70 exit(1); 71 } 72 } 73 74 main() 75 { 76 77 /* general constants */ 78 def("BSD", BSD); 79 def("UPAGES", UPAGES); 80 def("NBPG", NBPG); 81 def("KERNBASE", KERNBASE); 82 def("USRSTACK", USRSTACK); 83 84 /* proc fields and values */ 85 off("P_ADDR", struct proc, p_addr); 86 off("P_STAT", struct proc, p_stat); 87 off("P_WCHAN", struct proc, p_wchan); 88 off("P_VMSPACE", struct proc, p_vmspace); 89 off("P_RTIME", struct proc, p_rtime); 90 def("SRUN", SRUN); 91 92 /* VM structure fields */ 93 off("VM_PMAP", struct vmspace, vm_pmap); 94 off("VM_PMAP_CTX", struct vmspace, vm_pmap.pm_ctx); 95 off("VM_PMAP_CTXNUM", struct vmspace, vm_pmap.pm_ctxnum); 96 97 /* interrupt/fault metering */ 98 off("V_SWTCH", struct vmmeter, v_swtch); 99 off("V_INTR", struct vmmeter, v_intr); 100 off("V_FAULTS", struct vmmeter, v_faults); 101 102 /* PTE bits and related information */ 103 def("PG_W", PG_W); 104 def("PG_VSHIFT", PG_VSHIFT); 105 def("PG_PROTSHIFT", PG_PROTSHIFT); 106 def("PG_PROTUREAD", PG_PROTUREAD); 107 def("PG_PROTUWRITE", PG_PROTUWRITE); 108 109 /* FPU state */ 110 off("FS_REGS", struct fpstate, fs_regs); 111 off("FS_FSR", struct fpstate, fs_fsr); 112 off("FS_QSIZE", struct fpstate, fs_qsize); 113 off("FS_QUEUE", struct fpstate, fs_queue); 114 def("FSR_QNE", FSR_QNE); 115 116 /* system calls */ 117 def("SYS_sigreturn", SYS_sigreturn); 118 def("SYS_execve", SYS_execve); 119 def("SYS_exit", SYS_exit); 120 121 /* errno */ 122 def("EFAULT", EFAULT); 123 def("ENAMETOOLONG", ENAMETOOLONG); 124 125 /* PCB fields */ 126 off("PCB_NSAVED", struct pcb, pcb_nsaved); 127 off("PCB_ONFAULT", struct pcb, pcb_onfault); 128 off("PCB_PSR", struct pcb, pcb_psr); 129 off("PCB_RW", struct pcb, pcb_rw); 130 off("PCB_SP", struct pcb, pcb_sp); 131 off("PCB_PC", struct pcb, pcb_pc); 132 off("PCB_UW", struct pcb, pcb_uw); 133 off("PCB_WIM", struct pcb, pcb_wim); 134 135 /* interrupt enable register PTE */ 136 def("IE_REG_PTE", PG_V | PG_W | PG_S | PG_NC | PG_OBIO | 137 ((u_int)INT_ENABLE_REG_PHYSADR >> PGSHIFT)); 138 139 #ifdef notyet 140 /* ZSCC interrupt fields */ 141 off("ZSC_A", struct zs_softc, sc_a); 142 off("ZSC_B", struct zs_softc, sc_b); 143 /* off("ZL_WREG", struct zs_line, zl_wreg); */ 144 off("ZL_TBC", struct zs_line, zl_tbc); 145 off("ZL_TBA", struct zs_line, zl_tba); 146 off("ZL_RBPUT", struct zs_line, zl_rbput); 147 off("ZL_RBUF", struct zs_line, zl_rbuf); 148 def("ZSRR1_DO_bit", ffs(ZSRR1_DO) - 1); 149 #endif 150 /* audio trap handler fields */ 151 def("AUCB_SIZE", AUCB_SIZE); 152 off("CB_HEAD", struct aucb, cb_head); 153 off("CB_TAIL", struct aucb, cb_tail); 154 off("CB_PAUSE", struct aucb, cb_pause); 155 off("CB_DATA", struct aucb, cb_data); 156 off("CB_DROPS", struct aucb, cb_drops); 157 off("CB_PDROPS", struct aucb, cb_drops); 158 off("CB_THRESH", struct aucb, cb_thresh); 159 off("CB_WAKING", struct aucb, cb_waking); 160 off("AU_AMD", struct auio, au_amd); 161 off("AU_RB", struct auio, au_rb); 162 off("AU_WB", struct auio, au_wb); 163 off("AU_STAMP", struct auio, au_stamp); 164 off("AMD_IR", struct amd7930, ir); 165 off("AMD_BBRB", struct amd7930, bbrb); 166 off("AMD_BBTB", struct amd7930, bbtb); 167 168 flush(); 169 170 exit(0); 171 } 172