CVS commit: src/sys/arch/sh3
Module Name:src Committed By: nonaka Date: Thu Apr 30 05:20:31 UTC 2009 Modified Files: src/sys/arch/sh3/dev: adc.c src/sys/arch/sh3/sh3: cache_sh3.c interrupt.c Log Message: Support SH7706 To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sh3/dev/adc.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/sh3/cache_sh3.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sh3/sh3/interrupt.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/sh3/dev/adc.c diff -u src/sys/arch/sh3/dev/adc.c:1.11 src/sys/arch/sh3/dev/adc.c:1.12 --- src/sys/arch/sh3/dev/adc.c:1.11 Sun Apr 5 00:22:27 2009 +++ src/sys/arch/sh3/dev/adc.c Thu Apr 30 05:20:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: adc.c,v 1.11 2009/04/05 00:22:27 uwe Exp $ */ +/* $NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $ */ /* * Copyright (c) 2003 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.11 2009/04/05 00:22:27 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $"); #include #include @@ -58,7 +58,8 @@ /* REMINDER: also in 7727 and 7729 */ if ((cpu_product != CPU_PRODUCT_7709) - && (cpu_product != CPU_PRODUCT_7709A)) + && (cpu_product != CPU_PRODUCT_7709A) + && (cpu_product != CPU_PRODUCT_7706)) return (0); if (strcmp(cf->cf_name, "adc") != 0) Index: src/sys/arch/sh3/sh3/cache_sh3.c diff -u src/sys/arch/sh3/sh3/cache_sh3.c:1.14 src/sys/arch/sh3/sh3/cache_sh3.c:1.15 --- src/sys/arch/sh3/sh3/cache_sh3.c:1.14 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/sh3/cache_sh3.c Thu Apr 30 05:20:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh3.c,v 1.14 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: cache_sh3.c,v 1.15 2009/04/30 05:20:30 nonaka Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache_sh3.c,v 1.14 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache_sh3.c,v 1.15 2009/04/30 05:20:30 nonaka Exp $"); #include "opt_cache.h" @@ -77,6 +77,8 @@ cache_size = 8 * 1024; break; case CPU_PRODUCT_7709A: + /* FALLTHROUGH */ + case CPU_PRODUCT_7706: cache_size = 16 * 1024; break; } Index: src/sys/arch/sh3/sh3/interrupt.c diff -u src/sys/arch/sh3/sh3/interrupt.c:1.27 src/sys/arch/sh3/sh3/interrupt.c:1.28 --- src/sys/arch/sh3/sh3/interrupt.c:1.27 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/sh3/interrupt.c Thu Apr 30 05:20:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.27 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: interrupt.c,v 1.28 2009/04/30 05:20:30 nonaka Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.27 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.28 2009/04/30 05:20:30 nonaka Exp $"); #include #include @@ -76,6 +76,7 @@ #ifdef SH3 case CPU_PRODUCT_7709: case CPU_PRODUCT_7709A: + case CPU_PRODUCT_7706: _reg_write_2(SH7709_IPRC, 0); _reg_write_2(SH7709_IPRD, 0); _reg_write_2(SH7709_IPRE, 0); @@ -215,7 +216,7 @@ * int intc_intr_priority(int evtcode, int level) * Setup interrupt priority register. * SH7708, SH7708S, SH7708R, SH7750, SH7750S ... evtcode is INTEVT - * SH7709, SH7709A ... evtcode is INTEVT2 + * SH7709, SH7709A, SH7706 ... evtcode is INTEVT2 */ static void intc_intr_priority(int evtcode, int level) @@ -391,7 +392,9 @@ { printf("INTEVT=0x%x", _reg_read_4(SH_(INTEVT))); - if (cpu_product == CPU_PRODUCT_7709 || cpu_product == CPU_PRODUCT_7709A) + if (cpu_product == CPU_PRODUCT_7709 || + cpu_product == CPU_PRODUCT_7709A || + cpu_product == CPU_PRODUCT_7706) printf(" INTEVT2=0x%x", _reg_read_4(SH7709_INTEVT2)); printf("\n");
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: uwe Date: Fri Jan 28 21:06:09 UTC 2011 Modified Files: src/sys/arch/sh3/include: ptrace.h userret.h src/sys/arch/sh3/sh3: db_interface.c exception.c exception_vector.S process_machdep.c sh3_machdep.c Log Message: Implement PT_STEP. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/include/ptrace.h cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/include/userret.h cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sh3/sh3/db_interface.c \ src/sys/arch/sh3/sh3/exception.c cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sh3/sh3/exception_vector.S cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sh3/sh3/process_machdep.c cvs rdiff -u -r1.89 -r1.90 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/include/ptrace.h diff -u src/sys/arch/sh3/include/ptrace.h:1.8 src/sys/arch/sh3/include/ptrace.h:1.9 --- src/sys/arch/sh3/include/ptrace.h:1.8 Mon Oct 27 23:50:12 2008 +++ src/sys/arch/sh3/include/ptrace.h Fri Jan 28 21:06:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.8 2008/10/27 23:50:12 uwe Exp $ */ +/* $NetBSD: ptrace.h,v 1.9 2011/01/28 21:06:07 uwe Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -37,6 +37,8 @@ * sh3-dependent ptrace definitions */ +#define PT_STEP (PT_FIRSTMACH + 0) + /* old struct reg (now struct __reg40) that was missing r_gbr */ #define PT___GETREGS40 (PT_FIRSTMACH + 1) #define PT___SETREGS40 (PT_FIRSTMACH + 2) @@ -45,7 +47,7 @@ #define PT_SETREGS (PT_FIRSTMACH + 4) #define PT_MACHDEP_STRINGS \ - "(unused)", \ + "PT_STEP", \ "PT___GETREGS40", \ "PT___SETREGS40", \ "PT_GETREGS", \ Index: src/sys/arch/sh3/include/userret.h diff -u src/sys/arch/sh3/include/userret.h:1.10 src/sys/arch/sh3/include/userret.h:1.11 --- src/sys/arch/sh3/include/userret.h:1.10 Mon Nov 5 20:37:48 2007 +++ src/sys/arch/sh3/include/userret.h Fri Jan 28 21:06:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.10 2007/11/05 20:37:48 ad Exp $ */ +/* $NetBSD: userret.h,v 1.11 2011/01/28 21:06:07 uwe Exp $ */ /* * Copyright (c) 1992, 1993 @@ -81,12 +81,39 @@ #include +#include +#include "opt_ptrace.h" + + static __inline void userret(struct lwp *l) { /* Invoke MI userret code */ mi_userret(l); + +#ifdef PTRACE + /* Check if lwp is being PT_STEP'ed */ + if (l->l_md.md_flags & MDP_SSTEP) { + struct trapframe *tf = l->l_md.md_regs; + + /* + * Channel A is set up for single stepping in sh_cpu_init(). + * Before RTE we write tf_ubc to BBRA and tf_spc to BARA. + */ +#ifdef SH3 + if (CPU_IS_SH3) { + tf->tf_ubc = UBC_CYCLE_INSN | UBC_CYCLE_READ +| SH3_UBC_CYCLE_CPU; + } +#endif +#ifdef SH4 + if (CPU_IS_SH4) { + tf->tf_ubc = UBC_CYCLE_INSN | UBC_CYCLE_READ; + } +#endif + } +#endif /* PTRACE */ } #endif /* !_SH3_USERRET_H_ */ Index: src/sys/arch/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.60 src/sys/arch/sh3/sh3/db_interface.c:1.61 --- src/sys/arch/sh3/sh3/db_interface.c:1.60 Wed Jan 26 18:43:30 2011 +++ src/sys/arch/sh3/sh3/db_interface.c Fri Jan 28 21:06:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.60 2011/01/26 18:43:30 uwe Exp $ */ +/* $NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.60 2011/01/26 18:43:30 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -227,35 +227,21 @@ db_set_single_step(db_regs_t *regs) { - _reg_write_2(SH_(BBRA), 0); /* disable break */ - + /* + * Channel A is set up for single stepping in sh_cpu_init(). + * Before RTE we write tf_ubc to BBRA and tf_spc to BARA. + */ #ifdef SH3 if (CPU_IS_SH3) { - /* A: compare all address bits */ - _reg_write_4(SH3_BAMRA, 0x); - - /* A: break after execution, ignore ASID */ - _reg_write_4(SH3_BRCR, (UBC_CTL_A_AFTER_INSN - | SH3_UBC_CTL_A_MASK_ASID)); - - /* will be written to BBRA before RTE */ regs->tf_ubc = UBC_CYCLE_INSN | UBC_CYCLE_READ | SH3_UBC_CYCLE_CPU; } -#endif /* SH3 */ - +#endif #ifdef SH4 if (CPU_IS_SH4) { - /* A: compare all address bits, ignore ASID */ - _reg_write_1(SH4_BAMRA, SH4_UBC_MASK_NONE | SH4_UBC_MASK_ASID); - - /* A: break after execution */ - _reg_write_2(SH4_BRCR, UBC_CTL_A_AFTER_INSN); - - /* will be written to BBRA before RTE */ regs->tf_ubc = UBC_CYCLE_INSN | UBC_CYCLE_READ; } -#endif /* SH4 */ +#endif } void Index: src/sys/arch/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.60 src/sys/arch/sh3/sh3/exception.c:1.61 --- src/sys/arch/sh3/sh3/exception.c:1.60 Thu Jan 27 01:01:55 2011 +++ src/sys/arch/sh3/sh3/exception.c Fri Jan 28 21:06:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: uwe Date: Fri Feb 4 03:23:33 UTC 2011 Modified Files: src/sys/arch/sh3/include: locore.h src/sys/arch/sh3/sh3: exception_vector.S Log Message: __EXCEPTION_ENTRY - "tst" already does logical AND, so shave off extra "mov" and "and" and just test PSL_MD bit directly. While here - shuffle around instructions to construct PSL_MD to break dependencies. While still here - only interrupt vector uses SSR and SPC as function args, so don't bother saving them here in r4 and r5. Other vectors don't need them and interrupt vector can just as well "stc" them directly before exceptions are enabled. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sh3/include/locore.h cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sh3/sh3/exception_vector.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/sh3/include/locore.h diff -u src/sys/arch/sh3/include/locore.h:1.20 src/sys/arch/sh3/include/locore.h:1.21 --- src/sys/arch/sh3/include/locore.h:1.20 Tue Jan 18 00:26:57 2011 +++ src/sys/arch/sh3/include/locore.h Fri Feb 4 03:23:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.h,v 1.20 2011/01/18 00:26:57 joerg Exp $ */ +/* $NetBSD: locore.h,v 1.21 2011/02/04 03:23:33 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -68,26 +68,24 @@ * + save all registers to trapframe. * + setup kernel stack. * + change bank from 1 to 0 - * + set BANK0 (r4, r5, r6) = (ssr, spc, ssp) + * + NB: interrupt vector "knows" that r0_bank1 = ssp */ #define __EXCEPTION_ENTRY ;\ /* Check kernel/user mode. */ ;\ mov #0x40, r3 ;\ + stc ssr, r2 /* r2 = SSR */;\ swap.b r3, r3 ;\ - stc ssr, r2 ;\ - swap.w r3, r3 /* r3 = 0x4000 */ ;\ - mov r2, r0 /* r2 = r0 = SSR */ ;\ - and r3, r0 ;\ - tst r0, r0 /* if (SSR.MD == 0) T = 1 */ ;\ mov r14, r1 ;\ - mov r6, r14 /* frame pointer */ ;\ + swap.w r3, r3 /* r3 = PSL_MD */ ;\ + mov r6, r14 /* trapframe pointer */ ;\ + tst r3, r2 /* if (SSR.MD == 0) T = 1 */ ;\ + mov.l r1, @-r14 /* save tf_r14 */ ;\ bf/s 1f /* T==0 ...Exception from kernel mode */;\ mov r15, r0 ;\ /* Exception from user mode */ ;\ mov r7, r15 /* change to kernel stack */ ;\ 1: ;\ - /* Save registers */ ;\ - mov.l r1, @-r14 /* tf_r14 */;\ + /* Save remaining registers */ ;\ mov.l r0, @-r14 /* tf_r15 */;\ stc.l r0_bank,@-r14 /* tf_r0 */;\ stc.l r1_bank,@-r14 /* tf_r1 */;\ @@ -112,14 +110,12 @@ add #-8, r14 /* skip tf_ubc, tf_expevt */ ;\ mov r14, r6 /* store frame pointer */ ;\ /* Change register bank to 0 */ ;\ - shlr r3 /* r3 = 0x2000 */ ;\ + shlr r3 /* r3 = PSL_RB */ ;\ stc sr, r1 /* r1 = SR */;\ not r3, r3 ;\ and r1, r3 ;\ - ldc r3, sr /* SR.RB = 0 */;\ - /* Set up arguments. r4 = ssr, r5 = spc */ ;\ - stc r2_bank,r4 ;\ - stc spc, r5 + ldc r3, sr /* SR.RB = 0 */ + /* * __EXCEPTION_RETURN: Index: src/sys/arch/sh3/sh3/exception_vector.S diff -u src/sys/arch/sh3/sh3/exception_vector.S:1.47 src/sys/arch/sh3/sh3/exception_vector.S:1.48 --- src/sys/arch/sh3/sh3/exception_vector.S:1.47 Fri Jan 28 21:06:08 2011 +++ src/sys/arch/sh3/sh3/exception_vector.S Fri Feb 4 03:23:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: exception_vector.S,v 1.47 2011/01/28 21:06:08 uwe Exp $ */ +/* $NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ #define _ALIGN_TEXT .align 5 #include -__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.47 2011/01/28 21:06:08 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $") /* @@ -458,7 +458,10 @@ */ NENTRY(sh_vector_interrupt) __EXCEPTION_ENTRY - stc r0_bank, r6 ! ssp - 3rd arg to intc_intr() + !! arguments for intc_intr(): for struct clockframe + stc ssr, r4 + stc spc, r5 + stc r0_bank, r6 ! ssp __INTR_MASK(r0, r1) __EXCEPTION_UNBLOCK(r0, r1) ! enable exceptions for P3 access
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: dyoung Date: Wed Jul 20 21:30:13 UTC 2011 Modified Files: src/sys/arch/sh3/include: bus_funcs.h src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: Remove redundant, static inline bus_space(9) declarations from sh3/bus_funcs.h and move the non-inline definitions to sh3/sh3_machdep.c. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sh3/include/bus_funcs.h cvs rdiff -u -r1.92 -r1.93 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/include/bus_funcs.h diff -u src/sys/arch/sh3/include/bus_funcs.h:1.1 src/sys/arch/sh3/include/bus_funcs.h:1.2 --- src/sys/arch/sh3/include/bus_funcs.h:1.1 Fri Jul 1 17:10:01 2011 +++ src/sys/arch/sh3/include/bus_funcs.h Wed Jul 20 21:30:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_funcs.h,v 1.1 2011/07/01 17:10:01 dyoung Exp $ */ +/* $NetBSD: bus_funcs.h,v 1.2 2011/07/20 21:30:13 dyoung Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -64,9 +64,6 @@ #ifndef _SH3_BUS_FUNCS_H_ #define _SH3_BUS_FUNCS_H_ -int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t size, -int, bus_space_handle_t *); - #ifdef SH4_PCMCIA int shpcmcia_memio_map(bus_space_tag_t, bus_addr_t, bus_size_t size, int, bus_space_handle_t *); @@ -82,694 +79,6 @@ #endif /* - * u_intN_t bus_space_read_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset); - * - * Read a 1, 2, 4, or 8 byte quantity from bus space - * described by tag/handle/offset. - */ -static __inline uint8_t bus_space_read_1 - (bus_space_tag_t, bus_space_handle_t, bus_size_t); -static __inline uint16_t bus_space_read_2 - (bus_space_tag_t, bus_space_handle_t, bus_size_t); -static __inline uint32_t bus_space_read_4 - (bus_space_tag_t, bus_space_handle_t, bus_size_t); - -uint8_t -bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset) -{ - - return *(volatile uint8_t *)(bsh + offset); -} - -uint16_t -bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset) -{ - - return bswap16(*(volatile uint16_t *)(bsh + offset)); -} - -uint32_t -bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset) -{ - - return bswap32(*(volatile uint32_t *)(bsh + offset)); -} - -static __inline uint16_t bus_space_read_stream_2 - (bus_space_tag_t, bus_space_handle_t, bus_size_t); - -static __inline uint32_t bus_space_read_stream_4 - (bus_space_tag_t, bus_space_handle_t, bus_size_t); - -uint16_t -bus_space_read_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset) -{ - - return *(volatile uint16_t *)(bsh + offset); -} - -uint32_t -bus_space_read_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset) -{ - - return *(volatile uint32_t *)(bsh + offset); -} - -/* - * void bus_space_read_multi_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t *addr, size_t count); - * - * Read `count' 1, 2, 4, or 8 byte quantities from bus space - * described by tag/handle/offset and copy into buffer provided. - */ -static __inline void bus_space_read_multi_1(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint8_t *, bus_size_t); -static __inline void bus_space_read_multi_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t); -static __inline void bus_space_read_multi_4(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t); - -void -bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint8_t *addr, bus_size_t count) -{ - - while (count--) - *addr++ = bus_space_read_1(tag, bsh, offset); -} - -void -bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint16_t *addr, bus_size_t count) -{ - - while (count--) - *addr++ = bus_space_read_2(tag, bsh, offset); -} - -void -bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint32_t *addr, bus_size_t count) -{ - - while (count--) - *addr++ = bus_space_read_4(tag, bsh, offset); -} - -static __inline void bus_space_read_multi_stream_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t); -static __inline void bus_space_read_multi_stream_4(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t); - -void -bus_space_read_multi_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint16_t *addr, bus_size_t count) -{ - - while (count--) - *addr++ = *(volatile uint16_t *)(bsh + offset); -} - -void -bus_space_read_multi_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint32_t *addr, bus_size_t count) -{ - - while (count--) - *addr++ = *(volatile uint32_t *)(bsh + offset); -} - -/* - * int bus_space_alloc(bus_space_tag_t t, bus_addr_t r
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: dyoung Date: Mon Jul 25 16:06:58 UTC 2011 Modified Files: src/sys/arch/sh3/include: bus_funcs.h src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: Move the sh_memio_*() declarations back to sh3/include/bus_funcs.h. Should fix the mmeye build. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sh3/include/bus_funcs.h cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/include/bus_funcs.h diff -u src/sys/arch/sh3/include/bus_funcs.h:1.2 src/sys/arch/sh3/include/bus_funcs.h:1.3 --- src/sys/arch/sh3/include/bus_funcs.h:1.2 Wed Jul 20 21:30:13 2011 +++ src/sys/arch/sh3/include/bus_funcs.h Mon Jul 25 16:06:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_funcs.h,v 1.2 2011/07/20 21:30:13 dyoung Exp $ */ +/* $NetBSD: bus_funcs.h,v 1.3 2011/07/25 16:06:58 dyoung Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -78,6 +78,13 @@ bus_size_t, bus_size_t, bus_space_handle_t *); #endif +int sh_memio_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, +bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *); +void sh_memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t); +void sh_memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); +int sh_memio_subregion(bus_space_tag_t, bus_space_handle_t, +bus_size_t, bus_size_t, bus_space_handle_t *); + /* * Bus read/write barrier methods. * Index: src/sys/arch/sh3/sh3/sh3_machdep.c diff -u src/sys/arch/sh3/sh3/sh3_machdep.c:1.94 src/sys/arch/sh3/sh3/sh3_machdep.c:1.95 --- src/sys/arch/sh3/sh3/sh3_machdep.c:1.94 Mon Jul 25 16:02:25 2011 +++ src/sys/arch/sh3/sh3/sh3_machdep.c Mon Jul 25 16:06:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sh3_machdep.c,v 1.94 2011/07/25 16:02:25 dyoung Exp $ */ +/* $NetBSD: sh3_machdep.c,v 1.95 2011/07/25 16:06:58 dyoung Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.94 2011/07/25 16:02:25 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.95 2011/07/25 16:06:58 dyoung Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -708,8 +708,6 @@ * * Allocate a region of bus space. */ -int sh_memio_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, -bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *); #define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \ sh_memio_alloc((t), (rs), (re), (s), (a), (b), (f), (ap), (hp)) @@ -720,7 +718,6 @@ * * Free a region of bus space. */ -void sh_memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t); #define bus_space_free(t, h, s) \ sh_memio_free((t), (h), (s)) @@ -731,7 +728,6 @@ * * Unmap a region of bus space. */ -void sh_memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); #define bus_space_unmap(t, h, s) \ sh_memio_unmap((t), (h), (s)) @@ -743,8 +739,6 @@ * * Get a new handle for a subregion of an already-mapped area of bus space. */ -int sh_memio_subregion(bus_space_tag_t, bus_space_handle_t, -bus_size_t, bus_size_t, bus_space_handle_t *); #define bus_space_subregion(t, h, o, s, nhp)\ sh_memio_subregion((t), (h), (o), (s), (nhp))
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: christos Date: Sat Sep 3 09:07:54 UTC 2016 Modified Files: src/sys/arch/sh3/include: pmap.h vmparam.h src/sys/arch/sh3/sh3: pmap.c Log Message: Fix pmap_prefer for topdown and turn topdown on. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sh3/include/pmap.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/include/vmparam.h cvs rdiff -u -r1.77 -r1.78 src/sys/arch/sh3/sh3/pmap.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/sh3/include/pmap.h diff -u src/sys/arch/sh3/include/pmap.h:1.35 src/sys/arch/sh3/include/pmap.h:1.36 --- src/sys/arch/sh3/include/pmap.h:1.35 Sun Nov 14 08:33:22 2010 +++ src/sys/arch/sh3/include/pmap.h Sat Sep 3 05:07:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.35 2010/11/14 13:33:22 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.36 2016/09/03 09:07:53 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -72,8 +72,8 @@ pmap_remove_all(struct pmap *pmap) * which have the virtually-indexed cache. */ #ifdef SH4 -#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va)) -void pmap_prefer(vaddr_t, vaddr_t *); +#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va), (td)) +void pmap_prefer(vaddr_t, vaddr_t *, int); #endif /* SH4 */ #define PMAP_MAP_POOLPAGE(pa) SH3_PHYS_TO_P1SEG((pa)) Index: src/sys/arch/sh3/include/vmparam.h diff -u src/sys/arch/sh3/include/vmparam.h:1.21 src/sys/arch/sh3/include/vmparam.h:1.22 --- src/sys/arch/sh3/include/vmparam.h:1.21 Sun Nov 14 08:33:22 2010 +++ src/sys/arch/sh3/include/vmparam.h Sat Sep 3 05:07:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.21 2010/11/14 13:33:22 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.22 2016/09/03 09:07:53 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,8 +31,11 @@ #ifndef _SH3_VMPARAM_H_ #define _SH3_VMPARAM_H_ + #include +#define __USE_TOPDOWN_VM + /* * We use 4K pages on the sh3/sh4. Override the PAGE_* definitions * to be compile-time constants. @@ -51,7 +54,7 @@ /* top of stack */ #define USRSTACK VM_MAXUSER_ADDRESS -/* Virtual memory resoruce limit. */ +/* Virtual memory resource limit. */ #define MAXTSIZ (64 * 1024 * 1024) /* max text size */ #ifndef MAXDSIZ #define MAXDSIZ (512 * 1024 * 1024) /* max data size */ Index: src/sys/arch/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.77 src/sys/arch/sh3/sh3/pmap.c:1.78 --- src/sys/arch/sh3/sh3/pmap.c:1.77 Fri Nov 12 02:59:27 2010 +++ src/sys/arch/sh3/sh3/pmap.c Sat Sep 3 05:07:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.77 2010/11/12 07:59:27 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.78 2016/09/03 09:07:54 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2010/11/12 07:59:27 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2016/09/03 09:07:54 christos Exp $"); #include #include @@ -904,15 +904,21 @@ pmap_phys_address(paddr_t cookie) * a virtual cache alias against vaddr_t foff. */ void -pmap_prefer(vaddr_t foff, vaddr_t *vap) +pmap_prefer(vaddr_t foff, vaddr_t *vap, int td) { - vaddr_t va; + if (!SH_HAS_VIRTUAL_ALIAS) + return; - if (SH_HAS_VIRTUAL_ALIAS) { - va = *vap; + vaddr_t va = *vap; + vsize_t d = (foff - va) & sh_cache_prefer_mask; - *vap = va + ((foff - va) & sh_cache_prefer_mask); - } + if (d == 0) + return; + + if (td) + *vap = va - ((-d) & sh_cache_prefer_mask); + else + *vap = va + d; } #endif /* SH4 */
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 16:43:44 UTC 2020 Modified Files: src/sys/arch/sh3/include: psl.h src/sys/arch/sh3/sh3: clock.c locore_subr.S mmu_sh4.c Log Message: _cpu_exception_suspend - return old SR In a typical use case we do a very short code sequence with PSL_BL set and restore the old PSL_BL value with _cpu_exception_resume that does the full read/mask/set dance. In reality we are just restoring SR to its old state as no other modifications to SR can possibly happen. So return old SR and let the caller restore it in one instruction. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sh3/include/psl.h cvs rdiff -u -r1.40 -r1.41 src/sys/arch/sh3/sh3/clock.c cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sh3/sh3/locore_subr.S cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/sh3/mmu_sh4.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/sh3/include/psl.h diff -u src/sys/arch/sh3/include/psl.h:1.11 src/sys/arch/sh3/include/psl.h:1.12 --- src/sys/arch/sh3/include/psl.h:1.11 Wed Jan 26 19:07:42 2011 +++ src/sys/arch/sh3/include/psl.h Mon Aug 3 16:43:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.11 2011/01/26 19:07:42 uwe Exp $ */ +/* $NetBSD: psl.h,v 1.12 2020/08/03 16:43:44 uwe Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -62,6 +62,12 @@ #ifdef _KERNEL #ifndef _LOCORE +static inline __always_inline void +_cpu_set_sr(uint32_t sr) +{ +__asm volatile("ldc %0, sr" :: "r"(sr)); +} + /* SR.IMASK */ int _cpu_intr_raise(int); int _cpu_intr_suspend(void); Index: src/sys/arch/sh3/sh3/clock.c diff -u src/sys/arch/sh3/sh3/clock.c:1.40 src/sys/arch/sh3/sh3/clock.c:1.41 --- src/sys/arch/sh3/sh3/clock.c:1.40 Wed Mar 18 10:22:36 2009 +++ src/sys/arch/sh3/sh3/clock.c Mon Aug 3 16:43:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.40 2009/03/18 10:22:36 cegger Exp $ */ +/* $NetBSD: clock.c,v 1.41 2020/08/03 16:43:44 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.40 2009/03/18 10:22:36 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.41 2020/08/03 16:43:44 uwe Exp $"); #include "opt_pclock.h" #include "opt_hz.h" @@ -111,7 +111,7 @@ do { \ void sh_clock_init(int flags) { - uint32_t s, t0, cnt_1s; + uint32_t sr, t0, cnt_1s; sh_clock.flags = flags; @@ -143,12 +143,12 @@ sh_clock_init(int flags) _reg_bset_1(SH_(RCR2), SH_RCR2_ENABLE); } - s = _cpu_exception_suspend(); + sr = _cpu_exception_suspend(); _cpu_spin(1); /* load function on cache. */ TMU_START(0); _cpu_spin(1000); t0 = TMU_ELAPSED(0); - _cpu_exception_resume(s); + _cpu_set_sr(sr); sh_clock.cpucycle_1us = (sh_clock.tmuclk * 10) / t0; @@ -166,14 +166,14 @@ sh_clock_init(int flags) /* set TMU channel 1 source to PCLOCK / 4 */ _reg_write_2(SH_(TCR1), TCR_TPSC_P4); - s = _cpu_exception_suspend(); + sr = _cpu_exception_suspend(); _cpu_spin(1); /* load function on cache. */ TMU_START(0); TMU_START(1); _cpu_spin(cnt_1s); /* 1 sec. */ t0 = TMU_ELAPSED(0); t1 = TMU_ELAPSED(1); - _cpu_exception_resume(s); + _cpu_set_sr(sr); sh_clock.pclock = ((uint64_t)t1 * 4 * SH_RTC_CLOCK + t0/2) / t0; Index: src/sys/arch/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.59 src/sys/arch/sh3/sh3/locore_subr.S:1.60 --- src/sys/arch/sh3/sh3/locore_subr.S:1.59 Mon Aug 3 03:34:11 2020 +++ src/sys/arch/sh3/sh3/locore_subr.S Mon Aug 3 16:43:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.59 2020/08/03 03:34:11 uwe Exp $ */ +/* $NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.59 2020/08/03 03:34:11 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $") /* @@ -305,8 +305,8 @@ NENTRY(_cpu_exception_suspend) swap.w r1, r1 /* r1 = PSL_BL */ or r1, r2 /* r2 |= PSL_BL */ ldc r2, sr /* SR = r2 */ - rts - and r1, r0 /* r0 &= 0x1000 */ + rts /* return old SR */ + nop SET_ENTRY_SIZE(_cpu_exception_suspend) Index: src/sys/arch/sh3/sh3/mmu_sh4.c diff -u src/sys/arch/sh3/sh3/mmu_sh4.c:1.14 src/sys/arch/sh3/sh3/mmu_sh4.c:1.15 --- src/sys/arch/sh3/sh3/mmu_sh4.c:1.14 Sun Feb 12 16:34:10 2012 +++ src/sys/arch/sh3/sh3/mmu_sh4.c Mon Aug 3 16:43:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mmu_sh4.c,v 1.14 2012/02/12 16:34:10 matt Exp $ */ +/* $NetBSD: mmu_sh4.c,v 1.15 2020/08/03 16:43:44 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.14 2012/02/12 16:34:10 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.15 2020/08/03 16:43:44 uwe Exp $"); #in
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 21:53:25 UTC 2020 Modified Files: src/sys/arch/sh3/include: cpu.h src/sys/arch/sh3/sh3: db_interface.c Log Message: SH3_P2SEG_FUNC(f) - get a P2 address of a function. Just SH3_P1SEG_TO_P2SEG + cast, but we now define SH3_P1SEG_TO_P2SEG and SH3_P2SEG_TO_P1SEG to use arithmetic, not bitwise ops. That gives the same result for the correct P1/P2 input values, but addition can be done at link time with addends. Thus SH3_P2SEG_FUNC compiles to a constant P2 address. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sh3/include/cpu.h cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sh3/sh3/db_interface.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/sh3/include/cpu.h diff -u src/sys/arch/sh3/include/cpu.h:1.59 src/sys/arch/sh3/include/cpu.h:1.60 --- src/sys/arch/sh3/include/cpu.h:1.59 Sun Dec 1 15:34:45 2019 +++ src/sys/arch/sh3/include/cpu.h Mon Aug 3 21:53:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.59 2019/12/01 15:34:45 ad Exp $ */ +/* $NetBSD: cpu.h,v 1.60 2020/08/03 21:53:25 uwe Exp $ */ /*- * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved. @@ -151,8 +151,14 @@ do { \ #define SH3_P2SEG_TO_PHYS(x) ((uint32_t)(x) & SH3_PHYS_MASK) #define SH3_PHYS_TO_P1SEG(x) ((uint32_t)(x) | SH3_P1SEG_BASE) #define SH3_PHYS_TO_P2SEG(x) ((uint32_t)(x) | SH3_P2SEG_BASE) -#define SH3_P1SEG_TO_P2SEG(x) ((uint32_t)(x) | 0x2000) -#define SH3_P2SEG_TO_P1SEG(x) ((uint32_t)(x) & ~0x2000) +#define SH3_P1SEG_TO_P2SEG(x) ((uint32_t)(x) + 0x2000u) +#define SH3_P2SEG_TO_P1SEG(x) ((uint32_t)(x) - 0x2000u) + +#ifdef __GNUC__ +#define SH3_P2SEG_FUNC(f) ((__typeof__(f) *)SH3_P1SEG_TO_P2SEG(f)) +#else +#define SH3_P2SEG_FUNC(f) ((void *)SH3_P1SEG_TO_P2SEG(f)) +#endif #ifndef __lint__ Index: src/sys/arch/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.64 src/sys/arch/sh3/sh3/db_interface.c:1.65 --- src/sys/arch/sh3/sh3/db_interface.c:1.64 Mon Aug 3 01:56:18 2020 +++ src/sys/arch/sh3/sh3/db_interface.c Mon Aug 3 21:53:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.64 2020/08/03 01:56:18 uwe Exp $ */ +/* $NetBSD: db_interface.c,v 1.65 2020/08/03 21:53:25 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64 2020/08/03 01:56:18 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.65 2020/08/03 21:53:25 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -331,8 +331,8 @@ db_tlbdump_cmd(db_expr_t addr, bool have void (*get_utlb_p2)(uint32_t, uint32_t *, uint32_t *, uint32_t *); uint32_t aa, da1, da2; - get_itlb_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_get_itlb_sh4); - get_utlb_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_get_utlb_sh4); + get_itlb_p2 = SH3_P2SEG_FUNC(__db_get_itlb_sh4); + get_utlb_p2 = SH3_P2SEG_FUNC(__db_get_utlb_sh4); /* MMU configuration */ r = _reg_read_4(SH4_MMUCR); @@ -478,11 +478,11 @@ db_cachedump_cmd(db_expr_t addr, bool ha #ifdef SH3 if (CPU_IS_SH3) - cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh3); + cachedump_p2 = SH3_P2SEG_FUNC(__db_cachedump_sh3); #endif #ifdef SH4 if (CPU_IS_SH4) - cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh4); + cachedump_p2 = SH3_P2SEG_FUNC(__db_cachedump_sh4); #endif (*cachedump_p2)(have_addr ? addr : 0); }
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: ad Date: Sun Dec 1 12:19:28 UTC 2019 Modified Files: src/sys/arch/sh3/include: userret.h src/sys/arch/sh3/sh3: exception.c exception_vector.S Log Message: sh3: make ASTs work as expected, and fix a few things in the TLB refill path. With help from uwe@ and martin@. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/include/userret.h cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sh3/sh3/exception.c cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sh3/sh3/exception_vector.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/sh3/include/userret.h diff -u src/sys/arch/sh3/include/userret.h:1.16 src/sys/arch/sh3/include/userret.h:1.17 --- src/sys/arch/sh3/include/userret.h:1.16 Sat Nov 30 15:53:36 2019 +++ src/sys/arch/sh3/include/userret.h Sun Dec 1 12:19:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.16 2019/11/30 15:53:36 ad Exp $ */ +/* $NetBSD: userret.h,v 1.17 2019/12/01 12:19:28 ad Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,6 +51,14 @@ static __inline void userret(struct lwp *l) { + /* This must come first... */ + l->l_md.md_astpending = 0; + + if (l->l_pflag & LP_OWEUPC) { + l->l_pflag &= ~LP_OWEUPC; + ADDUPROF(l); + } + /* Invoke MI userret code */ mi_userret(l); Index: src/sys/arch/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.70 src/sys/arch/sh3/sh3/exception.c:1.71 --- src/sys/arch/sh3/sh3/exception.c:1.70 Sat Nov 30 15:53:36 2019 +++ src/sys/arch/sh3/sh3/exception.c Sun Dec 1 12:19:28 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $ */ +/* $NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $ */ /*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. + * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: exception.c, #include #include #include +#include #ifdef DDB #include @@ -295,12 +296,9 @@ tlb_exception(struct lwp *l, struct trap }\ } while(/*CONSTCOND*/0) - splx(tf->tf_ssr & PSL_IMASK); - usermode = !KERNELMODE(tf->tf_ssr); if (usermode) { KDASSERT(l->l_md.md_regs == tf); - LWP_CACHE_CREDS(l, l->l_proc); } else { #if 0 /* FIXME: probably wrong for yamt-idlelwp */ KDASSERT(l == NULL || /* idle */ @@ -330,6 +328,8 @@ tlb_exception(struct lwp *l, struct trap ksi.ksi_signo = SIGSEGV; ksi.ksi_code = SEGV_ACCERR; ksi.ksi_addr = (void *)va; + splx(tf->tf_ssr & PSL_IMASK); + LWP_CACHE_CREDS(l, l->l_proc); goto user_fault; } else { TLB_ASSERT(l && onfault != NULL, @@ -372,12 +372,12 @@ tlb_exception(struct lwp *l, struct trap /* Lookup page table. if entry found, load it. */ if (track && __pmap_pte_load(pmap, va, track)) { - if (usermode) - userret(l); return; } /* Page not found. call fault handler */ + splx(tf->tf_ssr & PSL_IMASK); + LWP_CACHE_CREDS(l, l->l_proc); pcb->pcb_onfault = NULL; err = uvm_fault(map, va, ftype); pcb->pcb_onfault = onfault; @@ -399,10 +399,21 @@ tlb_exception(struct lwp *l, struct trap /* Page in. load PTE to TLB. */ if (err == 0) { - bool loaded = __pmap_pte_load(pmap, va, track); + bool loaded; + userret(l); + loaded = __pmap_pte_load(pmap, va, track); +#if 0 + /* + * XXXAD I don't think you should do this - consider + * a multithreaded program where another thread got + * switched to during UVM fault and it unmapped the + * page. I think you should just let the fault happen + * again. + */ TLB_ASSERT(loaded, "page table entry not found"); - if (usermode) - userret(l); +#else + __USE(loaded); +#endif return; } @@ -441,7 +452,6 @@ tlb_exception(struct lwp *l, struct trap ksi.ksi_trap = tf->tf_expevt; trapsignal(l, &ksi); userret(l); - ast(l, tf); return; tlb_panic: @@ -459,27 +469,29 @@ tlb_exception(struct lwp *l, struct trap * tf ... full user context. * This is called when exception return. if return from kernel to user, * handle asynchronous software traps and context switch if needed. + * Interrupts are blocked on entry. */ void ast(struct lwp *l, struct trapframe *tf) { + int s; - if (KERNELMODE(tf->tf_ssr)) { + if (__predict_true(l->l_md.md_astpending == 0)) { + return; + } + if (__predict_false(KERNELMODE(tf->tf_ssr))) { + /* should not occur but leave it here to be safe */ return; } KDASSERT(l != NULL); KDASSERT(l->l_md.md_regs == tf); - while (l->l_md.md_astpending) { - //curcpu()->ci_data.cpu_nast++; - l->
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: thorpej Date: Sat Nov 21 17:25:52 UTC 2020 Modified Files: src/sys/arch/sh3/dev: sci.c scif.c Log Message: malloc(9) -> kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sh3/dev/sci.c cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sh3/dev/scif.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/sh3/dev/sci.c diff -u src/sys/arch/sh3/dev/sci.c:1.62 src/sys/arch/sh3/dev/sci.c:1.63 --- src/sys/arch/sh3/dev/sci.c:1.62 Sun Nov 10 21:16:32 2019 +++ src/sys/arch/sh3/dev/sci.c Sat Nov 21 17:25:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $ */ +/* $NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.62 #include #include #include -#include +#include #include #include @@ -416,7 +416,7 @@ sci_attach(device_t parent, device_t sel tp->t_hwiflow = NULL; sc->sc_tty = tp; - sc->sc_rbuf = malloc(sci_rbuf_size << 1, M_DEVBUF, M_WAITOK); + sc->sc_rbuf = kmem_alloc(sci_rbuf_size << 1, KM_SLEEP); sc->sc_ebuf = sc->sc_rbuf + (sci_rbuf_size << 1); tty_attach(tp); Index: src/sys/arch/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.67 src/sys/arch/sh3/dev/scif.c:1.68 --- src/sys/arch/sh3/dev/scif.c:1.67 Sun Nov 10 21:16:32 2019 +++ src/sys/arch/sh3/dev/scif.c Sat Nov 21 17:25:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $ */ +/* $NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.6 #include #include #include -#include +#include #include #include #include @@ -497,7 +497,7 @@ scif_attach(device_t parent, device_t se tp->t_hwiflow = NULL; sc->sc_tty = tp; - sc->sc_rbuf = malloc(scif_rbuf_size << 1, M_DEVBUF, M_WAITOK); + sc->sc_rbuf = kmem_alloc(scif_rbuf_size << 1, KM_SLEEP); sc->sc_ebuf = sc->sc_rbuf + (scif_rbuf_size << 1); tty_attach(tp);
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: mrg Date: Mon Sep 14 05:04:05 UTC 2020 Modified Files: src/sys/arch/sh3/include: ptrace.h Log Message: apply some parens to make macros safe. fixes GCC 9 sanitizer issues. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/ptrace.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/sh3/include/ptrace.h diff -u src/sys/arch/sh3/include/ptrace.h:1.17 src/sys/arch/sh3/include/ptrace.h:1.18 --- src/sys/arch/sh3/include/ptrace.h:1.17 Tue Dec 24 14:50:59 2019 +++ src/sys/arch/sh3/include/ptrace.h Mon Sep 14 05:04:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.17 2019/12/24 14:50:59 kamil Exp $ */ +/* $NetBSD: ptrace.h,v 1.18 2020/09/14 05:04:05 mrg Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -66,11 +66,11 @@ "PT_CLEARSTEP" #include -#define PTRACE_REG_PC(r) r->r_spc -#define PTRACE_REG_FP(r) r->r_r14 -#define PTRACE_REG_SET_PC(r, v) r->r_spc = (v) -#define PTRACE_REG_SP(r) r->r_r15 -#define PTRACE_REG_INTV(r) r->r_r0 +#define PTRACE_REG_PC(r) (r)->r_spc +#define PTRACE_REG_FP(r) (r)->r_r14 +#define PTRACE_REG_SET_PC(r, v) (r)->r_spc = (v) +#define PTRACE_REG_SP(r) (r)->r_r15 +#define PTRACE_REG_INTV(r) (r)->r_r0 #define PTRACE_ILLEGAL_ASM __asm __volatile ("0: bra 0b; bra 0b" : : : "memory")
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: martin Date: Thu Oct 15 18:58:59 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: process_machdep.c Log Message: Add missing 'error' declaration To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sh3/sh3/process_machdep.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/sh3/sh3/process_machdep.c diff -u src/sys/arch/sh3/sh3/process_machdep.c:1.23 src/sys/arch/sh3/sh3/process_machdep.c:1.24 --- src/sys/arch/sh3/sh3/process_machdep.c:1.23 Thu Oct 15 17:37:36 2020 +++ src/sys/arch/sh3/sh3/process_machdep.c Thu Oct 15 18:58:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.23 2020/10/15 17:37:36 mgorny Exp $ */ +/* $NetBSD: process_machdep.c,v 1.24 2020/10/15 18:58:59 martin Exp $ */ /* * Copyright (c) 1993 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.23 2020/10/15 17:37:36 mgorny Exp $"); +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.24 2020/10/15 18:58:59 martin Exp $"); #include #include @@ -188,7 +188,7 @@ ptrace_machdep_dorequest(struct lwp *l, { struct uio uio; struct iovec iov; - int write = 0; + int write = 0, error; switch (req) { default:
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Thu Jul 15 04:58:33 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S Log Message: For cpu_switchto(), inherit PSL_IMASK field of SR between lwp's. Otherwise, IPL is lost during context switch, which allows improper interrupts when, e.g., spin mutexes are hold. With this fix, full ATF is successfully completed on DIAGNOSTIC kernel (with one KASSERT in uvm_map.c, which triggers kern/51254, converted to printf). Thanks uwe@ for review and suggesting optimization. Also thanks ad@ for useful comment, and ryo@ for giving me reference manuals of SH-4! To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.60 src/sys/arch/sh3/sh3/locore_subr.S:1.61 --- src/sys/arch/sh3/sh3/locore_subr.S:1.60 Mon Aug 3 16:43:44 2020 +++ src/sys/arch/sh3/sh3/locore_subr.S Thu Jul 15 04:58:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $ */ +/* $NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $") /* @@ -140,7 +140,22 @@ ENTRY(cpu_switchto) mov r10, r1 ! &nlwp->l_md.md_pcb->pcb_sf mov r9, r0 ! return olwp (we are about to clobber r9) ldc.l @r1+, gbr - ldc.l @r1+, sr + + /* + * We cannot simply pop SR here; PSL_IMASK field should be + * inherited to nlwp. Otherwise, IPL is lost during context + * switch, which allows improper interrupts when, e.g., + * spin mutexes are hold. + */ + mov.l @r1+, r8 ! r8 = new SR + mov #0x78, r9 + shll r9 ! r9 = PSL_IMASK + not r9, r10 ! r10 = ~PSL_IMASK + and r9, r11 ! r11 = old SR & PSL_IMASK + and r10, r8 + or r11, r8 + ldc r8, sr + lds.l @r1+, pr mov.l @r1+, r8 mov.l @r1+, r9
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: andvar Date: Mon Jul 26 21:43:11 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: exception_vector.S pmap.c Log Message: Revert rename back to OFSET, since the name follows historical PGOFSET definition. Noted by tsutsui. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sh3/sh3/exception_vector.S cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/exception_vector.S diff -u src/sys/arch/sh3/sh3/exception_vector.S:1.52 src/sys/arch/sh3/sh3/exception_vector.S:1.53 --- src/sys/arch/sh3/sh3/exception_vector.S:1.52 Sat Jul 24 21:31:35 2021 +++ src/sys/arch/sh3/sh3/exception_vector.S Mon Jul 26 21:43:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: exception_vector.S,v 1.52 2021/07/24 21:31:35 andvar Exp $ */ +/* $NetBSD: exception_vector.S,v 1.53 2021/07/26 21:43:11 andvar Exp $ */ /*- * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ #define _ALIGN_TEXT .align 5 #include -__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.52 2021/07/24 21:31:35 andvar Exp $") +__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.53 2021/07/26 21:43:11 andvar Exp $") /* @@ -220,7 +220,7 @@ NENTRY(sh3_vector_tlbmiss) bt/s .L3_call_tlb_exception mov #-(PGSHIFT - 2), r1 - !! __PMAP_PTP_OFFSET(vpn) - except we pre-shift 2 bits left to + !! __PMAP_PTP_OFSET(vpn) - except we pre-shift 2 bits left to !! get the array offset directly, as we know bits 10 and 11 !! are zero (we cleaned them in r5 to get 4K aligned VPN) shld r1, r2 ! vpn >> (PGSHIFT - 2) Index: src/sys/arch/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.84 src/sys/arch/sh3/sh3/pmap.c:1.85 --- src/sys/arch/sh3/sh3/pmap.c:1.84 Sat Jul 24 21:31:35 2021 +++ src/sys/arch/sh3/sh3/pmap.c Mon Jul 26 21:43:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.84 2021/07/24 21:31:35 andvar Exp $ */ +/* $NetBSD: pmap.c,v 1.85 2021/07/26 21:43:11 andvar Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.84 2021/07/24 21:31:35 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.85 2021/07/26 21:43:11 andvar Exp $"); #include #include @@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.8 (((va) + (1 << __PMAP_PTP_SHIFT) - 1) & ~((1 << __PMAP_PTP_SHIFT) - 1)) #define __PMAP_PTP_PG_N (PAGE_SIZE / sizeof(pt_entry_t)) #define __PMAP_PTP_INDEX(va) (((va) >> __PMAP_PTP_SHIFT) & (__PMAP_PTP_N - 1)) -#define __PMAP_PTP_OFFSET(va) ((va >> PGSHIFT) & (__PMAP_PTP_PG_N - 1)) +#define __PMAP_PTP_OFSET(va) ((va >> PGSHIFT) & (__PMAP_PTP_PG_N - 1)) struct pmap __pmap_kernel; struct pmap *const kernel_pmap_ptr = &__pmap_kernel; @@ -966,7 +966,7 @@ __pmap_pte_alloc(pmap_t pmap, vaddr_t va ptp = (pt_entry_t *)SH3_PHYS_TO_P1SEG(VM_PAGE_TO_PHYS(pg)); pmap->pm_ptp[__PMAP_PTP_INDEX(va)] = ptp; - return (ptp + __PMAP_PTP_OFFSET(va)); + return (ptp + __PMAP_PTP_OFSET(va)); } /* @@ -986,7 +986,7 @@ __pmap_pte_lookup(pmap_t pmap, vaddr_t v if (ptp == NULL) return (NULL); - return (ptp + __PMAP_PTP_OFFSET(va)); + return (ptp + __PMAP_PTP_OFSET(va)); } /* @@ -1002,7 +1002,7 @@ __pmap_kpte_lookup(vaddr_t va) if (ptp == NULL) return NULL; - return (ptp + __PMAP_PTP_OFFSET(va)); + return (ptp + __PMAP_PTP_OFSET(va)); } /*
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Tue Oct 13 12:55:53 UTC 2009 Modified Files: src/sys/arch/sh3/include: lock.h Log Message: Fix inline asm for tas.b. "=m" is not restrictive enough and gcc may decide to use addressing modes that tas.b does not support. 'V' is advertised to be "non-offsettable" subset of 'm' but there's a bug in gcc that prevents "=V" from working. When in doubt use brute force, so pass lock pointer as "r" input and declare "memory" as clobbered. Landisk kernel diff is 5 instructions (register choice for lock address in __cpu_simple_lock_try). sys/dev/raidframe/rf_copyback.c - where old __asm triggered incorrect code - successfully compiles (as part of sys/rump/dev/lib/libraidframe). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/lock.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/sh3/include/lock.h diff -u src/sys/arch/sh3/include/lock.h:1.15 src/sys/arch/sh3/include/lock.h:1.16 --- src/sys/arch/sh3/include/lock.h:1.15 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/lock.h Tue Oct 13 12:55:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lock.h,v 1.15 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: lock.h,v 1.16 2009/10/13 12:55:53 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -81,11 +81,11 @@ { __asm volatile( - "1: tas.b %0 \n" + "1: tas.b @%0 \n" " bf 1b \n" - : "=m" (*alp) - : /* no inputs */ - : "cc"); + : /* no outputs */ + : "r" (alp) + : "cc", "memory"); } static __inline int @@ -94,11 +94,11 @@ int __rv; __asm volatile( - " tas.b %0 \n" - " movt %1 \n" - : "=m" (*alp), "=r" (__rv) - : /* no inputs */ - : "cc"); + " tas.b @%1 \n" + " movt %0 \n" + : "=r" (__rv) + : "r" (alp) + : "cc", "memory"); return (__rv); }
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Mon Mar 15 11:27:38 UTC 2010 Modified Files: src/sys/arch/sh3/include: bus.h Log Message: Sync with : constify source arg of bus_space_write* &co, fix size_t vs. bus_size_t confusion. Makes mmeye kernel build again. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/bus.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/sh3/include/bus.h diff -u src/sys/arch/sh3/include/bus.h:1.17 src/sys/arch/sh3/include/bus.h:1.18 --- src/sys/arch/sh3/include/bus.h:1.17 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/bus.h Mon Mar 15 11:27:38 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.h,v 1.17 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: bus.h,v 1.18 2010/03/15 11:27:38 uwe Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -549,15 +549,15 @@ * provided to bus space described by tag/handle/offset. */ static __inline void bus_space_write_multi_1(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint8_t *, bus_size_t); +bus_space_handle_t, bus_size_t, const uint8_t *, bus_size_t); static __inline void bus_space_write_multi_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t); +bus_space_handle_t, bus_size_t, const uint16_t *, bus_size_t); static __inline void bus_space_write_multi_4(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t); +bus_space_handle_t, bus_size_t, const uint32_t *, bus_size_t); void bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint8_t *addr, bus_size_t count) +bus_size_t offset, const uint8_t *addr, bus_size_t count) { while (count--) @@ -566,7 +566,7 @@ void bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint16_t *addr, bus_size_t count) +bus_size_t offset, const uint16_t *addr, bus_size_t count) { while (count--) @@ -575,7 +575,7 @@ void bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint32_t *addr, bus_size_t count) +bus_size_t offset, const uint32_t *addr, bus_size_t count) { while (count--) @@ -583,13 +583,13 @@ } static __inline void bus_space_write_multi_stream_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t); +bus_space_handle_t, bus_size_t, const uint16_t *, bus_size_t); static __inline void bus_space_write_multi_stream_4(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t); +bus_space_handle_t, bus_size_t, const uint32_t *, bus_size_t); void bus_space_write_multi_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint16_t *addr, bus_size_t count) +bus_size_t offset, const uint16_t *addr, bus_size_t count) { while (count--) @@ -598,7 +598,7 @@ void bus_space_write_multi_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint32_t *addr, bus_size_t count) +bus_size_t offset, const uint32_t *addr, bus_size_t count) { while (count--) @@ -614,15 +614,15 @@ * by tag/handle/offset `count' times. */ static __inline void bus_space_set_multi_1(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint8_t, bus_size_t); +bus_space_handle_t, bus_size_t, uint8_t, size_t); static __inline void bus_space_set_multi_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t, bus_size_t); +bus_space_handle_t, bus_size_t, uint16_t, size_t); static __inline void bus_space_set_multi_4(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint32_t, bus_size_t); +bus_space_handle_t, bus_size_t, uint32_t, size_t); void bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint8_t val, bus_size_t count) +bus_size_t offset, uint8_t val, size_t count) { while (count--) @@ -631,7 +631,7 @@ void bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint16_t val, bus_size_t count) +bus_size_t offset, uint16_t val, size_t count) { while (count--) @@ -640,7 +640,7 @@ void bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, -bus_size_t offset, uint32_t val, bus_size_t count) +bus_size_t offset, uint32_t val, size_t count) { while (count--) @@ -656,15 +656,15 @@ * by tag/handle starting at `offset'. */ static __inline void bus_space_set_region_1(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint8_t, bus_size_t); +bus_space_handle_t, bus_size_t, uint8_t, size_t); static __inline void bus_space_set_region_2(bus_space_tag_t, -bus_space_handle_t, bus_size_t, uint16_t, bus_size_t); +bus_space_handle_t, bus_size_t, uint16_t, size_t); static __inline void bus_space_set_region_4(bus_space_tag_t, -bus_space_handle_t, bus_size
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: chs Date: Sun Aug 8 16:23:40 UTC 2010 Modified Files: src/sys/arch/sh3/dev: adc.c Log Message: make this compile with DIAGNOSTIC. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/dev/adc.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/sh3/dev/adc.c diff -u src/sys/arch/sh3/dev/adc.c:1.12 src/sys/arch/sh3/dev/adc.c:1.13 --- src/sys/arch/sh3/dev/adc.c:1.12 Thu Apr 30 05:20:30 2009 +++ src/sys/arch/sh3/dev/adc.c Sun Aug 8 16:23:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $ */ +/* $NetBSD: adc.c,v 1.13 2010/08/08 16:23:40 chs Exp $ */ /* * Copyright (c) 2003 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.13 2010/08/08 16:23:40 chs Exp $"); #include #include @@ -141,11 +141,11 @@ csr = ADC_(CSR); if ((csr & SH7709_ADCSR_ADST) != 0) { /* another conversion is in progress?! */ - snprintb(bits, sizeof(buts), SH7709_ADCSR_BITS, csr); + snprintb(bits, sizeof(bits), SH7709_ADCSR_BITS, csr); printf("adc_sample_channel(%d): CSR=%s", chan, bits); cr = ADC_(CR); cr &= ~0x07; /* three lower bits always read as 1s */ - snprintb(bits, sizeof(buts), SH7709_ADCR_BITS, cr); + snprintb(bits, sizeof(bits), SH7709_ADCR_BITS, cr); printf(", CR=%s\n", bits); return (-1); }
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: uwe Date: Sun Apr 5 00:26:00 UTC 2009 Modified Files: src/sys/arch/sh3/dev: shb.c Log Message: Register null hooks with pmf(9) for now, which is no worse than before and allows us to test other things. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sh3/dev/shb.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/sh3/dev/shb.c diff -u src/sys/arch/sh3/dev/shb.c:1.13 src/sys/arch/sh3/dev/shb.c:1.14 --- src/sys/arch/sh3/dev/shb.c:1.13 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/dev/shb.c Sun Apr 5 00:25:59 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: shb.c,v 1.13 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: shb.c,v 1.14 2009/04/05 00:25:59 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: shb.c,v 1.13 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: shb.c,v 1.14 2009/04/05 00:25:59 uwe Exp $"); #include #include @@ -65,6 +65,13 @@ aprint_normal("\n"); config_search_ia(shb_search, self, "shb", NULL); + + /* + * XXX: TODO: provide hooks to manage on-chip modules. For + * now register null hooks which is no worse than before. + */ + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "unable to establish power handler\n"); } static int
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sun Apr 5 00:04:52 UTC 2009 Modified Files: src/sys/arch/sh3/sh3: cpu.c Log Message: Register with pmf(9), tell it we don't need anything. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sh3/sh3/cpu.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/sh3/sh3/cpu.c diff -u src/sys/arch/sh3/sh3/cpu.c:1.13 src/sys/arch/sh3/sh3/cpu.c:1.14 --- src/sys/arch/sh3/sh3/cpu.c:1.13 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/sh3/cpu.c Sun Apr 5 00:04:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.13 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: cpu.c,v 1.14 2009/04/05 00:04:51 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.13 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14 2009/04/05 00:04:51 uwe Exp $"); #include #include @@ -77,4 +77,7 @@ sh_cache_information(); sh_mmu_information(); + + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "unable to establish power handler\n"); }
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: uwe Date: Sun Apr 5 00:22:28 UTC 2009 Modified Files: src/sys/arch/sh3/dev: adc.c Log Message: Register null hooks with pmf(9) for now, which is no worse than before and allows us to test other things. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/dev/adc.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/sh3/dev/adc.c diff -u src/sys/arch/sh3/dev/adc.c:1.10 src/sys/arch/sh3/dev/adc.c:1.11 --- src/sys/arch/sh3/dev/adc.c:1.10 Tue Dec 16 22:35:25 2008 +++ src/sys/arch/sh3/dev/adc.c Sun Apr 5 00:22:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: adc.c,v 1.10 2008/12/16 22:35:25 christos Exp $ */ +/* $NetBSD: adc.c,v 1.11 2009/04/05 00:22:27 uwe Exp $ */ /* * Copyright (c) 2003 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.10 2008/12/16 22:35:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adc.c,v 1.11 2009/04/05 00:22:27 uwe Exp $"); #include #include @@ -79,6 +79,15 @@ aprint_normal("\n"); config_search_ia(adc_search, self, "adc", NULL); + + /* + * XXX: TODO: provide hooks to manage power. For now register + * null hooks which is no worse than before. + * + * NB: ADC registers are reset by standby! + */ + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "unable to establish power handler\n"); }
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: uwe Date: Sun Apr 5 00:17:57 UTC 2009 Modified Files: src/sys/arch/sh3/dev: rtc.c Log Message: Register with pmf(9), tell it we don't need anything. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sh3/dev/rtc.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/sh3/dev/rtc.c diff -u src/sys/arch/sh3/dev/rtc.c:1.6 src/sys/arch/sh3/dev/rtc.c:1.7 --- src/sys/arch/sh3/dev/rtc.c:1.6 Tue Dec 16 22:35:25 2008 +++ src/sys/arch/sh3/dev/rtc.c Sun Apr 5 00:17:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.6 2008/12/16 22:35:25 christos Exp $ */ +/* $NetBSD: rtc.c,v 1.7 2009/04/05 00:17:56 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.6 2008/12/16 22:35:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.7 2009/04/05 00:17:56 uwe Exp $"); #include #include @@ -127,6 +127,9 @@ rtc_gettime_ymdhms(&sc->sc_todr, &dt); } #endif + + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "unable to establish power handler\n"); }
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: uwe Date: Sun Apr 5 00:22:53 UTC 2009 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: Register null hooks with pmf(9) for now, which is no worse than before and allows us to test other things. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.58 src/sys/arch/sh3/dev/scif.c:1.59 --- src/sys/arch/sh3/dev/scif.c:1.58 Wed Mar 18 10:22:36 2009 +++ src/sys/arch/sh3/dev/scif.c Sun Apr 5 00:22:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.58 2009/03/18 10:22:36 cegger Exp $ */ +/* $NetBSD: scif.c,v 1.59 2009/04/05 00:22:53 uwe Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.58 2009/03/18 10:22:36 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.59 2009/04/05 00:22:53 uwe Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -494,6 +494,10 @@ sc->sc_ebuf = sc->sc_rbuf + (scif_rbuf_size << 1); tty_attach(tp); + + /* XXX: TODO */ + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "unable to establish power handler\n"); } /*
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: nonaka Date: Tue Apr 21 12:57:41 UTC 2009 Modified Files: src/sys/arch/sh3/include: cputypes.h Log Message: Add SH7706 To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sh3/include/cputypes.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/sh3/include/cputypes.h diff -u src/sys/arch/sh3/include/cputypes.h:1.11 src/sys/arch/sh3/include/cputypes.h:1.12 --- src/sys/arch/sh3/include/cputypes.h:1.11 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/cputypes.h Tue Apr 21 12:57:41 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cputypes.h,v 1.11 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: cputypes.h,v 1.12 2009/04/21 12:57:41 nonaka Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -48,13 +48,14 @@ #define CPU_PRODUCT_7708R 3 #define CPU_PRODUCT_7709 4 #define CPU_PRODUCT_7709A 5 +#define CPU_PRODUCT_7706 6 /* SH4 series */ -#define CPU_PRODUCT_7750 6 -#define CPU_PRODUCT_7750S 7 -#define CPU_PRODUCT_7750R 8 -#define CPU_PRODUCT_7751 9 -#define CPU_PRODUCT_7751R 10 +#define CPU_PRODUCT_7750 7 +#define CPU_PRODUCT_7750S 8 +#define CPU_PRODUCT_7750R 9 +#define CPU_PRODUCT_7751 10 +#define CPU_PRODUCT_7751R 11 #ifndef _LOCORE
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: nonaka Date: Thu Apr 30 05:19:38 UTC 2009 Modified Files: src/sys/arch/sh3/include: scireg.h Log Message: Added some register definition. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/include/scireg.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/sh3/include/scireg.h diff -u src/sys/arch/sh3/include/scireg.h:1.8 src/sys/arch/sh3/include/scireg.h:1.9 --- src/sys/arch/sh3/include/scireg.h:1.8 Tue Jul 1 11:49:37 2003 +++ src/sys/arch/sh3/include/scireg.h Thu Apr 30 05:19:38 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: scireg.h,v 1.8 2003/07/01 11:49:37 uwe Exp $ */ +/* $NetBSD: scireg.h,v 1.9 2009/04/30 05:19:38 nonaka Exp $ */ /*- * Copyright (C) 1999 SAITOH Masanobu. All rights reserved. @@ -43,6 +43,7 @@ #define SHREG_SCTDR (*(volatile unsigned char *) 0xFE86) #define SHREG_SCSSR (*(volatile unsigned char *) 0xFE88) #define SHREG_SCRDR (*(volatile unsigned char *) 0xFE8A) +#define SHREG_SCSCMR (*(volatile unsigned char *) 0xFE8C) #define SHREG_SCSPDR (*(volatile unsigned char *) 0xf4000136) #else @@ -59,6 +60,15 @@ #endif +#define SCSMR_CA 0x80 +#define SCSMR_CHR 0x40 +#define SCSMR_PE 0x20 +#define SCSMR_OE 0x10 +#define SCSMR_STOP 0x08 +#define SCSMR_MP 0x04 +#define SCSMR_CKS1 0x02 +#define SCSMR_CKS0 0x01 + #define SCSCR_TIE 0x80 /* Transmit Interrupt Enable */ #define SCSCR_RIE 0x40 /* Receive Interrupt Enable */ #define SCSCR_TE 0x20 /* Transmit Enable */ @@ -73,6 +83,9 @@ #define SCSSR_ORER 0x20 #define SCSSR_FER 0x10 #define SCSSR_PER 0x08 +#define SCSSR_TEND 0x04 +#define SCSSR_MPB 0x02 +#define SCSSR_MPBT 0x01 #define SCSPTR_SPB1IO 0x08 #define SCSPTR_SPB1DT 0x04
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: nonaka Date: Sat May 16 10:11:50 UTC 2009 Modified Files: src/sys/arch/sh3/include: exception.h Log Message: Add SH4 INTEVT codes for GPIO. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sh3/include/exception.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/sh3/include/exception.h diff -u src/sys/arch/sh3/include/exception.h:1.11 src/sys/arch/sh3/include/exception.h:1.12 --- src/sys/arch/sh3/include/exception.h:1.11 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/exception.h Sat May 16 10:11:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.h,v 1.11 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: exception.h,v 1.12 2009/05/16 10:11:50 nonaka Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -149,6 +149,8 @@ #define SH4_INTEVT_IRQ14 0x3c0 #define SH4_INTEVT_IRQ15 0x3e0 +#define SH4_INTEVT_GPIO 0x620 + #define SH4_INTEVT_PCISERR 0xa00 #define SH4_INTEVT_PCIDMA3 0xa20 #define SH4_INTEVT_PCIDMA2 0xa40
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: nonaka Date: Sat May 16 10:13:13 UTC 2009 Modified Files: src/sys/arch/sh3/include: cache_sh3.h Log Message: Added SH7706 cache flush op. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/include/cache_sh3.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/sh3/include/cache_sh3.h diff -u src/sys/arch/sh3/include/cache_sh3.h:1.9 src/sys/arch/sh3/include/cache_sh3.h:1.10 --- src/sys/arch/sh3/include/cache_sh3.h:1.9 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/cache_sh3.h Sat May 16 10:13:13 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh3.h,v 1.9 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: cache_sh3.h,v 1.10 2009/05/16 10:13:13 nonaka Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -143,6 +143,7 @@ #define SH7709_CACHE_FLUSH() SH3_CACHE_8K_FLUSH(4) #define SH7709_CACHE_FLUSH_RAMMODE() SH3_CACHE_8K_FLUSH(2) #define SH7709A_CACHE_FLUSH() SH3_CACHE_16K_FLUSH() +#define SH7706_CACHE_FLUSH() SH3_CACHE_16K_FLUSH() #ifndef _LOCORE extern void sh3_cache_config(void);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Jun 9 00:24:51 UTC 2009 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S Log Message: Spell "handler" correctly. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.50 src/sys/arch/sh3/sh3/locore_subr.S:1.51 --- src/sys/arch/sh3/sh3/locore_subr.S:1.50 Fri Feb 13 22:41:03 2009 +++ src/sys/arch/sh3/sh3/locore_subr.S Tue Jun 9 00:24:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.50 2009/02/13 22:41:03 apb Exp $ */ +/* $NetBSD: locore_subr.S,v 1.51 2009/06/09 00:24:51 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.50 2009/02/13 22:41:03 apb Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.51 2009/06/09 00:24:51 uwe Exp $") /* @@ -460,7 +460,7 @@ cmp/hi r1, r2 /* bomb if uaddr isn't in user space */ bt 2f - mov.l .L_copyout_curpcb, r1 /* set fault hander */ + mov.l .L_copyout_curpcb, r1 /* set fault handler */ mov.l @r1, r2 mov.l .L_copyout_onfault, r1 mov.l r1, @(PCB_ONFAULT,r2) @@ -516,7 +516,7 @@ cmp/hi r1, r2 /* bomb if uaddr isn't in user space */ bt 2f - mov.l .L_copyin_curpcb, r1 /* set fault hander */ + mov.l .L_copyin_curpcb, r1 /* set fault handler */ mov.l @r1, r2 mov.l .L_copyin_onfault, r1 mov.l r1, @(PCB_ONFAULT,r2) @@ -526,7 +526,7 @@ mov #0, r0 1: - mov.l .L_copyin_curpcb, r1 /* clear fault hander */ + mov.l .L_copyin_curpcb, r1 /* clear fault handler */ mov.l @r1, r2 mov #0, r1 mov.l r1, @(PCB_ONFAULT,r2)
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Jun 9 01:35:11 UTC 2009 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S Log Message: Fix logic error in copyinstr() when deciding whether to return EFAULT or ENAMETOOLONG. >From OpenBSD revision 1.9 by miod@ To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.51 src/sys/arch/sh3/sh3/locore_subr.S:1.52 --- src/sys/arch/sh3/sh3/locore_subr.S:1.51 Tue Jun 9 00:24:51 2009 +++ src/sys/arch/sh3/sh3/locore_subr.S Tue Jun 9 01:35:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.51 2009/06/09 00:24:51 uwe Exp $ */ +/* $NetBSD: locore_subr.S,v 1.52 2009/06/09 01:35:11 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.51 2009/06/09 00:24:51 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.52 2009/06/09 01:35:11 uwe Exp $") /* @@ -670,7 +670,7 @@ cmp/eq #-1, r0 bf 1b mov.l .L_copyinstr_VM_MAXUSER_ADDRESS, r1 - cmp/hs r1, r5 + cmp/hs r1, r4 bt 3f mov #ENAMETOOLONG, r3
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Jun 9 02:38:27 UTC 2009 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: In pmap_protect(), compute the bitmask to set in the ptes only once, instead of every iteration. From OpenBSD. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.72 src/sys/arch/sh3/sh3/pmap.c:1.73 --- src/sys/arch/sh3/sh3/pmap.c:1.72 Tue Apr 21 21:30:00 2009 +++ src/sys/arch/sh3/sh3/pmap.c Tue Jun 9 02:38:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.72 2009/04/21 21:30:00 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.73 2009/06/09 02:38:27 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.72 2009/04/21 21:30:00 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2009/06/09 02:38:27 uwe Exp $"); #include #include @@ -649,7 +649,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) { bool kernel = pmap == pmap_kernel(); - pt_entry_t *pte, entry; + pt_entry_t *pte, entry, protbits; vaddr_t va; sva = trunc_page(sva); @@ -659,6 +659,22 @@ return; } + switch (prot) { + default: + panic("pmap_protect: invalid protection mode %x", prot); + /* NOTREACHED */ + case VM_PROT_READ: + /* FALLTHROUGH */ + case VM_PROT_READ | VM_PROT_EXECUTE: + protbits = kernel ? PG_PR_KRO : PG_PR_URO; + break; + case VM_PROT_READ | VM_PROT_WRITE: + /* FALLTHROUGH */ + case VM_PROT_ALL: + protbits = kernel ? PG_PR_KRW : PG_PR_URW; + break; + } + for (va = sva; va < eva; va += PAGE_SIZE) { if (((pte = __pmap_pte_lookup(pmap, va)) == NULL) || @@ -672,22 +688,7 @@ sh_dcache_wbinv_range_index(va, PAGE_SIZE); } - entry &= ~PG_PR_MASK; - switch (prot) { - default: - panic("pmap_protect: invalid protection mode %x", prot); - /* NOTREACHED */ - case VM_PROT_READ: - /* FALLTHROUGH */ - case VM_PROT_READ | VM_PROT_EXECUTE: - entry |= kernel ? PG_PR_KRO : PG_PR_URO; - break; - case VM_PROT_READ | VM_PROT_WRITE: - /* FALLTHROUGH */ - case VM_PROT_ALL: - entry |= kernel ? PG_PR_KRW : PG_PR_URW; - break; - } + entry = (entry & ~PG_PR_MASK) | protbits; *pte = entry; if (pmap->pm_asid != -1)
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uebayasi Date: Sat Oct 30 18:15:04 UTC 2010 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.74 src/sys/arch/sh3/sh3/pmap.c:1.75 --- src/sys/arch/sh3/sh3/pmap.c:1.74 Sat Nov 7 07:27:46 2009 +++ src/sys/arch/sh3/sh3/pmap.c Sat Oct 30 18:15:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $"); #include #include @@ -43,6 +43,8 @@ #include #include +#define VM_PAGE_TO_MD(pg) (&(pg)->mdpage) + #ifdef DEBUG #define STATIC #else @@ -339,7 +341,7 @@ entry |= _PG_WIRED; if (pg != NULL) { /* memory-space */ - pvh = &pg->mdpage; + pvh = VM_PAGE_TO_MD(pg); entry |= PG_C; /* always cached */ /* Seed modified/reference tracking */ @@ -483,7 +485,7 @@ * XXX mapping them uncached (like arm and mips do). */ again: - pvh = &pg->mdpage; + pvh = VM_PAGE_TO_MD(pg); SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) { if (sh_cache_indexof(va) != sh_cache_indexof(pv->pv_va)) { @@ -495,7 +497,7 @@ } /* Register pv map */ - pvh = &pg->mdpage; + pvh = VM_PAGE_TO_MD(pg); pv = __pmap_pv_alloc(); pv->pv_pmap = pmap; pv->pv_va = va; @@ -547,12 +549,12 @@ int s; s = splvm(); - pvh = &pg->mdpage; + pvh = VM_PAGE_TO_MD(pg); SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) { if (pv->pv_pmap == pmap && pv->pv_va == vaddr) { if (SH_HAS_VIRTUAL_ALIAS || (SH_HAS_WRITEBACK_CACHE && -(pg->mdpage.pvh_flags & PVH_MODIFIED))) { +(pvh->pvh_flags & PVH_MODIFIED))) { /* * Always use index ops. since I don't want to * worry about address space. @@ -699,7 +701,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { - struct vm_page_md *pvh = &pg->mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; struct pmap *pmap; vaddr_t va; @@ -789,24 +791,25 @@ bool pmap_is_referenced(struct vm_page *pg) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); - return ((pg->mdpage.pvh_flags & PVH_REFERENCED) ? true : false); + return ((pvh->pvh_flags & PVH_REFERENCED) ? true : false); } bool pmap_clear_reference(struct vm_page *pg) { - struct vm_page_md *pvh = &pg->mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; pt_entry_t *pte; pmap_t pmap; vaddr_t va; int s; - if ((pg->mdpage.pvh_flags & PVH_REFERENCED) == 0) + if ((pvh->pvh_flags & PVH_REFERENCED) == 0) return (false); - pg->mdpage.pvh_flags &= ~PVH_REFERENCED; + pvh->pvh_flags &= ~PVH_REFERENCED; s = splvm(); /* Restart reference bit emulation */ @@ -831,14 +834,15 @@ bool pmap_is_modified(struct vm_page *pg) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); - return ((pg->mdpage.pvh_flags & PVH_MODIFIED) ? true : false); + return ((pvh->pvh_flags & PVH_MODIFIED) ? true : false); } bool pmap_clear_modify(struct vm_page *pg) { - struct vm_page_md *pvh = &pg->mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; struct pmap *pmap; pt_entry_t *pte, entry; @@ -1023,12 +1027,14 @@ /* Emulate reference/modified tracking for managed page. */ if (flags != 0 && (pg = PHYS_TO_VM_PAGE(entry & PG_PPN)) != NULL) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); + if (flags & PVH_REFERENCED) { - pg->mdpage.pvh_flags |= PVH_REFERENCED; + pvh->pvh_flags |= PVH_REFERENCED; entry |= PG_V; } if (flags & PVH_MODIFIED) { - pg->mdpage.pvh_flags |= PVH_MODIFIED; + pvh->pvh_flags |= PVH_MODIFIED; entry |= PG_D; } *pte = entry;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uch Date: Thu Dec 10 13:35:32 UTC 2009 Modified Files: src/sys/arch/sh3/sh3: vm_machdep.c Log Message: u-area is no longer zero-cleared. reset here To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.65 src/sys/arch/sh3/sh3/vm_machdep.c:1.66 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.65 Sun Nov 29 04:15:43 2009 +++ src/sys/arch/sh3/sh3/vm_machdep.c Thu Dec 10 13:35:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.65 2009/11/29 04:15:43 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.65 2009/11/29 04:15:43 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $"); #include "opt_kstack_debug.h" @@ -189,6 +189,8 @@ #define P1ADDR(x) (SH3_PHYS_TO_P1SEG(*__pmap_kpte_lookup(x) & PG_PPN)) pcb = lwp_getpcb(l); + pcb->pcb_onfault = NULL; + pcb->pcb_faultbail = 0; #ifdef SH3 /* * Accessing context store space must not cause exceptions.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: matt Date: Wed Dec 22 02:41:13 UTC 2010 Modified Files: src/sys/arch/sh3/include: types.h Log Message: Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first member in struct cpu_info. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sh3/include/types.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/sh3/include/types.h diff -u src/sys/arch/sh3/include/types.h:1.29 src/sys/arch/sh3/include/types.h:1.30 --- src/sys/arch/sh3/include/types.h:1.29 Fri Dec 11 05:52:04 2009 +++ src/sys/arch/sh3/include/types.h Wed Dec 22 02:41:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.29 2009/12/11 05:52:04 matt Exp $ */ +/* $NetBSD: types.h,v 1.30 2010/12/22 02:41:12 matt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -71,6 +71,7 @@ #define __HAVE_AST_PERPROC #define __HAVE_SYSCALL_INTERN +#define __HAVE_CPU_DATA_FIRST #if defined(_KERNEL) #define __HAVE_RAS
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: nisimura Date: Wed Dec 29 13:43:58 UTC 2010 Modified Files: src/sys/arch/sh3/sh3: exception.c vm_machdep.c Log Message: use lwp_getpcb() to hide the detail about how struct pcb is populated. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sh3/sh3/exception.c cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.56 src/sys/arch/sh3/sh3/exception.c:1.57 --- src/sys/arch/sh3/sh3/exception.c:1.56 Mon Dec 20 00:25:43 2010 +++ src/sys/arch/sh3/sh3/exception.c Wed Dec 29 13:43:58 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.56 2010/12/20 00:25:43 matt Exp $ */ +/* $NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.56 2010/12/20 00:25:43 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -139,6 +139,7 @@ { int expevt = tf->tf_expevt; bool usermode = !KERNELMODE(tf->tf_ssr); + struct pcb *pcb; ksiginfo_t ksi; uint32_t trapcode; #ifdef DDB @@ -191,8 +192,9 @@ case EXPEVT_ADDR_ERR_LD: /* FALLTHROUGH */ case EXPEVT_ADDR_ERR_ST: - KDASSERT(l->l_md.md_pcb->pcb_onfault != NULL); - tf->tf_spc = (int)l->l_md.md_pcb->pcb_onfault; + pcb = lwp_getpcb(l); + KDASSERT(pcb->pcb_onfault != NULL); + tf->tf_spc = (int)pcb->pcb_onfault; tf->tf_r0 = EFAULT; if (tf->tf_spc == 0) goto do_panic; Index: src/sys/arch/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.67 src/sys/arch/sh3/sh3/vm_machdep.c:1.68 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.67 Fri Apr 23 19:18:10 2010 +++ src/sys/arch/sh3/sh3/vm_machdep.c Wed Dec 29 13:43:58 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.68 2010/12/29 13:43:58 nisimura Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.68 2010/12/29 13:43:58 nisimura Exp $"); #include "opt_kstack_debug.h" @@ -134,6 +134,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, void (*func)(void *), void *arg) { + struct pcb *pcb; struct switchframe *sf; #if 0 /* FIXME: probably wrong for yamt-idlelwp */ @@ -151,7 +152,8 @@ l2->l_md.md_regs->tf_r15 = (u_int)stack + stacksize; /* When l2 is switched to, jump to the trampoline */ - sf = &l2->l_md.md_pcb->pcb_sf; + pcb = lwp_getpcb(l2); + sf = &pcb->pcb_sf; sf->sf_pr = (int)lwp_trampoline; sf->sf_r10 = (int)l2; /* "new" lwp for lwp_startup() */ sf->sf_r11 = (int)arg; /* hook function/argument */ @@ -166,14 +168,14 @@ void cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg) { - struct switchframe *sf; + struct pcb *pcb = lwp_getpcb(l); + struct switchframe *sf = &pcb->pcb_sf; sh3_setup_uarea(l); l->l_md.md_regs->tf_ssr = PSL_USERSET; /* When lwp is switched to, jump to the trampoline */ - sf = &l->l_md.md_pcb->pcb_sf; sf->sf_pr = (int)lwp_setfunc_trampoline; sf->sf_r11 = (int)arg; /* hook function/argument */ sf->sf_r12 = (int)func;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: nisimura Date: Wed Dec 29 13:49:32 UTC 2010 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: one more line for lwp_getpcb() conversion. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.57 src/sys/arch/sh3/sh3/exception.c:1.58 --- src/sys/arch/sh3/sh3/exception.c:1.57 Wed Dec 29 13:43:58 2010 +++ src/sys/arch/sh3/sh3/exception.c Wed Dec 29 13:49:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $ */ +/* $NetBSD: exception.c,v 1.58 2010/12/29 13:49:32 nisimura Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.58 2010/12/29 13:49:32 nisimura Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -282,7 +282,7 @@ int err, track, ftype; const char *panic_msg; - pcb = &l->l_addr->u_pcb; + pcb = lwp_getpcb(l); onfault = pcb->pcb_onfault; #define TLB_ASSERT(assert, msg)\
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: joerg Date: Tue Jan 18 00:26:58 UTC 2011 Modified Files: src/sys/arch/sh3/include: locore.h Log Message: Allow co-existance of traditional and modern CPP To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sh3/include/locore.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/sh3/include/locore.h diff -u src/sys/arch/sh3/include/locore.h:1.19 src/sys/arch/sh3/include/locore.h:1.20 --- src/sys/arch/sh3/include/locore.h:1.19 Sun Jun 1 00:46:01 2008 +++ src/sys/arch/sh3/include/locore.h Tue Jan 18 00:26:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.h,v 1.19 2008/06/01 00:46:01 uwe Exp $ */ +/* $NetBSD: locore.h,v 1.20 2011/01/18 00:26:57 joerg Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -28,6 +28,21 @@ #ifdef _LOCORE +#ifdef __STDC__ +#if defined(SH3) && defined(SH4) +#define MOV(x, r) mov.l .L_ ## x, r; mov.l @r, r +#define REG_SYMBOL(x) .L_ ## x: .long _C_LABEL(__sh_ ## x) +#define FUNC_SYMBOL(x) .L_ ## x: .long _C_LABEL(__sh_ ## x) +#elif defined(SH3) +#define MOV(x, r) mov.l .L_ ## x, r +#define REG_SYMBOL(x) .L_ ## x: .long SH3_ ## x +#define FUNC_SYMBOL(x) .L_ ## x: .long _C_LABEL(sh3_ ## x) +#elif defined(SH4) +#define MOV(x, r) mov.l .L_ ## x, r +#define REG_SYMBOL(x) .L_ ## x: .long SH4_ ## x +#define FUNC_SYMBOL(x) .L_ ## x: .long _C_LABEL(sh4_ ## x) +#endif /* SH3 && SH4 */ +#else /* !__STDC__ */ #if defined(SH3) && defined(SH4) #define MOV(x, r) mov.l .L_/**/x, r; mov.l @r, r #define REG_SYMBOL(x) .L_/**/x: .long _C_LABEL(__sh_/**/x) @@ -41,6 +56,7 @@ #define REG_SYMBOL(x) .L_/**/x: .long SH4_/**/x #define FUNC_SYMBOL(x) .L_/**/x: .long _C_LABEL(sh4_/**/x) #endif /* SH3 && SH4 */ +#endif /* __STDC__ */ /* * BANK1 r6 contains current trapframe pointer.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Wed Jan 26 18:43:30 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: db_interface.c Log Message: BRCR and BAMRA have different format in sh3 and sh4, so there's no point in using SH_() wrapper to refer to them in code that is already model-specific. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sh3/sh3/db_interface.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/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.59 src/sys/arch/sh3/sh3/db_interface.c:1.60 --- src/sys/arch/sh3/sh3/db_interface.c:1.59 Sat Nov 21 17:40:28 2009 +++ src/sys/arch/sh3/sh3/db_interface.c Wed Jan 26 18:43:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.59 2009/11/21 17:40:28 rmind Exp $ */ +/* $NetBSD: db_interface.c,v 1.60 2011/01/26 18:43:30 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.59 2009/11/21 17:40:28 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.60 2011/01/26 18:43:30 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -232,10 +232,10 @@ #ifdef SH3 if (CPU_IS_SH3) { /* A: compare all address bits */ - _reg_write_4(SH_(BAMRA), 0x); + _reg_write_4(SH3_BAMRA, 0x); /* A: break after execution, ignore ASID */ - _reg_write_4(SH_(BRCR), (UBC_CTL_A_AFTER_INSN + _reg_write_4(SH3_BRCR, (UBC_CTL_A_AFTER_INSN | SH3_UBC_CTL_A_MASK_ASID)); /* will be written to BBRA before RTE */ @@ -247,10 +247,10 @@ #ifdef SH4 if (CPU_IS_SH4) { /* A: compare all address bits, ignore ASID */ - _reg_write_1(SH_(BAMRA), SH4_UBC_MASK_NONE | SH4_UBC_MASK_ASID); + _reg_write_1(SH4_BAMRA, SH4_UBC_MASK_NONE | SH4_UBC_MASK_ASID); /* A: break after execution */ - _reg_write_2(SH_(BRCR), UBC_CTL_A_AFTER_INSN); + _reg_write_2(SH4_BRCR, UBC_CTL_A_AFTER_INSN); /* will be written to BBRA before RTE */ regs->tf_ubc = UBC_CYCLE_INSN | UBC_CYCLE_READ;
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Wed Jan 26 19:07:43 UTC 2011 Modified Files: src/sys/arch/sh3/include: psl.h Log Message: Add sh4 PSL_FD - FPU disable bit. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/include/psl.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/sh3/include/psl.h diff -u src/sys/arch/sh3/include/psl.h:1.10 src/sys/arch/sh3/include/psl.h:1.11 --- src/sys/arch/sh3/include/psl.h:1.10 Fri Jan 4 20:10:12 2008 +++ src/sys/arch/sh3/include/psl.h Wed Jan 26 19:07:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.10 2008/01/04 20:10:12 uwe Exp $ */ +/* $NetBSD: psl.h,v 1.11 2011/01/26 19:07:42 uwe Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -45,6 +45,7 @@ #define PSL_IMASK 0x00f0 /* Interrupt Mask bit */ #define PSL_QBIT 0x0100 /* Q bit */ #define PSL_MBIT 0x0200 /* M bit */ +#define PSL_FD 0x8000 /* FPU Disable bit */ #define PSL_BL 0x1000 /* Exception Block bit */ #define PSL_RB 0x2000 /* Register Bank bit */ #define PSL_MD 0x4000 /* Processor Mode bit */
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Wed Jan 26 23:26:37 UTC 2011 Modified Files: src/sys/arch/sh3/include: proc.h Log Message: Add MDP_SSTEP flag. Not used yet. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/proc.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/sh3/include/proc.h diff -u src/sys/arch/sh3/include/proc.h:1.15 src/sys/arch/sh3/include/proc.h:1.16 --- src/sys/arch/sh3/include/proc.h:1.15 Fri Jan 14 02:06:30 2011 +++ src/sys/arch/sh3/include/proc.h Wed Jan 26 23:26:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.15 2011/01/14 02:06:30 rmind Exp $ */ +/* $NetBSD: proc.h,v 1.16 2011/01/26 23:26:37 uwe Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -58,6 +58,7 @@ /* md_flags */ #define MDP_USEDFPU 0x0001 /* has used the FPU */ +#define MDP_SSTEP 0x0002 /* single-stepped with PT_STEP */ struct lwp;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Wed Jan 26 23:29:17 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: Clear MDP_SSTEP in setregs(). To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/sh3/sh3_machdep.c diff -u src/sys/arch/sh3/sh3/sh3_machdep.c:1.88 src/sys/arch/sh3/sh3/sh3_machdep.c:1.89 --- src/sys/arch/sh3/sh3/sh3_machdep.c:1.88 Fri Jan 14 02:06:31 2011 +++ src/sys/arch/sh3/sh3/sh3_machdep.c Wed Jan 26 23:29:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sh3_machdep.c,v 1.88 2011/01/14 02:06:31 rmind Exp $ */ +/* $NetBSD: sh3_machdep.c,v 1.89 2011/01/26 23:29:16 uwe Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.88 2011/01/14 02:06:31 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.89 2011/01/26 23:29:16 uwe Exp $"); #include "opt_kgdb.h" #include "opt_memsize.h" @@ -511,7 +511,7 @@ { struct trapframe *tf; - l->l_md.md_flags &= ~MDP_USEDFPU; + l->l_md.md_flags &= ~(MDP_USEDFPU | MDP_SSTEP); tf = l->l_md.md_regs;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Thu Jan 27 00:19:27 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: core_machdep.c Log Message: Include only headers that are actually used. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sh3/sh3/core_machdep.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/sh3/sh3/core_machdep.c diff -u src/sys/arch/sh3/sh3/core_machdep.c:1.3 src/sys/arch/sh3/sh3/core_machdep.c:1.4 --- src/sys/arch/sh3/sh3/core_machdep.c:1.3 Sat Nov 21 17:40:28 2009 +++ src/sys/arch/sh3/sh3/core_machdep.c Thu Jan 27 00:19:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: core_machdep.c,v 1.3 2009/11/21 17:40:28 rmind Exp $ */ +/* $NetBSD: core_machdep.c,v 1.4 2011/01/27 00:19:27 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,30 +81,17 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.3 2009/11/21 17:40:28 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.4 2011/01/27 00:19:27 uwe Exp $"); #include #include #include -#include -#include -#include #include #include #include -#include -#include -#include - -#include - -#include -#include #include -#include -#include -#include + /* * Dump the machine specific segment at the start of a core dump.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Thu Jan 27 01:01:56 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: general_exception: when printing current mode in the panic message, test "usermode" directly instead of testing for EXP_USER bit. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.59 src/sys/arch/sh3/sh3/exception.c:1.60 --- src/sys/arch/sh3/sh3/exception.c:1.59 Fri Jan 14 02:06:30 2011 +++ src/sys/arch/sh3/sh3/exception.c Thu Jan 27 01:01:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.59 2011/01/14 02:06:30 rmind Exp $ */ +/* $NetBSD: exception.c,v 1.60 2011/01/27 01:01:55 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.59 2011/01/14 02:06:30 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.60 2011/01/27 01:01:55 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -257,7 +257,7 @@ printf("fatal %s", exp_type[expevt >> 5]); else printf("EXPEVT 0x%03x", expevt); - printf(" in %s mode\n", expevt & EXP_USER ? "user" : "kernel"); + printf(" in %s mode\n", usermode ? "user" : "kernel"); printf(" spc %x ssr %x \n", tf->tf_spc, tf->tf_ssr); panic("general_exception");
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Feb 1 01:54:14 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S vm_machdep.c Log Message: cpu_setfunc() must use lwp_trampoline to arrange for the recycled lwp to go through lwp_startup() the first time it's switched to. This makes NetBSD-4.x SA binaries work on current. Tested with dig(1) in NetBSD-4.x chroot on landisk. Looks like this mistake of mine was picked up and replicated in several other ports, sorry. Reported by chuck@ in PR kern/44500 To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/sh3/sh3/locore_subr.S cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.53 src/sys/arch/sh3/sh3/locore_subr.S:1.54 --- src/sys/arch/sh3/sh3/locore_subr.S:1.53 Sat Mar 20 23:31:30 2010 +++ src/sys/arch/sh3/sh3/locore_subr.S Tue Feb 1 01:54:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.53 2010/03/20 23:31:30 chs Exp $ */ +/* $NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.53 2010/03/20 23:31:30 chs Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $") /* @@ -388,7 +388,6 @@ mov r0, r4 /* previous lwp returned by cpu_switchto */ jsr @r1 mov r10, r5 /* my struct lwp */ -ALTENTRY(lwp_setfunc_trampoline) jsr @r12 mov r11, r4 __EXCEPTION_RETURN Index: src/sys/arch/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.69 src/sys/arch/sh3/sh3/vm_machdep.c:1.70 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.69 Fri Jan 14 02:06:31 2011 +++ src/sys/arch/sh3/sh3/vm_machdep.c Tue Feb 1 01:54:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.69 2011/01/14 02:06:31 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.70 2011/02/01 01:54:14 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.69 2011/01/14 02:06:31 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.70 2011/02/01 01:54:14 uwe Exp $"); #include "opt_kstack_debug.h" @@ -107,7 +107,6 @@ #include extern void lwp_trampoline(void); -extern void lwp_setfunc_trampoline(void); static void sh3_setup_uarea(struct lwp *); @@ -176,7 +175,8 @@ l->l_md.md_regs->tf_ssr = PSL_USERSET; /* When lwp is switched to, jump to the trampoline */ - sf->sf_pr = (int)lwp_setfunc_trampoline; + sf->sf_pr = (int)lwp_trampoline; + sf->sf_r10 = (int)l; /* "new" lwp for lwp_startup() */ sf->sf_r11 = (int)arg; /* hook function/argument */ sf->sf_r12 = (int)func; }
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Fri Feb 4 04:13:52 UTC 2011 Modified Files: src/sys/arch/sh3/include: locore.h Log Message: Since __INTR_MASK + __EXCEPTION_UNBLOCK is common sequence, provide __INTR_MASK_EXCEPTION_UNBLOCK combo version that does stc/ldc just once. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/include/locore.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/sh3/include/locore.h diff -u src/sys/arch/sh3/include/locore.h:1.21 src/sys/arch/sh3/include/locore.h:1.22 --- src/sys/arch/sh3/include/locore.h:1.21 Fri Feb 4 03:23:33 2011 +++ src/sys/arch/sh3/include/locore.h Fri Feb 4 04:13:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.h,v 1.21 2011/02/04 03:23:33 uwe Exp $ */ +/* $NetBSD: locore.h,v 1.22 2011/02/04 04:13:52 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -201,6 +201,23 @@ and Rn, Rm ;\ ldc Rm, sr /* unmask all interrupts */ + +/* + * Since __INTR_MASK + __EXCEPTION_UNBLOCK is common sequence, provide + * this combo version that does stc/ldc just once. + */ +#define __INTR_MASK_EXCEPTION_UNBLOCK(Rs, Ri, Rb) \ + mov #0x78, Ri /* 0xf0 >> 1 */;\ + mov #0xef, Rb /* ~0x10 */;\ + shll Ri /* Ri = PSL_IMASK */ ;\ + swap.b Rb, Rb ;\ + stc sr, Rs ;\ + swap.w Rb, Rb /* Rb = ~PSL_BL */ ;\ + or Ri, Rs /* SR |= PSL_IMASK */ ;\ + and Rb, Rs /* SR &= ~PSL_BL */ ;\ + ldc Rs, sr + + #else /* !_LOCORE */ void sh3_switch_setup(struct lwp *);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Fri Feb 4 04:14:25 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: exception_vector.S Log Message: Use __INTR_MASK_EXCEPTION_UNBLOCK combo. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sh3/sh3/exception_vector.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/sh3/sh3/exception_vector.S diff -u src/sys/arch/sh3/sh3/exception_vector.S:1.48 src/sys/arch/sh3/sh3/exception_vector.S:1.49 --- src/sys/arch/sh3/sh3/exception_vector.S:1.48 Fri Feb 4 03:23:33 2011 +++ src/sys/arch/sh3/sh3/exception_vector.S Fri Feb 4 04:14:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $ */ +/* $NetBSD: exception_vector.S,v 1.49 2011/02/04 04:14:25 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ #define _ALIGN_TEXT .align 5 #include -__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: exception_vector.S,v 1.49 2011/02/04 04:14:25 uwe Exp $") /* @@ -73,7 +73,6 @@ */ NENTRY(sh_vector_generic) __EXCEPTION_ENTRY - __INTR_MASK(r0, r1) /* Identify exception cause */ MOV (EXPEVT, r0) mov.l @r0, r0 @@ -90,7 +89,7 @@ bt 1f /* tlb_exception(curlwp, tf, TEA); */ - __EXCEPTION_UNBLOCK(r0, r1) + __INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3) mov.l .Lg_tlb_exception, r0 jsr @r0 mov r14, r5 /* 2nd arg */ @@ -105,7 +104,7 @@ mov.l r2, @(TF_UBC, r14) /* clear tf->tf_ubc */ mov.w r2, @r1 /* disable UBC channel A */ #endif - __EXCEPTION_UNBLOCK(r0, r1) + __INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3) mov.l .Lg_general_exception, r0 jsr @r0 mov r14, r5 /* 2nd arg */ @@ -270,8 +269,7 @@ mov.l @r2, r2 ! *SH3_EXPEVT mov.l @r0, r6 ! arg3: va = *SH3_TEA mov.l @r1, r4 ! arg1: curlwp - __INTR_MASK(r0, r1) - __EXCEPTION_UNBLOCK(r0, r1) + __INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3) mov.l .L3_tlb_exception, r0 mov.l r2, @(TF_EXPEVT, r14) ! tf->tf_expevt = EXPEVT jsr @r0 @@ -421,8 +419,7 @@ mov.l @(0x24, r0), r2 ! *SH4_EXPEVT mov.l @(0x0c, r0), r6 ! arg3: va = *SH4_TEA mov.l @r1, r4 ! arg1: curlwp - __INTR_MASK(r0, r1) - __EXCEPTION_UNBLOCK(r0, r1) + __INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3) mov.l .L4_tlb_exception, r0 mov.l r2, @(TF_EXPEVT, r14) ! tf->tf_expevt = EXPEVT jsr @r0 @@ -462,9 +459,7 @@ stc ssr, r4 stc spc, r5 stc r0_bank, r6 ! ssp - - __INTR_MASK(r0, r1) - __EXCEPTION_UNBLOCK(r0, r1) ! enable exceptions for P3 access + __INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3) mov.l .Li_ci_idepth, r8 ! callee-saved mov.l .Li_intc_intr, r0
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: tsutsui Date: Wed Dec 12 13:32:37 UTC 2012 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: Fix one more device/softc split error: - set sc->sc_dev properly To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sh3/dev/sci.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/sh3/dev/sci.c diff -u src/sys/arch/sh3/dev/sci.c:1.56 src/sys/arch/sh3/dev/sci.c:1.57 --- src/sys/arch/sh3/dev/sci.c:1.56 Mon Oct 29 12:51:38 2012 +++ src/sys/arch/sh3/dev/sci.c Wed Dec 12 13:32:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.56 2012/10/29 12:51:38 chs Exp $ */ +/* $NetBSD: sci.c,v 1.57 2012/12/12 13:32:37 tsutsui Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.56 2012/10/29 12:51:38 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.57 2012/12/12 13:32:37 tsutsui Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -375,6 +375,7 @@ sci_attach(device_t parent, device_t sel sci_attached = 1; + sc->sc_dev = self; sc->sc_hwflags = 0; /* XXX */ sc->sc_swflags = 0; /* XXX */ sc->sc_fifolen = 0; /* XXX */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: tsutsui Date: Wed Dec 12 13:34:49 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: cache_sh4.c Log Message: Fix fallouts in rev 1.19: http://www.nerv.org/~ryo/netbsd/netbsd/?q=id:20080316T191753Z.1654448ada03ce3c4668f3fe472796d0b771e147 - revert RUN_P1 -> PAD_P1_SWITCH changes where RUN_P1 is actually required (all icache CCIA ops still need RUN_P2) - sh4_dcache_wbinv_all() and sh4_dcache_wbinv_range_index() (which manipulate CCDA arrays) are no longer have RUN_P2 so we can't call them directly from sh4_icache_sync_all() and sh4_icache_sync_range_index() funcitons; use function pointers (which have appropriate addresses) instead for 7750 and 7750S To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sh3/sh3/cache_sh4.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/sh3/sh3/cache_sh4.c diff -u src/sys/arch/sh3/sh3/cache_sh4.c:1.20 src/sys/arch/sh3/sh3/cache_sh4.c:1.21 --- src/sys/arch/sh3/sh3/cache_sh4.c:1.20 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/sh3/cache_sh4.c Wed Dec 12 13:34:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh4.c,v 1.20 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: cache_sh4.c,v 1.21 2012/12/12 13:34:49 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.20 2008/04/28 20:23:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.21 2012/12/12 13:34:49 tsutsui Exp $"); #include "opt_cache.h" @@ -222,14 +222,15 @@ sh4_icache_sync_all(void) vaddr_t va = 0; vaddr_t eva = SH4_ICACHE_SIZE; - sh4_dcache_wbinv_all(); + /* d$ index ops must be called via P2 on 7750 and 7750S */ + (*sh_cache_ops._dcache_wbinv_all)(); RUN_P2; while (va < eva) { cache_sh4_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32 * 8; } - PAD_P1_SWITCH; + RUN_P1; } void @@ -248,7 +249,7 @@ sh4_icache_sync_range(vaddr_t va, vsize_ _reg_write_4(ccia, va & CCIA_TAGADDR_MASK); /* V = 0 */ va += 32; } - PAD_P1_SWITCH; + RUN_P1; } void @@ -257,7 +258,8 @@ sh4_icache_sync_range_index(vaddr_t va, vaddr_t eva = round_line(va + sz); va = trunc_line(va); - sh4_dcache_wbinv_range_index(va, eva - va); + /* d$ index ops must be called via P2 on 7750 and 7750S */ + (*sh_cache_ops._dcache_wbinv_range_index)(va, eva - va); RUN_P2; while ((eva - va) >= (8 * 32)) { @@ -269,7 +271,7 @@ sh4_icache_sync_range_index(vaddr_t va, cache_sh4_op_line_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32; } - PAD_P1_SWITCH; + RUN_P1; } void @@ -419,7 +421,7 @@ sh4_emode_icache_sync_all(void) CCIA_V, 13); va += 32 * 8; } - PAD_P1_SWITCH; + RUN_P1; } void @@ -442,7 +444,7 @@ sh4_emode_icache_sync_range_index(vaddr_ CCIA_V, 13); va += 32; } - PAD_P1_SWITCH; + RUN_P1; } void
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: tsutsui Date: Wed Dec 12 15:43:44 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: cache_sh4.c Log Message: Revert part of the previous (reverting RUN_P1 -> PAD_P1_SWITCH again). We can assume all icache ops are called from (and will return to) P1 so no need to bother to jump to P1 at end of functions. Pointed out by uwe@. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/sh3/cache_sh4.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/sh3/sh3/cache_sh4.c diff -u src/sys/arch/sh3/sh3/cache_sh4.c:1.21 src/sys/arch/sh3/sh3/cache_sh4.c:1.22 --- src/sys/arch/sh3/sh3/cache_sh4.c:1.21 Wed Dec 12 13:34:49 2012 +++ src/sys/arch/sh3/sh3/cache_sh4.c Wed Dec 12 15:43:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh4.c,v 1.21 2012/12/12 13:34:49 tsutsui Exp $ */ +/* $NetBSD: cache_sh4.c,v 1.22 2012/12/12 15:43:44 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.21 2012/12/12 13:34:49 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.22 2012/12/12 15:43:44 tsutsui Exp $"); #include "opt_cache.h" @@ -230,7 +230,7 @@ sh4_icache_sync_all(void) cache_sh4_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32 * 8; } - RUN_P1; + PAD_P1_SWITCH; } void @@ -249,7 +249,7 @@ sh4_icache_sync_range(vaddr_t va, vsize_ _reg_write_4(ccia, va & CCIA_TAGADDR_MASK); /* V = 0 */ va += 32; } - RUN_P1; + PAD_P1_SWITCH; } void @@ -271,7 +271,7 @@ sh4_icache_sync_range_index(vaddr_t va, cache_sh4_op_line_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32; } - RUN_P1; + PAD_P1_SWITCH; } void @@ -421,7 +421,7 @@ sh4_emode_icache_sync_all(void) CCIA_V, 13); va += 32 * 8; } - RUN_P1; + PAD_P1_SWITCH; } void @@ -444,7 +444,7 @@ sh4_emode_icache_sync_range_index(vaddr_ CCIA_V, 13); va += 32; } - RUN_P1; + PAD_P1_SWITCH; } void
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: tsutsui Date: Wed Dec 12 16:24:49 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: cache_sh4.c Log Message: Sprinkle redundant comments about PAD_P1_SWITCH to avoid stupid confusion. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sh3/sh3/cache_sh4.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/sh3/sh3/cache_sh4.c diff -u src/sys/arch/sh3/sh3/cache_sh4.c:1.22 src/sys/arch/sh3/sh3/cache_sh4.c:1.23 --- src/sys/arch/sh3/sh3/cache_sh4.c:1.22 Wed Dec 12 15:43:44 2012 +++ src/sys/arch/sh3/sh3/cache_sh4.c Wed Dec 12 16:24:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh4.c,v 1.22 2012/12/12 15:43:44 tsutsui Exp $ */ +/* $NetBSD: cache_sh4.c,v 1.23 2012/12/12 16:24:49 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.22 2012/12/12 15:43:44 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.23 2012/12/12 16:24:49 tsutsui Exp $"); #include "opt_cache.h" @@ -230,6 +230,7 @@ sh4_icache_sync_all(void) cache_sh4_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32 * 8; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -249,6 +250,7 @@ sh4_icache_sync_range(vaddr_t va, vsize_ _reg_write_4(ccia, va & CCIA_TAGADDR_MASK); /* V = 0 */ va += 32; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -271,6 +273,7 @@ sh4_icache_sync_range_index(vaddr_t va, cache_sh4_op_line_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -286,6 +289,7 @@ sh4_dcache_wbinv_all(void) (CCDA_U | CCDA_V)); va += 32 * 8; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -319,6 +323,7 @@ sh4_dcache_wbinv_range_index(vaddr_t va, (CCDA_U | CCDA_V)); va += 32; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -421,6 +426,7 @@ sh4_emode_icache_sync_all(void) CCIA_V, 13); va += 32 * 8; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; } @@ -444,6 +450,7 @@ sh4_emode_icache_sync_range_index(vaddr_ CCIA_V, 13); va += 32; } + /* assume we are returning into a P1 caller */ PAD_P1_SWITCH; }
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Mon Sep 26 22:43:07 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: compute the entry size correctly. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sh3/sh3/cpu_in_cksum.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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.2 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.3 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.2 Fri Feb 1 21:15:40 2008 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Mon Sep 26 18:43:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.2 2008/02/02 02:15:40 uwe Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.3 2011/09/26 22:43:07 christos Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -31,7 +31,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.2 2008/02/02 02:15:40 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.3 2011/09/26 22:43:07 christos Exp $") #define reg_tmp0 r0 @@ -244,9 +244,6 @@ out_of_mbufs: .L_message_out_of_data: .asciz "cksum: out of data (%d byte short)\n" - SET_ENTRY_SIZE(in_cksum) - - .align 2 cksum128mod: mov reg_mlen,reg_tmp0 @@ -305,3 +302,4 @@ cksum128_tail: mov #0,reg_tmp0 rts addc reg_tmp0,reg_sum + SET_ENTRY_SIZE(cpu_in_cksum)
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Tue Sep 27 00:35:38 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: move the size marker back to where it was, but fix the name. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sh3/sh3/cpu_in_cksum.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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.3 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.4 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.3 Mon Sep 26 18:43:07 2011 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Mon Sep 26 20:35:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.3 2011/09/26 22:43:07 christos Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.4 2011/09/27 00:35:38 christos Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -31,7 +31,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.3 2011/09/26 22:43:07 christos Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.4 2011/09/27 00:35:38 christos Exp $") #define reg_tmp0 r0 @@ -244,6 +244,9 @@ out_of_mbufs: .L_message_out_of_data: .asciz "cksum: out of data (%d byte short)\n" + SET_ENTRY_SIZE(cpu_in_cksum) + + .align 2 cksum128mod: mov reg_mlen,reg_tmp0 @@ -302,4 +305,3 @@ cksum128_tail: mov #0,reg_tmp0 rts addc reg_tmp0,reg_sum - SET_ENTRY_SIZE(cpu_in_cksum)
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Mon Oct 31 19:08:46 UTC 2011 Modified Files: src/sys/arch/sh3/include: ptrace.h Log Message: #if-0'ed defines for PT_GETFPREGS and PT_SETFPREGS. Not used yet, but reserve the numbers as they are "leaked" to readelf(1), that has to know them as NT_NETBSDCORE_FIRSTMACH + x (see get_netbsd_elfcore_note_type). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/include/ptrace.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/sh3/include/ptrace.h diff -u src/sys/arch/sh3/include/ptrace.h:1.9 src/sys/arch/sh3/include/ptrace.h:1.10 --- src/sys/arch/sh3/include/ptrace.h:1.9 Fri Jan 28 21:06:07 2011 +++ src/sys/arch/sh3/include/ptrace.h Mon Oct 31 19:08:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.9 2011/01/28 21:06:07 uwe Exp $ */ +/* $NetBSD: ptrace.h,v 1.10 2011/10/31 19:08:45 uwe Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -46,6 +46,11 @@ #define PT_GETREGS (PT_FIRSTMACH + 3) #define PT_SETREGS (PT_FIRSTMACH + 4) +#if 0 /* XXX: not yet, but reserve the numbers "leaked" to readelf(1). */ +#define PT_GETFPREGS (PT_FIRSTMACH + 5) +#define PT_SETFPREGS (PT_FIRSTMACH + 6) +#endif + #define PT_MACHDEP_STRINGS \ "PT_STEP", \ "PT___GETREGS40", \
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: dyoung Date: Fri Jul 1 19:17:38 UTC 2011 Modified Files: src/sys/arch/sh3/dev: shpcic.c shpcicvar.h Log Message: #include instead of . To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/dev/shpcic.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sh3/dev/shpcicvar.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/sh3/dev/shpcic.c diff -u src/sys/arch/sh3/dev/shpcic.c:1.14 src/sys/arch/sh3/dev/shpcic.c:1.15 --- src/sys/arch/sh3/dev/shpcic.c:1.14 Tue May 17 17:34:52 2011 +++ src/sys/arch/sh3/dev/shpcic.c Fri Jul 1 19:17:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: shpcic.c,v 1.14 2011/05/17 17:34:52 dyoung Exp $ */ +/* $NetBSD: shpcic.c,v 1.15 2011/07/01 19:17:38 dyoung Exp $ */ /* * Copyright (c) 2005 NONAKA Kimihiro @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: shpcic.c,v 1.14 2011/05/17 17:34:52 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: shpcic.c,v 1.15 2011/07/01 19:17:38 dyoung Exp $"); #include "opt_pci.h" @@ -47,7 +47,7 @@ #include #include -#include +#include #include #include Index: src/sys/arch/sh3/dev/shpcicvar.h diff -u src/sys/arch/sh3/dev/shpcicvar.h:1.7 src/sys/arch/sh3/dev/shpcicvar.h:1.8 --- src/sys/arch/sh3/dev/shpcicvar.h:1.7 Sun Aug 2 00:06:44 2009 +++ src/sys/arch/sh3/dev/shpcicvar.h Fri Jul 1 19:17:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: shpcicvar.h,v 1.7 2009/08/02 00:06:44 nonaka Exp $ */ +/* $NetBSD: shpcicvar.h,v 1.8 2011/07/01 19:17:38 dyoung Exp $ */ /*- * Copyright (c) 2005 NONAKA Kimihiro @@ -29,7 +29,7 @@ #ifndef _SH3_SHPCICVAR_H_ #define _SH3_SHPCICVAR_H_ -#include +#include bus_space_tag_t shpcic_get_bus_io_tag(void); bus_space_tag_t shpcic_get_bus_mem_tag(void);
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: mrg Date: Sun Jul 3 06:45:51 UTC 2011 Modified Files: src/sys/arch/sh3/include: stdarg.h Log Message: add GCC 4.5 support. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/include/stdarg.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/sh3/include/stdarg.h diff -u src/sys/arch/sh3/include/stdarg.h:1.9 src/sys/arch/sh3/include/stdarg.h:1.10 --- src/sys/arch/sh3/include/stdarg.h:1.9 Sun May 21 22:39:04 2006 +++ src/sys/arch/sh3/include/stdarg.h Sun Jul 3 06:45:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.9 2006/05/21 22:39:04 uwe Exp $ */ +/* $NetBSD: stdarg.h,v 1.10 2011/07/03 06:45:50 mrg Exp $ */ /* * Copyright (c) 1991, 1993 @@ -42,13 +42,18 @@ #ifdef __lint__ #define __builtin_next_arg(t) ((t) ? 0 : 0) #define __builtin_stdarg_start(a, l) ((a) = ((l) ? 0 : 0)) +#define __builtin_va_start(a, l) ((a) = ((l) ? 0 : 0)) #define __builtin_va_arg(a, t) ((t)((a) ? 0 : 0)) #define __builtin_va_end /* nothing */ #define __builtin_va_copy(d, s) ((d) = (s)) #endif #if __GNUC_PREREQ__(2, 96) +#if __GNUC_PREREQ__(4, 5) +#define va_start(ap, last) __builtin_va_start((ap), (last)) +#else #define va_start(ap, last) __builtin_stdarg_start((ap), (last)) +#endif #define va_arg __builtin_va_arg #define va_end __builtin_va_end #define __va_copy(dest, src) __builtin_va_copy((dest), (src))
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: dyoung Date: Mon Jul 25 16:02:25 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: #include . Should fix most of the SH3 ports. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/sh3/sh3_machdep.c diff -u src/sys/arch/sh3/sh3/sh3_machdep.c:1.93 src/sys/arch/sh3/sh3/sh3_machdep.c:1.94 --- src/sys/arch/sh3/sh3/sh3_machdep.c:1.93 Wed Jul 20 21:30:13 2011 +++ src/sys/arch/sh3/sh3/sh3_machdep.c Mon Jul 25 16:02:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sh3_machdep.c,v 1.93 2011/07/20 21:30:13 dyoung Exp $ */ +/* $NetBSD: sh3_machdep.c,v 1.94 2011/07/25 16:02:25 dyoung Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.93 2011/07/20 21:30:13 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.94 2011/07/25 16:02:25 dyoung Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -89,6 +89,7 @@ #include #include #include +#include #ifdef KGDB #include
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: martin Date: Mon Feb 13 01:04:27 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: vm_machdep.c Log Message: add missing MD code for posix_spawn To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.73 src/sys/arch/sh3/sh3/vm_machdep.c:1.74 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.73 Mon Jun 13 05:23:33 2011 +++ src/sys/arch/sh3/sh3/vm_machdep.c Mon Feb 13 01:04:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.74 2012/02/13 01:04:26 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.74 2012/02/13 01:04:26 martin Exp $"); #include "opt_kstack_debug.h" @@ -274,6 +274,16 @@ child_return(void *arg) } /* + * Process the tail end of a posix_spawn() for the child. + */ +void +cpu_spawn_return(struct lwp *l) +{ + + userret(l); +} + +/* * struct emul e_startlwp (for _lwp_create(2)) */ void
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uch Date: Mon Jun 13 05:23:34 UTC 2011 Modified Files: src/sys/arch/sh3/sh3: vm_machdep.c Log Message: include uvm_page.h for vm_physmem[] To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.72 src/sys/arch/sh3/sh3/vm_machdep.c:1.73 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.72 Sun Jun 12 03:35:46 2011 +++ src/sys/arch/sh3/sh3/vm_machdep.c Mon Jun 13 05:23:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.72 2011/06/12 03:35:46 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.72 2011/06/12 03:35:46 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $"); #include "opt_kstack_debug.h" @@ -101,6 +101,7 @@ #include #include +#include #include #include
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: ryo Date: Fri Sep 21 09:05:09 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: adapt for _UC_TLSBASE. Approved by manu@ and msaitoh@ To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/sh3/sh3/sh3_machdep.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/sh3/sh3/sh3_machdep.c diff -u src/sys/arch/sh3/sh3/sh3_machdep.c:1.100 src/sys/arch/sh3/sh3/sh3_machdep.c:1.101 --- src/sys/arch/sh3/sh3/sh3_machdep.c:1.100 Sun Jul 8 20:14:12 2012 +++ src/sys/arch/sh3/sh3/sh3_machdep.c Fri Sep 21 09:05:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sh3_machdep.c,v 1.100 2012/07/08 20:14:12 dsl Exp $ */ +/* $NetBSD: sh3_machdep.c,v 1.101 2012/09/21 09:05:08 ryo Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.100 2012/07/08 20:14:12 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.101 2012/09/21 09:05:08 ryo Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -432,7 +432,7 @@ cpu_getmcontext(struct lwp *l, mcontext_ (void *) gr[_REG_PC])) != -1) gr[_REG_PC] = ras_pc; - *flags |= _UC_CPU; + *flags |= (_UC_CPU|_UC_TLSBASE); /* FPU context is currently not handled by the kernel. */ memset(&mcp->__fpregs, 0, sizeof (mcp->__fpregs)); @@ -465,7 +465,8 @@ cpu_setmcontext(struct lwp *l, const mco if (error) return error; - tf->tf_gbr= gr[_REG_GBR]; + /* done in lwp_setprivate */ + /* tf->tf_gbr= gr[_REG_GBR]; */ tf->tf_spc= gr[_REG_PC]; tf->tf_ssr= gr[_REG_SR]; tf->tf_macl = gr[_REG_MACL]; @@ -488,7 +489,8 @@ cpu_setmcontext(struct lwp *l, const mco tf->tf_r0 = gr[_REG_R0]; tf->tf_r15= gr[_REG_R15]; - lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_GBR]); + if (flags & _UC_TLSBASE) + lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_GBR]); } #if 0
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: joerg Date: Mon Dec 5 12:42:33 UTC 2016 Modified Files: src/sys/arch/sh3/include: elf_machdep.h Log Message: binutils decided to shuffle around its extensions a long time ago. Since we don't actually use them for anything, follow them. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sh3/include/elf_machdep.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/sh3/include/elf_machdep.h diff -u src/sys/arch/sh3/include/elf_machdep.h:1.11 src/sys/arch/sh3/include/elf_machdep.h:1.12 --- src/sys/arch/sh3/include/elf_machdep.h:1.11 Thu Oct 23 19:39:42 2014 +++ src/sys/arch/sh3/include/elf_machdep.h Mon Dec 5 12:42:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_machdep.h,v 1.11 2014/10/23 19:39:42 christos Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.12 2016/12/05 12:42:33 joerg Exp $ */ #include @@ -47,6 +47,11 @@ #define R_SH_DIR8BP 7 #define R_SH_DIR8W 8 #define R_SH_DIR8L 9 +#define R_SH_LOOP_START 10 +#define R_SH_LOOP_END 11 +#define R_SH_GNU_VTINHERIT 22 +#define R_SH_GNU_VTENTRY 23 +#define R_SH_SWITCH8 24 #define R_SH_SWITCH16 25 #define R_SH_SWITCH32 26 #define R_SH_USES 27 @@ -55,11 +60,6 @@ #define R_SH_CODE 30 #define R_SH_DATA 31 #define R_SH_LABEL 32 -#define R_SH_SWITCH8 33 -#define R_SH_GNU_VTINHERIT 34 -#define R_SH_GNU_VTENTRY 35 -#define R_SH_LOOP_START 36 -#define R_SH_LOOP_END 37 /* TLS relocations */ #define R_SH_TLS_GD_32 144
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: tsutsui Date: Sun Dec 6 02:21:55 UTC 2015 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: Make options SCIFCONSOLE patchable via a variable using gdb(1) etc. Tested on dreamcast. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.65 src/sys/arch/sh3/dev/scif.c:1.66 --- src/sys/arch/sh3/dev/scif.c:1.65 Sat Nov 15 19:20:01 2014 +++ src/sys/arch/sh3/dev/scif.c Sun Dec 6 02:21:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.65 2014/11/15 19:20:01 christos Exp $ */ +/* $NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.65 2014/11/15 19:20:01 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -223,6 +223,10 @@ const struct cdevsw scif_cdevsw = { .d_flag = D_TTY }; +#ifndef SCIFCONSOLE +#define SCIFCONSOLE 0 +#endif +int scifconsole = SCIFCONSOLE; /* patchable */ /* struct tty */ static void scifstart(struct tty *); @@ -1424,11 +1428,10 @@ scifcnprobe(struct consdev *cp) /* Initialize required fields. */ cp->cn_dev = makedev(maj, 0); -#ifdef SCIFCONSOLE - cp->cn_pri = CN_REMOTE; -#else - cp->cn_pri = CN_NORMAL; -#endif + if (scifconsole) + cp->cn_pri = CN_REMOTE; + else + cp->cn_pri = CN_NORMAL; } void
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Tue Jan 6 17:43:16 UTC 2015 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: We never want the c definitions in To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sh3/sh3/cpu_in_cksum.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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.4 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.5 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.4 Mon Sep 26 20:35:38 2011 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Tue Jan 6 12:43:16 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.4 2011/09/27 00:35:38 christos Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.5 2015/01/06 17:43:16 christos Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -27,11 +27,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _LOCORE +#define _LOCORE +#endif #include #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.4 2011/09/27 00:35:38 christos Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.5 2015/01/06 17:43:16 christos Exp $") #define reg_tmp0 r0
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: skrll Date: Sun Feb 15 10:48:13 UTC 2015 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S Log Message: port-sh3/49613: errno does not set by some systemcall at error case Branch to correct point when error detected. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.54 src/sys/arch/sh3/sh3/locore_subr.S:1.55 --- src/sys/arch/sh3/sh3/locore_subr.S:1.54 Tue Feb 1 01:54:14 2011 +++ src/sys/arch/sh3/sh3/locore_subr.S Sun Feb 15 10:48:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $ */ +/* $NetBSD: locore_subr.S,v 1.55 2015/02/15 10:48:13 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.55 2015/02/15 10:48:13 skrll Exp $") /* @@ -645,7 +645,7 @@ ENTRY(copyinstr) mov.l .L_copyinstr_VM_MAXUSER_ADDRESS, r3 cmp/hi r3, r4 /* bomb if usrc isn't in user space */ - bt 4f + bt 5f mov r3, r0 sub r4, r0 cmp/hi r6, r0 /* don't beyond user space */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: skrll Date: Wed Mar 4 09:39:26 UTC 2015 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF. >From martin@ To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.63 src/sys/arch/sh3/sh3/exception.c:1.64 --- src/sys/arch/sh3/sh3/exception.c:1.63 Sun Jul 8 20:14:12 2012 +++ src/sys/arch/sh3/sh3/exception.c Wed Mar 4 09:39:26 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.63 2012/07/08 20:14:12 dsl Exp $ */ +/* $NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.63 2012/07/08 20:14:12 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -417,11 +417,22 @@ tlb_exception(struct lwp *l, struct trap /* Page not found. */ if (usermode) { KSI_INIT_TRAP(&ksi); - if (err == ENOMEM) + switch (err) { + case ENOMEM: ksi.ksi_signo = SIGKILL; - else { + break; + case EINVAL: + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_ADRERR; + break; + case EACCES: + ksi.ksi_signo = SIGSEGV; + ksi.ksi_code = SEGV_ACCERR; + break; + default: ksi.ksi_signo = SIGSEGV; ksi.ksi_code = SEGV_MAPERR; + break; } goto user_fault; } else {
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: christos Date: Thu Aug 25 12:19:42 UTC 2016 Modified Files: src/sys/arch/sh3/include: ieeefp.h Log Message: use fenv.h To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sh3/include/ieeefp.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/sh3/include/ieeefp.h diff -u src/sys/arch/sh3/include/ieeefp.h:1.4 src/sys/arch/sh3/include/ieeefp.h:1.5 --- src/sys/arch/sh3/include/ieeefp.h:1.4 Tue Aug 5 12:47:42 2008 +++ src/sys/arch/sh3/include/ieeefp.h Thu Aug 25 08:19:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieeefp.h,v 1.4 2008/08/05 16:47:42 matt Exp $ */ +/* $NetBSD: ieeefp.h,v 1.5 2016/08/25 12:19:42 christos Exp $ */ /* * Written by J.T. Conklin, Apr 6, 1995 @@ -12,28 +12,11 @@ #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) -typedef int fenv_t; -typedef int fexcept_t; - -#define FE_INVALID 0x01 /* invalid operation exception */ -#define FE_DENORMAL 0x02 /* denormalization exception */ -#define FE_DIVBYZERO 0x04 /* divide-by-zero exception */ -#define FE_OVERFLOW 0x08 /* overflow exception */ -#define FE_UNDERFLOW 0x10 /* underflow exception */ -#define FE_INEXACT 0x20 /* imprecise (loss of precision) */ - -#define FE_ALL_EXCEPT 0x3f - -#define FE_TONEAREST 0 /* round to nearest representable number */ -#define FE_DOWNWARD 1 /* round toward negative infinity */ -#define FE_UPWARD 2 /* round toward positive infinity */ -#define FE_TOWARDZERO 3 /* round to zero (truncate) */ +#include #if defined(_NETBSD_SOURCE) -typedef int fp_except; #define FP_X_INV FE_INVALID /* invalid operation exception */ -#define FP_X_DNML FE_DENORMAL /* denormalization exception */ #define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */ #define FP_X_OFL FE_OVERFLOW /* overflow exception */ #define FP_X_UFL FE_UNDERFLOW /* underflow exception */ @@ -41,8 +24,6 @@ typedef int fp_except; typedef enum { FP_RN=FE_TONEAREST, /* round to nearest representable number */ - FP_RM=FE_DOWNWARD, /* round toward negative infinity */ - FP_RP=FE_UPWARD, /* round toward positive infinity */ FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */ } fp_rnd;
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: christos Date: Thu Aug 25 12:29:15 UTC 2016 Modified Files: src/sys/arch/sh3/include: fenv.h ieeefp.h Log Message: fake some stuff for softfloat. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sh3/include/fenv.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sh3/include/ieeefp.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/sh3/include/fenv.h diff -u src/sys/arch/sh3/include/fenv.h:1.1 src/sys/arch/sh3/include/fenv.h:1.2 --- src/sys/arch/sh3/include/fenv.h:1.1 Thu Aug 25 08:14:10 2016 +++ src/sys/arch/sh3/include/fenv.h Thu Aug 25 08:29:14 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fenv.h,v 1.1 2016/08/25 12:14:10 christos Exp $ */ +/* $NetBSD: fenv.h,v 1.2 2016/08/25 12:29:14 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -53,8 +53,9 @@ /* Rounding modes, from FPSCR */ #define FE_TONEAREST FPSCR_ROUND_NEAREST #define FE_TOWARDZERO FPSCR_ROUND_ZERO -/* FE_DOWNWARD */ -/* FE_UPWARD */ +/* These two don't exist and are only defined for the benefit of softfloat */ +#define FE_DOWNWARD (FPSCR_ROUND_ZERO + 1) +#define FE_UPWARD (FPSCR_ROUND_ZERO + 2) #define _ROUND_MASK \ (FE_TONEAREST | FE_TOWARDZERO) Index: src/sys/arch/sh3/include/ieeefp.h diff -u src/sys/arch/sh3/include/ieeefp.h:1.5 src/sys/arch/sh3/include/ieeefp.h:1.6 --- src/sys/arch/sh3/include/ieeefp.h:1.5 Thu Aug 25 08:19:42 2016 +++ src/sys/arch/sh3/include/ieeefp.h Thu Aug 25 08:29:14 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieeefp.h,v 1.5 2016/08/25 12:19:42 christos Exp $ */ +/* $NetBSD: ieeefp.h,v 1.6 2016/08/25 12:29:14 christos Exp $ */ /* * Written by J.T. Conklin, Apr 6, 1995 @@ -16,6 +16,8 @@ #if defined(_NETBSD_SOURCE) +typedef int fp_except; + #define FP_X_INV FE_INVALID /* invalid operation exception */ #define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */ #define FP_X_OFL FE_OVERFLOW /* overflow exception */ @@ -24,6 +26,8 @@ typedef enum { FP_RN=FE_TONEAREST, /* round to nearest representable number */ + FP_RM=FE_DOWNWARD, /* round toward negative infinity */ + FP_RP=FE_UPWARD,/* round toward positive infinity */ FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */ } fp_rnd;
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: martin Date: Mon Sep 8 10:00:18 UTC 2014 Modified Files: src/sys/arch/sh3/dev: rtc.c Log Message: Adapt formats for debug printfs to clock_subr type changes. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/dev/rtc.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/sh3/dev/rtc.c diff -u src/sys/arch/sh3/dev/rtc.c:1.8 src/sys/arch/sh3/dev/rtc.c:1.9 --- src/sys/arch/sh3/dev/rtc.c:1.8 Sat May 22 15:51:32 2010 +++ src/sys/arch/sh3/dev/rtc.c Mon Sep 8 10:00:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.8 2010/05/22 15:51:32 tsutsui Exp $ */ +/* $NetBSD: rtc.c,v 1.9 2014/09/08 10:00:18 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.8 2010/05/22 15:51:32 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.9 2014/09/08 10:00:18 martin Exp $"); #include #include @@ -208,8 +208,8 @@ rtc_gettime_ymdhms(todr_chip_handle_t h, #ifdef RTC_DEBUG aprint_debug_dev(sc->sc_dev, - "gettime: %04d-%02d-%02d %02d:%02d:%02d\n", - dt->dt_year, dt->dt_mon, dt->dt_day, + "gettime: %04lu-%02d-%02d %02d:%02d:%02d\n", + (unsigned long)dt->dt_year, dt->dt_mon, dt->dt_day, dt->dt_hour, dt->dt_min, dt->dt_sec); if (!sc->sc_valid) @@ -262,8 +262,8 @@ rtc_settime_ymdhms(todr_chip_handle_t h, #ifdef RTC_DEBUG aprint_debug_dev(sc->sc_dev, - "settime: %04d-%02d-%02d %02d:%02d:%02d\n", - dt->dt_year, dt->dt_mon, dt->dt_day, + "settime: %04lu-%02d-%02d %02d:%02d:%02d\n", + (unsigned long)dt->dt_year, dt->dt_mon, dt->dt_day, dt->dt_hour, dt->dt_min, dt->dt_sec); #endif
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: christos Date: Thu Oct 23 19:39:43 UTC 2014 Modified Files: src/sys/arch/sh3/include: elf_machdep.h Log Message: instead of bitching about the missing endianness, get it. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/include/elf_machdep.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/sh3/include/elf_machdep.h diff -u src/sys/arch/sh3/include/elf_machdep.h:1.10 src/sys/arch/sh3/include/elf_machdep.h:1.11 --- src/sys/arch/sh3/include/elf_machdep.h:1.10 Sat May 30 01:56:53 2009 +++ src/sys/arch/sh3/include/elf_machdep.h Thu Oct 23 15:39:42 2014 @@ -1,8 +1,6 @@ -/* $NetBSD: elf_machdep.h,v 1.10 2009/05/30 05:56:53 skrll Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.11 2014/10/23 19:39:42 christos Exp $ */ -#if !defined(_BYTE_ORDER) && !defined(HAVE_NBTOOL_CONFIG_H) -#error Define _BYTE_ORDER! -#endif +#include #if _BYTE_ORDER == _LITTLE_ENDIAN #define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: tsutsui Date: Tue May 14 13:53:47 UTC 2013 Modified Files: src/sys/arch/sh3/include: scireg.h Log Message: Add a definition of SCSCMR1, smart card mode register available on 7750 etc. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/include/scireg.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/sh3/include/scireg.h diff -u src/sys/arch/sh3/include/scireg.h:1.9 src/sys/arch/sh3/include/scireg.h:1.10 --- src/sys/arch/sh3/include/scireg.h:1.9 Thu Apr 30 05:19:38 2009 +++ src/sys/arch/sh3/include/scireg.h Tue May 14 13:53:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: scireg.h,v 1.9 2009/04/30 05:19:38 nonaka Exp $ */ +/* $NetBSD: scireg.h,v 1.10 2013/05/14 13:53:47 tsutsui Exp $ */ /*- * Copyright (C) 1999 SAITOH Masanobu. All rights reserved. @@ -56,6 +56,7 @@ #define SHREG_SCTDR (*(volatile unsigned char *) 0xffec) #define SHREG_SCSSR (*(volatile unsigned char *) 0xffe00010) #define SHREG_SCRDR (*(volatile unsigned char *) 0xffe00014) +#define SHREG_SCSCMR (*(volatile unsigned char *) 0xffe00018) #define SHREG_SCSPTR (*(volatile unsigned char *) 0xffe0001c) #endif
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: tsutsui Date: Tue May 14 14:11:43 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: cache_sh4.c Log Message: Don't call sh4_icache_sync_all() before sh_cache_ops is initialized. Instead, use SH4_EMODE_CACHE_FLUSH() or SH4_CACHE_FLUSH() macro to invalidate cache before initializing CCR. This seems to suppress random file system corruption on wd(4) at acardide(4) (which uses bus-master DMA and calls many cache flush ops) during pkgsrc packages builds on landisk. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sh3/sh3/cache_sh4.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/sh3/sh3/cache_sh4.c diff -u src/sys/arch/sh3/sh3/cache_sh4.c:1.23 src/sys/arch/sh3/sh3/cache_sh4.c:1.24 --- src/sys/arch/sh3/sh3/cache_sh4.c:1.23 Wed Dec 12 16:24:49 2012 +++ src/sys/arch/sh3/sh3/cache_sh4.c Tue May 14 14:11:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cache_sh4.c,v 1.23 2012/12/12 16:24:49 tsutsui Exp $ */ +/* $NetBSD: cache_sh4.c,v 1.24 2013/05/14 14:11:43 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.23 2012/12/12 16:24:49 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache_sh4.c,v 1.24 2013/05/14 14:11:43 tsutsui Exp $"); #include "opt_cache.h" @@ -118,8 +118,11 @@ sh4_cache_config(void) r |= SH4_CCR_CB; #endif - sh4_icache_sync_all(); RUN_P2; + if (r & SH4_CCR_EMODE) + SH4_EMODE_CACHE_FLUSH(); + else + SH4_CACHE_FLUSH(); _reg_write_4(SH4_CCR, SH4_CCR_ICI|SH4_CCR_OCI); _reg_write_4(SH4_CCR, r); RUN_P1;
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: christos Date: Thu May 16 18:47:38 UTC 2013 Modified Files: src/sys/arch/sh3/include: disklabel.h Log Message: name it like other ports do To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/include/disklabel.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/sh3/include/disklabel.h diff -u src/sys/arch/sh3/include/disklabel.h:1.8 src/sys/arch/sh3/include/disklabel.h:1.9 --- src/sys/arch/sh3/include/disklabel.h:1.8 Mon Nov 23 08:40:11 2009 +++ src/sys/arch/sh3/include/disklabel.h Thu May 16 14:47:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.h,v 1.8 2009/11/23 13:40:11 pooka Exp $ */ +/* $NetBSD: disklabel.h,v 1.9 2013/05/16 18:47:38 christos Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -52,7 +52,7 @@ #include #endif /* HAVE_NBTOOL_CONFIG_H */ struct cpu_disklabel { - struct mbr_partition dosparts[MBR_PART_COUNT]; + struct mbr_partition mbrparts[MBR_PART_COUNT]; #define __HAVE_DISKLABEL_DKBAD struct dkbad bad; };
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: msaitoh Date: Thu Jun 19 18:01:18 UTC 2014 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: fix -Werror=unused-but-set-variable compile error To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sh3/dev/sci.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/sh3/dev/sci.c diff -u src/sys/arch/sh3/dev/sci.c:1.58 src/sys/arch/sh3/dev/sci.c:1.59 --- src/sys/arch/sh3/dev/sci.c:1.58 Sun Mar 16 05:20:25 2014 +++ src/sys/arch/sh3/dev/sci.c Thu Jun 19 18:01:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.58 2014/03/16 05:20:25 dholland Exp $ */ +/* $NetBSD: sci.c,v 1.59 2014/06/19 18:01:18 msaitoh Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.58 2014/03/16 05:20:25 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.59 2014/06/19 18:01:18 msaitoh Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -599,7 +599,6 @@ void sci_iflush(struct sci_softc *sc) { unsigned char err_c; - volatile unsigned char c; if (((err_c = SHREG_SCSSR) & (SCSSR_RDRF | SCSSR_ORER | SCSSR_FER | SCSSR_PER)) != 0) { @@ -609,7 +608,7 @@ sci_iflush(struct sci_softc *sc) return; } - c = SHREG_SCRDR; + (void)SHREG_SCRDR; SHREG_SCSSR &= ~SCSSR_RDRF; }
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: matt Date: Wed Jun 26 16:28:51 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: syscall.c Log Message: Collapse syscall_fancy/syscall_plain to syscall and p_trace_enabled. Use sy_invoke To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/sh3/syscall.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/sh3/sh3/syscall.c diff -u src/sys/arch/sh3/sh3/syscall.c:1.14 src/sys/arch/sh3/sh3/syscall.c:1.15 --- src/sys/arch/sh3/sh3/syscall.c:1.14 Sun Feb 19 21:06:27 2012 +++ src/sys/arch/sh3/sh3/syscall.c Wed Jun 26 16:28:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.14 2012/02/19 21:06:27 rmind Exp $ */ +/* $NetBSD: syscall.c,v 1.15 2013/06/26 16:28:51 matt Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -88,17 +88,14 @@ #include -static void syscall_plain(struct lwp *, struct trapframe *); -static void syscall_fancy(struct lwp *, struct trapframe *); +static void syscall(struct lwp *, struct trapframe *); void syscall_intern(struct proc *p) { - if (trace_is_enabled(p)) - p->p_md.md_syscall = syscall_fancy; - else - p->p_md.md_syscall = syscall_plain; + p->p_trace_enabled = trace_is_enabled(p); + p->p_md.md_syscall = syscall; } @@ -108,7 +105,7 @@ syscall_intern(struct proc *p) * tf ... full user context. */ static void -syscall_plain(struct lwp *l, struct trapframe *tf) +syscall(struct lwp *l, struct trapframe *tf) { struct proc *p = l->l_proc; void *params; @@ -205,7 +202,7 @@ syscall_plain(struct lwp *l, struct trap rval[0] = 0; rval[1] = tf->tf_r1; - error = sy_call(callp, l, args, rval); + error = sy_invoke(callp, l, args, rval, code); switch (error) { case 0: @@ -235,140 +232,3 @@ syscall_plain(struct lwp *l, struct trap userret(l); } - -/* - * Like syscall_plain but with trace_enter/trace_exit. - */ -static void -syscall_fancy(struct lwp *l, struct trapframe *tf) -{ - struct proc *p = l->l_proc; - void *params; - const struct sysent *callp; - int error, opc, nsys; - size_t argsize; - register_t code, args[8], rval[2], ocode; - - curcpu()->ci_data.cpu_nsyscall++; - - opc = tf->tf_spc; - ocode = code = tf->tf_r0; - - nsys = p->p_emul->e_nsysent; - callp = p->p_emul->e_sysent; - params = (void *)tf->tf_r15; - - switch (code) { - case SYS_syscall: - /* - * Code is first argument, followed by actual args. - */ - code = tf->tf_r4; /* fuword(params); */ - /* params += sizeof(int); */ - break; - case SYS___syscall: - /* - * Like syscall, but code is a quad, so as to maintain - * quad alignment for the rest of the arguments. - */ - if (callp != sysent) - break; - /* fuword(params + _QUAD_LOWWORD * sizeof(int)); */ -#if _BYTE_ORDER == BIG_ENDIAN - code = tf->tf_r5; -#else - code = tf->tf_r4; -#endif - /* params += sizeof(quad_t); */ - break; - default: - break; - } - if (code < 0 || code >= nsys) - callp += p->p_emul->e_nosys; /* illegal */ - else - callp += code; - argsize = callp->sy_argsize; - - if (ocode == SYS_syscall) { - if (argsize) { - args[0] = tf->tf_r5; - args[1] = tf->tf_r6; - args[2] = tf->tf_r7; - if (argsize > 3 * sizeof(int)) { -argsize -= 3 * sizeof(int); -error = copyin(params, (void *)&args[3], - argsize); - } else -error = 0; - } else - error = 0; - } - else if (ocode == SYS___syscall) { - if (argsize) { - args[0] = tf->tf_r6; - args[1] = tf->tf_r7; - if (argsize > 2 * sizeof(int)) { -argsize -= 2 * sizeof(int); -error = copyin(params, (void *)&args[2], - argsize); - } else -error = 0; - } else - error = 0; - } else { - if (argsize) { - args[0] = tf->tf_r4; - args[1] = tf->tf_r5; - args[2] = tf->tf_r6; - args[3] = tf->tf_r7; - if (argsize > 4 * sizeof(int)) { -argsize -= 4 * sizeof(int); -error = copyin(params, (void *)&args[4], - argsize); - } else -error = 0; - } else - error = 0; - } - - if (error) - goto bad; - - if ((error = trace_enter(code, args, callp->sy_narg)) != 0) - goto out; - - rval[0] = 0; - rval[1] = tf->tf_r1; - error = sy_call(callp, l, args, rval); -out: - switch (error) { - case 0: - tf->tf_r0 = rval[0]; - tf->tf_r1 = rval[1]; - tf->tf_ssr |= PSL_TBIT; /* T bit */ - - break; - case ERESTART: - /* 2 = TRAPA instruction size */ - tf->tf_spc = opc - 2; - - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: - bad: - if (p->p_emul->e_errno) - error = p->p_emul->e_errno[error]; - tf->tf_r0 = error; - tf->tf_ssr &= ~PSL_TBIT; /* T bit */ - - break; - } - - - trace_exit(code, rval, error); - - userret(l); -}
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Aug 6 21:41:01 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: db_trace.c Log Message: db_stack_trace_print: support trace/[at], starting trace from switchframe. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sh3/sh3/db_trace.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/sh3/sh3/db_trace.c diff -u src/sys/arch/sh3/sh3/db_trace.c:1.23 src/sys/arch/sh3/sh3/db_trace.c:1.24 --- src/sys/arch/sh3/sh3/db_trace.c:1.23 Sun Jun 8 22:02:08 2008 +++ src/sys/arch/sh3/sh3/db_trace.c Tue Aug 6 21:41:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.23 2008/06/08 22:02:08 uwe Exp $ */ +/* $NetBSD: db_trace.c,v 1.24 2013/08/06 21:41:01 uwe Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.23 2008/06/08 22:02:08 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.24 2013/08/06 21:41:01 uwe Exp $"); #include #include @@ -82,17 +82,76 @@ db_stack_trace_print(db_expr_t addr, boo struct trapframe *tf; db_addr_t callpc, frame, lastframe; uint32_t vbr; + bool kernel_only = true; + bool lwpid = false; + bool lwpaddr = false; + const char *cp; + char c; __asm volatile("stc vbr, %0" : "=r"(vbr)); - tf = &ddb_regs; + cp = modif; + while ((c = *cp++) != 0) { + if (c == 'a') + lwpaddr = true; + else if (c == 't') + lwpid = true; + else if (c == 'u') + kernel_only = false; + } - frame = tf->tf_r14; - callpc = tf->tf_spc; + if (lwpaddr && lwpid) { + db_printf("only one of /a or /t can be specified\n"); + return; + } + if ((lwpaddr || lwpid) && !have_addr) { + db_printf("%s required\n", lwpaddr ? "address" : "pid"); + return; + } - if (callpc == 0) { - (*print)("calling through null pointer?\n"); - callpc = tf->tf_pr; + + if (!have_addr) { + tf = &ddb_regs; + frame = tf->tf_r14; + callpc = tf->tf_spc; + if (callpc == 0) { + (*print)("calling through null pointer?\n"); + callpc = tf->tf_pr; + } + } + else if (lwpaddr || lwpid) { + struct proc *p; + struct lwp *l; + struct pcb *pcb; + + if (lwpaddr) { + l = (struct lwp *)addr; + p = l->l_proc; + (*print)("trace: lwp addr %p pid %d ", + (void *)addr, p->p_pid); + } + else { + pid_t pid = (pid_t)addr; + (*print)("trace: pid %d ", pid); + p = proc_find_raw(pid); + if (p == NULL) { +(*print)("not found\n"); +return; + } + l = LIST_FIRST(&p->p_lwps); + } + KASSERT(l != NULL); + (*print)("lid %d ", l->l_lid); + pcb = lwp_getpcb(l); + tf = (struct trapframe *)pcb->pcb_sf.sf_r6_bank; + frame = pcb->pcb_sf.sf_r14; + callpc = pcb->pcb_sf.sf_pr; + (*print)("at %p\n", frame); + } + else { + /* XXX */ + db_printf("trace by frame address is not supported\n"); + return; } lastframe = 0;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Thu Nov 7 21:45:04 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: cache.c vm_machdep.c Log Message: fix unused variables To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/sh3/cache.c cvs rdiff -u -r1.75 -r1.76 src/sys/arch/sh3/sh3/vm_machdep.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/sh3/sh3/cache.c diff -u src/sys/arch/sh3/sh3/cache.c:1.16 src/sys/arch/sh3/sh3/cache.c:1.17 --- src/sys/arch/sh3/sh3/cache.c:1.16 Wed Mar 18 06:22:36 2009 +++ src/sys/arch/sh3/sh3/cache.c Thu Nov 7 16:45:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cache.c,v 1.16 2009/03/18 10:22:36 cegger Exp $ */ +/* $NetBSD: cache.c,v 1.17 2013/11/07 21:45:04 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.16 2009/03/18 10:22:36 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.17 2013/11/07 21:45:04 christos Exp $"); #include "opt_cache.h" #include "opt_memsize.h" /* IOM_RAM_BEGIN */ @@ -167,6 +167,7 @@ __cache_flush(void) d = *p; p += 4; /* next line index (16B) */ } + __USE(d); /* Flush I-Cache */ /* Index: src/sys/arch/sh3/sh3/vm_machdep.c diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.75 src/sys/arch/sh3/sh3/vm_machdep.c:1.76 --- src/sys/arch/sh3/sh3/vm_machdep.c:1.75 Sun Feb 19 16:06:27 2012 +++ src/sys/arch/sh3/sh3/vm_machdep.c Thu Nov 7 16:45:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.75 2012/02/19 21:06:27 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.76 2013/11/07 21:45:04 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.75 2012/02/19 21:06:27 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.76 2013/11/07 21:45:04 christos Exp $"); #include "opt_kstack_debug.h" @@ -269,7 +269,7 @@ startlwp(void *arg) { ucontext_t *uc = arg; lwp_t *l = curlwp; - int error; + int error __diagused; error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); KASSERT(error == 0);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Sat Nov 9 02:23:57 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: db_trace.c Log Message: remove unused code To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sh3/sh3/db_trace.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/sh3/sh3/db_trace.c diff -u src/sys/arch/sh3/sh3/db_trace.c:1.24 src/sys/arch/sh3/sh3/db_trace.c:1.25 --- src/sys/arch/sh3/sh3/db_trace.c:1.24 Tue Aug 6 17:41:01 2013 +++ src/sys/arch/sh3/sh3/db_trace.c Fri Nov 8 21:23:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.24 2013/08/06 21:41:01 uwe Exp $ */ +/* $NetBSD: db_trace.c,v 1.25 2013/11/09 02:23:57 christos Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.24 2013/08/06 21:41:01 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.25 2013/11/09 02:23:57 christos Exp $"); #include #include @@ -82,7 +82,6 @@ db_stack_trace_print(db_expr_t addr, boo struct trapframe *tf; db_addr_t callpc, frame, lastframe; uint32_t vbr; - bool kernel_only = true; bool lwpid = false; bool lwpaddr = false; const char *cp; @@ -96,8 +95,6 @@ db_stack_trace_print(db_expr_t addr, boo lwpaddr = true; else if (c == 't') lwpid = true; - else if (c == 'u') - kernel_only = false; } if (lwpaddr && lwpid) {
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: christos Date: Sat Nov 9 21:31:45 UTC 2013 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: fixed unused variable warning To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.61 src/sys/arch/sh3/dev/scif.c:1.62 --- src/sys/arch/sh3/dev/scif.c:1.61 Thu Feb 2 14:43:00 2012 +++ src/sys/arch/sh3/dev/scif.c Sat Nov 9 16:31:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.61 2012/02/02 19:43:00 tls Exp $ */ +/* $NetBSD: scif.c,v 1.62 2013/11/09 21:31:45 christos Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.61 2012/02/02 19:43:00 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.62 2013/11/09 21:31:45 christos Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -695,12 +695,11 @@ static void scif_iflush(struct scif_softc *sc) { int i; - unsigned char c; i = scif_fdr_read() & SCFDR2_RECVCNT; while (i > 0) { - c = scif_frdr_read(); + (void)scif_frdr_read(); scif_ssr_write(scif_ssr_read() & ~(SCSSR2_RDF | SCSSR2_DR)); i--; }
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: skrll Date: Thu Nov 14 13:54:08 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: cache.c Log Message: Removed unused variable To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/sh3/cache.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/sh3/sh3/cache.c diff -u src/sys/arch/sh3/sh3/cache.c:1.17 src/sys/arch/sh3/sh3/cache.c:1.18 --- src/sys/arch/sh3/sh3/cache.c:1.17 Thu Nov 7 21:45:04 2013 +++ src/sys/arch/sh3/sh3/cache.c Thu Nov 14 13:54:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cache.c,v 1.17 2013/11/07 21:45:04 christos Exp $ */ +/* $NetBSD: cache.c,v 1.18 2013/11/14 13:54:08 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.17 2013/11/07 21:45:04 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.18 2013/11/14 13:54:08 skrll Exp $"); #include "opt_cache.h" #include "opt_memsize.h" /* IOM_RAM_BEGIN */ @@ -154,7 +154,6 @@ __cache_flush(void) { volatile int *p = (int *)SH3_PHYS_TO_P1SEG(IOM_RAM_BEGIN); int i; - int d; /* Flush D-Cache */ /* @@ -164,7 +163,7 @@ __cache_flush(void) * 16KB line-size 32B 1-way ... [13:5] */ for (i = 0; i < 256/*entry*/ * 4/*way*/; i++) { - d = *p; + (void)*p; p += 4; /* next line index (16B) */ } __USE(d);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: skrll Date: Mon Nov 18 15:34:06 UTC 2013 Modified Files: src/sys/arch/sh3/sh3: cache.c Log Message: Really remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sh3/sh3/cache.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/sh3/sh3/cache.c diff -u src/sys/arch/sh3/sh3/cache.c:1.18 src/sys/arch/sh3/sh3/cache.c:1.19 --- src/sys/arch/sh3/sh3/cache.c:1.18 Thu Nov 14 13:54:08 2013 +++ src/sys/arch/sh3/sh3/cache.c Mon Nov 18 15:34:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cache.c,v 1.18 2013/11/14 13:54:08 skrll Exp $ */ +/* $NetBSD: cache.c,v 1.19 2013/11/18 15:34:06 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.18 2013/11/14 13:54:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.19 2013/11/18 15:34:06 skrll Exp $"); #include "opt_cache.h" #include "opt_memsize.h" /* IOM_RAM_BEGIN */ @@ -166,7 +166,6 @@ __cache_flush(void) (void)*p; p += 4; /* next line index (16B) */ } - __USE(d); /* Flush I-Cache */ /*
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: christos Date: Thu Mar 20 18:01:19 UTC 2014 Modified Files: src/sys/arch/sh3/sh3: db_disasm.c Log Message: kill sprintf To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/sh3/db_disasm.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/sh3/sh3/db_disasm.c diff -u src/sys/arch/sh3/sh3/db_disasm.c:1.21 src/sys/arch/sh3/sh3/db_disasm.c:1.22 --- src/sys/arch/sh3/sh3/db_disasm.c:1.21 Fri Jun 6 22:43:10 2008 +++ src/sys/arch/sh3/sh3/db_disasm.c Thu Mar 20 14:01:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.21 2008/06/07 02:43:10 uwe Exp $ */ +/* $NetBSD: db_disasm.c,v 1.22 2014/03/20 18:01:19 christos Exp $ */ /* * Copyright (c) 1998-2000 Internet Initiative Japan Inc. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.21 2008/06/07 02:43:10 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2014/03/20 18:01:19 christos Exp $"); #include #include @@ -42,62 +42,62 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c, static uint16_t get_insn(const void *); -static void get_opcode(const uint16_t *, char *); +static void get_opcode(const uint16_t *, char *, size_t); -static void f_02(const uint16_t *, char *); -static void f_03(const uint16_t *, char *); -static void f_04(const uint16_t *, char *); -static void f_08(const uint16_t *, char *); -static void f_09(const uint16_t *, char *); -static void f_0a(const uint16_t *, char *); -static void f_0b(const uint16_t *, char *); -static void f_0c(const uint16_t *, char *); -static void f_10(const uint16_t *, char *); -static void f_20(const uint16_t *, char *); -static void f_24(const uint16_t *, char *); -static void f_28(const uint16_t *, char *); -static void f_2c(const uint16_t *, char *); -static void f_30(const uint16_t *, char *); -static void f_34(const uint16_t *, char *); -static void f_38(const uint16_t *, char *); -static void f_3c(const uint16_t *, char *); -static void f_40(const uint16_t *, char *); -static void f_41(const uint16_t *, char *); -static void f_42(const uint16_t *, char *); -static void f_43(const uint16_t *, char *); -static void f_44(const uint16_t *, char *); -static void f_45(const uint16_t *, char *); -static void f_46(const uint16_t *, char *); -static void f_47(const uint16_t *, char *); -static void f_48(const uint16_t *, char *); -static void f_49(const uint16_t *, char *); -static void f_4a(const uint16_t *, char *); -static void f_4b(const uint16_t *, char *); -static void f_4c(const uint16_t *, char *); -static void f_4d(const uint16_t *, char *); -static void f_4e(const uint16_t *, char *); -static void f_4f(const uint16_t *, char *); -static void f_50(const uint16_t *, char *); -static void f_60(const uint16_t *, char *); -static void f_64(const uint16_t *, char *); -static void f_68(const uint16_t *, char *); -static void f_6c(const uint16_t *, char *); -static void f_70(const uint16_t *, char *); -static void f_80(const uint16_t *, char *); -static void f_90(const uint16_t *, char *); -static void f_a0(const uint16_t *, char *); -static void f_b0(const uint16_t *, char *); -static void f_c0(const uint16_t *, char *); -static void f_d0(const uint16_t *, char *); -static void f_e0(const uint16_t *, char *); -static void f_f0(const uint16_t *, char *); -static void f_f4(const uint16_t *, char *); -static void f_f8(const uint16_t *, char *); -static void f_fc(const uint16_t *, char *); -static void f_fd(const uint16_t *, char *); -static void f_fe(const uint16_t *, char *); +static void f_02(const uint16_t *, char *, size_t); +static void f_03(const uint16_t *, char *, size_t); +static void f_04(const uint16_t *, char *, size_t); +static void f_08(const uint16_t *, char *, size_t); +static void f_09(const uint16_t *, char *, size_t); +static void f_0a(const uint16_t *, char *, size_t); +static void f_0b(const uint16_t *, char *, size_t); +static void f_0c(const uint16_t *, char *, size_t); +static void f_10(const uint16_t *, char *, size_t); +static void f_20(const uint16_t *, char *, size_t); +static void f_24(const uint16_t *, char *, size_t); +static void f_28(const uint16_t *, char *, size_t); +static void f_2c(const uint16_t *, char *, size_t); +static void f_30(const uint16_t *, char *, size_t); +static void f_34(const uint16_t *, char *, size_t); +static void f_38(const uint16_t *, char *, size_t); +static void f_3c(const uint16_t *, char *, size_t); +static void f_40(const uint16_t *, char *, size_t); +static void f_41(const uint16_t *, char *, size_t); +static void f_42(const uint16_t *, char *, size_t); +static void f_43(const uint16_t *, char *, size_t); +static void f_44(const uint16_t *, char *, size_t); +static void f_45(const uint16_t *, char *, size_t); +static void f_46(const uint16_t *, char *, size_t); +static void f_47(const uint16_t *, char *, size_t); +static void f_48
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: christos Date: Wed Nov 29 17:43:20 UTC 2017 Modified Files: src/sys/arch/sh3/include: signal.h Log Message: need for sigset_t To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sh3/include/signal.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/sh3/include/signal.h diff -u src/sys/arch/sh3/include/signal.h:1.13 src/sys/arch/sh3/include/signal.h:1.14 --- src/sys/arch/sh3/include/signal.h:1.13 Wed Nov 19 13:36:00 2008 +++ src/sys/arch/sh3/include/signal.h Wed Nov 29 12:43:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.13 2008/11/19 18:36:00 ad Exp $ */ +/* $NetBSD: signal.h,v 1.14 2017/11/29 17:43:20 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. @@ -39,7 +39,7 @@ typedef int sig_atomic_t; #if defined(_NETBSD_SOURCE) - +#include /* * Information pushed on stack when a signal is delivered. * This is used by the kernel to restore state following
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sun Oct 22 03:29:23 UTC 2017 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: tlb_exception - set ksi_addr to va also when a userland page is not found. Helps SIGSEGV handlers for PROT_NONE red zones. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.65 src/sys/arch/sh3/sh3/exception.c:1.66 --- src/sys/arch/sh3/sh3/exception.c:1.65 Tue Jun 20 23:20:01 2017 +++ src/sys/arch/sh3/sh3/exception.c Sun Oct 22 03:29:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.65 2017/06/20 23:20:01 uwe Exp $ */ +/* $NetBSD: exception.c,v 1.66 2017/10/22 03:29:23 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.65 2017/06/20 23:20:01 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.66 2017/10/22 03:29:23 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -417,6 +417,8 @@ tlb_exception(struct lwp *l, struct trap /* Page not found. */ if (usermode) { KSI_INIT_TRAP(&ksi); + ksi.ksi_addr = (void *)va; + switch (err) { case ENOMEM: ksi.ksi_signo = SIGKILL;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Tue Jun 20 23:20:01 UTC 2017 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: Use vmspace::vm_minsaddr instead of hardcoding USRSTACK. Requested by joerg@. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.64 src/sys/arch/sh3/sh3/exception.c:1.65 --- src/sys/arch/sh3/sh3/exception.c:1.64 Wed Mar 4 09:39:26 2015 +++ src/sys/arch/sh3/sh3/exception.c Tue Jun 20 23:20:01 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $ */ +/* $NetBSD: exception.c,v 1.65 2017/06/20 23:20:01 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.64 2015/03/04 09:39:26 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.65 2017/06/20 23:20:01 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -393,11 +393,11 @@ tlb_exception(struct lwp *l, struct trap /* User stack extension */ if (map != kernel_map && (va >= (vaddr_t)l->l_proc->p_vmspace->vm_maxsaddr) && - (va < USRSTACK)) { + (va < (vaddr_t)l->l_proc->p_vmspace->vm_minsaddr)) { if (err == 0) { struct vmspace *vm = l->l_proc->p_vmspace; uint32_t nss; - nss = btoc(USRSTACK - va); + nss = btoc((vaddr_t)vm->vm_minsaddr - va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (err == EACCES) {
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: cherry Date: Sat Dec 24 17:18:00 UTC 2016 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Use the correct page frame number to steal pages during boot. Fixes the related sh3 kernel build breakage. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.79 src/sys/arch/sh3/sh3/pmap.c:1.80 --- src/sys/arch/sh3/sh3/pmap.c:1.79 Fri Dec 23 07:15:28 2016 +++ src/sys/arch/sh3/sh3/pmap.c Sat Dec 24 17:18:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.79 2016/12/23 07:15:28 cherry Exp $ */ +/* $NetBSD: pmap.c,v 1.80 2016/12/24 17:18:00 cherry Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.79 2016/12/23 07:15:28 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.80 2016/12/24 17:18:00 cherry Exp $"); #include #include @@ -148,7 +148,7 @@ pmap_steal_memory(vsize_t size, vaddr_t /* Steal pages */ pa = ptoa(uvm_physseg_get_start(bank)); - uvm_physseg_unplug(start, npage); + uvm_physseg_unplug(atop(pa), npage); va = SH3_PHYS_TO_P1SEG(pa); memset((void *)va, 0, size);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Thu Feb 2 21:17:40 UTC 2017 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: pmap_steal_memory - s/start/avail_start/ to fix mistake in the hotplug conversion. The kernel now panics (can't unplug memory from the middle of a segment) instead of triggering a reset. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.80 src/sys/arch/sh3/sh3/pmap.c:1.81 --- src/sys/arch/sh3/sh3/pmap.c:1.80 Sat Dec 24 17:18:00 2016 +++ src/sys/arch/sh3/sh3/pmap.c Thu Feb 2 21:17:40 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.80 2016/12/24 17:18:00 cherry Exp $ */ +/* $NetBSD: pmap.c,v 1.81 2017/02/02 21:17:40 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.80 2016/12/24 17:18:00 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.81 2017/02/02 21:17:40 uwe Exp $"); #include #include @@ -147,7 +147,7 @@ pmap_steal_memory(vsize_t size, vaddr_t KDASSERT(uvm_physseg_valid_p(bank)); /* Steal pages */ - pa = ptoa(uvm_physseg_get_start(bank)); + pa = ptoa(uvm_physseg_get_avail_start(bank)); uvm_physseg_unplug(atop(pa), npage); va = SH3_PHYS_TO_P1SEG(pa); memset((void *)va, 0, size);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Thu Feb 2 21:35:29 UTC 2017 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: pmap_steal_memory - a few more s/start/avail_start/ fixes for the hotplug conversion. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.81 src/sys/arch/sh3/sh3/pmap.c:1.82 --- src/sys/arch/sh3/sh3/pmap.c:1.81 Thu Feb 2 21:17:40 2017 +++ src/sys/arch/sh3/sh3/pmap.c Thu Feb 2 21:35:29 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.81 2017/02/02 21:17:40 uwe Exp $ */ +/* $NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.81 2017/02/02 21:17:40 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $"); #include #include @@ -140,7 +140,8 @@ pmap_steal_memory(vsize_t size, vaddr_t for (bank = uvm_physseg_get_first(); uvm_physseg_valid_p(bank); bank = uvm_physseg_get_next(bank)) { - if (npage <= uvm_physseg_get_end(bank) - uvm_physseg_get_start(bank)) + if (npage <= uvm_physseg_get_avail_end(bank) +- uvm_physseg_get_avail_start(bank)) break; }
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Sat Jul 11 03:53:32 UTC 2020 Modified Files: src/sys/arch/sh3/include: clock.h Log Message: Fix doc comment for sh_clock_init. Forgot to update it back in 2006 when sh3 ports were converted to todr(9) and its second argument (struct rtc_ops) was removed. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sh3/include/clock.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/sh3/include/clock.h diff -u src/sys/arch/sh3/include/clock.h:1.4 src/sys/arch/sh3/include/clock.h:1.5 --- src/sys/arch/sh3/include/clock.h:1.4 Mon Apr 28 20:23:35 2008 +++ src/sys/arch/sh3/include/clock.h Sat Jul 11 03:53:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.h,v 1.4 2008/04/28 20:23:35 martin Exp $ */ +/* $NetBSD: clock.h,v 1.5 2020/07/11 03:53:32 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,14 +30,11 @@ */ /* - * void sh_clock_init(int flags, struct rtc_ops *): + * void sh_clock_init(int flags): * flags: * SH_CLOCK_NORTC ... If SH RTC module is disabled, set this. *internal module don't use RTCCLK. * SH_CLOCK_NOINITTODR ... Don't initialize RTC time. - * rtc_ops: - * Machine dependent RTC ops pointer. If NULL is specified, use SH - * internal RTC. * * void machine_clock_init(void): * Implement machine specific part of clock routines.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Sat Jul 25 22:26:59 UTC 2020 Added Files: src/sys/arch/sh3/include: pmb.h Log Message: Definitions for ST40 Privileged Mapping Buffer. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/sh3/include/pmb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/sh3/include/pmb.h diff -u /dev/null src/sys/arch/sh3/include/pmb.h:1.1 --- /dev/null Sat Jul 25 22:26:59 2020 +++ src/sys/arch/sh3/include/pmb.h Sat Jul 25 22:26:59 2020 @@ -0,0 +1,80 @@ +/* $NetBSD: pmb.h,v 1.1 2020/07/25 22:26:59 uwe Exp $ */ +/* + * Copyright (c) 2020 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SH3_PMB_H_ +#define _SH3_PMB_H_ +/* + * ST40 Privileged Mapping Buffer (PMB) + * + * Original SuperH can handle only 29-bit external memory space. + * "The physical address space is permanently mapped onto 29-bit + * external memory space." See . + * + * ST40-200, ST40-300 and ST40-500 have "space enhanced" SE mode where + * the mapping from the physical address space P1 and P2 segments to + * the 32-bit external memory space is defined via 16-entry PMB. + */ + + +/* on ST40-200 and ST40-500 SE bit is in MMUCR */ +#define ST40_MMUCR_SE 0x0010 + + +/* Physical address space control register (ST4-300) */ +#define ST40_PMB_PASCR 0xff70 +#define ST40_PASCR_UB_MASK 0x000f +#define ST40_PASCR_SE 0x8000 + + +/* Memory-mapped PMB */ +#define ST40_PMB_ENTRY 16 + +#define ST40_PMB_E_MASK 0x0f00 +#define ST40_PMB_E_SHIFT 8 + + +/* PMB Address Array */ +#define ST40_PMB_AA 0xf610 +#define ST40_PMB_AA_V 0x0100 +#define ST40_PMB_AA_VPN_MASK 0xff00 +#define ST40_PMB_AA_VPN_SHIFT 24 + + +/* PMB Data Array */ +#define ST40_PMB_DA 0xf710 +#define ST40_PMB_DA_WT 0x0001 +#define ST40_PMB_DA_C 0x0008 +#define ST40_PMB_DA_UB 0x0200 +#define ST40_PMB_DA_SZ_MASK 0x0090 +#define ST40_PMB_DA_SZ_16M 0x +#define ST40_PMB_DA_SZ_64M 0x0010 +#define ST40_PMB_DA_SZ_128M 0x0080 +#define ST40_PMB_DA_SZ_512M 0x0090 +#define ST40_PMB_DA_V 0x0100 +#define ST40_PMB_DA_PPN_MASK 0xff00 +#define ST40_PMB_DA_PPN_SHIFT 24 + +#endif /* !_SH3_PMB_H_ */
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Sat Jul 25 22:59:55 UTC 2020 Modified Files: src/sys/arch/sh3/include: cputypes.h Log Message: Define CPU_PRODUCT_STX7105. I'm not sure if this should rather be named CPU_PRODUCT_ST40_300, but that's probably too general. These constants don't have to be backward compatible, so we can re-do this properly later if we need to. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/include/cputypes.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/sh3/include/cputypes.h diff -u src/sys/arch/sh3/include/cputypes.h:1.12 src/sys/arch/sh3/include/cputypes.h:1.13 --- src/sys/arch/sh3/include/cputypes.h:1.12 Tue Apr 21 12:57:41 2009 +++ src/sys/arch/sh3/include/cputypes.h Sat Jul 25 22:59:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cputypes.h,v 1.12 2009/04/21 12:57:41 nonaka Exp $ */ +/* $NetBSD: cputypes.h,v 1.13 2020/07/25 22:59:55 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -57,6 +57,9 @@ #define CPU_PRODUCT_7751 10 #define CPU_PRODUCT_7751R 11 +/* STMicroelectronics ST40 series (SH4) */ +#define CPU_PRODUCT_STX7105 12 /* ST40-300 */ + #ifndef _LOCORE extern int cpu_arch;
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: skrll Date: Tue Jul 28 01:40:43 UTC 2020 Modified Files: src/sys/arch/sh3/include: cputypes.h Log Message: _LKM -> _MODULE To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sh3/include/cputypes.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/sh3/include/cputypes.h diff -u src/sys/arch/sh3/include/cputypes.h:1.13 src/sys/arch/sh3/include/cputypes.h:1.14 --- src/sys/arch/sh3/include/cputypes.h:1.13 Sat Jul 25 22:59:55 2020 +++ src/sys/arch/sh3/include/cputypes.h Tue Jul 28 01:40:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cputypes.h,v 1.13 2020/07/25 22:59:55 uwe Exp $ */ +/* $NetBSD: cputypes.h,v 1.14 2020/07/28 01:40:43 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -33,8 +33,8 @@ #if defined(_KERNEL_OPT) #include "opt_cputype.h" -#elif defined(_LKM) -/* If building an LKM, include both SH3 and SH4 support. */ +#elif defined(_MODULE) +/* If building a module, include both SH3 and SH4 support. */ #define SH3 #define SH4 #endif
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Thu Jul 30 03:19:34 UTC 2020 Modified Files: src/sys/arch/sh3/include: pmb.h Log Message: Add snprintb formats. Fix PASCR name. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sh3/include/pmb.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/sh3/include/pmb.h diff -u src/sys/arch/sh3/include/pmb.h:1.1 src/sys/arch/sh3/include/pmb.h:1.2 --- src/sys/arch/sh3/include/pmb.h:1.1 Sat Jul 25 22:26:59 2020 +++ src/sys/arch/sh3/include/pmb.h Thu Jul 30 03:19:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmb.h,v 1.1 2020/07/25 22:26:59 uwe Exp $ */ +/* $NetBSD: pmb.h,v 1.2 2020/07/30 03:19:33 uwe Exp $ */ /* * Copyright (c) 2020 Valery Ushakov * All rights reserved. @@ -44,10 +44,15 @@ /* Physical address space control register (ST4-300) */ -#define ST40_PMB_PASCR 0xff70 +#define ST40_PASCR 0xff70 #define ST40_PASCR_UB_MASK 0x000f #define ST40_PASCR_SE 0x8000 +#define ST40_PASCR_BITS \ + "\177\020" \ + "b\037" "SE\0" \ + "f\0\04" "UB\0" + /* Memory-mapped PMB */ #define ST40_PMB_ENTRY 16 @@ -62,6 +67,11 @@ #define ST40_PMB_AA_VPN_MASK 0xff00 #define ST40_PMB_AA_VPN_SHIFT 24 +#define ST40_PMB_AA_BITS \ + "\177\020"\ + "f\030\010" "VPN\0" \ + "b\010" "V\0" + /* PMB Data Array */ #define ST40_PMB_DA 0xf710 @@ -77,4 +87,19 @@ #define ST40_PMB_DA_PPN_MASK 0xff00 #define ST40_PMB_DA_PPN_SHIFT 24 +#define ST40_PMB_DA_BITS \ + "\177\020"\ + "f\030\010" "PPN\0" \ + "b\010" "V\0" \ + "F\04\04" "\0" \ + ":\011" "512M\0" \ + ":\010" "128M\0" \ + ":\01""64M\0" \ + ":\0" "16M\0" \ + "b\011" "UB\0" \ + "b\03" "C\0" \ + "F\0\01""\0" \ + ":\01""WT\0" \ + ":\0" "CB\0" + #endif /* !_SH3_PMB_H_ */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Thu Jul 30 03:57:52 UTC 2020 Added Files: src/sys/arch/sh3/sh3: pmb.c Log Message: Code to dump PMB contents. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/sh3/sh3/pmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/sh3/sh3/pmb.c diff -u /dev/null src/sys/arch/sh3/sh3/pmb.c:1.1 --- /dev/null Thu Jul 30 03:57:52 2020 +++ src/sys/arch/sh3/sh3/pmb.c Thu Jul 30 03:57:52 2020 @@ -0,0 +1,140 @@ +/* $NetBSD: pmb.c,v 1.1 2020/07/30 03:57:52 uwe Exp $ */ +/* + * Copyright (c) 2020 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: pmb.c,v 1.1 2020/07/30 03:57:52 uwe Exp $"); + +#include +#include +#include + +#include +#include +#include + + +void +st40_pmb_init(int product) +{ + int se_mode; + bool have_ub; + uint8_t ub; + char bits[64]; + + switch (product) { + + /* ST40-300 */ + case CPU_PRODUCT_STX7105: { + uint32_t pascr = _reg_read_4(ST40_PASCR); + snprintb(bits, sizeof(bits), ST40_PASCR_BITS, pascr); + printf("PMB: PASCR=%s\n", bits); + + se_mode = (pascr & ST40_PASCR_SE); + have_ub = true; + ub = (uint8_t)(pascr & ST40_PASCR_UB_MASK); + break; + } + +#if 0 + /* ST40-200, ST40-500 */ + case 0xdeadbabe: { + uint32_t mmucr = _reg_read_4(SH4_MMUCR); + + se_mode = (mmucr & ST40_MMUCR_SE); + have_ub = false; + ub = 0; + break; + } +#endif + + /* No PMB */ + default: + return; + } + + if (!se_mode) { + printf("PMB: 29-bit mode\n"); + if (have_ub) { + for (int area = 0; area < 8; ++area) { +bool unbuffered = !!(ub & (1u << area)); +printf("PMB: area%d %s\n", area, + unbuffered ? "UNBUFFERED" : "buffered"); + } + } + return; + } + + printf("PMB: 32-bit mode\n"); + for (unsigned int i = 0; i < ST40_PMB_ENTRY; ++i) { + uint32_t offset = (i << ST40_PMB_E_SHIFT); + + uint32_t addr = _reg_read_4(ST40_PMB_AA + offset); +#if 0 + snprintb(bits, sizeof(bits), ST40_PMB_AA_BITS, addr); + printf("PMB[%02d] A=%s", i, bits); +#endif + uint32_t data = _reg_read_4(ST40_PMB_DA + offset); +#if 0 + snprintb(bits, sizeof(bits), ST40_PMB_DA_BITS, data); + printf(" D=%s\n", bits); +#endif + if ((addr & ST40_PMB_AA_V) == 0) + continue; + + uint32_t vpn = addr & ST40_PMB_AA_VPN_MASK; + uint32_t ppn = data & ST40_PMB_DA_PPN_MASK; + uint32_t szbits = data & ST40_PMB_DA_SZ_MASK; + + vpn >>= ST40_PMB_AA_VPN_SHIFT; + ppn >>= ST40_PMB_DA_PPN_SHIFT; + + unsigned int sz = 0; + switch (szbits) { + case ST40_PMB_DA_SZ_16M: + sz = 1; + break; + case ST40_PMB_DA_SZ_64M: + sz = 4; + break; + case ST40_PMB_DA_SZ_128M: + sz = 8; + break; + case ST40_PMB_DA_SZ_512M: + sz = 32; + break; + } + + printf("PMB[%02d] = %02x..%02x -> %02x..%02x" + " %3uM %s %s %s\n", + i, + vpn, vpn + sz - 1, + ppn, ppn + sz - 1, + sz << 4, + data & ST40_PMB_DA_UB ? "UB" : "--", + data & ST40_PMB_DA_C ? "C" : "-", + data & ST40_PMB_DA_WT ? "WT" : "CB"); + } +}
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Thu Jul 30 20:59:09 UTC 2020 Modified Files: src/sys/arch/sh3/include: pmb.h Log Message: ST40_PMB_DA_BITS - all values for the non-continuous size field. Size field has two reserved bits in the middle. Don't depend on them being zero, they can be defined in future versions. Provide exhaustive list with all possibile "filler" bits in the middle so that we correctly report the size field value regardless of the unrelated bits. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sh3/include/pmb.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/sh3/include/pmb.h diff -u src/sys/arch/sh3/include/pmb.h:1.2 src/sys/arch/sh3/include/pmb.h:1.3 --- src/sys/arch/sh3/include/pmb.h:1.2 Thu Jul 30 03:19:33 2020 +++ src/sys/arch/sh3/include/pmb.h Thu Jul 30 20:59:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmb.h,v 1.2 2020/07/30 03:19:33 uwe Exp $ */ +/* $NetBSD: pmb.h,v 1.3 2020/07/30 20:59:08 uwe Exp $ */ /* * Copyright (c) 2020 Valery Ushakov * All rights reserved. @@ -87,15 +87,31 @@ #define ST40_PMB_DA_PPN_MASK 0xff00 #define ST40_PMB_DA_PPN_SHIFT 24 +/* + * size field is not continuous hence the kludgy list with all the + * possible junk bits in the middle. + */ #define ST40_PMB_DA_BITS \ "\177\020"\ "f\030\010" "PPN\0" \ "b\010" "V\0" \ "F\04\04" "\0" \ + ":\017" "512M\0" \ + ":\016" "128M\0" \ + ":\015" "512M\0" \ + ":\014" "128M\0" \ + ":\013" "512M\0" \ + ":\012" "128M\0" \ ":\011" "512M\0" \ ":\010" "128M\0" \ - ":\01""64M\0" \ - ":\0" "16M\0" \ + ":\007""64M\0" \ + ":\006""16M\0" \ + ":\005""64M\0" \ + ":\004""16M\0" \ + ":\003""64M\0" \ + ":\002""16M\0" \ + ":\001""64M\0" \ + ":\000""16M\0" \ "b\011" "UB\0" \ "b\03" "C\0" \ "F\0\01""\0" \
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: uwe Date: Thu Jul 30 21:25:43 UTC 2020 Modified Files: src/sys/arch/sh3/include: pmb.h Log Message: Publicly declare st40_pmb_init(). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sh3/include/pmb.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/sh3/include/pmb.h diff -u src/sys/arch/sh3/include/pmb.h:1.3 src/sys/arch/sh3/include/pmb.h:1.4 --- src/sys/arch/sh3/include/pmb.h:1.3 Thu Jul 30 20:59:08 2020 +++ src/sys/arch/sh3/include/pmb.h Thu Jul 30 21:25:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmb.h,v 1.3 2020/07/30 20:59:08 uwe Exp $ */ +/* $NetBSD: pmb.h,v 1.4 2020/07/30 21:25:43 uwe Exp $ */ /* * Copyright (c) 2020 Valery Ushakov * All rights reserved. @@ -118,4 +118,9 @@ ":\01""WT\0" \ ":\0" "CB\0" + +#ifndef _LOCORE +void st40_pmb_init(int); +#endif /* !_LOCORE */ + #endif /* !_SH3_PMB_H_ */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Aug 1 20:54:23 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: pmap_unwire - deobfuscate. Don't hide assignments inside if (). Remove redundant entry == 0 test b/c _PG_WIRED test afterwards covers that and the compiler actually elimiates it anyway. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.82 src/sys/arch/sh3/sh3/pmap.c:1.83 --- src/sys/arch/sh3/sh3/pmap.c:1.82 Thu Feb 2 21:35:29 2017 +++ src/sys/arch/sh3/sh3/pmap.c Sat Aug 1 20:54:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $ */ +/* $NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $"); #include #include @@ -736,9 +736,12 @@ pmap_unwire(pmap_t pmap, vaddr_t va) { pt_entry_t *pte, entry; - if ((pte = __pmap_pte_lookup(pmap, va)) == NULL || - (entry = *pte) == 0 || - (entry & _PG_WIRED) == 0) + pte = __pmap_pte_lookup(pmap, va); + if (pte == NULL) + return; + + entry = *pte; + if ((entry & _PG_WIRED) == 0) return; *pte = entry & ~_PG_WIRED;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 01:14:26 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: db_interface.c Log Message: db_cachedump_cmd - call the dump function via P2 directly. Instead of calling RUN_P2 at the very beginning of both cpu-specific cache dump functions just call them via P2 pointers. This effectively just makes db_cachedump_cmd into a shared RUN_P2 code for both of them. Drop RUN_P1 at the end as we are getting back to P1 anyway because that's where the return address is. Any necessary padding is provided by the sh_icache_sync_all() call. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sh3/sh3/db_interface.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/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.61 src/sys/arch/sh3/sh3/db_interface.c:1.62 --- src/sys/arch/sh3/sh3/db_interface.c:1.61 Fri Jan 28 21:06:07 2011 +++ src/sys/arch/sh3/sh3/db_interface.c Mon Aug 3 01:14:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $ */ +/* $NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -447,25 +447,27 @@ static void db_cachedump_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) { + void (*cachedump_p2)(vaddr_t); + #ifdef SH3 if (CPU_IS_SH3) - __db_cachedump_sh3(have_addr ? addr : 0); + cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh3); #endif #ifdef SH4 if (CPU_IS_SH4) - __db_cachedump_sh4(have_addr ? addr : 0); + cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh4); #endif + (*cachedump_p2)(have_addr ? addr : 0); } #ifdef SH3 -static void +static __noinline void __db_cachedump_sh3(vaddr_t va_start) { uint32_t r; vaddr_t va, va_end, cca; int entry, way; - RUN_P2; /* disable cache */ _reg_write_4(SH3_CCR, _reg_read_4(SH3_CCR) & ~SH3_CCR_CE); @@ -497,20 +499,16 @@ __db_cachedump_sh3(vaddr_t va_start) /* enable cache */ _reg_bset_4(SH3_CCR, SH3_CCR_CE); sh_icache_sync_all(); - - RUN_P1; } #endif /* SH3 */ #ifdef SH4 -static void +static __noinline void __db_cachedump_sh4(vaddr_t va) { uint32_t r, e; int i, istart, iend; - RUN_P2; /* must access from P2 */ - /* disable I/D-cache */ _reg_write_4(SH4_CCR, _reg_read_4(SH4_CCR) & ~(SH4_CCR_ICE | SH4_CCR_OCE)); @@ -548,8 +546,6 @@ __db_cachedump_sh4(vaddr_t va) _reg_write_4(SH4_CCR, _reg_read_4(SH4_CCR) | SH4_CCR_ICE | SH4_CCR_OCE); sh_icache_sync_all(); - - RUN_P1; } #endif /* SH4 */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 01:18:45 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: db_interface.c Log Message: Declare __db_cachedump_sh3/sh4 __noinline too. Previous commit only did that for the definitions. Forgot to apply the attribute to the declarations too. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sh3/sh3/db_interface.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/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.62 src/sys/arch/sh3/sh3/db_interface.c:1.63 --- src/sys/arch/sh3/sh3/db_interface.c:1.62 Mon Aug 3 01:14:26 2020 +++ src/sys/arch/sh3/sh3/db_interface.c Mon Aug 3 01:18:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $ */ +/* $NetBSD: db_interface.c,v 1.63 2020/08/03 01:18:45 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.63 2020/08/03 01:18:45 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -74,10 +74,10 @@ static void __db_tlbdump_page_size_sh4(u static void db_cachedump_cmd(db_expr_t, bool, db_expr_t, const char *); #ifdef SH3 -static void __db_cachedump_sh3(vaddr_t); +static __noinline void __db_cachedump_sh3(vaddr_t); #endif #ifdef SH4 -static void __db_cachedump_sh4(vaddr_t); +static __noinline void __db_cachedump_sh4(vaddr_t); #endif static void db_frame_cmd(db_expr_t, bool, db_expr_t, const char *);
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 01:56:19 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: db_interface.c Log Message: db_tlbdump_cmd - get rid of RUN_P2/P1, use functions instead. Move the bits of code to read TLB entries into separate functions and call them via P2 pointers instead of doing P2/P1 switch inline. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sh3/sh3/db_interface.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/sh3/sh3/db_interface.c diff -u src/sys/arch/sh3/sh3/db_interface.c:1.63 src/sys/arch/sh3/sh3/db_interface.c:1.64 --- src/sys/arch/sh3/sh3/db_interface.c:1.63 Mon Aug 3 01:18:45 2020 +++ src/sys/arch/sh3/sh3/db_interface.c Mon Aug 3 01:56:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.63 2020/08/03 01:18:45 uwe Exp $ */ +/* $NetBSD: db_interface.c,v 1.64 2020/08/03 01:56:18 uwe Exp $ */ /*- * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.63 2020/08/03 01:18:45 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64 2020/08/03 01:56:18 uwe Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -66,6 +66,13 @@ db_regs_t ddb_regs; /* register state * static void kdb_printtrap(u_int, int); static void db_tlbdump_cmd(db_expr_t, bool, db_expr_t, const char *); +#ifdef SH4 +static __noinline void +__db_get_itlb_sh4(uint32_t, uint32_t *, uint32_t *, uint32_t *); +static __noinline void +__db_get_utlb_sh4(uint32_t, uint32_t *, uint32_t *, uint32_t *); +#endif + static char *__db_procname_by_asid(int); static void __db_tlbdump_pfn(uint32_t); #ifdef SH4 @@ -320,8 +327,13 @@ db_tlbdump_cmd(db_expr_t addr, bool have #endif /* SH3 */ #ifdef SH4 if (CPU_IS_SH4) { + void (*get_itlb_p2)(uint32_t, uint32_t *, uint32_t *, uint32_t *); + void (*get_utlb_p2)(uint32_t, uint32_t *, uint32_t *, uint32_t *); uint32_t aa, da1, da2; + get_itlb_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_get_itlb_sh4); + get_utlb_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_get_utlb_sh4); + /* MMU configuration */ r = _reg_read_4(SH4_MMUCR); db_printf("%s virtual storage mode, SQ access: (kernel%s)\n", @@ -338,11 +350,7 @@ db_tlbdump_cmd(db_expr_t addr, bool have for (i = 0; i < 4; i++) { e = i << SH4_ITLB_E_SHIFT; - RUN_P2; - aa = _reg_read_4(SH4_ITLB_AA | e); - da1 = _reg_read_4(SH4_ITLB_DA1 | e); - da2 = _reg_read_4(SH4_ITLB_DA2 | e); - RUN_P1; + (*get_itlb_p2)(e, &aa, &da1, &da2); db_printf("0x%08x %3d", aa & SH4_ITLB_AA_VPN_MASK, @@ -367,11 +375,7 @@ db_tlbdump_cmd(db_expr_t addr, bool have for (i = 0; i < 64; i++) { e = i << SH4_UTLB_E_SHIFT; - RUN_P2; - aa = _reg_read_4(SH4_UTLB_AA | e); - da1 = _reg_read_4(SH4_UTLB_DA1 | e); - da2 = _reg_read_4(SH4_UTLB_DA2 | e); - RUN_P1; + (*get_utlb_p2)(e, &aa, &da1, &da2); db_printf("0x%08x %3d", aa & SH4_UTLB_AA_VPN_MASK, @@ -397,6 +401,29 @@ db_tlbdump_cmd(db_expr_t addr, bool have #endif /* SH4 */ } + +#ifdef SH4 +static __noinline void +__db_get_itlb_sh4(uint32_t e, uint32_t *paa, uint32_t *pda1, uint32_t *pda2) +{ + + *paa = _reg_read_4(SH4_ITLB_AA | e); + *pda1 = _reg_read_4(SH4_ITLB_DA1 | e); + *pda2 = _reg_read_4(SH4_ITLB_DA2 | e); +} + + +static __noinline void +__db_get_utlb_sh4(uint32_t e, uint32_t *paa, uint32_t *pda1, uint32_t *pda2) +{ + + *paa = _reg_read_4(SH4_UTLB_AA | e); + *pda1 = _reg_read_4(SH4_UTLB_DA1 | e); + *pda2 = _reg_read_4(SH4_UTLB_DA2 | e); +} +#endif /* SH4 */ + + static void __db_tlbdump_pfn(uint32_t r) {
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 03:34:11 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: locore_subr.S Log Message: _cpu_exception_suspend, _cpu_exception_resume - cosmetics Use PSL_BL instead of magic hex in comments. Use spaces between operands. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.58 src/sys/arch/sh3/sh3/locore_subr.S:1.59 --- src/sys/arch/sh3/sh3/locore_subr.S:1.58 Wed Jan 8 20:59:19 2020 +++ src/sys/arch/sh3/sh3/locore_subr.S Mon Aug 3 03:34:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.58 2020/01/08 20:59:19 skrll Exp $ */ +/* $NetBSD: locore_subr.S,v 1.59 2020/08/03 03:34:11 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.58 2020/01/08 20:59:19 skrll Exp $") +__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.59 2020/08/03 03:34:11 uwe Exp $") /* @@ -298,15 +298,15 @@ NENTRY(_cpu_intr_resume) * if exception occur, jump to 0xa000 (hard reset). */ NENTRY(_cpu_exception_suspend) - stc sr, r0 /* r0 = SR */ - mov #0x10, r1 - swap.b r1, r1 - mov r0, r2 /* r2 = r0 */ - swap.w r1, r1 /* r1 = 0x1000 */ - or r1, r2 /* r2 |= 0x1000 */ - ldc r2, sr /* SR = r2 */ + stc sr, r0 /* r0 = SR */ + mov #0x10, r1 /* bswap32(PSL_BL) - fits immediate */ + swap.b r1, r1 + mov r0, r2 /* r2 = r0 */ + swap.w r1, r1 /* r1 = PSL_BL */ + or r1, r2 /* r2 |= PSL_BL */ + ldc r2, sr /* SR = r2 */ rts - and r1, r0 /* r0 &= 0x1000 */ + and r1, r0 /* r0 &= 0x1000 */ SET_ENTRY_SIZE(_cpu_exception_suspend) @@ -315,14 +315,14 @@ NENTRY(_cpu_exception_suspend) * restore 's' exception mask. (SR.BL) */ NENTRY(_cpu_exception_resume) - stc sr, r0 /* r0 = SR */ - mov #0x10, r1 - swap.b r1, r1 - swap.w r1, r1 - not r1, r1 /* r1 = ~0x1000 */ - and r1, r0 /* r0 &= ~0x1000 */ - or r4, r0 /* r0 |= old SR.BL */ - ldc r0, sr /* SR = r0 (don't move to delay slot) */ + stc sr, r0 /* r0 = SR */ + mov #0x10, r1 /* bswap32(PSL_BL) - fits immediate */ + swap.b r1, r1 + swap.w r1, r1 + not r1, r1 /* r1 = ~PSL_BL */ + and r1, r0 /* r0 &= ~PSL_BL */ + or r4, r0 /* r0 |= old SR.BL */ + ldc r0, sr /* SR = r0 (don't move to delay slot) */ rts nop SET_ENTRY_SIZE(_cpu_exception_resume)
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 19:08:55 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: mmu_sh4.c Log Message: Split compound assertion into several, one for each term. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/sh3/mmu_sh4.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/sh3/sh3/mmu_sh4.c diff -u src/sys/arch/sh3/sh3/mmu_sh4.c:1.15 src/sys/arch/sh3/sh3/mmu_sh4.c:1.16 --- src/sys/arch/sh3/sh3/mmu_sh4.c:1.15 Mon Aug 3 16:43:44 2020 +++ src/sys/arch/sh3/sh3/mmu_sh4.c Mon Aug 3 19:08:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mmu_sh4.c,v 1.15 2020/08/03 16:43:44 uwe Exp $ */ +/* $NetBSD: mmu_sh4.c,v 1.16 2020/08/03 19:08:55 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.15 2020/08/03 16:43:44 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.16 2020/08/03 19:08:55 uwe Exp $"); #include #include @@ -155,7 +155,9 @@ sh4_tlb_update(int asid, vaddr_t va, uin uint32_t ptel; int sr; - KDASSERT(asid < 0x100 && (pte & ~PGOFSET) != 0 && va != 0); + KDASSERT(asid < 0x100); + KDASSERT(va != 0); + KDASSERT((pte & ~PGOFSET) != 0); sr = _cpu_exception_suspend(); /* Save old ASID */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 19:24:29 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: mmu_sh4.c Log Message: sh4_tlb_invalidate_addr - use the right constant. VPN mask happens to be the same in many registers, but since we are writing the value to UTLB data array, use that particular constant for consistency. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/sh3/mmu_sh4.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/sh3/sh3/mmu_sh4.c diff -u src/sys/arch/sh3/sh3/mmu_sh4.c:1.16 src/sys/arch/sh3/sh3/mmu_sh4.c:1.17 --- src/sys/arch/sh3/sh3/mmu_sh4.c:1.16 Mon Aug 3 19:08:55 2020 +++ src/sys/arch/sh3/sh3/mmu_sh4.c Mon Aug 3 19:24:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mmu_sh4.c,v 1.16 2020/08/03 19:08:55 uwe Exp $ */ +/* $NetBSD: mmu_sh4.c,v 1.17 2020/08/03 19:24:28 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.16 2020/08/03 19:08:55 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.17 2020/08/03 19:24:28 uwe Exp $"); #include #include @@ -83,7 +83,7 @@ sh4_tlb_invalidate_addr(int asid, vaddr_ uint32_t pteh; int sr; - va &= SH4_PTEH_VPN_MASK; + va &= SH4_UTLB_AA_VPN_MASK; sr = _cpu_exception_suspend(); /* Save current ASID */
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Mon Aug 3 22:28:39 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: mmu_sh4.c Log Message: sh4_tlb_invalidate_addr - refactor to avoid RUN_P2. Introduce __sh4_tlb_assoc that performs the associative write. Call it from sh4_tlb_invalidate_addr. In sh4_tlb_update do not call sh4_tlb_invalidate_addr, call __sh4_tlb_assoc directly. We need to do the song and dance to block exceptions and set PTEH anyway for the new value, so don't waste all that effort. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/sh3/mmu_sh4.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/sh3/sh3/mmu_sh4.c diff -u src/sys/arch/sh3/sh3/mmu_sh4.c:1.17 src/sys/arch/sh3/sh3/mmu_sh4.c:1.18 --- src/sys/arch/sh3/sh3/mmu_sh4.c:1.17 Mon Aug 3 19:24:28 2020 +++ src/sys/arch/sh3/sh3/mmu_sh4.c Mon Aug 3 22:28:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mmu_sh4.c,v 1.17 2020/08/03 19:24:28 uwe Exp $ */ +/* $NetBSD: mmu_sh4.c,v 1.18 2020/08/03 22:28:39 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.17 2020/08/03 19:24:28 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.18 2020/08/03 22:28:39 uwe Exp $"); #include #include @@ -39,6 +39,8 @@ __KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v #include #include +static __noinline void __sh4_tlb_assoc(uint32_t); + #define SH4_MMU_HAZARD __asm volatile("nop;nop;nop;nop;nop;nop;nop;nop;") /* Must be inlined because we "call" it while running on P2 */ @@ -77,30 +79,43 @@ sh4_mmu_start(void) SH4_MMU_HAZARD; } + +/* + * Perform associative write to UTLB. Must be called via its P2 + * address. Note, the ASID match is against PTEH, not "va". The + * caller is responsible for saving/setting/restoring PTEH. + */ +static __noinline void +__sh4_tlb_assoc(uint32_t va) +{ + + _reg_write_4(SH4_UTLB_AA | SH4_UTLB_A, va); + PAD_P1_SWITCH; +} + + void sh4_tlb_invalidate_addr(int asid, vaddr_t va) { - uint32_t pteh; - int sr; + void (*tlb_assoc_p2)(uint32_t); + uint32_t opteh; + uint32_t sr; + + tlb_assoc_p2 = SH3_P2SEG_FUNC(__sh4_tlb_assoc); va &= SH4_UTLB_AA_VPN_MASK; + sr = _cpu_exception_suspend(); + opteh = _reg_read_4(SH4_PTEH); /* save current ASID */ - /* Save current ASID */ - pteh = _reg_read_4(SH4_PTEH); - /* Set ASID for associative write */ - _reg_write_4(SH4_PTEH, asid); - - /* Associative write(UTLB/ITLB). not required ITLB invalidate. */ - RUN_P2; - _reg_write_4(SH4_UTLB_AA | SH4_UTLB_A, va); /* Clear D, V */ - RUN_P1; - /* Restore ASID */ - _reg_write_4(SH4_PTEH, pteh); + _reg_write_4(SH4_PTEH, asid); /* set ASID for associative write */ + (*tlb_assoc_p2)(va); /* invalidate { va, ASID } entry if exists */ + _reg_write_4(SH4_PTEH, opteh); /* restore ASID */ _cpu_set_sr(sr); } + void sh4_tlb_invalidate_asid(int asid) { @@ -151,36 +166,37 @@ sh4_tlb_invalidate_all(void) void sh4_tlb_update(int asid, vaddr_t va, uint32_t pte) { - uint32_t oasid; - uint32_t ptel; - int sr; + void (*tlb_assoc_p2)(uint32_t); + uint32_t opteh, ptel; + uint32_t sr; KDASSERT(asid < 0x100); KDASSERT(va != 0); KDASSERT((pte & ~PGOFSET) != 0); - sr = _cpu_exception_suspend(); - /* Save old ASID */ - oasid = _reg_read_4(SH4_PTEH) & SH4_PTEH_ASID_MASK; + tlb_assoc_p2 = SH3_P2SEG_FUNC(__sh4_tlb_assoc); - /* Invalidate old entry (if any) */ - sh4_tlb_invalidate_addr(asid, va); + sr = _cpu_exception_suspend(); + opteh = _reg_read_4(SH4_PTEH); /* save old ASID */ - _reg_write_4(SH4_PTEH, asid); - /* Load new entry */ + /* + * Invalidate { va, ASID } entry if exists. Only ASID is + * matched in PTEH, but set the va part too for ldtlb below. + */ _reg_write_4(SH4_PTEH, (va & ~PGOFSET) | asid); + (*tlb_assoc_p2)(va & SH4_UTLB_AA_VPN_MASK); + + /* Load new entry (PTEH is already set) */ ptel = pte & PG_HW_BITS; + _reg_write_4(SH4_PTEL, ptel); if (pte & _PG_PCMCIA) { _reg_write_4(SH4_PTEA, (pte >> _PG_PCMCIA_SHIFT) & SH4_PTEA_SA_MASK); } else { _reg_write_4(SH4_PTEA, 0); } - _reg_write_4(SH4_PTEL, ptel); __asm volatile("ldtlb; nop"); - /* Restore old ASID */ - if (asid != oasid) - _reg_write_4(SH4_PTEH, oasid); + _reg_write_4(SH4_PTEH, opteh); /* restore old ASID */ _cpu_set_sr(sr); }