root / pc-bios / proll.patch @ 6f7e9aec
History | View | Annotate | Download (88 kB)
1 |
diff -ruN proll_18.orig/Makefile proll-patch7/Makefile
|
---|---|
2 |
--- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000
|
3 |
+++ proll-patch7/Makefile 2004-11-13 15:50:49.000000000 +0000
|
4 |
@@ -4,6 +4,7 @@
|
5 |
make -C krups-ser all |
6 |
make -C espresso all |
7 |
make -C espresso-ser all |
8 |
+ make -C qemu all
|
9 |
|
10 |
clean: |
11 |
make -C mrcoffee clean |
12 |
@@ -11,3 +12,4 @@
|
13 |
make -C krups-ser clean |
14 |
make -C espresso clean |
15 |
make -C espresso-ser clean |
16 |
+ make -C qemu clean
|
17 |
diff -ruN proll_18.orig/qemu/Makefile proll-patch7/qemu/Makefile
|
18 |
--- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
|
19 |
+++ proll-patch7/qemu/Makefile 2005-03-02 16:41:50.000000000 +0000
|
20 |
@@ -0,0 +1,122 @@
|
21 |
+#
|
22 |
+# proll:
|
23 |
+# qemu/Makefile - make PROLL for QEMU
|
24 |
+# $Id: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $
|
25 |
+#
|
26 |
+# Copyright 1999 Pete Zaitcev
|
27 |
+# This is Free Software is licensed under terms of GNU General Public License.
|
28 |
+#
|
29 |
+
|
30 |
+CC = gcc
|
31 |
+
|
32 |
+#CROSS = /usr/local/sparc/bin/sparc-sun-linux-
|
33 |
+CROSS = sparc-unknown-linux-gnu-
|
34 |
+
|
35 |
+CROSSCC = $(CROSS)gcc
|
36 |
+CROSSLD = $(CROSS)ld
|
37 |
+CROSSNM = $(CROSS)nm
|
38 |
+
|
39 |
+RM = /bin/rm -f
|
40 |
+ELFTOAOUT = elftoaout
|
41 |
+
|
42 |
+#
|
43 |
+SRC = ../src
|
44 |
+
|
45 |
+# Due to remapping algorithm PROLBASE should be algned on PMD.
|
46 |
+# We make PROLBASE a define instead of using _start because we
|
47 |
+# want to shift it to form a PGD entry. A relocatable label will not work.
|
48 |
+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
|
49 |
+PROLBASE = 0xffd00000
|
50 |
+PROLRODATA = 0xffd07000
|
51 |
+PROLDATA = 0xffd09000
|
52 |
+PROLSIZE = 240*1024
|
53 |
+
|
54 |
+# Linux
|
55 |
+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6.
|
56 |
+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them.
|
57 |
+# __ANSI__ is supposed to be on by default but it is not.
|
58 |
+CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g -DQEMU
|
59 |
+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g
|
60 |
+# Solaris or Linux/i386 cross compilation
|
61 |
+#CFLAGS = -Iinclude -O
|
62 |
+
|
63 |
+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA)
|
64 |
+
|
65 |
+ALL = proll.aout
|
66 |
+PROLLEXE = proll.elf
|
67 |
+
|
68 |
+OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \
|
69 |
+ printf.o le.o system_qemu.o iommu.o \
|
70 |
+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \
|
71 |
+ vconsole.o hconsole.o rconsole.o vcons_zs.o
|
72 |
+
|
73 |
+all: $(ALL)
|
74 |
+
|
75 |
+$(PROLLEXE): $(OBJS)
|
76 |
+ $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS)
|
77 |
+
|
78 |
+head.o: head.S $(SRC)/phys_jj.h \
|
79 |
+ $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h
|
80 |
+ $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S
|
81 |
+
|
82 |
+main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \
|
83 |
+ $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \
|
84 |
+ $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h
|
85 |
+ $(CROSSCC) $(CFLAGS) -c $*.c
|
86 |
+openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \
|
87 |
+ $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h
|
88 |
+ $(CROSSCC) $(CFLAGS) -c $*.c
|
89 |
+
|
90 |
+system_qemu.o: system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \
|
91 |
+ $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \
|
92 |
+ $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h
|
93 |
+ $(CROSSCC) $(CFLAGS) -c $*.c
|
94 |
+iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \
|
95 |
+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h
|
96 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
97 |
+vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h
|
98 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
99 |
+vcons_zs.o: $(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h
|
100 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
101 |
+hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h
|
102 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
103 |
+rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h
|
104 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
105 |
+printf.o: $(SRC)/printf.c
|
106 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
107 |
+le.o: $(SRC)/le.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/netpriv.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/net.h $(SRC)/phys_jj.h
|
108 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
109 |
+
|
110 |
+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
|
111 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
112 |
+netinit.o: $(SRC)/netinit.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
|
113 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
114 |
+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
|
115 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
116 |
+udp.o: $(SRC)/udp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
|
117 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
118 |
+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
|
119 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
120 |
+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
|
121 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
122 |
+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
|
123 |
+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
|
124 |
+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
|
125 |
+
|
126 |
+wuf.o: $(SRC)/wuf.S
|
127 |
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
|
128 |
+wof.o: $(SRC)/wof.S
|
129 |
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
|
130 |
+
|
131 |
+#genlab.o: genlab.c
|
132 |
+# $(CC) -c $*.c
|
133 |
+#
|
134 |
+#genlab: genlab.o
|
135 |
+# $(CC) -o genlab genlab.o
|
136 |
+
|
137 |
+clean:
|
138 |
+ $(RM) $(OBJS)
|
139 |
+ $(RM) $(PROLLEXE) proll.aout
|
140 |
+
|
141 |
+proll.aout: $(PROLLEXE)
|
142 |
+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE)
|
143 |
diff -ruN proll_18.orig/qemu/head.S proll-patch7/qemu/head.S
|
144 |
--- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000
|
145 |
+++ proll-patch7/qemu/head.S 2005-03-02 15:30:47.000000000 +0000
|
146 |
@@ -0,0 +1,539 @@
|
147 |
+/**
|
148 |
+ ** Standalone startup code for Linux PROM emulator.
|
149 |
+ ** Copyright 1999 Pete A. Zaitcev
|
150 |
+ ** This code is licensed under GNU General Public License.
|
151 |
+ **/
|
152 |
+/*
|
153 |
+ * $Id: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $
|
154 |
+ */
|
155 |
+
|
156 |
+#include <psr.h>
|
157 |
+#include <asi.h>
|
158 |
+#include <crs.h>
|
159 |
+/* #include <asm/head.h> */ /* Trap entries. Do not use. */
|
160 |
+#include "phys_jj.h"
|
161 |
+
|
162 |
+#define C_LABEL(name) name
|
163 |
+#define REGWIN_SZ 0x40
|
164 |
+
|
165 |
+#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
|
166 |
+
|
167 |
+ /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
|
168 |
+#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
|
169 |
+#define VATOPMDOFF(va) (((va)>>16)&0xFC)
|
170 |
+
|
171 |
+#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
|
172 |
+
|
173 |
+/* Here are some trap goodies */
|
174 |
+
|
175 |
+#if 0
|
176 |
+/* Generic trap entry. */
|
177 |
+#define TRAP_ENTRY(type, label) \
|
178 |
+ rd %psr, %l0; b label; rd %wim, %l3; nop;
|
179 |
+#endif
|
180 |
+
|
181 |
+/* Data/text faults. */
|
182 |
+#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
|
183 |
+#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
|
184 |
+
|
185 |
+#if 0
|
186 |
+/* This is for traps we should NEVER get. */
|
187 |
+#define BAD_TRAP(num) \
|
188 |
+ rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
|
189 |
+
|
190 |
+/* This is for traps when we want just skip the instruction which caused it */
|
191 |
+#define SKIP_TRAP(type, name) \
|
192 |
+ jmpl %l2, %g0; rett %l2 + 4; nop; nop;
|
193 |
+
|
194 |
+/* Notice that for the system calls we pull a trick. We load up a
|
195 |
+ * different pointer to the system call vector table in %l7, but call
|
196 |
+ * the same generic system call low-level entry point. The trap table
|
197 |
+ * entry sequences are also HyperSparc pipeline friendly ;-)
|
198 |
+ */
|
199 |
+
|
200 |
+/* Software trap for Linux system calls. */
|
201 |
+#define LINUX_SYSCALL_TRAP \
|
202 |
+ sethi %hi(C_LABEL(sys_call_table)), %l7; \
|
203 |
+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
|
204 |
+ b linux_sparc_syscall; \
|
205 |
+ rd %psr, %l0;
|
206 |
+
|
207 |
+/* Software trap for SunOS4.1.x system calls. */
|
208 |
+#define SUNOS_SYSCALL_TRAP \
|
209 |
+ rd %psr, %l0; \
|
210 |
+ sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
|
211 |
+ b linux_sparc_syscall; \
|
212 |
+ or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
|
213 |
+
|
214 |
+/* Software trap for Slowaris system calls. */
|
215 |
+#define SOLARIS_SYSCALL_TRAP \
|
216 |
+ b solaris_syscall; \
|
217 |
+ rd %psr, %l0; \
|
218 |
+ nop; \
|
219 |
+ nop;
|
220 |
+
|
221 |
+#define INDIRECT_SOLARIS_SYSCALL(x) \
|
222 |
+ mov x, %g1; \
|
223 |
+ b solaris_syscall; \
|
224 |
+ rd %psr, %l0; \
|
225 |
+ nop;
|
226 |
+
|
227 |
+#define BREAKPOINT_TRAP \
|
228 |
+ b breakpoint_trap; \
|
229 |
+ rd %psr,%l0; \
|
230 |
+ nop; \
|
231 |
+ nop;
|
232 |
+
|
233 |
+/* Software trap for Sparc-netbsd system calls. */
|
234 |
+#define NETBSD_SYSCALL_TRAP \
|
235 |
+ sethi %hi(C_LABEL(sys_call_table)), %l7; \
|
236 |
+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
|
237 |
+ b bsd_syscall; \
|
238 |
+ rd %psr, %l0;
|
239 |
+
|
240 |
+/* The Get Condition Codes software trap for userland. */
|
241 |
+#define GETCC_TRAP \
|
242 |
+ b getcc_trap_handler; mov %psr, %l0; nop; nop;
|
243 |
+
|
244 |
+/* The Set Condition Codes software trap for userland. */
|
245 |
+#define SETCC_TRAP \
|
246 |
+ b setcc_trap_handler; mov %psr, %l0; nop; nop;
|
247 |
+
|
248 |
+/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
|
249 |
+ * gets handled with another macro.
|
250 |
+ */
|
251 |
+#define TRAP_ENTRY_INTERRUPT(int_level) \
|
252 |
+ mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
|
253 |
+
|
254 |
+/* NMI's (Non Maskable Interrupts) are special, you can't keep them
|
255 |
+ * from coming in, and basically if you get one, the shows over. ;(
|
256 |
+ * On the sun4c they are usually asynchronous memory errors, on the
|
257 |
+ * the sun4m they could be either due to mem errors or a software
|
258 |
+ * initiated interrupt from the prom/kern on an SMP box saying "I
|
259 |
+ * command you to do CPU tricks, read your mailbox for more info."
|
260 |
+ */
|
261 |
+#define NMI_TRAP \
|
262 |
+ rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
|
263 |
+
|
264 |
+#endif
|
265 |
+
|
266 |
+/* Window overflows/underflows are special and we need to try to be as
|
267 |
+ * efficient as possible here....
|
268 |
+ */
|
269 |
+#define WINDOW_SPILL \
|
270 |
+ rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
|
271 |
+
|
272 |
+#define WINDOW_FILL \
|
273 |
+ rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
|
274 |
+
|
275 |
+#define STUB_TRAP ba stub_trap; nop; nop; nop;
|
276 |
+
|
277 |
+#define TRAP_ENTRY(a,b) STUB_TRAP
|
278 |
+#define SKIP_TRAP(a,b) STUB_TRAP
|
279 |
+#define SUNOS_SYSCALL_TRAP STUB_TRAP
|
280 |
+#define SOLARIS_SYSCALL_TRAP STUB_TRAP
|
281 |
+#define NETBSD_SYSCALL_TRAP STUB_TRAP
|
282 |
+#define LINUX_SYSCALL_TRAP STUB_TRAP
|
283 |
+#define BREAKPOINT_TRAP STUB_TRAP
|
284 |
+#define NMI_TRAP STUB_TRAP
|
285 |
+#define GETCC_TRAP STUB_TRAP
|
286 |
+#define SETCC_TRAP STUB_TRAP
|
287 |
+#define BAD_TRAP(n) STUB_TRAP
|
288 |
+#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP
|
289 |
+#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP
|
290 |
+
|
291 |
+ .section ".text"
|
292 |
+ .globl start, _start
|
293 |
+_start:
|
294 |
+start:
|
295 |
+ .globl spill_window_entry, fill_window_entry
|
296 |
+
|
297 |
+#define EXPORT_TRAP(trap) \
|
298 |
+ .globl trap; \
|
299 |
+ .type trap,function; \
|
300 |
+ .size trap, 16
|
301 |
+
|
302 |
+EXPORT_TRAP(t_zero)
|
303 |
+EXPORT_TRAP(t_wovf)
|
304 |
+EXPORT_TRAP(t_wunf)
|
305 |
+EXPORT_TRAP(t_irq1)
|
306 |
+EXPORT_TRAP(t_irq2)
|
307 |
+EXPORT_TRAP(t_irq3)
|
308 |
+EXPORT_TRAP(t_irq4)
|
309 |
+EXPORT_TRAP(t_irq5)
|
310 |
+EXPORT_TRAP(t_irq6)
|
311 |
+EXPORT_TRAP(t_irq7)
|
312 |
+EXPORT_TRAP(t_irq8)
|
313 |
+EXPORT_TRAP(t_irq9)
|
314 |
+EXPORT_TRAP(t_irq10)
|
315 |
+EXPORT_TRAP(t_irq11)
|
316 |
+EXPORT_TRAP(t_irq12)
|
317 |
+EXPORT_TRAP(t_irq13)
|
318 |
+EXPORT_TRAP(t_irq14)
|
319 |
+EXPORT_TRAP(t_irq15)
|
320 |
+
|
321 |
+C_LABEL(trapbase):
|
322 |
+t_zero: b goprol; nop; nop; nop;
|
323 |
+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
|
324 |
+t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
|
325 |
+t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
|
326 |
+t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
|
327 |
+t_wovf: WINDOW_SPILL /* Window Overflow */
|
328 |
+t_wunf: WINDOW_FILL /* Window Underflow */
|
329 |
+t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
|
330 |
+t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
|
331 |
+t_dflt: SRMMU_DFAULT /* Data Miss Exception */
|
332 |
+t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
|
333 |
+t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
|
334 |
+t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
|
335 |
+t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
|
336 |
+t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
|
337 |
+t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
|
338 |
+t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
|
339 |
+t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
|
340 |
+t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
|
341 |
+t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
|
342 |
+t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
|
343 |
+t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
|
344 |
+t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
|
345 |
+t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
|
346 |
+t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
|
347 |
+t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
|
348 |
+t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
|
349 |
+t_nmi: NMI_TRAP /* Level 15 (NMI) */
|
350 |
+t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
|
351 |
+t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
|
352 |
+t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
|
353 |
+t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
|
354 |
+t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
|
355 |
+t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
|
356 |
+t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
|
357 |
+t_dacce:SRMMU_DFAULT /* Data Access Error */
|
358 |
+t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
|
359 |
+t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
|
360 |
+t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
|
361 |
+t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
|
362 |
+ BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
|
363 |
+ BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
|
364 |
+ BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
|
365 |
+t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
|
366 |
+ BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
|
367 |
+ BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
|
368 |
+ BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
|
369 |
+ BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
|
370 |
+ BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
|
371 |
+ BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
|
372 |
+ BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
|
373 |
+ BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
|
374 |
+ BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
|
375 |
+ BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
|
376 |
+ BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
|
377 |
+ BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
|
378 |
+ BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
|
379 |
+ BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
|
380 |
+ BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
|
381 |
+ BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
|
382 |
+ BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
|
383 |
+t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */
|
384 |
+t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
|
385 |
+t_divz: BAD_TRAP(0x82) /* Divide by zero trap */
|
386 |
+t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
|
387 |
+t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
|
388 |
+t_rchk: BAD_TRAP(0x85) /* Range Check */
|
389 |
+t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
|
390 |
+t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
|
391 |
+t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */
|
392 |
+t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */
|
393 |
+t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
|
394 |
+ BAD_TRAP(0x8e) BAD_TRAP(0x8f)
|
395 |
+t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
|
396 |
+t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
|
397 |
+ BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
|
398 |
+ BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
|
399 |
+t_getcc:GETCC_TRAP /* Get Condition Codes */
|
400 |
+t_setcc:SETCC_TRAP /* Set Condition Codes */
|
401 |
+t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
|
402 |
+ BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
|
403 |
+t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
|
404 |
+ BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
|
405 |
+ BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
|
406 |
+ BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
|
407 |
+ BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
|
408 |
+ BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
|
409 |
+ BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
|
410 |
+t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
|
411 |
+ BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
|
412 |
+ BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
|
413 |
+ BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
|
414 |
+ BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
|
415 |
+t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
|
416 |
+ BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
|
417 |
+ BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
|
418 |
+ BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
|
419 |
+ BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
|
420 |
+t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
|
421 |
+ BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
|
422 |
+ BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
|
423 |
+ BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
|
424 |
+ BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
|
425 |
+t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
|
426 |
+dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
|
427 |
+dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
|
428 |
+
|
429 |
+stub_trap:
|
430 |
+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
|
431 |
+ set 0x00ffffff, %g4
|
432 |
+ sta %g4, [%g5] ASI_M_BYPASS
|
433 |
+1: ba 1b; nop
|
434 |
+
|
435 |
+ .section ".bss"
|
436 |
+ .align 8
|
437 |
+bss_start:
|
438 |
+ .align 0x1000 ! PAGE_SIZE
|
439 |
+ .globl C_LABEL(bootup_user_stack)
|
440 |
+ .type bootup_user_stack,#object
|
441 |
+ .size bootup_user_stack,0x2000
|
442 |
+C_LABEL(bootup_user_stack): .skip 0x2000
|
443 |
+
|
444 |
+ .section ".text"
|
445 |
+
|
446 |
+goprol:
|
447 |
+ ! %g1 contains end of memory
|
448 |
+ set PHYS_JJ_EEPROM + 0x30, %g1
|
449 |
+ lda [%g1] ASI_M_BYPASS, %g1
|
450 |
+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
|
451 |
+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
|
452 |
+ sub %g1, %g2, %g2 ! start of private memory
|
453 |
+ srl %g2, 0x4, %g7 ! ctx table at s+0x0
|
454 |
+ add %g2, 0x400, %g3 ! l1 table at s+0x400
|
455 |
+ srl %g3, 0x4, %g3
|
456 |
+ or %g3, 0x1, %g3
|
457 |
+ sta %g3, [%g2] ASI_M_BYPASS
|
458 |
+ add %g2, 0x400, %g2 ! s+0x400
|
459 |
+ add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800
|
460 |
+ srl %g3, 0x4, %g3
|
461 |
+ or %g3, 0x1, %g3
|
462 |
+ sta %g3, [%g2] ASI_M_BYPASS
|
463 |
+ add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900
|
464 |
+ add %g2, 0x3fc, %g2 ! s+0x7fc
|
465 |
+ srl %g3, 0x4, %g3
|
466 |
+ or %g3, 0x1, %g3
|
467 |
+ sta %g3, [%g2] ASI_M_BYPASS
|
468 |
+ add %g2, 0x4, %g2 ! s+0x800
|
469 |
+ set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)
|
470 |
+ sta %g3, [%g2] ASI_M_BYPASS
|
471 |
+ add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00
|
472 |
+ add %g2, 0x1d0, %g2 ! s+0x9d0
|
473 |
+ srl %g3, 0x4, %g3
|
474 |
+ or %g3, 0x1, %g3
|
475 |
+ sta %g3, [%g2] ASI_M_BYPASS
|
476 |
+ add %g2, 0x30, %g2 ! s+0xa00
|
477 |
+
|
478 |
+ set PROLBASE, %g3
|
479 |
+ set 0x1000, %g5
|
480 |
+ set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
|
481 |
+1: srl %g3, 0x4, %g4
|
482 |
+ or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)
|
483 |
+ sta %g4, [%g2] ASI_M_BYPASS
|
484 |
+ add %g2, 4, %g2
|
485 |
+ add %g3, %g5, %g3
|
486 |
+ deccc %g6
|
487 |
+ bne 1b
|
488 |
+ nop
|
489 |
+#if 0
|
490 |
+ set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
|
491 |
+1: srl %g3, 0x4, %g4
|
492 |
+ or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)
|
493 |
+ sta %g4, [%g2] ASI_M_BYPASS
|
494 |
+ add %g2, 4, %g2
|
495 |
+ add %g3, %g5, %g3
|
496 |
+ deccc %g6
|
497 |
+ bne 1b
|
498 |
+ nop
|
499 |
+#endif
|
500 |
+ set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
|
501 |
+ set 0x1000, %g4
|
502 |
+ sll %g7, 0x4, %g3
|
503 |
+ add %g4, %g3, %g3
|
504 |
+1: srl %g3, 0x4, %g4
|
505 |
+ or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)
|
506 |
+ sta %g4, [%g2] ASI_M_BYPASS
|
507 |
+ add %g2, 4, %g2
|
508 |
+ add %g3, %g5, %g3
|
509 |
+ deccc %g6
|
510 |
+ bne 1b
|
511 |
+ nop
|
512 |
+
|
513 |
+ mov %g1, %g3
|
514 |
+
|
515 |
+ set AC_M_CTPR, %g2
|
516 |
+ sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr
|
517 |
+ set 1, %g1
|
518 |
+ sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu
|
519 |
+
|
520 |
+ /*
|
521 |
+ * The code which enables traps is a simplified version of
|
522 |
+ * kernel head.S.
|
523 |
+ *
|
524 |
+ * We know number of windows as 8 so we do not calculate them.
|
525 |
+ * The deadwood is here for any case.
|
526 |
+ */
|
527 |
+
|
528 |
+ /* Turn on Supervisor, EnableFloating, and all the PIL bits.
|
529 |
+ * Also puts us in register window zero with traps off.
|
530 |
+ */
|
531 |
+ set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
|
532 |
+ wr %g2, 0x0, %psr
|
533 |
+ WRITE_PAUSE
|
534 |
+
|
535 |
+ /* I want a kernel stack NOW! */
|
536 |
+ set C_LABEL(bootup_user_stack), %g1
|
537 |
+ set (0x2000 - REGWIN_SZ), %g2
|
538 |
+ add %g1, %g2, %sp
|
539 |
+ mov 0, %fp /* And for good luck */
|
540 |
+
|
541 |
+ /* Zero out our BSS section. */
|
542 |
+ set C_LABEL(bss_start) , %o0 ! First address of BSS
|
543 |
+ set C_LABEL(end) , %o1 ! Last address of BSS
|
544 |
+ ba 2f
|
545 |
+ nop
|
546 |
+1:
|
547 |
+ st %g0, [%o0]
|
548 |
+2:
|
549 |
+ subcc %o0, %o1, %g0
|
550 |
+ bl 1b
|
551 |
+ add %o0, 0x4, %o0
|
552 |
+
|
553 |
+ mov 2, %g1
|
554 |
+ wr %g1, 0x0, %wim ! make window 1 invalid
|
555 |
+ WRITE_PAUSE
|
556 |
+
|
557 |
+#if 0
|
558 |
+ wr %g0, 0x0, %wim
|
559 |
+ WRITE_PAUSE
|
560 |
+ save
|
561 |
+ rd %psr, %g3
|
562 |
+ restore
|
563 |
+ and %g3, PSR_CWP, %g3
|
564 |
+ add %g3, 0x1, %g3
|
565 |
+#else
|
566 |
+ or %g0, 8, %g3
|
567 |
+#endif
|
568 |
+
|
569 |
+#if 0
|
570 |
+ sethi %hi( C_LABEL(cputyp) ), %o0
|
571 |
+ st %g7, [%o0 + %lo( C_LABEL(cputyp) )]
|
572 |
+
|
573 |
+ sethi %hi( C_LABEL(nwindows) ), %g4
|
574 |
+ st %g3, [%g4 + %lo( C_LABEL(nwindows) )]
|
575 |
+
|
576 |
+ sub %g3, 0x1, %g3
|
577 |
+ sethi %hi( C_LABEL(nwindowsm1) ), %g4
|
578 |
+ st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
|
579 |
+#endif
|
580 |
+
|
581 |
+ /* Here we go, start using Linux's trap table... */
|
582 |
+ set C_LABEL(trapbase), %g3
|
583 |
+ wr %g3, 0x0, %tbr
|
584 |
+ WRITE_PAUSE
|
585 |
+
|
586 |
+ /* Finally, turn on traps so that we can call c-code. */
|
587 |
+ rd %psr, %g3
|
588 |
+ wr %g3, 0x0, %psr
|
589 |
+ WRITE_PAUSE
|
590 |
+
|
591 |
+ wr %g3, PSR_ET, %psr
|
592 |
+ WRITE_PAUSE
|
593 |
+
|
594 |
+ .globl prolmain
|
595 |
+ call C_LABEL(prolmain)
|
596 |
+ nop
|
597 |
+
|
598 |
+3:
|
599 |
+ b 3b
|
600 |
+ nop
|
601 |
+
|
602 |
+/*
|
603 |
+ * Memory access trap handler
|
604 |
+ * %l0 program %psr from trap table entry
|
605 |
+ * %l1 program %pc from hardware
|
606 |
+ * %l2 program %npc from hardware
|
607 |
+ * %l3 program %wim from trap table entry
|
608 |
+ * %l4
|
609 |
+ * %l5
|
610 |
+ * %l6
|
611 |
+ * %l7 text flag from trap table entry
|
612 |
+ */
|
613 |
+
|
614 |
+ .section ".text"
|
615 |
+ .globl srmmu_fault
|
616 |
+C_LABEL(srmmu_fault):
|
617 |
+
|
618 |
+ set AC_M_SFAR, %l6
|
619 |
+ set AC_M_SFSR, %l5
|
620 |
+ lda [%l6] ASI_M_MMUREGS, %l6
|
621 |
+ lda [%l5] ASI_M_MMUREGS, %l5
|
622 |
+
|
623 |
+ set ignore_fault, %l5
|
624 |
+ ld [%l5], %l5
|
625 |
+ subcc %l5, %g0, %g0 /* NULL pointer trap faults always */
|
626 |
+ be 3f
|
627 |
+ nop
|
628 |
+ subcc %l5, %l6, %g0
|
629 |
+ be 2f
|
630 |
+ nop
|
631 |
+3:
|
632 |
+
|
633 |
+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
|
634 |
+ set 0x00ffffff, %g4
|
635 |
+ sta %g4, [%g5] ASI_M_BYPASS
|
636 |
+ add %g5, 8, %g5 /* On right side */
|
637 |
+ sta %g4, [%g5] ASI_M_BYPASS
|
638 |
+1: ba 1b; nop
|
639 |
+
|
640 |
+2:
|
641 |
+ set C_LABEL(fault_ignored), %l5
|
642 |
+ mov 1, %l6
|
643 |
+ st %l6, [%l5]
|
644 |
+
|
645 |
+ /*
|
646 |
+ * Skip the faulting instruction.
|
647 |
+ * I think it works when next instruction is a branch even.
|
648 |
+ */
|
649 |
+ or %l2, 0, %l1
|
650 |
+ add %l2, 4, %l2
|
651 |
+
|
652 |
+ wr %l0, 0, %psr
|
653 |
+ WRITE_PAUSE
|
654 |
+ jmp %l1
|
655 |
+ rett %l2
|
656 |
+
|
657 |
+/*
|
658 |
+ * Slow external versions of st_bypass and ld_bypass.
|
659 |
+ * rconsole.c uses inlines. We call these in places which are not speed
|
660 |
+ * critical, to avoid compiler bugs.
|
661 |
+ */
|
662 |
+ .globl C_LABEL(st_bypass)
|
663 |
+C_LABEL(st_bypass):
|
664 |
+ retl
|
665 |
+ sta %o1, [%o0] ASI_M_BYPASS
|
666 |
+ .globl C_LABEL(ld_bypass)
|
667 |
+C_LABEL(ld_bypass):
|
668 |
+ retl
|
669 |
+ lda [%o0] ASI_M_BYPASS, %o0
|
670 |
+ .globl C_LABEL(sth_bypass)
|
671 |
+C_LABEL(sth_bypass):
|
672 |
+ retl
|
673 |
+ stha %o1, [%o0] ASI_M_BYPASS
|
674 |
+ .globl C_LABEL(ldh_bypass)
|
675 |
+C_LABEL(ldh_bypass):
|
676 |
+ retl
|
677 |
+ lduha [%o0] ASI_M_BYPASS, %o0
|
678 |
+ .globl C_LABEL(stb_bypass)
|
679 |
+C_LABEL(stb_bypass):
|
680 |
+ retl
|
681 |
+ stba %o1, [%o0] ASI_M_BYPASS
|
682 |
+ .globl C_LABEL(ldb_bypass)
|
683 |
+C_LABEL(ldb_bypass):
|
684 |
+ retl
|
685 |
+ lduba [%o0] ASI_M_BYPASS, %o0
|
686 |
diff -ruN proll_18.orig/qemu/main.c proll-patch7/qemu/main.c
|
687 |
--- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000
|
688 |
+++ proll-patch7/qemu/main.c 2005-03-02 20:08:23.000000000 +0000
|
689 |
@@ -0,0 +1,173 @@
|
690 |
+/**
|
691 |
+ ** Proll (PROM replacement)
|
692 |
+ ** Copyright 1999 Pete Zaitcev
|
693 |
+ ** This code is licensed under GNU General Public License.
|
694 |
+ **/
|
695 |
+#include <stdarg.h>
|
696 |
+
|
697 |
+// #include <asm/contregs.h>
|
698 |
+#include <asi.h>
|
699 |
+#include "pgtsrmmu.h"
|
700 |
+#include "iommu.h" /* Typical SBus IOMMU for sun4m */
|
701 |
+#include "phys_jj.h"
|
702 |
+#include "vconsole.h"
|
703 |
+#include "version.h"
|
704 |
+#include <general.h> /* __P() */
|
705 |
+#include <net.h> /* init_net() */
|
706 |
+#include <romlib.h> /* we are a provider for part of this. */
|
707 |
+#include <netpriv.h> /* myipaddr */
|
708 |
+#include <arpa.h>
|
709 |
+#include <system.h> /* our own prototypes */
|
710 |
+
|
711 |
+void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
|
712 |
+int vcon_zs_init(struct vconterm *t, unsigned int a0);
|
713 |
+int vcon_zs_write(struct vconterm *t, char *data, int leng);
|
714 |
+
|
715 |
+static void init_idprom(void);
|
716 |
+
|
717 |
+struct vconterm dp0;
|
718 |
+struct mem cmem; /* Current memory, virtual */
|
719 |
+struct mem cio; /* Current I/O space */
|
720 |
+struct phym pmem; /* Current phys. mem. */
|
721 |
+struct iommu ciommu; /* Our IOMMU on sun4m */
|
722 |
+
|
723 |
+static struct {
|
724 |
+ const char id[16];
|
725 |
+ unsigned int version;
|
726 |
+ char pad1[0x1c]; // Pad to 0x30
|
727 |
+ unsigned int ram_size;
|
728 |
+ char boot_device;
|
729 |
+ unsigned int load_addr, kernel_size;
|
730 |
+ unsigned int cmdline, cmdline_len;
|
731 |
+ char pad2[0x0c]; // Pad to 0x54
|
732 |
+ unsigned short width, height, depth;
|
733 |
+} *hw_idprom;
|
734 |
+
|
735 |
+int ignore_fault, fault_ignored;
|
736 |
+void *printk_fn;
|
737 |
+unsigned int q_height, q_width;
|
738 |
+
|
739 |
+/*
|
740 |
+ */
|
741 |
+void prolmain()
|
742 |
+{
|
743 |
+ static char fname[14];
|
744 |
+ static struct banks bb;
|
745 |
+ unsigned int hiphybas;
|
746 |
+ const void *romvec;
|
747 |
+ unsigned int ram_size;
|
748 |
+ char nographic;
|
749 |
+
|
750 |
+ nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
|
751 |
+ if (!nographic) {
|
752 |
+ q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
|
753 |
+ q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
|
754 |
+ vcon_init(&dp0, PHYS_JJ_TCX_FB);
|
755 |
+ printk_fn = vcon_write;
|
756 |
+ }
|
757 |
+ else {
|
758 |
+ vcon_zs_init(&dp0, 0x71100000);
|
759 |
+ printk_fn = vcon_zs_write;
|
760 |
+ }
|
761 |
+
|
762 |
+
|
763 |
+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
|
764 |
+ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
|
765 |
+ printk("%d MB total\n", ram_size/(1024*1024));
|
766 |
+
|
767 |
+ bb.nbanks = 1;
|
768 |
+ bb.bankv[0].start = 0;
|
769 |
+ bb.bankv[0].length = ram_size;
|
770 |
+
|
771 |
+ hiphybas = ram_size - PROLSIZE;
|
772 |
+
|
773 |
+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
|
774 |
+ makepages(&pmem, hiphybas);
|
775 |
+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
|
776 |
+
|
777 |
+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
|
778 |
+ (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
|
779 |
+
|
780 |
+ iommu_init(&ciommu, hiphybas);
|
781 |
+
|
782 |
+ /*
|
783 |
+ */
|
784 |
+ init_idprom();
|
785 |
+ printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
|
786 |
+ if (!nographic)
|
787 |
+ printk("Prom console: TCX %dx%d\n", q_width, q_height);
|
788 |
+ else
|
789 |
+ printk("Prom console: serial\n");
|
790 |
+ sched_init();
|
791 |
+ le_probe();
|
792 |
+ init_net();
|
793 |
+
|
794 |
+ printk("Boot device: %c\n", hw_idprom->boot_device);
|
795 |
+ if (hw_idprom->boot_device == 'n') {
|
796 |
+ if (bootp() != 0) fatal();
|
797 |
+ /*
|
798 |
+ * boot_rec.bp_file cannot be used because system PROM
|
799 |
+ * uses it to locate ourselves. If we load from boot_rec.bp_file,
|
800 |
+ * we will loop reloading PROLL over and over again.
|
801 |
+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
|
802 |
+ */
|
803 |
+ xtoa(myipaddr, fname, 8);
|
804 |
+ fname[9] = '.';
|
805 |
+ fname[10] = 'P';
|
806 |
+ fname[11] = 'R';
|
807 |
+ fname[12] = 'O';
|
808 |
+ fname[13] = 'L';
|
809 |
+ fname[14] = 0;
|
810 |
+
|
811 |
+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
|
812 |
+ }
|
813 |
+
|
814 |
+ romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
|
815 |
+ (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
|
816 |
+
|
817 |
+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
|
818 |
+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
|
819 |
+ (int)cio.start, (int)cio.curp);
|
820 |
+
|
821 |
+ {
|
822 |
+ void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
|
823 |
+ printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
|
824 |
+ *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
|
825 |
+ entry(romvec, 0, 0, 0, 0);
|
826 |
+ }
|
827 |
+
|
828 |
+ mem_fini(&cmem);
|
829 |
+ vcon_fini(&dp0);
|
830 |
+}
|
831 |
+
|
832 |
+/*
|
833 |
+ * dvma_alloc over iommu_alloc.
|
834 |
+ */
|
835 |
+void *dvma_alloc(int size, unsigned int *pphys)
|
836 |
+{
|
837 |
+ return iommu_alloc(&ciommu, size, pphys);
|
838 |
+}
|
839 |
+
|
840 |
+/*
|
841 |
+ */
|
842 |
+void udelay(unsigned long usecs)
|
843 |
+{
|
844 |
+ // Qemu hardware is perfect and does not need any delays!
|
845 |
+}
|
846 |
+
|
847 |
+static void init_idprom()
|
848 |
+{
|
849 |
+ void *va_prom;
|
850 |
+
|
851 |
+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
|
852 |
+ printk("init_idprom: cannot map eeprom\n");
|
853 |
+ fatal();
|
854 |
+ }
|
855 |
+ bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
|
856 |
+ /*
|
857 |
+ * hw_idprom is not used anywhere.
|
858 |
+ * It's just as we hate to leave hanging pointers (I/O page here).
|
859 |
+ */
|
860 |
+ hw_idprom = va_prom;
|
861 |
+}
|
862 |
+
|
863 |
diff -ruN proll_18.orig/qemu/openprom.c proll-patch7/qemu/openprom.c
|
864 |
--- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000
|
865 |
+++ proll-patch7/qemu/openprom.c 2005-03-02 20:09:57.000000000 +0000
|
866 |
@@ -0,0 +1,646 @@
|
867 |
+/*
|
868 |
+ * PROM interface support
|
869 |
+ * Copyright 1996 The Australian National University.
|
870 |
+ * Copyright 1996 Fujitsu Laboratories Limited
|
871 |
+ * Copyright 1999 Pete A. Zaitcev
|
872 |
+ * This software may be distributed under the terms of the Gnu
|
873 |
+ * Public License version 2 or later
|
874 |
+ */
|
875 |
+
|
876 |
+#include <openprom.h>
|
877 |
+#include <general.h>
|
878 |
+#include <romlib.h>
|
879 |
+#include <system.h>
|
880 |
+#include <vconsole.h>
|
881 |
+#include "phys_jj.h"
|
882 |
+
|
883 |
+//#define DEBUG_OBP
|
884 |
+
|
885 |
+struct property {
|
886 |
+ const char *name;
|
887 |
+ const char *value;
|
888 |
+ const int length;
|
889 |
+};
|
890 |
+
|
891 |
+struct node {
|
892 |
+ const struct property *properties;
|
893 |
+ /* short */ const int sibling;
|
894 |
+ /* short */ const int child;
|
895 |
+};
|
896 |
+
|
897 |
+static int obp_nextnode(int node);
|
898 |
+static int obp_child(int node);
|
899 |
+static int obp_proplen(int node, char *name);
|
900 |
+static int obp_getprop(int node, char *name, char *val);
|
901 |
+static int obp_setprop(int node, char *name, char *val, int len);
|
902 |
+static const char *obp_nextprop(int node, char *name);
|
903 |
+
|
904 |
+static char obp_idprom[IDPROM_SIZE];
|
905 |
+static const struct property null_properties = { NULL, NULL, -1 };
|
906 |
+static const int prop_true = -1;
|
907 |
+
|
908 |
+static const struct property propv_root[] = {
|
909 |
+ {"name", "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") },
|
910 |
+ {"idprom", obp_idprom, IDPROM_SIZE},
|
911 |
+ {"banner-name", "JavaStation", sizeof("JavaStation")},
|
912 |
+ {"compatible", "sun4m", 6},
|
913 |
+ {NULL, NULL, -1}
|
914 |
+};
|
915 |
+
|
916 |
+static const int prop_iommu_reg[] = {
|
917 |
+ 0x0, 0x10000000, 0x00000300,
|
918 |
+};
|
919 |
+static const struct property propv_iommu[] = {
|
920 |
+ {"name", "iommu", sizeof("iommu")},
|
921 |
+ {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
|
922 |
+ {NULL, NULL, -1}
|
923 |
+};
|
924 |
+
|
925 |
+static const int prop_sbus_ranges[] = {
|
926 |
+ 0x0, 0x0, 0x0, 0x30000000, 0x10000000,
|
927 |
+ 0x1, 0x0, 0x0, 0x40000000, 0x10000000,
|
928 |
+ 0x2, 0x0, 0x0, 0x50000000, 0x10000000,
|
929 |
+ 0x3, 0x0, 0x0, 0x60000000, 0x10000000,
|
930 |
+ 0x4, 0x0, 0x0, 0x70000000, 0x10000000,
|
931 |
+};
|
932 |
+static const struct property propv_sbus[] = {
|
933 |
+ {"name", "sbus", 5},
|
934 |
+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
|
935 |
+ {"device_type", "hierarchical", sizeof("hierarchical") },
|
936 |
+ {NULL, NULL, -1}
|
937 |
+};
|
938 |
+
|
939 |
+static const int prop_tcx_regs[] = {
|
940 |
+ 0x2, 0x00800000, 0x00100000,
|
941 |
+ 0x2, 0x02000000, 0x00000001,
|
942 |
+ 0x2, 0x04000000, 0x00800000,
|
943 |
+ 0x2, 0x06000000, 0x00800000,
|
944 |
+ 0x2, 0x0a000000, 0x00000001,
|
945 |
+ 0x2, 0x0c000000, 0x00000001,
|
946 |
+ 0x2, 0x0e000000, 0x00000001,
|
947 |
+ 0x2, 0x00700000, 0x00001000,
|
948 |
+ 0x2, 0x00200000, 0x00000004,
|
949 |
+ 0x2, 0x00300000, 0x0000081c,
|
950 |
+ 0x2, 0x00000000, 0x00010000,
|
951 |
+ 0x2, 0x00240000, 0x00000004,
|
952 |
+ 0x2, 0x00280000, 0x00000001,
|
953 |
+};
|
954 |
+
|
955 |
+#if 1 /* Zaitcev */
|
956 |
+static const int pixfreq = 0x03dfd240;
|
957 |
+static const int hbporch = 0xa0;
|
958 |
+static const int vfreq = 0x3c;
|
959 |
+#endif
|
960 |
+#if 0 /* Kevin Boone - 70Hz refresh */
|
961 |
+static const int pixfreq = 0x047868C0;
|
962 |
+static const int hbporch = 0x90;
|
963 |
+static const int vfreq = 0x46;
|
964 |
+#endif
|
965 |
+
|
966 |
+static const int vbporch = 0x1d;
|
967 |
+static const int vsync = 0x6;
|
968 |
+static const int hsync = 0x88;
|
969 |
+static const int vfporch = 0x3;
|
970 |
+static const int hfporch = 0x18;
|
971 |
+static const int height = 0x300;
|
972 |
+static const int width = 0x400;
|
973 |
+static const int linebytes = 0x400;
|
974 |
+static const int depth = 8;
|
975 |
+static const int tcx_intr[] = { 5, 0 };
|
976 |
+static const int tcx_interrupts = 5;
|
977 |
+static const struct property propv_sbus_tcx[] = {
|
978 |
+ {"name", "SUNW,tcx", sizeof("SUNW,tcx")},
|
979 |
+ {"vbporch", (char*)&vbporch, sizeof(int)},
|
980 |
+ {"hbporch", (char*)&hbporch, sizeof(int)},
|
981 |
+ {"vsync", (char*)&vsync, sizeof(int)},
|
982 |
+ {"hsync", (char*)&hsync, sizeof(int)},
|
983 |
+ {"vfporch", (char*)&vfporch, sizeof(int)},
|
984 |
+ {"hfporch", (char*)&hfporch, sizeof(int)},
|
985 |
+ {"pixfreq", (char*)&pixfreq, sizeof(int)},
|
986 |
+ {"vfreq", (char*)&vfreq, sizeof(int)},
|
987 |
+ {"height", (char*)&height, sizeof(int)},
|
988 |
+ {"width", (char*)&width, sizeof(int)},
|
989 |
+ {"linebytes", (char*)&linebytes, sizeof(int)},
|
990 |
+ {"depth", (char*)&depth, sizeof(int)},
|
991 |
+ {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
|
992 |
+ {"tcx-8-bit", (char*)&prop_true, 0},
|
993 |
+ {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},
|
994 |
+ {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
|
995 |
+ {"device_type", "display", sizeof("display")},
|
996 |
+ {NULL, NULL, -1}
|
997 |
+};
|
998 |
+
|
999 |
+static const int prop_cs4231_reg[] = {
|
1000 |
+ 0x3, 0x0C000000, 0x00000040
|
1001 |
+};
|
1002 |
+static const int cs4231_interrupts = 5;
|
1003 |
+static const int cs4231_intr[] = { 5, 0 };
|
1004 |
+
|
1005 |
+static const struct property propv_sbus_cs4231[] = {
|
1006 |
+ {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },
|
1007 |
+ {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
|
1008 |
+ {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
|
1009 |
+ {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
|
1010 |
+ {"device_type", "serial", sizeof("serial") },
|
1011 |
+ {"alias", "audio", sizeof("audio") },
|
1012 |
+ {NULL, NULL, -1}
|
1013 |
+};
|
1014 |
+
|
1015 |
+static const int cpu_nctx = NCTX_SWIFT;
|
1016 |
+static const int cpu_cache_line_size = 0x20;
|
1017 |
+static const int cpu_cache_nlines = 0x200;
|
1018 |
+static const struct property propv_cpu[] = {
|
1019 |
+ {"name", "STP1012PGA", sizeof("STP1012PGA") },
|
1020 |
+ {"device_type", "cpu", 4 },
|
1021 |
+ {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},
|
1022 |
+ {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},
|
1023 |
+ {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},
|
1024 |
+ {NULL, NULL, -1}
|
1025 |
+};
|
1026 |
+
|
1027 |
+static const int prop_obio_ranges[] = {
|
1028 |
+ 0x0, 0x0, 0x0, 0x71000000, 0x01000000,
|
1029 |
+};
|
1030 |
+static const struct property propv_obio[] = {
|
1031 |
+ {"name", "obio", 5 },
|
1032 |
+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
|
1033 |
+ {"device_type", "hierarchical", sizeof("hierarchical") },
|
1034 |
+ {NULL, NULL, -1}
|
1035 |
+};
|
1036 |
+
|
1037 |
+static const int prop_auxio_reg[] = {
|
1038 |
+ 0x0, 0x00900000, 0x00000001,
|
1039 |
+};
|
1040 |
+static const struct property propv_obio_auxio[] = {
|
1041 |
+ {"name", "auxio", sizeof("auxio") },
|
1042 |
+ {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
|
1043 |
+ {NULL, NULL, -1}
|
1044 |
+};
|
1045 |
+
|
1046 |
+static const int prop_int_reg[] = {
|
1047 |
+ 0x0, 0x00e00000, 0x00000010,
|
1048 |
+ 0x0, 0x00e10000, 0x00000010,
|
1049 |
+};
|
1050 |
+static const struct property propv_obio_int[] = {
|
1051 |
+ {"name", "interrupt", sizeof("interrupt")},
|
1052 |
+ {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
|
1053 |
+ {NULL, NULL, -1}
|
1054 |
+};
|
1055 |
+
|
1056 |
+static const int prop_cnt_reg[] = {
|
1057 |
+ 0x0, 0x00d00000, 0x00000010,
|
1058 |
+ 0x0, 0x00d10000, 0x00000010,
|
1059 |
+};
|
1060 |
+static const struct property propv_obio_cnt[] = {
|
1061 |
+ {"name", "counter", sizeof("counter")},
|
1062 |
+ {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
|
1063 |
+ {NULL, NULL, -1}
|
1064 |
+};
|
1065 |
+
|
1066 |
+static const int prop_eeprom_reg[] = {
|
1067 |
+ 0x0, 0x00200000, 0x00002000,
|
1068 |
+};
|
1069 |
+static const struct property propv_obio_eep[] = {
|
1070 |
+ {"name", "eeprom", sizeof("eeprom")},
|
1071 |
+ {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
|
1072 |
+ {"model", "mk48t08", sizeof("mk48t08")},
|
1073 |
+ {NULL, NULL, -1}
|
1074 |
+};
|
1075 |
+
|
1076 |
+static const int prop_su_reg[] = {
|
1077 |
+ 0x0, 0x003002f8, 0x00000008,
|
1078 |
+};
|
1079 |
+static const struct property propv_obio_su[] = {
|
1080 |
+ {"name", "su", sizeof("su")},
|
1081 |
+ {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
|
1082 |
+ {NULL, NULL, -1}
|
1083 |
+};
|
1084 |
+
|
1085 |
+static const int prop_zs_intr[] = { 12, 0x0 };
|
1086 |
+static const int prop_zs_reg[] = {
|
1087 |
+ 0x0, 0x00000000, 0x00000008,
|
1088 |
+};
|
1089 |
+static const int prop_zs_addr = { 0x70000000 };
|
1090 |
+static const int prop_zs_slave[] = { 1 };
|
1091 |
+static const struct property propv_obio_zs[] = {
|
1092 |
+ {"name", "zs", sizeof("zs")},
|
1093 |
+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
|
1094 |
+ {"slave", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
|
1095 |
+ {"device_type", "serial", sizeof("serial") },
|
1096 |
+ {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
|
1097 |
+ // {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },
|
1098 |
+ {NULL, NULL, -1}
|
1099 |
+};
|
1100 |
+
|
1101 |
+static const int prop_zs1_intr[] = { 12, 0x0 };
|
1102 |
+static const int prop_zs1_reg[] = {
|
1103 |
+ 0x0, 0x00100000, 0x00000008,
|
1104 |
+};
|
1105 |
+static const int prop_zs1_addr = { 0x70100000 };
|
1106 |
+static const int prop_zs1_slave[] = { 0 };
|
1107 |
+static const struct property propv_obio_zs1[] = {
|
1108 |
+ {"name", "zs", sizeof("zs")},
|
1109 |
+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
|
1110 |
+ {"slave", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
|
1111 |
+ {"device_type", "serial", sizeof("serial") },
|
1112 |
+ {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
|
1113 |
+ // {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
|
1114 |
+ {NULL, NULL, -1}
|
1115 |
+};
|
1116 |
+
|
1117 |
+static const int prop_ledma_reg[] = {
|
1118 |
+ 0x4, 0x08400010, 0x00000020,
|
1119 |
+};
|
1120 |
+static const int prop_ledma_burst = 0x3f;
|
1121 |
+static const struct property propv_sbus_ledma[] = {
|
1122 |
+ {"name", "ledma", sizeof("ledma")},
|
1123 |
+ {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
|
1124 |
+ {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
|
1125 |
+ {NULL, NULL, -1}
|
1126 |
+};
|
1127 |
+
|
1128 |
+static const int prop_le_reg[] = {
|
1129 |
+ 0x4, 0x08c00000, 0x00000004,
|
1130 |
+};
|
1131 |
+static const int prop_le_busmaster_regval = 0x7;
|
1132 |
+static const int prop_le_intr[] = { 0x26, 0x0 };
|
1133 |
+static const struct property propv_sbus_ledma_le[] = {
|
1134 |
+ {"name", "le", sizeof("le")},
|
1135 |
+ {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
|
1136 |
+ {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},
|
1137 |
+ {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
|
1138 |
+ {NULL, NULL, -1}
|
1139 |
+};
|
1140 |
+
|
1141 |
+static const int prop_espdma_reg[] = {
|
1142 |
+ 0x4, 0x08400000, 0x00000010,
|
1143 |
+};
|
1144 |
+// Disabled, not implemented yet
|
1145 |
+static const struct property propv_sbus_espdma[] = {
|
1146 |
+ {"name", "xxxespdma", sizeof("xxxespdma")},
|
1147 |
+ {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
|
1148 |
+ {NULL, NULL, -1}
|
1149 |
+};
|
1150 |
+
|
1151 |
+static const int prop_esp_reg[] = {
|
1152 |
+ 0x4, 0x08800000, 0x00000040,
|
1153 |
+};
|
1154 |
+static const int prop_esp_intr[] = { 0x24, 0x0 };
|
1155 |
+static const struct property propv_sbus_espdma_esp[] = {
|
1156 |
+ {"name", "esp", sizeof("esp")},
|
1157 |
+ {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
|
1158 |
+ {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
|
1159 |
+ {NULL, NULL, -1}
|
1160 |
+};
|
1161 |
+
|
1162 |
+static const int prop_bpp_reg[] = {
|
1163 |
+ 0x4, 0x0c800000, 0x0000001c,
|
1164 |
+};
|
1165 |
+static const int prop_bpp_intr[] = { 0x33, 0x0 };
|
1166 |
+static const struct property propv_sbus_bpp[] = {
|
1167 |
+ {"name", "SUNW,bpp", sizeof("SUNW,bpp")},
|
1168 |
+ {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
|
1169 |
+ {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
|
1170 |
+ {NULL, NULL, -1}
|
1171 |
+};
|
1172 |
+
|
1173 |
+static const int prop_fd_intr[] = { 0x2b, 0x0 };
|
1174 |
+static const int prop_fd_reg[] = {
|
1175 |
+ 0x0, 0x00400000, 0x0000000f,
|
1176 |
+};
|
1177 |
+static const struct property propv_obio_fd[] = {
|
1178 |
+ {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},
|
1179 |
+ {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
|
1180 |
+ {"device_type", "block", sizeof("block") },
|
1181 |
+ {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
|
1182 |
+ {NULL, NULL, -1}
|
1183 |
+};
|
1184 |
+
|
1185 |
+static const int prop_pw_intr[] = { 0x22, 0x0 };
|
1186 |
+static const int prop_pw_reg[] = {
|
1187 |
+ 0x0, 0x00910000, 0x00000001,
|
1188 |
+};
|
1189 |
+static const struct property propv_obio_pw[] = {
|
1190 |
+ {"name", "power", sizeof("power")},
|
1191 |
+ {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
|
1192 |
+ {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
|
1193 |
+ {NULL, NULL, -1}
|
1194 |
+};
|
1195 |
+
|
1196 |
+static const int prop_cf_reg[] = {
|
1197 |
+ 0x0, 0x00800000, 0x00000001,
|
1198 |
+};
|
1199 |
+static const struct property propv_obio_cf[] = {
|
1200 |
+ {"name", "slavioconfig", sizeof("slavioconfig")},
|
1201 |
+ {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
|
1202 |
+ {NULL, NULL, -1}
|
1203 |
+};
|
1204 |
+
|
1205 |
+static const struct node nodes[] = {
|
1206 |
+ { &null_properties, 1, 0 }, /* 0 = big brother of root */
|
1207 |
+ { propv_root, 0, 2 }, /* 1 "/" */
|
1208 |
+ { propv_iommu, 11, 3 }, /* 2 "/iommu" */
|
1209 |
+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
|
1210 |
+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
|
1211 |
+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
|
1212 |
+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */
|
1213 |
+ { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */
|
1214 |
+ { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */
|
1215 |
+ { propv_sbus_espdma, 0, 10 }, /* 9 "/iommu/sbus/espdma" */
|
1216 |
+ { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */
|
1217 |
+ { propv_cpu, 12, 0 }, /* 11 "/STP1012PGA" */
|
1218 |
+ { propv_obio, 0, 13 }, /* 12 "/obio" */
|
1219 |
+ { propv_obio_int, 14, 0 }, /* 13 "/obio/interrupt" */
|
1220 |
+ { propv_obio_cnt, 15, 0 }, /* 14 "/obio/counter" */
|
1221 |
+ { propv_obio_eep, 16, 0 }, /* 15 "/obio/eeprom" */
|
1222 |
+ { propv_obio_auxio, 17, 0 }, /* 16 "/obio/auxio" */
|
1223 |
+ { propv_obio_zs, 18, 0 }, /* 17 "/obio/zs@0,0" */
|
1224 |
+ { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000" */
|
1225 |
+ { propv_obio_fd, 20, 0 }, /* 19 "/obio/SUNW,fdtwo" */
|
1226 |
+ { propv_obio_pw, 21, 0 }, /* 20 "/obio/power" */
|
1227 |
+ { propv_obio_cf, 0, 0 }, /* 21 "/obio/slavioconfig@0,800000" */
|
1228 |
+#if 0
|
1229 |
+ { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */
|
1230 |
+ { propv_cpu, 18, 0 }, /* 17 "/STP1012PGA" */
|
1231 |
+ { propv_cpu, 19, 0 }, /* 18 "/STP1012PGA" */
|
1232 |
+
|
1233 |
+ { propv_cpu, 20, 0 }, /* 19 "/STP1012PGA" */
|
1234 |
+ { propv_cpu, 21, 0 }, /* 20 "/STP1012PGA" */
|
1235 |
+ { propv_cpu, 22, 0 }, /* 21 "/STP1012PGA" */
|
1236 |
+ { propv_cpu, 23, 0 }, /* 22 "/STP1012PGA" */
|
1237 |
+ { propv_cpu, 24, 0 }, /* 23 "/STP1012PGA" */
|
1238 |
+ { propv_cpu, 25, 0 }, /* 24 "/STP1012PGA" */
|
1239 |
+ { propv_cpu, 26, 0 }, /* 25 "/STP1012PGA" */
|
1240 |
+ { propv_cpu, 27, 0 }, /* 26 "/STP1012PGA" */
|
1241 |
+ { propv_cpu, 28, 0 }, /* 27 "/STP1012PGA" */
|
1242 |
+ { propv_cpu, 29, 0 }, /* 28 "/STP1012PGA" */
|
1243 |
+ { propv_cpu, 30, 0 }, /* 29 "/STP1012PGA" */
|
1244 |
+#endif
|
1245 |
+};
|
1246 |
+
|
1247 |
+static struct linux_mlist_v0 totphys[MAX_BANKS];
|
1248 |
+static struct linux_mlist_v0 totmap[1];
|
1249 |
+static struct linux_mlist_v0 totavail[MAX_BANKS];
|
1250 |
+
|
1251 |
+static struct linux_mlist_v0 *ptphys;
|
1252 |
+static struct linux_mlist_v0 *ptmap;
|
1253 |
+static struct linux_mlist_v0 *ptavail;
|
1254 |
+
|
1255 |
+static const struct linux_nodeops nodeops0 = {
|
1256 |
+ obp_nextnode, /* int (*no_nextnode)(int node); */
|
1257 |
+ obp_child, /* int (*no_child)(int node); */
|
1258 |
+ obp_proplen, /* int (*no_proplen)(int node, char *name); */
|
1259 |
+ obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
|
1260 |
+ obp_setprop, /* int (*no_setprop)(int node, char *name,
|
1261 |
+ char *val, int len); */
|
1262 |
+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
|
1263 |
+};
|
1264 |
+
|
1265 |
+static struct linux_arguments_v0 obp_arg;
|
1266 |
+static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
|
1267 |
+
|
1268 |
+static void (*synch_hook)(void);
|
1269 |
+static char obp_stdin, obp_stdout;
|
1270 |
+
|
1271 |
+static int obp_nbgetchar(void);
|
1272 |
+static int obp_nbputchar(int ch);
|
1273 |
+static void obp_reboot(char *);
|
1274 |
+static void obp_abort(void);
|
1275 |
+static void obp_halt(void);
|
1276 |
+static int obp_devopen(char *str);
|
1277 |
+static int obp_devclose(int dev_desc);
|
1278 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
|
1279 |
+
|
1280 |
+static void doublewalk(unsigned ptab1, unsigned va)
|
1281 |
+{
|
1282 |
+unsigned int proc_tablewalk(int ctx, unsigned int va);
|
1283 |
+unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
|
1284 |
+
|
1285 |
+ proc_tablewalk(0, va);
|
1286 |
+ if (ptab1 != 0) mem_tablewalk(ptab1, va);
|
1287 |
+}
|
1288 |
+
|
1289 |
+static struct linux_romvec romvec0;
|
1290 |
+
|
1291 |
+void *
|
1292 |
+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
|
1293 |
+ const char *cmdline, char boot_device, int nographic)
|
1294 |
+{
|
1295 |
+ int i;
|
1296 |
+
|
1297 |
+ /*
|
1298 |
+ * Avoid data segment allocations
|
1299 |
+ */
|
1300 |
+ ptphys = totphys;
|
1301 |
+ ptmap = totmap;
|
1302 |
+ ptavail = totavail;
|
1303 |
+ /*
|
1304 |
+ * Form memory descriptors.
|
1305 |
+ */
|
1306 |
+ for (i = 0; i < bankc; i++) {
|
1307 |
+ totphys[i].theres_more = &totphys[i+1];
|
1308 |
+ totphys[i].start_adr = (char*) bankv[i].start;
|
1309 |
+ totphys[i].num_bytes = bankv[i].length;
|
1310 |
+ }
|
1311 |
+ totphys[i-1].theres_more = 0;
|
1312 |
+
|
1313 |
+ /*
|
1314 |
+ * XXX Merged in normal PROM when full banks touch.
|
1315 |
+ */
|
1316 |
+ for (i = 0; i < bankc; i++) {
|
1317 |
+ unsigned bankbase = bankv[i].start;
|
1318 |
+ unsigned banksize = bankv[i].length;
|
1319 |
+ if (hiphybas > bankbase &&
|
1320 |
+ hiphybas < bankbase + banksize) {
|
1321 |
+ banksize = hiphybas - bankbase;
|
1322 |
+ }
|
1323 |
+ totavail[i].theres_more = &totavail[i+1];
|
1324 |
+ totavail[i].start_adr = (char*) bankbase;
|
1325 |
+ totavail[i].num_bytes = banksize;
|
1326 |
+ }
|
1327 |
+ totavail[i-1].theres_more = 0;
|
1328 |
+
|
1329 |
+ totmap[0].theres_more = 0;
|
1330 |
+ totmap[0].start_adr = (char*) PROLBASE;
|
1331 |
+ totmap[0].num_bytes = PROLSIZE;
|
1332 |
+
|
1333 |
+ /*
|
1334 |
+ * idprom
|
1335 |
+ */
|
1336 |
+ bcopy(idprom, obp_idprom, IDPROM_SIZE);
|
1337 |
+
|
1338 |
+ // Linux wants a R/W romvec table
|
1339 |
+ romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
|
1340 |
+ romvec0.pv_plugin_revision = 77;
|
1341 |
+ romvec0.pv_printrev = 0x10203;
|
1342 |
+ romvec0.pv_v0mem.v0_totphys = &ptphys;
|
1343 |
+ romvec0.pv_v0mem.v0_prommap = &ptmap;
|
1344 |
+ romvec0.pv_v0mem.v0_available = &ptavail;
|
1345 |
+ romvec0.pv_nodeops = &nodeops0;
|
1346 |
+ romvec0.pv_bootstr = (void *)doublewalk;
|
1347 |
+ romvec0.pv_v0devops.v0_devopen = &obp_devopen;
|
1348 |
+ romvec0.pv_v0devops.v0_devclose = &obp_devclose;
|
1349 |
+ romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
|
1350 |
+ romvec0.pv_stdin = &obp_stdin;
|
1351 |
+ romvec0.pv_stdout = &obp_stdout;
|
1352 |
+ romvec0.pv_getchar = obp_nbgetchar;
|
1353 |
+ romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
|
1354 |
+ romvec0.pv_nbgetchar = obp_nbgetchar;
|
1355 |
+ romvec0.pv_nbputchar = obp_nbputchar;
|
1356 |
+ romvec0.pv_reboot = obp_reboot;
|
1357 |
+ romvec0.pv_abort = obp_abort;
|
1358 |
+ romvec0.pv_halt = obp_halt;
|
1359 |
+ romvec0.pv_synchook = &synch_hook;
|
1360 |
+ romvec0.pv_v0bootargs = &obp_argp;
|
1361 |
+ switch(boot_device) {
|
1362 |
+ default:
|
1363 |
+ case 'a':
|
1364 |
+ obp_arg.argv[0] = "fd()";
|
1365 |
+ break;
|
1366 |
+ case 'c':
|
1367 |
+ obp_arg.argv[0] = "sd()";
|
1368 |
+ break;
|
1369 |
+ case 'n':
|
1370 |
+ obp_arg.argv[0] = "le()";
|
1371 |
+ break;
|
1372 |
+ }
|
1373 |
+ obp_arg.argv[1] = cmdline;
|
1374 |
+
|
1375 |
+ if (nographic) {
|
1376 |
+ obp_stdin = PROMDEV_TTYA;
|
1377 |
+ obp_stdout = PROMDEV_TTYA;
|
1378 |
+ } else {
|
1379 |
+ obp_stdin = PROMDEV_KBD;
|
1380 |
+ obp_stdout = PROMDEV_SCREEN;
|
1381 |
+ }
|
1382 |
+ return &romvec0;
|
1383 |
+}
|
1384 |
+
|
1385 |
+static const struct property *find_property(int node,char *name)
|
1386 |
+{
|
1387 |
+ const struct property *prop = &nodes[node].properties[0];
|
1388 |
+ while (prop && prop->name) {
|
1389 |
+ if (bcmp(prop->name, name, 128) == 0) return prop;
|
1390 |
+ prop++;
|
1391 |
+ }
|
1392 |
+ return NULL;
|
1393 |
+}
|
1394 |
+
|
1395 |
+static int obp_nextnode(int node)
|
1396 |
+{
|
1397 |
+#ifdef DEBUG_OBP
|
1398 |
+ printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
|
1399 |
+#endif
|
1400 |
+ return nodes[node].sibling;
|
1401 |
+}
|
1402 |
+
|
1403 |
+static int obp_child(int node)
|
1404 |
+{
|
1405 |
+#ifdef DEBUG_OBP
|
1406 |
+ printk("obp_child(%d) = %d\n", node, nodes[node].child);
|
1407 |
+#endif
|
1408 |
+ return nodes[node].child;
|
1409 |
+}
|
1410 |
+
|
1411 |
+static int obp_proplen(int node, char *name)
|
1412 |
+{
|
1413 |
+ const struct property *prop = find_property(node,name);
|
1414 |
+ if (prop) {
|
1415 |
+#ifdef DEBUG_OBP
|
1416 |
+ printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
|
1417 |
+#endif
|
1418 |
+ return prop->length;
|
1419 |
+ }
|
1420 |
+#ifdef DEBUG_OBP
|
1421 |
+ printk("obp_proplen(%d, %s) (no prop)\n", node, name);
|
1422 |
+#endif
|
1423 |
+ return -1;
|
1424 |
+}
|
1425 |
+
|
1426 |
+static int obp_getprop(int node, char *name, char *value)
|
1427 |
+{
|
1428 |
+ const struct property *prop;
|
1429 |
+
|
1430 |
+ prop = find_property(node,name);
|
1431 |
+ if (prop) {
|
1432 |
+ memcpy(value,prop->value,prop->length);
|
1433 |
+#ifdef DEBUG_OBP
|
1434 |
+ printk("obp_getprop(%d, %s) = %s\n", node, name, value);
|
1435 |
+#endif
|
1436 |
+ return prop->length;
|
1437 |
+ }
|
1438 |
+#ifdef DEBUG_OBP
|
1439 |
+ printk("obp_getprop(%d, %s): not found\n", node, name);
|
1440 |
+#endif
|
1441 |
+ return -1;
|
1442 |
+}
|
1443 |
+
|
1444 |
+static int obp_setprop(int node, char *name, char *value, int len)
|
1445 |
+{
|
1446 |
+#ifdef DEBUG_OBP
|
1447 |
+ printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
|
1448 |
+#endif
|
1449 |
+ return -1;
|
1450 |
+}
|
1451 |
+
|
1452 |
+static const char *obp_nextprop(int node,char *name)
|
1453 |
+{
|
1454 |
+ const struct property *prop = find_property(node,name);
|
1455 |
+ if (prop) {
|
1456 |
+#ifdef DEBUG_OBP
|
1457 |
+ printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
|
1458 |
+#endif
|
1459 |
+ return prop[1].name;
|
1460 |
+ }
|
1461 |
+#ifdef DEBUG_OBP
|
1462 |
+ printk("obp_nextprop(%d, %s): not found\n", node, name);
|
1463 |
+#endif
|
1464 |
+ return NULL;
|
1465 |
+}
|
1466 |
+
|
1467 |
+static int obp_nbgetchar(void) {
|
1468 |
+ extern struct vconterm dp0;
|
1469 |
+ return vcon_getch(&dp0);
|
1470 |
+}
|
1471 |
+
|
1472 |
+static int obp_nbputchar(int ch) {
|
1473 |
+ printk("%c", ch);
|
1474 |
+ return 0;
|
1475 |
+}
|
1476 |
+
|
1477 |
+static void obp_reboot(char *str) {
|
1478 |
+ printk("rebooting (%s): not implemented, freezing\n", str);
|
1479 |
+ for (;;) {}
|
1480 |
+}
|
1481 |
+
|
1482 |
+static void obp_abort() {
|
1483 |
+ printk("abort, freezing\n");
|
1484 |
+ for (;;) {}
|
1485 |
+}
|
1486 |
+
|
1487 |
+static void obp_halt() {
|
1488 |
+ printk("halt, freezing\n");
|
1489 |
+ for (;;) {}
|
1490 |
+}
|
1491 |
+
|
1492 |
+static int obp_devopen(char *str) {
|
1493 |
+#ifdef DEBUG_OBP
|
1494 |
+ printk("open %s\n", str);
|
1495 |
+#endif
|
1496 |
+ return 0;
|
1497 |
+}
|
1498 |
+
|
1499 |
+static int obp_devclose(int dev_desc) {
|
1500 |
+#ifdef DEBUG_OBP
|
1501 |
+ printk("close %d\n", dev_desc);
|
1502 |
+#endif
|
1503 |
+ return 0;
|
1504 |
+}
|
1505 |
+
|
1506 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) {
|
1507 |
+#ifdef DEBUG_OBP
|
1508 |
+ printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf);
|
1509 |
+#endif
|
1510 |
+ //buf[8] = 'L';
|
1511 |
+ return num_blks;
|
1512 |
+}
|
1513 |
diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch7/qemu/system_qemu.c
|
1514 |
--- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000
|
1515 |
+++ proll-patch7/qemu/system_qemu.c 2005-03-02 16:10:20.000000000 +0000
|
1516 |
@@ -0,0 +1,416 @@
|
1517 |
+/**
|
1518 |
+ ** Proll (PROM replacement)
|
1519 |
+ ** system.c: shared miscallenea.
|
1520 |
+ ** Copyright 1999 Pete Zaitcev
|
1521 |
+ ** This code is licensed under GNU General Public License.
|
1522 |
+ **/
|
1523 |
+#include <stdarg.h>
|
1524 |
+#include <asi.h>
|
1525 |
+#include <crs.h>
|
1526 |
+#ifndef NULL
|
1527 |
+#define NULL ((void*)0)
|
1528 |
+#endif
|
1529 |
+
|
1530 |
+#include "pgtsrmmu.h"
|
1531 |
+
|
1532 |
+#include "vconsole.h"
|
1533 |
+#include <timer.h> /* Local copy of 2.2 style include */
|
1534 |
+#include <general.h> /* __P() */
|
1535 |
+#include <net.h> /* init_net() */
|
1536 |
+#include <romlib.h> /* we are a provider for part of this. */
|
1537 |
+#include <netpriv.h> /* myipaddr */
|
1538 |
+#include <arpa.h>
|
1539 |
+#include <system.h> /* our own prototypes */
|
1540 |
+
|
1541 |
+/*
|
1542 |
+ * We export this.
|
1543 |
+ */
|
1544 |
+char idprom[IDPROM_SIZE];
|
1545 |
+
|
1546 |
+
|
1547 |
+/*
|
1548 |
+ * Create an I/O mapping to pa[size].
|
1549 |
+ * Returns va of the mapping or 0 if unsuccessful.
|
1550 |
+ */
|
1551 |
+void *
|
1552 |
+map_io(unsigned pa, int size)
|
1553 |
+{
|
1554 |
+ void *va;
|
1555 |
+ unsigned int npages;
|
1556 |
+ unsigned int off;
|
1557 |
+ unsigned int mva;
|
1558 |
+
|
1559 |
+ off = pa & (PAGE_SIZE-1);
|
1560 |
+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
1561 |
+ pa &= ~(PAGE_SIZE-1);
|
1562 |
+
|
1563 |
+ va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
|
1564 |
+ if (va == 0) return va;
|
1565 |
+
|
1566 |
+ mva = (unsigned int) va;
|
1567 |
+ /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
|
1568 |
+ while (npages-- != 0) {
|
1569 |
+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
|
1570 |
+ mva += PAGE_SIZE;
|
1571 |
+ pa += PAGE_SIZE;
|
1572 |
+ }
|
1573 |
+
|
1574 |
+ return (void *)((unsigned int)va + off);
|
1575 |
+}
|
1576 |
+
|
1577 |
+/*
|
1578 |
+ * Tablewalk routine used for testing.
|
1579 |
+ * Returns PTP/PTE.
|
1580 |
+ */
|
1581 |
+unsigned int
|
1582 |
+proc_tablewalk(int ctx, unsigned int va)
|
1583 |
+{
|
1584 |
+ unsigned int pa1;
|
1585 |
+
|
1586 |
+ __asm__ __volatile__ ("lda [%1] %2, %0" :
|
1587 |
+ "=r" (pa1) :
|
1588 |
+ "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
|
1589 |
+ /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
|
1590 |
+ pa1 <<= 4;
|
1591 |
+ pa1 = ld_bypass(pa1 + (ctx << 2));
|
1592 |
+ if ((pa1 & 0x03) == 0) goto invalid;
|
1593 |
+ return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
|
1594 |
+
|
1595 |
+invalid:
|
1596 |
+ printk(" invalid %x\n", pa1);
|
1597 |
+ return 0;
|
1598 |
+}
|
1599 |
+
|
1600 |
+/*
|
1601 |
+ * Walk the tables in memory, starting at physical address pa.
|
1602 |
+ */
|
1603 |
+unsigned int
|
1604 |
+mem_tablewalk(unsigned int pa, unsigned int va)
|
1605 |
+{
|
1606 |
+ unsigned int pa1;
|
1607 |
+
|
1608 |
+ printk("pa %x va %x", pa, va);
|
1609 |
+ pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
|
1610 |
+ if ((pa1 & 0x03) == 0) goto invalid;
|
1611 |
+ printk(" l1 %x", pa1);
|
1612 |
+ pa1 <<= 4; pa1 &= 0xFFFFFF00;
|
1613 |
+ pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
|
1614 |
+ if ((pa1 & 0x03) == 0) goto invalid;
|
1615 |
+ printk(" l2 %x", pa1);
|
1616 |
+ pa1 <<= 4; pa1 &= 0xFFFFFF00;
|
1617 |
+ pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
|
1618 |
+ if ((pa1 & 0x03) == 0) goto invalid;
|
1619 |
+ printk(" l3 %x", pa1);
|
1620 |
+ printk(" off %x\n", va&0x00000FFF);
|
1621 |
+ return pa1;
|
1622 |
+invalid:
|
1623 |
+ printk(" invalid %x\n", pa1);
|
1624 |
+ return 0;
|
1625 |
+}
|
1626 |
+
|
1627 |
+/*
|
1628 |
+ * Make CPU page tables.
|
1629 |
+ * Returns pointer to context table.
|
1630 |
+ * Here we ignore memory allocation errors which "should not happen"
|
1631 |
+ * because we cannot print anything anyways if memory initialization fails.
|
1632 |
+ */
|
1633 |
+void makepages(struct phym *t, unsigned int highbase)
|
1634 |
+{
|
1635 |
+ unsigned int *ctp, *l1, pte;
|
1636 |
+ int i;
|
1637 |
+ unsigned int pa, va;
|
1638 |
+
|
1639 |
+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
|
1640 |
+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
|
1641 |
+
|
1642 |
+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
|
1643 |
+ for (i = 0; i < NCTX_SWIFT; i++) {
|
1644 |
+ ctp[i] = pte;
|
1645 |
+ }
|
1646 |
+
|
1647 |
+ pa = PROLBASE;
|
1648 |
+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
|
1649 |
+ map_page(l1, va, pa, 0, highbase);
|
1650 |
+ pa += PAGE_SIZE;
|
1651 |
+ }
|
1652 |
+ pa = highbase + PROLDATA - PROLBASE;
|
1653 |
+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
|
1654 |
+ map_page(l1, va, pa, 0, highbase);
|
1655 |
+ pa += PAGE_SIZE;
|
1656 |
+ }
|
1657 |
+
|
1658 |
+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
|
1659 |
+ pa = 0;
|
1660 |
+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
|
1661 |
+ map_page(l1, va, pa, 0, highbase);
|
1662 |
+ pa += PAGE_SIZE;
|
1663 |
+ }
|
1664 |
+
|
1665 |
+ t->pctp = ctp;
|
1666 |
+ t->pl1 = l1;
|
1667 |
+ t->pbas = highbase;
|
1668 |
+}
|
1669 |
+
|
1670 |
+/*
|
1671 |
+ * Create a memory mapping from va to epa in page table pgd.
|
1672 |
+ * highbase is used for v2p translation.
|
1673 |
+ */
|
1674 |
+int
|
1675 |
+map_page(unsigned int *pgd, unsigned int va,
|
1676 |
+ unsigned int epa, int type, unsigned int highbase)
|
1677 |
+{
|
1678 |
+ unsigned int pte;
|
1679 |
+ unsigned int *p;
|
1680 |
+ unsigned int pa;
|
1681 |
+
|
1682 |
+ pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
|
1683 |
+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
|
1684 |
+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
|
1685 |
+ SRMMU_PTRS_PER_PMD*sizeof(int));
|
1686 |
+ if (p == 0) goto drop;
|
1687 |
+ pte = SRMMU_ET_PTD |
|
1688 |
+ (((unsigned int)p - PROLBASE + highbase) >> 4);
|
1689 |
+ pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
|
1690 |
+ /* barrier() */
|
1691 |
+ }
|
1692 |
+
|
1693 |
+ pa = ((pte & 0xFFFFFFF0) << 4);
|
1694 |
+ pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
|
1695 |
+ pte = ld_bypass(pa);
|
1696 |
+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
|
1697 |
+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
|
1698 |
+ SRMMU_PTRS_PER_PTE*sizeof(int));
|
1699 |
+ if (p == 0) goto drop;
|
1700 |
+ pte = SRMMU_ET_PTD |
|
1701 |
+ (((unsigned int)p - PROLBASE + highbase) >> 4);
|
1702 |
+ st_bypass(pa, pte);
|
1703 |
+ }
|
1704 |
+
|
1705 |
+ pa = ((pte & 0xFFFFFFF0) << 4);
|
1706 |
+ pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
|
1707 |
+
|
1708 |
+ pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
|
1709 |
+ if (type) { /* I/O */
|
1710 |
+ pte |= SRMMU_REF;
|
1711 |
+ /* SRMMU cannot make Supervisor-only, but not exectutable */
|
1712 |
+ pte |= SRMMU_PRIV;
|
1713 |
+ } else { /* memory */
|
1714 |
+ pte |= SRMMU_REF|SRMMU_CACHE;
|
1715 |
+ pte |= SRMMU_PRIV; /* Supervisor only access */
|
1716 |
+ }
|
1717 |
+ st_bypass(pa, pte);
|
1718 |
+ return 0;
|
1719 |
+
|
1720 |
+drop:
|
1721 |
+ return -1;
|
1722 |
+}
|
1723 |
+
|
1724 |
+/*
|
1725 |
+ * Switch page tables.
|
1726 |
+ */
|
1727 |
+void
|
1728 |
+init_mmu_swift(unsigned int ctp_phy)
|
1729 |
+{
|
1730 |
+ unsigned int addr;
|
1731 |
+
|
1732 |
+ /*
|
1733 |
+ * Flush cache
|
1734 |
+ */
|
1735 |
+ for (addr = 0; addr < 0x2000; addr += 0x10) {
|
1736 |
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
1737 |
+ "r" (addr), "i" (ASI_M_DATAC_TAG));
|
1738 |
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
1739 |
+ "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
|
1740 |
+ }
|
1741 |
+
|
1742 |
+ /*
|
1743 |
+ * Switch ctx table
|
1744 |
+ */
|
1745 |
+ ctp_phy >>= 4;
|
1746 |
+ /* printk("done flushing, switching to %x\n", ctp_phy); */
|
1747 |
+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
|
1748 |
+ "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
|
1749 |
+
|
1750 |
+ /*
|
1751 |
+ * Flush old page table references
|
1752 |
+ */
|
1753 |
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
1754 |
+ "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
|
1755 |
+}
|
1756 |
+
|
1757 |
+/*
|
1758 |
+ * add_timer, del_timer
|
1759 |
+ * This should go into sched.c, but we have it split for different archs.
|
1760 |
+ */
|
1761 |
+struct timer_list_head {
|
1762 |
+ struct timer_list *head, *tail;
|
1763 |
+};
|
1764 |
+
|
1765 |
+static struct timer_list_head timers; /* Anonymous heap of timers */
|
1766 |
+
|
1767 |
+void add_timer(struct timer_list *timer) {
|
1768 |
+ struct timer_list *p;
|
1769 |
+ if (timer->prev != NULL || timer->next != NULL) {
|
1770 |
+ printk("bug: kernel timer added twice at 0x%x.\n",
|
1771 |
+ __builtin_return_address(0));
|
1772 |
+ return;
|
1773 |
+ }
|
1774 |
+ if ((p = timers.tail) != NULL) {
|
1775 |
+ timer->prev = p;
|
1776 |
+ p->next = timer;
|
1777 |
+ timers.tail = timer;
|
1778 |
+ } else {
|
1779 |
+ timers.head = timer;
|
1780 |
+ timers.tail = timer;
|
1781 |
+ }
|
1782 |
+ return;
|
1783 |
+}
|
1784 |
+
|
1785 |
+int del_timer(struct timer_list *timer) {
|
1786 |
+ struct timer_list *p;
|
1787 |
+ int ret;
|
1788 |
+
|
1789 |
+ if (timers.head == timer) timers.head = timer->next;
|
1790 |
+ if (timers.tail == timer) timers.tail = timer->prev;
|
1791 |
+ if ((p = timer->prev) != NULL) p->next = timer->next;
|
1792 |
+ if ((p = timer->next) != NULL) p->prev = timer->prev;
|
1793 |
+ ret = timer->next != 0 || timer->prev != 0;
|
1794 |
+ timer->next = NULL;
|
1795 |
+ timer->prev = NULL;
|
1796 |
+ return ret;
|
1797 |
+}
|
1798 |
+
|
1799 |
+void run_timers() {
|
1800 |
+ struct timer_list *p;
|
1801 |
+
|
1802 |
+ p = timers.head;
|
1803 |
+ while (p != NULL) {
|
1804 |
+ if (p->expires < jiffies) {
|
1805 |
+ del_timer(p); /* XXX make nonstatic member */
|
1806 |
+ (*p->function)(p->data);
|
1807 |
+ p = timers.head;
|
1808 |
+ } else {
|
1809 |
+ p = p->next;
|
1810 |
+ }
|
1811 |
+ }
|
1812 |
+}
|
1813 |
+
|
1814 |
+/*
|
1815 |
+ * Allocate memory. This is reusable.
|
1816 |
+ */
|
1817 |
+void mem_init(struct mem *t, char *begin, char *limit)
|
1818 |
+{
|
1819 |
+ t->start = begin;
|
1820 |
+ t->uplim = limit;
|
1821 |
+ t->curp = begin;
|
1822 |
+}
|
1823 |
+
|
1824 |
+void mem_fini(struct mem *t)
|
1825 |
+{
|
1826 |
+ t->curp = 0;
|
1827 |
+}
|
1828 |
+
|
1829 |
+void *mem_alloc(struct mem *t, int size, int align)
|
1830 |
+{
|
1831 |
+ char *p;
|
1832 |
+
|
1833 |
+ p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
|
1834 |
+ if (p >= t->uplim || p + size > t->uplim) return 0;
|
1835 |
+ t->curp = p + size;
|
1836 |
+ return p;
|
1837 |
+}
|
1838 |
+
|
1839 |
+void *mem_zalloc(struct mem *t, int size, int align)
|
1840 |
+{
|
1841 |
+ char *p;
|
1842 |
+
|
1843 |
+ if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
|
1844 |
+ return p;
|
1845 |
+}
|
1846 |
+
|
1847 |
+/*
|
1848 |
+ * Library functions
|
1849 |
+ */
|
1850 |
+void bzero(void *s, int len) {
|
1851 |
+ while (len--) *((char *)s)++ = 0;
|
1852 |
+}
|
1853 |
+
|
1854 |
+void bcopy(const void *f, void *t, int len) {
|
1855 |
+ while (len--) *((char *)t)++ = *((char *)f)++;
|
1856 |
+}
|
1857 |
+
|
1858 |
+/* Comparison is 7-bit */
|
1859 |
+int bcmp(const void *s1, const void *s2, int len)
|
1860 |
+{
|
1861 |
+ int i;
|
1862 |
+ char ch;
|
1863 |
+
|
1864 |
+ while (len--) {
|
1865 |
+ ch = *((char *)s1)++;
|
1866 |
+ if ((i = ch - *((char *)s2)++) != 0)
|
1867 |
+ return i;
|
1868 |
+ if (ch == 0)
|
1869 |
+ return 0;
|
1870 |
+ }
|
1871 |
+ return 0;
|
1872 |
+}
|
1873 |
+
|
1874 |
+int strlen(const char *s) {
|
1875 |
+ const char *p;
|
1876 |
+ for (p = s; *p != 0; p++) { }
|
1877 |
+ return p - s;
|
1878 |
+}
|
1879 |
+
|
1880 |
+extern void *printk_fn;
|
1881 |
+
|
1882 |
+void printk(char *fmt, ...)
|
1883 |
+{
|
1884 |
+ struct prf_fp {
|
1885 |
+ void *xfp;
|
1886 |
+ void (*write)(void *, char *, int);
|
1887 |
+ } prfa;
|
1888 |
+ extern void prf(struct prf_fp *, char *fmt, va_list adx);
|
1889 |
+ va_list x1;
|
1890 |
+
|
1891 |
+ va_start(x1, fmt);
|
1892 |
+ prfa.xfp = &dp0;
|
1893 |
+ prfa.write = printk_fn;
|
1894 |
+ prf(&prfa, fmt, x1);
|
1895 |
+ va_end(x1);
|
1896 |
+}
|
1897 |
+
|
1898 |
+void fatal()
|
1899 |
+{
|
1900 |
+ printk("fatal.");
|
1901 |
+loop: goto loop;
|
1902 |
+}
|
1903 |
+
|
1904 |
+/*
|
1905 |
+ * Get the highest bit number from the mask.
|
1906 |
+ */
|
1907 |
+int highc(int mask, int size)
|
1908 |
+{
|
1909 |
+ int m1;
|
1910 |
+
|
1911 |
+ m1 = 1 << size;
|
1912 |
+ while (size != 0) {
|
1913 |
+ size--;
|
1914 |
+ m1 >>= 1;
|
1915 |
+ if (m1 & mask) break;
|
1916 |
+ }
|
1917 |
+ return size;
|
1918 |
+}
|
1919 |
+
|
1920 |
+/*
|
1921 |
+ */
|
1922 |
+unsigned int ld_bp_swap(unsigned int ptr) {
|
1923 |
+ unsigned int n;
|
1924 |
+ n = ld_bypass(ptr);
|
1925 |
+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
|
1926 |
+ return n;
|
1927 |
+}
|
1928 |
+
|
1929 |
+void st_bp_swap(unsigned int ptr, unsigned int n) {
|
1930 |
+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
|
1931 |
+ st_bypass(ptr, n);
|
1932 |
+};
|
1933 |
diff -ruN proll_18.orig/src/arp.c proll-patch7/src/arp.c
|
1934 |
--- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
|
1935 |
+++ proll-patch7/src/arp.c 2004-11-13 15:50:49.000000000 +0000
|
1936 |
@@ -45,7 +45,7 @@
|
1937 |
#endif
|
1938 |
static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ |
1939 |
static int next_arp; /* next table entry */ |
1940 |
-static t_ipaddr def_gw = IP_ANY; /* default routing */
|
1941 |
+static t_ipaddr def_gw; /* default routing */
|
1942 |
|
1943 |
|
1944 |
|
1945 |
@@ -144,7 +144,7 @@
|
1946 |
* |
1947 |
* Resolve IP address and return pointer to hardware address.
|
1948 |
*/ |
1949 |
-unsigned char *ip_resolve(ip)
|
1950 |
+const unsigned char *ip_resolve(ip)
|
1951 |
t_ipaddr ip; |
1952 |
{ |
1953 |
int i;
|
1954 |
@@ -230,14 +230,11 @@
|
1955 |
*/ |
1956 |
int init_arp()
|
1957 |
{ |
1958 |
- /* Set name of module for error messages */
|
1959 |
- net_module_name = "arp";
|
1960 |
-
|
1961 |
#ifndef NOARP
|
1962 |
/* Register ARP packet type and set send buffer pointer */
|
1963 |
if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL) |
1964 |
return(FALSE);
|
1965 |
#endif
|
1966 |
-
|
1967 |
+ def_gw = IP_ANY;
|
1968 |
return(TRUE);
|
1969 |
} |
1970 |
diff -ruN proll_18.orig/src/arp.h proll-patch7/src/arp.h
|
1971 |
--- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
|
1972 |
+++ proll-patch7/src/arp.h 2004-11-13 15:50:49.000000000 +0000
|
1973 |
@@ -104,7 +104,7 @@
|
1974 |
extern int init_arp __P((void)); |
1975 |
|
1976 |
/* Resolve IP address and return pointer to hardware address */
|
1977 |
-extern unsigned char *ip_resolve __P((t_ipaddr ip));
|
1978 |
+extern const unsigned char *ip_resolve __P((t_ipaddr ip));
|
1979 |
|
1980 |
/* Add a new antry to the ARP cache */
|
1981 |
extern void addcache __P((unsigned char *ha, t_ipaddr ip)); |
1982 |
diff -ruN proll_18.orig/src/hconsole.c proll-patch7/src/hconsole.c
|
1983 |
--- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
|
1984 |
+++ proll-patch7/src/hconsole.c 2005-03-02 17:03:09.000000000 +0000
|
1985 |
@@ -29,6 +29,10 @@
|
1986 |
struct raster r_master; /* For a case of resize, whole fb */ |
1987 |
struct raster r_0; /* malloc() erzatz */ |
1988 |
|
1989 |
+#ifdef QEMU
|
1990 |
+extern unsigned int q_height, q_width;
|
1991 |
+#endif
|
1992 |
+
|
1993 |
int hcon_init(struct hconsole *t, unsigned int a0) |
1994 |
{ |
1995 |
struct raster *q, *r;
|
1996 |
@@ -42,7 +46,11 @@
|
1997 |
* No probing sequence or argument passing, hardcode everything. XXX |
1998 |
*/ |
1999 |
raster8_cons_a(q, 768, 1024, (char *)a0); |
2000 |
+#ifndef QEMU
|
2001 |
raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); |
2002 |
+#else
|
2003 |
+ raster_cons_2(r, q, 0, 0, q_height, q_width);
|
2004 |
+#endif
|
2005 |
t->r_ = r; |
2006 |
t->r0_ = q; |
2007 |
t->f_ = &f_master; |
2008 |
diff -ruN proll_18.orig/src/lat7_2.bm proll-patch7/src/lat7_2.bm
|
2009 |
--- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
|
2010 |
+++ proll-patch7/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
|
2011 |
@@ -1,6 +1,6 @@
|
2012 |
#define lat7_2_width 128 |
2013 |
#define lat7_2_height 88 |
2014 |
-static unsigned char lat7_2_bits[] = {
|
2015 |
+static unsigned const char lat7_2_bits[] = {
|
2016 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
2017 |
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, |
2018 |
0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, |
2019 |
diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch7/src/lat7_2_swapped.bm
|
2020 |
--- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
|
2021 |
+++ proll-patch7/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
|
2022 |
@@ -0,0 +1,121 @@
|
2023 |
+#define lat7_2_width 128
|
2024 |
+#define lat7_2_height 88
|
2025 |
+static unsigned const char lat7_2_bits[] = {
|
2026 |
+ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2027 |
+ 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
|
2028 |
+ 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
|
2029 |
+ 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
|
2030 |
+ 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
|
2031 |
+ 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
|
2032 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
|
2033 |
+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
|
2034 |
+ 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
|
2035 |
+ 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
2036 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
|
2037 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
|
2038 |
+ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
|
2039 |
+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
|
2040 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
2041 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2042 |
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2043 |
+ 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2044 |
+ 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
|
2045 |
+ 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
|
2046 |
+ 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
|
2047 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
|
2048 |
+ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
|
2049 |
+ 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
|
2050 |
+ 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
|
2051 |
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
|
2052 |
+ 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
|
2053 |
+ 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2054 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
|
2055 |
+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2056 |
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
|
2057 |
+ 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2058 |
+ 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
|
2059 |
+ 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2060 |
+ 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
|
2061 |
+ 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2062 |
+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
|
2063 |
+ 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
|
2064 |
+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
|
2065 |
+ 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
|
2066 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2067 |
+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
2068 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
|
2069 |
+ 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
|
2070 |
+ 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
2071 |
+ 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
|
2072 |
+ 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2073 |
+ 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
|
2074 |
+ 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
|
2075 |
+ 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
|
2076 |
+ 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
|
2077 |
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
|
2078 |
+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
|
2079 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
|
2080 |
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
|
2081 |
+ 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
|
2082 |
+ 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
|
2083 |
+ 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2084 |
+ 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
|
2085 |
+ 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
|
2086 |
+ 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
|
2087 |
+ 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
|
2088 |
+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
|
2089 |
+ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
|
2090 |
+ 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
|
2091 |
+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
|
2092 |
+ 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2093 |
+ 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
|
2094 |
+ 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
|
2095 |
+ 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
|
2096 |
+ 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
|
2097 |
+ 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
|
2098 |
+ 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
|
2099 |
+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
|
2100 |
+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
|
2101 |
+ 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
|
2102 |
+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
|
2103 |
+ 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
2104 |
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
|
2105 |
+ 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
|
2106 |
+ 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
|
2107 |
+ 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
|
2108 |
+ 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
|
2109 |
+ 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
|
2110 |
+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
|
2111 |
+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
|
2112 |
+ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2113 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
|
2114 |
+ 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2115 |
+ 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
|
2116 |
+ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2117 |
+ 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
|
2118 |
+ 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2119 |
+ 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
|
2120 |
+ 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
|
2121 |
+ 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
|
2122 |
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
|
2123 |
+ 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
|
2124 |
+ 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
|
2125 |
+ 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
|
2126 |
+ 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2127 |
+ 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2128 |
+ 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
|
2129 |
+ 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
|
2130 |
+ 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
|
2131 |
+ 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
|
2132 |
+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
|
2133 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
|
2134 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
|
2135 |
+ 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
|
2136 |
+ 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2137 |
+ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
|
2138 |
+ 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
|
2139 |
+ 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
|
2140 |
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
|
2141 |
+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
|
2142 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
|
2143 |
+ 0x00, 0x00, 0x00, 0x00};
|
2144 |
diff -ruN proll_18.orig/src/le.c proll-patch7/src/le.c
|
2145 |
--- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
|
2146 |
+++ proll-patch7/src/le.c 2004-11-13 15:50:49.000000000 +0000
|
2147 |
@@ -185,8 +185,6 @@
|
2148 |
unsigned short rap; /* register address port */ |
2149 |
}; |
2150 |
|
2151 |
-int sparc_lance_debug = 2;
|
2152 |
-
|
2153 |
/* The Lance uses 24 bit addresses */
|
2154 |
/* On the Sun4c the DVMA will provide the remaining bytes for us */
|
2155 |
/* On the Sun4m we have to instruct the ledma to provide them */
|
2156 |
diff -ruN proll_18.orig/src/netinit.c proll-patch7/src/netinit.c
|
2157 |
--- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
|
2158 |
+++ proll-patch7/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
|
2159 |
@@ -49,13 +49,20 @@
|
2160 |
unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ |
2161 |
t_ipaddr myipaddr; /* my own IP address */
|
2162 |
t_ipaddr mynetmask; /* my own netmask */
|
2163 |
- char *net_module_name; /* name of init module */
|
2164 |
t_ipaddr servaddr; /* IP of RARP&TFTP server */
|
2165 |
|
2166 |
/* Broadcast hardware address */
|
2167 |
-unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
2168 |
+const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
2169 |
|
2170 |
|
2171 |
+unsigned int seed;
|
2172 |
+
|
2173 |
+/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
|
2174 |
+short int random()
|
2175 |
+{
|
2176 |
+ seed = (seed + 23968)*0x015A4E35 >> 1;
|
2177 |
+ return seed & 0x7FFF;
|
2178 |
+}
|
2179 |
|
2180 |
/*
|
2181 |
************************************************************************** |
2182 |
@@ -104,10 +111,17 @@
|
2183 |
*/ |
2184 |
void init_net()
|
2185 |
{ |
2186 |
+ /* Avoid data segment allocations */
|
2187 |
+ seed = 151;
|
2188 |
+
|
2189 |
/* Initialize the different network layer modules */
|
2190 |
init_packet(); |
2191 |
- if (!init_arp() || !init_udp()) {
|
2192 |
- printf("\nERROR: init_%s\n", net_module_name);
|
2193 |
+ if (!init_arp()) {
|
2194 |
+ printf("\nERROR: init_arp\n");
|
2195 |
+ fatal();
|
2196 |
+ }
|
2197 |
+ if (!init_udp()) {
|
2198 |
+ printf("\nERROR: init_udp\n");
|
2199 |
fatal(); |
2200 |
} |
2201 |
} |
2202 |
diff -ruN proll_18.orig/src/netpriv.h proll-patch7/src/netpriv.h
|
2203 |
--- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
|
2204 |
+++ proll-patch7/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000
|
2205 |
@@ -130,10 +130,9 @@
|
2206 |
* |
2207 |
*/ |
2208 |
extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */ |
2209 |
-extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
|
2210 |
+extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
|
2211 |
extern t_ipaddr myipaddr; /* my own IP address */ |
2212 |
extern t_ipaddr mynetmask; /* netmask for my network */ |
2213 |
-extern char *net_module_name; /* initialized module's name */
|
2214 |
extern t_ipaddr servaddr; /* server IP address */ |
2215 |
|
2216 |
|
2217 |
@@ -150,7 +149,7 @@
|
2218 |
extern unsigned char *reg_type __P((int typeval, int (* receive)())); |
2219 |
|
2220 |
/* Write a packet to the network */
|
2221 |
-extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
|
2222 |
+extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
|
2223 |
|
2224 |
/* Empty read buffer */
|
2225 |
extern void empty_buf __P((void)); |
2226 |
diff -ruN proll_18.orig/src/openprom.h proll-patch7/src/openprom.h
|
2227 |
--- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
|
2228 |
+++ proll-patch7/src/openprom.h 2004-11-13 15:50:49.000000000 +0000
|
2229 |
@@ -54,20 +54,20 @@
|
2230 |
}; |
2231 |
|
2232 |
struct linux_mem_v0 {
|
2233 |
- struct linux_mlist_v0 **v0_totphys;
|
2234 |
- struct linux_mlist_v0 **v0_prommap;
|
2235 |
- struct linux_mlist_v0 **v0_available; /* What we can use */
|
2236 |
+ struct linux_mlist_v0 * const *v0_totphys;
|
2237 |
+ struct linux_mlist_v0 * const *v0_prommap;
|
2238 |
+ struct linux_mlist_v0 * const *v0_available; /* What we can use */
|
2239 |
}; |
2240 |
|
2241 |
/* Arguments sent to the kernel from the boot prompt. */
|
2242 |
struct linux_arguments_v0 {
|
2243 |
- char *argv[8];
|
2244 |
+ const char *argv[8];
|
2245 |
char args[100]; |
2246 |
char boot_dev[2]; |
2247 |
int boot_dev_ctrl;
|
2248 |
int boot_dev_unit;
|
2249 |
int dev_partition;
|
2250 |
- char *kernel_file_name;
|
2251 |
+ const char *kernel_file_name;
|
2252 |
void *aieee1; /* XXX */ |
2253 |
}; |
2254 |
|
2255 |
@@ -91,13 +91,13 @@
|
2256 |
struct linux_mem_v0 pv_v0mem;
|
2257 |
|
2258 |
/* Node operations. */
|
2259 |
- struct linux_nodeops *pv_nodeops;
|
2260 |
+ const struct linux_nodeops *pv_nodeops;
|
2261 |
|
2262 |
char **pv_bootstr;
|
2263 |
struct linux_dev_v0_funcs pv_v0devops;
|
2264 |
|
2265 |
- char *pv_stdin;
|
2266 |
- char *pv_stdout;
|
2267 |
+ const char *pv_stdin;
|
2268 |
+ const char *pv_stdout;
|
2269 |
#define PROMDEV_KBD 0 /* input from keyboard */ |
2270 |
#define PROMDEV_SCREEN 0 /* output to screen */ |
2271 |
#define PROMDEV_TTYA 1 /* in/out to ttya */ |
2272 |
@@ -127,7 +127,7 @@
|
2273 |
void (*v2_eval)(char *str); |
2274 |
} pv_fortheval; |
2275 |
|
2276 |
- struct linux_arguments_v0 **pv_v0bootargs;
|
2277 |
+ const struct linux_arguments_v0 * const *pv_v0bootargs;
|
2278 |
|
2279 |
/* Get ether address. */
|
2280 |
unsigned int (*pv_enaddr)(int d, char *enaddr); |
2281 |
@@ -175,7 +175,7 @@
|
2282 |
int (*no_proplen)(int node, char *name); |
2283 |
int (*no_getprop)(int node, char *name, char *val); |
2284 |
int (*no_setprop)(int node, char *name, char *val, int len); |
2285 |
- char * (*no_nextprop)(int node, char *name);
|
2286 |
+ const char * (*no_nextprop)(int node, char *name);
|
2287 |
}; |
2288 |
|
2289 |
/* More fun PROM structures for device probing. */
|
2290 |
diff -ruN proll_18.orig/src/packet.c proll-patch7/src/packet.c
|
2291 |
--- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
|
2292 |
+++ proll-patch7/src/packet.c 2004-11-13 15:50:49.000000000 +0000
|
2293 |
@@ -41,7 +41,7 @@
|
2294 |
int aligner;
|
2295 |
} wbuf; |
2296 |
static struct sk_buff *rskb; |
2297 |
-static int nqskb = 0;
|
2298 |
+static int nqskb;
|
2299 |
|
2300 |
|
2301 |
void init_packet()
|
2302 |
@@ -62,6 +62,8 @@
|
2303 |
for (i = 0; i < MAXSKBS; i++) { |
2304 |
skev[i].skb.allocn = i; |
2305 |
} |
2306 |
+
|
2307 |
+ nqskb = 0;
|
2308 |
} |
2309 |
|
2310 |
unsigned char *reg_type(int ptype, int (*func)()) |
2311 |
@@ -81,7 +83,7 @@
|
2312 |
return wbuf.s;
|
2313 |
} |
2314 |
|
2315 |
-int write_packet(int leng, int type, unsigned char *dst)
|
2316 |
+int write_packet(int leng, int type, const unsigned char *dst)
|
2317 |
{ |
2318 |
struct sk_buff *skb;
|
2319 |
unsigned char *s; |
2320 |
diff -ruN proll_18.orig/src/printf.c proll-patch7/src/printf.c
|
2321 |
--- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
|
2322 |
+++ proll-patch7/src/printf.c 2004-11-13 15:50:49.000000000 +0000
|
2323 |
@@ -19,7 +19,7 @@
|
2324 |
static void printn(struct prf_fp *, unsigned long, unsigned int); |
2325 |
static void putchar(char, struct prf_fp *); |
2326 |
|
2327 |
-static char hextab[] = "0123456789ABCDEF";
|
2328 |
+static const char hextab[] = "0123456789ABCDEF";
|
2329 |
|
2330 |
/*
|
2331 |
* Scaled down version of C Library printf. |
2332 |
@@ -41,7 +41,7 @@
|
2333 |
void
|
2334 |
prf(struct prf_fp *filog, char *fmt, va_list adx) |
2335 |
{ |
2336 |
- register c;
|
2337 |
+ register int c;
|
2338 |
char *s;
|
2339 |
|
2340 |
for(;;) {
|
2341 |
@@ -60,7 +60,7 @@
|
2342 |
putchar(va_arg(adx,unsigned), filog);
|
2343 |
} else if(c == 's') { |
2344 |
s = va_arg(adx,char*);
|
2345 |
- while(c = *s++)
|
2346 |
+ while((c = *s++))
|
2347 |
putchar(c,filog); |
2348 |
} else if (c == 'l' || c == 'O') { |
2349 |
printn(filog, (long)va_arg(adx,long), c=='l'?10:8); |
2350 |
diff -ruN proll_18.orig/src/rconsole.c proll-patch7/src/rconsole.c
|
2351 |
--- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
|
2352 |
+++ proll-patch7/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000
|
2353 |
@@ -28,12 +28,18 @@
|
2354 |
* move to California. Only plain lat7 survived. |
2355 |
* I recreated lat7-1 changes in lat7-2. --zaitcev |
2356 |
*/ |
2357 |
+#ifdef ORIG
|
2358 |
#include "lat7_2.bm" /* lat7_1.bm */ |
2359 |
+#else
|
2360 |
+#include "lat7_2_swapped.bm" /* lat7_1.bm */
|
2361 |
+#endif
|
2362 |
#define LAT7_NCHARS 128 |
2363 |
#define LAT7_HEIGHT 11 |
2364 |
#define LAT7_WIDTH 8 |
2365 |
|
2366 |
+#ifdef ORIG
|
2367 |
static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
|
2368 |
+#endif
|
2369 |
|
2370 |
#if 1 |
2371 |
/*
|
2372 |
@@ -94,6 +100,7 @@
|
2373 |
|
2374 |
#endif
|
2375 |
|
2376 |
+#ifdef ORIG
|
2377 |
static inline int swapbits(int w0) |
2378 |
{ |
2379 |
int w1 = 0; |
2380 |
@@ -105,13 +112,16 @@
|
2381 |
} |
2382 |
return w1;
|
2383 |
} |
2384 |
+#endif
|
2385 |
|
2386 |
void font_cons_7(struct rfont *p) |
2387 |
{ |
2388 |
+#ifdef ORIG
|
2389 |
int x;
|
2390 |
int col = 0; |
2391 |
int row = 0; |
2392 |
int erow = 0; |
2393 |
+
|
2394 |
for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) { |
2395 |
lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
|
2396 |
swapbits(lat7_2_bits[x]) & 0xFF;
|
2397 |
@@ -124,6 +134,9 @@
|
2398 |
} |
2399 |
} |
2400 |
p->body_ = lat7_body; |
2401 |
+#else
|
2402 |
+ p->body_ = lat7_2_bits;
|
2403 |
+#endif
|
2404 |
p->nchars_ = LAT7_NCHARS; |
2405 |
p->width_ = LAT7_WIDTH; |
2406 |
p->height_ = LAT7_HEIGHT; |
2407 |
diff -ruN proll_18.orig/src/rconsole.h proll-patch7/src/rconsole.h
|
2408 |
--- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
|
2409 |
+++ proll-patch7/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
|
2410 |
@@ -13,10 +13,10 @@
|
2411 |
*/ |
2412 |
|
2413 |
#define RF_MAXWIDTH 16 |
2414 |
-typedef unsigned short Rf_scan; /* __w16 to be used */
|
2415 |
+typedef unsigned char Rf_scan; /* __w16 to be used */
|
2416 |
|
2417 |
struct rfont {
|
2418 |
- Rf_scan *body_;
|
2419 |
+ const Rf_scan *body_;
|
2420 |
int nchars_; /* 128 for ASCII ... 65536 for Unicode */ |
2421 |
int width_; /* [Pixels]. Maximum size is 16. */ |
2422 |
int height_; /* [Pixels == scan lines]. */ |
2423 |
diff -ruN proll_18.orig/src/romlib.h proll-patch7/src/romlib.h
|
2424 |
--- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
|
2425 |
+++ proll-patch7/src/romlib.h 2004-11-13 15:50:49.000000000 +0000
|
2426 |
@@ -73,12 +73,12 @@
|
2427 |
#define memcpy(dst, src, len) bcopy(src, dst, len)
|
2428 |
#define memcmp(x1, x2, len) bcmp(x1, x2, len)
|
2429 |
#define memset(p, len, zero) bzero(p, len)
|
2430 |
-extern void bcopy(void *b1, void *b2, int length);
|
2431 |
-extern int bcmp(void *b1, void *b2, int length);
|
2432 |
+extern void bcopy(const void *b1, void *b2, int length);
|
2433 |
+extern int bcmp(const void *b1, const void *b2, int length);
|
2434 |
extern void bzero(void *b, int c); |
2435 |
/* gcc complains about "conflicting types for builtin function strlen". */
|
2436 |
#define strlen(s) ssize(s)
|
2437 |
-extern int ssize(char *s);
|
2438 |
+extern int ssize(const char *s);
|
2439 |
|
2440 |
|
2441 |
/*
|
2442 |
diff -ruN proll_18.orig/src/sched_4m.c proll-patch7/src/sched_4m.c
|
2443 |
--- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
|
2444 |
+++ proll-patch7/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000
|
2445 |
@@ -108,7 +108,7 @@
|
2446 |
static int set_bolt; /* Tick counter limit */ |
2447 |
static struct handsc hndv[16]; |
2448 |
|
2449 |
-static unsigned int intr_to_mask[16] = {
|
2450 |
+static unsigned const int intr_to_mask[16] = {
|
2451 |
0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, |
2452 |
0, 0, 0, 0, 0, 0, 0, 0, |
2453 |
}; |
2454 |
diff -ruN proll_18.orig/src/swap.c proll-patch7/src/swap.c
|
2455 |
--- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
|
2456 |
+++ proll-patch7/src/swap.c 2004-11-13 15:50:49.000000000 +0000
|
2457 |
@@ -0,0 +1,21 @@
|
2458 |
+// Convert the lat7 font so that no conversion is needed at runtime.
|
2459 |
+#define ORIG
|
2460 |
+#include "rconsole.c"
|
2461 |
+
|
2462 |
+#include <stdio.h>
|
2463 |
+
|
2464 |
+int main()
|
2465 |
+{
|
2466 |
+ struct rfont p;
|
2467 |
+ int i;
|
2468 |
+
|
2469 |
+ font_cons_7(&p);
|
2470 |
+
|
2471 |
+ printf(" ");
|
2472 |
+ for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
|
2473 |
+ printf("0x%02x, ", p.body_[i]);
|
2474 |
+ if ((i % 12) == 11)
|
2475 |
+ printf("\n ");
|
2476 |
+ }
|
2477 |
+ printf("\n");
|
2478 |
+}
|
2479 |
diff -ruN proll_18.orig/src/system.c proll-patch7/src/system.c
|
2480 |
--- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
|
2481 |
+++ proll-patch7/src/system.c 2004-11-13 15:50:49.000000000 +0000
|
2482 |
@@ -298,8 +298,8 @@
|
2483 |
} |
2484 |
|
2485 |
/* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
|
2486 |
- pa = PAGE_SIZE;
|
2487 |
- for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
|
2488 |
+ pa = 0;
|
2489 |
+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
|
2490 |
map_page(l1, va, pa, 0, highbase);
|
2491 |
pa += PAGE_SIZE; |
2492 |
} |
2493 |
@@ -518,12 +518,12 @@
|
2494 |
while (len--) *((char *)s)++ = 0; |
2495 |
} |
2496 |
|
2497 |
-void bcopy(void *f, void *t, int len) {
|
2498 |
+void bcopy(const void *f, void *t, int len) {
|
2499 |
while (len--) *((char *)t)++ = *((char *)f)++; |
2500 |
} |
2501 |
|
2502 |
/* Comparison is 7-bit */
|
2503 |
-int bcmp(void *s1, void *s2, int len)
|
2504 |
+int bcmp(const void *s1, const void *s2, int len)
|
2505 |
{ |
2506 |
int i;
|
2507 |
char ch;
|
2508 |
@@ -538,8 +538,8 @@
|
2509 |
return 0; |
2510 |
} |
2511 |
|
2512 |
-int strlen(char *s) {
|
2513 |
- char *p;
|
2514 |
+int strlen(const char *s) {
|
2515 |
+ const char *p;
|
2516 |
for (p = s; *p != 0; p++) { } |
2517 |
return p - s;
|
2518 |
} |
2519 |
@@ -560,14 +560,6 @@
|
2520 |
va_end(x1); |
2521 |
} |
2522 |
|
2523 |
-/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
|
2524 |
-short int random()
|
2525 |
-{
|
2526 |
- static unsigned int seed = 151;
|
2527 |
- seed = (seed + 23968)*0x015A4E35 >> 1;
|
2528 |
- return seed & 0x7FFF;
|
2529 |
-}
|
2530 |
-
|
2531 |
void fatal()
|
2532 |
{ |
2533 |
printk("fatal.");
|
2534 |
diff -ruN proll_18.orig/src/system.h proll-patch7/src/system.h
|
2535 |
--- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
|
2536 |
+++ proll-patch7/src/system.h 2004-11-13 15:50:49.000000000 +0000
|
2537 |
@@ -16,7 +16,7 @@
|
2538 |
#define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ |
2539 |
#define NCTX_SWIFT 0x100 |
2540 |
|
2541 |
-#define MAX_BANKS 3 /* Allocation for all machines */
|
2542 |
+#define MAX_BANKS 8 /* Allocation for all machines */
|
2543 |
|
2544 |
#ifndef __ASSEMBLY__
|
2545 |
struct bank {
|
2546 |
diff -ruN proll_18.orig/src/udp.c proll-patch7/src/udp.c
|
2547 |
--- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
|
2548 |
+++ proll-patch7/src/udp.c 2004-11-13 15:50:49.000000000 +0000
|
2549 |
@@ -81,7 +81,7 @@
|
2550 |
int source;
|
2551 |
int dest;
|
2552 |
{ |
2553 |
- register unsigned char *addr;
|
2554 |
+ const register unsigned char *addr;
|
2555 |
|
2556 |
/* Set global variables */
|
2557 |
usource = source; |
2558 |
@@ -299,9 +299,6 @@
|
2559 |
*/ |
2560 |
int init_udp()
|
2561 |
{ |
2562 |
- /* Set module name for error handling */
|
2563 |
- net_module_name = "udp";
|
2564 |
-
|
2565 |
/* Register IP packet type and set write buffer pointer */
|
2566 |
if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) |
2567 |
return(FALSE);
|
2568 |
diff -ruN proll_18.orig/src/vcons_zs.c proll-patch7/src/vcons_zs.c
|
2569 |
--- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000
|
2570 |
+++ proll-patch7/src/vcons_zs.c 2005-03-02 12:07:41.000000000 +0000
|
2571 |
@@ -0,0 +1,68 @@
|
2572 |
+/**
|
2573 |
+ ** Console over 'zs' (Zilog serial port)
|
2574 |
+ ** Copyright 1999 Pete Zaitcev
|
2575 |
+ ** This code is licensed under GNU General Public License.
|
2576 |
+ **/
|
2577 |
+
|
2578 |
+#include "vconsole.h"
|
2579 |
+#include <system.h>
|
2580 |
+
|
2581 |
+#define ZS_DATA 0x02
|
2582 |
+
|
2583 |
+int vcon_zs_init(struct vconterm *t, unsigned int a0)
|
2584 |
+{
|
2585 |
+
|
2586 |
+ t->impl = (void *) a0;
|
2587 |
+
|
2588 |
+ t->vc_x = 0; t->vc_y = 0;
|
2589 |
+ t->backp = 0; t->backc = 0;
|
2590 |
+
|
2591 |
+ stb_bypass(a0, 3); // reg 3
|
2592 |
+ stb_bypass(a0, 1); // enable rx
|
2593 |
+
|
2594 |
+ stb_bypass(a0, 5); // reg 5
|
2595 |
+ stb_bypass(a0, 8); // enable tx
|
2596 |
+
|
2597 |
+ return 0;
|
2598 |
+}
|
2599 |
+
|
2600 |
+int vcon_zs_putch(struct vconterm *t, char c)
|
2601 |
+{
|
2602 |
+ unsigned zs_ptr = (unsigned) t->impl;
|
2603 |
+
|
2604 |
+ //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
|
2605 |
+ stb_bypass(zs_ptr + ZS_DATA, c);
|
2606 |
+ return 0;
|
2607 |
+}
|
2608 |
+
|
2609 |
+int vcon_zs_write(struct vconterm *t, char *data, int leng)
|
2610 |
+{
|
2611 |
+ while (leng != 0) {
|
2612 |
+ leng--;
|
2613 |
+ vcon_zs_putch(t, *data++);
|
2614 |
+ }
|
2615 |
+ return leng;
|
2616 |
+}
|
2617 |
+
|
2618 |
+int vcon_zs_read(struct vconterm *t, char *data, int leng)
|
2619 |
+{
|
2620 |
+ unsigned zs_ptr = (unsigned) t->impl;
|
2621 |
+
|
2622 |
+ while ((ldb_bypass(zs_ptr) & 1) != 1) { }
|
2623 |
+ *data = ldb_bypass(zs_ptr + ZS_DATA);
|
2624 |
+ return 0;
|
2625 |
+}
|
2626 |
+
|
2627 |
+int vcon_zs_getch(struct vconterm *t)
|
2628 |
+{
|
2629 |
+ unsigned zs_ptr = (unsigned) t->impl;
|
2630 |
+
|
2631 |
+ while ((ldb_bypass(zs_ptr) & 1) != 1) { }
|
2632 |
+ return ldb_bypass(zs_ptr + ZS_DATA);
|
2633 |
+}
|
2634 |
+
|
2635 |
+void vcon_zs_fini(struct vconterm *t)
|
2636 |
+{
|
2637 |
+ /* violent crash in the end */
|
2638 |
+ ;
|
2639 |
+}
|
2640 |
diff -ruN proll_18.orig/src/vconsole.c proll-patch7/src/vconsole.c
|
2641 |
--- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000
|
2642 |
+++ proll-patch7/src/vconsole.c 2005-03-02 14:29:05.000000000 +0000
|
2643 |
@@ -13,6 +13,10 @@
|
2644 |
|
2645 |
struct hconsole hcons0;
|
2646 |
|
2647 |
+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
|
2648 |
+ EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
|
2649 |
+ ESpalette };
|
2650 |
+
|
2651 |
int vcon_init(struct vconterm *t, unsigned int a0) |
2652 |
{ |
2653 |
struct hconsole *hconp;
|
2654 |
@@ -25,11 +29,49 @@
|
2655 |
|
2656 |
t->vc_x = 0; t->vc_y = 0; |
2657 |
t->backp = 0; t->backc = 0; |
2658 |
+ t->vc_state = ESnormal;
|
2659 |
|
2660 |
hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_); |
2661 |
return 0; |
2662 |
} |
2663 |
|
2664 |
+/*
|
2665 |
+ * gotoxy() must verify all boundaries, because the arguments
|
2666 |
+ * might also be negative. If the given position is out of
|
2667 |
+ * bounds, the cursor is placed at the nearest margin.
|
2668 |
+ */
|
2669 |
+static void gotoxy(struct vconterm *vc, int new_x, int new_y)
|
2670 |
+{
|
2671 |
+ int max_x, max_y;
|
2672 |
+ struct hconsole *hconp = vc->impl;
|
2673 |
+
|
2674 |
+ max_x = hcon_qxdim(hconp);
|
2675 |
+ max_y = hcon_qydim(hconp);
|
2676 |
+
|
2677 |
+ if (new_x < 0)
|
2678 |
+ vc->vc_x = 0;
|
2679 |
+ else {
|
2680 |
+ if (new_x >= max_x)
|
2681 |
+ vc->vc_x = max_x - 1;
|
2682 |
+ else
|
2683 |
+ vc->vc_x = new_x;
|
2684 |
+ }
|
2685 |
+
|
2686 |
+ if (new_y < 0)
|
2687 |
+ vc->vc_y = 0;
|
2688 |
+ else if (new_y >= max_y)
|
2689 |
+ vc->vc_y = max_y - 1;
|
2690 |
+ else
|
2691 |
+ vc->vc_y = new_y;
|
2692 |
+
|
2693 |
+}
|
2694 |
+
|
2695 |
+/* for absolute user moves, when decom is set */
|
2696 |
+static void gotoxay(struct vconterm *t, int new_x, int new_y)
|
2697 |
+{
|
2698 |
+ gotoxy(t, new_x, new_y);
|
2699 |
+}
|
2700 |
+
|
2701 |
int vcon_write(struct vconterm *t, char *data, int leng) |
2702 |
{ |
2703 |
int l = leng;
|
2704 |
@@ -40,29 +82,84 @@
|
2705 |
if (l <= 0) break; |
2706 |
c = *data++; --l; |
2707 |
|
2708 |
- switch (c) {
|
2709 |
- case 0x07: /* Bell */
|
2710 |
- vcon_i_backflush(t);
|
2711 |
- break;
|
2712 |
- case 0x0A: /* Linefeed */
|
2713 |
- vcon_i_backflush(t);
|
2714 |
- vcon_i_cursfeed(t);
|
2715 |
+ switch(t->vc_state) {
|
2716 |
+ case ESesc:
|
2717 |
+ t->vc_state = ESnormal;
|
2718 |
+ switch (c) {
|
2719 |
+ case '[':
|
2720 |
+ t->vc_state = ESsquare;
|
2721 |
+ break;
|
2722 |
+ case 'M':
|
2723 |
+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
|
2724 |
+ break;
|
2725 |
+ }
|
2726 |
break;
|
2727 |
- case 0x0D: /* Return */
|
2728 |
- vcon_i_backflush(t);
|
2729 |
- t->vc_x = 0;
|
2730 |
+ case ESsquare:
|
2731 |
+ for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
|
2732 |
+ t->vc_par[t->vc_npar] = 0;
|
2733 |
+ t->vc_npar = 0;
|
2734 |
+ t->vc_state = ESgetpars;
|
2735 |
+ case ESgetpars:
|
2736 |
+ if (c==';' && t->vc_npar<NPAR-1) {
|
2737 |
+ t->vc_npar++;
|
2738 |
+ break;
|
2739 |
+ } else if (c>='0' && c<='9') {
|
2740 |
+ t->vc_par[t->vc_npar] *= 10;
|
2741 |
+ t->vc_par[t->vc_npar] += c-'0';
|
2742 |
+ break;
|
2743 |
+ } else t->vc_state=ESgotpars;
|
2744 |
+ case ESgotpars:
|
2745 |
+ t->vc_state = ESnormal;
|
2746 |
+ switch(c) {
|
2747 |
+ case 'H': case 'f':
|
2748 |
+ if (t->vc_par[0]) t->vc_par[0]--;
|
2749 |
+ if (t->vc_par[1]) t->vc_par[1]--;
|
2750 |
+ gotoxay(t, t->vc_par[1], t->vc_par[0]);
|
2751 |
+ break;
|
2752 |
+ case 'M':
|
2753 |
+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
|
2754 |
+ break;
|
2755 |
+ }
|
2756 |
break;
|
2757 |
default:
|
2758 |
- if (t->backp == 0) {
|
2759 |
- t->backc = 1;
|
2760 |
- t->backp = data-1;
|
2761 |
- } else {
|
2762 |
- t->backc++;
|
2763 |
- }
|
2764 |
- if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
|
2765 |
+ t->vc_state = ESnormal;
|
2766 |
+ switch (c) {
|
2767 |
+ case 0x07: /* Bell */
|
2768 |
+ vcon_i_backflush(t);
|
2769 |
+ break;
|
2770 |
+ case 0x08: /* BS */
|
2771 |
+ vcon_i_backflush(t);
|
2772 |
+ if (t->vc_x > 0)
|
2773 |
+ t->vc_x--;
|
2774 |
+ break;
|
2775 |
+ case 0x0A: /* Linefeed */
|
2776 |
vcon_i_backflush(t); |
2777 |
- t->vc_x = 0;
|
2778 |
vcon_i_cursfeed(t); |
2779 |
+ break;
|
2780 |
+ case 0x0D: /* Return */
|
2781 |
+ vcon_i_backflush(t);
|
2782 |
+ t->vc_x = 0;
|
2783 |
+ break;
|
2784 |
+ case 24: case 26:
|
2785 |
+ vcon_i_backflush(t);
|
2786 |
+ t->vc_state = ESnormal;
|
2787 |
+ break;
|
2788 |
+ case 27:
|
2789 |
+ vcon_i_backflush(t);
|
2790 |
+ t->vc_state = ESesc;
|
2791 |
+ break;
|
2792 |
+ default:
|
2793 |
+ if (t->backp == 0) {
|
2794 |
+ t->backc = 1;
|
2795 |
+ t->backp = data-1;
|
2796 |
+ } else {
|
2797 |
+ t->backc++;
|
2798 |
+ }
|
2799 |
+ if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
|
2800 |
+ vcon_i_backflush(t);
|
2801 |
+ t->vc_x = 0;
|
2802 |
+ vcon_i_cursfeed(t);
|
2803 |
+ }
|
2804 |
} |
2805 |
} |
2806 |
} |
2807 |
diff -ruN proll_18.orig/src/vconsole.h proll-patch7/src/vconsole.h
|
2808 |
--- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000
|
2809 |
+++ proll-patch7/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000
|
2810 |
@@ -6,6 +6,8 @@
|
2811 |
#ifndef VCONSOLE_H
|
2812 |
#define VCONSOLE_H
|
2813 |
|
2814 |
+#define NPAR 16
|
2815 |
+
|
2816 |
struct vconterm {
|
2817 |
void *impl;
|
2818 |
|
2819 |
@@ -13,6 +15,8 @@
|
2820 |
int backc; /* Same, count */ |
2821 |
|
2822 |
int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */ |
2823 |
+ int vc_state;
|
2824 |
+ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
|
2825 |
}; |
2826 |
|
2827 |
int vcon_init(struct vconterm *t, unsigned int a0); |