xref: /csrg-svn/sys/sparc/sparc/genassym.c (revision 56541)
155148Storek /*
255148Storek  * Copyright (c) 1992 The Regents of the University of California.
355148Storek  * All rights reserved.
455148Storek  *
555148Storek  * This software was developed by the Computer Systems Engineering group
655148Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
755148Storek  * contributed to Berkeley.
855148Storek  *
955504Sbostic  * All advertising materials mentioning features or use of this software
1055504Sbostic  * must display the following acknowledgement:
1155504Sbostic  *	This product includes software developed by the University of
1255504Sbostic  *	California, Lawrence Berkeley Laboratories.
1355504Sbostic  *
1455148Storek  * %sccs.include.redist.c%
1555148Storek  *
16*56541Sbostic  *	@(#)genassym.c	7.3 (Berkeley) 10/11/92
1755148Storek  *
1855148Storek  * from: $Header: genassym.c,v 1.12 92/06/28 10:13:01 mccanne $ (LBL)
1955148Storek  */
2055148Storek 
21*56541Sbostic #include <sys/param.h>
22*56541Sbostic #include <sys/buf.h>
23*56541Sbostic #include <sys/proc.h>
24*56541Sbostic #include <sys/map.h>
25*56541Sbostic #include <sys/proc.h>
26*56541Sbostic #include <sys/mbuf.h>
27*56541Sbostic #include <sys/msgbuf.h>
28*56541Sbostic #include <sys/syscall.h>
29*56541Sbostic #include <sys/user.h>
3055148Storek 
31*56541Sbostic #include <machine/pmap.h>
32*56541Sbostic #include <machine/psl.h>
33*56541Sbostic 
3455148Storek #ifdef notyet
35*56541Sbostic #include <sparc/dev/zsreg.h>
36*56541Sbostic #include <sparc/dev/zsvar.h>
3755148Storek #endif
38*56541Sbostic #include <sparc/dev/bsd_audioreg.h>
39*56541Sbostic #include <sparc/dev/bsd_audiovar.h>
4055148Storek 
41*56541Sbostic #include <sparc/sparc/intreg.h>
4255148Storek 
4355148Storek #include <stdio.h>
44*56541Sbostic /*#include <stddef.h>*/
4555148Storek 
4655148Storek #ifndef offsetof
4755148Storek #define	offsetof(str, mem) ((size_t)&((str *)0)->mem)
4855148Storek #endif
4955148Storek 
5055148Storek #define	off(what, str, mem) def(what, (int)offsetof(str, mem))
5155148Storek 
5255148Storek void
5355148Storek def(what, where)
5455148Storek 	char *what;
5555148Storek 	int where;
5655148Storek {
5755148Storek 
5855148Storek 	if (printf("#define\t%s\t%d\n", what, where) < 0) {
5955148Storek 		perror("printf");
6055148Storek 		exit(1);
6155148Storek 	}
6255148Storek }
6355148Storek 
6455148Storek void
6555148Storek flush()
6655148Storek {
6755148Storek 
6855148Storek 	if (fflush(stdout)) {
6955148Storek 		perror("fflush");
7055148Storek 		exit(1);
7155148Storek 	}
7255148Storek }
7355148Storek 
7455148Storek main()
7555148Storek {
7655148Storek 
7755148Storek 	/* general constants */
7855148Storek 	def("BSD", BSD);
7955148Storek 	def("UPAGES", UPAGES);
8055148Storek 	def("NBPG", NBPG);
8155148Storek 	def("KERNBASE", KERNBASE);
8255148Storek 	def("USRSTACK", USRSTACK);
8355148Storek 
8455148Storek 	/* proc fields and values */
8555148Storek 	off("P_ADDR", struct proc, p_addr);
8655148Storek 	off("P_STAT", struct proc, p_stat);
8755148Storek 	off("P_WCHAN", struct proc, p_wchan);
8855148Storek 	off("P_VMSPACE", struct proc, p_vmspace);
8955148Storek 	off("P_RTIME", struct proc, p_rtime);
9055148Storek 	def("SRUN", SRUN);
9155148Storek 
9255148Storek 	/* VM structure fields */
9355148Storek 	off("VM_PMAP", struct vmspace, vm_pmap);
9455148Storek 	off("VM_PMAP_CTX", struct vmspace, vm_pmap.pm_ctx);
9555148Storek 	off("VM_PMAP_CTXNUM", struct vmspace, vm_pmap.pm_ctxnum);
9655148Storek 
9755148Storek 	/* interrupt/fault metering */
9855148Storek 	off("V_SWTCH", struct vmmeter, v_swtch);
9955148Storek 	off("V_INTR", struct vmmeter, v_intr);
10055148Storek 	off("V_FAULTS", struct vmmeter, v_faults);
10155148Storek 
10255148Storek 	/* PTE bits and related information */
10355148Storek 	def("PG_W", PG_W);
10455148Storek 	def("PG_VSHIFT", PG_VSHIFT);
10555148Storek 	def("PG_PROTSHIFT", PG_PROTSHIFT);
10655148Storek 	def("PG_PROTUREAD", PG_PROTUREAD);
10755148Storek 	def("PG_PROTUWRITE", PG_PROTUWRITE);
10855148Storek 
10955148Storek 	/* FPU state */
11055148Storek 	off("FS_REGS", struct fpstate, fs_regs);
11155148Storek 	off("FS_FSR", struct fpstate, fs_fsr);
11255148Storek 	off("FS_QSIZE", struct fpstate, fs_qsize);
11355148Storek 	off("FS_QUEUE", struct fpstate, fs_queue);
11455148Storek 	def("FSR_QNE", FSR_QNE);
11555148Storek 
11655148Storek 	/* system calls */
11755148Storek 	def("SYS_sigreturn", SYS_sigreturn);
11855148Storek 	def("SYS_execve", SYS_execve);
11955148Storek 	def("SYS_exit", SYS_exit);
12055148Storek 
12155148Storek 	/* errno */
12255148Storek 	def("EFAULT", EFAULT);
12355148Storek 	def("ENAMETOOLONG", ENAMETOOLONG);
12455148Storek 
12555148Storek 	/* PCB fields */
12655148Storek 	off("PCB_NSAVED", struct pcb, pcb_nsaved);
12755148Storek 	off("PCB_ONFAULT", struct pcb, pcb_onfault);
12855148Storek 	off("PCB_PSR", struct pcb, pcb_psr);
12955148Storek 	off("PCB_RW", struct pcb, pcb_rw);
13055148Storek 	off("PCB_SP", struct pcb, pcb_sp);
13155148Storek 	off("PCB_PC", struct pcb, pcb_pc);
13255148Storek 	off("PCB_UW", struct pcb, pcb_uw);
13355148Storek 	off("PCB_WIM", struct pcb, pcb_wim);
13455148Storek 
13555148Storek 	/* interrupt enable register PTE */
13655148Storek 	def("IE_REG_PTE", PG_V | PG_W | PG_S | PG_NC | PG_OBIO |
13755148Storek 	    ((u_int)INT_ENABLE_REG_PHYSADR >> PGSHIFT));
13855148Storek 
13955148Storek #ifdef notyet
14055148Storek 	/* ZSCC interrupt fields */
14155148Storek 	off("ZSC_A", struct zs_softc, sc_a);
14255148Storek 	off("ZSC_B", struct zs_softc, sc_b);
14355148Storek /*	off("ZL_WREG", struct zs_line, zl_wreg); */
14455148Storek 	off("ZL_TBC", struct zs_line, zl_tbc);
14555148Storek 	off("ZL_TBA", struct zs_line, zl_tba);
14655148Storek 	off("ZL_RBPUT", struct zs_line, zl_rbput);
14755148Storek 	off("ZL_RBUF", struct zs_line, zl_rbuf);
14855148Storek 	def("ZSRR1_DO_bit", ffs(ZSRR1_DO) - 1);
14955148Storek #endif
15055148Storek 	/* audio trap handler fields */
15155148Storek 	def("AUCB_SIZE", AUCB_SIZE);
15255148Storek 	off("CB_HEAD", struct aucb, cb_head);
15355148Storek 	off("CB_TAIL", struct aucb, cb_tail);
15455148Storek 	off("CB_PAUSE", struct aucb, cb_pause);
15555148Storek 	off("CB_DATA", struct aucb, cb_data);
15655148Storek 	off("CB_DROPS", struct aucb, cb_drops);
15755148Storek 	off("CB_PDROPS", struct aucb, cb_drops);
15855148Storek 	off("CB_THRESH", struct aucb, cb_thresh);
15955148Storek 	off("CB_WAKING", struct aucb, cb_waking);
16055148Storek 	off("AU_AMD", struct auio, au_amd);
16155148Storek 	off("AU_RB", struct auio, au_rb);
16255148Storek 	off("AU_WB", struct auio, au_wb);
16355148Storek 	off("AU_STAMP", struct auio, au_stamp);
16455148Storek 	off("AMD_IR", struct amd7930, ir);
16555148Storek 	off("AMD_BBRB", struct amd7930, bbrb);
16655148Storek 	off("AMD_BBTB", struct amd7930, bbtb);
16755148Storek 
16855148Storek 	flush();
16955148Storek 
17055148Storek 	exit(0);
17155148Storek }
172