Subject: Re: NetBSD/arc status
To: None <jonathan@DSG.Stanford.EDU, imp@village.org, mhitch@NetBSD.ORG,>
From: Noriyuki Soda <soda@sra.co.jp>
List: port-mips
Date: 07/24/1998 08:56:14
> 	- System hangs as soon as spl0() is called (I'm missing
> 	  something in merge process). Probably something is wrong
> 	  in trap() or somewhere, but I don't begin to find the error,
> 	  yet, because the time when I encountered this problem is
> 	  today. :-)

fixed.
This was the bug of mips shared locore.S.
I suppose that this bug also damages to the performance of R4000 pmax.

Quick dirty fix is below. (there were other bugs in sys/arch/arc.)
I've put newer version of the tar.gz file to the same ftp directory.

------------------------------------------------------------------------
Index: locore.S
===================================================================
RCS file: /proj/bsd/cvs/netbsd/src/sys/arch/mips/mips/locore.S,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** locore.S	1998/07/20 21:50:56	1.3
--- locore.S	1998/07/23 23:18:12	1.4
***************
*** 677,683 ****
--- 677,687 ----
   * profiling.
   */
  LEAF(idle)
+ #ifdef arc /* XXX: not arc, really MIPS3 */
+ 	li	t0, (MIPS3_INT_MASK | MIPS_SR_INT_IE)
+ #else
  	li	t0, (MIPS_INT_MASK | MIPS_SR_INT_IE)
+ #endif
  	mtc0	t0, MIPS_COP_0_STATUS_REG	# enable all interrupts
  	nop
  	sw	zero, _C_LABEL(curproc)		# set curproc NULL for stats
***************
*** 1344,1350 ****
--- 1348,1358 ----
  ALEAF(spllow)
  	mfc0	v0, MIPS_COP_0_STATUS_REG	# read status register
  	nop
+ #ifdef arc /* XXX: not arc, really MIPS3 */
+ 	or	t0, v0, (MIPS3_INT_MASK | MIPS_SR_INT_IE)
+ #else
  	or	t0, v0, (MIPS_INT_MASK | MIPS_SR_INT_IE)
+ #endif
  	mtc0	t0, MIPS_COP_0_STATUS_REG	# enable all interrupts
  	j	ra
  	and	v0, v0, (MIPS_INT_MASK | MIPS_SR_INT_IE)
Index: locore_r4000.S
===================================================================
RCS file: /proj/bsd/cvs/netbsd/src/sys/arch/mips/mips/locore_r4000.S,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** locore_r4000.S	1998/07/20 21:50:59	1.7
--- locore_r4000.S	1998/07/23 23:18:14	1.8
***************
*** 875,881 ****
  	sw	s6, U_PCB_REGS+(S6 * 4)(k1)
  	sw	s7, U_PCB_REGS+(S7 * 4)(k1)
  	sw	s8, U_PCB_REGS+(S8 * 4)(k1)
! 	li	t0, MIPS_HARD_INT_MASK | MIPS_SR_INT_IE
  /*
   * Call the software interrupt handler.
   */
--- 875,881 ----
  	sw	s6, U_PCB_REGS+(S6 * 4)(k1)
  	sw	s7, U_PCB_REGS+(S7 * 4)(k1)
  	sw	s8, U_PCB_REGS+(S8 * 4)(k1)
! 	li	t0, MIPS3_HARD_INT_MASK | MIPS_SR_INT_IE
  /*
   * Call the software interrupt handler.
   */
------------------------------------------------------------------------

Then, the other problem appeared.
This is the harder type problem. :-<
(heap area is corrupted by erroneous code.)

------------------------------------------------------------------------
Copyright (c) 1996, 1997, 1998
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 1.3F (M402COM) #6: Fri Jul 24 08:08:16 JST 1998
    soda@floyd:/usr/current/netbsd/netbsd/src/sys/arch/arc/compile/M402COM
real mem = 33554432
avail mem = 27062272
using 819 buffers containing 3354624 bytes of memory
mainbus0 (root)
cpu0 at mainbus0: MIPS R4400 CPU Rev. 5.0 with MIPS R4010 FPC Rev. 0.0
        L1 cache: 16kb Instruction, 16kb Data. Direct mapped.
        No L2 cache or Snooping L2 cache.
pica0 at mainbus0
aclock0 at pica0 slot 0 offset 0x0: mc146818 or compatible
lpt0 at pica0 slot 1 offset 0x0
fdc0 at pica0 slot 2 offset 0x0
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
sn0 at pica0 slot 5 offset 0x0: bufsize 28480 address 00:00:11:11:33:33
asc0 at pica0 slot 6 offset 0x0: NCR53CF9X-2, target 7
scsibus0 at asc0: 8 targets
sd0 at scsibus0 targ 0 lun 0: <CONNER, CFA540S, 090> SCSI2 0/direct fixed
sd0: 515MB, 2800 cyl, 4 head, 94 sec, 512 bytes/sect x 1056708 sectors
cd0 at scsibus0 targ 1 lun 0: <CHINON, CD-ROM CDS-535, Q20> SCSI2 5/cdrom removable
sd1 at scsibus0 targ 3 lun 0: <nEC, D3845, 0311> SCSI2 0/direct fixed
sd1: 1032MB, 2097 cyl, 16 head, 63 sec, 512 bytes/sect x 2113776 sectors
pckbd at pica0 slot 7 offset 0x0 not configured
pms at pica0 slot 8 offset 0x0 not configured
com0 at pica0 slot 9 offset 0x0: ns16550a, working fifo
com0: console
com1 at pica0 slot 10 offset 0x0: ns16550a, working fifo
fb at pica0 slot 11 offset 0x0 not configured
isabr0 at mainbus0
isa0 at isabr0 isa_io_base 0xe2000000 isa_mem_base 0xe3000000
doing spl0:cause=3000c008
done
now cold = 0
Data modified on freelist: word 0 of object 0xc0434400 size 1024 previous type free (0x0 != 0xdeadbeef)
Data modified on freelist: word 0 of object 0xc043a900 size 180 previous type free (0x0 != 0xdeadbeef)
Data modified on freelist: word 0 of object 0xc0438000 size 2048 previous type free (0x0 != 0xdeadbeef)
Data modified on freelist: word 0 of object 0xc0436800 size 1024 previous type free (0x0 != 0xdeadbeef)
boot device: <unknown>
root device: sn0
dump device: 
file system (default generic): 
mountroot: trying nfs...
Data modified on freelist: word 0 of object 0xc043e900 size 256 previous type free (0x0 != 0xdeadbeef)
mountroot: trying msdos...
mountroot: trying cd9660...
mountroot: trying ffs...
no file system for sn0
cannot mount root, error = 79
root device (default sn0): sn0
dump device: sn0
file system (default generic): 
 dumps on sn0p
mountroot: trying nfs...
mountroot: trying msdos...
mountroot: trying cd9660...
mountroot: trying ffs...
no file system for sn0
cannot mount root, error = 79
root device (default sn0): sd1
dump device (default sd1b): 
file system (default generic): 
root on sd1a dumps on sd1b
mountroot: trying nfs...
mountroot: trying msdos...
Data modified on freelist: word 0 of object 0xc0437c00 size 320 previous type free (0x0 != 0xdeadbeef)
------------------------------------------------------------------------

Later,
--
soda