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