Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/acorn32/stand/BtNetBSD Commit of BtNetBSD version 0...



details:   https://anonhg.NetBSD.org/src/rev/7f06ffab4f75
branches:  trunk
changeset: 522143:7f06ffab4f75
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Feb 11 19:00:07 2002 +0000

description:
Commit of BtNetBSD version 0.99 : new bootconfig implemented in the
bootloader that also allows ELF symbols to be read correctly as well as
still having the posibility to boot older kernels with the `oldkernel'
option.

There is now support for upto 32 blocks of DRAM and a 16 blocks of VRAM.
Also preliminary support for specifying Mode Defintion Files (MDF) to the
kernel.

diffstat:

 sys/arch/acorn32/stand/BtNetBSD/README                  |    6 +-
 sys/arch/acorn32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD |  329 ++++++++++-----
 sys/arch/acorn32/stand/BtNetBSD/pling.BtNetBSD/fastboot |   15 +-
 3 files changed, 237 insertions(+), 113 deletions(-)

diffs (truncated from 589 to 300 lines):

diff -r a6e7462e2241 -r 7f06ffab4f75 sys/arch/acorn32/stand/BtNetBSD/README
--- a/sys/arch/acorn32/stand/BtNetBSD/README    Mon Feb 11 18:57:19 2002 +0000
+++ b/sys/arch/acorn32/stand/BtNetBSD/README    Mon Feb 11 19:00:07 2002 +0000
@@ -1,6 +1,6 @@
-$NetBSD: README,v 1.1 2001/10/05 22:28:00 reinoud Exp $
+$NetBSD: README,v 1.2 2002/02/11 19:00:07 reinoud Exp $
 
-Welcome to NetBSD for the Acorn RiscPC/A7000/NC and Imago !
+Welcome to NetBSD for the Acorn RiscPC/A7000/NC !
 
 To get this distribution working run `settype' the file `Settype'
 to Obey and run this file. It will set all file types in this
@@ -11,5 +11,5 @@
 
 Enjoy your installation !
 
-19 Februari 2001
+11 Februari 2002
 Reinoud Zandijk
diff -r a6e7462e2241 -r 7f06ffab4f75 sys/arch/acorn32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD
--- a/sys/arch/acorn32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD   Mon Feb 11 18:57:19 2002 +0000
+++ b/sys/arch/acorn32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD   Mon Feb 11 19:00:07 2002 +0000
@@ -1,7 +1,7 @@
 REM > BtNetBSD
-REM $NetBSD: BtNetBSD,v 1.2 2001/12/16 20:54:32 reinoud Exp $
+REM $NetBSD: BtNetBSD,v 1.3 2002/02/11 19:00:07 reinoud Exp $
 REM
-REM Copyright (c) 2000, 2001 Reinoud Zandijk
+REM Copyright (c) 2000, 2001, 2002 Reinoud Zandijk
 REM Copyright (c) 1998, 1999, 2000 Ben Harris
 REM ELF file reading based on work by Ben Harris
 REM All rights reserved.
@@ -28,11 +28,11 @@
 REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 REM THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 REM
-REM This file is part of NetBSD/arm32 -- a port of NetBSD to ARM6+ machines
+REM This file is part of NetBSD/acorn32 -- a port of NetBSD to ARM6+ machines
 REM This source contains pieces of code by Ben Harris (file structure)
 REM and Mark Brinicombe (DRAM/VRAM search)
 REM
-REM Purpose : Trying to boot NetBSD/arm32 !!
+REM Purpose : Trying to boot NetBSD/acorn32 !!
 
 
 ON ERROR REPORT:PRINT " at line ";ERL: PRINT'"Press key":QQ=GET:END
@@ -59,8 +59,8 @@
 COLOUR 128:CLS
 
 PRINT''
-PROCcenter("BtNetBSD 0.97")
-PROCcenter("booting NetBSD/arm32 on a RiscPC/RC7500/NC and Imago")
+PROCcenter("BtNetBSD 0.99")
+PROCcenter("booting NetBSD/acorn32 on a RiscPC/A7000/NC")
 PRINT''
 
 REM get argument string
@@ -83,16 +83,17 @@
 REM   the difference is that RO4 won't map it in by default and
 REM   that could trigger a OS_Memory bug ...
 SYS "OS_Memory", 6 TO ,memorytablesize%, nbpp% : REM get tablesize%
-memory_image_size% = HIMEM-512*1024     : REM keep a 512 Kb for vars
-DIM memory_image% memory_image_size%  : REM claim the space
+memory_image_size% = HIMEM-512*1024            : REM keep a 512 Kb for vars
+DIM memory_image% memory_image_size%           : REM claim the space
 
 bot_memory% = memory_image%
 top_memory% = memory_image% + memory_image_size%
 
 KERNEL_BASE = &F0000000
 
-MAX_RELOCPAGES = 2048
-MAX_RAMBANKS = 8
+MAX_RELOCPAGES = 4096
+MAX_DRAMBANKS = 32
+MAX_VRAMBANKS = 16
 
 twirl% = 0
 firstpage%  = (bot_memory% DIV nbpp%)+1
@@ -132,19 +133,18 @@
 E% = entry%
 
 IF debug% THEN
-  IF ((relocpos%-(relocinstr%+4)) MOD 12)<>0 THEN PRINT "Sanity check for relocation entries failed!"
+  IF ((relocpos%-(relocinstr%+4)) MOD 12)<>0 THEN ERROR 0,"Sanity check for relocation entries failed!"
   PRINT"Entering kernel at 0x";~entry%
-  OSCLI("Memoryi "+STR$~(FNblock_vaddr(start_kernelpage%)+(entry% MOD nbpp%)))
-  PRINT"Go for it (key)":qq=GET
-ELSE
-  PRINT ''"Press ESC to abort loader"
-  PRINT "Kernel will be started in ";
-  FOR secs%=startdelay% TO 1 STEP -1
-    PRINT ;secs%;"...";
-    tt=TIME: WHILE TIME-tt<=100: ENDWHILE : REM wait one second
-  NEXT
-  PRINT "start!"
+  REM  OSCLI("Memoryi "+STR$~(FNblock_vaddr(start_kernelpage%)+(entry% MOD nbpp%)))
+  REM  PRINT"Go for it (key)":qq=GET
 ENDIF
+PRINT ''"Press ESC to abort loader"
+PRINT "Kernel will be started in ";
+FOR secs%=startdelay% TO 1 STEP -1
+  PRINT ;secs%;"...";
+  tt=TIME: WHILE TIME-tt<=100: ENDWHILE : REM wait one second
+NEXT
+PRINT "start!"
 
 REM get ECID for each podule
 FOR pod% =-1 TO 8
@@ -160,7 +160,7 @@
 *pointer 0
 SYS "OS_RemoveCursors"
 
-REM XXX is this OK ?
+REM XXX is this OK ? What is this!
 DIM buf 8
 buf!?3 = 2: buf!4 = 0: SYS "OS_Word", 22, buf+3
 
@@ -221,22 +221,24 @@
   start_kernelpage% = freepagesbase%
   pv_offset% = KERNEL_BASE - DRAM_addr%(0) : REM XXX hardcoded
 
-  REM load the code blocks ?
+  REM load the program blocks
   first% = TRUE
   FOR ph% = phdrs% TO phdrs% + (phnum% - 1) * phentsize% STEP phentsize%
-    IF ph%!0 <> 1 THEN NEXT : REM We only do PT_LOAD
-    IF NOT first% THEN PRINT "+";
-    first%  = FALSE
-    offset% = ph%!4
-    vaddr%  = ph%!8
-    REM physaddr% = ph%!12
-    filesz% = ph%!16
-    memsz%  = ph%!20
-    flags%  = ph%!24
-    PROCload_chunk(file%, offset%, vaddr%, filesz%, memsz%)
-    REM freepagesbase% is updated
+    IF ph%!0 = 1 THEN
+      REM We only do PT_LOAD
+      IF NOT first% THEN PRINT "+";
+      first%  = FALSE
+      offset% = ph%!4
+      vaddr%  = ph%!8
+      REM physaddr% = ph%!12
+      filesz% = ph%!16
+      memsz%  = ph%!20
+      flags%  = ph%!24
+      PROCload_chunk(file%, offset%, vaddr%, filesz%, memsz%)
+      REM freepagesbase% is updated
 
-    vfreebase% = vaddr% + memsz% : REM XXX
+      vfreebase% = vaddr% + memsz% : REM memsz% is the real size.... filesz can be only Text f.e.
+    ENDIF
   NEXT
 
   txtbase% = 0
@@ -255,7 +257,12 @@
     FOR sh% = shdrs% TO shdrs% + (shnum% - 1) * shentsize% STEP shentsize%
       IF sh%!4 = 2 THEN havesyms% = TRUE
     NEXT
-    IF INSTR(args$, "symtab")=0 THEN havesyms% = FALSE
+    IF havesyms% THEN
+      IF INSTR(args$, "symtab")=0 THEN havesyms% = FALSE
+      IF debug% THEN
+        IF havesyms% PRINT ;" (symbols avail) "; ELSE PRINT ;" (ignoring symbols) ";
+      ENDIF
+    ENDIF
     REM freepagesbase% points to first free relocation page
     IF havesyms% THEN
       REM vfreebase points to first free address in relocated area
@@ -279,7 +286,6 @@
           PRINT "+";
           PROCload_chunk(file%, sh%!16, vfreebase%, sh%!20, sh%!20)
           !(FNblock_vaddr(mshdrspage%) + sh% - shdrs% + 16) = vfreebase% - ssym%
-                REM PROCwrite_word(mshdrs% + sh% - shdrs% + 16, freebase% - ssym%)
           vfreebase% += FNroundup(sh%!20, 4)
         ENDIF
       NEXT
@@ -288,17 +294,17 @@
     ENDIF
   ENDIF
   PRINT " ";
-  REM XXX
 
   kernelpages% = freepagesbase% - start_kernelpage%
-  IF extradebug% THEN PRINT ''"Number of kernel pages ";kernelpages%;" (";kernelpages%*nbpp%;")"
- 
+  IF extradebug% THEN PRINT ''"Number of kernel pages ";kernelpages%;" (";kernelpages%*nbpp%;" bytes)"
+
   PROCfinish_relocationtable
 ENDPROC
 
 
 DEF PROCload_chunk(file%, offset%, vaddr%, filesz%, memsz%)
   LOCAL paddr%, ppn%, fragaddr%, fragsz%
+
   REM offset%  offset in file
   REM vaddr%   indicates virtual address where stuff needs to be relocated to
   REM filesz%  number of bytes to read of `file' for this chunk
@@ -351,8 +357,6 @@
 ENDPROC
 
 
-
-
 REM *****************************************************************************
 REM * A.OUT LOADER                                                              *
 REM *****************************************************************************
@@ -363,18 +367,16 @@
   ssym% = 0 : esym% = 0
   SYS "OS_GBPB", 3, file%, hdr%, 32, 0
   bemagic% = (hdr%?0 << 24) OR (hdr%?1 <<16) OR (hdr%?2 << 8) OR hdr%?3
-  IF debug% THEN
-    CASE bemagic% AND &0000FFFF OF
-     WHEN &0107
-       PRINT "(OMAGIC) ";
-     WHEN &0108
-       PRINT "(NMAGIC) ";
-      WHEN &010B
-        PRINT "(ZMAGIC) ";
-      WHEN &00CC
-        PRINT "(QMAGIC) ";
-    ENDCASE
-  ENDIF
+  CASE bemagic% AND &0000FFFF OF
+    WHEN &0107
+      PRINT "(OMAGIC) ";
+    WHEN &0108
+      PRINT "(NMAGIC) ";
+    WHEN &010B
+      PRINT "(ZMAGIC) ";
+    WHEN &00CC
+      PRINT "(QMAGIC) ";
+  ENDCASE
   REM XXX: Assume ZMAGIC
 
   REM foooff% is byte offset in file.  foobasepage% is base page in RAM.
@@ -500,29 +502,51 @@
  
   REM update new header structure
   new_hdr%!16 = symsize%
+  
+  REM mark highest virtual address free in NetBSD's mapping
+  vfreebase% = KERNEL_BASE + nbpp%*relocoff%
 
+  REM `patch' symbol table stuff
+  ssym% = 0
+  esym% = 0
+  
   PROCfinish_relocationtable
 ENDPROC
 
 
+REM *****************************************************************************
+REM * Common loader and relocate stuff                                          *
+REM *****************************************************************************
+
 DEF PROCfinish_relocationtable
-  REM place the arguments
-  argsbasepage% = freepagesbase%
-  argspages% = 1
-  argvirtualbase% = nbpp%*relocoff% + KERNEL_BASE
-  relocpos%!0 = FNblock_paddr(argsbasepage%)
-  relocpos%!4 = kernel_phys_start% + nbpp%*relocoff%: relocnr%+=1: relocoff%+=1
-  relocpos%!8 = nbpp%
-  relocpos% += 12
-  $(FNblock_vaddr(argsbasepage%)) = args$+CHR$0
-  freepagesbase% += argspages%
-  kernelpages% += argspages%
+  REM align vfreebase% to a page
+  vfreebase% = FNroundup(vfreebase%, nbpp%)
+  relocoff% = (vfreebase% - KERNEL_BASE) DIV nbpp%
+
+  IF vfreebase% > (nbpp%*relocoff% + KERNEL_BASE) THEN
+    PRINT ''"WHOOAH!' : 0x", ~vfreebase%;" > 0x";~(nbpp%*relocoff%+KERNEL_BASE)
+    freepagesbase% += 16
+    kernelpages%   += 16
+    relocoff%      += 16
+  ENDIF
 
-  REM Align scratch to a 16 kb boundry just in case ... should be on physical XXX
-  offset% = FNroundup(relocoff%, 4) - relocoff%
-  freepagesbase% += offset%
-  kernelpages%   += offset%
-  relocoff%      += offset%
+  IF INSTR(args$, "oldkernel")>0 THEN
+    REM place the arguments in a block ... for the old bootloader's sake
+    argsbasepage% = freepagesbase%
+    argspages% = 1
+    argvirtualbase% = nbpp%*relocoff% + KERNEL_BASE
+    relocpos%!0 = FNblock_paddr(argsbasepage%)
+    relocpos%!4 = kernel_phys_start% + nbpp%*relocoff%: relocnr%+=1: relocoff%+=1
+    relocpos%!8 = nbpp%
+    relocpos% += 12
+    $(FNblock_vaddr(argsbasepage%)) = args$+CHR$0
+    freepagesbase% += argspages%
+    kernelpages%   += argspages%
+    IF debug% THEN PRINT "Args at 0x";~argvirtualbase%
+  ELSE
+    REM reserve some space for the MDF file



Home | Main Index | Thread Index | Old Index