Annotation of qemu/pc-bios/proll.patch, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.