Re: CVS commit: src/sys/arch/pmax/stand/common
Log Message: Check if `enet' environment variable is available before reference to get MAC address, and exit with appropriate warning messages if it isn't. My 3MIN doesn't set the variable by default and netboot fails silently. I guess the battery of RTC chip in your DECstation weared out and is incapable of holding record anymore. Hmm, but `boot' variable (3/rz2/netbsd -aN) is still kept and `enet' is cleared even after abort by haltbutton without powercycle. Anyway, NULL pointer dereference is a bad thing. --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
Hmm, but `boot' variable (3/rz2/netbsd -aN) is still kept and `enet' is cleared even after abort by haltbutton without powercycle. Anyway, NULL pointer dereference is a bad thing. The original code used to be ok for long time, at the age. Toru Nishimura / ALKYL Technology
Re: CVS commit: src/sys/arch/pmax/stand/common
Hmm, but `boot' variable (3/rz2/netbsd -aN) is still kept and `enet' is cleared even after abort by haltbutton without powercycle. Anyway, NULL pointer dereference is a bad thing. The original code used to be ok for long time, at the age. Probably it has been broken on 3MIN for long time and people used ECOFF kernels directly on netboot at that time. http://mail-index.NetBSD.org/source-changes/2002/02/23/0090.html Log Message: Support two-stage netboot. Is known to work on maxine, but problems have been reported on 3min. --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
Matt Thomas wrote: On Nov 25, 2010, at 2:20 PM, Simon Burge wrote: Matt Thomas wrote: On Nov 25, 2010, at 9:00 AM, Antti Kantee wrote: On Fri Nov 26 2010 at 01:50:11 +0900, Izumi Tsutsui wrote: but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. Like I said, I don't have strong feelings about this. If you want to fix stubs, go for it! (there's no need for a discussion after that, anyway, since the issue is decided and fixed) Please don't. I've changed the mips1 syscall handler to save t0-t2 just like the mips3+ handler does. Why is it necessary to save three extra regs for every syscall, when only two syscalls actually use t0? Callers of the syscalls don't expect t0-t3 to be saved. Because N32/N64 requires that $gp be caller saved/restored. Normally this would be done on the stack but we can't do that since that would mess up accessing stack based arguments. So the other alternative is to save it in a temporary register. http://cvsweb.NetBSD.org/bsdweb.cgi/src/lib/libc/arch/mips/SYS.h.diff?r1=1.18r2=1.19 +# if defined(__mips_o32) || defined(__mips_o64) +# define PIC_PROLOGUE(x) SETUP_GP +# define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); jr t9 +# define PIC_RETURN() j ra +# else +# define PIC_PROLOGUE(x) SETUP_GP64(t3, x) +# define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9 +# define PIC_RETURN() RESTORE_GP64; j ra +# endif http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/arch/mips/mips/mipsX_subr.S.diff?r1=1.34r2=1.35 - #REG_S t0, FRAME_T0(k1)# no need to save temp regs - #REG_S t1, FRAME_T1(k1) - #REG_S t2, FRAME_T2(k1) - #REG_S t3, FRAME_T3(k1) - mfc0a1, MIPS_COP_0_STATUS # 2nd arg is STATUS : + moves0, t0 # since the saved registers have + moves1, t1 # been saved we can use them to + moves2, t2 # stash most of temporary regs + REG_S t3, FRAME_T3(k1)# syscall saved gp for fork + mfc0a1, MIPS_COP_0_STATUS # 2nd arg is STATUS Also, why go to the effort of saving t0-t2 and not t3 as well? Surely that violates POLA? Because it was wasn't needed. t3 seems used to save $gp, but is it needed to save t0-t2 on MIPS3+? Anyway if t0-t2 are saved but t3 not, it's bad idea to put dumb optimization that assumes t0 is preserved in stubs because such hacks will cause no benefit but annoying bugs unless it's officially defined as ABI. --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
Now NetBSD/pmax kernel properly boots, but init(8) still doesn't start on GXemul emulating R3000 3MAX. GXemul's trace shows it's in infinite loop of uvm_fault(): --- : trap(0x8ff3c,:,PATH_LOCALE,0x7ded1044,..) _splset_noprof(0xfc01,0x0,PATH_LOCALE,0x7ded1044,..) uvm_fault_internal(0x83eb9e10,0x7df45000,2,0x0,..) vm_map_lock_read(0x83eb9e10,0x7df45000,2,0x0,..) atomic_cas_ptr(0x83eb9e14,0x0,16,0x0,..) mb_read(0x83eb9e14,0x0,16,0x0,..) uvm_map_lookup_entry(0x83eb9e10,0x7df45000,0xc5bf7dec,0x0,..) vm_map_unlock_read(0x83eb9e10,0x83fc6688,2,0x5,..) mb_read(0x83eb9e14,0x83fc6688,2,0x5,..) atomic_cas_ptr(0x83eb9e14,0x10,0,0x5,..) trapsignal(0x83f19320,0xc5bf7ee8,0xfffd,0x5,..) mutex_enter(0x83fd2f90,0xc5bf7ee8,0xfffd,0x5,..) mutex_enter(0x83f7a0b0,0xc5bf7ee8,0xfffd,0x5,..) kpsignal2(0x83ebece8,0xc5bf7ee8,_KERNEL_OPT_DDB_HISTORY_SIZE,0x0,..) mutex_enter(0x83ebb804,0x800,_KERNEL_OPT_DDB_HISTORY_SIZE,0x0,..) _splraise_noprof(0xf00,0x800,_KERNEL_OPT_DDB_HISTORY_SIZE,0x0,..) mutex_exit(0x83ebb804,0x0,0x83ebece8,0x0,..) ksiginfo_alloc(0x83ebece8,0xc5bf7ee8,2,0x0,..) pool_cache_get_paddr(X,0x2,0,0x0,..) makeiplcookie(0xc5bf7e18,0x3,0,0x0,..) _splraise_noprof(0x700,0x803491fc,0x700,0x0,..) _splset_noprof(0xfc01,0x0,0x816aa,0x0,..) lwp_find(0x83ebece8,0x1,0xc5bf7f18,\r,..) sigput(0x83f194d4,0x83ebece8,\t,\r,..) mb_read(3,0x0,PATH_LOCALE,0x1,..) sigpost(0x83f19320,0x2,0x103,0xa,..) mutex_spin_enter(0x83f7a140,0x2,0x103,0xa,..) mutex_spin_exit(0x83f7a140,0x9,0x103,0xa,..) ksiginfo_free(\t,0x9,0x103,0xa,..) makeiplcookie( ,0x3,0x,0xa,..) _splraise_noprof(0x700,0x803491fc,0x700,0xa,..) mutex_exit( ,0x0,0x816ab,0x0,..) lwp_userret(0x83f19320,0x0,cpu_info_store,0x0,..) mutex_enter(0x83f7a0b0,0x104,cpu_info_store,0x0,..) issignal(0x83f19320,0x104,cpu_info_store,0x0,..) ffs(0,0x200,cpu_info_store,0x0,..) ffs(0,0x200,cpu_info_store,0x0,..) ffs(0,0x803a,cpu_info_store,0x0,..) ffs(0,0x803a,cpu_info_store,0x0,..) mutex_spin_enter(0x83f7a140,0x803a,cpu_info_store,0x0,..) mutex_spin_exit(0x83f7a140,0x803a,cpu_info_store,0x0,..) mutex_exit( ,0x803a,cpu_info_store,0x0,..) trap(0x8ff3c,:,PATH_LOCALE,0x7ded1044,..) _splset_noprof(0xfc01,0x0,PATH_LOCALE,0x7ded1044,..) : --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
On Thu Nov 25 2010 at 14:05:28 +, Izumi Tsutsui wrote: Module Name: src Committed By: tsutsui Date: Thu Nov 25 14:05:28 UTC 2010 Modified Files: src/sys/arch/pmax/stand/common: startprog.S Log Message: Fix botch on mips64 merge: - use correct offsets to pass args to loaded kernel in __mips_o32 case Now NetBSD/pmax kernel properly boots, but init(8) still doesn't start on GXemul emulating R3000 3MAX. One remaining problem (which was debugged by Alessandro Forin) is that the post-mips64 brk/sbrk syscall stubs depend on syscall retaining t0, and the kernel doesn't do that. I have this in my local tree and it makes a mips1 platform boot with new userland. See if it helps on pmax too: --- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs #sw t1, FRAME_T1(k1) #sw t2, FRAME_T2(k1) #sw t3, FRAME_T3(k1)
Re: CVS commit: src/sys/arch/pmax/stand/common
On Thu Nov 25 2010 at 14:05:28 +, Izumi Tsutsui wrote: Module Name:src Committed By: tsutsui Date: Thu Nov 25 14:05:28 UTC 2010 Modified Files: src/sys/arch/pmax/stand/common: startprog.S Log Message: Fix botch on mips64 merge: - use correct offsets to pass args to loaded kernel in __mips_o32 case Now NetBSD/pmax kernel properly boots, but init(8) still doesn't start on GXemul emulating R3000 3MAX. One remaining problem (which was debugged by Alessandro Forin) is that the post-mips64 brk/sbrk syscall stubs depend on syscall retaining t0, and the kernel doesn't do that. I have this in my local tree and it makes a mips1 platform boot with new userland. See if it helps on pmax too: --- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs Yeah, it works with 20101117Z snapshot binaries. Thanks. But should we rather fix syscall stubs? --- Izumi Tsutsui --- NetBSD/pmax 5.99.39 FFS Primary Bootstrap NetBSD/pmax 5.99.39 Secondary Bootstrap, Revision 1.5 (tsut...@mirage, Thu Nov 25 22:22:23 JST 2010) Boot: 5/rz0/ Loading: 5/rz0/netbsd.pmax open 5/rz0/netbsd.pmax: No such file or directory Loading: 5/rz0/netbsd 3538000+120424 [218064+207371]=0x3e5724 Starting at 0x8003 segment 0 start size 0400 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 5.99.39 (GENERIC) #107: Thu Nov 25 23:28:21 JST 2010 tsut...@mirage:/usr/src/sys/arch/pmax/compile/GENERIC DECstation 5000/200 (3MAX) total memory = 65536 KB avail memory = 59712 KB mainbus0 (root) cpu0 at mainbus0: MIPS R3000 CPU (0x220) Rev. 2.0 with MIPS R3010 FPC Rev. 4.0 cpu0: 4KB/4B direct-mapped Instruction cache, 64 TLB entries cpu0: 4KB/4B direct-mapped write-through Data cache tc0 at mainbus0: 25 MHz clock ibus0 at tc0 slot 7 offset 0x0 mcclock0 at ibus0 addr 0x1fe8: mc146818 or compatible dz0 at ibus0 addr 0x1fe0: DC-7085, 4 lines lkkbd0 at dz0 line 0 wskbd0 at lkkbd0 mux 1 vsms0 at dz0 line 1 wsmouse0 at vsms0 mux 0 le0 at tc0 slot 6 offset 0x0: address 10:20:30:00:00:10 le0: 32 receive buffers, 8 transmit buffers asc0 at tc0 slot 5 offset 0x0: NCR53C94, 25MHz, SCSI ID 7 scsibus0 at asc0: 8 targets, 8 luns per target scsibus0: waiting 2 seconds for devices to settle... sd0 at scsibus0 target 0 lun 0: DEC, RZ58 (C) DEC, 2000 disk fixed sd0: 1024 MB, 1024 cyl, 16 head, 128 sec, 512 bytes/sect x 2097153 sectors sd0: async, 8-bit transfers boot device: sd0 root on sd0a dumps on sd0b root file system type: ffs pid 1(init): ABI set to O32 (e_flags=0x1007) Fri Nov 26 14:34:07 UTC 2010 Starting root file system check: /dev/rsd0a: file system is clean; not checking swapctl: adding /dev/sd0b as swap device at priority 0 Starting file system checks: Setting tty flags. Setting sysctl variables: ddb.onpanic: 0 - 0 Starting network. /etc/rc: WARNING: $hostname not set. IPv6 mode: host Configuring network interfaces:. Adding interface aliases:. Building databases: dev, utmp, utmpx, services done Starting syslogd. Mounting all filesystems... Clearing temporary files. Checking quotas: done. Setting securelevel: kern.securelevel: 0 - 1 Starting virecover. Checking for core dump... savecore: no core dump Starting local daemons:. Updating motd. postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db) newaliases: warning: valid_hostname: empty hostname newaliases: fatal: unable to use my own hostname Nov 26 14:34:15 postfix/sendmail[302]: fatal: unable to use my own hostname /etc/rc.d/postfix exited with code 1 Starting inetd. Starting cron. The following components reported failures: /etc/rc.d/postfix See /var/run/rc.log for more information. Fri Nov 26 14:34:16 UTC 2010 NetBSD/pmax (Amnesiac) (console) login:
re: CVS commit: src/sys/arch/pmax/stand/common
--- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs Yeah, it works with 20101117Z snapshot binaries. Thanks. But should we rather fix syscall stubs? if the above is necessary for old binaries then it needs to be done. we should fix the syscall stubs, for sure... but we may need the above as well. .mrg.
Re: CVS commit: src/sys/arch/pmax/stand/common
On Thu Nov 25 2010 at 23:39:03 +0900, Izumi Tsutsui wrote: One remaining problem (which was debugged by Alessandro Forin) is that the post-mips64 brk/sbrk syscall stubs depend on syscall retaining t0, and the kernel doesn't do that. I have this in my local tree and it makes a mips1 platform boot with new userland. See if it helps on pmax too: --- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs Yeah, it works with 20101117Z snapshot binaries. Thanks. cool But should we rather fix syscall stubs? That was debated a little but undecided. Pros for kernel: * debugging (low-level) over syscall trap doesn't cause debugger confusion * random kernel info not leaked to userland (+ IMHO principle of least surprise) Pros for syscall stub: * faster (but nobody measured it, and most likely the difference is lost in the noise) I don't have a strong prefence for either. The reason I have it that way is because for some reason when testing I forgot to fix my tree before starting a build and when I remembered the build was already past libc, so I figured I might as well fix the kernel ;)
Re: CVS commit: src/sys/arch/pmax/stand/common
On Fri Nov 26 2010 at 03:01:29 +1100, matthew green wrote: --- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs Yeah, it works with 20101117Z snapshot binaries. Thanks. But should we rather fix syscall stubs? if the above is necessary for old binaries then it needs to be done. we should fix the syscall stubs, for sure... but we may need the above as well. Well, it's necessary for libc post-mips64, but I don't think anyone will terribly scream if their not-currently-working libc remains the same. Old (4.0) userland works just fine even without that fix.
Re: CVS commit: src/sys/arch/pmax/stand/common
On Fri Nov 26 2010 at 03:01:29 +1100, matthew green wrote: --- locore_mips1.S 8 Nov 2010 18:09:38 - 1.68 +++ locore_mips1.S 25 Nov 2010 14:15:39 - @@ -418,7 +418,7 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLF sw a3, FRAME_A3(k1) lw a0, CPUVAR(CURLWP) # 1st arg is curlwp mfhiv1 - #sw t0, FRAME_T0(k1)# no need to save temp regs + sw t0, FRAME_T0(k1)# no need to save temp regs Yeah, it works with 20101117Z snapshot binaries. Thanks. But should we rather fix syscall stubs? if the above is necessary for old binaries then it needs to be done. we should fix the syscall stubs, for sure... but we may need the above as well. Actually, I'm not sure on for sure. If we define the kernel to retain t regs over syscall, there is no need to touch the syscall stubs. The problem is essentially that the old stub did this: brk: syscall la t0 _C_LABEL sw v0 0(t0) and the new one: brk: la t0 _C_LABEL syscall sw v0 0(t0)
Re: CVS commit: src/sys/arch/pmax/stand/common
Actually, I'm not sure on for sure. If we define the kernel to retain t regs over syscall, there is no need to touch the syscall stubs. The problem is essentially that the old stub did this: brk: syscall la t0 _C_LABEL sw v0 0(t0) and the new one: brk: la t0 _C_LABEL syscall sw v0 0(t0) http://cvsweb.NetBSD.org/bsdweb.cgi/src/lib/libc/arch/mips/sys/brk.S.diff?r1=1.16r2=1.17 --- - lw v0, _C_LABEL(__minbrk) + PTR_LA t0, _C_LABEL(__minbrk) + PTR_L v0, 0(t0) syscall - sw a0, _C_LABEL(__curbrk) - movev0, zero + PTR_S a0, 0(t0) + movev0, zero --- Should we still preserve t0 for __minbrk?? --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
brk: syscall la t0 _C_LABEL sw v0 0(t0) and the new one: brk: la t0 _C_LABEL syscall sw v0 0(t0) sbrk.S is that case: http://cvsweb.NetBSD.org/bsdweb.cgi/src/lib/libc/arch/mips/sys/sbrk.S.diff?r1=1.16r2=1.17 --- - lw v1, _C_LABEL(__curbrk) + PTR_LA t0, _C_LABEL(__curbrk) + PTR_L v1, 0(t0) - syscall + SYSTRAP(break) - movev0, v1 # return old val of curbrk from above - sw a0, _C_LABEL(__curbrk) # save current val of curbrk from above + movev0, v1 # return old val of curbrk from above + PTR_S a0, 0(t0) # save current val of curbrk from above --- but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
On Fri Nov 26 2010 at 01:50:11 +0900, Izumi Tsutsui wrote: but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. Like I said, I don't have strong feelings about this. If you want to fix stubs, go for it! (there's no need for a discussion after that, anyway, since the issue is decided and fixed)
Re: CVS commit: src/sys/arch/pmax/stand/common
On Nov 25, 2010, at 9:00 AM, Antti Kantee wrote: On Fri Nov 26 2010 at 01:50:11 +0900, Izumi Tsutsui wrote: but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. Like I said, I don't have strong feelings about this. If you want to fix stubs, go for it! (there's no need for a discussion after that, anyway, since the issue is decided and fixed) Please don't. I've changed the mips1 syscall handler to save t0-t2 just like the mips3+ handler does.
Re: CVS commit: src/sys/arch/pmax/stand/common
Please don't. I've changed the mips1 syscall handler to save t0-t2 just like the mips3+ handler does. What about brk.S? --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/pmax/stand/common
Matt Thomas wrote: On Nov 25, 2010, at 9:00 AM, Antti Kantee wrote: On Fri Nov 26 2010 at 01:50:11 +0900, Izumi Tsutsui wrote: but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. Like I said, I don't have strong feelings about this. If you want to fix stubs, go for it! (there's no need for a discussion after that, anyway, since the issue is decided and fixed) Please don't. I've changed the mips1 syscall handler to save t0-t2 just like the mips3+ handler does. Why is it necessary to save three extra regs for every syscall, when only two syscalls actually use t0? Callers of the syscalls don't expect t0-t3 to be saved. Also, why go to the effort of saving t0-t2 and not t3 as well? Surely that violates POLA? Cheers, Simon.
Re: CVS commit: src/sys/arch/pmax/stand/common
On Nov 25, 2010, at 2:20 PM, Simon Burge wrote: Matt Thomas wrote: On Nov 25, 2010, at 9:00 AM, Antti Kantee wrote: On Fri Nov 26 2010 at 01:50:11 +0900, Izumi Tsutsui wrote: but shouldn't we fix stub first, then discuss pros and blah of the change? Current binaries have not worked at all on MIPS1 since the last December. Like I said, I don't have strong feelings about this. If you want to fix stubs, go for it! (there's no need for a discussion after that, anyway, since the issue is decided and fixed) Please don't. I've changed the mips1 syscall handler to save t0-t2 just like the mips3+ handler does. Why is it necessary to save three extra regs for every syscall, when only two syscalls actually use t0? Callers of the syscalls don't expect t0-t3 to be saved. Because N32/N64 requires that $gp be caller saved/restored. Normally this would be done on the stack but we can't do that since that would mess up accessing stack based arguments. So the other alternative is to save it in a temporary register. Also, why go to the effort of saving t0-t2 and not t3 as well? Surely that violates POLA? Because it was wasn't needed.
re: CVS commit: src/sys/arch/pmax/stand/common
Well, it's necessary for libc post-mips64, but I don't think anyone will terribly scream if their not-currently-working libc remains the same. Old (4.0) userland works just fine even without that fix. sounds like we don't have to bother about fixing the recently broken stuff then. good deal.