1 /* 2 * Copyright (c) 1992 OMRON Corporation. 3 * Copyright (c) 1982, 1990, 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * %sccs.include.redist.c% 7 * 8 * from: hp300/hp300/genassym.c 8.2 (Berkeley) 9/23/93 9 * 10 * @(#)genassym.c 8.3 (Berkeley) 12/06/93 11 */ 12 13 #define KERNEL 14 15 #include <sys/param.h> 16 #include <sys/buf.h> 17 #include <sys/map.h> 18 #include <sys/proc.h> 19 #include <sys/mbuf.h> 20 #include <sys/msgbuf.h> 21 #include <sys/syscall.h> 22 #include <sys/user.h> 23 24 #include <machine/cpu.h> 25 #include <machine/trap.h> 26 #include <machine/psl.h> 27 #include <machine/reg.h> 28 #include <machine/stinger.h> 29 30 #include <luna68k/dev/pioreg.h> 31 #include <luna68k/luna68k/clockreg.h> 32 #include <vm/vm.h> 33 #include <luna68k/luna68k/pte.h> 34 35 #include <errno.h> 36 #include <stdio.h> 37 #include <stddef.h> 38 #include <string.h> 39 #include <unistd.h> 40 41 extern int errno; 42 43 void 44 def(what, val) 45 char *what; 46 int val; 47 { 48 49 if (printf("#define\t%s\t%d\n", what, val) < 0) { 50 (void)fprintf(stderr, "genassym: printf: %s\n", 51 strerror(errno)); 52 exit(1); 53 } 54 } 55 56 void 57 flush() 58 { 59 60 if (fflush(stdout) || fsync(fileno(stdout)) < 0) { 61 (void)fprintf(stderr, "genassym: flush stdout: %s\n", 62 strerror(errno)); 63 exit(1); 64 } 65 } 66 67 #define off(what, s, m) def(what, (int)offsetof(s, m)) 68 69 main() 70 { 71 struct pio *pio = (struct pio *)PIO0_ADDR; 72 register unsigned i; 73 74 def("UPAGES", UPAGES); 75 def("NBPG", NBPG); 76 def("PGSHIFT", PGSHIFT); 77 def("USRSTACK", USRSTACK); 78 def("KERNELSTACK", KERNELSTACK); 79 80 def("KIFF_SIZE", sizeof(struct KernInter)); 81 off("KI_MAXADDR", struct KernInter, maxaddr); 82 83 off("P_FORW", struct proc, p_forw); 84 off("P_BACK", struct proc, p_back); 85 off("P_VMSPACE", struct proc, p_vmspace); 86 off("P_ADDR", struct proc, p_addr); 87 off("P_PRIORITY", struct proc, p_priority); 88 off("P_STAT", struct proc, p_stat); 89 off("P_WCHAN", struct proc, p_wchan); 90 off("P_FLAG", struct proc, p_flag); 91 off("P_MDFLAG", struct proc, p_md.md_flags); 92 def("SSLEEP", SSLEEP); 93 def("SRUN", SRUN); 94 95 off("VM_PMAP", struct vmspace, vm_pmap); 96 off("PM_STCHG", struct pmap, pm_stchanged); 97 98 off("V_SWTCH", struct vmmeter, v_swtch); 99 off("V_INTR", struct vmmeter, v_intr); 100 101 def("T_BUSERR", T_BUSERR); 102 def("T_ADDRERR", T_ADDRERR); 103 def("T_ILLINST", T_ILLINST); 104 def("T_ZERODIV", T_ZERODIV); 105 def("T_CHKINST", T_CHKINST); 106 def("T_TRAPVINST", T_TRAPVINST); 107 def("T_PRIVINST", T_PRIVINST); 108 def("T_TRACE", T_TRACE); 109 def("T_MMUFLT", T_MMUFLT); 110 def("T_SSIR", T_SSIR); 111 def("T_FMTERR", T_FMTERR); 112 def("T_COPERR", T_COPERR); 113 def("T_FPERR", T_FPERR); 114 def("T_ASTFLT", T_ASTFLT); 115 def("T_TRAP15", T_TRAP15); 116 def("T_FPEMULI", T_FPEMULI); 117 def("T_FPEMULD", T_FPEMULD); 118 119 def("PSL_S", PSL_S); 120 def("PSL_IPL7", PSL_IPL7); 121 def("PSL_LOWIPL", PSL_LOWIPL); 122 def("PSL_HIGHIPL", PSL_HIGHIPL); 123 def("PSL_USER", PSL_USER); 124 def("SPL1", PSL_S | PSL_IPL1); 125 def("SPL2", PSL_S | PSL_IPL2); 126 def("SPL3", PSL_S | PSL_IPL3); 127 def("SPL4", PSL_S | PSL_IPL4); 128 def("SPL5", PSL_S | PSL_IPL5); 129 def("SPL6", PSL_S | PSL_IPL6); 130 131 def("FC_USERD", FC_USERD); 132 def("FC_PURGE", FC_PURGE); 133 def("CACHE_ON", CACHE_ON); 134 def("CACHE_OFF", CACHE_OFF); 135 def("CACHE_CLR", CACHE_CLR); 136 def("IC_CLEAR", IC_CLEAR); 137 def("DC_CLEAR", DC_CLEAR); 138 139 def("PG_V", PG_V); 140 def("PG_NV", PG_NV); 141 def("PG_RO", PG_RO); 142 def("PG_RW", PG_RW); 143 def("PG_CI", PG_CI); 144 def("PG_PROT", PG_PROT); 145 def("PG_FRAME", PG_FRAME); 146 def("SG_V", SG_V); 147 def("SG_NV", SG_NV); 148 def("SG_RW", SG_RW); 149 def("SG_FRAME", SG_FRAME); 150 def("SG_ISHIFT", SG_ISHIFT); 151 152 off("PCB_FLAGS", struct pcb, pcb_flags); 153 off("PCB_PS", struct pcb, pcb_ps); 154 off("PCB_USTP", struct pcb, pcb_ustp); 155 off("PCB_USP", struct pcb, pcb_usp); 156 off("PCB_REGS", struct pcb, pcb_regs); 157 off("PCB_ONFAULT", struct pcb, pcb_onfault); 158 off("PCB_FPCTX", struct pcb, pcb_fpregs); 159 def("SIZEOF_PCB", sizeof(struct pcb)); 160 161 /* exception frame offset/sizes */ 162 off("FR_SP", struct frame, f_regs[15]); 163 off("FR_HW", struct frame, f_sr); 164 off("FR_ADJ", struct frame, f_stackadj); 165 166 def("SYS_exit", SYS_exit); 167 def("SYS_execve", SYS_execve); 168 def("SYS_sigreturn", SYS_sigreturn); 169 170 def("EFAULT", EFAULT); 171 def("ENAMETOOLONG", ENAMETOOLONG); 172 173 def("CLOCK_REG", CLOCK_REG); 174 def("CLK_INT", CLK_INT); 175 def("CLK_CLR", CLK_CLR); 176 177 def("PIO0_A", &pio->a_port); 178 def("PIO0_B", &pio->b_port); 179 def("PIO0_CTL", &pio->control_port); 180 def("PIO_MODED", PIO_MODED); 181 182 #ifdef OLD_LUNA 183 def("FLINE_VEC", 44); /* F-Line excep vector offset */ 184 def("COPRO_VEC", 52); /* Coprocessor prot. offset */ 185 #endif 186 exit(0); 187 } 188