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