155148Storek /*
2*63323Sbostic * Copyright (c) 1992, 1993
3*63323Sbostic * The Regents of the University of California. 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
1259230Storek * California, Lawrence Berkeley Laboratory.
1355504Sbostic *
1455148Storek * %sccs.include.redist.c%
1555148Storek *
16*63323Sbostic * @(#)genassym.c 8.1 (Berkeley) 06/11/93
1755148Storek *
1859230Storek * from: $Header: genassym.c,v 1.15 93/04/21 06:09:30 torek Exp $ (LBL)
1955148Storek */
2055148Storek
2156541Sbostic #include <sys/param.h>
2256541Sbostic #include <sys/buf.h>
2356541Sbostic #include <sys/proc.h>
2456541Sbostic #include <sys/map.h>
2556541Sbostic #include <sys/proc.h>
2656541Sbostic #include <sys/mbuf.h>
2756541Sbostic #include <sys/msgbuf.h>
2856541Sbostic #include <sys/syscall.h>
2956541Sbostic #include <sys/user.h>
3055148Storek
3156541Sbostic #include <machine/pmap.h>
3256541Sbostic #include <machine/psl.h>
3356541Sbostic
3455148Storek #ifdef notyet
3556541Sbostic #include <sparc/dev/zsreg.h>
3656541Sbostic #include <sparc/dev/zsvar.h>
3755148Storek #endif
3856541Sbostic #include <sparc/dev/bsd_audioreg.h>
3956541Sbostic #include <sparc/dev/bsd_audiovar.h>
4055148Storek
4156541Sbostic #include <sparc/sparc/intreg.h>
4255148Storek
4355148Storek #include <stdio.h>
4459230Storek #include <stddef.h>
4555148Storek
4655148Storek #define off(what, str, mem) def(what, (int)offsetof(str, mem))
4755148Storek
4855148Storek void
def(what,where)4955148Storek def(what, where)
5055148Storek char *what;
5155148Storek int where;
5255148Storek {
5355148Storek
5455148Storek if (printf("#define\t%s\t%d\n", what, where) < 0) {
5555148Storek perror("printf");
5655148Storek exit(1);
5755148Storek }
5855148Storek }
5955148Storek
6055148Storek void
flush()6155148Storek flush()
6255148Storek {
6355148Storek
6455148Storek if (fflush(stdout)) {
6555148Storek perror("fflush");
6655148Storek exit(1);
6755148Storek }
6855148Storek }
6955148Storek
main()7055148Storek main()
7155148Storek {
7255148Storek
7355148Storek /* general constants */
7455148Storek def("BSD", BSD);
7555148Storek def("UPAGES", UPAGES);
7655148Storek def("NBPG", NBPG);
7755148Storek def("KERNBASE", KERNBASE);
7855148Storek def("USRSTACK", USRSTACK);
7955148Storek
8055148Storek /* proc fields and values */
8155148Storek off("P_ADDR", struct proc, p_addr);
8255148Storek off("P_STAT", struct proc, p_stat);
8355148Storek off("P_WCHAN", struct proc, p_wchan);
8455148Storek off("P_VMSPACE", struct proc, p_vmspace);
8555148Storek off("P_RTIME", struct proc, p_rtime);
8655148Storek def("SRUN", SRUN);
8755148Storek
8855148Storek /* VM structure fields */
8955148Storek off("VM_PMAP", struct vmspace, vm_pmap);
9055148Storek off("VM_PMAP_CTX", struct vmspace, vm_pmap.pm_ctx);
9155148Storek off("VM_PMAP_CTXNUM", struct vmspace, vm_pmap.pm_ctxnum);
9255148Storek
9355148Storek /* interrupt/fault metering */
9455148Storek off("V_SWTCH", struct vmmeter, v_swtch);
9555148Storek off("V_INTR", struct vmmeter, v_intr);
9655148Storek off("V_FAULTS", struct vmmeter, v_faults);
9755148Storek
9855148Storek /* PTE bits and related information */
9955148Storek def("PG_W", PG_W);
10055148Storek def("PG_VSHIFT", PG_VSHIFT);
10155148Storek def("PG_PROTSHIFT", PG_PROTSHIFT);
10255148Storek def("PG_PROTUREAD", PG_PROTUREAD);
10355148Storek def("PG_PROTUWRITE", PG_PROTUWRITE);
10455148Storek
10555148Storek /* FPU state */
10655148Storek off("FS_REGS", struct fpstate, fs_regs);
10755148Storek off("FS_FSR", struct fpstate, fs_fsr);
10855148Storek off("FS_QSIZE", struct fpstate, fs_qsize);
10955148Storek off("FS_QUEUE", struct fpstate, fs_queue);
11055148Storek def("FSR_QNE", FSR_QNE);
11155148Storek
11255148Storek /* system calls */
11355148Storek def("SYS_sigreturn", SYS_sigreturn);
11455148Storek def("SYS_execve", SYS_execve);
11555148Storek def("SYS_exit", SYS_exit);
11655148Storek
11755148Storek /* errno */
11855148Storek def("EFAULT", EFAULT);
11955148Storek def("ENAMETOOLONG", ENAMETOOLONG);
12055148Storek
12155148Storek /* PCB fields */
12255148Storek off("PCB_NSAVED", struct pcb, pcb_nsaved);
12355148Storek off("PCB_ONFAULT", struct pcb, pcb_onfault);
12455148Storek off("PCB_PSR", struct pcb, pcb_psr);
12555148Storek off("PCB_RW", struct pcb, pcb_rw);
12655148Storek off("PCB_SP", struct pcb, pcb_sp);
12755148Storek off("PCB_PC", struct pcb, pcb_pc);
12855148Storek off("PCB_UW", struct pcb, pcb_uw);
12955148Storek off("PCB_WIM", struct pcb, pcb_wim);
13055148Storek
13155148Storek /* interrupt enable register PTE */
13255148Storek def("IE_REG_PTE", PG_V | PG_W | PG_S | PG_NC | PG_OBIO |
13355148Storek ((u_int)INT_ENABLE_REG_PHYSADR >> PGSHIFT));
13455148Storek
13555148Storek #ifdef notyet
13655148Storek /* ZSCC interrupt fields */
13755148Storek off("ZSC_A", struct zs_softc, sc_a);
13855148Storek off("ZSC_B", struct zs_softc, sc_b);
13955148Storek /* off("ZL_WREG", struct zs_line, zl_wreg); */
14055148Storek off("ZL_TBC", struct zs_line, zl_tbc);
14155148Storek off("ZL_TBA", struct zs_line, zl_tba);
14255148Storek off("ZL_RBPUT", struct zs_line, zl_rbput);
14355148Storek off("ZL_RBUF", struct zs_line, zl_rbuf);
14455148Storek def("ZSRR1_DO_bit", ffs(ZSRR1_DO) - 1);
14555148Storek #endif
14655148Storek /* audio trap handler fields */
14755148Storek def("AUCB_SIZE", AUCB_SIZE);
14855148Storek off("CB_HEAD", struct aucb, cb_head);
14955148Storek off("CB_TAIL", struct aucb, cb_tail);
15055148Storek off("CB_PAUSE", struct aucb, cb_pause);
15155148Storek off("CB_DATA", struct aucb, cb_data);
15255148Storek off("CB_DROPS", struct aucb, cb_drops);
15355148Storek off("CB_PDROPS", struct aucb, cb_drops);
15455148Storek off("CB_THRESH", struct aucb, cb_thresh);
15555148Storek off("CB_WAKING", struct aucb, cb_waking);
15655148Storek off("AU_AMD", struct auio, au_amd);
15755148Storek off("AU_RB", struct auio, au_rb);
15855148Storek off("AU_WB", struct auio, au_wb);
15955148Storek off("AU_STAMP", struct auio, au_stamp);
16055148Storek off("AMD_IR", struct amd7930, ir);
16155148Storek off("AMD_BBRB", struct amd7930, bbrb);
16255148Storek off("AMD_BBTB", struct amd7930, bbtb);
16355148Storek
16455148Storek flush();
16555148Storek
16655148Storek exit(0);
16755148Storek }
168