xref: /original-bsd/sys/luna68k/luna68k/genassym.c (revision 6093a5ae)
1 /*
2  * Copyright (c) 1992 OMRON Corporation.
3  * Copyright (c) 1982, 1990, 1992 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * %sccs.include.redist.c%
7  *
8  * OMRON: $Id: genassym.c,v 1.2 92/06/14 06:15:25 moti Exp $
9  *
10  * from: hp300/hp300/genassym.c	7.11 (Berkeley) 7/8/92
11  *
12  *	@(#)genassym.c	7.2 (Berkeley) 07/23/92
13  */
14 
15 #define KERNEL
16 
17 #include "sys/param.h"
18 #include "sys/buf.h"
19 #include "sys/map.h"
20 #include "sys/proc.h"
21 #include "sys/mbuf.h"
22 #include "sys/msgbuf.h"
23 #include "../include/cpu.h"
24 #include "../include/trap.h"
25 #include "../include/psl.h"
26 #include "../include/reg.h"
27 #include "../include/stinger.h"
28 #include "../dev/pioreg.h"
29 #include "clockreg.h"
30 #include "sys/syscall.h"
31 #include "vm/vm.h"
32 #include "sys/user.h"
33 #include "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 KernInter *KernInter = (struct KernInter *)0;
72 	struct pio *pio = (struct pio *)PIO0_ADDR;
73 	register unsigned i;
74 
75 	def("UPAGES", UPAGES);
76 	def("NBPG", NBPG);
77 	def("PGSHIFT", PGSHIFT);
78 	def("USRSTACK", USRSTACK);
79 	def("KERNELSTACK", KERNELSTACK);
80 	def("KI_MAXADDR", &KernInter->maxaddr);
81 
82 	off("P_LINK", struct proc, p_link);
83 	off("P_RLINK", struct proc, p_rlink);
84 	off("P_VMSPACE", struct proc, p_vmspace);
85 	off("P_ADDR", struct proc, p_addr);
86 	off("P_PRI", struct proc, p_pri);
87 	off("P_STAT", struct proc, p_stat);
88 	off("P_WCHAN", struct proc, p_wchan);
89 	off("P_FLAG", struct proc, p_flag);
90 	def("SSLEEP", SSLEEP);
91 	def("SRUN", SRUN);
92 
93 	off("VM_PMAP", struct vmspace, vm_pmap);
94 	off("PM_STCHG", struct pmap, pm_stchanged);
95 
96 	off("V_SWTCH", struct vmmeter, v_swtch);
97 	off("V_INTR", struct vmmeter, v_intr);
98 
99 	def("T_BUSERR", T_BUSERR);
100 	def("T_ADDRERR", T_ADDRERR);
101 	def("T_ILLINST", T_ILLINST);
102 	def("T_ZERODIV", T_ZERODIV);
103 	def("T_CHKINST", T_CHKINST);
104 	def("T_TRAPVINST", T_TRAPVINST);
105 	def("T_PRIVINST", T_PRIVINST);
106 	def("T_TRACE", T_TRACE);
107 	def("T_MMUFLT", T_MMUFLT);
108 	def("T_SSIR", T_SSIR);
109 	def("T_FMTERR", T_FMTERR);
110 	def("T_COPERR", T_COPERR);
111 	def("T_FPERR", T_FPERR);
112 	def("T_ASTFLT", T_ASTFLT);
113 	def("T_TRAP15", T_TRAP15);
114 	def("T_FPEMULI", T_FPEMULI);
115 	def("T_FPEMULD", T_FPEMULD);
116 
117 	def("PSL_S", PSL_S);
118 	def("PSL_IPL7", PSL_IPL7);
119 	def("PSL_LOWIPL", PSL_LOWIPL);
120 	def("PSL_HIGHIPL", PSL_HIGHIPL);
121 	def("PSL_USER", PSL_USER);
122 	def("SPL1", PSL_S | PSL_IPL1);
123 	def("SPL2", PSL_S | PSL_IPL2);
124 	def("SPL3", PSL_S | PSL_IPL3);
125 	def("SPL4", PSL_S | PSL_IPL4);
126 	def("SPL5", PSL_S | PSL_IPL5);
127 	def("SPL6", PSL_S | PSL_IPL6);
128 
129 	def("FC_USERD", FC_USERD);
130 	def("FC_PURGE", FC_PURGE);
131 	def("CACHE_ON", CACHE_ON);
132 	def("CACHE_OFF", CACHE_OFF);
133 	def("CACHE_CLR", CACHE_CLR);
134 	def("IC_CLEAR", IC_CLEAR);
135 	def("DC_CLEAR", DC_CLEAR);
136 
137 	def("PG_V", PG_V);
138 	def("PG_NV", PG_NV);
139 	def("PG_RO", PG_RO);
140 	def("PG_RW", PG_RW);
141 	def("PG_CI", PG_CI);
142 	def("PG_PROT", PG_PROT);
143 	def("PG_FRAME", PG_FRAME);
144 	def("SG_V", SG_V);
145 	def("SG_NV", SG_NV);
146 	def("SG_RW", SG_RW);
147 	def("SG_FRAME", SG_FRAME);
148 	def("SG_ISHIFT", SG_ISHIFT);
149 
150 	off("PCB_FLAGS", struct pcb, pcb_flags);
151 	off("PCB_PS", struct pcb, pcb_ps);
152 	off("PCB_USTP", struct pcb, pcb_ustp);
153 	off("PCB_USP", struct pcb, pcb_usp);
154 	off("PCB_REGS", struct pcb, pcb_regs);
155 	off("PCB_ONFAULT", struct pcb, pcb_onfault);
156 	off("PCB_FPCTX", struct pcb, pcb_fpregs);
157 	def("SIZEOF_PCB", sizeof(struct pcb));
158 
159 	def("SYS_exit", SYS_exit);
160 	def("SYS_execve", SYS_execve);
161 	def("SYS_sigreturn", SYS_sigreturn);
162 
163 	def("EFAULT", EFAULT);
164 	def("ENAMETOOLONG", ENAMETOOLONG);
165 
166 	def("CLOCK_REG", CLOCK_REG);
167 	def("CLK_INT", CLK_INT);
168 	def("CLK_CLR", CLK_CLR);
169 
170 	def("PIO0_A", &pio->a_port);
171 	def("PIO0_B", &pio->b_port);
172 	def("PIO0_CTL", &pio->control_port);
173 	def("PIO_MODED", PIO_MODED);
174 
175 #ifdef	OLD_LUNA
176 	def("FLINE_VEC", 44); /* F-Line excep vector offset */
177 	def("COPRO_VEC", 52); /* Coprocessor prot. offset */
178 #endif
179 	exit(0);
180 }
181