Commit 5b9053a5ea29f51a6058a5ce76daee6f80efb0b2

Authored by bellard
1 parent 6ea83fed

remove proll


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1965 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 0 additions and 4067 deletions
pc-bios/proll.patch deleted 100644 → 0
1 -diff -ruN proll_18.orig/Makefile proll-patch-15/Makefile  
2 ---- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000  
3 -+++ proll-patch-15/Makefile 2005-11-09 18:14:51.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-patch-15/qemu/Makefile  
18 ---- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000  
19 -+++ proll-patch-15/qemu/Makefile 2005-08-14 10:25:06.000000000 +0000  
20 -@@ -0,0 +1,123 @@  
21 -+#  
22 -+# proll:  
23 -+# qemu/Makefile - make PROLL for QEMU  
24 -+# $Id: proll.patch,v 1.6 2005-11-11 00:24:57 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 = 0xffd08000  
51 -+PROLDATA = 0xffd0b000  
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 -W -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -Wa,-xarch=v8 -g -DQEMU -m32 -fno-builtin  
59 -+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g -Wa,-xarch=v8 -Wa,-32  
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 esp.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 -+esp.o: $(SRC)/esp.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/phys_jj.h  
110 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
111 -+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h  
112 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
113 -+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  
114 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
115 -+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h  
116 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
117 -+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  
118 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
119 -+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h  
120 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
121 -+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h  
122 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c  
123 -+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \  
124 -+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h  
125 -+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c  
126 -+  
127 -+wuf.o: $(SRC)/wuf.S  
128 -+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S  
129 -+wof.o: $(SRC)/wof.S  
130 -+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S  
131 -+  
132 -+#genlab.o: genlab.c  
133 -+# $(CC) -c $*.c  
134 -+#  
135 -+#genlab: genlab.o  
136 -+# $(CC) -o genlab genlab.o  
137 -+  
138 -+clean:  
139 -+ $(RM) $(OBJS)  
140 -+ $(RM) $(PROLLEXE) proll.aout  
141 -+  
142 -+proll.aout: $(PROLLEXE)  
143 -+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE)  
144 -diff -ruN proll_18.orig/qemu/head.S proll-patch-15/qemu/head.S  
145 ---- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000  
146 -+++ proll-patch-15/qemu/head.S 2005-07-12 22:24:17.000000000 +0000  
147 -@@ -0,0 +1,543 @@  
148 -+/**  
149 -+ ** Standalone startup code for Linux PROM emulator.  
150 -+ ** Copyright 1999 Pete A. Zaitcev  
151 -+ ** This code is licensed under GNU General Public License.  
152 -+ **/  
153 -+/*  
154 -+ * $Id: proll.patch,v 1.6 2005-11-11 00:24:57 bellard Exp $  
155 -+ */  
156 -+  
157 -+#include <psr.h>  
158 -+#include <asi.h>  
159 -+#include <crs.h>  
160 -+/* #include <asm/head.h> */ /* Trap entries. Do not use. */  
161 -+#include "phys_jj.h"  
162 -+  
163 -+#define C_LABEL(name) name  
164 -+#define REGWIN_SZ 0x40  
165 -+  
166 -+#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */  
167 -+  
168 -+ /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */  
169 -+#define VATOPGDOFF(va) (((va)>>22)&0x3FC)  
170 -+#define VATOPMDOFF(va) (((va)>>16)&0xFC)  
171 -+  
172 -+#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */  
173 -+  
174 -+/* Here are some trap goodies */  
175 -+  
176 -+#if 0  
177 -+/* Generic trap entry. */  
178 -+#define TRAP_ENTRY(type, label) \  
179 -+ rd %psr, %l0; b label; rd %wim, %l3; nop;  
180 -+#endif  
181 -+  
182 -+/* Data/text faults. */  
183 -+#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;  
184 -+#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;  
185 -+  
186 -+#if 0  
187 -+/* This is for traps we should NEVER get. */  
188 -+#define BAD_TRAP(num) \  
189 -+ rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;  
190 -+  
191 -+/* This is for traps when we want just skip the instruction which caused it */  
192 -+#define SKIP_TRAP(type, name) \  
193 -+ jmpl %l2, %g0; rett %l2 + 4; nop; nop;  
194 -+  
195 -+/* Notice that for the system calls we pull a trick. We load up a  
196 -+ * different pointer to the system call vector table in %l7, but call  
197 -+ * the same generic system call low-level entry point. The trap table  
198 -+ * entry sequences are also HyperSparc pipeline friendly ;-)  
199 -+ */  
200 -+  
201 -+/* Software trap for Linux system calls. */  
202 -+#define LINUX_SYSCALL_TRAP \  
203 -+ sethi %hi(C_LABEL(sys_call_table)), %l7; \  
204 -+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \  
205 -+ b linux_sparc_syscall; \  
206 -+ rd %psr, %l0;  
207 -+  
208 -+/* Software trap for SunOS4.1.x system calls. */  
209 -+#define SUNOS_SYSCALL_TRAP \  
210 -+ rd %psr, %l0; \  
211 -+ sethi %hi(C_LABEL(sunos_sys_table)), %l7; \  
212 -+ b linux_sparc_syscall; \  
213 -+ or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;  
214 -+  
215 -+/* Software trap for Slowaris system calls. */  
216 -+#define SOLARIS_SYSCALL_TRAP \  
217 -+ b solaris_syscall; \  
218 -+ rd %psr, %l0; \  
219 -+ nop; \  
220 -+ nop;  
221 -+  
222 -+#define INDIRECT_SOLARIS_SYSCALL(x) \  
223 -+ mov x, %g1; \  
224 -+ b solaris_syscall; \  
225 -+ rd %psr, %l0; \  
226 -+ nop;  
227 -+  
228 -+#define BREAKPOINT_TRAP \  
229 -+ b breakpoint_trap; \  
230 -+ rd %psr,%l0; \  
231 -+ nop; \  
232 -+ nop;  
233 -+  
234 -+/* Software trap for Sparc-netbsd system calls. */  
235 -+#define NETBSD_SYSCALL_TRAP \  
236 -+ sethi %hi(C_LABEL(sys_call_table)), %l7; \  
237 -+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \  
238 -+ b bsd_syscall; \  
239 -+ rd %psr, %l0;  
240 -+  
241 -+/* The Get Condition Codes software trap for userland. */  
242 -+#define GETCC_TRAP \  
243 -+ b getcc_trap_handler; mov %psr, %l0; nop; nop;  
244 -+  
245 -+/* The Set Condition Codes software trap for userland. */  
246 -+#define SETCC_TRAP \  
247 -+ b setcc_trap_handler; mov %psr, %l0; nop; nop;  
248 -+  
249 -+/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and  
250 -+ * gets handled with another macro.  
251 -+ */  
252 -+#define TRAP_ENTRY_INTERRUPT(int_level) \  
253 -+ mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;  
254 -+  
255 -+/* NMI's (Non Maskable Interrupts) are special, you can't keep them  
256 -+ * from coming in, and basically if you get one, the shows over. ;(  
257 -+ * On the sun4c they are usually asynchronous memory errors, on the  
258 -+ * the sun4m they could be either due to mem errors or a software  
259 -+ * initiated interrupt from the prom/kern on an SMP box saying "I  
260 -+ * command you to do CPU tricks, read your mailbox for more info."  
261 -+ */  
262 -+#define NMI_TRAP \  
263 -+ rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;  
264 -+  
265 -+#endif  
266 -+  
267 -+/* Window overflows/underflows are special and we need to try to be as  
268 -+ * efficient as possible here....  
269 -+ */  
270 -+#define WINDOW_SPILL \  
271 -+ rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;  
272 -+  
273 -+#define WINDOW_FILL \  
274 -+ rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;  
275 -+  
276 -+#define STUB_TRAP ba stub_trap; nop; nop; nop;  
277 -+  
278 -+#define TRAP_ENTRY(a,b) STUB_TRAP  
279 -+#define SKIP_TRAP(a,b) STUB_TRAP  
280 -+#define SUNOS_SYSCALL_TRAP STUB_TRAP  
281 -+#define SOLARIS_SYSCALL_TRAP STUB_TRAP  
282 -+#define NETBSD_SYSCALL_TRAP STUB_TRAP  
283 -+#define LINUX_SYSCALL_TRAP STUB_TRAP  
284 -+#define BREAKPOINT_TRAP STUB_TRAP  
285 -+#define NMI_TRAP STUB_TRAP  
286 -+#define GETCC_TRAP STUB_TRAP  
287 -+#define SETCC_TRAP STUB_TRAP  
288 -+#define BAD_TRAP(n) STUB_TRAP  
289 -+#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP  
290 -+#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP  
291 -+  
292 -+ .section ".text"  
293 -+ .globl start, _start  
294 -+_start:  
295 -+start:  
296 -+ .globl spill_window_entry, fill_window_entry  
297 -+  
298 -+#define EXPORT_TRAP(trap) \  
299 -+ .globl trap; \  
300 -+ .type trap,function; \  
301 -+ .size trap, 16  
302 -+  
303 -+EXPORT_TRAP(t_zero)  
304 -+EXPORT_TRAP(t_wovf)  
305 -+EXPORT_TRAP(t_wunf)  
306 -+EXPORT_TRAP(t_irq1)  
307 -+EXPORT_TRAP(t_irq2)  
308 -+EXPORT_TRAP(t_irq3)  
309 -+EXPORT_TRAP(t_irq4)  
310 -+EXPORT_TRAP(t_irq5)  
311 -+EXPORT_TRAP(t_irq6)  
312 -+EXPORT_TRAP(t_irq7)  
313 -+EXPORT_TRAP(t_irq8)  
314 -+EXPORT_TRAP(t_irq9)  
315 -+EXPORT_TRAP(t_irq10)  
316 -+EXPORT_TRAP(t_irq11)  
317 -+EXPORT_TRAP(t_irq12)  
318 -+EXPORT_TRAP(t_irq13)  
319 -+EXPORT_TRAP(t_irq14)  
320 -+EXPORT_TRAP(t_irq15)  
321 -+  
322 -+C_LABEL(trapbase):  
323 -+t_zero: b goprol; nop; nop; nop;  
324 -+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */  
325 -+t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */  
326 -+t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */  
327 -+t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */  
328 -+t_wovf: WINDOW_SPILL /* Window Overflow */  
329 -+t_wunf: WINDOW_FILL /* Window Underflow */  
330 -+t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */  
331 -+t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */  
332 -+t_dflt: SRMMU_DFAULT /* Data Miss Exception */  
333 -+t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */  
334 -+t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */  
335 -+t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)  
336 -+t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */  
337 -+t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */  
338 -+t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */  
339 -+t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */  
340 -+t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */  
341 -+t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */  
342 -+t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */  
343 -+t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */  
344 -+t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */  
345 -+t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */  
346 -+t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */  
347 -+t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */  
348 -+t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */  
349 -+t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */  
350 -+t_nmi: NMI_TRAP /* Level 15 (NMI) */  
351 -+t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */  
352 -+t_iacce:BAD_TRAP(0x21) /* Instr Access Error */  
353 -+t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)  
354 -+t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */  
355 -+t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */  
356 -+t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)  
357 -+t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */  
358 -+t_dacce:SRMMU_DFAULT /* Data Access Error */  
359 -+t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */  
360 -+t_dserr:BAD_TRAP(0x2b) /* Data Store Error */  
361 -+t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */  
362 -+t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)  
363 -+ BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)  
364 -+ BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)  
365 -+ BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)  
366 -+t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */  
367 -+ BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)  
368 -+ BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)  
369 -+ BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)  
370 -+ BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)  
371 -+ BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)  
372 -+ BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)  
373 -+ BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)  
374 -+ BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)  
375 -+ BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)  
376 -+ BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)  
377 -+ BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)  
378 -+ BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)  
379 -+ BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)  
380 -+ BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)  
381 -+ BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)  
382 -+ BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)  
383 -+ BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)  
384 -+t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */  
385 -+t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */  
386 -+t_divz: BAD_TRAP(0x82) /* Divide by zero trap */  
387 -+t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */  
388 -+t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */  
389 -+t_rchk: BAD_TRAP(0x85) /* Range Check */  
390 -+t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */  
391 -+t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */  
392 -+t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */  
393 -+t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */  
394 -+t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)  
395 -+ BAD_TRAP(0x8e) BAD_TRAP(0x8f)  
396 -+t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */  
397 -+t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)  
398 -+ BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)  
399 -+ BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)  
400 -+t_getcc:GETCC_TRAP /* Get Condition Codes */  
401 -+t_setcc:SETCC_TRAP /* Set Condition Codes */  
402 -+t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)  
403 -+ BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)  
404 -+t_slowi:INDIRECT_SOLARIS_SYSCALL(156)  
405 -+ BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)  
406 -+ BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)  
407 -+ BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)  
408 -+ BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)  
409 -+ BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)  
410 -+ BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)  
411 -+t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)  
412 -+ BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)  
413 -+ BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)  
414 -+ BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)  
415 -+ BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)  
416 -+t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)  
417 -+ BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)  
418 -+ BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)  
419 -+ BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)  
420 -+ BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)  
421 -+t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)  
422 -+ BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)  
423 -+ BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)  
424 -+ BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)  
425 -+ BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)  
426 -+t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)  
427 -+dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */  
428 -+dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */  
429 -+  
430 -+stub_trap:  
431 -+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */  
432 -+ set 0x00ffffff, %g4  
433 -+ sta %g4, [%g5] ASI_M_BYPASS  
434 -+1: ba 1b; nop  
435 -+  
436 -+ .section ".bss"  
437 -+ .align 8  
438 -+bss_start:  
439 -+ .align 0x1000 ! PAGE_SIZE  
440 -+ .globl C_LABEL(bootup_user_stack)  
441 -+ .type bootup_user_stack,#object  
442 -+ .size bootup_user_stack,0x2000  
443 -+C_LABEL(bootup_user_stack): .skip 0x2000  
444 -+  
445 -+ .section ".text"  
446 -+ .register %g2, #scratch  
447 -+ .register %g3, #scratch  
448 -+ .register %g6, #scratch  
449 -+ .register %g7, #scratch  
450 -+  
451 -+goprol:  
452 -+ ! %g1 contains end of memory  
453 -+ set PHYS_JJ_EEPROM + 0x30, %g1  
454 -+ lda [%g1] ASI_M_BYPASS, %g1  
455 -+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram  
456 -+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables  
457 -+ sub %g1, %g2, %g2 ! start of private memory  
458 -+ srl %g2, 0x4, %g7 ! ctx table at s+0x0  
459 -+ add %g2, 0x400, %g3 ! l1 table at s+0x400  
460 -+ srl %g3, 0x4, %g3  
461 -+ or %g3, 0x1, %g3  
462 -+ sta %g3, [%g2] ASI_M_BYPASS  
463 -+ add %g2, 0x400, %g2 ! s+0x400  
464 -+ add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800  
465 -+ srl %g3, 0x4, %g3  
466 -+ or %g3, 0x1, %g3  
467 -+ sta %g3, [%g2] ASI_M_BYPASS  
468 -+ add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900  
469 -+ add %g2, 0x3fc, %g2 ! s+0x7fc  
470 -+ srl %g3, 0x4, %g3  
471 -+ or %g3, 0x1, %g3  
472 -+ sta %g3, [%g2] ASI_M_BYPASS  
473 -+ add %g2, 0x4, %g2 ! s+0x800  
474 -+ set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)  
475 -+ sta %g3, [%g2] ASI_M_BYPASS  
476 -+ add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00  
477 -+ add %g2, 0x1d0, %g2 ! s+0x9d0  
478 -+ srl %g3, 0x4, %g3  
479 -+ or %g3, 0x1, %g3  
480 -+ sta %g3, [%g2] ASI_M_BYPASS  
481 -+ add %g2, 0x30, %g2 ! s+0xa00  
482 -+  
483 -+ set PROLBASE, %g3  
484 -+ set 0x1000, %g5  
485 -+ set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages  
486 -+1: srl %g3, 0x4, %g4  
487 -+ or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)  
488 -+ sta %g4, [%g2] ASI_M_BYPASS  
489 -+ add %g2, 4, %g2  
490 -+ add %g3, %g5, %g3  
491 -+ deccc %g6  
492 -+ bne 1b  
493 -+ nop  
494 -+#if 0  
495 -+ set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages  
496 -+1: srl %g3, 0x4, %g4  
497 -+ or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)  
498 -+ sta %g4, [%g2] ASI_M_BYPASS  
499 -+ add %g2, 4, %g2  
500 -+ add %g3, %g5, %g3  
501 -+ deccc %g6  
502 -+ bne 1b  
503 -+ nop  
504 -+#endif  
505 -+ set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages  
506 -+ set 0x1000, %g4  
507 -+ sll %g7, 0x4, %g3  
508 -+ add %g4, %g3, %g3  
509 -+1: srl %g3, 0x4, %g4  
510 -+ or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)  
511 -+ sta %g4, [%g2] ASI_M_BYPASS  
512 -+ add %g2, 4, %g2  
513 -+ add %g3, %g5, %g3  
514 -+ deccc %g6  
515 -+ bne 1b  
516 -+ nop  
517 -+  
518 -+ mov %g1, %g3  
519 -+  
520 -+ set AC_M_CTPR, %g2  
521 -+ sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr  
522 -+ set 1, %g1  
523 -+ sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu  
524 -+  
525 -+ /*  
526 -+ * The code which enables traps is a simplified version of  
527 -+ * kernel head.S.  
528 -+ *  
529 -+ * We know number of windows as 8 so we do not calculate them.  
530 -+ * The deadwood is here for any case.  
531 -+ */  
532 -+  
533 -+ /* Turn on Supervisor, EnableFloating, and all the PIL bits.  
534 -+ * Also puts us in register window zero with traps off.  
535 -+ */  
536 -+ set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2  
537 -+ wr %g2, 0x0, %psr  
538 -+ WRITE_PAUSE  
539 -+  
540 -+ /* I want a kernel stack NOW! */  
541 -+ set C_LABEL(bootup_user_stack), %g1  
542 -+ set (0x2000 - REGWIN_SZ), %g2  
543 -+ add %g1, %g2, %sp  
544 -+ mov 0, %fp /* And for good luck */  
545 -+  
546 -+ /* Zero out our BSS section. */  
547 -+ set C_LABEL(bss_start) , %o0 ! First address of BSS  
548 -+ set C_LABEL(end) , %o1 ! Last address of BSS  
549 -+ ba 2f  
550 -+ nop  
551 -+1:  
552 -+ st %g0, [%o0]  
553 -+2:  
554 -+ subcc %o0, %o1, %g0  
555 -+ bl 1b  
556 -+ add %o0, 0x4, %o0  
557 -+  
558 -+ mov 2, %g1  
559 -+ wr %g1, 0x0, %wim ! make window 1 invalid  
560 -+ WRITE_PAUSE  
561 -+  
562 -+#if 0  
563 -+ wr %g0, 0x0, %wim  
564 -+ WRITE_PAUSE  
565 -+ save  
566 -+ rd %psr, %g3  
567 -+ restore  
568 -+ and %g3, PSR_CWP, %g3  
569 -+ add %g3, 0x1, %g3  
570 -+#else  
571 -+ or %g0, 8, %g3  
572 -+#endif  
573 -+  
574 -+#if 0  
575 -+ sethi %hi( C_LABEL(cputyp) ), %o0  
576 -+ st %g7, [%o0 + %lo( C_LABEL(cputyp) )]  
577 -+  
578 -+ sethi %hi( C_LABEL(nwindows) ), %g4  
579 -+ st %g3, [%g4 + %lo( C_LABEL(nwindows) )]  
580 -+  
581 -+ sub %g3, 0x1, %g3  
582 -+ sethi %hi( C_LABEL(nwindowsm1) ), %g4  
583 -+ st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]  
584 -+#endif  
585 -+  
586 -+ /* Here we go, start using Linux's trap table... */  
587 -+ set C_LABEL(trapbase), %g3  
588 -+ wr %g3, 0x0, %tbr  
589 -+ WRITE_PAUSE  
590 -+  
591 -+ /* Finally, turn on traps so that we can call c-code. */  
592 -+ rd %psr, %g3  
593 -+ wr %g3, 0x0, %psr  
594 -+ WRITE_PAUSE  
595 -+  
596 -+ wr %g3, PSR_ET, %psr  
597 -+ WRITE_PAUSE  
598 -+  
599 -+ .globl prolmain  
600 -+ call C_LABEL(prolmain)  
601 -+ nop  
602 -+  
603 -+3:  
604 -+ b 3b  
605 -+ nop  
606 -+  
607 -+/*  
608 -+ * Memory access trap handler  
609 -+ * %l0 program %psr from trap table entry  
610 -+ * %l1 program %pc from hardware  
611 -+ * %l2 program %npc from hardware  
612 -+ * %l3 program %wim from trap table entry  
613 -+ * %l4  
614 -+ * %l5  
615 -+ * %l6  
616 -+ * %l7 text flag from trap table entry  
617 -+ */  
618 -+  
619 -+ .section ".text"  
620 -+ .globl srmmu_fault  
621 -+C_LABEL(srmmu_fault):  
622 -+  
623 -+ set AC_M_SFAR, %l6  
624 -+ set AC_M_SFSR, %l5  
625 -+ lda [%l6] ASI_M_MMUREGS, %l6  
626 -+ lda [%l5] ASI_M_MMUREGS, %l5  
627 -+  
628 -+ set ignore_fault, %l5  
629 -+ ld [%l5], %l5  
630 -+ subcc %l5, %g0, %g0 /* NULL pointer trap faults always */  
631 -+ be 3f  
632 -+ nop  
633 -+ subcc %l5, %l6, %g0  
634 -+ be 2f  
635 -+ nop  
636 -+3:  
637 -+  
638 -+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */  
639 -+ set 0x00ffffff, %g4  
640 -+ sta %g4, [%g5] ASI_M_BYPASS  
641 -+ add %g5, 8, %g5 /* On right side */  
642 -+ sta %g4, [%g5] ASI_M_BYPASS  
643 -+1: ba 1b; nop  
644 -+  
645 -+2:  
646 -+ set C_LABEL(fault_ignored), %l5  
647 -+ mov 1, %l6  
648 -+ st %l6, [%l5]  
649 -+  
650 -+ /*  
651 -+ * Skip the faulting instruction.  
652 -+ * I think it works when next instruction is a branch even.  
653 -+ */  
654 -+ or %l2, 0, %l1  
655 -+ add %l2, 4, %l2  
656 -+  
657 -+ wr %l0, 0, %psr  
658 -+ WRITE_PAUSE  
659 -+ jmp %l1  
660 -+ rett %l2  
661 -+  
662 -+/*  
663 -+ * Slow external versions of st_bypass and ld_bypass.  
664 -+ * rconsole.c uses inlines. We call these in places which are not speed  
665 -+ * critical, to avoid compiler bugs.  
666 -+ */  
667 -+ .globl C_LABEL(st_bypass)  
668 -+C_LABEL(st_bypass):  
669 -+ retl  
670 -+ sta %o1, [%o0] ASI_M_BYPASS  
671 -+ .globl C_LABEL(ld_bypass)  
672 -+C_LABEL(ld_bypass):  
673 -+ retl  
674 -+ lda [%o0] ASI_M_BYPASS, %o0  
675 -+ .globl C_LABEL(sth_bypass)  
676 -+C_LABEL(sth_bypass):  
677 -+ retl  
678 -+ stha %o1, [%o0] ASI_M_BYPASS  
679 -+ .globl C_LABEL(ldh_bypass)  
680 -+C_LABEL(ldh_bypass):  
681 -+ retl  
682 -+ lduha [%o0] ASI_M_BYPASS, %o0  
683 -+ .globl C_LABEL(stb_bypass)  
684 -+C_LABEL(stb_bypass):  
685 -+ retl  
686 -+ stba %o1, [%o0] ASI_M_BYPASS  
687 -+ .globl C_LABEL(ldb_bypass)  
688 -+C_LABEL(ldb_bypass):  
689 -+ retl  
690 -+ lduba [%o0] ASI_M_BYPASS, %o0  
691 -diff -ruN proll_18.orig/qemu/main.c proll-patch-15/qemu/main.c  
692 ---- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000  
693 -+++ proll-patch-15/qemu/main.c 2005-08-14 10:07:48.000000000 +0000  
694 -@@ -0,0 +1,185 @@  
695 -+/**  
696 -+ ** Proll (PROM replacement)  
697 -+ ** Copyright 1999 Pete Zaitcev  
698 -+ ** This code is licensed under GNU General Public License.  
699 -+ **/  
700 -+#include <stdarg.h>  
701 -+  
702 -+// #include <asm/contregs.h>  
703 -+#include <asi.h>  
704 -+#include "pgtsrmmu.h"  
705 -+#include "iommu.h" /* Typical SBus IOMMU for sun4m */  
706 -+#include "phys_jj.h"  
707 -+#include "vconsole.h"  
708 -+#include "version.h"  
709 -+#include <general.h> /* __P() */  
710 -+#include <net.h> /* init_net() */  
711 -+#include <romlib.h> /* we are a provider for part of this. */  
712 -+#include <netpriv.h> /* myipaddr */  
713 -+#include <arpa.h>  
714 -+#include <system.h> /* our own prototypes */  
715 -+  
716 -+void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);  
717 -+int vcon_zs_init(struct vconterm *t, unsigned int a0);  
718 -+int vcon_zs_write(struct vconterm *t, char *data, int leng);  
719 -+int vcon_zs_getch(struct vconterm *t);  
720 -+void esp_probe();  
721 -+int esp_boot(int unit);  
722 -+static void init_idprom(void);  
723 -+  
724 -+struct vconterm dp0;  
725 -+struct mem cmem; /* Current memory, virtual */  
726 -+struct mem cio; /* Current I/O space */  
727 -+struct phym pmem; /* Current phys. mem. */  
728 -+struct iommu ciommu; /* Our IOMMU on sun4m */  
729 -+  
730 -+static struct {  
731 -+ const char id[16];  
732 -+ unsigned int version;  
733 -+ char pad1[0x1c]; // Pad to 0x30  
734 -+ unsigned int ram_size;  
735 -+ char boot_device;  
736 -+ unsigned int load_addr, kernel_size;  
737 -+ unsigned int cmdline, cmdline_len;  
738 -+ char pad2[0x0c]; // Pad to 0x54  
739 -+ unsigned short width, height, depth;  
740 -+} *hw_idprom;  
741 -+  
742 -+int ignore_fault, fault_ignored;  
743 -+void *printk_fn, *getch_fn;  
744 -+unsigned int q_height, q_width;  
745 -+  
746 -+/*  
747 -+ */  
748 -+void prolmain()  
749 -+{  
750 -+ static char fname[14];  
751 -+ static struct banks bb;  
752 -+ unsigned int hiphybas;  
753 -+ const void *romvec;  
754 -+ unsigned int ram_size;  
755 -+ char nographic, bootdev;  
756 -+  
757 -+ nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);  
758 -+ if (!nographic) {  
759 -+ q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);  
760 -+ q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);  
761 -+ vcon_init(&dp0, PHYS_JJ_TCX_FB);  
762 -+ printk_fn = vcon_write;  
763 -+ getch_fn = vcon_getch;  
764 -+ }  
765 -+ else {  
766 -+ vcon_zs_init(&dp0, 0x71100004);  
767 -+ printk_fn = vcon_zs_write;  
768 -+ getch_fn = vcon_zs_getch;  
769 -+ }  
770 -+  
771 -+  
772 -+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);  
773 -+ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);  
774 -+ printk("%d MB total\n", ram_size/(1024*1024));  
775 -+  
776 -+ bb.nbanks = 1;  
777 -+ bb.bankv[0].start = 0;  
778 -+ bb.bankv[0].length = ram_size;  
779 -+  
780 -+ hiphybas = ram_size - PROLSIZE;  
781 -+  
782 -+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));  
783 -+ makepages(&pmem, hiphybas);  
784 -+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);  
785 -+  
786 -+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE),  
787 -+ (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));  
788 -+  
789 -+ iommu_init(&ciommu, hiphybas);  
790 -+  
791 -+ /*  
792 -+ */  
793 -+ init_idprom();  
794 -+ printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);  
795 -+ if (!nographic)  
796 -+ printk("Prom console: TCX %dx%d\n", q_width, q_height);  
797 -+ else  
798 -+ printk("Prom console: serial\n");  
799 -+ sched_init();  
800 -+ le_probe();  
801 -+ init_net();  
802 -+ esp_probe();  
803 -+  
804 -+ bootdev = hw_idprom->boot_device;  
805 -+ printk("Boot device: %c\n", bootdev);  
806 -+ if (hw_idprom->kernel_size > 0) {  
807 -+ printk("Kernel already loaded\n");  
808 -+ } else if (bootdev == 'n') {  
809 -+ if (bootp() != 0) fatal();  
810 -+ /*  
811 -+ * boot_rec.bp_file cannot be used because system PROM  
812 -+ * uses it to locate ourselves. If we load from boot_rec.bp_file,  
813 -+ * we will loop reloading PROLL over and over again.  
814 -+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).  
815 -+ */  
816 -+ xtoa(myipaddr, fname, 8);  
817 -+ fname[9] = '.';  
818 -+ fname[10] = 'P';  
819 -+ fname[11] = 'R';  
820 -+ fname[12] = 'O';  
821 -+ fname[13] = 'L';  
822 -+ fname[14] = 0;  
823 -+  
824 -+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal();  
825 -+ } else if (bootdev == 'c') {  
826 -+ if (esp_boot(0) != 0) fatal();  
827 -+ } else if (bootdev == 'd') {  
828 -+ if (esp_boot(2) != 0) fatal();  
829 -+ }  
830 -+  
831 -+ romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,  
832 -+ (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);  
833 -+  
834 -+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",  
835 -+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,  
836 -+ (int)cio.start, (int)cio.curp);  
837 -+  
838 -+ {  
839 -+ void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;  
840 -+ printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",  
841 -+ *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);  
842 -+ entry(romvec, 0, 0, 0, 0);  
843 -+ }  
844 -+  
845 -+ mem_fini(&cmem);  
846 -+ vcon_fini(&dp0);  
847 -+}  
848 -+  
849 -+/*  
850 -+ * dvma_alloc over iommu_alloc.  
851 -+ */  
852 -+void *dvma_alloc(int size, unsigned int *pphys)  
853 -+{  
854 -+ return iommu_alloc(&ciommu, size, pphys);  
855 -+}  
856 -+  
857 -+/*  
858 -+ */  
859 -+void udelay(__attribute__((unused)) unsigned long usecs)  
860 -+{  
861 -+ // Qemu hardware is perfect and does not need any delays!  
862 -+}  
863 -+  
864 -+static void init_idprom()  
865 -+{  
866 -+ void *va_prom;  
867 -+  
868 -+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {  
869 -+ printk("init_idprom: cannot map eeprom\n");  
870 -+ fatal();  
871 -+ }  
872 -+ bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);  
873 -+ /*  
874 -+ * hw_idprom is not used anywhere.  
875 -+ * It's just as we hate to leave hanging pointers (I/O page here).  
876 -+ */  
877 -+ hw_idprom = va_prom;  
878 -+}  
879 -+  
880 -diff -ruN proll_18.orig/qemu/openprom.c proll-patch-15/qemu/openprom.c  
881 ---- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000  
882 -+++ proll-patch-15/qemu/openprom.c 2005-11-07 20:11:04.000000000 +0000  
883 -@@ -0,0 +1,910 @@  
884 -+/*  
885 -+ * PROM interface support  
886 -+ * Copyright 1996 The Australian National University.  
887 -+ * Copyright 1996 Fujitsu Laboratories Limited  
888 -+ * Copyright 1999 Pete A. Zaitcev  
889 -+ * This software may be distributed under the terms of the Gnu  
890 -+ * Public License version 2 or later  
891 -+ */  
892 -+  
893 -+#include <openprom.h>  
894 -+#include <general.h>  
895 -+#include <romlib.h>  
896 -+#include <system.h>  
897 -+#include <vconsole.h>  
898 -+#include "phys_jj.h"  
899 -+  
900 -+//#define DEBUG_OBP  
901 -+  
902 -+#define PAGE_SIZE 4096  
903 -+  
904 -+struct property {  
905 -+ const char *name;  
906 -+ const char *value;  
907 -+ int length;  
908 -+};  
909 -+  
910 -+struct node {  
911 -+ const struct property *properties;  
912 -+ /* short */ const int sibling;  
913 -+ /* short */ const int child;  
914 -+};  
915 -+  
916 -+static int obp_nextnode(int node);  
917 -+static int obp_child(int node);  
918 -+static int obp_proplen(int node, char *name);  
919 -+static int obp_getprop(int node, char *name, char *val);  
920 -+static int obp_setprop(int node, char *name, char *val, int len);  
921 -+static const char *obp_nextprop(int node, char *name);  
922 -+  
923 -+static char obp_idprom[IDPROM_SIZE];  
924 -+static const struct property null_properties = { NULL, NULL, -1 };  
925 -+static const int prop_true = -1;  
926 -+  
927 -+static struct property propv_root[7];  
928 -+  
929 -+static const struct property propv_root_templ[] = {  
930 -+ {"name", "SUNW,SparcStation-5", sizeof("SUNW,SparcStation-5") },  
931 -+ {"idprom", obp_idprom, IDPROM_SIZE},  
932 -+ {"banner-name", "SparcStation", sizeof("SparcStation")},  
933 -+ {"compatible", "sun4m", 6},  
934 -+};  
935 -+  
936 -+static const int prop_iommu_reg[] = {  
937 -+ 0x0, 0x10000000, 0x00000300,  
938 -+};  
939 -+static const struct property propv_iommu[] = {  
940 -+ {"name", "iommu", sizeof("iommu")},  
941 -+ {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },  
942 -+ {NULL, NULL, -1}  
943 -+};  
944 -+  
945 -+static const int prop_sbus_ranges[] = {  
946 -+ 0x0, 0x0, 0x0, 0x30000000, 0x10000000,  
947 -+ 0x1, 0x0, 0x0, 0x40000000, 0x10000000,  
948 -+ 0x2, 0x0, 0x0, 0x50000000, 0x10000000,  
949 -+ 0x3, 0x0, 0x0, 0x60000000, 0x10000000,  
950 -+ 0x4, 0x0, 0x0, 0x70000000, 0x10000000,  
951 -+};  
952 -+static const struct property propv_sbus[] = {  
953 -+ {"name", "sbus", 5},  
954 -+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},  
955 -+ {"device_type", "hierarchical", sizeof("hierarchical") },  
956 -+ {NULL, NULL, -1}  
957 -+};  
958 -+  
959 -+static const int prop_tcx_regs[] = {  
960 -+ 0x2, 0x00800000, 0x00100000,  
961 -+ 0x2, 0x02000000, 0x00000001,  
962 -+ 0x2, 0x04000000, 0x00800000,  
963 -+ 0x2, 0x06000000, 0x00800000,  
964 -+ 0x2, 0x0a000000, 0x00000001,  
965 -+ 0x2, 0x0c000000, 0x00000001,  
966 -+ 0x2, 0x0e000000, 0x00000001,  
967 -+ 0x2, 0x00700000, 0x00001000,  
968 -+ 0x2, 0x00200000, 0x00000004,  
969 -+ 0x2, 0x00300000, 0x0000081c,  
970 -+ 0x2, 0x00000000, 0x00010000,  
971 -+ 0x2, 0x00240000, 0x00000004,  
972 -+ 0x2, 0x00280000, 0x00000001,  
973 -+};  
974 -+  
975 -+#if 1 /* Zaitcev */  
976 -+static const int pixfreq = 0x03dfd240;  
977 -+static const int hbporch = 0xa0;  
978 -+static const int vfreq = 0x3c;  
979 -+#endif  
980 -+#if 0 /* Kevin Boone - 70Hz refresh */  
981 -+static const int pixfreq = 0x047868C0;  
982 -+static const int hbporch = 0x90;  
983 -+static const int vfreq = 0x46;  
984 -+#endif  
985 -+  
986 -+static const int vbporch = 0x1d;  
987 -+static const int vsync = 0x6;  
988 -+static const int hsync = 0x88;  
989 -+static const int vfporch = 0x3;  
990 -+static const int hfporch = 0x18;  
991 -+static const int height = 0x300;  
992 -+static const int width = 0x400;  
993 -+static const int linebytes = 0x400;  
994 -+static const int depth = 24;  
995 -+static const int tcx_intr[] = { 5, 0 };  
996 -+static const int tcx_interrupts = 5;  
997 -+static const struct property propv_sbus_tcx[] = {  
998 -+ {"name", "SUNW,tcx", sizeof("SUNW,tcx")},  
999 -+ {"vbporch", (char*)&vbporch, sizeof(int)},  
1000 -+ {"hbporch", (char*)&hbporch, sizeof(int)},  
1001 -+ {"vsync", (char*)&vsync, sizeof(int)},  
1002 -+ {"hsync", (char*)&hsync, sizeof(int)},  
1003 -+ {"vfporch", (char*)&vfporch, sizeof(int)},  
1004 -+ {"hfporch", (char*)&hfporch, sizeof(int)},  
1005 -+ {"pixfreq", (char*)&pixfreq, sizeof(int)},  
1006 -+ {"vfreq", (char*)&vfreq, sizeof(int)},  
1007 -+ {"height", (char*)&height, sizeof(int)},  
1008 -+ {"width", (char*)&width, sizeof(int)},  
1009 -+ {"linebytes", (char*)&linebytes, sizeof(int)},  
1010 -+ {"depth", (char*)&depth, sizeof(int)},  
1011 -+ {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},  
1012 -+ {"tcx-8-bit", 0, -1},  
1013 -+ {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},  
1014 -+ {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},  
1015 -+ {"device_type", "display", sizeof("display")},  
1016 -+ {NULL, NULL, -1}  
1017 -+};  
1018 -+  
1019 -+static const int prop_cs4231_reg[] = {  
1020 -+ 0x3, 0x0C000000, 0x00000040  
1021 -+};  
1022 -+static const int cs4231_interrupts = 5;  
1023 -+static const int cs4231_intr[] = { 5, 0 };  
1024 -+  
1025 -+static const struct property propv_sbus_cs4231[] = {  
1026 -+ {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },  
1027 -+ {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },  
1028 -+ {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },  
1029 -+ {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },  
1030 -+ {"device_type", "serial", sizeof("serial") },  
1031 -+ {"alias", "audio", sizeof("audio") },  
1032 -+ {NULL, NULL, -1}  
1033 -+};  
1034 -+  
1035 -+static const int cpu_nctx = NCTX_SWIFT;  
1036 -+static const int cpu_cache_line_size = 0x20;  
1037 -+static const int cpu_cache_nlines = 0x200;  
1038 -+static const struct property propv_cpu[] = {  
1039 -+ {"name", "STP1012PGA", sizeof("STP1012PGA") },  
1040 -+ {"device_type", "cpu", 4 },  
1041 -+ {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},  
1042 -+ {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},  
1043 -+ {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},  
1044 -+ {NULL, NULL, -1}  
1045 -+};  
1046 -+  
1047 -+static const int prop_obio_ranges[] = {  
1048 -+ 0x0, 0x0, 0x0, 0x71000000, 0x01000000,  
1049 -+};  
1050 -+static const struct property propv_obio[] = {  
1051 -+ {"name", "obio", 5 },  
1052 -+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },  
1053 -+ {"device_type", "hierarchical", sizeof("hierarchical") },  
1054 -+ {NULL, NULL, -1}  
1055 -+};  
1056 -+  
1057 -+static const int prop_auxio_reg[] = {  
1058 -+ 0x0, 0x00900000, 0x00000001,  
1059 -+};  
1060 -+static const struct property propv_obio_auxio[] = {  
1061 -+ {"name", "auxio", sizeof("auxio") },  
1062 -+ {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },  
1063 -+ {NULL, NULL, -1}  
1064 -+};  
1065 -+  
1066 -+static const int prop_int_reg[] = {  
1067 -+ 0x0, 0x00e00000, 0x00000010,  
1068 -+ 0x0, 0x00e10000, 0x00000010,  
1069 -+};  
1070 -+static const struct property propv_obio_int[] = {  
1071 -+ {"name", "interrupt", sizeof("interrupt")},  
1072 -+ {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },  
1073 -+ {NULL, NULL, -1}  
1074 -+};  
1075 -+  
1076 -+static const int prop_cnt_reg[] = {  
1077 -+ 0x0, 0x00d00000, 0x00000010,  
1078 -+ 0x0, 0x00d10000, 0x00000010,  
1079 -+};  
1080 -+static const struct property propv_obio_cnt[] = {  
1081 -+ {"name", "counter", sizeof("counter")},  
1082 -+ {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },  
1083 -+ {NULL, NULL, -1}  
1084 -+};  
1085 -+  
1086 -+static const int prop_eeprom_reg[] = {  
1087 -+ 0x0, 0x00200000, 0x00002000,  
1088 -+};  
1089 -+static const struct property propv_obio_eep[] = {  
1090 -+ {"name", "eeprom", sizeof("eeprom")},  
1091 -+ {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },  
1092 -+ {"model", "mk48t08", sizeof("mk48t08")},  
1093 -+ {NULL, NULL, -1}  
1094 -+};  
1095 -+  
1096 -+static const int prop_su_reg[] = {  
1097 -+ 0x0, 0x003002f8, 0x00000008,  
1098 -+};  
1099 -+static const struct property propv_obio_su[] = {  
1100 -+ {"name", "su", sizeof("su")},  
1101 -+ {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },  
1102 -+ {NULL, NULL, -1}  
1103 -+};  
1104 -+  
1105 -+static const int prop_zs_intr[] = { 0x2c, 0x0 };  
1106 -+static const int prop_zs_reg[] = {  
1107 -+ 0x0, 0x00000000, 0x00000008,  
1108 -+};  
1109 -+static void *prop_zs_addr;  
1110 -+static const int prop_zs_slave = 1;  
1111 -+static const struct property propv_obio_zs[] = {  
1112 -+ {"name", "zs", sizeof("zs")},  
1113 -+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },  
1114 -+ {"slave", (char*)&prop_zs_slave, sizeof(prop_zs_slave) },  
1115 -+ {"device_type", "serial", sizeof("serial") },  
1116 -+ {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },  
1117 -+ {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },  
1118 -+ {"keyboard", (char*)&prop_true, 0},  
1119 -+ {"mouse", (char*)&prop_true, 0},  
1120 -+ {NULL, NULL, -1}  
1121 -+};  
1122 -+  
1123 -+static const int prop_zs1_intr[] = { 0x2c, 0x0 };  
1124 -+static const int prop_zs1_reg[] = {  
1125 -+ 0x0, 0x00100000, 0x00000008,  
1126 -+};  
1127 -+static void *prop_zs1_addr;  
1128 -+static const int prop_zs1_slave = 0;  
1129 -+static const struct property propv_obio_zs1[] = {  
1130 -+ {"name", "zs", sizeof("zs")},  
1131 -+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },  
1132 -+ {"slave", (char*)&prop_zs1_slave, sizeof(prop_zs1_slave) },  
1133 -+ {"device_type", "serial", sizeof("serial") },  
1134 -+ {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },  
1135 -+ {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },  
1136 -+ {NULL, NULL, -1}  
1137 -+};  
1138 -+  
1139 -+static const int prop_ledma_reg[] = {  
1140 -+ 0x4, 0x08400010, 0x00000020,  
1141 -+};  
1142 -+static const int prop_ledma_burst = 0x3f;  
1143 -+static const struct property propv_sbus_ledma[] = {  
1144 -+ {"name", "ledma", sizeof("ledma")},  
1145 -+ {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },  
1146 -+ {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },  
1147 -+ {NULL, NULL, -1}  
1148 -+};  
1149 -+  
1150 -+static const int prop_le_reg[] = {  
1151 -+ 0x4, 0x08c00000, 0x00000004,  
1152 -+};  
1153 -+static const int prop_le_busmaster_regval = 0x7;  
1154 -+static const int prop_le_intr[] = { 0x26, 0x0 };  
1155 -+static const struct property propv_sbus_ledma_le[] = {  
1156 -+ {"name", "le", sizeof("le")},  
1157 -+ {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },  
1158 -+ {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},  
1159 -+ {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },  
1160 -+ {NULL, NULL, -1}  
1161 -+};  
1162 -+  
1163 -+static const int prop_espdma_reg[] = {  
1164 -+ 0x4, 0x08400000, 0x00000010,  
1165 -+};  
1166 -+  
1167 -+static const struct property propv_sbus_espdma[] = {  
1168 -+ {"name", "espdma", sizeof("espdma")},  
1169 -+ {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },  
1170 -+ {NULL, NULL, -1}  
1171 -+};  
1172 -+  
1173 -+static const int prop_esp_reg[] = {  
1174 -+ 0x4, 0x08800000, 0x00000040,  
1175 -+};  
1176 -+static const int prop_esp_intr[] = { 0x24, 0x0 };  
1177 -+static const struct property propv_sbus_espdma_esp[] = {  
1178 -+ {"name", "esp", sizeof("esp")},  
1179 -+ {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },  
1180 -+ {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },  
1181 -+ {NULL, NULL, -1}  
1182 -+};  
1183 -+  
1184 -+static const int prop_bpp_reg[] = {  
1185 -+ 0x4, 0x0c800000, 0x0000001c,  
1186 -+};  
1187 -+static const int prop_bpp_intr[] = { 0x33, 0x0 };  
1188 -+static const struct property propv_sbus_bpp[] = {  
1189 -+ {"name", "SUNW,bpp", sizeof("SUNW,bpp")},  
1190 -+ {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },  
1191 -+ {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },  
1192 -+ {NULL, NULL, -1}  
1193 -+};  
1194 -+  
1195 -+static const int prop_apc_reg[] = {  
1196 -+ 0x4, 0x0a000000, 0x00000010,  
1197 -+};  
1198 -+static const struct property propv_sbus_apc[] = {  
1199 -+ {"name", "xxxpower-management", sizeof("xxxpower-management")},  
1200 -+ {"reg", (char*)&prop_apc_reg[0], sizeof(prop_apc_reg) },  
1201 -+ {NULL, NULL, -1}  
1202 -+};  
1203 -+  
1204 -+static const int prop_fd_intr[] = { 0x2b, 0x0 };  
1205 -+static const int prop_fd_reg[] = {  
1206 -+ 0x0, 0x00400000, 0x0000000f,  
1207 -+};  
1208 -+static const struct property propv_obio_fd[] = {  
1209 -+ {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},  
1210 -+ {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },  
1211 -+ {"device_type", "block", sizeof("block") },  
1212 -+ {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },  
1213 -+ {NULL, NULL, -1}  
1214 -+};  
1215 -+  
1216 -+static const int prop_pw_intr[] = { 0x22, 0x0 };  
1217 -+static const int prop_pw_reg[] = {  
1218 -+ 0x0, 0x00910000, 0x00000001,  
1219 -+};  
1220 -+static const struct property propv_obio_pw[] = {  
1221 -+ {"name", "power", sizeof("power")},  
1222 -+ {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },  
1223 -+ {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },  
1224 -+ {NULL, NULL, -1}  
1225 -+};  
1226 -+  
1227 -+static const int prop_cf_reg[] = {  
1228 -+ 0x0, 0x00800000, 0x00000001,  
1229 -+};  
1230 -+static const struct property propv_obio_cf[] = {  
1231 -+ {"name", "slavioconfig", sizeof("slavioconfig")},  
1232 -+ {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },  
1233 -+ {NULL, NULL, -1}  
1234 -+};  
1235 -+  
1236 -+static const struct property propv_options[] = {  
1237 -+ {"name", "options", sizeof("options")},  
1238 -+ {"screen-#columns", "80", sizeof("80")},  
1239 -+ {"screen-#rows", "25", sizeof("25")},  
1240 -+ {"tpe-link-test?", (char *)&prop_true, 0},  
1241 -+ {"ttya-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},  
1242 -+ {"ttya-ignore-cd", (char *)&prop_true, 0},  
1243 -+ {"ttya-rts-dtr-off", 0, -1},  
1244 -+ {"ttyb-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},  
1245 -+ {"ttyb-ignore-cd", (char *)&prop_true, 0},  
1246 -+ {"ttyb-rts-dtr-off", 0, -1},  
1247 -+ {NULL, NULL, -1}  
1248 -+};  
1249 -+  
1250 -+static int prop_mem_reg[3];  
1251 -+static int prop_mem_avail[3];  
1252 -+  
1253 -+static const struct property propv_memory[] = {  
1254 -+ {"name", "memory", sizeof("memory")},  
1255 -+ {"reg", (char*)&prop_mem_reg[0], sizeof(prop_mem_reg) },  
1256 -+ {"available", (char*)&prop_mem_avail[0], sizeof(prop_mem_avail) },  
1257 -+ {NULL, NULL, -1}  
1258 -+};  
1259 -+  
1260 -+static int prop_vmem_avail[6];  
1261 -+  
1262 -+static const struct property propv_vmemory[] = {  
1263 -+ {"name", "virtual-memory", sizeof("virtual-memory")},  
1264 -+ {"available", (char*)&prop_vmem_avail[0], sizeof(prop_vmem_avail) },  
1265 -+ {NULL, NULL, -1}  
1266 -+};  
1267 -+  
1268 -+static const struct node nodes[] = {  
1269 -+ { &null_properties, 1, 0 }, /* 0 = big brother of root */  
1270 -+ { propv_root, 0, 2 }, /* 1 "/" */  
1271 -+ { propv_iommu, 12, 3 }, /* 2 "/iommu" */  
1272 -+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */  
1273 -+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */  
1274 -+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */  
1275 -+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */  
1276 -+ { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */  
1277 -+ { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */  
1278 -+ { propv_sbus_espdma, 11, 10 }, /* 9 "/iommu/sbus/espdma" */  
1279 -+ { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */  
1280 -+ { propv_sbus_apc, 0, 0 }, /* 11 "/iommu/sbus/power-management */  
1281 -+ { propv_cpu, 13, 0 }, /* 12 "/STP1012PGA" */  
1282 -+ { propv_obio, 23, 14 }, /* 13 "/obio" */  
1283 -+ { propv_obio_int, 15, 0 }, /* 14 "/obio/interrupt" */  
1284 -+ { propv_obio_cnt, 16, 0 }, /* 15 "/obio/counter" */  
1285 -+ { propv_obio_eep, 17, 0 }, /* 16 "/obio/eeprom" */  
1286 -+ { propv_obio_auxio, 18, 0 }, /* 17 "/obio/auxio" */  
1287 -+ { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000"  
1288 -+ Must be before zs@0,0! */  
1289 -+ { propv_obio_zs, 20, 0 }, /* 19 "/obio/zs@0,0" */  
1290 -+ { propv_obio_fd, 21, 0 }, /* 20 "/obio/SUNW,fdtwo" */  
1291 -+ { propv_obio_pw, 22, 0 }, /* 21 "/obio/power" */  
1292 -+ { propv_obio_cf, 0, 0 }, /* 22 "/obio/slavioconfig@0,800000" */  
1293 -+ { propv_options, 24, 0 }, /* 23 "/options" */  
1294 -+ { propv_memory, 25, 0 }, /* 24 "/memory" */  
1295 -+ { propv_vmemory, 0, 0 }, /* 25 "/virtual-memory" */  
1296 -+};  
1297 -+  
1298 -+static struct linux_mlist_v0 totphys[MAX_BANKS];  
1299 -+static struct linux_mlist_v0 totmap[1];  
1300 -+static struct linux_mlist_v0 totavail[MAX_BANKS];  
1301 -+  
1302 -+static struct linux_mlist_v0 *ptphys;  
1303 -+static struct linux_mlist_v0 *ptmap;  
1304 -+static struct linux_mlist_v0 *ptavail;  
1305 -+  
1306 -+static const struct linux_nodeops nodeops0 = {  
1307 -+ obp_nextnode, /* int (*no_nextnode)(int node); */  
1308 -+ obp_child, /* int (*no_child)(int node); */  
1309 -+ obp_proplen, /* int (*no_proplen)(int node, char *name); */  
1310 -+ obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */  
1311 -+ obp_setprop, /* int (*no_setprop)(int node, char *name,  
1312 -+ char *val, int len); */  
1313 -+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */  
1314 -+};  
1315 -+  
1316 -+static struct linux_arguments_v0 obp_arg;  
1317 -+static const struct linux_arguments_v0 * const obp_argp = &obp_arg;  
1318 -+  
1319 -+static void (*synch_hook)(void);  
1320 -+static char obp_stdin, obp_stdout;  
1321 -+static int obp_fd_stdin, obp_fd_stdout;  
1322 -+  
1323 -+static int obp_nbgetchar(void);  
1324 -+static int obp_nbputchar(int ch);  
1325 -+static void obp_reboot(char *);  
1326 -+static void obp_abort(void);  
1327 -+static void obp_halt(void);  
1328 -+static int obp_devopen(char *str);  
1329 -+static int obp_devclose(int dev_desc);  
1330 -+static int obp_devread(int dev_desc, char *buf, int nbytes);  
1331 -+static int obp_devwrite(int dev_desc, char *buf, int nbytes);  
1332 -+static int obp_devseek(int dev_desc, int hi, int lo);  
1333 -+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);  
1334 -+static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size);  
1335 -+static void obp_dumb_munmap(char *va, unsigned int size);  
1336 -+static int obp_inst2pkg(int dev_desc);  
1337 -+  
1338 -+static void doublewalk(unsigned ptab1, unsigned va)  
1339 -+{  
1340 -+unsigned int proc_tablewalk(int ctx, unsigned int va);  
1341 -+unsigned int mem_tablewalk(unsigned int pa, unsigned int va);  
1342 -+  
1343 -+ proc_tablewalk(0, va);  
1344 -+ if (ptab1 != 0) mem_tablewalk(ptab1, va);  
1345 -+}  
1346 -+  
1347 -+static struct linux_romvec romvec0;  
1348 -+  
1349 -+struct fd {  
1350 -+ int unit, part;  
1351 -+ int offset;  
1352 -+ int (*pread)(int dev_desc, int offset, char *buf, unsigned int nbytes);  
1353 -+ int (*pwrite)(int dev_desc, int offset, char *buf, unsigned int nbytes);  
1354 -+} fd_table[16];  
1355 -+  
1356 -+static int fd_index;  
1357 -+static int con_pread(int dev_desc, int offset, char *buf, unsigned int nbytes);  
1358 -+static int con_pwrite(int dev_desc, int offset, char *buf, unsigned int nbytes);  
1359 -+  
1360 -+void *  
1361 -+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,  
1362 -+ const char *cmdline, char boot_device, int nographic)  
1363 -+{  
1364 -+ int i;  
1365 -+  
1366 -+ /*  
1367 -+ * Avoid data segment allocations  
1368 -+ */  
1369 -+ ptphys = totphys;  
1370 -+ ptmap = totmap;  
1371 -+ ptavail = totavail;  
1372 -+ /*  
1373 -+ * Form memory descriptors.  
1374 -+ */  
1375 -+ for (i = 0; i < bankc; i++) {  
1376 -+ totphys[i].theres_more = &totphys[i+1];  
1377 -+ totphys[i].start_adr = (char*) bankv[i].start;  
1378 -+ totphys[i].num_bytes = bankv[i].length;  
1379 -+ }  
1380 -+ totphys[i-1].theres_more = 0;  
1381 -+  
1382 -+ /*  
1383 -+ * XXX Merged in normal PROM when full banks touch.  
1384 -+ */  
1385 -+ for (i = 0; i < bankc; i++) {  
1386 -+ unsigned bankbase = bankv[i].start;  
1387 -+ unsigned banksize = bankv[i].length;  
1388 -+ if (hiphybas > bankbase &&  
1389 -+ hiphybas < bankbase + banksize) {  
1390 -+ banksize = hiphybas - bankbase;  
1391 -+ }  
1392 -+ totavail[i].theres_more = &totavail[i+1];  
1393 -+ totavail[i].start_adr = (char*) bankbase;  
1394 -+ totavail[i].num_bytes = banksize;  
1395 -+ }  
1396 -+ totavail[i-1].theres_more = 0;  
1397 -+  
1398 -+ totmap[0].theres_more = 0;  
1399 -+ totmap[0].start_adr = (char*) PROLBASE;  
1400 -+ totmap[0].num_bytes = PROLSIZE;  
1401 -+ prop_mem_reg[0] = 0;  
1402 -+ prop_mem_reg[1] = 0;  
1403 -+ prop_mem_reg[2] = bankv[0].length;  
1404 -+ prop_mem_avail[0] = 0;  
1405 -+ prop_mem_avail[1] = 0;  
1406 -+ prop_mem_avail[2] = hiphybas;  
1407 -+ prop_vmem_avail[0] = 0;  
1408 -+ prop_vmem_avail[1] = 0;  
1409 -+ prop_vmem_avail[2] = PROLBASE-1;  
1410 -+ prop_vmem_avail[3] = 0;  
1411 -+ prop_vmem_avail[4] = 0xffe00000;  
1412 -+ prop_vmem_avail[5] = 0x00200000;  
1413 -+  
1414 -+ /*  
1415 -+ * idprom  
1416 -+ */  
1417 -+ bcopy(idprom, obp_idprom, IDPROM_SIZE);  
1418 -+  
1419 -+ // Linux wants a R/W romvec table  
1420 -+ romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;  
1421 -+ romvec0.pv_romvers = 3;  
1422 -+ romvec0.pv_plugin_revision = 77;  
1423 -+ romvec0.pv_printrev = 0x10203;  
1424 -+ romvec0.pv_v0mem.v0_totphys = &ptphys;  
1425 -+ romvec0.pv_v0mem.v0_prommap = &ptmap;  
1426 -+ romvec0.pv_v0mem.v0_available = &ptavail;  
1427 -+ romvec0.pv_nodeops = &nodeops0;  
1428 -+ romvec0.pv_bootstr = (void *)doublewalk;  
1429 -+ romvec0.pv_v0devops.v0_devopen = &obp_devopen;  
1430 -+ romvec0.pv_v0devops.v0_devclose = &obp_devclose;  
1431 -+ romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;  
1432 -+ romvec0.pv_stdin = &obp_stdin;  
1433 -+ romvec0.pv_stdout = &obp_stdout;  
1434 -+ romvec0.pv_getchar = obp_nbgetchar;  
1435 -+ romvec0.pv_putchar = (void (*)(int))obp_nbputchar;  
1436 -+ romvec0.pv_nbgetchar = obp_nbgetchar;  
1437 -+ romvec0.pv_nbputchar = obp_nbputchar;  
1438 -+ romvec0.pv_reboot = obp_reboot;  
1439 -+ romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;  
1440 -+ romvec0.pv_abort = obp_abort;  
1441 -+ romvec0.pv_halt = obp_halt;  
1442 -+ romvec0.pv_synchook = &synch_hook;  
1443 -+ romvec0.pv_v0bootargs = &obp_argp;  
1444 -+ romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg;  
1445 -+ romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;  
1446 -+ romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;  
1447 -+ romvec0.pv_v2devops.v2_dev_open = obp_devopen;  
1448 -+ romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose;  
1449 -+ romvec0.pv_v2devops.v2_dev_read = obp_devread;  
1450 -+ romvec0.pv_v2devops.v2_dev_write = obp_devwrite;  
1451 -+ romvec0.pv_v2devops.v2_dev_seek = obp_devseek;  
1452 -+ obp_arg.boot_dev_ctrl = 0;  
1453 -+ obp_arg.boot_dev_unit = '0';  
1454 -+ obp_arg.argv[0] = "sd(0,0,0):d";  
1455 -+ switch(boot_device) {  
1456 -+ default:  
1457 -+ case 'a':  
1458 -+ obp_arg.argv[0] = "fd()";  
1459 -+ obp_arg.boot_dev[0] = 'f';  
1460 -+ obp_arg.boot_dev[1] = 'd';  
1461 -+ break;  
1462 -+ case 'd':  
1463 -+ obp_arg.boot_dev_unit = '2';  
1464 -+ obp_arg.argv[0] = "sd(0,2,0):d";  
1465 -+ // Fall through  
1466 -+ case 'c':  
1467 -+ obp_arg.boot_dev[0] = 's';  
1468 -+ obp_arg.boot_dev[1] = 'd';  
1469 -+ break;  
1470 -+ case 'n':  
1471 -+ obp_arg.argv[0] = "le()";  
1472 -+ obp_arg.boot_dev[0] = 'l';  
1473 -+ obp_arg.boot_dev[1] = 'e';  
1474 -+ break;  
1475 -+ }  
1476 -+ obp_arg.argv[1] = cmdline;  
1477 -+ romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];  
1478 -+ romvec0.pv_v2bootargs.bootargs = &cmdline;  
1479 -+ romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;  
1480 -+ romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;  
1481 -+  
1482 -+ bcopy(propv_root_templ, propv_root, sizeof(propv_root_templ));  
1483 -+ propv_root[4].name = "stdin-path";  
1484 -+ propv_root[5].name = "stdout-path";  
1485 -+ obp_fd_stdin = 0;  
1486 -+ obp_fd_stdout = 1;  
1487 -+ fd_table[0].pread = con_pread;  
1488 -+ fd_table[0].pwrite = con_pwrite;  
1489 -+ fd_table[1].pread = con_pread;  
1490 -+ fd_table[1].pwrite = con_pwrite;  
1491 -+ fd_index = 2;  
1492 -+ if (nographic) {  
1493 -+ obp_stdin = PROMDEV_TTYA;  
1494 -+ propv_root[4].value = "/obio/zs@0,100000:a";  
1495 -+ propv_root[4].length = sizeof("/obio/zs@0,100000:a");  
1496 -+ fd_table[0].unit = 18;  
1497 -+ obp_stdout = PROMDEV_TTYA;  
1498 -+ propv_root[5].value = "/obio/zs@0,100000:a";  
1499 -+ propv_root[5].length = sizeof("/obio/zs@0,100000:a");  
1500 -+ fd_table[1].unit = 18;  
1501 -+ } else {  
1502 -+ obp_stdin = PROMDEV_KBD;  
1503 -+ propv_root[4].value = "/obio/zs@0,0";  
1504 -+ propv_root[4].length = sizeof("/obio/zs@0,0");  
1505 -+ fd_table[0].unit = 19;  
1506 -+ obp_stdout = PROMDEV_SCREEN;  
1507 -+ propv_root[5].value = "/iommu/sbus/SUNW,tcx";  
1508 -+ propv_root[5].length = sizeof("/iommu/sbus/SUNW,tcx");  
1509 -+ fd_table[1].unit = 4;  
1510 -+ }  
1511 -+ prop_zs_addr = map_io(0x71000000, 8);  
1512 -+ prop_zs1_addr = map_io(0x71100000, 8);  
1513 -+ return &romvec0;  
1514 -+}  
1515 -+  
1516 -+static const struct property *find_property(int node,char *name)  
1517 -+{  
1518 -+ const struct property *prop = &nodes[node].properties[0];  
1519 -+ while (prop && prop->name) {  
1520 -+ if (bcmp(prop->name, name, 128) == 0) return prop;  
1521 -+ prop++;  
1522 -+ }  
1523 -+ return NULL;  
1524 -+}  
1525 -+  
1526 -+static int obp_nextnode(int node)  
1527 -+{  
1528 -+#ifdef DEBUG_OBP  
1529 -+ printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);  
1530 -+#endif  
1531 -+ return nodes[node].sibling;  
1532 -+}  
1533 -+  
1534 -+static int obp_child(int node)  
1535 -+{  
1536 -+#ifdef DEBUG_OBP  
1537 -+ printk("obp_child(%d) = %d\n", node, nodes[node].child);  
1538 -+#endif  
1539 -+ return nodes[node].child;  
1540 -+}  
1541 -+  
1542 -+static int obp_proplen(int node, char *name)  
1543 -+{  
1544 -+ const struct property *prop = find_property(node,name);  
1545 -+ if (prop) {  
1546 -+#ifdef DEBUG_OBP  
1547 -+ printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);  
1548 -+#endif  
1549 -+ return prop->length;  
1550 -+ }  
1551 -+#ifdef DEBUG_OBP  
1552 -+ printk("obp_proplen(%d, %s) (no prop)\n", node, name);  
1553 -+#endif  
1554 -+ return -1;  
1555 -+}  
1556 -+  
1557 -+static int obp_getprop(int node, char *name, char *value)  
1558 -+{  
1559 -+ const struct property *prop;  
1560 -+  
1561 -+ if (!name) {  
1562 -+ // NULL name means get first property  
1563 -+#ifdef DEBUG_OBP  
1564 -+ printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name,  
1565 -+ nodes[node].properties[0].name);  
1566 -+#endif  
1567 -+ return (int)nodes[node].properties[0].name;  
1568 -+ }  
1569 -+ prop = find_property(node,name);  
1570 -+ if (prop) {  
1571 -+ memcpy(value,prop->value,prop->length);  
1572 -+#ifdef DEBUG_OBP  
1573 -+ printk("obp_getprop(%d, %s) = %s\n", node, name, value);  
1574 -+#endif  
1575 -+ return prop->length;  
1576 -+ }  
1577 -+#ifdef DEBUG_OBP  
1578 -+ printk("obp_getprop(%d, %s): not found\n", node, name);  
1579 -+#endif  
1580 -+ return -1;  
1581 -+}  
1582 -+  
1583 -+static int obp_setprop(__attribute__((unused)) int node,  
1584 -+ __attribute__((unused)) char *name,  
1585 -+ __attribute__((unused)) char *value,  
1586 -+ __attribute__((unused)) int len)  
1587 -+{  
1588 -+#ifdef DEBUG_OBP  
1589 -+ printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);  
1590 -+#endif  
1591 -+ return -1;  
1592 -+}  
1593 -+  
1594 -+static const char *obp_nextprop(int node,char *name)  
1595 -+{  
1596 -+ const struct property *prop;  
1597 -+  
1598 -+ if (!name || *name == '\0') {  
1599 -+ // NULL name means get first property  
1600 -+#ifdef DEBUG_OBP  
1601 -+ printk("obp_nextprop(%d, NULL) = %s\n", node,  
1602 -+ nodes[node].properties[0].name);  
1603 -+#endif  
1604 -+ return nodes[node].properties[0].name;  
1605 -+ }  
1606 -+ prop = find_property(node,name);  
1607 -+ if (prop && prop[1].name) {  
1608 -+#ifdef DEBUG_OBP  
1609 -+ printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);  
1610 -+#endif  
1611 -+ return prop[1].name;  
1612 -+ }  
1613 -+#ifdef DEBUG_OBP  
1614 -+ printk("obp_nextprop(%d, %s): not found\n", node, name);  
1615 -+#endif  
1616 -+ return "";  
1617 -+}  
1618 -+  
1619 -+extern int (*getch_fn)(struct vconterm *v);  
1620 -+  
1621 -+static int obp_nbgetchar(void) {  
1622 -+ extern struct vconterm dp0;  
1623 -+ return getch_fn(&dp0);  
1624 -+}  
1625 -+  
1626 -+static int obp_nbputchar(int ch) {  
1627 -+ printk("%c", ch);  
1628 -+ return 0;  
1629 -+}  
1630 -+  
1631 -+static void obp_reboot(char *str) {  
1632 -+ printk("rebooting (%s)\n", str);  
1633 -+ stb_bypass(0x71f00000, 1);  
1634 -+ for (;;) {}  
1635 -+}  
1636 -+  
1637 -+static void obp_abort() {  
1638 -+ printk("abort, power off\n");  
1639 -+ stb_bypass(0x71910000, 1);  
1640 -+ for (;;) {}  
1641 -+}  
1642 -+  
1643 -+static void obp_halt() {  
1644 -+ printk("halt, power off\n");  
1645 -+ stb_bypass(0x71910000, 1);  
1646 -+ for (;;) {}  
1647 -+}  
1648 -+  
1649 -+extern void *esp_read(int unit, int part, int offset, short len);  
1650 -+  
1651 -+static int esp_pread(int dev_desc, int offset, char *buf, unsigned int nbytes)  
1652 -+{  
1653 -+ unsigned int i;  
1654 -+ void *src;  
1655 -+  
1656 -+ for(i = 0; i < nbytes; i += 512) {  
1657 -+ src = esp_read(fd_table[dev_desc].unit, fd_table[dev_desc].part, (offset + i) / 512, 512);  
1658 -+ memcpy(&buf[i], src, 512);  
1659 -+ }  
1660 -+ return nbytes;  
1661 -+}  
1662 -+  
1663 -+static int con_pread(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)  
1664 -+{  
1665 -+ unsigned int i;  
1666 -+  
1667 -+ for(i = 0; i < nbytes; i ++) {  
1668 -+ buf[i] = obp_nbgetchar();  
1669 -+ }  
1670 -+ return nbytes;  
1671 -+}  
1672 -+  
1673 -+static int con_pwrite(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)  
1674 -+{  
1675 -+ unsigned int i;  
1676 -+  
1677 -+ for(i = 0; i < nbytes; i ++) {  
1678 -+ obp_nbputchar(buf[i]);  
1679 -+ }  
1680 -+ return nbytes;  
1681 -+}  
1682 -+  
1683 -+#define isnum(c) ((c >= '0') && (c < '9'))  
1684 -+#define ctoi(c) (c - '0')  
1685 -+  
1686 -+static int obp_devopen(char *str) {  
1687 -+#ifdef DEBUG_OBP  
1688 -+ printk("obp_devopen(%s)\n", str);  
1689 -+#endif  
1690 -+ if (str[0] == 's' && str[1] == 'd' && str[4] == ',') {  
1691 -+ unsigned int target;  
1692 -+  
1693 -+ if (str[5] < 7)  
1694 -+ target = str[5];  
1695 -+ else if (isnum(str[6]) && isnum(str[5])) {  
1696 -+ target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7;  
1697 -+ }  
1698 -+ else {  
1699 -+ target = ctoi(str[5]) & 7;  
1700 -+ }  
1701 -+ fd_table[fd_index].unit = target;  
1702 -+ fd_table[fd_index].part = str[10] - 'a';  
1703 -+ fd_table[fd_index].pread = esp_pread;  
1704 -+ return fd_index++; // XXX  
1705 -+ }  
1706 -+ return 0;  
1707 -+}  
1708 -+  
1709 -+static int obp_devclose(__attribute__((unused)) int dev_desc) {  
1710 -+#ifdef DEBUG_OBP  
1711 -+ printk("obp_devclose %d\n", dev_desc);  
1712 -+#endif  
1713 -+ fd_index--; // XXX  
1714 -+ return 0;  
1715 -+}  
1716 -+  
1717 -+static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)  
1718 -+{  
1719 -+#ifdef DEBUG_OBP  
1720 -+ printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);  
1721 -+#endif  
1722 -+ return fd_table[dev_desc].pread(dev_desc, offset, buf, num_blks * 512);  
1723 -+}  
1724 -+  
1725 -+static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,  
1726 -+ unsigned int pa, unsigned int size)  
1727 -+{  
1728 -+ unsigned int npages;  
1729 -+ unsigned int off;  
1730 -+ unsigned int mva;  
1731 -+  
1732 -+#ifdef DEBUG_OBP  
1733 -+ printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);  
1734 -+#endif  
1735 -+ off = pa & (PAGE_SIZE-1);  
1736 -+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;  
1737 -+ pa &= ~(PAGE_SIZE-1);  
1738 -+  
1739 -+ mva = (unsigned int) va;  
1740 -+ while (npages-- != 0) {  
1741 -+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas);  
1742 -+ mva += PAGE_SIZE;  
1743 -+ pa += PAGE_SIZE;  
1744 -+ }  
1745 -+ return va;  
1746 -+}  
1747 -+  
1748 -+static void obp_dumb_munmap(__attribute__((unused)) char *va,  
1749 -+ __attribute__((unused)) unsigned int size)  
1750 -+{  
1751 -+#ifdef DEBUG_OBP  
1752 -+ printk("obp_dumb_munmap: virta %x, sz %d\n", va, size);  
1753 -+#endif  
1754 -+}  
1755 -+  
1756 -+static int obp_devread(int dev_desc, char *buf, int nbytes)  
1757 -+{  
1758 -+ int ret;  
1759 -+#ifdef DEBUG_OBP  
1760 -+ printk("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes);  
1761 -+#endif  
1762 -+ ret = fd_table[dev_desc].pread(dev_desc, fd_table[dev_desc].offset, buf, nbytes);  
1763 -+ fd_table[dev_desc].offset += nbytes;  
1764 -+ return ret;  
1765 -+}  
1766 -+  
1767 -+static int obp_devwrite(int dev_desc, char *buf, int nbytes)  
1768 -+{  
1769 -+ int ret;  
1770 -+#ifdef DEBUG_OBP  
1771 -+ printk("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes);  
1772 -+#endif  
1773 -+ ret = fd_table[dev_desc].pwrite(dev_desc, fd_table[dev_desc].offset, buf, nbytes);  
1774 -+ fd_table[dev_desc].offset += nbytes;  
1775 -+ return ret;  
1776 -+}  
1777 -+  
1778 -+static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo)  
1779 -+{  
1780 -+#ifdef DEBUG_OBP  
1781 -+ printk("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo);  
1782 -+#endif  
1783 -+ fd_table[dev_desc].offset = lo;  
1784 -+ return 0;  
1785 -+}  
1786 -+  
1787 -+static int obp_inst2pkg(int dev_desc)  
1788 -+{  
1789 -+#ifdef DEBUG_OBP  
1790 -+ printk("obp_inst2pkg: fd %d\n", dev_desc);  
1791 -+#endif  
1792 -+ return fd_table[dev_desc].unit;  
1793 -+}  
1794 -diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch-15/qemu/system_qemu.c  
1795 ---- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000  
1796 -+++ proll-patch-15/qemu/system_qemu.c 2005-04-16 06:16:20.000000000 +0000  
1797 -@@ -0,0 +1,430 @@  
1798 -+/**  
1799 -+ ** Proll (PROM replacement)  
1800 -+ ** system.c: shared miscallenea.  
1801 -+ ** Copyright 1999 Pete Zaitcev  
1802 -+ ** This code is licensed under GNU General Public License.  
1803 -+ **/  
1804 -+#include <stdarg.h>  
1805 -+#include <asi.h>  
1806 -+#include <crs.h>  
1807 -+#ifndef NULL  
1808 -+#define NULL ((void*)0)  
1809 -+#endif  
1810 -+  
1811 -+#include "pgtsrmmu.h"  
1812 -+  
1813 -+#include "vconsole.h"  
1814 -+#include <timer.h> /* Local copy of 2.2 style include */  
1815 -+#include <general.h> /* __P() */  
1816 -+#include <net.h> /* init_net() */  
1817 -+#include <romlib.h> /* we are a provider for part of this. */  
1818 -+#include <netpriv.h> /* myipaddr */  
1819 -+#include <arpa.h>  
1820 -+#include <system.h> /* our own prototypes */  
1821 -+  
1822 -+/*  
1823 -+ * We export this.  
1824 -+ */  
1825 -+char idprom[IDPROM_SIZE];  
1826 -+  
1827 -+  
1828 -+/*  
1829 -+ * Create an I/O mapping to pa[size].  
1830 -+ * Returns va of the mapping or 0 if unsuccessful.  
1831 -+ */  
1832 -+void *  
1833 -+map_io(unsigned pa, int size)  
1834 -+{  
1835 -+ void *va;  
1836 -+ unsigned int npages;  
1837 -+ unsigned int off;  
1838 -+ unsigned int mva;  
1839 -+  
1840 -+ off = pa & (PAGE_SIZE-1);  
1841 -+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;  
1842 -+ pa &= ~(PAGE_SIZE-1);  
1843 -+  
1844 -+ va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);  
1845 -+ if (va == 0) return va;  
1846 -+  
1847 -+ mva = (unsigned int) va;  
1848 -+ /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */  
1849 -+ while (npages-- != 0) {  
1850 -+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas);  
1851 -+ mva += PAGE_SIZE;  
1852 -+ pa += PAGE_SIZE;  
1853 -+ }  
1854 -+  
1855 -+ return (void *)((unsigned int)va + off);  
1856 -+}  
1857 -+  
1858 -+/*  
1859 -+ * Tablewalk routine used for testing.  
1860 -+ * Returns PTP/PTE.  
1861 -+ */  
1862 -+unsigned int  
1863 -+proc_tablewalk(int ctx, unsigned int va)  
1864 -+{  
1865 -+ unsigned int pa1;  
1866 -+  
1867 -+ __asm__ __volatile__ ("lda [%1] %2, %0" :  
1868 -+ "=r" (pa1) :  
1869 -+ "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));  
1870 -+ /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */  
1871 -+ pa1 <<= 4;  
1872 -+ pa1 = ld_bypass(pa1 + (ctx << 2));  
1873 -+ if ((pa1 & 0x03) == 0) goto invalid;  
1874 -+ return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);  
1875 -+  
1876 -+invalid:  
1877 -+ printk(" invalid %x\n", pa1);  
1878 -+ return 0;  
1879 -+}  
1880 -+  
1881 -+/*  
1882 -+ * Walk the tables in memory, starting at physical address pa.  
1883 -+ */  
1884 -+unsigned int  
1885 -+mem_tablewalk(unsigned int pa, unsigned int va)  
1886 -+{  
1887 -+ unsigned int pa1;  
1888 -+  
1889 -+ printk("pa %x va %x", pa, va);  
1890 -+ pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));  
1891 -+ if ((pa1 & 0x03) == 0) goto invalid;  
1892 -+ printk(" l1 %x", pa1);  
1893 -+ pa1 <<= 4; pa1 &= 0xFFFFFF00;  
1894 -+ pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));  
1895 -+ if ((pa1 & 0x03) == 0) goto invalid;  
1896 -+ printk(" l2 %x", pa1);  
1897 -+ pa1 <<= 4; pa1 &= 0xFFFFFF00;  
1898 -+ pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));  
1899 -+ if ((pa1 & 0x03) == 0) goto invalid;  
1900 -+ printk(" l3 %x", pa1);  
1901 -+ printk(" off %x\n", va&0x00000FFF);  
1902 -+ return pa1;  
1903 -+invalid:  
1904 -+ printk(" invalid %x\n", pa1);  
1905 -+ return 0;  
1906 -+}  
1907 -+  
1908 -+/*  
1909 -+ * Make CPU page tables.  
1910 -+ * Returns pointer to context table.  
1911 -+ * Here we ignore memory allocation errors which "should not happen"  
1912 -+ * because we cannot print anything anyways if memory initialization fails.  
1913 -+ */  
1914 -+void makepages(struct phym *t, unsigned int highbase)  
1915 -+{  
1916 -+ unsigned int *ctp, *l1, pte;  
1917 -+ int i;  
1918 -+ unsigned int pa, va;  
1919 -+  
1920 -+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));  
1921 -+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));  
1922 -+  
1923 -+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);  
1924 -+ for (i = 0; i < NCTX_SWIFT; i++) {  
1925 -+ ctp[i] = pte;  
1926 -+ }  
1927 -+  
1928 -+ pa = PROLBASE;  
1929 -+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {  
1930 -+ map_page(l1, va, pa, 0, highbase);  
1931 -+ pa += PAGE_SIZE;  
1932 -+ }  
1933 -+ pa = highbase + PROLDATA - PROLBASE;  
1934 -+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {  
1935 -+ map_page(l1, va, pa, 0, highbase);  
1936 -+ pa += PAGE_SIZE;  
1937 -+ }  
1938 -+  
1939 -+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */  
1940 -+ pa = 0;  
1941 -+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {  
1942 -+ map_page(l1, va, pa, 0, highbase);  
1943 -+ pa += PAGE_SIZE;  
1944 -+ }  
1945 -+  
1946 -+ t->pctp = ctp;  
1947 -+ t->pl1 = l1;  
1948 -+ t->pbas = highbase;  
1949 -+}  
1950 -+  
1951 -+/*  
1952 -+ * Create a memory mapping from va to epa in page table pgd.  
1953 -+ * highbase is used for v2p translation.  
1954 -+ */  
1955 -+int  
1956 -+map_page(unsigned int *pgd, unsigned int va,  
1957 -+ unsigned int epa, int type, unsigned int highbase)  
1958 -+{  
1959 -+ unsigned int pte;  
1960 -+ unsigned int *p;  
1961 -+ unsigned int pa;  
1962 -+  
1963 -+ pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];  
1964 -+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {  
1965 -+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),  
1966 -+ SRMMU_PTRS_PER_PMD*sizeof(int));  
1967 -+ if (p == 0) goto drop;  
1968 -+ pte = SRMMU_ET_PTD |  
1969 -+ (((unsigned int)p - PROLBASE + highbase) >> 4);  
1970 -+ pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;  
1971 -+ /* barrier() */  
1972 -+ }  
1973 -+  
1974 -+ pa = ((pte & 0xFFFFFFF0) << 4);  
1975 -+ pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);  
1976 -+ pte = ld_bypass(pa);  
1977 -+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {  
1978 -+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),  
1979 -+ SRMMU_PTRS_PER_PTE*sizeof(int));  
1980 -+ if (p == 0) goto drop;  
1981 -+ pte = SRMMU_ET_PTD |  
1982 -+ (((unsigned int)p - PROLBASE + highbase) >> 4);  
1983 -+ st_bypass(pa, pte);  
1984 -+ }  
1985 -+  
1986 -+ pa = ((pte & 0xFFFFFFF0) << 4);  
1987 -+ pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);  
1988 -+  
1989 -+ pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);  
1990 -+ if (type) { /* I/O */  
1991 -+ pte |= SRMMU_REF;  
1992 -+ /* SRMMU cannot make Supervisor-only, but not exectutable */  
1993 -+ pte |= SRMMU_PRIV;  
1994 -+ } else { /* memory */  
1995 -+ pte |= SRMMU_REF|SRMMU_CACHE;  
1996 -+ pte |= SRMMU_PRIV; /* Supervisor only access */  
1997 -+ }  
1998 -+ st_bypass(pa, pte);  
1999 -+ return 0;  
2000 -+  
2001 -+drop:  
2002 -+ return -1;  
2003 -+}  
2004 -+  
2005 -+/*  
2006 -+ * Switch page tables.  
2007 -+ */  
2008 -+void  
2009 -+init_mmu_swift(unsigned int ctp_phy)  
2010 -+{  
2011 -+ unsigned int addr;  
2012 -+  
2013 -+ /*  
2014 -+ * Flush cache  
2015 -+ */  
2016 -+ for (addr = 0; addr < 0x2000; addr += 0x10) {  
2017 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :  
2018 -+ "r" (addr), "i" (ASI_M_DATAC_TAG));  
2019 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :  
2020 -+ "r" (addr<<1), "i" (ASI_M_TXTC_TAG));  
2021 -+ }  
2022 -+  
2023 -+ /*  
2024 -+ * Switch ctx table  
2025 -+ */  
2026 -+ ctp_phy >>= 4;  
2027 -+ /* printk("done flushing, switching to %x\n", ctp_phy); */  
2028 -+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :  
2029 -+ "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));  
2030 -+  
2031 -+ /*  
2032 -+ * Flush old page table references  
2033 -+ */  
2034 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :  
2035 -+ "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");  
2036 -+}  
2037 -+  
2038 -+/*  
2039 -+ * add_timer, del_timer  
2040 -+ * This should go into sched.c, but we have it split for different archs.  
2041 -+ */  
2042 -+struct timer_list_head {  
2043 -+ struct timer_list *head, *tail;  
2044 -+};  
2045 -+  
2046 -+static struct timer_list_head timers; /* Anonymous heap of timers */  
2047 -+  
2048 -+void add_timer(struct timer_list *timer) {  
2049 -+ struct timer_list *p;  
2050 -+ if (timer->prev != NULL || timer->next != NULL) {  
2051 -+ printk("bug: kernel timer added twice at 0x%x.\n",  
2052 -+ __builtin_return_address(0));  
2053 -+ return;  
2054 -+ }  
2055 -+ if ((p = timers.tail) != NULL) {  
2056 -+ timer->prev = p;  
2057 -+ p->next = timer;  
2058 -+ timers.tail = timer;  
2059 -+ } else {  
2060 -+ timers.head = timer;  
2061 -+ timers.tail = timer;  
2062 -+ }  
2063 -+ return;  
2064 -+}  
2065 -+  
2066 -+int del_timer(struct timer_list *timer) {  
2067 -+ struct timer_list *p;  
2068 -+ int ret;  
2069 -+  
2070 -+ if (timers.head == timer) timers.head = timer->next;  
2071 -+ if (timers.tail == timer) timers.tail = timer->prev;  
2072 -+ if ((p = timer->prev) != NULL) p->next = timer->next;  
2073 -+ if ((p = timer->next) != NULL) p->prev = timer->prev;  
2074 -+ ret = timer->next != 0 || timer->prev != 0;  
2075 -+ timer->next = NULL;  
2076 -+ timer->prev = NULL;  
2077 -+ return ret;  
2078 -+}  
2079 -+  
2080 -+void run_timers() {  
2081 -+ struct timer_list *p;  
2082 -+  
2083 -+ p = timers.head;  
2084 -+ while (p != NULL) {  
2085 -+ if (p->expires < jiffies) {  
2086 -+ del_timer(p); /* XXX make nonstatic member */  
2087 -+ (*p->function)(p->data);  
2088 -+ p = timers.head;  
2089 -+ } else {  
2090 -+ p = p->next;  
2091 -+ }  
2092 -+ }  
2093 -+}  
2094 -+  
2095 -+/*  
2096 -+ * Allocate memory. This is reusable.  
2097 -+ */  
2098 -+void mem_init(struct mem *t, char *begin, char *limit)  
2099 -+{  
2100 -+ t->start = begin;  
2101 -+ t->uplim = limit;  
2102 -+ t->curp = begin;  
2103 -+}  
2104 -+  
2105 -+void mem_fini(struct mem *t)  
2106 -+{  
2107 -+ t->curp = 0;  
2108 -+}  
2109 -+  
2110 -+void *mem_alloc(struct mem *t, int size, int align)  
2111 -+{  
2112 -+ char *p;  
2113 -+  
2114 -+ p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));  
2115 -+ if (p >= t->uplim || p + size > t->uplim) return 0;  
2116 -+ t->curp = p + size;  
2117 -+ return p;  
2118 -+}  
2119 -+  
2120 -+void *mem_zalloc(struct mem *t, int size, int align)  
2121 -+{  
2122 -+ char *p;  
2123 -+  
2124 -+ if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);  
2125 -+ return p;  
2126 -+}  
2127 -+  
2128 -+/*  
2129 -+ * Library functions  
2130 -+ */  
2131 -+void *memset(void *s, int c, size_t len)  
2132 -+{  
2133 -+ void *p = s;  
2134 -+  
2135 -+ while (len--) {  
2136 -+ *(char *)s = c;  
2137 -+ s++;  
2138 -+ }  
2139 -+ return p;  
2140 -+}  
2141 -+  
2142 -+void bcopy(const void *f, void *t, int len) {  
2143 -+ while (len--) {  
2144 -+ *(char *)t = *(char *)f;  
2145 -+ f++;  
2146 -+ t++;  
2147 -+ }  
2148 -+}  
2149 -+  
2150 -+/* Comparison is 7-bit */  
2151 -+int bcmp(const void *s1, const void *s2, int len)  
2152 -+{  
2153 -+ int i;  
2154 -+ char ch;  
2155 -+  
2156 -+ while (len--) {  
2157 -+ ch = *(char *)s1;  
2158 -+ i = ch - *(char *)s2;  
2159 -+ s1++;  
2160 -+ s2++;  
2161 -+ if (i != 0)  
2162 -+ return i;  
2163 -+ if (ch == 0)  
2164 -+ return 0;  
2165 -+ }  
2166 -+ return 0;  
2167 -+}  
2168 -+  
2169 -+int strlen(const char *s) {  
2170 -+ const char *p;  
2171 -+ for (p = s; *p != 0; p++) { }  
2172 -+ return p - s;  
2173 -+}  
2174 -+  
2175 -+extern void *printk_fn;  
2176 -+  
2177 -+void printk(char *fmt, ...)  
2178 -+{  
2179 -+ struct prf_fp {  
2180 -+ void *xfp;  
2181 -+ void (*write)(void *, char *, int);  
2182 -+ } prfa;  
2183 -+ extern void prf(struct prf_fp *, char *fmt, va_list adx);  
2184 -+ va_list x1;  
2185 -+  
2186 -+ va_start(x1, fmt);  
2187 -+ prfa.xfp = &dp0;  
2188 -+ prfa.write = printk_fn;  
2189 -+ prf(&prfa, fmt, x1);  
2190 -+ va_end(x1);  
2191 -+}  
2192 -+  
2193 -+void fatal()  
2194 -+{  
2195 -+ printk("fatal.");  
2196 -+loop: goto loop;  
2197 -+}  
2198 -+  
2199 -+/*  
2200 -+ * Get the highest bit number from the mask.  
2201 -+ */  
2202 -+int highc(int mask, int size)  
2203 -+{  
2204 -+ int m1;  
2205 -+  
2206 -+ m1 = 1 << size;  
2207 -+ while (size != 0) {  
2208 -+ size--;  
2209 -+ m1 >>= 1;  
2210 -+ if (m1 & mask) break;  
2211 -+ }  
2212 -+ return size;  
2213 -+}  
2214 -+  
2215 -+/*  
2216 -+ */  
2217 -+unsigned int ld_bp_swap(unsigned int ptr) {  
2218 -+ unsigned int n;  
2219 -+ n = ld_bypass(ptr);  
2220 -+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);  
2221 -+ return n;  
2222 -+}  
2223 -+  
2224 -+void st_bp_swap(unsigned int ptr, unsigned int n) {  
2225 -+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);  
2226 -+ st_bypass(ptr, n);  
2227 -+};  
2228 -diff -ruN proll_18.orig/src/arp.c proll-patch-15/src/arp.c  
2229 ---- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000  
2230 -+++ proll-patch-15/src/arp.c 2005-08-14 10:10:11.000000000 +0000  
2231 -@@ -45,7 +45,7 @@  
2232 - #endif  
2233 - static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */  
2234 - static int next_arp; /* next table entry */  
2235 --static t_ipaddr def_gw = IP_ANY; /* default routing */  
2236 -+static t_ipaddr def_gw; /* default routing */  
2237 -  
2238 -  
2239 -  
2240 -@@ -100,10 +100,7 @@  
2241 - *  
2242 - * ARP receiver routine  
2243 - */  
2244 --static int arp_recv(buf, bufsize, addr)  
2245 --unsigned char *buf;  
2246 --int bufsize;  
2247 --unsigned char *addr;  
2248 -+static int arp_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)  
2249 - {  
2250 - register struct arphdr *ahp = (struct arphdr *)buf;  
2251 -  
2252 -@@ -144,7 +141,7 @@  
2253 - *  
2254 - * Resolve IP address and return pointer to hardware address.  
2255 - */  
2256 --unsigned char *ip_resolve(ip)  
2257 -+const unsigned char *ip_resolve(ip)  
2258 - t_ipaddr ip;  
2259 - {  
2260 - int i;  
2261 -@@ -230,14 +227,11 @@  
2262 - */  
2263 - int init_arp()  
2264 - {  
2265 -- /* Set name of module for error messages */  
2266 -- net_module_name = "arp";  
2267 --  
2268 - #ifndef NOARP  
2269 - /* Register ARP packet type and set send buffer pointer */  
2270 - if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)  
2271 - return(FALSE);  
2272 - #endif  
2273 --  
2274 -+ def_gw = IP_ANY;  
2275 - return(TRUE);  
2276 - }  
2277 -diff -ruN proll_18.orig/src/arp.h proll-patch-15/src/arp.h  
2278 ---- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000  
2279 -+++ proll-patch-15/src/arp.h 2004-11-13 15:50:49.000000000 +0000  
2280 -@@ -104,7 +104,7 @@  
2281 - extern int init_arp __P((void));  
2282 -  
2283 - /* Resolve IP address and return pointer to hardware address */  
2284 --extern unsigned char *ip_resolve __P((t_ipaddr ip));  
2285 -+extern const unsigned char *ip_resolve __P((t_ipaddr ip));  
2286 -  
2287 - /* Add a new antry to the ARP cache */  
2288 - extern void addcache __P((unsigned char *ha, t_ipaddr ip));  
2289 -diff -ruN proll_18.orig/src/bootp.c proll-patch-15/src/bootp.c  
2290 ---- proll_18.orig/src/bootp.c 1999-12-15 17:20:30.000000000 +0000  
2291 -+++ proll-patch-15/src/bootp.c 2005-08-14 10:16:09.000000000 +0000  
2292 -@@ -151,7 +151,7 @@  
2293 - while (TRUE) {  
2294 - boot_xid = get_ticks() + random();  
2295 - bootp_send();  
2296 -- i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout, CHR_ESC);  
2297 -+ i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout);  
2298 - if (i < 0) { /* user pressed ESC */  
2299 - printf("\nAborted\n");  
2300 - return(1);  
2301 -diff -ruN proll_18.orig/src/esp.c proll-patch-15/src/esp.c  
2302 ---- proll_18.orig/src/esp.c 1970-01-01 00:00:00.000000000 +0000  
2303 -+++ proll-patch-15/src/esp.c 2005-08-15 18:42:46.000000000 +0000  
2304 -@@ -0,0 +1,305 @@  
2305 -+#include <system.h> /* == <asm/system.h> */  
2306 -+#include <general.h> /* __P for netpriv.h */  
2307 -+#include <dma.h> /* dmaga */  
2308 -+#include <romlib.h>  
2309 -+  
2310 -+#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */  
2311 -+#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */  
2312 -+#define PHYS_JJ_ESP_IRQ 4  
2313 -+#define BUFSIZE 4096  
2314 -+/*  
2315 -+ * XXX Crude  
2316 -+ */  
2317 -+struct esp_dma {  
2318 -+ struct sparc_dma_registers *regs;  
2319 -+ enum dvma_rev revision;  
2320 -+};  
2321 -+  
2322 -+struct esp_regs {  
2323 -+ unsigned int regs[16];  
2324 -+};  
2325 -+  
2326 -+struct esp_private {  
2327 -+ int active; /* initialized */  
2328 -+ int inst; /* iface number */  
2329 -+  
2330 -+ volatile struct esp_regs *ll;  
2331 -+ __u32 buffer_dvma;  
2332 -+ unsigned int irq; /* device IRQ number */  
2333 -+ int interrupt;  
2334 -+  
2335 -+ struct esp_dma *espdma; /* If set this points to espdma */  
2336 -+  
2337 -+ unsigned char *buffer;  
2338 -+ struct disk_info {  
2339 -+ unsigned int hw_sector;  
2340 -+ unsigned int part_offset[8];  
2341 -+ } disk[8];  
2342 -+};  
2343 -+  
2344 -+static void esp_interrupt(void *dev_id)  
2345 -+{  
2346 -+ struct esp_private *lp = (struct esp_private *)dev_id;  
2347 -+  
2348 -+ lp->interrupt = 1;  
2349 -+ /* Acknowledge all the interrupt sources ASAP */  
2350 -+  
2351 -+ lp->interrupt = 0;  
2352 -+}  
2353 -+  
2354 -+static int esp_open (void *dev)  
2355 -+{  
2356 -+ struct esp_private *lp = (struct esp_private *)dev;  
2357 -+ int status = 0;  
2358 -+  
2359 -+ if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) {  
2360 -+ printk ("Esp: Can't get irq %d\n", lp->irq);  
2361 -+ return -1;  
2362 -+ }  
2363 -+  
2364 -+ /* On the 4m, setup the espdma to provide the upper bits for buffers */  
2365 -+ if (lp->espdma)  
2366 -+ lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000;  
2367 -+  
2368 -+ return status;  
2369 -+}  
2370 -+  
2371 -+static int esp_close (void *dev)  
2372 -+{  
2373 -+ struct esp_private *lp = (struct esp_private *)dev;  
2374 -+  
2375 -+ free_irq (lp->irq, (void *) dev);  
2376 -+ return 0;  
2377 -+}  
2378 -+  
2379 -+static int  
2380 -+esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq)  
2381 -+{  
2382 -+ volatile struct esp_regs *ll;  
2383 -+  
2384 -+ /* Get the IO region */  
2385 -+ ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs));  
2386 -+ if (ll == 0) return -1;  
2387 -+  
2388 -+ esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma);  
2389 -+ esp->ll = ll;  
2390 -+ esp->espdma = espdma;  
2391 -+ esp->irq = irq;  
2392 -+  
2393 -+ // Chip reset  
2394 -+ stb_bypass((int)ll + 3*2, 2);  
2395 -+ return 0;  
2396 -+}  
2397 -+  
2398 -+static int espdma_init(struct esp_dma *espdma)  
2399 -+{  
2400 -+ void *p;  
2401 -+  
2402 -+ /* Hardcode everything for MrCoffee. */  
2403 -+ if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) {  
2404 -+ printk("espdma_init: cannot map registers\n");  
2405 -+ return -1;  
2406 -+ }  
2407 -+ espdma->regs = p;  
2408 -+  
2409 -+ printk("dma1: ");  
2410 -+  
2411 -+ switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) {  
2412 -+ case DMA_VERS0:  
2413 -+ espdma->revision=dvmarev0;  
2414 -+ printk("Revision 0 ");  
2415 -+ break;  
2416 -+ case DMA_ESCV1:  
2417 -+ espdma->revision=dvmaesc1;  
2418 -+ printk("ESC Revision 1 ");  
2419 -+ break;  
2420 -+ case DMA_VERS1:  
2421 -+ espdma->revision=dvmarev1;  
2422 -+ printk("Revision 1 ");  
2423 -+ break;  
2424 -+ case DMA_VERS2:  
2425 -+ espdma->revision=dvmarev2;  
2426 -+ printk("Revision 2 ");  
2427 -+ break;  
2428 -+ case DMA_VERHME:  
2429 -+ espdma->revision=dvmahme;  
2430 -+ printk("HME DVMA gate array ");  
2431 -+ break;  
2432 -+ case DMA_VERSPLUS:  
2433 -+ espdma->revision=dvmarevplus;  
2434 -+ printk("Revision 1 PLUS ");  
2435 -+ break;  
2436 -+ default:  
2437 -+ printk("unknown dma version %x",  
2438 -+ (espdma->regs->cond_reg)&DMA_DEVICE_ID);  
2439 -+ /* espdma->allocated = 1; */  
2440 -+ break;  
2441 -+ }  
2442 -+ printk("\n");  
2443 -+ return 0;  
2444 -+}  
2445 -+  
2446 -+static struct esp_dma espdma0;  
2447 -+static struct esp_private esp;  
2448 -+/*  
2449 -+ * Find all the esp cards on the system and initialize them  
2450 -+ */  
2451 -+void esp_probe ()  
2452 -+{  
2453 -+ if (espdma_init(&espdma0) != 0) {  
2454 -+ return;  
2455 -+ }  
2456 -+  
2457 -+ if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) {  
2458 -+ printk("esp_probe: esp0 init failed\n");  
2459 -+ return;  
2460 -+ }  
2461 -+ return;  
2462 -+}  
2463 -+  
2464 -+void esp_read_capacity(int unit)  
2465 -+{  
2466 -+ // Set SCSI target  
2467 -+ stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);  
2468 -+ // Set DMA address  
2469 -+ st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);  
2470 -+ // Set DMA length  
2471 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 10);  
2472 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 0);  
2473 -+ // Set DMA direction  
2474 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);  
2475 -+ // Setup command = Read Capacity  
2476 -+ esp.buffer[0] = 0x80;  
2477 -+ esp.buffer[1] = 0x25;  
2478 -+ esp.buffer[2] = 0x00;  
2479 -+ esp.buffer[3] = 0x00;  
2480 -+ esp.buffer[4] = 0x00;  
2481 -+ esp.buffer[5] = 0x00;  
2482 -+ esp.buffer[6] = 0x00;  
2483 -+ esp.buffer[7] = 0x00;  
2484 -+ esp.buffer[8] = 0x00;  
2485 -+ esp.buffer[9] = 0x00;  
2486 -+ esp.buffer[10] = 0x00;  
2487 -+ // Set ATN, issue command  
2488 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);  
2489 -+  
2490 -+ // Set DMA length = 512 * read length  
2491 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 0);  
2492 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 8 & 0xff);  
2493 -+ // Set DMA direction  
2494 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);  
2495 -+ // Transfer  
2496 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);  
2497 -+ esp.disk[unit].hw_sector = (esp.buffer[4] << 24) | (esp.buffer[5] << 16) | (esp.buffer[6] << 8) | esp.buffer[7];  
2498 -+}  
2499 -+  
2500 -+// offset is multiple of 512, len in bytes  
2501 -+void *esp_read(int unit, int part, int offset, short len)  
2502 -+{  
2503 -+ int pos, hw_sect, sect_offset, spb;  
2504 -+  
2505 -+ // Set SCSI target  
2506 -+ stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);  
2507 -+ // Set DMA address  
2508 -+ st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);  
2509 -+ // Set DMA length  
2510 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 10);  
2511 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 0);  
2512 -+ // Set DMA direction  
2513 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);  
2514 -+ hw_sect = esp.disk[unit].hw_sector;  
2515 -+ offset += esp.disk[unit].part_offset[part];  
2516 -+ spb = hw_sect / 512;  
2517 -+ sect_offset = offset / spb;  
2518 -+ pos = (offset - sect_offset * spb) * 512;  
2519 -+ len /= 512;  
2520 -+ //printk("Read unit %d, offset %d -> offset %d, pos %d, hw_sect %d\n", unit, offset, sect_offset, pos, hw_sect);  
2521 -+ // Setup command = Read(10)  
2522 -+ esp.buffer[0] = 0x80;  
2523 -+ esp.buffer[1] = 0x28;  
2524 -+ esp.buffer[2] = 0x00;  
2525 -+ esp.buffer[3] = (sect_offset >> 24) & 0xff;  
2526 -+ esp.buffer[4] = (sect_offset >> 16) & 0xff;  
2527 -+ esp.buffer[5] = (sect_offset >> 8) & 0xff;  
2528 -+ esp.buffer[6] = sect_offset & 0xff;  
2529 -+ esp.buffer[7] = 0x00;  
2530 -+ esp.buffer[8] = (len >> 8) & 0xff;  
2531 -+ esp.buffer[9] = len & 0xff;  
2532 -+ // Set ATN, issue command  
2533 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);  
2534 -+  
2535 -+ // Set DMA length = sector size * read length  
2536 -+ stb_bypass(PHYS_JJ_ESP + 0*4, (len * hw_sect) & 0xff);  
2537 -+ stb_bypass(PHYS_JJ_ESP + 1*4, ((len * hw_sect) >> 8) & 0xff);  
2538 -+ // Set DMA direction  
2539 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);  
2540 -+ // Transfer  
2541 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);  
2542 -+ return esp.buffer + pos;  
2543 -+}  
2544 -+  
2545 -+// Sparc boot sequence can be found in SILO docs,  
2546 -+// first-isofs/README.SILO_ISOFS  
2547 -+int esp_boot(int unit)  
2548 -+{  
2549 -+ struct sun_disklabel {  
2550 -+ unsigned char info[128]; /* Informative text string */  
2551 -+ unsigned char spare0[14];  
2552 -+ struct sun_info {  
2553 -+ unsigned char spare1;  
2554 -+ unsigned char id;  
2555 -+ unsigned char spare2;  
2556 -+ unsigned char flags;  
2557 -+ } infos[8];  
2558 -+ unsigned char spare[246]; /* Boot information etc. */  
2559 -+ short rspeed; /* Disk rotational speed */  
2560 -+ short pcylcount; /* Physical cylinder count */  
2561 -+ short sparecyl; /* extra sects per cylinder */  
2562 -+ unsigned char spare2[4]; /* More magic... */  
2563 -+ short ilfact; /* Interleave factor */  
2564 -+ short ncyl; /* Data cylinder count */  
2565 -+ short nacyl; /* Alt. cylinder count */  
2566 -+ short ntrks; /* Tracks per cylinder */  
2567 -+ short nsect; /* Sectors per track */  
2568 -+ unsigned char spare3[4]; /* Even more magic... */  
2569 -+ struct sun_partition {  
2570 -+ int start_cylinder;  
2571 -+ int num_sectors;  
2572 -+ } partitions[8];  
2573 -+ short magic; /* Magic number */  
2574 -+ short csum; /* Label xor'd checksum */  
2575 -+ } *label;  
2576 -+ unsigned int i, offset;  
2577 -+ void *src, *dst;  
2578 -+  
2579 -+ printk("Loading partition table from target %d:\n", unit);  
2580 -+ // Chip reset  
2581 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 2);  
2582 -+  
2583 -+ esp_open(&esp);  
2584 -+ esp_read_capacity(unit);  
2585 -+  
2586 -+ label = esp_read(unit, 0, 0, 512);  
2587 -+ printk("hw sector: %d, CHS: %d/%d/%d, partitions:\n", esp.disk[unit].hw_sector,  
2588 -+ label->ncyl, label->ntrks, label->nsect);  
2589 -+ for (i = 0; i < 8; i++) {  
2590 -+ printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, label->partitions[i].start_cylinder,  
2591 -+ label->partitions[i].num_sectors, label->infos[i].id, label->infos[i].flags);  
2592 -+ esp.disk[unit].part_offset[i] = label->partitions[3].start_cylinder * label->ntrks * label->nsect;  
2593 -+ }  
2594 -+ offset = 1;  
2595 -+ printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset);  
2596 -+ // Skip a.out header (0x20)  
2597 -+ dst = (void *)0x4000;  
2598 -+ src = esp_read(unit, 3, offset, 512);  
2599 -+ src = (void *)((unsigned int) src + 0x20);  
2600 -+ memcpy(dst, src, 512 - 0x20);  
2601 -+ dst = (void *)0x4000 + 512 - 0x20;  
2602 -+ for (i = 1; i < 7680/512; i++) {  
2603 -+ src = esp_read(unit, 3, offset + i, 512);  
2604 -+ memcpy(dst, src, 512);  
2605 -+ dst += 512;  
2606 -+ }  
2607 -+ esp_close(&esp);  
2608 -+ return 0;  
2609 -+}  
2610 -diff -ruN proll_18.orig/src/hconsole.c proll-patch-15/src/hconsole.c  
2611 ---- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000  
2612 -+++ proll-patch-15/src/hconsole.c 2005-11-09 18:46:34.000000000 +0000  
2613 -@@ -29,6 +29,10 @@  
2614 - struct raster r_master; /* For a case of resize, whole fb */  
2615 - struct raster r_0; /* malloc() erzatz */  
2616 -  
2617 -+#ifdef QEMU  
2618 -+extern unsigned int q_height, q_width;  
2619 -+#endif  
2620 -+  
2621 - int hcon_init(struct hconsole *t, unsigned int a0)  
2622 - {  
2623 - struct raster *q, *r;  
2624 -@@ -42,7 +46,11 @@  
2625 - * No probing sequence or argument passing, hardcode everything. XXX  
2626 - */  
2627 - raster8_cons_a(q, 768, 1024, (char *)a0);  
2628 -+#ifndef QEMU  
2629 - raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));  
2630 -+#else  
2631 -+ raster_cons_2(r, q, 0, 0, q_height, q_width);  
2632 -+#endif  
2633 - t->r_ = r;  
2634 - t->r0_ = q;  
2635 - t->f_ = &f_master;  
2636 -@@ -67,7 +75,7 @@  
2637 - return 0;  
2638 - }  
2639 -  
2640 --void hcon_fini (struct hconsole *t)  
2641 -+void hcon_fini (__attribute((unused)) struct hconsole *t)  
2642 - {  
2643 - return;  
2644 - }  
2645 -@@ -77,12 +85,12 @@  
2646 - {  
2647 - struct rfont *f = t->f_;  
2648 -  
2649 -- if (sy < 0 || sy >= t->ydim_) return -1;  
2650 -- if (sx < 0 || sx >= t->xdim_) return -1;  
2651 -+ if (sy < 0 || (unsigned)sy >= t->ydim_) return -1;  
2652 -+ if (sx < 0 || (unsigned)sx >= t->xdim_) return -1;  
2653 - if (height < 0) return -1;  
2654 -- if (sy + height > t->ydim_) height = t->ydim_ - sy;  
2655 -+ if ((unsigned)sy + (unsigned)height > t->ydim_) height = t->ydim_ - sy;  
2656 - if (width < 0) return -1;  
2657 -- if (sx + width > t->xdim_) width = t->xdim_ - sx;  
2658 -+ if ((unsigned)sx + (unsigned)width > t->xdim_) width = t->xdim_ - sx;  
2659 -  
2660 - /* XXX Clear with correct background color */  
2661 - (*t->r_->clear_)(t->r_,  
2662 -@@ -107,10 +115,10 @@  
2663 - char c0 = c;  
2664 - RC_color rfg, rbg;  
2665 -  
2666 -- if (y < 0 || y >= t->ydim_) return -1;  
2667 -- if (x < 0 || x >= t->xdim_) return -1;  
2668 -+ if (y < 0 || (unsigned)y >= t->ydim_) return -1;  
2669 -+ if (x < 0 || (unsigned)x >= t->xdim_) return -1;  
2670 -  
2671 -- if (t->curson_ && t->ypos_ == y && t->xpos_ == x) {  
2672 -+ if (t->curson_ && t->ypos_ == (unsigned)y && t->xpos_ == (unsigned)x) {  
2673 - rfg = t->bg_; rbg = t->fg_;  
2674 - } else {  
2675 - rfg = t->fg_; rbg = t->bg_;  
2676 -@@ -126,9 +134,9 @@  
2677 - {  
2678 - struct rfont *f = t->f_;  
2679 -  
2680 -- if (y < 0 || y >= t->ydim_) return -1;  
2681 -- if (x < 0 || x >= t->xdim_) return -1;  
2682 -- if (x + count >= t->xdim_) count = t->xdim_ - x;  
2683 -+ if (y < 0 || (unsigned)y >= t->ydim_) return -1;  
2684 -+ if (x < 0 || (unsigned)x >= t->xdim_) return -1;  
2685 -+ if ((unsigned)x + (unsigned)count >= t->xdim_) count = t->xdim_ - x;  
2686 -  
2687 - (*t->r_->render_)(t->r_, y*f->height_, x*f->width_,  
2688 - s, count, t->bg_, t->fg_, f);  
2689 -@@ -200,8 +208,8 @@  
2690 -  
2691 - rc = 0;  
2692 - if (dir == SM_UP) {  
2693 -- if (d < 0 || d >= t->ydim_) return -1;  
2694 -- if (b <= d || b > t->ydim_) return -1;  
2695 -+ if (d < 0 || (unsigned)d >= t->ydim_) return -1;  
2696 -+ if (b <= d || (unsigned)b > t->ydim_) return -1;  
2697 - if (d + count >= b) count = b - d;  
2698 - if (d + count >= b) count = b - d;  
2699 - (*t->r_->yscroll_)(t->r_,  
2700 -@@ -213,8 +221,8 @@  
2701 - count*f->height_, raster_qwidth(t->r_),  
2702 - t->bg_);  
2703 - } else if (dir == SM_DOWN) {  
2704 -- if (d < 0 || d >= t->ydim_) return -1;  
2705 -- if (b <= d || b > t->ydim_) return -1;  
2706 -+ if (d < 0 || (unsigned)d >= t->ydim_) return -1;  
2707 -+ if (b <= d || (unsigned)b > t->ydim_) return -1;  
2708 - if (d + count >= b) count = b - d;  
2709 - (*t->r_->yscroll_)(t->r_,  
2710 - d*f->height_, 0,  
2711 -diff -ruN proll_18.orig/src/hme.c proll-patch-15/src/hme.c  
2712 ---- proll_18.orig/src/hme.c 2002-07-23 05:52:52.000000000 +0000  
2713 -+++ proll-patch-15/src/hme.c 2005-04-16 06:16:20.000000000 +0000  
2714 -@@ -655,10 +655,10 @@  
2715 - unsigned int flags,  
2716 - unsigned int addr)  
2717 - {  
2718 -- __asm__ __volatile__("  
2719 -- stwa %3, [%0] %2  
2720 -- stwa %4, [%1] %2  
2721 --" : /* no outputs */  
2722 -+ __asm__ __volatile__(  
2723 -+ "stwa %3, [%0] %2\n\t"  
2724 -+ "stwa %4, [%1] %2\n\t"  
2725 -+ : /* no outputs */  
2726 - : "r" (&rp->rx_addr), "r" (&rp->rx_flags),  
2727 - "i" (ASI_PL), "r" (addr), "r" (flags));  
2728 - }  
2729 -@@ -667,10 +667,10 @@  
2730 - unsigned int flags,  
2731 - unsigned int addr)  
2732 - {  
2733 -- __asm__ __volatile__("  
2734 -- stwa %3, [%0] %2  
2735 -- stwa %4, [%1] %2  
2736 --" : /* no outputs */  
2737 -+ __asm__ __volatile__(  
2738 -+ "stwa %3, [%0] %2\n\t"  
2739 -+ "stwa %4, [%1] %2\n\t"  
2740 -+ : /* no outputs */  
2741 - : "r" (&tp->tx_addr), "r" (&tp->tx_flags),  
2742 - "i" (ASI_PL), "r" (addr), "r" (flags));  
2743 - }  
2744 -@@ -2404,7 +2404,7 @@  
2745 - TXD(("[%d]", elem));  
2746 - this = &txbase[elem];  
2747 - #ifdef __sparc_v9__  
2748 -- __asm__ __volatile__("lduwa [%1] %2, %0"  
2749 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t"  
2750 - : "=r" (flags)  
2751 - : "r" (&this->tx_flags), "i" (ASI_PL));  
2752 - #else  
2753 -@@ -2447,7 +2447,7 @@  
2754 - RXD(("RX<"));  
2755 - this = &rxbase[elem];  
2756 - #ifdef __sparc_v9__  
2757 -- __asm__ __volatile__("lduwa [%1] %2, %0"  
2758 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t"  
2759 - : "=r" (flags)  
2760 - : "r" (&this->rx_flags), "i" (ASI_PL));  
2761 - #else  
2762 -@@ -2530,7 +2530,7 @@  
2763 - elem = NEXT_RX(elem);  
2764 - this = &rxbase[elem];  
2765 - #ifdef __sparc_v9__  
2766 -- __asm__ __volatile__("lduwa [%1] %2, %0"  
2767 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t"  
2768 - : "=r" (flags)  
2769 - : "r" (&this->rx_flags), "i" (ASI_PL));  
2770 - #else  
2771 -diff -ruN proll_18.orig/src/iommu.c proll-patch-15/src/iommu.c  
2772 ---- proll_18.orig/src/iommu.c 2002-07-23 05:52:49.000000000 +0000  
2773 -+++ proll-patch-15/src/iommu.c 2005-08-14 10:08:17.000000000 +0000  
2774 -@@ -36,7 +36,7 @@  
2775 - unsigned int pa, ba;  
2776 - unsigned int npages;  
2777 - unsigned int mva, mpa;  
2778 -- int i;  
2779 -+ unsigned int i;  
2780 - unsigned int *iopte;  
2781 -  
2782 - npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;  
2783 -diff -ruN proll_18.orig/src/lat7_2.bm proll-patch-15/src/lat7_2.bm  
2784 ---- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000  
2785 -+++ proll-patch-15/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000  
2786 -@@ -1,6 +1,6 @@  
2787 - #define lat7_2_width 128  
2788 - #define lat7_2_height 88  
2789 --static unsigned char lat7_2_bits[] = {  
2790 -+static unsigned const char lat7_2_bits[] = {  
2791 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2792 - 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,  
2793 - 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,  
2794 -diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch-15/src/lat7_2_swapped.bm  
2795 ---- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000  
2796 -+++ proll-patch-15/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000  
2797 -@@ -0,0 +1,121 @@  
2798 -+#define lat7_2_width 128  
2799 -+#define lat7_2_height 88  
2800 -+static unsigned const char lat7_2_bits[] = {  
2801 -+ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,  
2802 -+ 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,  
2803 -+ 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,  
2804 -+ 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,  
2805 -+ 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,  
2806 -+ 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,  
2807 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,  
2808 -+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,  
2809 -+ 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,  
2810 -+ 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,  
2811 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,  
2812 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,  
2813 -+ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,  
2814 -+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,  
2815 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,  
2816 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2817 -+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2818 -+ 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2819 -+ 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,  
2820 -+ 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,  
2821 -+ 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,  
2822 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,  
2823 -+ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,  
2824 -+ 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,  
2825 -+ 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,  
2826 -+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,  
2827 -+ 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,  
2828 -+ 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,  
2829 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,  
2830 -+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2831 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,  
2832 -+ 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,  
2833 -+ 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,  
2834 -+ 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,  
2835 -+ 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,  
2836 -+ 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,  
2837 -+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,  
2838 -+ 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,  
2839 -+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,  
2840 -+ 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,  
2841 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,  
2842 -+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,  
2843 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,  
2844 -+ 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,  
2845 -+ 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,  
2846 -+ 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,  
2847 -+ 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,  
2848 -+ 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,  
2849 -+ 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,  
2850 -+ 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,  
2851 -+ 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,  
2852 -+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,  
2853 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,  
2854 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,  
2855 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,  
2856 -+ 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,  
2857 -+ 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,  
2858 -+ 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,  
2859 -+ 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,  
2860 -+ 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,  
2861 -+ 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,  
2862 -+ 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,  
2863 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,  
2864 -+ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,  
2865 -+ 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,  
2866 -+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,  
2867 -+ 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,  
2868 -+ 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,  
2869 -+ 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,  
2870 -+ 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,  
2871 -+ 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,  
2872 -+ 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,  
2873 -+ 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,  
2874 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,  
2875 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,  
2876 -+ 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,  
2877 -+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,  
2878 -+ 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,  
2879 -+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,  
2880 -+ 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,  
2881 -+ 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,  
2882 -+ 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,  
2883 -+ 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,  
2884 -+ 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,  
2885 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,  
2886 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,  
2887 -+ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2888 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,  
2889 -+ 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2890 -+ 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,  
2891 -+ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2892 -+ 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,  
2893 -+ 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,  
2894 -+ 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,  
2895 -+ 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,  
2896 -+ 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,  
2897 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,  
2898 -+ 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,  
2899 -+ 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,  
2900 -+ 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,  
2901 -+ 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,  
2902 -+ 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
2903 -+ 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,  
2904 -+ 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,  
2905 -+ 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,  
2906 -+ 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,  
2907 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,  
2908 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,  
2909 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,  
2910 -+ 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,  
2911 -+ 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,  
2912 -+ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,  
2913 -+ 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,  
2914 -+ 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,  
2915 -+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,  
2916 -+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,  
2917 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,  
2918 -+ 0x00, 0x00, 0x00, 0x00};  
2919 -diff -ruN proll_18.orig/src/le.c proll-patch-15/src/le.c  
2920 ---- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000  
2921 -+++ proll-patch-15/src/le.c 2005-04-16 06:16:20.000000000 +0000  
2922 -@@ -185,8 +185,6 @@  
2923 - unsigned short rap; /* register address port */  
2924 - };  
2925 -  
2926 --int sparc_lance_debug = 2;  
2927 --  
2928 - /* The Lance uses 24 bit addresses */  
2929 - /* On the Sun4c the DVMA will provide the remaining bytes for us */  
2930 - /* On the Sun4m we have to instruct the ledma to provide them */  
2931 -@@ -771,7 +769,7 @@  
2932 - /* Clear the slack of the packet, do I need this? */  
2933 - /* For a firewall its a good idea - AC */  
2934 - if (len != skblen)  
2935 -- bzero((char *) &ib->tx_buf [entry][skblen], len - skblen);  
2936 -+ memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);  
2937 -  
2938 - /* Now, give the packet to the lance */  
2939 - ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);  
2940 -diff -ruN proll_18.orig/src/net.h proll-patch-15/src/net.h  
2941 ---- proll_18.orig/src/net.h 1999-12-15 17:20:17.000000000 +0000  
2942 -+++ proll-patch-15/src/net.h 2005-08-14 10:17:02.000000000 +0000  
2943 -@@ -124,7 +124,7 @@  
2944 - extern int udp_open __P((t_ipaddr daddr, int source, int dest));  
2945 -  
2946 - /* Read from a UDP socket */  
2947 --extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));  
2948 -+extern int udp_read(char *buf, unsigned int bufsize, int timeout);  
2949 -  
2950 - /* Write to a UDP socket */  
2951 - extern int udp_write __P((char *buf, int writelen));  
2952 -diff -ruN proll_18.orig/src/netinit.c proll-patch-15/src/netinit.c  
2953 ---- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000  
2954 -+++ proll-patch-15/src/netinit.c 2004-11-13 15:50:49.000000000 +0000  
2955 -@@ -49,13 +49,20 @@  
2956 - unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */  
2957 - t_ipaddr myipaddr; /* my own IP address */  
2958 - t_ipaddr mynetmask; /* my own netmask */  
2959 -- char *net_module_name; /* name of init module */  
2960 - t_ipaddr servaddr; /* IP of RARP&TFTP server */  
2961 -  
2962 - /* Broadcast hardware address */  
2963 --unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };  
2964 -+const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };  
2965 -  
2966 -  
2967 -+unsigned int seed;  
2968 -+  
2969 -+/* This is taken from x86 to be used in network kernel. Returns 15 bits. */  
2970 -+short int random()  
2971 -+{  
2972 -+ seed = (seed + 23968)*0x015A4E35 >> 1;  
2973 -+ return seed & 0x7FFF;  
2974 -+}  
2975 -  
2976 - /*  
2977 - **************************************************************************  
2978 -@@ -104,10 +111,17 @@  
2979 - */  
2980 - void init_net()  
2981 - {  
2982 -+ /* Avoid data segment allocations */  
2983 -+ seed = 151;  
2984 -+  
2985 - /* Initialize the different network layer modules */  
2986 - init_packet();  
2987 -- if (!init_arp() || !init_udp()) {  
2988 -- printf("\nERROR: init_%s\n", net_module_name);  
2989 -+ if (!init_arp()) {  
2990 -+ printf("\nERROR: init_arp\n");  
2991 -+ fatal();  
2992 -+ }  
2993 -+ if (!init_udp()) {  
2994 -+ printf("\nERROR: init_udp\n");  
2995 - fatal();  
2996 - }  
2997 - }  
2998 -diff -ruN proll_18.orig/src/netpriv.h proll-patch-15/src/netpriv.h  
2999 ---- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000  
3000 -+++ proll-patch-15/src/netpriv.h 2005-08-14 10:12:20.000000000 +0000  
3001 -@@ -83,7 +83,7 @@  
3002 - */  
3003 - struct device *dev;  
3004 - char *data;  
3005 -- int len;  
3006 -+ unsigned int len;  
3007 - int protocol;  
3008 - unsigned char ip_summed;  
3009 - };  
3010 -@@ -130,10 +130,9 @@  
3011 - *  
3012 - */  
3013 - extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */  
3014 --extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */  
3015 -+extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */  
3016 - extern t_ipaddr myipaddr; /* my own IP address */  
3017 - extern t_ipaddr mynetmask; /* netmask for my network */  
3018 --extern char *net_module_name; /* initialized module's name */  
3019 - extern t_ipaddr servaddr; /* server IP address */  
3020 -  
3021 -  
3022 -@@ -150,7 +149,7 @@  
3023 - extern unsigned char *reg_type __P((int typeval, int (* receive)()));  
3024 -  
3025 - /* Write a packet to the network */  
3026 --extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));  
3027 -+extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));  
3028 -  
3029 - /* Empty read buffer */  
3030 - extern void empty_buf __P((void));  
3031 -diff -ruN proll_18.orig/src/openprom.h proll-patch-15/src/openprom.h  
3032 ---- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000  
3033 -+++ proll-patch-15/src/openprom.h 2005-05-13 16:23:14.000000000 +0000  
3034 -@@ -54,29 +54,29 @@  
3035 - };  
3036 -  
3037 - struct linux_mem_v0 {  
3038 -- struct linux_mlist_v0 **v0_totphys;  
3039 -- struct linux_mlist_v0 **v0_prommap;  
3040 -- struct linux_mlist_v0 **v0_available; /* What we can use */  
3041 -+ struct linux_mlist_v0 * const *v0_totphys;  
3042 -+ struct linux_mlist_v0 * const *v0_prommap;  
3043 -+ struct linux_mlist_v0 * const *v0_available; /* What we can use */  
3044 - };  
3045 -  
3046 - /* Arguments sent to the kernel from the boot prompt. */  
3047 - struct linux_arguments_v0 {  
3048 -- char *argv[8];  
3049 -+ const char *argv[8];  
3050 - char args[100];  
3051 - char boot_dev[2];  
3052 - int boot_dev_ctrl;  
3053 - int boot_dev_unit;  
3054 - int dev_partition;  
3055 -- char *kernel_file_name;  
3056 -+ const char *kernel_file_name;  
3057 - void *aieee1; /* XXX */  
3058 - };  
3059 -  
3060 - /* V2 and up boot things. */  
3061 - struct linux_bootargs_v2 {  
3062 -- char **bootpath;  
3063 -- char **bootargs;  
3064 -- int *fd_stdin;  
3065 -- int *fd_stdout;  
3066 -+ const char **bootpath;  
3067 -+ const char **bootargs;  
3068 -+ const int *fd_stdin;  
3069 -+ const int *fd_stdout;  
3070 - };  
3071 -  
3072 - /* The top level PROM vector. */  
3073 -@@ -91,13 +91,13 @@  
3074 - struct linux_mem_v0 pv_v0mem;  
3075 -  
3076 - /* Node operations. */  
3077 -- struct linux_nodeops *pv_nodeops;  
3078 -+ const struct linux_nodeops *pv_nodeops;  
3079 -  
3080 - char **pv_bootstr;  
3081 - struct linux_dev_v0_funcs pv_v0devops;  
3082 -  
3083 -- char *pv_stdin;  
3084 -- char *pv_stdout;  
3085 -+ const char *pv_stdin;  
3086 -+ const char *pv_stdout;  
3087 - #define PROMDEV_KBD 0 /* input from keyboard */  
3088 - #define PROMDEV_SCREEN 0 /* output to screen */  
3089 - #define PROMDEV_TTYA 1 /* in/out to ttya */  
3090 -@@ -127,7 +127,7 @@  
3091 - void (*v2_eval)(char *str);  
3092 - } pv_fortheval;  
3093 -  
3094 -- struct linux_arguments_v0 **pv_v0bootargs;  
3095 -+ const struct linux_arguments_v0 * const *pv_v0bootargs;  
3096 -  
3097 - /* Get ether address. */  
3098 - unsigned int (*pv_enaddr)(int d, char *enaddr);  
3099 -@@ -175,7 +175,7 @@  
3100 - int (*no_proplen)(int node, char *name);  
3101 - int (*no_getprop)(int node, char *name, char *val);  
3102 - int (*no_setprop)(int node, char *name, char *val, int len);  
3103 -- char * (*no_nextprop)(int node, char *name);  
3104 -+ const char * (*no_nextprop)(int node, char *name);  
3105 - };  
3106 -  
3107 - /* More fun PROM structures for device probing. */  
3108 -diff -ruN proll_18.orig/src/packet.c proll-patch-15/src/packet.c  
3109 ---- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000  
3110 -+++ proll-patch-15/src/packet.c 2005-08-14 10:12:49.000000000 +0000  
3111 -@@ -41,7 +41,7 @@  
3112 - int aligner;  
3113 - } wbuf;  
3114 - static struct sk_buff *rskb;  
3115 --static int nqskb = 0;  
3116 -+static int nqskb;  
3117 -  
3118 -  
3119 - void init_packet()  
3120 -@@ -62,6 +62,8 @@  
3121 - for (i = 0; i < MAXSKBS; i++) {  
3122 - skev[i].skb.allocn = i;  
3123 - }  
3124 -+  
3125 -+ nqskb = 0;  
3126 - }  
3127 -  
3128 - unsigned char *reg_type(int ptype, int (*func)())  
3129 -@@ -81,7 +83,7 @@  
3130 - return wbuf.s;  
3131 - }  
3132 -  
3133 --int write_packet(int leng, int type, unsigned char *dst)  
3134 -+int write_packet(int leng, int type, const unsigned char *dst)  
3135 - {  
3136 - struct sk_buff *skb;  
3137 - unsigned char *s;  
3138 -@@ -209,12 +211,12 @@  
3139 - /*  
3140 - */  
3141 - void  
3142 --eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, int base)  
3143 -+eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, __attribute__((unused)) int base)  
3144 - {  
3145 - bcopy(src, dest->data, len);  
3146 - }  
3147 -  
3148 --unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)  
3149 -+unsigned short eth_type_trans(struct sk_buff *skb, __attribute__((unused)) struct device *dev)  
3150 - {  
3151 - unsigned char *s = skb->data + 12;  
3152 - return s[0] << 8 | s[1]; /* Network order word */  
3153 -diff -ruN proll_18.orig/src/printf.c proll-patch-15/src/printf.c  
3154 ---- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000  
3155 -+++ proll-patch-15/src/printf.c 2005-08-14 10:07:26.000000000 +0000  
3156 -@@ -19,7 +19,7 @@  
3157 - static void printn(struct prf_fp *, unsigned long, unsigned int);  
3158 - static void putchar(char, struct prf_fp *);  
3159 -  
3160 --static char hextab[] = "0123456789ABCDEF";  
3161 -+static const char hextab[] = "0123456789ABCDEF";  
3162 -  
3163 - /*  
3164 - * Scaled down version of C Library printf.  
3165 -@@ -41,7 +41,7 @@  
3166 - void  
3167 - prf(struct prf_fp *filog, char *fmt, va_list adx)  
3168 - {  
3169 -- register c;  
3170 -+ register int c;  
3171 - char *s;  
3172 -  
3173 - for(;;) {  
3174 -@@ -60,7 +60,7 @@  
3175 - putchar(va_arg(adx,unsigned), filog);  
3176 - } else if(c == 's') {  
3177 - s = va_arg(adx,char*);  
3178 -- while(c = *s++)  
3179 -+ while((c = *s++))  
3180 - putchar(c,filog);  
3181 - } else if (c == 'l' || c == 'O') {  
3182 - printn(filog, (long)va_arg(adx,long), c=='l'?10:8);  
3183 -@@ -77,10 +77,6 @@  
3184 - char prbuf[24];  
3185 - register char *cp;  
3186 -  
3187 -- if (b == 10 && n < 0) {  
3188 -- putchar('-',filog);  
3189 -- n = (~n) + 1; /* n = -n */  
3190 -- }  
3191 - cp = prbuf;  
3192 - do  
3193 - *cp++ = hextab[(unsigned int)(n%b)];  
3194 -diff -ruN proll_18.orig/src/rconsole.c proll-patch-15/src/rconsole.c  
3195 ---- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000  
3196 -+++ proll-patch-15/src/rconsole.c 2005-08-14 10:25:53.000000000 +0000  
3197 -@@ -28,12 +28,18 @@  
3198 - * move to California. Only plain lat7 survived.  
3199 - * I recreated lat7-1 changes in lat7-2. --zaitcev  
3200 - */  
3201 -+#ifdef ORIG  
3202 - #include "lat7_2.bm" /* lat7_1.bm */  
3203 -+#else  
3204 -+#include "lat7_2_swapped.bm" /* lat7_1.bm */  
3205 -+#endif  
3206 - #define LAT7_NCHARS 128  
3207 - #define LAT7_HEIGHT 11  
3208 - #define LAT7_WIDTH 8  
3209 -  
3210 -+#ifdef ORIG  
3211 - static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];  
3212 -+#endif  
3213 -  
3214 - #if 1  
3215 - /*  
3216 -@@ -46,18 +52,18 @@  
3217 - #endif  
3218 -  
3219 - static __inline__ void stfb_w(void *ptr, unsigned int data) {  
3220 -- __asm__ __volatile__ ("sta %0, [%1] %2" : :  
3221 -+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :  
3222 - "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));  
3223 - }  
3224 -  
3225 - static __inline__ void stfb_b(void *ptr, unsigned int data) {  
3226 -- __asm__ __volatile__ ("stba %0, [%1] %2" : :  
3227 -+ __asm__ __volatile__ ("stba %0, [%1] %2\n\t" : :  
3228 - "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));  
3229 - }  
3230 -  
3231 - static __inline__ unsigned int ldfb_w(void *ptr) {  
3232 - unsigned int data;  
3233 -- __asm__ __volatile__ ("lda [%1] %2, %0" :  
3234 -+ __asm__ __volatile__ ("lda [%1] %2, %0\n\t" :  
3235 - "=r" (data) :  
3236 - "r" (ptr), "i" (ASI_M_BYPASS));  
3237 - return data;  
3238 -@@ -65,7 +71,7 @@  
3239 -  
3240 - static __inline__ unsigned int ldfb_b(void *ptr) {  
3241 - unsigned int data;  
3242 -- __asm__ __volatile__ ("lduba [%1] %2, %0" :  
3243 -+ __asm__ __volatile__ ("lduba [%1] %2, %0\n\t" :  
3244 - "=r" (data) :  
3245 - "r" (ptr), "i" (ASI_M_BYPASS));  
3246 - return data;  
3247 -@@ -94,6 +100,7 @@  
3248 -  
3249 - #endif  
3250 -  
3251 -+#ifdef ORIG  
3252 - static inline int swapbits(int w0)  
3253 - {  
3254 - int w1 = 0;  
3255 -@@ -105,13 +112,16 @@  
3256 - }  
3257 - return w1;  
3258 - }  
3259 -+#endif  
3260 -  
3261 - void font_cons_7(struct rfont *p)  
3262 - {  
3263 -+#ifdef ORIG  
3264 - int x;  
3265 - int col = 0;  
3266 - int row = 0;  
3267 - int erow = 0;  
3268 -+  
3269 - for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {  
3270 - lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =  
3271 - swapbits(lat7_2_bits[x]) & 0xFF;  
3272 -@@ -124,6 +134,9 @@  
3273 - }  
3274 - }  
3275 - p->body_ = lat7_body;  
3276 -+#else  
3277 -+ p->body_ = lat7_2_bits;  
3278 -+#endif  
3279 - p->nchars_ = LAT7_NCHARS;  
3280 - p->width_ = LAT7_WIDTH;  
3281 - p->height_ = LAT7_HEIGHT;  
3282 -@@ -175,7 +188,7 @@  
3283 - r->render_ = p->render_;  
3284 - }  
3285 -  
3286 --void raster_dest(struct raster *r)  
3287 -+void raster_dest(__attribute((unused)) struct raster *r)  
3288 - {  
3289 - }  
3290 -  
3291 -diff -ruN proll_18.orig/src/rconsole.h proll-patch-15/src/rconsole.h  
3292 ---- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000  
3293 -+++ proll-patch-15/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000  
3294 -@@ -13,10 +13,10 @@  
3295 - */  
3296 -  
3297 - #define RF_MAXWIDTH 16  
3298 --typedef unsigned short Rf_scan; /* __w16 to be used */  
3299 -+typedef unsigned char Rf_scan; /* __w16 to be used */  
3300 -  
3301 - struct rfont {  
3302 -- Rf_scan *body_;  
3303 -+ const Rf_scan *body_;  
3304 - int nchars_; /* 128 for ASCII ... 65536 for Unicode */  
3305 - int width_; /* [Pixels]. Maximum size is 16. */  
3306 - int height_; /* [Pixels == scan lines]. */  
3307 -diff -ruN proll_18.orig/src/romlib.h proll-patch-15/src/romlib.h  
3308 ---- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000  
3309 -+++ proll-patch-15/src/romlib.h 2005-04-16 20:32:49.000000000 +0000  
3310 -@@ -72,13 +72,13 @@  
3311 - */  
3312 - #define memcpy(dst, src, len) bcopy(src, dst, len)  
3313 - #define memcmp(x1, x2, len) bcmp(x1, x2, len)  
3314 --#define memset(p, len, zero) bzero(p, len)  
3315 --extern void bcopy(void *b1, void *b2, int length);  
3316 --extern int bcmp(void *b1, void *b2, int length);  
3317 --extern void bzero(void *b, int c);  
3318 -+extern void bcopy(const void *b1, void *b2, int length);  
3319 -+extern int bcmp(const void *b1, const void *b2, int length);  
3320 -+typedef unsigned int size_t;  
3321 -+extern void *memset(void *p, int c, size_t len);  
3322 - /* gcc complains about "conflicting types for builtin function strlen". */  
3323 - #define strlen(s) ssize(s)  
3324 --extern int ssize(char *s);  
3325 -+extern int ssize(const char *s);  
3326 -  
3327 -  
3328 - /*  
3329 -diff -ruN proll_18.orig/src/sched_4m.c proll-patch-15/src/sched_4m.c  
3330 ---- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000  
3331 -+++ proll-patch-15/src/sched_4m.c 2005-08-14 10:18:14.000000000 +0000  
3332 -@@ -108,7 +108,7 @@  
3333 - static int set_bolt; /* Tick counter limit */  
3334 - static struct handsc hndv[16];  
3335 -  
3336 --static unsigned int intr_to_mask[16] = {  
3337 -+static unsigned const int intr_to_mask[16] = {  
3338 - 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0,  
3339 - 0, 0, 0, 0, 0, 0, 0, 0,  
3340 - };  
3341 -@@ -130,7 +130,7 @@  
3342 - int /* 0 - not expired yet; <>0 - timer expired */  
3343 - chk_timeout()  
3344 - {  
3345 -- int lim = (((1000000/HZ) + 1) << 10);  
3346 -+ unsigned int lim = (((1000000/HZ) + 1) << 10);  
3347 - unsigned int clear;  
3348 - unsigned int intc;  
3349 - int n;  
3350 -@@ -182,7 +182,7 @@  
3351 - struct handsc *hndp;  
3352 - unsigned int mask;  
3353 -  
3354 -- if (irq < 0 || irq >= 16) {  
3355 -+ if (irq == 0 || irq >= 16) {  
3356 - printk("request_irq: bad irq %d\n", irq);  
3357 - return -1;  
3358 - }  
3359 -@@ -207,7 +207,7 @@  
3360 - {  
3361 - struct handsc *hndp;  
3362 -  
3363 -- if (irq < 0 || irq >= 16) {  
3364 -+ if (irq == 0 || irq >= 16) {  
3365 - printk("free_irq: bad irq %d\n", irq);  
3366 - return;  
3367 - }  
3368 -diff -ruN proll_18.orig/src/swap.c proll-patch-15/src/swap.c  
3369 ---- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000  
3370 -+++ proll-patch-15/src/swap.c 2004-11-13 15:50:49.000000000 +0000  
3371 -@@ -0,0 +1,21 @@  
3372 -+// Convert the lat7 font so that no conversion is needed at runtime.  
3373 -+#define ORIG  
3374 -+#include "rconsole.c"  
3375 -+  
3376 -+#include <stdio.h>  
3377 -+  
3378 -+int main()  
3379 -+{  
3380 -+ struct rfont p;  
3381 -+ int i;  
3382 -+  
3383 -+ font_cons_7(&p);  
3384 -+  
3385 -+ printf(" ");  
3386 -+ for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {  
3387 -+ printf("0x%02x, ", p.body_[i]);  
3388 -+ if ((i % 12) == 11)  
3389 -+ printf("\n ");  
3390 -+ }  
3391 -+ printf("\n");  
3392 -+}  
3393 -diff -ruN proll_18.orig/src/system.c proll-patch-15/src/system.c  
3394 ---- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000  
3395 -+++ proll-patch-15/src/system.c 2005-04-16 06:16:20.000000000 +0000  
3396 -@@ -298,8 +298,8 @@  
3397 - }  
3398 -  
3399 - /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */  
3400 -- pa = PAGE_SIZE;  
3401 -- for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {  
3402 -+ pa = 0;  
3403 -+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {  
3404 - map_page(l1, va, pa, 0, highbase);  
3405 - pa += PAGE_SIZE;  
3406 - }  
3407 -@@ -507,30 +507,44 @@  
3408 - {  
3409 - char *p;  
3410 -  
3411 -- if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);  
3412 -+ if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);  
3413 - return p;  
3414 - }  
3415 -  
3416 - /*  
3417 - * Library functions  
3418 - */  
3419 --void bzero(void *s, int len) {  
3420 -- while (len--) *((char *)s)++ = 0;  
3421 -+void *memset(void *s, int c, size_t len)  
3422 -+{  
3423 -+ void *p = s;  
3424 -+  
3425 -+ while (len--) {  
3426 -+ *(char *)s = c;  
3427 -+ s++;  
3428 -+ }  
3429 -+ return p;  
3430 - }  
3431 -  
3432 --void bcopy(void *f, void *t, int len) {  
3433 -- while (len--) *((char *)t)++ = *((char *)f)++;  
3434 -+void bcopy(const void *f, void *t, int len) {  
3435 -+ while (len--) {  
3436 -+ *(char *)t = *(char *)f;  
3437 -+ f++;  
3438 -+ t++;  
3439 -+ }  
3440 - }  
3441 -  
3442 - /* Comparison is 7-bit */  
3443 --int bcmp(void *s1, void *s2, int len)  
3444 -+int bcmp(const void *s1, const void *s2, int len)  
3445 - {  
3446 - int i;  
3447 - char ch;  
3448 -  
3449 - while (len--) {  
3450 -- ch = *((char *)s1)++;  
3451 -- if ((i = ch - *((char *)s2)++) != 0)  
3452 -+ ch = *(char *)s1;  
3453 -+ i = ch - *(char *)s2;  
3454 -+ s1++;  
3455 -+ s2++;  
3456 -+ if (i != 0)  
3457 - return i;  
3458 - if (ch == 0)  
3459 - return 0;  
3460 -@@ -538,8 +552,8 @@  
3461 - return 0;  
3462 - }  
3463 -  
3464 --int strlen(char *s) {  
3465 -- char *p;  
3466 -+int strlen(const char *s) {  
3467 -+ const char *p;  
3468 - for (p = s; *p != 0; p++) { }  
3469 - return p - s;  
3470 - }  
3471 -@@ -560,14 +574,6 @@  
3472 - va_end(x1);  
3473 - }  
3474 -  
3475 --/* This is taken from x86 to be used in network kernel. Returns 15 bits. */  
3476 --short int random()  
3477 --{  
3478 -- static unsigned int seed = 151;  
3479 -- seed = (seed + 23968)*0x015A4E35 >> 1;  
3480 -- return seed & 0x7FFF;  
3481 --}  
3482 --  
3483 - void fatal()  
3484 - {  
3485 - printk("fatal.");  
3486 -diff -ruN proll_18.orig/src/system.h proll-patch-15/src/system.h  
3487 ---- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000  
3488 -+++ proll-patch-15/src/system.h 2005-04-16 06:16:20.000000000 +0000  
3489 -@@ -16,7 +16,7 @@  
3490 - #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */  
3491 - #define NCTX_SWIFT 0x100  
3492 -  
3493 --#define MAX_BANKS 3 /* Allocation for all machines */  
3494 -+#define MAX_BANKS 8 /* Allocation for all machines */  
3495 -  
3496 - #ifndef __ASSEMBLY__  
3497 - struct bank {  
3498 -@@ -164,10 +164,10 @@  
3499 -  
3500 - extern __inline__ void setipl(unsigned long __orig_psr)  
3501 - {  
3502 -- __asm__ __volatile__("  
3503 -- wr %0, 0x0, %%psr  
3504 -- nop; nop; nop  
3505 --" : /* no outputs */  
3506 -+ __asm__ __volatile__(  
3507 -+ "wr %0, 0x0, %%psr\n\t"  
3508 -+ "nop; nop; nop\n\t"  
3509 -+ : /* no outputs */  
3510 - : "r" (__orig_psr)  
3511 - : "memory", "cc");  
3512 - }  
3513 -@@ -176,13 +176,13 @@  
3514 - {  
3515 - unsigned long tmp;  
3516 -  
3517 -- __asm__ __volatile__("  
3518 -- rd %%psr, %0  
3519 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */  
3520 -- or %0, %1, %0  
3521 -- wr %0, 0x0, %%psr  
3522 -- nop; nop; nop  
3523 --" : "=r" (tmp)  
3524 -+ __asm__ __volatile__(  
3525 -+ "rd %%psr, %0\n\t"  
3526 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */  
3527 -+ "or %0, %1, %0\n\t"  
3528 -+ "wr %0, 0x0, %%psr\n\t"  
3529 -+ "nop; nop; nop\n\t"  
3530 -+ : "=r" (tmp)  
3531 - : "i" (PSR_PIL)  
3532 - : "memory");  
3533 - }  
3534 -@@ -191,13 +191,13 @@  
3535 - {  
3536 - unsigned long tmp;  
3537 -  
3538 -- __asm__ __volatile__("  
3539 -- rd %%psr, %0  
3540 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */  
3541 -- andn %0, %1, %0  
3542 -- wr %0, 0x0, %%psr  
3543 -- nop; nop; nop  
3544 --" : "=r" (tmp)  
3545 -+ __asm__ __volatile__(  
3546 -+ "rd %%psr, %0\n\t"  
3547 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */  
3548 -+ "andn %0, %1, %0\n\t"  
3549 -+ "wr %0, 0x0, %%psr\n\t"  
3550 -+ "nop; nop; nop\n\t"  
3551 -+ : "=r" (tmp)  
3552 - : "i" (PSR_PIL)  
3553 - : "memory");  
3554 - }  
3555 -@@ -214,18 +214,18 @@  
3556 - {  
3557 - unsigned long retval;  
3558 -  
3559 -- __asm__ __volatile__("  
3560 -- rd %%psr, %0  
3561 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */  
3562 -- and %0, %2, %%g1  
3563 -- and %1, %2, %%g2  
3564 -- xorcc %%g1, %%g2, %%g0  
3565 -- be 1f  
3566 -- nop  
3567 -- wr %0, %2, %%psr  
3568 -- nop; nop; nop;  
3569 --1:  
3570 --" : "=r" (retval)  
3571 -+ __asm__ __volatile__(  
3572 -+ "rd %%psr, %0\n\t"  
3573 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */  
3574 -+ "and %0, %2, %%g1\n\t"  
3575 -+ "and %1, %2, %%g2\n\t"  
3576 -+ "xorcc %%g1, %%g2, %%g0\n\t"  
3577 -+ "be 1f\n\t"  
3578 -+ "nop\n\t"  
3579 -+ "wr %0, %2, %%psr\n\t"  
3580 -+ "nop; nop; nop;\n\t"  
3581 -+ "1:\n\t"  
3582 -+ : "=r" (retval)  
3583 - : "r" (__new_psr), "i" (PSR_PIL)  
3584 - : "g1", "g2", "memory", "cc");  
3585 -  
3586 -@@ -236,13 +236,13 @@  
3587 - {  
3588 - unsigned long retval;  
3589 -  
3590 -- __asm__ __volatile__("  
3591 -- rd %%psr, %0  
3592 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */  
3593 -- or %0, %1, %%g1  
3594 -- wr %%g1, 0x0, %%psr  
3595 -- nop; nop; nop  
3596 --" : "=r" (retval)  
3597 -+ __asm__ __volatile__(  
3598 -+ "rd %%psr, %0\n\t"  
3599 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */  
3600 -+ "or %0, %1, %%g1\n\t"  
3601 -+ "wr %%g1, 0x0, %%psr\n\t"  
3602 -+ "nop; nop; nop\n\t"  
3603 -+ : "=r" (retval)  
3604 - : "i" (PSR_PIL)  
3605 - : "g1", "memory");  
3606 -  
3607 -diff -ruN proll_18.orig/src/tftp.c proll-patch-15/src/tftp.c  
3608 ---- proll_18.orig/src/tftp.c 2002-09-13 21:53:34.000000000 +0000  
3609 -+++ proll-patch-15/src/tftp.c 2005-08-14 10:16:15.000000000 +0000  
3610 -@@ -127,7 +127,7 @@  
3611 - int len;  
3612 -  
3613 - /* Read packet with timeout */  
3614 -- len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT, CHR_ESC);  
3615 -+ len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT);  
3616 - if (len == 0) {  
3617 - printf("TFTP: Timeout\n");  
3618 - return(ERR_TIMEOUT);  
3619 -diff -ruN proll_18.orig/src/udp.c proll-patch-15/src/udp.c  
3620 ---- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000  
3621 -+++ proll-patch-15/src/udp.c 2005-08-14 10:17:19.000000000 +0000  
3622 -@@ -76,12 +76,9 @@  
3623 - *  
3624 - * Open a new UDP socket.  
3625 - */  
3626 --int udp_open(daddr, source, dest)  
3627 --t_ipaddr daddr;  
3628 --int source;  
3629 --int dest;  
3630 -+int udp_open(t_ipaddr daddr, int source, int dest)  
3631 - {  
3632 -- register unsigned char *addr;  
3633 -+ const unsigned char *addr;  
3634 -  
3635 - /* Set global variables */  
3636 - usource = source;  
3637 -@@ -101,16 +98,13 @@  
3638 - *  
3639 - * IP receiver routine  
3640 - */  
3641 --static int ip_recv(buf, bufsize, addr)  
3642 --unsigned char *buf;  
3643 --int bufsize;  
3644 --unsigned char *addr;  
3645 -+static int ip_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)  
3646 - {  
3647 - struct iphdr *ipp = ((struct iphdr *)buf);  
3648 - struct udphdr *udpp = ((struct udphdr *)(buf + IP_MIN_HSIZE));  
3649 - struct udp_pseudo psehdr;  
3650 -  
3651 -- int size;  
3652 -+ unsigned int size;  
3653 - t_ipaddr dadr;  
3654 -  
3655 - #ifdef DEBUG  
3656 -@@ -194,13 +188,9 @@  
3657 - *  
3658 - * Read one packet from a UDP socket  
3659 - */  
3660 --int udp_read(buf, bufsize, timeout, abortch)  
3661 --char *buf;  
3662 --int bufsize;  
3663 --int timeout;  
3664 --char abortch;  
3665 -+int udp_read(char *buf, unsigned int bufsize, int timeout)  
3666 - {  
3667 -- int len;  
3668 -+ unsigned int len;  
3669 -  
3670 - /* Wait until we get something */  
3671 - set_timeout(timeout);  
3672 -@@ -299,9 +289,6 @@  
3673 - */  
3674 - int init_udp()  
3675 - {  
3676 -- /* Set module name for error handling */  
3677 -- net_module_name = "udp";  
3678 --  
3679 - /* Register IP packet type and set write buffer pointer */  
3680 - if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)  
3681 - return(FALSE);  
3682 -diff -ruN proll_18.orig/src/udp.h proll-patch-15/src/udp.h  
3683 ---- proll_18.orig/src/udp.h 2001-12-24 05:12:34.000000000 +0000  
3684 -+++ proll-patch-15/src/udp.h 2005-08-14 10:16:40.000000000 +0000  
3685 -@@ -53,7 +53,7 @@  
3686 - extern int udp_open __P((t_ipaddr daddr, int source, int dest));  
3687 -  
3688 - /* Read from a UDP socket */  
3689 --extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));  
3690 -+extern int udp_read(char *buf, unsigned int bufsize, int timeout);  
3691 -  
3692 - /* Write to a UDP socket */  
3693 - extern int udp_write __P((char *buf, int writelen));  
3694 -diff -ruN proll_18.orig/src/vcons_zs.c proll-patch-15/src/vcons_zs.c  
3695 ---- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000  
3696 -+++ proll-patch-15/src/vcons_zs.c 2005-08-14 10:25:51.000000000 +0000  
3697 -@@ -0,0 +1,68 @@  
3698 -+/**  
3699 -+ ** Console over 'zs' (Zilog serial port)  
3700 -+ ** Copyright 1999 Pete Zaitcev  
3701 -+ ** This code is licensed under GNU General Public License.  
3702 -+ **/  
3703 -+  
3704 -+#include "vconsole.h"  
3705 -+#include <system.h>  
3706 -+  
3707 -+#define ZS_DATA 0x02  
3708 -+  
3709 -+int vcon_zs_init(struct vconterm *t, unsigned int a0)  
3710 -+{  
3711 -+  
3712 -+ t->impl = (void *) a0;  
3713 -+  
3714 -+ t->vc_x = 0; t->vc_y = 0;  
3715 -+ t->backp = 0; t->backc = 0;  
3716 -+  
3717 -+ stb_bypass(a0, 3); // reg 3  
3718 -+ stb_bypass(a0, 1); // enable rx  
3719 -+  
3720 -+ stb_bypass(a0, 5); // reg 5  
3721 -+ stb_bypass(a0, 8); // enable tx  
3722 -+  
3723 -+ return 0;  
3724 -+}  
3725 -+  
3726 -+int vcon_zs_putch(struct vconterm *t, char c)  
3727 -+{  
3728 -+ unsigned zs_ptr = (unsigned) t->impl;  
3729 -+  
3730 -+ //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }  
3731 -+ stb_bypass(zs_ptr + ZS_DATA, c);  
3732 -+ return 0;  
3733 -+}  
3734 -+  
3735 -+int vcon_zs_write(struct vconterm *t, char *data, int leng)  
3736 -+{  
3737 -+ while (leng != 0) {  
3738 -+ leng--;  
3739 -+ vcon_zs_putch(t, *data++);  
3740 -+ }  
3741 -+ return leng;  
3742 -+}  
3743 -+  
3744 -+int vcon_zs_read(struct vconterm *t, char *data, __attribute((unused)) int leng)  
3745 -+{  
3746 -+ unsigned zs_ptr = (unsigned) t->impl;  
3747 -+  
3748 -+ while ((ldb_bypass(zs_ptr) & 1) != 1) { }  
3749 -+ *data = ldb_bypass(zs_ptr + ZS_DATA);  
3750 -+ return 0;  
3751 -+}  
3752 -+  
3753 -+int vcon_zs_getch(struct vconterm *t)  
3754 -+{  
3755 -+ unsigned zs_ptr = (unsigned) t->impl;  
3756 -+  
3757 -+ while ((ldb_bypass(zs_ptr) & 1) != 1) { }  
3758 -+ return ldb_bypass(zs_ptr + ZS_DATA) & 0xff;  
3759 -+}  
3760 -+  
3761 -+void vcon_zs_fini(__attribute((unused)) struct vconterm *t)  
3762 -+{  
3763 -+ /* violent crash in the end */  
3764 -+ ;  
3765 -+}  
3766 -diff -ruN proll_18.orig/src/vconsole.c proll-patch-15/src/vconsole.c  
3767 ---- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000  
3768 -+++ proll-patch-15/src/vconsole.c 2005-08-14 10:24:49.000000000 +0000  
3769 -@@ -7,12 +7,17 @@  
3770 - #include "vconsole.h"  
3771 -  
3772 - #include "hconsole.h"  
3773 -+#include <system.h>  
3774 -  
3775 - static void vcon_i_cursfeed(struct vconterm *t);  
3776 - static void vcon_i_backflush(struct vconterm *t);  
3777 -  
3778 - struct hconsole hcons0;  
3779 -  
3780 -+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,  
3781 -+ EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,  
3782 -+ ESpalette };  
3783 -+  
3784 - int vcon_init(struct vconterm *t, unsigned int a0)  
3785 - {  
3786 - struct hconsole *hconp;  
3787 -@@ -25,11 +30,49 @@  
3788 -  
3789 - t->vc_x = 0; t->vc_y = 0;  
3790 - t->backp = 0; t->backc = 0;  
3791 -+ t->vc_state = ESnormal;  
3792 -  
3793 - hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_);  
3794 - return 0;  
3795 - }  
3796 -  
3797 -+/*  
3798 -+ * gotoxy() must verify all boundaries, because the arguments  
3799 -+ * might also be negative. If the given position is out of  
3800 -+ * bounds, the cursor is placed at the nearest margin.  
3801 -+ */  
3802 -+static void gotoxy(struct vconterm *vc, int new_x, int new_y)  
3803 -+{  
3804 -+ int max_x, max_y;  
3805 -+ struct hconsole *hconp = vc->impl;  
3806 -+  
3807 -+ max_x = hcon_qxdim(hconp);  
3808 -+ max_y = hcon_qydim(hconp);  
3809 -+  
3810 -+ if (new_x < 0)  
3811 -+ vc->vc_x = 0;  
3812 -+ else {  
3813 -+ if (new_x >= max_x)  
3814 -+ vc->vc_x = max_x - 1;  
3815 -+ else  
3816 -+ vc->vc_x = new_x;  
3817 -+ }  
3818 -+  
3819 -+ if (new_y < 0)  
3820 -+ vc->vc_y = 0;  
3821 -+ else if (new_y >= max_y)  
3822 -+ vc->vc_y = max_y - 1;  
3823 -+ else  
3824 -+ vc->vc_y = new_y;  
3825 -+  
3826 -+}  
3827 -+  
3828 -+/* for absolute user moves, when decom is set */  
3829 -+static void gotoxay(struct vconterm *t, int new_x, int new_y)  
3830 -+{  
3831 -+ gotoxy(t, new_x, new_y);  
3832 -+}  
3833 -+  
3834 - int vcon_write(struct vconterm *t, char *data, int leng)  
3835 - {  
3836 - int l = leng;  
3837 -@@ -40,29 +83,101 @@  
3838 - if (l <= 0) break;  
3839 - c = *data++; --l;  
3840 -  
3841 -- switch (c) {  
3842 -- case 0x07: /* Bell */  
3843 -- vcon_i_backflush(t);  
3844 -- break;  
3845 -- case 0x0A: /* Linefeed */  
3846 -- vcon_i_backflush(t);  
3847 -- vcon_i_cursfeed(t);  
3848 -+ switch(t->vc_state) {  
3849 -+ case ESesc:  
3850 -+ t->vc_state = ESnormal;  
3851 -+ switch (c) {  
3852 -+ case '[':  
3853 -+ t->vc_state = ESsquare;  
3854 -+ break;  
3855 -+ case 'M':  
3856 -+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);  
3857 -+ break;  
3858 -+ default:  
3859 -+ //printk("Unhandled escape code '%c'\n", c);  
3860 -+ break;  
3861 -+ }  
3862 - break;  
3863 -- case 0x0D: /* Return */  
3864 -- vcon_i_backflush(t);  
3865 -- t->vc_x = 0;  
3866 -+ case ESsquare:  
3867 -+ for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)  
3868 -+ t->vc_par[t->vc_npar] = 0;  
3869 -+ t->vc_npar = 0;  
3870 -+ t->vc_state = ESgetpars;  
3871 -+ case ESgetpars:  
3872 -+ if (c==';' && t->vc_npar<NPAR-1) {  
3873 -+ t->vc_npar++;  
3874 -+ break;  
3875 -+ } else if (c>='0' && c<='9') {  
3876 -+ t->vc_par[t->vc_npar] *= 10;  
3877 -+ t->vc_par[t->vc_npar] += c-'0';  
3878 -+ break;  
3879 -+ } else t->vc_state=ESgotpars;  
3880 -+ case ESgotpars:  
3881 -+ t->vc_state = ESnormal;  
3882 -+ switch(c) {  
3883 -+ case 'H': case 'f':  
3884 -+ if (t->vc_par[0]) t->vc_par[0]--;  
3885 -+ if (t->vc_par[1]) t->vc_par[1]--;  
3886 -+ gotoxay(t, t->vc_par[1], t->vc_par[0]);  
3887 -+ break;  
3888 -+ case 'J':  
3889 -+ if (t->vc_par[0] == 0) {  
3890 -+ //erase from cursor to end of display  
3891 -+ hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_);  
3892 -+ }  
3893 -+ break;  
3894 -+ case 'M':  
3895 -+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);  
3896 -+ break;  
3897 -+ case 'm':  
3898 -+ break;  
3899 -+ default:  
3900 -+#if 0  
3901 -+ printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",  
3902 -+ c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]);  
3903 -+#endif  
3904 -+ break;  
3905 -+ }  
3906 - break;  
3907 - default:  
3908 -- if (t->backp == 0) {  
3909 -- t->backc = 1;  
3910 -- t->backp = data-1;  
3911 -- } else {  
3912 -- t->backc++;  
3913 -- }  
3914 -- if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {  
3915 -+ t->vc_state = ESnormal;  
3916 -+ switch (c) {  
3917 -+ case 0x07: /* Bell */  
3918 -+ vcon_i_backflush(t);  
3919 -+ break;  
3920 -+ case 0x08: /* BS */  
3921 -+ vcon_i_backflush(t);  
3922 -+ if (t->vc_x > 0)  
3923 -+ t->vc_x--;  
3924 -+ break;  
3925 -+ case 0x0A: /* Linefeed */  
3926 - vcon_i_backflush(t);  
3927 -- t->vc_x = 0;  
3928 - vcon_i_cursfeed(t);  
3929 -+ break;  
3930 -+ case 0x0D: /* Return */  
3931 -+ vcon_i_backflush(t);  
3932 -+ t->vc_x = 0;  
3933 -+ break;  
3934 -+ case 24: case 26:  
3935 -+ vcon_i_backflush(t);  
3936 -+ t->vc_state = ESnormal;  
3937 -+ break;  
3938 -+ case 27:  
3939 -+ vcon_i_backflush(t);  
3940 -+ t->vc_state = ESesc;  
3941 -+ break;  
3942 -+ default:  
3943 -+ if (t->backp == 0) {  
3944 -+ t->backc = 1;  
3945 -+ t->backp = data-1;  
3946 -+ } else {  
3947 -+ t->backc++;  
3948 -+ }  
3949 -+ if ((unsigned int)t->vc_x + t->backc >= hcon_qxdim(hconp)) {  
3950 -+ vcon_i_backflush(t);  
3951 -+ t->vc_x = 0;  
3952 -+ vcon_i_cursfeed(t);  
3953 -+ }  
3954 - }  
3955 - }  
3956 - }  
3957 -@@ -73,7 +188,7 @@  
3958 - static void vcon_i_cursfeed(struct vconterm *t) {  
3959 - struct hconsole *hconp = t->impl;  
3960 -  
3961 -- if (++t->vc_y >= hcon_qydim(hconp)) {  
3962 -+ if ((unsigned int)++t->vc_y >= hcon_qydim(hconp)) {  
3963 - t->vc_y = hcon_qydim(hconp)-1;  
3964 - hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);  
3965 - }  
3966 -@@ -90,22 +205,75 @@  
3967 - t->backp = 0; t->backc = 0;  
3968 - }  
3969 -  
3970 --int vcon_putch(struct vconterm *t, char c)  
3971 -+int vcon_putch(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char c)  
3972 - {  
3973 - return -1;  
3974 - }  
3975 -  
3976 --int vcon_read(struct vconterm *t, char *data, int leng)  
3977 -+int vcon_read(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char *data, __attribute__((unused)) int leng)  
3978 - {  
3979 - return 0;  
3980 - }  
3981 -  
3982 --int vcon_getch(struct vconterm *t)  
3983 -+static const unsigned char sunkbd_keycode[128] = {  
3984 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3985 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3986 -+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8,  
3987 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,  
3988 -+ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',  
3989 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3990 -+ 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13,  
3991 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3992 -+ 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',  
3993 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3994 -+ ' ',  
3995 -+};  
3996 -+  
3997 -+static const unsigned char sunkbd_keycode_shifted[128] = {  
3998 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
3999 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
4000 -+ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8,  
4001 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,  
4002 -+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',  
4003 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
4004 -+ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13,  
4005 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
4006 -+ 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',  
4007 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
4008 -+ ' ',  
4009 -+};  
4010 -+  
4011 -+static int shiftstate;  
4012 -+  
4013 -+int vcon_getch(__attribute__((unused)) struct vconterm *t)  
4014 - {  
4015 -- return -1;  
4016 -+ int ch;  
4017 -+  
4018 -+ while ((ldb_bypass(0x71000004) & 1) != 1) { }  
4019 -+ do {  
4020 -+ ch = ldb_bypass(0x71000006) & 0xff;  
4021 -+ if (ch == 99)  
4022 -+ shiftstate |= 1;  
4023 -+ else if (ch == 110)  
4024 -+ shiftstate |= 2;  
4025 -+ else if (ch == 227)  
4026 -+ shiftstate &= ~1;  
4027 -+ else if (ch == 238)  
4028 -+ shiftstate &= ~2;  
4029 -+ //printk("getch: %d\n", ch);  
4030 -+ }  
4031 -+ while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release  
4032 -+ //printk("getch rel: %d\n", ch);  
4033 -+ ch &= 0x7f;  
4034 -+ if (shiftstate)  
4035 -+ ch = sunkbd_keycode_shifted[ch];  
4036 -+ else  
4037 -+ ch = sunkbd_keycode[ch];  
4038 -+ //printk("getch xlate: %d\n", ch);  
4039 -+ return ch;  
4040 - }  
4041 -  
4042 --void vcon_fini(struct vconterm *t)  
4043 -+void vcon_fini(__attribute__((unused)) struct vconterm *t)  
4044 - {  
4045 - /* violent crash in the end */  
4046 - ;  
4047 -diff -ruN proll_18.orig/src/vconsole.h proll-patch-15/src/vconsole.h  
4048 ---- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000  
4049 -+++ proll-patch-15/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000  
4050 -@@ -6,6 +6,8 @@  
4051 - #ifndef VCONSOLE_H  
4052 - #define VCONSOLE_H  
4053 -  
4054 -+#define NPAR 16  
4055 -+  
4056 - struct vconterm {  
4057 - void *impl;  
4058 -  
4059 -@@ -13,6 +15,8 @@  
4060 - int backc; /* Same, count */  
4061 -  
4062 - int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */  
4063 -+ int vc_state;  
4064 -+ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */  
4065 - };  
4066 -  
4067 - int vcon_init(struct vconterm *t, unsigned int a0);