xref: /original-bsd/sys/luna68k/luna68k/genassym.c (revision ca98dac2)
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.3 (Berkeley) 10/11/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 <sys/syscall.h>
24 #include <sys/user.h>
25 
26 #include <machine/cpu.h>
27 #include <machine/trap.h>
28 #include <machine/psl.h>
29 #include <machine/reg.h>
30 #include <machine/stinger.h>
31 
32 #include <luna68k/dev/pioreg.h>
33 #include <luna68k/luna68k/clockreg.h>
34 #include <vm/vm.h>
35 #include <luna68k/luna68k/pte.h>
36 
37 #include <errno.h>
38 #include <stdio.h>
39 #include <stddef.h>
40 #include <string.h>
41 #include <unistd.h>
42 
43 extern int errno;
44 
45 void
46 def(what, val)
47 	char *what;
48 	int val;
49 {
50 
51 	if (printf("#define\t%s\t%d\n", what, val) < 0) {
52 		(void)fprintf(stderr, "genassym: printf: %s\n",
53 		    strerror(errno));
54 		exit(1);
55 	}
56 }
57 
58 void
59 flush()
60 {
61 
62 	if (fflush(stdout) || fsync(fileno(stdout)) < 0) {
63 		(void)fprintf(stderr, "genassym: flush stdout: %s\n",
64 		    strerror(errno));
65 		exit(1);
66 	}
67 }
68 
69 #define	off(what, s, m)	def(what, (int)offsetof(s, m))
70 
71 main()
72 {
73 	struct KernInter *KernInter = (struct KernInter *)0;
74 	struct pio *pio = (struct pio *)PIO0_ADDR;
75 	register unsigned i;
76 
77 	def("UPAGES", UPAGES);
78 	def("NBPG", NBPG);
79 	def("PGSHIFT", PGSHIFT);
80 	def("USRSTACK", USRSTACK);
81 	def("KERNELSTACK", KERNELSTACK);
82 	def("KI_MAXADDR", &KernInter->maxaddr);
83 
84 	off("P_LINK", struct proc, p_link);
85 	off("P_RLINK", struct proc, p_rlink);
86 	off("P_VMSPACE", struct proc, p_vmspace);
87 	off("P_ADDR", struct proc, p_addr);
88 	off("P_PRI", struct proc, p_pri);
89 	off("P_STAT", struct proc, p_stat);
90 	off("P_WCHAN", struct proc, p_wchan);
91 	off("P_FLAG", struct proc, p_flag);
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 	def("SYS_exit", SYS_exit);
162 	def("SYS_execve", SYS_execve);
163 	def("SYS_sigreturn", SYS_sigreturn);
164 
165 	def("EFAULT", EFAULT);
166 	def("ENAMETOOLONG", ENAMETOOLONG);
167 
168 	def("CLOCK_REG", CLOCK_REG);
169 	def("CLK_INT", CLK_INT);
170 	def("CLK_CLR", CLK_CLR);
171 
172 	def("PIO0_A", &pio->a_port);
173 	def("PIO0_B", &pio->b_port);
174 	def("PIO0_CTL", &pio->control_port);
175 	def("PIO_MODED", PIO_MODED);
176 
177 #ifdef	OLD_LUNA
178 	def("FLINE_VEC", 44); /* F-Line excep vector offset */
179 	def("COPRO_VEC", 52); /* Coprocessor prot. offset */
180 #endif
181 	exit(0);
182 }
183