/[qemu]/qemu/pc-bios/proll.patch
ViewVC logotype

Diff of /qemu/pc-bios/proll.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by bellard, Mon Oct 4 21:23:09 2004 UTC revision 1.2 by bellard, Sun Dec 19 23:18:01 2004 UTC
# Line 1  Line 1 
1  diff -ru proll_18.orig/mrcoffee/main.c proll_18/mrcoffee/main.c  diff -ruN proll_18.orig/Makefile proll-patch4/Makefile
2  --- proll_18.orig/mrcoffee/main.c       2002-09-13 16:16:59.000000000 +0200  --- proll_18.orig/Makefile      2002-09-13 14:16:59.000000000 +0000
3  +++ proll_18/mrcoffee/main.c    2004-09-26 11:52:23.000000000 +0200  +++ proll-patch4/Makefile       2004-11-13 15:50:49.000000000 +0000
4  @@ -101,6 +101,7 @@  @@ -4,6 +4,7 @@
5          le_probe();          make -C krups-ser    all
6          init_net();          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/head.S proll-patch4/qemu/head.S
18    --- proll_18.orig/qemu/head.S   1970-01-01 00:00:00.000000000 +0000
19    +++ proll-patch4/qemu/head.S    2004-11-13 15:50:49.000000000 +0000
20    @@ -0,0 +1,515 @@
21    +/**
22    + ** Standalone startup code for Linux PROM emulator.
23    + ** Copyright 1999 Pete A. Zaitcev
24    + ** This code is licensed under GNU General Public License.
25    + **/
26    +/*
27    + * $Id$
28    + */
29    +
30    +#include <psr.h>
31    +#include <asi.h>
32    +#include <crs.h>
33    +/* #include <asm/head.h> */    /* Trap entries. Do not use. */
34    +#include "phys_jj.h"
35    +
36    +#define C_LABEL(name)  name
37    +#define REGWIN_SZ   0x40
38    +
39    +#define WRITE_PAUSE    nop; nop; nop; /* Have to do this after %wim/%psr chg */
40    +
41    +  /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
42    +#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
43    +#define VATOPMDOFF(va) (((va)>>16)&0xFC)
44    +
45    +#define NOP_INSN       0x01000000     /* Used to patch sparc_save_state */
46    +
47    +/* Here are some trap goodies */
48    +
49    +#if 0
50    +/* Generic trap entry. */
51    +#define TRAP_ENTRY(type, label) \
52    +       rd %psr, %l0; b label; rd %wim, %l3; nop;
53    +#endif
54    +
55    +/* Data/text faults. */
56    +#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
57    +#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
58    +
59    +#if 0
60    +/* This is for traps we should NEVER get. */
61    +#define BAD_TRAP(num) \
62    +        rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
63    +
64    +/* This is for traps when we want just skip the instruction which caused it */
65    +#define SKIP_TRAP(type, name) \
66    +       jmpl %l2, %g0; rett %l2 + 4; nop; nop;
67    +
68    +/* Notice that for the system calls we pull a trick.  We load up a
69    + * different pointer to the system call vector table in %l7, but call
70    + * the same generic system call low-level entry point.  The trap table
71    + * entry sequences are also HyperSparc pipeline friendly ;-)
72    + */
73    +
74    +/* Software trap for Linux system calls. */
75    +#define LINUX_SYSCALL_TRAP \
76    +        sethi %hi(C_LABEL(sys_call_table)), %l7; \
77    +        or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
78    +        b linux_sparc_syscall; \
79    +        rd %psr, %l0;
80    +
81    +/* Software trap for SunOS4.1.x system calls. */
82    +#define SUNOS_SYSCALL_TRAP \
83    +        rd %psr, %l0; \
84    +        sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
85    +        b linux_sparc_syscall; \
86    +        or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
87    +
88    +/* Software trap for Slowaris system calls. */
89    +#define SOLARIS_SYSCALL_TRAP \
90    +        b solaris_syscall; \
91    +        rd %psr, %l0; \
92    +        nop; \
93    +        nop;
94    +
95    +#define INDIRECT_SOLARIS_SYSCALL(x) \
96    +       mov x, %g1; \
97    +       b solaris_syscall; \
98    +       rd %psr, %l0; \
99    +       nop;
100    +
101    +#define BREAKPOINT_TRAP \
102    +       b breakpoint_trap; \
103    +       rd %psr,%l0; \
104    +       nop; \
105    +       nop;
106    +
107    +/* Software trap for Sparc-netbsd system calls. */
108    +#define NETBSD_SYSCALL_TRAP \
109    +        sethi %hi(C_LABEL(sys_call_table)), %l7; \
110    +        or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
111    +        b bsd_syscall; \
112    +        rd %psr, %l0;
113    +
114    +/* The Get Condition Codes software trap for userland. */
115    +#define GETCC_TRAP \
116    +        b getcc_trap_handler; mov %psr, %l0; nop; nop;
117    +
118    +/* The Set Condition Codes software trap for userland. */
119    +#define SETCC_TRAP \
120    +        b setcc_trap_handler; mov %psr, %l0; nop; nop;
121    +
122    +/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
123    + * gets handled with another macro.
124    + */
125    +#define TRAP_ENTRY_INTERRUPT(int_level) \
126    +        mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
127    +
128    +/* NMI's (Non Maskable Interrupts) are special, you can't keep them
129    + * from coming in, and basically if you get one, the shows over. ;(
130    + * On the sun4c they are usually asynchronous memory errors, on the
131    + * the sun4m they could be either due to mem errors or a software
132    + * initiated interrupt from the prom/kern on an SMP box saying "I
133    + * command you to do CPU tricks, read your mailbox for more info."
134    + */
135    +#define NMI_TRAP \
136    +        rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
137    +
138    +#endif
139    +
140    +/* Window overflows/underflows are special and we need to try to be as
141    + * efficient as possible here....
142    + */
143    +#define WINDOW_SPILL \
144    +        rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
145    +
146    +#define WINDOW_FILL \
147    +        rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
148    +
149    +#define STUB_TRAP      ba stub_trap; nop; nop; nop;
150    +
151    +#define TRAP_ENTRY(a,b)                STUB_TRAP
152    +#define SKIP_TRAP(a,b)         STUB_TRAP
153    +#define SUNOS_SYSCALL_TRAP     STUB_TRAP
154    +#define SOLARIS_SYSCALL_TRAP   STUB_TRAP
155    +#define NETBSD_SYSCALL_TRAP    STUB_TRAP
156    +#define LINUX_SYSCALL_TRAP     STUB_TRAP
157    +#define BREAKPOINT_TRAP                STUB_TRAP
158    +#define NMI_TRAP               STUB_TRAP
159    +#define GETCC_TRAP             STUB_TRAP
160    +#define SETCC_TRAP             STUB_TRAP
161    +#define BAD_TRAP(n)            STUB_TRAP
162    +#define        TRAP_ENTRY_INTERRUPT(i)         STUB_TRAP
163    +#define        INDIRECT_SOLARIS_SYSCALL(i)     STUB_TRAP
164    +
165    +       .section ".text"
166    +       .globl start, _start
167    +_start:
168    +start:
169    +       .globl spill_window_entry, fill_window_entry
170    +C_LABEL(trapbase):
171    +t_zero:        b goprol; nop; nop; nop;
172    +t_tflt:        SRMMU_TFAULT                        /* Inst. Access Exception        */
173    +t_bins:        TRAP_ENTRY(0x2, bad_instruction)    /* Illegal Instruction           */
174    +t_pins:        TRAP_ENTRY(0x3, priv_instruction)   /* Privileged Instruction        */
175    +t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler)   /* Floating Point Disabled       */
176    +t_wovf:        WINDOW_SPILL                        /* Window Overflow               */
177    +t_wunf:        WINDOW_FILL                         /* Window Underflow              */
178    +t_mna: TRAP_ENTRY(0x7, mna_handler)        /* Memory Address Not Aligned    */
179    +t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler)   /* Floating Point Exception      */
180    +t_dflt:        SRMMU_DFAULT                        /* Data Miss Exception           */
181    +t_tio: TRAP_ENTRY(0xa, do_tag_overflow)    /* Tagged Instruction Ovrflw     */
182    +t_wpt: TRAP_ENTRY(0xb, do_watchpoint)      /* Watchpoint Detected           */
183    +t_badc:        BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
184    +t_irq1:        TRAP_ENTRY_INTERRUPT(1)             /* IRQ Software/SBUS Level 1     */
185    +t_irq2:        TRAP_ENTRY_INTERRUPT(2)             /* IRQ SBUS Level 2              */
186    +t_irq3:        TRAP_ENTRY_INTERRUPT(3)             /* IRQ SCSI/DMA/SBUS Level 3     */
187    +t_irq4:        TRAP_ENTRY_INTERRUPT(4)             /* IRQ Software Level 4          */
188    +t_irq5:        TRAP_ENTRY_INTERRUPT(5)             /* IRQ SBUS/Ethernet Level 5     */
189    +t_irq6:        TRAP_ENTRY_INTERRUPT(6)             /* IRQ Software Level 6          */
190    +t_irq7:        TRAP_ENTRY_INTERRUPT(7)             /* IRQ Video/SBUS Level 5        */
191    +t_irq8:        TRAP_ENTRY_INTERRUPT(8)             /* IRQ SBUS Level 6              */
192    +t_irq9:        TRAP_ENTRY_INTERRUPT(9)             /* IRQ SBUS Level 7              */
193    +t_irq10:TRAP_ENTRY_INTERRUPT(10)            /* IRQ Timer #1 (one we use)     */
194    +t_irq11:TRAP_ENTRY_INTERRUPT(11)            /* IRQ Floppy Intr.              */
195    +t_irq12:TRAP_ENTRY_INTERRUPT(12)            /* IRQ Zilog serial chip         */
196    +t_irq13:TRAP_ENTRY_INTERRUPT(13)            /* IRQ Audio Intr.               */
197    +t_irq14:TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
198    +t_nmi: NMI_TRAP                            /* Level 15 (NMI)                */
199    +t_racc:        TRAP_ENTRY(0x20, do_reg_access)     /* General Register Access Error */
200    +t_iacce:BAD_TRAP(0x21)                      /* Instr Access Error            */
201    +t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
202    +t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled)    /* Co-Processor Disabled         */
203    +t_uflsh:SKIP_TRAP(0x25, unimp_flush)        /* Unimplemented FLUSH inst.     */
204    +t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
205    +t_cpexc:TRAP_ENTRY(0x28, do_cp_exception)   /* Co-Processor Exception        */
206    +t_dacce:SRMMU_DFAULT                        /* Data Access Error             */
207    +t_hwdz:        TRAP_ENTRY(0x2a, do_hw_divzero)     /* Division by zero, you lose... */
208    +t_dserr:BAD_TRAP(0x2b)                      /* Data Store Error              */
209    +t_daccm:BAD_TRAP(0x2c)                      /* Data Access MMU-Miss          */
210    +t_bad2d:               BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
211    +        BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
212    +        BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
213    +        BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
214    +t_iaccm:BAD_TRAP(0x3c)                      /* Instr Access MMU-Miss         */
215    + BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
216    + BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
217    + BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
218    + BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
219    + BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
220    + BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
221    + BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
222    + BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
223    + BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
224    + BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
225    + BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
226    + BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
227    + BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
228    + BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
229    + BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
230    + BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
231    + BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
232    +t_sunos:SUNOS_SYSCALL_TRAP                  /* SunOS System Call             */
233    +t_sbkpt:BREAKPOINT_TRAP                     /* Software Breakpoint/KGDB      */
234    +t_divz:        BAD_TRAP(0x82)                      /* Divide by zero trap           */
235    +t_flwin:TRAP_ENTRY(0x83, do_flush_windows)  /* Flush Windows Trap            */
236    +t_clwin:BAD_TRAP(0x84)                      /* Clean Windows Trap            */
237    +t_rchk:        BAD_TRAP(0x85)                      /* Range Check                   */
238    +t_funal:BAD_TRAP(0x86)                      /* Fix Unaligned Access Trap     */
239    +t_iovf:        BAD_TRAP(0x87)                      /* Integer Overflow Trap         */
240    +t_slowl:SOLARIS_SYSCALL_TRAP                /* Slowaris System Call          */
241    +t_netbs:NETBSD_SYSCALL_TRAP                 /* Net-B.S. System Call          */
242    +t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
243    + BAD_TRAP(0x8e) BAD_TRAP(0x8f)
244    +t_linux:LINUX_SYSCALL_TRAP                  /* Linux System Call             */
245    +t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
246    + BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
247    + BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
248    +t_getcc:GETCC_TRAP                          /* Get Condition Codes           */
249    +t_setcc:SETCC_TRAP                          /* Set Condition Codes           */
250    +t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
251    + BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
252    +t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
253    + BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
254    + BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
255    + BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
256    + BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
257    + BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
258    + BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
259    +t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
260    + BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
261    + BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
262    + BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
263    + BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
264    +t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
265    + BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
266    + BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
267    + BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
268    + BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
269    +t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
270    + BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
271    + BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
272    + BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
273    + BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
274    +t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
275    +dbtrap:        BAD_TRAP(0xfe)                      /* Debugger/PROM breakpoint #1   */
276    +dbtrap2:BAD_TRAP(0xff)                      /* Debugger/PROM breakpoint #2   */        
277    +
278    +stub_trap:
279    +   set (PHYS_JJ_TCX_FB + 0xbf0), %g5   /* 2 cells from side */
280    +   set 0x00ffffff, %g4
281    +   sta %g4, [%g5] ASI_M_BYPASS
282    +1:     ba 1b; nop
283    +
284    +       .section ".bss"
285    +       .align 8
286    +bss_start:
287    +       .align  0x1000          ! PAGE_SIZE
288    +       .globl C_LABEL(bootup_user_stack)
289    +        .type   bootup_user_stack,#object
290    +        .size   bootup_user_stack,0x2000
291    +C_LABEL(bootup_user_stack):            .skip 0x2000
292    +
293    +       .section ".text"
294    +
295    +goprol:
296    +       ! %g1 contains end of memory
297    +       ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
298    +       set     PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2  ! add 0x1000 for temp tables
299    +       sub     %g1, %g2, %g2                   ! start of private memory
300    +       srl     %g2, 0x4, %g7                   ! ctx table at s+0x0
301    +       add     %g2, 0x400, %g3                 ! l1 table at s+0x400
302    +       srl     %g3, 0x4, %g3
303    +       or      %g3, 0x1, %g3
304    +       sta     %g3, [%g2] ASI_M_BYPASS
305    +       add     %g2, 0x400, %g2                 ! s+0x400
306    +       add     %g2, 0x800, %g3                 ! l2 table for ram (00xxxxxx) at s+0x800
307    +       srl     %g3, 0x4, %g3
308    +       or      %g3, 0x1, %g3
309    +       sta     %g3, [%g2] ASI_M_BYPASS
310    +       add     %g2, 0x500, %g3                 ! l2 table for rom (ffxxxxxx) at s+0x900
311    +       add     %g2, 0x3fc, %g2                 ! s+0x7fc
312    +       srl     %g3, 0x4, %g3
313    +       or      %g3, 0x1, %g3
314    +       sta     %g3, [%g2] ASI_M_BYPASS
315    +       add     %g2, 0x4, %g2                   ! s+0x800
316    +       set     ((7 << 2) | 2), %g3             ! 7 = U: --- S: RWX (main memory)
317    +       sta     %g3, [%g2] ASI_M_BYPASS
318    +       add     %g2, 0x200, %g3                 ! l3 table for rom at s+0xa00
319    +       add     %g2, 0x1d0, %g2                 ! s+0x9d0
320    +       srl     %g3, 0x4, %g3
321    +       or      %g3, 0x1, %g3
322    +       sta     %g3, [%g2] ASI_M_BYPASS
323    +       add     %g2, 0x30, %g2                  ! s+0xa00
324    +
325    +       set     PROLBASE, %g3
326    +       set     0x1000, %g5
327    +       set     (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
328    +1:     srl     %g3, 0x4, %g4
329    +       or      %g4, ((7 << 2) | 2), %g4        ! 4 = U: --X S: --X (rom, execute only)
330    +       sta     %g4, [%g2] ASI_M_BYPASS
331    +       add     %g2, 4, %g2
332    +       add     %g3, %g5, %g3
333    +       deccc   %g6
334    +       bne     1b
335    +        nop
336    +#if 0  
337    +       set     (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
338    +1:     srl     %g3, 0x4, %g4
339    +       or      %g4, ((0 << 2) | 2), %g4        ! 0 = U: R-- S: R-- (rom, read only)
340    +       sta     %g4, [%g2] ASI_M_BYPASS
341    +       add     %g2, 4, %g2
342    +       add     %g3, %g5, %g3
343    +       deccc   %g6
344    +       bne     1b
345    +        nop
346    +#endif
347    +       set     (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
348    +       set     0x1000, %g4
349    +       sll     %g7, 0x4, %g3
350    +       add     %g4, %g3, %g3
351    +1:     srl     %g3, 0x4, %g4
352    +       or      %g4, ((7 << 2) | 2), %g4        ! 5 = U: R-- S: RW- (data area, read/write)
353    +       sta     %g4, [%g2] ASI_M_BYPASS
354    +       add     %g2, 4, %g2
355    +       add     %g3, %g5, %g3
356    +       deccc   %g6
357    +       bne     1b
358    +        nop
359    +
360    +       mov     %g1, %g3
361    +
362    +       set     AC_M_CTPR, %g2
363    +       sta     %g7, [%g2] ASI_M_MMUREGS        ! set ctx table ptr
364    +       set     1, %g1
365    +       sta     %g1, [%g0] ASI_M_MMUREGS        ! enable mmu
366    +
367    +       /*
368    +        * The code which enables traps is a simplified version of
369    +        * kernel head.S.
370    +        *
371    +        * We know number of windows as 8 so we do not calculate them.
372    +        * The deadwood is here for any case.
373    +        */
374    +
375    +       /* Turn on Supervisor, EnableFloating, and all the PIL bits.
376    +        * Also puts us in register window zero with traps off.
377    +        */
378    +       set     (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
379    +       wr      %g2, 0x0, %psr
380    +       WRITE_PAUSE
381    +
382    +       /* I want a kernel stack NOW! */
383    +       set     C_LABEL(bootup_user_stack), %g1
384    +       set     (0x2000 - REGWIN_SZ), %g2
385    +       add     %g1, %g2, %sp
386    +       mov     0, %fp                  /* And for good luck */
387    +
388    +       /* Zero out our BSS section. */
389    +       set     C_LABEL(bss_start) , %o0        ! First address of BSS
390    +       set     C_LABEL(end) , %o1              ! Last address of BSS
391    +       ba      2f
392    +        nop
393    +1:
394    +       st      %g0, [%o0]
395    +2:
396    +       subcc   %o0, %o1, %g0
397    +       bl      1b
398    +        add    %o0, 0x4, %o0
399    +
400    +       sethi   %hi( C_LABEL(ram_size) ), %o0
401    +       st      %g3, [%o0 + %lo( C_LABEL(ram_size) )]
402    +
403    +       mov     2, %g1
404    +       wr      %g1, 0x0, %wim                  ! make window 1 invalid
405    +       WRITE_PAUSE
406    +
407    +#if 0
408    +       wr  %g0, 0x0, %wim
409    +       WRITE_PAUSE
410    +       save
411    +       rd  %psr, %g3
412    +       restore
413    +       and  %g3, PSR_CWP, %g3
414    +       add  %g3, 0x1, %g3
415    +#else
416    +       or      %g0, 8, %g3
417    +#endif
418    +
419    +#if 0
420    +       sethi   %hi( C_LABEL(cputyp) ), %o0
421    +       st      %g7, [%o0 + %lo( C_LABEL(cputyp) )]
422    +
423    +       sethi   %hi( C_LABEL(nwindows) ), %g4
424    +       st      %g3, [%g4 + %lo( C_LABEL(nwindows) )]
425    +
426    +       sub     %g3, 0x1, %g3
427    +       sethi   %hi( C_LABEL(nwindowsm1) ), %g4
428    +       st      %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
429    +#endif
430    +
431    +       /* Here we go, start using Linux's trap table... */
432    +       set     C_LABEL(trapbase), %g3
433    +       wr      %g3, 0x0, %tbr
434    +       WRITE_PAUSE
435    +
436    +       /* Finally, turn on traps so that we can call c-code. */
437    +       rd      %psr, %g3
438    +       wr      %g3, 0x0, %psr
439    +       WRITE_PAUSE
440    +
441    +       wr      %g3, PSR_ET, %psr
442    +       WRITE_PAUSE
443    +
444    +       .globl prolmain
445    +       call C_LABEL(prolmain)
446    +        nop
447    +
448    +3:
449    +       b       3b
450    +        nop
451    +
452    +/*
453    + * Memory access trap handler
454    + *   %l0  program %psr from trap table entry
455    + *   %l1  program %pc from hardware
456    + *   %l2  program %npc from hardware
457    + *   %l3  program %wim from trap table entry
458    + *   %l4
459    + *   %l5
460    + *   %l6
461    + *   %l7  text flag from trap table entry
462    + */
463    +
464    +       .section ".text"
465    +       .globl srmmu_fault
466    +C_LABEL(srmmu_fault):
467    +
468    +       set AC_M_SFAR, %l6
469    +       set AC_M_SFSR, %l5
470    +       lda [%l6] ASI_M_MMUREGS, %l6
471    +       lda [%l5] ASI_M_MMUREGS, %l5
472    +
473    +       set ignore_fault, %l5
474    +       ld [%l5], %l5
475    +       subcc %l5, %g0, %g0             /* NULL pointer trap faults always */
476    +       be 3f
477    +        nop
478    +       subcc %l5, %l6, %g0
479    +       be 2f
480    +        nop
481    +3:
482    +
483    +   set (PHYS_JJ_TCX_FB + 0xbf0), %g5   /* 2 cells from side */
484    +   set 0x00ffffff, %g4
485    +   sta %g4, [%g5] ASI_M_BYPASS
486    +   add %g5, 8, %g5                     /* On right side */
487    +   sta %g4, [%g5] ASI_M_BYPASS
488    +1:     ba 1b; nop
489    +
490    +2:
491    +       set C_LABEL(fault_ignored), %l5
492    +       mov 1, %l6
493    +       st %l6, [%l5]
494    +
495    +       /*
496    +        * Skip the faulting instruction.
497    +        * I think it works when next instruction is a branch even.
498    +        */
499    +       or %l2, 0, %l1
500    +       add %l2, 4, %l2
501    +
502    +       wr %l0, 0, %psr
503    +       WRITE_PAUSE
504    +       jmp %l1
505    +       rett %l2
506    +
507    +/*
508    + * Slow external versions of st_bypass and ld_bypass.
509    + * rconsole.c uses inlines. We call these in places which are not speed
510    + * critical, to avoid compiler bugs.
511    + */
512    +       .globl C_LABEL(st_bypass)
513    +C_LABEL(st_bypass):
514    +       retl
515    +        sta %o1, [%o0] ASI_M_BYPASS
516    +       .globl C_LABEL(ld_bypass)
517    +C_LABEL(ld_bypass):
518    +       retl
519    +        lda [%o0] ASI_M_BYPASS, %o0
520    +       .globl C_LABEL(sth_bypass)
521    +C_LABEL(sth_bypass):
522    +       retl
523    +        stha %o1, [%o0] ASI_M_BYPASS
524    +       .globl C_LABEL(ldh_bypass)
525    +C_LABEL(ldh_bypass):
526    +       retl
527    +        lduha [%o0] ASI_M_BYPASS, %o0
528    +       .globl C_LABEL(stb_bypass)
529    +C_LABEL(stb_bypass):
530    +       retl
531    +        stba %o1, [%o0] ASI_M_BYPASS
532    +       .globl C_LABEL(ldb_bypass)
533    +C_LABEL(ldb_bypass):
534    +       retl
535    +        lduba [%o0] ASI_M_BYPASS, %o0
536    diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
537    --- proll_18.orig/qemu/main.c   1970-01-01 00:00:00.000000000 +0000
538    +++ proll-patch4/qemu/main.c    2004-11-23 19:05:34.000000000 +0000
539    @@ -0,0 +1,178 @@
540    +/**
541    + ** Proll (PROM replacement)
542    + ** Copyright 1999 Pete Zaitcev
543    + ** This code is licensed under GNU General Public License.
544    + **/
545    +#include <stdarg.h>
546    +
547    +// #include <asm/contregs.h>
548    +#include <asi.h>
549    +#include "pgtsrmmu.h"
550    +#include "iommu.h"             /* Typical SBus IOMMU for sun4m */
551    +#include "phys_jj.h"
552    +#include "vconsole.h"
553    +#include "version.h"
554    +#include <general.h>           /* __P() */
555    +#include <net.h>               /* init_net() */
556    +#include <romlib.h>            /* we are a provider for part of this. */
557    +#include <netpriv.h>           /* myipaddr */
558    +#include <arpa.h>
559    +#include <system.h>            /* our own prototypes */
560    +
561    +static void init_idprom(void);
562    +static void makepages_q(struct phym *t, unsigned int highbase);
563    +
564    +struct vconterm dp0;
565    +struct mem cmem;               /* Current memory, virtual */
566    +struct mem cio;                        /* Current I/O space */
567    +struct phym pmem;              /* Current phys. mem. */
568    +struct iommu ciommu;           /* Our IOMMU on sun4m */
569    +
570    +static char *hw_idprom;
571    +int ignore_fault, fault_ignored, ram_size;
572    +
573    +/*
574    + */
575    +void prolmain()
576    +{
577    +       //static const char fname[14] = "00000000.PROL";
578    +       static struct banks bb;
579    +       unsigned int hiphybas;
580    +       const void *romvec;
581    +
582    +       vcon_init(&dp0, PHYS_JJ_TCX_FB);
583    +       printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
584    +       printk("%d MB total\n", ram_size/(1024*1024));
585    +
586    +       bb.nbanks = 1;
587    +       bb.bankv[0].start = 0;
588    +       bb.bankv[0].length = ram_size;
589    +
590    +       hiphybas = ram_size - PROLSIZE;
591    +
592    +       mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
593    +       makepages_q(&pmem, hiphybas);
594    +       init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
595    +
596    +       mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
597    +           (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
598    +
599    +       iommu_init(&ciommu, hiphybas);
600    +
601    +       /*
602    +        */
603    +       init_idprom();
604    +       sched_init();
605    +       le_probe();
606    +       init_net();
607    +
608    +#if 0
609    +#if 0 /* RARP */
610    +       if (rarp() != 0) fatal();
611    +       /* printrarp(); */
612    +       xtoa(myipaddr, fname, 8);
613    +       if (load(servaddr, fname) != 0) fatal();
614    +#else
615    +       if (bootp() != 0) fatal();
616    +       /*
617    +        * boot_rec.bp_file cannot be used because system PROM
618    +        * uses it to locate ourselves. If we load from boot_rec.bp_file,
619    +        * we will loop reloading PROLL over and over again.
620    +        * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
621    +        */
622    +       xtoa(myipaddr, fname, 8);
623    +       if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
624    +#endif
625    +#endif
626    +
627    +       romvec = init_openprom(bb.nbanks, bb.bankv, hiphybas);
628    +
629    +       printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
630    +           PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
631    +           (int)cio.start, (int)cio.curp);
632    +       //set_timeout(5);  while (!chk_timeout()) { }  /* P3: let me read */
633    +
634    +       {
635    +               void (*entry)(const void *, int, int, int, int) = (void (*)(const void*, int, int, int, int)) LOADBASE;
636    +               entry(romvec, 0, 0, 0, 0);
637    +       }
638    +
639    +       mem_fini(&cmem);
640    +       vcon_fini(&dp0);
641    +}
642    +
643    +/*
644    + * dvma_alloc over iommu_alloc.
645    + */
646    +void *dvma_alloc(int size, unsigned int *pphys)
647    +{
648    +       return iommu_alloc(&ciommu, size, pphys);
649    +}
650    +
651    +/*
652    + */
653    +void udelay(unsigned long usecs)
654    +{
655    +       int i, n;
656    +       n = usecs*50;
657    +       for (i = 0; i < n; i++) { }
658    +}
659    +
660    +static void init_idprom()
661    +{
662    +       char *va_prom;
663    +
664    +       if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
665    +               printk("init_idprom: cannot map eeprom\n");
666    +               fatal();
667    +       }
668    +       bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
669    +       /*
670    +        * hw_idprom is not used anywhere.
671    +        * It's just as we hate to leave hanging pointers (I/O page here).
672    +        */
673    +       hw_idprom = va_prom;
674    +}
675    +
676    +/*
677    + * Make CPU page tables.
678    + * Returns pointer to context table.
679    + * Here we ignore memory allocation errors which "should not happen"
680    + * because we cannot print anything anyways if memory initialization fails.
681    + */
682    +void makepages_q(struct phym *t, unsigned int highbase)
683    +{
684    +       unsigned int *ctp, *l1, pte;
685    +       int i;
686    +       unsigned int pa, va;
687    +
688    +       ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
689    +       l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
690    +
691    +       pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
692    +       for (i = 0; i < NCTX_SWIFT; i++) {
693    +               ctp[i] = pte;
694    +       }
695    +
696    +       pa = PROLBASE;
697    +       for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
698    +               map_page(l1, va, pa, 0, highbase);
699    +               pa += PAGE_SIZE;
700    +       }
701    +       pa = highbase + PROLDATA - PROLBASE;
702    +       for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
703    +               map_page(l1, va, pa, 0, highbase);
704    +               pa += PAGE_SIZE;
705    +       }
706    +
707    +       /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
708    +       pa = 0;
709    +       for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
710    +               map_page(l1, va, pa, 0, highbase);
711    +               pa += PAGE_SIZE;
712    +       }
713    +
714    +       t->pctp = ctp;
715    +       t->pl1 = l1;
716    +       t->pbas = highbase;
717    +}
718    diff -ruN proll_18.orig/qemu/Makefile proll-patch4/qemu/Makefile
719    --- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
720    +++ proll-patch4/qemu/Makefile  2004-11-13 15:50:49.000000000 +0000
721    @@ -0,0 +1,119 @@
722    +#
723    +# proll:
724    +# qemu/Makefile - make PROLL for QEMU
725    +# $Id$
726    +#
727    +# Copyright 1999 Pete Zaitcev
728    +# This is Free Software is licensed under terms of GNU General Public License.
729    +#
730    +
731    +CC = gcc
732    +
733    +#CROSS = /usr/local/sparc/bin/sparc-sun-linux-
734    +CROSS = sparc-unknown-linux-gnu-
735    +
736    +CROSSCC = $(CROSS)gcc
737    +CROSSLD = $(CROSS)ld
738    +CROSSNM = $(CROSS)nm
739    +
740    +RM = /bin/rm -f
741    +ELFTOAOUT = elftoaout
742    +
743    +#
744    +SRC = ../src
745    +
746    +# Due to remapping algorithm PROLBASE should be algned on PMD.
747    +# We make PROLBASE a define instead of using _start because we
748    +# want to shift it to form a PGD entry. A relocatable label will not work.
749    +# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
750    +PROLBASE =   0xffd00000
751    +PROLRODATA = 0xffd07000
752    +PROLDATA =   0xffd09000
753    +PROLSIZE = (240*1024)
754    +
755    +# Linux
756    +# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6.
757    +# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them.
758    +# __ANSI__ is supposed to be on by default but it is not.
759    +CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g
760    +ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g
761    +# Solaris or Linux/i386 cross compilation
762    +#CFLAGS = -Iinclude -O
763    +
764    +LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA)
765    +
766    +ALL = proll.aout
767    +PROLLEXE = proll.elf
768    +
769    +OBJS = head.o wuf.o wof.o main.o vconsole.o hconsole.o rconsole.o \
770    + printf.o le.o system.o iommu.o \
771    + arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o
772    +
773    +all:           $(ALL)
774    +
775    +$(PROLLEXE):   $(OBJS)
776    +       $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS)
777    +
778    +head.o:         head.S $(SRC)/phys_jj.h \
779    +  $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h
780    +       $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S
781    +
782    +main.o:         main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \
783    +  $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \
784    +  $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h
785    +       $(CROSSCC) $(CFLAGS) -c $*.c
786    +openprom.o:    openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \
787    +  $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h
788    +       $(CROSSCC) $(CFLAGS) -c $*.c
789    +
790    +system.o:       $(SRC)/system.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \
791    +  $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \
792    +  $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h
793    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
794    +iommu.o:        $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \
795    + $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h
796    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
797    +vconsole.o:    $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h
798    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
799    +hconsole.o:    $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h
800    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
801    +rconsole.o:    $(SRC)/rconsole.c $(SRC)/rconsole.h
802    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
803    +printf.o:       $(SRC)/printf.c
804    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
805    +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
806    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
807    +
808    +arp.o:         $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
809    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
810    +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
811    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
812    +tftp.o:                $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
813    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
814    +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
815    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
816    +packet.o:      $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
817    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
818    +sched_4m.o:    $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
819    +       $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
820    +bootp.o:       $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
821    +  $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
822    +       $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
823    +
824    +wuf.o:         $(SRC)/wuf.S
825    +       $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
826    +wof.o:         $(SRC)/wof.S
827    +       $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
828    +
829    +#genlab.o:      genlab.c
830    +#      $(CC) -c $*.c
831    +#
832    +#genlab:        genlab.o
833    +#      $(CC) -o genlab genlab.o
834    +
835    +clean:
836    +       $(RM) $(OBJS)
837    +       $(RM) $(PROLLEXE) proll.aout
838    +
839    +proll.aout:    $(PROLLEXE)
840    +       $(ELFTOAOUT) -o proll.aout $(PROLLEXE)
841    diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c
842    --- proll_18.orig/qemu/openprom.c       1970-01-01 00:00:00.000000000 +0000
843    +++ proll-patch4/qemu/openprom.c        2004-11-23 19:14:05.000000000 +0000
844    @@ -0,0 +1,596 @@
845    +/*
846    + * PROM interface support
847    + * Copyright 1996 The Australian National University.
848    + * Copyright 1996 Fujitsu Laboratories Limited
849    + * Copyright 1999 Pete A. Zaitcev
850    + * This software may be distributed under the terms of the Gnu
851    + * Public License version 2 or later
852    + */
853    +
854    +#include <openprom.h>
855    +#include <general.h>
856    +#include <romlib.h>
857    +#include <system.h>
858    +#include <vconsole.h>
859    +#include "phys_jj.h"
860    +
861    +struct property {
862    +       const char *name;
863    +       const char *value;
864    +       const int length;
865    +};
866    +
867    +struct node {
868    +       const struct property *properties;
869    +       /* short */ const int sibling;
870    +       /* short */ const int child;
871    +};
872    +
873    +static int obp_nextnode(int node);
874    +static int obp_child(int node);
875    +static int obp_proplen(int node, char *name);
876    +static int obp_getprop(int node, char *name, char *val);
877    +static int obp_setprop(int node, char *name, char *val, int len);
878    +static const char *obp_nextprop(int node, char *name);
879    +
880    +static char obp_idprom[IDPROM_SIZE];
881    +static const struct property null_properties = { NULL, NULL, -1 };
882    +static const int prop_true = -1;
883    +
884    +static const struct property propv_root[] = {
885    +       {"name",        "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") },
886    +       {"idprom",      obp_idprom, IDPROM_SIZE},
887    +       {"banner-name", "JavaStation", sizeof("JavaStation")},
888    +       {"compatible",  "sun4m", 6},
889    +       {NULL, NULL, -1}
890    +};
891    +
892    +static const int prop_iommu_reg[] = {
893    +       0x0, 0x10000000, 0x00000300,
894    +};
895    +static const struct property propv_iommu[] = {
896    +       {"name",        "iommu", sizeof("iommu")},
897    +       {"reg",         (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
898    +       {NULL, NULL, -1}
899    +};
900    +
901    +static const int prop_sbus_ranges[] = {
902    +       0x0, 0x0, 0x0, 0x30000000, 0x10000000,
903    +       0x1, 0x0, 0x0, 0x40000000, 0x10000000,
904    +       0x2, 0x0, 0x0, 0x50000000, 0x10000000,
905    +       0x3, 0x0, 0x0, 0x60000000, 0x10000000,
906    +       0x4, 0x0, 0x0, 0x70000000, 0x10000000,
907    +};
908    +static const struct property propv_sbus[] = {
909    +       {"name",        "sbus", 5},
910    +       {"ranges",      (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
911    +       {NULL, NULL, -1}
912    +};
913    +
914    +static const int prop_tcx_regs[] = {
915    +       0x2, 0x00800000, 0x00100000,
916    +       0x2, 0x02000000, 0x00000001,
917    +       0x2, 0x04000000, 0x00800000,
918    +       0x2, 0x06000000, 0x00800000,
919    +       0x2, 0x0a000000, 0x00000001,
920    +       0x2, 0x0c000000, 0x00000001,
921    +       0x2, 0x0e000000, 0x00000001,
922    +       0x2, 0x00700000, 0x00001000,
923    +       0x2, 0x00200000, 0x00000004,
924    +       0x2, 0x00300000, 0x0000081c,
925    +       0x2, 0x00000000, 0x00010000,
926    +       0x2, 0x00240000, 0x00000004,
927    +       0x2, 0x00280000, 0x00000001,
928    +};
929    +
930    +#if 1  /* Zaitcev */
931    +static const int pixfreq = 0x03dfd240;
932    +static const int hbporch = 0xa0;
933    +static const int vfreq = 0x3c;
934    +#endif
935    +#if 0  /* Kevin Boone - 70Hz refresh */
936    +static const int pixfreq = 0x047868C0;
937    +static const int hbporch = 0x90;
938    +static const int vfreq = 0x46;
939    +#endif
940    +
941    +static const int vbporch = 0x1d;
942    +static const int vsync = 0x6;
943    +static const int hsync = 0x88;
944    +static const int vfporch = 0x3;
945    +static const int hfporch = 0x18;
946    +static const int height = 0x300;
947    +static const int width = 0x400;
948    +static const int linebytes = 0x400;
949    +static const int depth = 8;
950    +static const int tcx_intr[] = { 5, 0 };
951    +static const int tcx_interrupts = 5;
952    +static const struct property propv_sbus_tcx[] = {
953    +       {"name",        "SUNW,tcx", sizeof("SUNW,tcx")},
954    +       {"vbporch",     (char*)&vbporch, sizeof(int)},
955    +       {"hbporch",     (char*)&hbporch, sizeof(int)},
956    +       {"vsync",       (char*)&vsync, sizeof(int)},
957    +       {"hsync",       (char*)&hsync, sizeof(int)},
958    +       {"vfporch",     (char*)&vfporch, sizeof(int)},
959    +       {"hfporch",     (char*)&hfporch, sizeof(int)},
960    +       {"pixfreq",     (char*)&pixfreq, sizeof(int)},
961    +       {"vfreq",       (char*)&vfreq, sizeof(int)},
962    +       {"height",      (char*)&height, sizeof(int)},
963    +       {"width",       (char*)&width, sizeof(int)},
964    +       {"linebytes",   (char*)&linebytes, sizeof(int)},
965    +       {"depth",       (char*)&depth, sizeof(int)},
966    +       {"reg",         (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
967    +       {"tcx-8-bit",   (char*)&prop_true, 0},
968    +       {"intr",        (char*)&tcx_intr[0], sizeof(tcx_intr)},
969    +       {"interrupts",  (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
970    +       {"device_type", "display", sizeof("display")},
971    +       {NULL, NULL, -1}
972    +};
973    +
974    +static const int prop_cs4231_reg[] = {
975    +       0x3, 0x0C000000, 0x00000040
976    +};
977    +static const int cs4231_interrupts = 5;
978    +static const int cs4231_intr[] = { 5, 0 };
979    +
980    +static const struct property propv_sbus_cs4231[] = {
981    +       {"name",        "SUNW,CS4231", sizeof("SUNW,CS4231") },
982    +       {"intr",        (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
983    +       {"interrupts",  (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
984    +       {"reg",         (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
985    +       {"device_type", "serial", sizeof("serial") },
986    +       {"alias",       "audio", sizeof("audio") },
987    +       {NULL, NULL, -1}
988    +};
989    +
990    +static const int cpu_nctx = NCTX_SWIFT;
991    +static const int cpu_cache_line_size = 0x20;
992    +static const int cpu_cache_nlines = 0x200;
993    +static const struct property propv_cpu[] = {
994    +       {"name",        "STP1012PGA", sizeof("STP1012PGA") },
995    +       {"device_type", "cpu", 4 },
996    +       {"mmu-nctx",    (char*)&cpu_nctx, sizeof(int)},
997    +       {"cache-line-size",     (char*)&cpu_cache_line_size, sizeof(int)},
998    +       {"cache-nlines",        (char*)&cpu_cache_nlines, sizeof(int)},
999    +       {NULL, NULL, -1}
1000    +};
1001    +
1002    +static const int prop_obio_ranges[] = {
1003    +       0x0, 0x0, 0x0, 0x71000000, 0x01000000,
1004    +};
1005    +static const struct property propv_obio[] = {
1006    +       {"name",        "obio", 5 },
1007    +       {"ranges",      (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
1008    +       {NULL, NULL, -1}
1009    +};
1010    +
1011    +static const int prop_auxio_reg[] = {
1012    +       0x0, 0x00900000, 0x00000001,
1013    +};
1014    +static const struct property propv_obio_auxio[] = {
1015    +       {"name",        "auxio", sizeof("auxio") },
1016    +       {"reg",         (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
1017    +       {NULL, NULL, -1}
1018    +};
1019    +
1020    +static const int prop_int_reg[] = {
1021    +       0x0, 0x00e00000, 0x00000010,
1022    +       0x0, 0x00e10000, 0x00000010,
1023    +};
1024    +static const struct property propv_obio_int[] = {
1025    +       {"name",        "interrupt", sizeof("interrupt")},
1026    +       {"reg",         (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
1027    +       {NULL, NULL, -1}
1028    +};
1029    +
1030    +static const int prop_cnt_reg[] = {
1031    +       0x0, 0x00d00000, 0x00000010,
1032    +       0x0, 0x00d10000, 0x00000010,
1033    +};
1034    +static const struct property propv_obio_cnt[] = {
1035    +       {"name",        "counter", sizeof("counter")},
1036    +       {"reg",         (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
1037    +       {NULL, NULL, -1}
1038    +};
1039    +
1040    +static const int prop_eeprom_reg[] = {
1041    +       0x0, 0x00200000, 0x00002000,
1042    +};
1043    +static const struct property propv_obio_eep[] = {
1044    +       {"name",        "eeprom", sizeof("eeprom")},
1045    +       {"reg",         (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
1046    +       {"model",       "mk48t08", sizeof("mk48t08")},
1047    +       {NULL, NULL, -1}
1048    +};
1049    +
1050    +static const int prop_su_reg[] = {
1051    +       0x0, 0x003002f8, 0x00000008,
1052    +};
1053    +static const struct property propv_obio_su[] = {
1054    +       {"name",        "su", sizeof("su")},
1055    +       {"reg",         (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
1056    +       {NULL, NULL, -1}
1057    +};
1058    +
1059    +static const int prop_zs_intr[] = { 0x26, 0x0 };
1060    +static const int prop_zs_reg[] = {
1061    +       0x4, 0x00000000, 0x0000000f,
1062    +};
1063    +static const int prop_zs_slave[] = { 0x1 };
1064    +static const struct property propv_obio_zs[] = {
1065    +       {"name",        "zs", sizeof("zs")},
1066    +       {"reg",         (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
1067    +       {"reg",         (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
1068    +       {"device_type", "serial", sizeof("serial") },
1069    +       {NULL, NULL, -1}
1070    +};
1071    +
1072    +static const int prop_zs1_intr[] = { 0x26, 0x0 };
1073    +static const int prop_zs1_reg[] = {
1074    +       0x4, 0x00100000, 0x0000000f,
1075    +};
1076    +static const int prop_zs1_slave[] = { 0x0 };
1077    +static const struct property propv_obio_zs1[] = {
1078    +       {"name",        "zs", sizeof("zs")},
1079    +       {"reg",         (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
1080    +       {"reg",         (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
1081    +       {"device_type", "serial", sizeof("serial") },
1082    +       {NULL, NULL, -1}
1083    +};
1084    +
1085    +static const int prop_ledma_reg[] = {
1086    +       0x4, 0x08400010, 0x00000020,
1087    +};
1088    +static const int prop_ledma_burst = 0x3f;
1089    +static const struct property propv_sbus_ledma[] = {
1090    +       {"name",        "ledma", sizeof("ledma")},
1091    +       {"reg",         (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
1092    +       {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
1093    +       {NULL, NULL, -1}
1094    +};
1095    +
1096    +static const int prop_le_reg[] = {
1097    +       0x4, 0x08c00000, 0x00000004,
1098    +};
1099    +static const int prop_le_busmaster_regval = 0x7;
1100    +static const int prop_le_intr[] = { 0x26, 0x0 };
1101    +static const struct property propv_sbus_ledma_le[] = {
1102    +       {"name",        "le", sizeof("le")},
1103    +       {"reg",         (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
1104    +       {"busmaster-regval",    (char*)&prop_le_busmaster_regval, sizeof(int)},
1105    +       {"intr",        (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
1106    +       {NULL, NULL, -1}
1107    +};
1108    +
1109    +static const struct node nodes[] = {
1110    +       { &null_properties,      1,  0 }, /* 0 = big brother of root */
1111    +       { propv_root,            0,  2 }, /*  1 "/" */
1112    +       { propv_iommu,           8,  3 }, /*  2 "/iommu" */
1113    +       { propv_sbus,            0,  4 }, /*  3 "/iommu/sbus" */
1114    +       { propv_sbus_tcx,        5,  0 }, /*  4 "/iommu/sbus/SUNW,tcx" */
1115    +       { propv_sbus_ledma,      7,  6 }, /*  5 "/iommu/sbus/ledma" */
1116    +       { propv_sbus_ledma_le,   0,  0 }, /*  6 "/iommu/sbus/ledma/le" */
1117    +       { propv_sbus_cs4231,     0,  0 }, /*  7 "/iommu/sbus/SUNW,CS4231 */
1118    +       { propv_cpu,             9,  0 }, /*  8 "/STP1012PGA" */
1119    +       { propv_obio,            0, 10 }, /*  9 "/obio" */
1120    +       { propv_obio_int,       11,  0 }, /* 10 "/obio/interrupt" */
1121    +       { propv_obio_cnt,       12,  0 }, /* 11 "/obio/counter" */
1122    +       { propv_obio_eep,       13,  0 }, /* 12 "/obio/eeprom" */
1123    +       { propv_obio_su,        14,  0 }, /* 13 "/obio/su" */
1124    +       { propv_obio_auxio,      0,  0 }, /* 14 "/obio/auxio" */
1125    +       { propv_obio_zs,         0,  0 }, /* 14 "/obio/zs@0,0" */
1126    +       { propv_obio_zs1,        0,  0 }, /* 14 "/obio/zs@0,100000" */
1127    +};
1128    +
1129    +static struct linux_mlist_v0 totphys[MAX_BANKS];
1130    +static struct linux_mlist_v0 totmap[1];
1131    +static struct linux_mlist_v0 totavail[MAX_BANKS];
1132    +
1133    +static struct linux_mlist_v0 *ptphys;
1134    +static struct linux_mlist_v0 *ptmap;
1135    +static struct linux_mlist_v0 *ptavail;
1136    +
1137    +static const struct linux_nodeops nodeops0 = {
1138    +        obp_nextnode,  /* int (*no_nextnode)(int node); */
1139    +        obp_child,     /* int (*no_child)(int node); */
1140    +        obp_proplen,   /* int (*no_proplen)(int node, char *name); */
1141    +        obp_getprop,   /* int (*no_getprop)(int node,char *name,char *val); */
1142    +        obp_setprop,   /* int (*no_setprop)(int node, char *name,
1143    +                                char *val, int len); */
1144    +        obp_nextprop   /* char * (*no_nextprop)(int node, char *name); */
1145    +};
1146    +
1147    +static const char arg_nfsroot[] = "console=ttyS0 ip=bootp root=nfs";
1148    +
1149    +static const struct linux_arguments_v0 obp_arg = {
1150    +       { "le()", arg_nfsroot, NULL, NULL, NULL, NULL, NULL, NULL },
1151    +       { "" },
1152    +       { 'l', 'e' },  0, 0, 0, NULL,
1153    +       NULL
1154    +};
1155    +static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
1156    +
1157    +static const void * const synch_hook = NULL;
1158    +#if 0
1159    +static const char obp_stdin = PROMDEV_KBD;
1160    +static const char obp_stdout = PROMDEV_SCREEN;
1161    +#else
1162    +static const char obp_stdin = PROMDEV_TTYA;
1163    +static const char obp_stdout = PROMDEV_TTYA;
1164    +#endif
1165    +
1166    +static int obp_nbgetchar(void);
1167    +static int obp_nbputchar(int ch);
1168    +static void obp_reboot(char *);
1169    +static void obp_abort(void);
1170    +static void obp_halt(void);
1171    +static int obp_devopen(char *str);
1172    +static int obp_devclose(int dev_desc);
1173    +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
1174    +
1175    +static void doublewalk(unsigned ptab1, unsigned va)
1176    +{
1177    +unsigned int proc_tablewalk(int ctx, unsigned int va);
1178    +unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
1179    +
1180    +       proc_tablewalk(0, va);
1181    +       if (ptab1 != 0) mem_tablewalk(ptab1, va);
1182    +}
1183    +
1184  +#ifdef ORIG  +#ifdef ORIG
1185   #if 0 /* RARP */  +static const struct linux_romvec romvec0 = {
1186          if (rarp() != 0) fatal();  +       LINUX_OPPROM_MAGIC,             /* pv_magic_cookie */
1187          /* printrarp(); */  +       0,                              /* pv_romvers - Format selector! */
1188  @@ -117,13 +118,20 @@  +       77,                             /* pv_plugin_revision */
1189          xtoa(myipaddr, fname, 8);  +       0x10203,                        /* pv_printrev */
1190          if (load(boot_rec.bp_siaddr, fname) != 0) fatal();  +       {                               /* pv_v0mem */
1191    +               &ptphys,                /* v0_totphys */
1192    +               &ptmap,                 /* v0_prommap */
1193    +               &ptavail                /* v0_available */
1194    +       },
1195    +        &nodeops0,                     /* struct linux_nodeops *pv_nodeops; */
1196    +        (void*)doublewalk, /* P3 */    /* char **pv_bootstr; */
1197    +       {                               /* struct linux_dev_v0_funcs pv_v0devops; */
1198    +               &obp_devopen,           /* v0_devopen */
1199    +               &obp_devclose,          /* v0_devclose */
1200    +               &obp_rdblkdev,          /* v0_rdblkdev */
1201    +               NULL,                   /* v0_wrblkdev */
1202    +               NULL,                   /* v0_wrnetdev */
1203    +               NULL,                   /* v0_rdnetdev */
1204    +               NULL,                   /* v0_rdchardev */
1205    +               NULL,                   /* v0_wrchardev */
1206    +               NULL                    /* v0_seekdev */
1207    +       },
1208    +        &obp_stdin,                    /* char *pv_stdin */
1209    +        &obp_stdout,                   /* char *pv_stdout; */
1210    +        obp_nbgetchar,                 /* int (*pv_getchar)(void); */
1211    +        obp_nbputchar,                 /* void (*pv_putchar)(int ch); */
1212    +        obp_nbgetchar,                 /* int (*pv_nbgetchar)(void); */
1213    +        obp_nbputchar,                 /* int (*pv_nbputchar)(int ch); */
1214    +        NULL,                  /* void (*pv_putstr)(char *str, int len); */
1215    +        obp_reboot,                    /* void (*pv_reboot)(char *bootstr); */
1216    +        NULL,          /* void (*pv_printf)(__const__ char *fmt, ...); */
1217    +        obp_abort,                     /* void (*pv_abort)(void); */
1218    +        NULL,                          /* __volatile__ int *pv_ticks; */
1219    +        obp_halt,                      /* void (*pv_halt)(void); */
1220    +        (void *)&synch_hook,           /* void (**pv_synchook)(void); */
1221    +
1222    +#if 0
1223    +        /* Evaluate a forth string, not different proto for V0 and V2->up. */
1224    +        union {
1225    +                void (*v0_eval)(int len, char *str);
1226    +                void (*v2_eval)(char *str);
1227    +        } pv_fortheval;
1228    +#endif
1229    +       { 0 },                  /* pv_fortheval */
1230    +
1231    +        &obp_argp,             /* struct linux_arguments_v0 **pv_v0bootargs; */
1232    +       NULL,                   /* pv_enaddr */
1233    +       {                       /* pv_v2bootargs */
1234    +               NULL,           /* char **bootpath; */
1235    +               NULL,           /* char **bootargs; */
1236    +               NULL,           /* fd_stdin; */
1237    +               NULL,           /* fd_stdout */
1238    +       },
1239    +       {                       /* pv_v2devops */
1240    +               NULL,           /* v2_inst2pkg */
1241    +               NULL,           /* v2_dumb_mem_alloc */
1242    +               NULL,           /* v2_dumb_mem_free */
1243    +               NULL,           /* v2_dumb_mmap */
1244    +               NULL,           /* v2_dumb_munmap */
1245    +               NULL,           /* v2_dev_open */
1246    +               NULL,           /* v2_dev_close */
1247    +               NULL,           /* v2_dev_read */
1248    +               NULL,           /* v2_dev_write */
1249    +               NULL,           /* v2_dev_seek */
1250    +               NULL,           /* v2_wheee2 */
1251    +               NULL,           /* v2_wheee3 */
1252    +       },
1253    +       { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },        /* filler[15] */
1254    +        NULL,                  /* pv_setctxt */
1255    +        NULL,                  /* v3_cpustart */
1256    +        NULL,                  /* v3_cpustop */
1257    +        NULL,                  /* v3_cpuidle */
1258    +        NULL                   /* v3_cpuresume */
1259    +};
1260    +#endif
1261    +
1262    +static struct linux_romvec romvec0;
1263    +
1264    +void *
1265    +init_openprom(int bankc, struct bank *bankv, unsigned hiphybas)
1266    +{
1267    +       int i;
1268    +
1269    +       /*
1270    +        * Avoid data segment allocations
1271    +        */
1272    +       ptphys = totphys;
1273    +       ptmap = totmap;
1274    +       ptavail = totavail;
1275    +       /*
1276    +        * Form memory descriptors.
1277    +        */
1278    +       for (i = 0; i < bankc; i++) {
1279    +               totphys[i].theres_more = &totphys[i+1];
1280    +               totphys[i].start_adr = (char*) bankv[i].start;
1281    +               totphys[i].num_bytes = bankv[i].length;
1282    +       }
1283    +       totphys[i-1].theres_more = 0;
1284    +
1285    +       /*
1286    +        * XXX Merged in normal PROM when full banks touch.
1287    +        */
1288    +       for (i = 0; i < bankc; i++) {
1289    +               unsigned bankbase = bankv[i].start;
1290    +               unsigned banksize = bankv[i].length;
1291    +               if (hiphybas > bankbase &&
1292    +                   hiphybas < bankbase + banksize) {
1293    +                       banksize = hiphybas - bankbase;
1294    +               }
1295    +               totavail[i].theres_more = &totavail[i+1];
1296    +               totavail[i].start_adr = (char*) bankbase;
1297    +               totavail[i].num_bytes = banksize;
1298    +       }
1299    +       totavail[i-1].theres_more = 0;
1300    +
1301    +       totmap[0].theres_more = 0;
1302    +       totmap[0].start_adr = (char*) PROLBASE;
1303    +       totmap[0].num_bytes = PROLSIZE;
1304    +
1305    +       /*
1306    +        * idprom
1307    +        */
1308    +       bcopy(idprom, obp_idprom, IDPROM_SIZE);
1309    +
1310    +       // Linux wants a R/W romvec table
1311    +       romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
1312    +       romvec0.pv_plugin_revision = 77;
1313    +       romvec0.pv_printrev = 0x10203;
1314    +       romvec0.pv_v0mem.v0_totphys = &ptphys;
1315    +       romvec0.pv_v0mem.v0_prommap = &ptmap;
1316    +       romvec0.pv_v0mem.v0_available = &ptavail;
1317    +       romvec0.pv_nodeops = &nodeops0;
1318    +       romvec0.pv_bootstr = (void *)doublewalk;
1319    +       romvec0.pv_stdin = &obp_stdin;
1320    +       romvec0.pv_stdout = &obp_stdout;
1321    +       romvec0.pv_getchar = obp_nbgetchar;
1322    +       romvec0.pv_putchar = obp_nbputchar;
1323    +       romvec0.pv_nbgetchar = obp_nbgetchar;
1324    +       romvec0.pv_nbputchar = obp_nbputchar;
1325    +       romvec0.pv_reboot = obp_reboot;
1326    +       romvec0.pv_abort = obp_abort;
1327    +       romvec0.pv_halt = obp_halt;
1328    +       romvec0.pv_synchook = &synch_hook;
1329    +       romvec0.pv_v0bootargs = &obp_argp;
1330    +       return &romvec0;
1331    +}
1332    +
1333    +static const struct property *find_property(int node,char *name)
1334    +{
1335    +       const struct property *prop = &nodes[node].properties[0];
1336    +       while (prop && prop->name) {
1337    +               if (bcmp(prop->name, name, 128) == 0) return prop;
1338    +               prop++;
1339    +       }
1340    +       return NULL;
1341    +}
1342    +
1343    +static int obp_nextnode(int node)
1344    +{
1345    +       return nodes[node].sibling;
1346    +}
1347    +
1348    +static int obp_child(int node)
1349    +{
1350    +       return nodes[node].child;
1351    +}
1352    +
1353    +static int obp_proplen(int node, char *name)
1354    +{
1355    +       const struct property *prop = find_property(node,name);
1356    +       if (prop) return prop->length;
1357    +       return -1;
1358    +}
1359    +
1360    +static int obp_getprop(int node, char *name, char *value)
1361    +{
1362    +       const struct property *prop;
1363    +
1364    +       prop = find_property(node,name);
1365    +       if (prop) {
1366    +               memcpy(value,prop->value,prop->length);
1367    +               //printk("obp_getprop '%s'= %s\n", name, value);
1368    +               return prop->length;
1369    +       }
1370    +        //printk("obp_getprop: not found\n");
1371    +       return -1;
1372    +}
1373    +
1374    +static int obp_setprop(int node, char *name, char *value, int len)
1375    +{
1376    +       return -1;
1377    +}
1378    +
1379    +static const char *obp_nextprop(int node,char *name)
1380    +{
1381    +       const struct property *prop = find_property(node,name);
1382    +       if (prop) return prop[1].name;
1383    +       return NULL;
1384    +}
1385    +
1386    +#if 0
1387    +static unsigned char calc_idprom_cksum(struct idprom *idprom)
1388    +{
1389    +        unsigned char cksum, i, *ptr = (unsigned char *)idprom;
1390    +
1391    +        for (i = cksum = 0; i <= 0x0E; i++)
1392    +                cksum ^= *ptr++;
1393    +
1394    +        return cksum;
1395    +}
1396    +#endif
1397    +
1398    +static int obp_nbgetchar(void) {
1399    +       return -1;
1400    +}
1401    +
1402    +static int obp_nbputchar(int ch) {
1403    +       extern struct vconterm dp0;
1404    +       char buf = ch;
1405    +
1406    +       /* We do not use printk() in order to reduce stack depth. */
1407    +       vcon_write(&dp0, &buf, 1);
1408    +       return 0;
1409    +}
1410    +
1411    +static void obp_reboot(char *str) {
1412    +       printk("rebooting (%s): not implemented, freezing\n", str);
1413    +       for (;;) {}
1414    +}
1415    +
1416    +static void obp_abort() {
1417    +       printk("abort, freezing\n");
1418    +       for (;;) {}
1419    +}
1420    +
1421    +static void obp_halt() {
1422    +       printk("halt, freezing\n");
1423    +       for (;;) {}
1424    +}
1425    +
1426    +static int obp_devopen(char *str) {
1427    +        //printk("open %s\n", str);
1428    +       return 0;
1429    +}
1430    +
1431    +static int obp_devclose(int dev_desc) {
1432    +        //printk("close %d\n", dev_desc);
1433    +       return 0;
1434    +}
1435    +
1436    +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) {
1437    +    //printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf);
1438    +    //buf[8] = 'L';
1439    +    return num_blks;
1440    +}
1441    diff -ruN proll_18.orig/src/arp.c proll-patch4/src/arp.c
1442    --- proll_18.orig/src/arp.c     2001-12-24 05:12:31.000000000 +0000
1443    +++ proll-patch4/src/arp.c      2004-11-13 15:50:49.000000000 +0000
1444    @@ -45,7 +45,7 @@
1445   #endif   #endif
1446     static struct arp_cache arp_list[ARPNUM];      /* ARP address cache    */
1447     static int next_arp;                           /* next table entry     */
1448    -static t_ipaddr def_gw = IP_ANY;               /* default routing      */
1449    +static t_ipaddr def_gw;                                /* default routing      */
1450    
1451    
1452    
1453    @@ -144,7 +144,7 @@
1454      *
1455      * Resolve IP address and return pointer to hardware address.
1456      */
1457    -unsigned char *ip_resolve(ip)
1458    +const unsigned char *ip_resolve(ip)
1459     t_ipaddr ip;
1460     {
1461       int i;
1462    @@ -230,14 +230,11 @@
1463      */
1464     int init_arp()
1465     {
1466    -  /* Set name of module for error messages */
1467    -  net_module_name = "arp";
1468    -
1469     #ifndef NOARP
1470       /* Register ARP packet type and set send buffer pointer */
1471       if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)
1472            return(FALSE);
1473     #endif
1474    -
1475    +  def_gw = IP_ANY;
1476       return(TRUE);
1477     }
1478    diff -ruN proll_18.orig/src/arp.h proll-patch4/src/arp.h
1479    --- proll_18.orig/src/arp.h     1999-03-18 03:39:43.000000000 +0000
1480    +++ proll-patch4/src/arp.h      2004-11-13 15:50:49.000000000 +0000
1481    @@ -104,7 +104,7 @@
1482     extern int init_arp __P((void));
1483    
1484     /* Resolve IP address and return pointer to hardware address */
1485    -extern unsigned char *ip_resolve __P((t_ipaddr ip));
1486    +extern const unsigned char *ip_resolve __P((t_ipaddr ip));
1487    
1488     /* Add a new antry to the ARP cache */
1489     extern void addcache __P((unsigned char *ha, t_ipaddr ip));
1490    diff -ruN proll_18.orig/src/hconsole.c proll-patch4/src/hconsole.c
1491    --- proll_18.orig/src/hconsole.c        2002-07-23 05:52:48.000000000 +0000
1492    +++ proll-patch4/src/hconsole.c 2004-11-13 15:50:49.000000000 +0000
1493    @@ -42,7 +42,11 @@
1494             * No probing sequence or argument passing, hardcode everything. XXX
1495             */
1496            raster8_cons_a(q, 768, 1024, (char *)a0);
1497    +#if 1
1498            raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
1499    +#else
1500    +       raster_cons_2(r, q, 0, 0, 768, 1024);
1501  +#endif  +#endif
1502            t->r_ = r;
1503            t->r0_ = q;
1504            t->f_ = &f_master;
1505    diff -ruN proll_18.orig/src/lat7_2.bm proll-patch4/src/lat7_2.bm
1506    --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
1507    +++ proll-patch4/src/lat7_2.bm  2004-11-13 15:50:49.000000000 +0000
1508    @@ -1,6 +1,6 @@
1509     #define lat7_2_width 128
1510     #define lat7_2_height 88
1511    -static unsigned char lat7_2_bits[] = {
1512    +static unsigned const char lat7_2_bits[] = {
1513        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1514        0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
1515        0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
1516    diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch4/src/lat7_2_swapped.bm
1517    --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
1518    +++ proll-patch4/src/lat7_2_swapped.bm  2004-11-13 15:50:49.000000000 +0000
1519    @@ -0,0 +1,121 @@
1520    +#define lat7_2_width 128
1521    +#define lat7_2_height 88
1522    +static unsigned const char lat7_2_bits[] = {
1523    +   0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
1524    +   0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
1525    +   0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
1526    +   0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
1527    +   0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
1528    +   0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
1529    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
1530    +   0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
1531    +   0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
1532    +   0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
1533    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
1534    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
1535    +   0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
1536    +   0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
1537    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
1538    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1539    +   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1540    +   0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1541    +   0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
1542    +   0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
1543    +   0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
1544    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
1545    +   0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
1546    +   0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
1547    +   0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
1548    +   0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
1549    +   0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
1550    +   0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
1551    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
1552    +   0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1553    +   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
1554    +   0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
1555    +   0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
1556    +   0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
1557    +   0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
1558    +   0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
1559    +   0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
1560    +   0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
1561    +   0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
1562    +   0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
1563    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
1564    +   0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
1565    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
1566    +   0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
1567    +   0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
1568    +   0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
1569    +   0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
1570    +   0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
1571    +   0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
1572    +   0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
1573    +   0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
1574    +   0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
1575    +   0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
1576    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
1577    +   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
1578    +   0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
1579    +   0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
1580    +   0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
1581    +   0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
1582    +   0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
1583    +   0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
1584    +   0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
1585    +   0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
1586    +   0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
1587    +   0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
1588    +   0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
1589    +   0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
1590    +   0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
1591    +   0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
1592    +   0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
1593    +   0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
1594    +   0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
1595    +   0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
1596    +   0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
1597    +   0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
1598    +   0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
1599    +   0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
1600    +   0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
1601    +   0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
1602    +   0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
1603    +   0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
1604    +   0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
1605    +   0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
1606    +   0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
1607    +   0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
1608    +   0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
1609    +   0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1610    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
1611    +   0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1612    +   0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
1613    +   0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1614    +   0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
1615    +   0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
1616    +   0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
1617    +   0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
1618    +   0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
1619    +   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
1620    +   0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
1621    +   0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
1622    +   0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
1623    +   0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
1624    +   0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1625    +   0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
1626    +   0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
1627    +   0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
1628    +   0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
1629    +   0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
1630    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
1631    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
1632    +   0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
1633    +   0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
1634    +   0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
1635    +   0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
1636    +   0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
1637    +   0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
1638    +   0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
1639    +   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
1640    +   0x00, 0x00, 0x00, 0x00};
1641    diff -ruN proll_18.orig/src/le.c proll-patch4/src/le.c
1642    --- proll_18.orig/src/le.c      2002-07-23 05:52:49.000000000 +0000
1643    +++ proll-patch4/src/le.c       2004-11-13 15:50:49.000000000 +0000
1644    @@ -185,8 +185,6 @@
1645            unsigned short rap;                     /* register address port */
1646     };
1647    
1648    -int sparc_lance_debug = 2;
1649    -
1650     /* The Lance uses 24 bit addresses */
1651     /* On the Sun4c the DVMA will provide the remaining bytes for us */
1652     /* On the Sun4m we have to instruct the ledma to provide them    */
1653    diff -ruN proll_18.orig/src/netinit.c proll-patch4/src/netinit.c
1654    --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
1655    +++ proll-patch4/src/netinit.c  2004-11-13 15:50:49.000000000 +0000
1656    @@ -49,13 +49,20 @@
1657     unsigned char     myhwaddr[ETH_ALEN];          /* my own hardware addr */
1658              t_ipaddr myipaddr;                    /* my own IP address    */
1659              t_ipaddr mynetmask;                   /* my own netmask       */
1660    -         char    *net_module_name;             /* name of init module  */
1661              t_ipaddr servaddr;                    /* IP of RARP&TFTP server */
1662    
1663     /* Broadcast hardware address */
1664    -unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
1665    +const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
1666    
1667    
1668    +unsigned int seed;
1669    +
1670    +/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
1671    +short int random()
1672    +{
1673    +       seed = (seed + 23968)*0x015A4E35 >> 1;
1674    +       return seed & 0x7FFF;
1675    +}
1676    
1677     /*
1678      **************************************************************************
1679    @@ -104,10 +111,17 @@
1680      */
1681     void init_net()
1682     {
1683    +  /* Avoid data segment allocations */
1684    +  seed = 151;
1685    +
1686       /* Initialize the different network layer modules */
1687       init_packet();
1688    -  if (!init_arp() || !init_udp()) {
1689    -       printf("\nERROR: init_%s\n", net_module_name);
1690    +  if (!init_arp()) {
1691    +       printf("\nERROR: init_arp\n");
1692    +       fatal();
1693    +  }
1694    +  if (!init_udp()) {
1695    +       printf("\nERROR: init_udp\n");
1696            fatal();
1697       }
1698     }
1699    diff -ruN proll_18.orig/src/netpriv.h proll-patch4/src/netpriv.h
1700    --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
1701    +++ proll-patch4/src/netpriv.h  2004-11-13 15:50:49.000000000 +0000
1702    @@ -130,10 +130,9 @@
1703      *
1704      */
1705     extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address    */
1706    -extern unsigned char bcasthw[ETH_ALEN];  /* broadcast hardware addr    */
1707    +extern const unsigned char bcasthw[ETH_ALEN];  /* broadcast hardware addr      */
1708     extern t_ipaddr      myipaddr;           /* my own IP address          */
1709     extern t_ipaddr      mynetmask;                 /* netmask for my network      */
1710    -extern char         *net_module_name;   /* initialized module's name   */
1711     extern t_ipaddr      servaddr;           /* server IP address          */
1712    
1713    
1714    @@ -150,7 +149,7 @@
1715     extern unsigned char *reg_type __P((int typeval, int (* receive)()));
1716    
1717     /* Write a packet to the network */
1718    -extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
1719    +extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
1720    
1721     /* Empty read buffer */
1722     extern void empty_buf __P((void));
1723    diff -ruN proll_18.orig/src/openprom.h proll-patch4/src/openprom.h
1724    --- proll_18.orig/src/openprom.h        2002-07-14 02:26:30.000000000 +0000
1725    +++ proll-patch4/src/openprom.h 2004-11-13 15:50:49.000000000 +0000
1726    @@ -54,20 +54,20 @@
1727     };
1728    
1729     struct linux_mem_v0 {
1730    -       struct linux_mlist_v0 **v0_totphys;
1731    -       struct linux_mlist_v0 **v0_prommap;
1732    -       struct linux_mlist_v0 **v0_available; /* What we can use */
1733    +       struct linux_mlist_v0 * const *v0_totphys;
1734    +       struct linux_mlist_v0 * const *v0_prommap;
1735    +       struct linux_mlist_v0 * const *v0_available; /* What we can use */
1736     };
1737    
1738     /* Arguments sent to the kernel from the boot prompt. */
1739     struct linux_arguments_v0 {
1740    -       char *argv[8];
1741    +       const char *argv[8];
1742            char args[100];
1743            char boot_dev[2];
1744            int boot_dev_ctrl;
1745            int boot_dev_unit;
1746            int dev_partition;
1747    -       char *kernel_file_name;
1748    +       const char *kernel_file_name;
1749            void *aieee1;           /* XXX */
1750     };
1751    
1752    @@ -91,13 +91,13 @@
1753            struct linux_mem_v0 pv_v0mem;
1754    
1755          romvec = init_openprom(bb.nbanks, bb.bankv, hiphybas);          /* Node operations. */
1756    -       struct linux_nodeops *pv_nodeops;
1757    +       const struct linux_nodeops *pv_nodeops;
1758    
1759          printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",          char **pv_bootstr;
1760              PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,          struct linux_dev_v0_funcs pv_v0devops;
1761              (int)cio.start, (int)cio.curp);  
1762    -       char *pv_stdin;
1763    -       char *pv_stdout;
1764    +       const char *pv_stdin;
1765    +       const char *pv_stdout;
1766     #define        PROMDEV_KBD     0               /* input from keyboard */
1767     #define        PROMDEV_SCREEN  0               /* output to screen */
1768     #define        PROMDEV_TTYA    1               /* in/out to ttya */
1769    @@ -127,7 +127,7 @@
1770                    void (*v2_eval)(char *str);
1771            } pv_fortheval;
1772    
1773    -       struct linux_arguments_v0 **pv_v0bootargs;
1774    +       const struct linux_arguments_v0 * const *pv_v0bootargs;
1775    
1776            /* Get ether address. */
1777            unsigned int (*pv_enaddr)(int d, char *enaddr);
1778    @@ -175,7 +175,7 @@
1779            int (*no_proplen)(int node, char *name);
1780            int (*no_getprop)(int node, char *name, char *val);
1781            int (*no_setprop)(int node, char *name, char *val, int len);
1782    -       char * (*no_nextprop)(int node, char *name);
1783    +       const char * (*no_nextprop)(int node, char *name);
1784     };
1785    
1786     /* More fun PROM structures for device probing. */
1787    diff -ruN proll_18.orig/src/packet.c proll-patch4/src/packet.c
1788    --- proll_18.orig/src/packet.c  2000-02-11 04:56:45.000000000 +0000
1789    +++ proll-patch4/src/packet.c   2004-11-13 15:50:49.000000000 +0000
1790    @@ -41,7 +41,7 @@
1791            int aligner;
1792     } wbuf;
1793     static struct sk_buff *rskb;
1794    -static int nqskb = 0;
1795    +static int nqskb;
1796    
1797    
1798     void init_packet()
1799    @@ -62,6 +62,8 @@
1800            for (i = 0; i < MAXSKBS; i++) {
1801                    skev[i].skb.allocn = i;
1802            }
1803    +
1804    +       nqskb = 0;
1805     }
1806    
1807     unsigned char *reg_type(int ptype, int (*func)())
1808    @@ -81,7 +83,7 @@
1809            return wbuf.s;
1810     }
1811    
1812    -int write_packet(int leng, int type, unsigned char *dst)
1813    +int write_packet(int leng, int type, const unsigned char *dst)
1814     {
1815            struct sk_buff *skb;
1816            unsigned char *s;
1817    diff -ruN proll_18.orig/src/printf.c proll-patch4/src/printf.c
1818    --- proll_18.orig/src/printf.c  1999-03-19 07:03:59.000000000 +0000
1819    +++ proll-patch4/src/printf.c   2004-11-13 15:50:49.000000000 +0000
1820    @@ -19,7 +19,7 @@
1821     static void printn(struct prf_fp *, unsigned long, unsigned int);
1822     static void putchar(char, struct prf_fp *);
1823    
1824    -static char hextab[] = "0123456789ABCDEF";
1825    +static const char hextab[] = "0123456789ABCDEF";
1826    
1827     /*
1828      * Scaled down version of C Library printf.
1829    @@ -41,7 +41,7 @@
1830     void
1831     prf(struct prf_fp *filog, char *fmt, va_list adx)
1832     {
1833    -        register c;
1834    +        register int c;
1835             char *s;
1836    
1837            for(;;) {
1838    @@ -60,7 +60,7 @@
1839                            putchar(va_arg(adx,unsigned), filog);
1840                    } else if(c == 's') {
1841                            s = va_arg(adx,char*);
1842    -                               while(c = *s++)
1843    +                               while((c = *s++))
1844                                    putchar(c,filog);
1845                            } else if (c == 'l' || c == 'O') {
1846                            printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
1847    diff -ruN proll_18.orig/src/rconsole.c proll-patch4/src/rconsole.c
1848    --- proll_18.orig/src/rconsole.c        1999-01-16 07:16:55.000000000 +0000
1849    +++ proll-patch4/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000
1850    @@ -28,12 +28,18 @@
1851      * move to California. Only plain lat7 survived.
1852      * I recreated lat7-1 changes in lat7-2.  --zaitcev
1853      */
1854  +#ifdef ORIG  +#ifdef ORIG
1855          set_timeout(5);  while (!chk_timeout()) { }  /* P3: let me read */   #include "lat7_2.bm"   /* lat7_1.bm */
1856  +#else  +#else
1857  +       printk("loading kernel:");  +#include "lat7_2_swapped.bm"   /* lat7_1.bm */
1858  +       i = ld_bypass(0x20000000);  +#endif
1859  +       printk(" done, size %d\n", i);   #define LAT7_NCHARS  128
1860  +#endif   #define LAT7_HEIGHT   11
1861     #define LAT7_WIDTH     8
1862          {  
1863                  void (*entry)(void *, int) = (void (*)(void*, int)) LOADBASE;  +#ifdef ORIG
1864  diff -ru proll_18.orig/mrcoffee/openprom.c proll_18/mrcoffee/openprom.c   static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
1865  --- proll_18.orig/mrcoffee/openprom.c   2002-09-13 16:17:03.000000000 +0200  +#endif
1866  +++ proll_18/mrcoffee/openprom.c        2004-09-21 21:27:16.000000000 +0200  
1867  @@ -144,10 +144,14 @@   #if 1
1868   };   /*
1869    @@ -94,6 +100,7 @@
1870   static int cpu_nctx = NCTX_SWIFT;  
1871  +static int cpu_cache_line_size = 0x20;   #endif
1872  +static int cpu_cache_nlines = 0x200;  
1873   static struct property propv_cpu[] = {  +#ifdef ORIG
1874          {"name",        "STP1012PGA", sizeof("STP1012PGA") },   static inline int swapbits(int w0)
1875          {"device_type", "cpu", 4 },   {
1876          {"mmu-nctx",    (char*)&cpu_nctx, sizeof(int)},     int w1 = 0;
1877  +       {"cache-line-size",     (char*)&cpu_cache_line_size, sizeof(int)},  @@ -105,13 +112,16 @@
1878  +       {"cache-nlines",        (char*)&cpu_cache_nlines, sizeof(int)},     }
1879          {NULL, NULL, -1}     return w1;
1880     }
1881    +#endif
1882    
1883     void font_cons_7(struct rfont *p)
1884     {
1885    +#ifdef ORIG
1886       int x;
1887       int col = 0;
1888       int row = 0;
1889       int erow = 0;
1890    +
1891       for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {
1892         lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
1893                                                 swapbits(lat7_2_bits[x]) & 0xFF;
1894    @@ -124,6 +134,9 @@
1895         }
1896       }
1897       p->body_ = lat7_body;
1898    +#else
1899    +  p->body_ = lat7_2_bits;
1900    +#endif
1901       p->nchars_ = LAT7_NCHARS;
1902       p->width_ = LAT7_WIDTH;
1903       p->height_ = LAT7_HEIGHT;
1904    diff -ruN proll_18.orig/src/rconsole.h proll-patch4/src/rconsole.h
1905    --- proll_18.orig/src/rconsole.h        1999-01-16 05:00:59.000000000 +0000
1906    +++ proll-patch4/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
1907    @@ -13,10 +13,10 @@
1908      */
1909    
1910     #define RF_MAXWIDTH  16
1911    -typedef unsigned short Rf_scan;        /*  __w16 to be used */
1912    +typedef unsigned char Rf_scan;        /*  __w16 to be used */
1913    
1914     struct rfont {
1915    -  Rf_scan *body_;
1916    +  const Rf_scan *body_;
1917       int nchars_;                 /* 128 for ASCII ...  65536 for Unicode   */
1918       int width_;                  /* [Pixels]. Maximum size is 16.          */
1919       int height_;                 /* [Pixels == scan lines].                */
1920    diff -ruN proll_18.orig/src/romlib.h proll-patch4/src/romlib.h
1921    --- proll_18.orig/src/romlib.h  1999-04-20 04:26:45.000000000 +0000
1922    +++ proll-patch4/src/romlib.h   2004-11-13 15:50:49.000000000 +0000
1923    @@ -73,12 +73,12 @@
1924     #define memcpy(dst, src, len)  bcopy(src, dst, len)
1925     #define memcmp(x1, x2, len)    bcmp(x1, x2, len)
1926     #define memset(p, len, zero)   bzero(p, len)
1927    -extern void bcopy(void *b1, void *b2, int length);
1928    -extern int  bcmp(void *b1, void *b2, int length);
1929    +extern void bcopy(const void *b1, void *b2, int length);
1930    +extern int  bcmp(const void *b1, const void *b2, int length);
1931     extern void bzero(void *b, int c);
1932     /* gcc complains about "conflicting types for builtin function strlen". */
1933     #define strlen(s)              ssize(s)
1934    -extern int ssize(char *s);
1935    +extern int ssize(const char *s);
1936    
1937    
1938     /*
1939    diff -ruN proll_18.orig/src/sched_4m.c proll-patch4/src/sched_4m.c
1940    --- proll_18.orig/src/sched_4m.c        1999-04-27 05:48:51.000000000 +0000
1941    +++ proll-patch4/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000
1942    @@ -108,7 +108,7 @@
1943     static int set_bolt;                   /* Tick counter limit */
1944     static struct handsc hndv[16];
1945    
1946    -static unsigned int intr_to_mask[16] = {
1947    +static unsigned const int intr_to_mask[16] = {
1948            0,      0,      0,      0,      0,      0, SUN4M_INT_ETHERNET,  0,
1949            0,      0,      0,      0,      0,      0,      0,      0,
1950   };   };
1951    diff -ruN proll_18.orig/src/swap.c proll-patch4/src/swap.c
1952    --- proll_18.orig/src/swap.c    1970-01-01 00:00:00.000000000 +0000
1953    +++ proll-patch4/src/swap.c     2004-11-13 15:50:49.000000000 +0000
1954    @@ -0,0 +1,21 @@
1955    +// Convert the lat7 font so that no conversion is needed at runtime.
1956    +#define ORIG
1957    +#include "rconsole.c"
1958    +
1959    +#include <stdio.h>
1960    +
1961    +int main()
1962    +{
1963    +    struct rfont p;
1964    +    int i;
1965    +
1966    +    font_cons_7(&p);
1967    +
1968    +    printf("   ");
1969    +    for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
1970    +       printf("0x%02x, ", p.body_[i]);
1971    +       if ((i % 12) == 11)
1972    +           printf("\n   ");
1973    +    }
1974    +    printf("\n");
1975    +}
1976    diff -ruN proll_18.orig/src/system.c proll-patch4/src/system.c
1977    --- proll_18.orig/src/system.c  2002-07-23 05:52:49.000000000 +0000
1978    +++ proll-patch4/src/system.c   2004-11-13 15:50:49.000000000 +0000
1979    @@ -298,8 +298,8 @@
1980            }
1981    
1982            /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
1983    -       pa = PAGE_SIZE;
1984    -       for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
1985    +       pa = 0;
1986    +       for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
1987                    map_page(l1, va, pa, 0, highbase);
1988                    pa += PAGE_SIZE;
1989            }
1990    @@ -518,12 +518,12 @@
1991            while (len--) *((char *)s)++ = 0;
1992     }
1993    
1994    -void bcopy(void *f, void *t, int len) {
1995    +void bcopy(const void *f, void *t, int len) {
1996            while (len--) *((char *)t)++ = *((char *)f)++;
1997     }
1998    
1999     /* Comparison is 7-bit */
2000    -int bcmp(void *s1, void *s2, int len)
2001    +int bcmp(const void *s1, const void *s2, int len)
2002     {
2003            int i;
2004            char ch;
2005    @@ -538,8 +538,8 @@
2006            return 0;
2007     }
2008    
2009    -int strlen(char *s) {
2010    -       char *p;
2011    +int strlen(const char *s) {
2012    +       const char *p;
2013            for (p = s; *p != 0; p++) { }
2014            return p - s;
2015     }
2016    @@ -560,14 +560,6 @@
2017            va_end(x1);
2018     }
2019    
2020    -/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
2021    -short int random()
2022    -{
2023    -       static unsigned int seed = 151;
2024    -       seed = (seed + 23968)*0x015A4E35 >> 1;
2025    -       return seed & 0x7FFF;
2026    -}
2027    -
2028     void fatal()
2029     {
2030            printk("fatal.");
2031    diff -ruN proll_18.orig/src/system.h proll-patch4/src/system.h
2032    --- proll_18.orig/src/system.h  2002-09-13 21:53:32.000000000 +0000
2033    +++ proll-patch4/src/system.h   2004-11-13 15:50:49.000000000 +0000
2034    @@ -16,7 +16,7 @@
2035     #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
2036     #define NCTX_SWIFT  0x100
2037    
2038    -#define MAX_BANKS      3               /* Allocation for all machines */
2039    +#define MAX_BANKS      8               /* Allocation for all machines */
2040    
2041     #ifndef __ASSEMBLY__
2042     struct bank {
2043    diff -ruN proll_18.orig/src/udp.c proll-patch4/src/udp.c
2044    --- proll_18.orig/src/udp.c     2001-12-24 05:12:53.000000000 +0000
2045    +++ proll-patch4/src/udp.c      2004-11-13 15:50:49.000000000 +0000
2046    @@ -81,7 +81,7 @@
2047     int      source;
2048     int      dest;
2049     {
2050    -  register unsigned char *addr;
2051    +  const register unsigned char *addr;
2052    
2053       /* Set global variables */
2054       usource = source;
2055    @@ -299,9 +299,6 @@
2056      */
2057     int init_udp()
2058     {
2059    -  /* Set module name for error handling */
2060    -  net_module_name = "udp";
2061    -
2062       /* Register IP packet type and set write buffer pointer */
2063       if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
2064            return(FALSE);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26