1 /* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. 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 Laboratory. 13 * 14 * %sccs.include.redist.c% 15 * 16 * @(#)genassym.c 8.1 (Berkeley) 06/11/93 17 * 18 * from: $Header: genassym.c,v 1.15 93/04/21 06:09:30 torek Exp $ (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 #define off(what, str, mem) def(what, (int)offsetof(str, mem)) 47 48 void 49 def(what, where) 50 char *what; 51 int where; 52 { 53 54 if (printf("#define\t%s\t%d\n", what, where) < 0) { 55 perror("printf"); 56 exit(1); 57 } 58 } 59 60 void 61 flush() 62 { 63 64 if (fflush(stdout)) { 65 perror("fflush"); 66 exit(1); 67 } 68 } 69 70 main() 71 { 72 73 /* general constants */ 74 def("BSD", BSD); 75 def("UPAGES", UPAGES); 76 def("NBPG", NBPG); 77 def("KERNBASE", KERNBASE); 78 def("USRSTACK", USRSTACK); 79 80 /* proc fields and values */ 81 off("P_ADDR", struct proc, p_addr); 82 off("P_STAT", struct proc, p_stat); 83 off("P_WCHAN", struct proc, p_wchan); 84 off("P_VMSPACE", struct proc, p_vmspace); 85 off("P_RTIME", struct proc, p_rtime); 86 def("SRUN", SRUN); 87 88 /* VM structure fields */ 89 off("VM_PMAP", struct vmspace, vm_pmap); 90 off("VM_PMAP_CTX", struct vmspace, vm_pmap.pm_ctx); 91 off("VM_PMAP_CTXNUM", struct vmspace, vm_pmap.pm_ctxnum); 92 93 /* interrupt/fault metering */ 94 off("V_SWTCH", struct vmmeter, v_swtch); 95 off("V_INTR", struct vmmeter, v_intr); 96 off("V_FAULTS", struct vmmeter, v_faults); 97 98 /* PTE bits and related information */ 99 def("PG_W", PG_W); 100 def("PG_VSHIFT", PG_VSHIFT); 101 def("PG_PROTSHIFT", PG_PROTSHIFT); 102 def("PG_PROTUREAD", PG_PROTUREAD); 103 def("PG_PROTUWRITE", PG_PROTUWRITE); 104 105 /* FPU state */ 106 off("FS_REGS", struct fpstate, fs_regs); 107 off("FS_FSR", struct fpstate, fs_fsr); 108 off("FS_QSIZE", struct fpstate, fs_qsize); 109 off("FS_QUEUE", struct fpstate, fs_queue); 110 def("FSR_QNE", FSR_QNE); 111 112 /* system calls */ 113 def("SYS_sigreturn", SYS_sigreturn); 114 def("SYS_execve", SYS_execve); 115 def("SYS_exit", SYS_exit); 116 117 /* errno */ 118 def("EFAULT", EFAULT); 119 def("ENAMETOOLONG", ENAMETOOLONG); 120 121 /* PCB fields */ 122 off("PCB_NSAVED", struct pcb, pcb_nsaved); 123 off("PCB_ONFAULT", struct pcb, pcb_onfault); 124 off("PCB_PSR", struct pcb, pcb_psr); 125 off("PCB_RW", struct pcb, pcb_rw); 126 off("PCB_SP", struct pcb, pcb_sp); 127 off("PCB_PC", struct pcb, pcb_pc); 128 off("PCB_UW", struct pcb, pcb_uw); 129 off("PCB_WIM", struct pcb, pcb_wim); 130 131 /* interrupt enable register PTE */ 132 def("IE_REG_PTE", PG_V | PG_W | PG_S | PG_NC | PG_OBIO | 133 ((u_int)INT_ENABLE_REG_PHYSADR >> PGSHIFT)); 134 135 #ifdef notyet 136 /* ZSCC interrupt fields */ 137 off("ZSC_A", struct zs_softc, sc_a); 138 off("ZSC_B", struct zs_softc, sc_b); 139 /* off("ZL_WREG", struct zs_line, zl_wreg); */ 140 off("ZL_TBC", struct zs_line, zl_tbc); 141 off("ZL_TBA", struct zs_line, zl_tba); 142 off("ZL_RBPUT", struct zs_line, zl_rbput); 143 off("ZL_RBUF", struct zs_line, zl_rbuf); 144 def("ZSRR1_DO_bit", ffs(ZSRR1_DO) - 1); 145 #endif 146 /* audio trap handler fields */ 147 def("AUCB_SIZE", AUCB_SIZE); 148 off("CB_HEAD", struct aucb, cb_head); 149 off("CB_TAIL", struct aucb, cb_tail); 150 off("CB_PAUSE", struct aucb, cb_pause); 151 off("CB_DATA", struct aucb, cb_data); 152 off("CB_DROPS", struct aucb, cb_drops); 153 off("CB_PDROPS", struct aucb, cb_drops); 154 off("CB_THRESH", struct aucb, cb_thresh); 155 off("CB_WAKING", struct aucb, cb_waking); 156 off("AU_AMD", struct auio, au_amd); 157 off("AU_RB", struct auio, au_rb); 158 off("AU_WB", struct auio, au_wb); 159 off("AU_STAMP", struct auio, au_stamp); 160 off("AMD_IR", struct amd7930, ir); 161 off("AMD_BBRB", struct amd7930, bbrb); 162 off("AMD_BBTB", struct amd7930, bbtb); 163 164 flush(); 165 166 exit(0); 167 } 168