/* * Copyright (c) 1982, 1990 The Regents of the University of California. * All rights reserved. * * %sccs.include.redist.c% * * @(#)genassym.c 7.11 (Berkeley) 07/08/92 */ #define KERNEL #include "sys/param.h" #include "sys/buf.h" #include "sys/map.h" #include "sys/proc.h" #include "sys/mbuf.h" #include "sys/msgbuf.h" #include "../include/cpu.h" #include "../include/trap.h" #include "../include/psl.h" #include "../include/reg.h" #include "clockreg.h" #include "sys/syscall.h" #include "vm/vm.h" #include "sys/user.h" #include "pte.h" #include #include #include #include #include extern int errno; void def(what, val) char *what; int val; { if (printf("#define\t%s\t%d\n", what, val) < 0) { (void)fprintf(stderr, "genassym: printf: %s\n", strerror(errno)); exit(1); } } void flush() { if (fflush(stdout) || fsync(fileno(stdout)) < 0) { (void)fprintf(stderr, "genassym: flush stdout: %s\n", strerror(errno)); exit(1); } } #define off(what, s, m) def(what, (int)offsetof(s, m)) main() { register unsigned i; /* general constants */ def("UPAGES", UPAGES); def("NBPG", NBPG); def("PGSHIFT", PGSHIFT); def("USRSTACK", USRSTACK); def("MAXADDR", MAXADDR); /* proc fields and values */ off("P_LINK", struct proc, p_link); off("P_RLINK", struct proc, p_rlink); off("P_VMSPACE", struct proc, p_vmspace); off("P_ADDR", struct proc, p_addr); off("P_PRI", struct proc, p_pri); off("P_STAT", struct proc, p_stat); off("P_WCHAN", struct proc, p_wchan); off("P_FLAG", struct proc, p_flag); def("SSLEEP", SSLEEP); def("SRUN", SRUN); /* VM structure fields */ off("VM_PMAP", struct vmspace, vm_pmap); off("PM_STCHG", struct pmap, pm_stchanged); /* interrupt/fault metering */ off("V_SWTCH", struct vmmeter, v_swtch); off("V_INTR", struct vmmeter, v_intr); /* trap types (should just include trap.h?) */ def("T_BUSERR", T_BUSERR); def("T_ADDRERR", T_ADDRERR); def("T_ILLINST", T_ILLINST); def("T_ZERODIV", T_ZERODIV); def("T_CHKINST", T_CHKINST); def("T_TRAPVINST", T_TRAPVINST); def("T_PRIVINST", T_PRIVINST); def("T_TRACE", T_TRACE); def("T_MMUFLT", T_MMUFLT); def("T_SSIR", T_SSIR); def("T_FMTERR", T_FMTERR); def("T_COPERR", T_COPERR); def("T_FPERR", T_FPERR); def("T_ASTFLT", T_ASTFLT); def("T_TRAP15", T_TRAP15); def("T_FPEMULI", T_FPEMULI); def("T_FPEMULD", T_FPEMULD); /* PSL values (should just include psl.h?) */ def("PSL_S", PSL_S); def("PSL_IPL7", PSL_IPL7); def("PSL_LOWIPL", PSL_LOWIPL); def("PSL_HIGHIPL", PSL_HIGHIPL); def("PSL_USER", PSL_USER); def("SPL1", PSL_S | PSL_IPL1); def("SPL2", PSL_S | PSL_IPL2); def("SPL3", PSL_S | PSL_IPL3); def("SPL4", PSL_S | PSL_IPL4); def("SPL5", PSL_S | PSL_IPL5); def("SPL6", PSL_S | PSL_IPL6); /* magic */ def("FC_USERD", FC_USERD); def("FC_PURGE", FC_PURGE); def("INTIOBASE", INTIOBASE); def("MMUBASE", MMUBASE); def("MMUSTAT", MMUSTAT); def("MMUCMD", MMUCMD); def("MMUSSTP", MMUSSTP); def("MMUUSTP", MMUUSTP); def("MMUTBINVAL", MMUTBINVAL); def("MMU_BERR", MMU_BERR); def("MMU_ENAB", MMU_ENAB); def("MMU_FAULT", MMU_FAULT); def("MMU_CEN", MMU_CEN); def("MMU_IEN", MMU_IEN); def("MMU_FPE", MMU_FPE); def("CACHE_ON", CACHE_ON); def("CACHE_OFF", CACHE_OFF); def("CACHE_CLR", CACHE_CLR); def("IC_CLEAR", IC_CLEAR); def("DC_CLEAR", DC_CLEAR); /* pte/ste bits */ def("PG_V", PG_V); def("PG_NV", PG_NV); def("PG_RO", PG_RO); def("PG_RW", PG_RW); def("PG_CI", PG_CI); def("PG_PROT", PG_PROT); def("PG_FRAME", PG_FRAME); def("SG_V", SG_V); def("SG_NV", SG_NV); def("SG_RW", SG_RW); def("SG_FRAME", SG_FRAME); def("SG_ISHIFT", SG_ISHIFT); /* pcb fields */ off("PCB_FLAGS", struct pcb, pcb_flags); off("PCB_PS", struct pcb, pcb_ps); off("PCB_USTP", struct pcb, pcb_ustp); off("PCB_USP", struct pcb, pcb_usp); off("PCB_REGS", struct pcb, pcb_regs); off("PCB_ONFAULT", struct pcb, pcb_onfault); off("PCB_FPCTX", struct pcb, pcb_fpregs); def("SIZEOF_PCB", sizeof(struct pcb)); /* system calls */ def("SYS_exit", SYS_exit); def("SYS_execve", SYS_execve); def("SYS_sigreturn", SYS_sigreturn); /* errno */ def("EFAULT", EFAULT); def("ENAMETOOLONG", ENAMETOOLONG); /* clock registers */ def("CLKSR", CLKSR); def("CLKMSB1", CLKMSB1); def("CLKMSB3", CLKMSB3); /* HP-UX trace bit */ def("PCB_TRCB", ffs(PCB_HPUXTRACE) - 1); exit(0); }