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