Subject: Re: problems with 32bit kernels (continued)
To: None <bouyer@antioche.lip6.fr, port-sparc64@netbsd.org>
From: None <eeh@netbsd.org>
List: port-sparc64
Date: 11/12/2001 17:52:34
| following mrg's advices I got a 32bit kernel compiled. But it doens't
| boot on my ultra/1:
| Rebooting with command: boot net netbsd32 -s                          
| Boot device: /sbus/ledma@e,8400010/le@e,8c00000  File and args: netbsd32 -s
| 15400 >> NetBSD/sparc64 OpenFirmware Boot, Revision 
| >> (bouyer@java, Sat Nov 10 22:15:45 MET 2001)
| Using BOOTPARAMS protocol: ip address: 132.227.63.55, hostname: metal
| root addr=132.227.63.44 path=/home/NetBSD/sparc
| loadfile: reading header
| elf32_exec: Booting /sbus@1f,0/ledma@e,8400010/le@e,8c00000/netbsd32
| 1878320@0x1000000+63668@0x1800000+4130636@0x180f8b4 
| symbols @ 0xfff501ec 74+109504+86012 start=0x1000000
| chain: calling OF_chain(800000, eef0, 1000000, fffb5a80, 18)
| console is /sbus@1f,0/zs@f,1100000:a
| Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
|     The NetBSD Foundation, Inc.  All rights reserved.
| Copyright (c) 1982, 1986, 1989, 1991, 1993
|     The Regents of the University of California.  All rights reserved.
|
|
| RED State Exception
|
| TL=0000.0000.0000.0005 TT=0000.0000.0000.0030
|    TPC=0000.0000.0100.8958 TnPC=0000.0000.0100.895c TSTATE=0000.0044.5800.0d00
| TL=0000.0000.0000.0004 TT=0000.0000.0000.0030
|    TPC=0000.0000.0100.8958 TnPC=0000.0000.0100.895c TSTATE=0000.0044.5800.0d00
| TL=0000.0000.0000.0003 TT=0000.0000.0000.0030
|    TPC=0000.0000.0100.8958 TnPC=0000.0000.0100.895c TSTATE=0000.0044.5800.0d00
| TL=0000.0000.0000.0002 TT=0000.0000.0000.0030
|    TPC=0000.0000.0100.8958 TnPC=0000.0000.0100.895c TSTATE=0000.0044.5800.0d00
| TL=0000.0000.0000.0001 TT=0000.0000.0000.0030
|    TPC=0000.0000.0115.5ebc TnPC=0000.0000.0115.5ec0 TSTATE=0000.0099.8200.0c00
|
|
| Watchdog Reset
| Externally Initiated Reset
|
| This is with both GENERIC32 and a custom kernel. The 64bit kernel derived from
| the same config file boots fine.
|
| What can I do to help debug this ?

It might be usefult to find out what instructions you have at 0100.8958 and 
0115.5ebc.  From the looks of things something nasty has probably happened
to your stack.

| Related note: I tried booting a GENERIC 64bit kernel on this machine with
| a 32bit userland, hoping that compat_netbsd32 would do it. It fails when
| trying to exec /bin/sh:
| Rebooting with command: boot disk netbsd -s                           
| Boot device: /sbus/espdma@e,8400000/esp@e,8800000/sd@0,0  File and args: netbsd -s
| NetBSD IEEE 1275 Bootblock
| ..>> NetBSD/sparc64 OpenFirmware Boot, Revision 1.5
| >> (bouyer@java, Sat Nov 10 22:14:35 MET 2001)
| loadfile: reading header
| elf64_exec: Booting /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0:a/netbsd
| 4759286@0x1000000+133944@0x1800000+4060360@0x1820b38 
| symbols @ 0xfef86300 74+322704+172151 start=0x1000000
| chain: calling OF_chain(800000, ee08, 1000000, fffb5a80, 18)
| [ using 495704 bytes of netbsd ELF symbol table ]
| console is /sbus@1f,0/zs@f,1100000:a
| Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
|     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.5Y (GENERIC) #0: Fri Nov  9 10:31:56 MET 2001
|     bouyer@java:/home/cvs.netbsd.org/sys/arch/sparc64/compile/GENERIC
| total memory = 128 MB
| avail memory = 108 MB
| using 832 buffers containing 6656 KB of memory
| bootpath: /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0
| mainbus0 (root): SUNW,Ultra-1
| cpu0 at mainbus0: SUNW,UltraSPARC @ 142.993 MHz, version 0 FPU
| cpu0: physical 4K instruction (32 b/l), 4K data (32 b/l), 2048K external (64 b/l) 
| [...]
| root on sd0a dumps on sd0b
| root file system type: ffs
| Enter pathname of shell or RETURN for sh: 
| text_access_fault: pc=0 va=0
| kernel trap 64: +fast instruction access MMU miss
| Stopped in pid 7 (sh) at                 0:     undefined
| db> tr
| netbsd32_execve(8f530e0, 8f83dd0, 8f83dc0, 134bd6c, 0, 0) at netbsd32_execve+0x5
| 4
| syscall(8f83ed0, 3b, 0, 176cc, 400, 2) at syscall+0x304
| syscall_setup(4dfe0, ffffda88, 7a170, 7a170, 0, 0) at syscall_setup+0x12c
| db> 

32-bit init and mount (among other things) do not work in compat_netbsd32.  You need
a 64-bit root and the 32-bit stuff should be installed in /emul/netbsd32.  You may be
able to get by just making /emul/netbsd32 a symlink that points to root and copying a
over select 64-bit binaries to /bin and /sbin

Eduardo