Port-amiga archive

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

Re: 1.6.1: KASSERT in custom kernel triggered



On Tue, Jun 24, 2003 at 01:42:28PM +0200, Gunther Nikl wrote:
> On Mon, Jun 23, 2003 at 03:02:56PM +0200, Gunther Nikl wrote:
> > I upgraded my system to 1.6.1 and built a custom kernel as I did with
> > previous NetBSD versions before. However, this time my custom kernel doesn't
> > work, it triggers a KASSERT in amiga/pmap.c:pmap_kenter_pa line 1399 
> > (v1.100):
> > 
> >    KASSERT(!pmap_pte_v(pte));
> > 
> > AFAICT, this check is also present in the generic kernel but that kernel
> > works. What might be wrong with my custom kernel?
> 
>   My custom kernel works when using the bootblocks or loadbsd. I didn't test
>   that before I wrote my initial mail. I used a custom loader which upto 1.6
>   worked flawlessly. Surprisingly, the custom loader can boot GENERIC 1.6.1.

  I could nail the problem down. Apparently the arguments to pmap_bootstrap
  (start_c_pstart and start_c_fphystart) were zero... I don't know why that
  happend because eg. the boot_* flags were set properly. Moving the setup
  of these two variables before the possible kernel copy and MMU enable
  preparations solved it. A patch for this is included. I added another
  small modification. start_c() has now another parameter - loadbase. Since
  locore.s did already computed it, there is no need todo that in start_c()
  again.

  Gunther
diff -up old/locore.s new/locore.s
--- old/locore.s        Sun Jan 12 00:03:43 2003
+++ new/locore.s        Thu Jun 26 19:47:04 2003
@@ -788,6 +788,7 @@ ASENTRY_NOPROFILE(start)
 
        | save the passed parameters. "prepass" them on the stack for
        | later catch by start_c()
+       movl    %a5,%sp@-               | pass loadbase
        movl    %d6,%sp@-               | pass boot partition offset
        movl    %a2,%sp@-               | pass sync inhibit flags
        movl    %d3,%sp@-               | pass AGA mode
@@ -921,7 +922,7 @@ Lstartnot040:
 /* let the C function initialize everything */
        RELOC(start_c, %a0)
        jbsr    %a0@
-       addl    #28,%sp
+       lea     %sp@(4*9),%sp
 
 #ifdef DRACO
        RELOC(machineid,%a0)
diff -up old/amiga_init.c new/amiga_init.c
--- old/amiga_init.c    Sun Jan 12 00:03:12 2003
+++ new/amiga_init.c    Thu Jun 26 20:01:16 2003
@@ -127,7 +127,7 @@ int ncfdev;
 u_long scsi_nosync;
 int shift_nosync;
 
-void  start_c(int, u_int, u_int, u_int, char *, u_int, u_long, u_long);
+void  start_c(int, u_int, u_int, u_int, char *, u_int, u_long, u_long, u_int);
 void rollcolor(int);
 static int kernel_image_magic_size(void);
 static void kernel_image_magic_copy(u_char *);
@@ -195,13 +195,14 @@ alloc_z2mem(amount)
 int kernel_copyback = 1;
 
 void
-start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync, 
boot_part)
+start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync, 
boot_part, loadbase)
        int id;
        u_int fphystart, fphysize, cphysize;
        char *esym_addr;
        u_int flags;
        u_long inh_sync;
        u_long boot_part;
+       u_int loadbase;
 {
        extern char end[];
        extern u_int protorp[2];
@@ -213,7 +214,6 @@ start_c(id, fphystart, fphysize, cphysiz
        register pt_entry_t pg_proto, *pg;
        u_int end_loaded, ncd, i;
        struct boot_memlist *ml;
-       u_int loadbase = 0;     /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
 
 #ifdef DEBUG_KERNEL_START
        /* XXX this only is valid if Altais is in slot 0 */
@@ -221,9 +221,6 @@ start_c(id, fphystart, fphysize, cphysiz
        volatile u_int8_t *altaiscol = (u_int8_t *)0x200003c9;
 #endif
 
-       if ((u_int)&loadbase > cphysize)
-               loadbase = fphystart;
-
 #ifdef DEBUG_KERNEL_START
        if ((id>>24)==0x7D) {
                *altaiscolpt = 0;
@@ -714,6 +711,10 @@ start_c(id, fphystart, fphysize, cphysiz
         */
        RELOC(protorp[1], u_int) = RELOC(Sysseg_pa, u_int);     /* + segtable 
address */
 
+       /* Set these for pmap_bootstrap() in start_c_finish() */
+       RELOC(start_c_fphystart, u_int) = fphystart;
+       RELOC(start_c_pstart, u_int) = pstart;
+
        /*
         * copy over the kernel (and all now initialized variables)
         * to fastram.  DONT use bcopy(), this beast is much larger
@@ -777,9 +778,6 @@ start_c(id, fphystart, fphysize, cphysiz
                (RELOC(protorp[0], u_int)) = 0x80000202;
                asm volatile ("pmove %0@,%%srp":: "a" (&RELOC(protorp, u_int)));
        }
-
-       RELOC(start_c_fphystart, u_int) = fphystart;
-       RELOC(start_c_pstart, u_int) = pstart;
 }
 
 void


Home | Main Index | Thread Index | Old Index