CVS commit: [netbsd-5] src/sys/arch/vax/include
Module Name:src Committed By: bouyer Date: Wed Aug 22 20:59:47 UTC 2012 Modified Files: src/sys/arch/vax/include [netbsd-5]: cpu.h Log Message: Pull up following revision(s) (requested by abs in ticket #1780): sys/arch/vax/include/cpu.h: revision 1.94 via patch Change cpu_idle to be an inline which sets IPL to 1 and then back to 0 so simh can recognize the kernel is idle. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.85.14.1 src/sys/arch/vax/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/vax/include/cpu.h diff -u src/sys/arch/vax/include/cpu.h:1.85 src/sys/arch/vax/include/cpu.h:1.85.14.1 --- src/sys/arch/vax/include/cpu.h:1.85 Tue Mar 11 05:34:02 2008 +++ src/sys/arch/vax/include/cpu.h Wed Aug 22 20:59:47 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.85 2008/03/11 05:34:02 matt Exp $ */ +/* $NetBSD: cpu.h,v 1.85.14.1 2012/08/22 20:59:47 bouyer Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden @@ -165,7 +165,18 @@ extern int cpu_printfataltraps; #define cpu_proc_fork(x, y) do { } while (/*CONSCOND*/0) #define cpu_lwp_free(l, f) do { } while (/*CONSCOND*/0) #define cpu_lwp_free2(l) do { } while (/*CONSCOND*/0) -#define cpu_idle() do { } while (/*CONSCOND*/0) + +/* + * This allows SIMH to recognize the kernel wants to sleep. + */ +static inline void +cpu_idle(void) +{ + int ipl = mfpr(PR_IPL); + mtpr(1, PR_IPL); + mtpr(ipl, PR_IPL); +} + static inline bool cpu_intr_p(void) {
CVS commit: [netbsd-5] src/sys/arch/vax
Module Name:src Committed By: riz Date: Fri Jan 7 01:01:44 UTC 2011 Modified Files: src/sys/arch/vax/include [netbsd-5]: clock.h src/sys/arch/vax/vax [netbsd-5]: clock.c Log Message: Pull up following revision(s) (requested by uwe in ticket #1500): sys/arch/vax/vax/clock.c: revision 1.54 sys/arch/vax/include/clock.h: revision 1.8 Correct definition of leap year. Make yeartonum and numtoyear use full years so that year 2000 is correctly counted as a leap year. Now NetBSD under SIMH picks up correct time-of-day clock value. It used to be a day behind, since 2000 - 1900 = 100 and naive leap year test wouldn't count it as a leap year. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.70.1 src/sys/arch/vax/include/clock.h cvs rdiff -u -r1.49.20.1 -r1.49.20.2 src/sys/arch/vax/vax/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/vax/include/clock.h diff -u src/sys/arch/vax/include/clock.h:1.6 src/sys/arch/vax/include/clock.h:1.6.70.1 --- src/sys/arch/vax/include/clock.h:1.6 Tue Sep 5 19:32:57 2006 +++ src/sys/arch/vax/include/clock.h Fri Jan 7 01:01:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.h,v 1.6 2006/09/05 19:32:57 matt Exp $ */ +/* $NetBSD: clock.h,v 1.6.70.1 2011/01/07 01:01:44 riz Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -37,7 +37,7 @@ /* * Time constants. These are unlikely to change. */ -#define IS_LEAPYEAR(y) (((y % 4) == 0) (y % 100)) +#define IS_LEAPYEAR(y) y % 4) == 0) ((y % 100) != 0)) || ((y % 400) == 0)) #define SEC_PER_MIN (60) #define SEC_PER_HOUR (SEC_PER_MIN * 60) Index: src/sys/arch/vax/vax/clock.c diff -u src/sys/arch/vax/vax/clock.c:1.49.20.1 src/sys/arch/vax/vax/clock.c:1.49.20.2 --- src/sys/arch/vax/vax/clock.c:1.49.20.1 Wed Sep 16 04:46:14 2009 +++ src/sys/arch/vax/vax/clock.c Fri Jan 7 01:01:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $ */ +/* $NetBSD: clock.c,v 1.49.20.2 2011/01/07 01:01:44 riz Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49.20.2 2011/01/07 01:01:44 riz Exp $); #include sys/param.h #include sys/kernel.h @@ -194,18 +194,18 @@ { int n; - for (n = 0, y -= 1; y 69; y--) + for (n = 0, y -= 1; y 1969; y--) n += SECPERYEAR(y); return n; } /* - * Converts tick number to a year 70 - + * Converts tick number to a year 1970 - */ int numtoyear(int num) { - int y = 70, j; + int y = 1970, j; while(num = (j = SECPERYEAR(y))) { y++; num -= j;
CVS commit: [netbsd-5] src/sys/arch/vax/vax
Module Name:src Committed By: snj Date: Wed Sep 16 04:46:14 UTC 2009 Modified Files: src/sys/arch/vax/vax [netbsd-5]: clock.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #955): sys/arch/vax/vax/clock.c: revision 1.51 via patch Not understanding what vax_mfpr_get_counter() was doing, my fix for backwards time was incorrect, and actually disabled the use of mfpr for timecounters. The intent was to emulate a 32 bit counter using the hardclock_ticks from the clock interrupt and the contents of the Interval Counter register. The problem with that was when the ICR wrapped, but the clock interrupt was blocked resulted in an incorrect count. Work around this by keeping track of the previous ICR value and hardclock_ticks to ensure the 32 bit counter doesn't go backwards. Also, the ICR runs from -1 to -1, so adjust the value when reading it. Now mfpr works quit nicely on my 4000/90. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.49.20.1 src/sys/arch/vax/vax/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/vax/vax/clock.c diff -u src/sys/arch/vax/vax/clock.c:1.49 src/sys/arch/vax/vax/clock.c:1.49.20.1 --- src/sys/arch/vax/vax/clock.c:1.49 Mon Jan 7 16:40:17 2008 +++ src/sys/arch/vax/vax/clock.c Wed Sep 16 04:46:14 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.49 2008/01/07 16:40:17 joerg Exp $ */ +/* $NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49 2008/01/07 16:40:17 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $); #include sys/param.h #include sys/kernel.h @@ -83,13 +83,31 @@ { int cur_hardclock; u_int counter; + static int prev_count, prev_hardclock; do { cur_hardclock = hardclock_ticks; - counter = mfpr(PR_ICR); + counter = mfpr(PR_ICR) + tick; } while (cur_hardclock != hardclock_ticks); - return counter + hardclock_ticks * tick; + /* + * Handle interval counter wrapping with interrupts blocked. + * If the current hardclock_ticks is less than what we saw + * previously, use the previous value. + * If the interval counter is smaller, assume it has wrapped, + * and if the [adjusted] current hardclock ticks is the same + * as what we saw previously, increment the local copy of + * the hardclock ticks. + */ + if (cur_hardclock prev_hardclock) + cur_hardclock = prev_hardclock; + if (counter prev_count cur_hardclock == prev_hardclock) + cur_hardclock++; + + prev_count = counter; + prev_hardclock=cur_hardclock; + + return counter + cur_hardclock * tick; } #if VAX46 || VAXANY
CVS commit: [netbsd-5] src/sys/arch/vax/include
Module Name:src Committed By: bouyer Date: Mon May 18 21:38:03 UTC 2009 Modified Files: src/sys/arch/vax/include [netbsd-5]: mtpr.h Log Message: Pull up following revision(s) (requested by mhitch in ticket #767): sys/arch/vax/include/mtpr.h: revisions 1.21, 1.22 Add memory clobber to mtpr for barrier. See also kern/38637. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.58.1 src/sys/arch/vax/include/mtpr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/vax/include/mtpr.h diff -u src/sys/arch/vax/include/mtpr.h:1.20 src/sys/arch/vax/include/mtpr.h:1.20.58.1 --- src/sys/arch/vax/include/mtpr.h:1.20 Fri Feb 16 01:34:03 2007 +++ src/sys/arch/vax/include/mtpr.h Mon May 18 21:38:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mtpr.h,v 1.20 2007/02/16 01:34:03 matt Exp $ */ +/* $NetBSD: mtpr.h,v 1.20.58.1 2009/05/18 21:38:03 bouyer Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -172,7 +172,8 @@ __asm volatile ( mtpr %0,%1 : /* No output */ - : g (val), g (reg)); + : g (val), g (reg) + : memory); } static inline register_t
CVS commit: [netbsd-5] src/sys/arch/vax/vax
Module Name:src Committed By: snj Date: Sat Apr 11 06:32:37 UTC 2009 Modified Files: src/sys/arch/vax/vax [netbsd-5]: subr.S Log Message: Pull up following revision(s) (requested by mhitch in ticket #686): sys/arch/vax/vax/subr.S: revision 1.26 Apply patch from mhitch@: Make copyin(9) and copyout(9) work with 64KB or larger data blocks. Fixes broken pipe(2) problem mentioned in PR port-vax/41139. Ok'ed by ra...@. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/vax/vax/subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/vax/vax/subr.S diff -u src/sys/arch/vax/vax/subr.S:1.25 src/sys/arch/vax/vax/subr.S:1.25.4.1 --- src/sys/arch/vax/vax/subr.S:1.25 Fri Aug 29 18:25:02 2008 +++ src/sys/arch/vax/vax/subr.S Sat Apr 11 06:32:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: subr.S,v 1.25 2008/08/29 18:25:02 matt Exp $ */ +/* $NetBSD: subr.S,v 1.25.4.1 2009/04/11 06:32:37 snj Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -440,7 +440,7 @@ # ENTRY(copyout, 0) - movl 8(%ap),%r2 + movl 8(%ap),%r3 blss 3f # kernel space movl 4(%ap),%r1 brb 2f @@ -448,13 +448,18 @@ ENTRY(copyin, 0) movl 4(%ap),%r1 blss 3f # kernel space - movl 8(%ap),%r2 -2: mfpr $PR_ESP,%r3 - movab 1f,(%r3) - movc3 12(%ap),(%r1),(%r2) -1: mfpr $PR_ESP,%r3 - clrl (%r3) + movl 8(%ap),%r3 +2: mfpr $PR_ESP,%r2 + movab 1f,(%r2) +4: tstw 14(%ap) # check if = 64K + bneq 5f + movc3 12(%ap),(%r1),(%r3) +1: mfpr $PR_ESP,%r2 + clrl (%r2) ret +5: movc3 $0xfffc,(%r1),(%r3) + subl2 $0xfffc,12(%ap) + brb 4b 3: mnegl $1,%r0 ret