Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm32 Finally make the RiscPC boot ELF kernels for ...



details:   https://anonhg.NetBSD.org/src/rev/dc06a7656ab3
branches:  trunk
changeset: 515195:dc06a7656ab3
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Tue Sep 18 23:23:22 2001 +0000

description:
Finally make the RiscPC boot ELF kernels for real !! ... it now loads a.out
kernels as also ELF ones. Also cleaned up the code a bit and removed a
bunch of errors in the ELF loading code... no wonder it didn't work ! ... I
tried to squeeze about 8000 bytes in one 4096 byte page resulting in a
corrupted bss.

diffstat:

 sys/arch/arm32/riscpc/rpc_machdep.c                   |  34 ++++++++++--------
 sys/arch/arm32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD |  17 ++++++---
 2 files changed, 30 insertions(+), 21 deletions(-)

diffs (141 lines):

diff -r 7bc27830dcf4 -r dc06a7656ab3 sys/arch/arm32/riscpc/rpc_machdep.c
--- a/sys/arch/arm32/riscpc/rpc_machdep.c       Tue Sep 18 23:19:08 2001 +0000
+++ b/sys/arch/arm32/riscpc/rpc_machdep.c       Tue Sep 18 23:23:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_machdep.c,v 1.51 2001/07/28 18:12:45 chris Exp $   */
+/*     $NetBSD: rpc_machdep.c,v 1.52 2001/09/18 23:23:22 reinoud Exp $ */
 
 /*
  * Copyright (c) 2000-2001 Reinoud Zandijk.
@@ -671,29 +671,33 @@
        /* Now we fill in the L2 pagetable for the kernel code/data */
        l2pagetable = kernel_pt_table[KERNEL_PT_KERNEL];
 
+       /*
+        * The defines are a workaround for a recent problem that occurred
+        * with ARM 610 processors and some ARM 710 processors
+        * Other ARM 710 and StrongARM processors don't have a problem.
+        */
        if (N_GETMAGIC(kernexec[0]) == ZMAGIC) {
-               /*
-                * This is a work around for a recent problem that occurred
-                * with ARM 610 processors and some ARM 710 processors
-                * Other ARM 710 and StrongARM processors don't have a problem.
-                */
 #if defined(CPU_ARM6) || defined(CPU_ARM7)
-               logical = map_chunk(0, l2pagetable, KERNEL_TEXT_BASE,
+               logical = map_chunk(l1pagetable, l2pagetable, KERNEL_TEXT_BASE,
                    physical_start, kernexec->a_text,
                    AP_KRW, PT_CACHEABLE);
 #else  /* CPU_ARM6 || CPU_ARM7 */
-               logical = map_chunk(0, l2pagetable, KERNEL_TEXT_BASE,
+               logical = map_chunk(l1pagetable, l2pagetable, KERNEL_TEXT_BASE,
                    physical_start, kernexec->a_text,
                    AP_KR, PT_CACHEABLE);
 #endif /* CPU_ARM6 || CPU_ARM7 */
-               logical += map_chunk(0, l2pagetable, KERNEL_TEXT_BASE + logical,
+               logical += map_chunk(l1pagetable, l2pagetable, KERNEL_TEXT_BASE + logical,
                    physical_start + logical, kerneldatasize - kernexec->a_text,
                    AP_KRW, PT_CACHEABLE);
-       } else
-               map_chunk(0, l2pagetable, KERNEL_TEXT_BASE,
+       } else {        /* !ZMAGIC */
+               /*
+                * Most likely an ELF kernel ...
+                * XXX no distinction yet between read only and read/write area's ...
+                */
+               map_chunk(l1pagetable, l2pagetable, KERNEL_TEXT_BASE,
                    physical_start, kerneldatasize,
-                   AP_KRW, PT_CACHEABLE)
-       ;
+                   AP_KRW, PT_CACHEABLE);
+       };
 
 
 #ifdef VERBOSE_INIT_ARM
@@ -728,9 +732,9 @@
         */
        l2pagetable = kernel_pt_table[KERNEL_PT_VMEM];
 
-       map_chunk(0, l2pagetable, VMEM_VBASE, videomemory.vidm_pbase,
+       map_chunk(l1pagetable, l2pagetable, VMEM_VBASE, videomemory.vidm_pbase,
            videomemory.vidm_size, AP_KRW, PT_CACHEABLE);
-       map_chunk(0, l2pagetable, VMEM_VBASE + videomemory.vidm_size,
+       map_chunk(l1pagetable, l2pagetable, VMEM_VBASE + videomemory.vidm_size,
            videomemory.vidm_pbase, videomemory.vidm_size,
            AP_KRW, PT_CACHEABLE);
 
diff -r 7bc27830dcf4 -r dc06a7656ab3 sys/arch/arm32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD
--- a/sys/arch/arm32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD     Tue Sep 18 23:19:08 2001 +0000
+++ b/sys/arch/arm32/stand/BtNetBSD/pling.BtNetBSD/BtNetBSD     Tue Sep 18 23:23:22 2001 +0000
@@ -1,5 +1,5 @@
 REM > BtNetBSD
-REM $NetBSD: BtNetBSD,v 1.10 2001/08/20 12:20:05 wiz Exp $
+REM $NetBSD: BtNetBSD,v 1.11 2001/09/18 23:23:23 reinoud Exp $
 REM
 REM Copyright (c) 2000, 2001 Reinoud Zandijk
 REM Copyright (c) 1998, 1999, 2000 Ben Harris
@@ -219,7 +219,7 @@
   freepagesbase% = first_mapped_DRAM_index% : REM == first virt address in DRAM0a
   start_kernelpage% = freepagesbase%
   pv_offset% = KERNEL_BASE - DRAM_addr%(0) : REM XXX hardcoded
- 
+
   REM load the code blocks ?
   first% = TRUE
   FOR ph% = phdrs% TO phdrs% + (phnum% - 1) * phentsize% STEP phentsize%
@@ -228,6 +228,7 @@
     first%  = FALSE
     offset% = ph%!4
     vaddr%  = ph%!8
+    REM physaddr% = ph%!12
     filesz% = ph%!16
     memsz%  = ph%!20
     flags%  = ph%!24
@@ -289,6 +290,7 @@
   REM XXX
 
   kernelpages% = freepagesbase% - start_kernelpage%
+  IF extradebug% THEN PRINT ''"Number of kernel pages ";kernelpages%;" (";kernelpages%*nbpp%;")"
  
   PROCfinish_relocationtable
 ENDPROC
@@ -301,11 +303,12 @@
   REM filesz%  number of bytes to read of `file' for this chunk
   REM memsz%   number of bytes to clear for this chunk
   PRINT ;filesz%;
-  IF extradebug% PRINT ;" (";~vaddr%;"-";~(vaddr%+filesz%+memsz%);" [till base+";INT((vaddr%+filesz%+memsz%-&F0000000)/1024);"k]) ";
+  IF extradebug% PRINT ;" (";~vaddr%;"-";~(vaddr%+memsz%);" [till base+";INT((vaddr%+memsz%-&F0000000)/1024);"k]) ";
   WHILE filesz% > 0
     REM freepagesbase% is first page index in freepages list
-    fragsz% = nbpp% - (vaddr% MOD nbpp%)
+    fragsz% = nbpp%
     IF fragsz% > filesz% THEN fragsz% = filesz%
+
     fragaddr% = FNblock_vaddr(freepagesbase%)
     SYS "OS_GBPB", 3, file%, fragaddr%, fragsz%, offset%
  
@@ -322,11 +325,13 @@
     memsz% -= fragsz%
     PROCtwirl
   ENDWHILE
+ 
   IF memsz% > 0 PRINT "+";memsz%;
   WHILE memsz% > 0
     REM freepagesbase% is first page index in freepages list
-    fragsz = nbpp% - (vaddr% MOD nbpp%)
+    fragsz% = nbpp%
     IF fragsz% > memsz% THEN fragsz% = memsz%
+
     PROCbzero(FNblock_vaddr(freepagesbase%), fragsz%)
 
     REM create a relocation block
@@ -907,7 +912,7 @@
   ENDWHILE
   PRINT'
   IF extradebug% THEN PRINT '"First DRAM index found at index ";first_mapped_DRAM_index%;" DRAM_addr%(0)=0x";~DRAM_addr%(0)
-  IF first_mapped_DRAM_index%<0 THEN ERROR EXT 1, "No (S)DRAM mapped in this program (weird) ... increase Wimpslot!"
+  IF first_mapped_DRAM_index%<0 THEN ERROR EXT 1, "No (S)DRAM mapped in this program (wierd) ... increase Wimpslot!"
 ENDPROC
 
 



Home | Main Index | Thread Index | Old Index