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