CVS commit: [matt-nb5-mips64] src/common/lib/libc/string
Module Name:src Committed By: matt Date: Sun Aug 23 06:40:49 UTC 2009 Modified Files: src/common/lib/libc/string [matt-nb5-mips64]: memset2.c Log Message: Add a unit test to this file. Fix two bugs. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/common/lib/libc/string/memset2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/string/memset2.c diff -u src/common/lib/libc/string/memset2.c:1.1.2.1 src/common/lib/libc/string/memset2.c:1.1.2.2 --- src/common/lib/libc/string/memset2.c:1.1.2.1 Mon Aug 17 17:24:25 2009 +++ src/common/lib/libc/string/memset2.c Sun Aug 23 06:40:49 2009 @@ -42,25 +42,37 @@ #include #include +#ifdef TEST +#include +#define _DIAGASSERT(a) assert(a) +#endif + #ifdef _FORTIFY_SOURCE #undef bzero #undef memset #endif #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: memset2.c,v 1.1.2.1 2009/08/17 17:24:25 matt Exp $"); +__RCSID("$NetBSD: memset2.c,v 1.1.2.2 2009/08/23 06:40:49 matt Exp $"); #endif /* LIBC_SCCS and not lint */ /* - * Assume register_t is the widest non-synthetic type. + * Assume uregister_t is the widest non-synthetic unsigned type. */ -typedef register_t memword_t; +typedef uregister_t memword_t; #ifdef BZERO static inline #define memset memset0 #endif +#ifdef TEST +static +#define memset test_memset +#endif + +CTASSERT((~(memword_t)0U >> 1) != ~(memword_t)0U); + void * memset(void *addr, int c, size_t len) { @@ -104,7 +116,7 @@ keep_mask = ~(memword_t)0U << (fill_count * 8); #endif #if BYTE_ORDER == LITTLE_ENDIAN - keep_mask = ~(memword_t)0U << (fill_count * 8); + keep_mask = ~(memword_t)0U >> (fill_count * 8); #endif /* * Make sure dstp is aligned to a memword_t boundary. @@ -133,14 +145,19 @@ */ dstp++; keep_mask = 0; + } else { + len += (uintptr_t)addr & (sizeof(memword_t) - 1); } #else /* __OPTIMIZE_SIZE__ */ uint8_t *dp, *ep; + if (len < fill_count) + fill_count = len; for (dp = (uint8_t *)dstp, ep = dp + fill_count; dp != ep; dp++) *dp = fill; + if ((len -= fill_count) == 0) + return addr; dstp = (memword_t *)ep; - len -= fill_count; #endif /* __OPTIMIZE_SIZE__ */ } @@ -172,10 +189,10 @@ * space in the first word. */ #if BYTE_ORDER == BIG_ENDIAN - keep_mask |= ~(~(memword_t)0U >> (len * 8)); + keep_mask |= ~(memword_t)0U >> (len * 8); #endif #if BYTE_ORDER == LITTLE_ENDIAN - keep_mask |= ~(~(memword_t)0U << (len * 8)); + keep_mask |= ~(memword_t)0U << (len * 8); #endif /* * Now we mask off the bytes we are filling and then fill in @@ -206,3 +223,53 @@ memset(addr, 0, len); } #endif + +#ifdef TEST +#include +#include + +#undef memset + +static union { + uint8_t bytes[sizeof(memword_t) * 4]; + memword_t words[4]; +} testmem; + +int +main(int argc, char **argv) +{ + size_t start; + size_t len; + bool failed = false; + + for (start = 1; start < sizeof(testmem) - 1; start++) { + for (len = 1; start + len < sizeof(testmem) - 1; len++) { + bool ok = true; + size_t i; + uint8_t check_value; + memset(testmem.bytes, 0xff, sizeof(testmem)); + test_memset(testmem.bytes + start, 0x00, len); + for (i = 0; i < sizeof(testmem); i++) { +if (i == 0 || i == start + len) + check_value = 0xff; +else if (i == start) + check_value = 0x00; +if (testmem.bytes[i] != check_value) { + if (ok) + printf("pass @ %zu .. %zu failed", + start, start + len - 1); + ok = false; + printf(" [%zu]=0x%02x(!0x%02x)", + i, testmem.bytes[i], check_value); +} + } + if (!ok) { +printf("\n"); +failed = 1; + } + } + } + + return failed ? 1 : 0; +} +#endif /* TEST */
CVS commit: [matt-nb5-mips64] src/sys
Module Name:src Committed By: matt Date: Sun Aug 23 06:38:08 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: types.h src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c mips_machdep.c pmap.c src/sys/uvm [matt-nb5-mips64]: uvm_map.c uvm_unix.c Log Message: PRIxVADDR, PRIdVSIZE, PRIxVSIZE, or PRIxPADDR as appropriate. Use __intXX_t or __uintXX_t as appropriate in To generate a diff of this commit: cvs rdiff -u -r1.43.36.3 -r1.43.36.4 src/sys/arch/mips/include/types.h cvs rdiff -u -r1.19 -r1.19.62.1 src/sys/arch/mips/mips/db_disasm.c cvs rdiff -u -r1.205.4.1.2.1.2.3 -r1.205.4.1.2.1.2.4 \ src/sys/arch/mips/mips/mips_machdep.c cvs rdiff -u -r1.179.16.1 -r1.179.16.2 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.263.4.3 -r1.263.4.3.4.1 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.40 -r1.40.28.1 src/sys/uvm/uvm_unix.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/mips/include/types.h diff -u src/sys/arch/mips/include/types.h:1.43.36.3 src/sys/arch/mips/include/types.h:1.43.36.4 --- src/sys/arch/mips/include/types.h:1.43.36.3 Sun Aug 23 03:38:19 2009 +++ src/sys/arch/mips/include/types.h Sun Aug 23 06:38:07 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.43.36.3 2009/08/23 03:38:19 matt Exp $ */ +/* $NetBSD: types.h,v 1.43.36.4 2009/08/23 06:38:07 matt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -47,53 +47,56 @@ * the rest of the operating system as possible. */ -#if defined(__mips_n32) -typedef long long mips_reg_t; -typedef unsigned long long mips_ureg_t; -typedef long long mips_fpreg_t; -#else -#if defined(__mips_o64) || defined(__mips_o32) -typedef int mips_fpreg_t; -#else -typedef long mips_fpreg_t; -#endif -typedef long mips_reg_t; -typedef unsigned long mips_ureg_t; -#endif /* NB: This should probably be if defined(_KERNEL) */ #if defined(_NETBSD_SOURCE) -#if defined(_MIPS_PADDR_T_64BIT) && !defined(_LP64) -typedef unsigned long long paddr_t; -typedef unsigned long long psize_t; -#define PRIxPADDR "llx" -#define PRIxPSIZE "llx" +#if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64) +typedef __uint64_t paddr_t; +typedef __uint64_t psize_t; +#define PRIxPADDR PRIx64 +#define PRIxPSIZE PRIx64 +#define PRIdPSIZE PRId64 #else -typedef unsigned long paddr_t; -typedef unsigned long psize_t; -#define PRIxPADDR "lx" -#define PRIxPSIZE "lx" -#endif -typedef unsigned long vaddr_t; -typedef unsigned long vsize_t; -#define PRIxVADDR "lx" -#define PRIxVSIZE "lx" +typedef __uint32_t paddr_t; +typedef __uint32_t psize_t; +#define PRIxPADDR PRIx32 +#define PRIxPSIZE PRIx32 +#define PRIdPSIZE PRId32 +#endif +typedef __uint32_t vaddr_t; +typedef __uint32_t vsize_t; +#define PRIxVADDR PRIx32 +#define PRIxVSIZE PRIx32 +#define PRIdVSIZE PRId32 #endif /* Make sure this is signed; we need pointers to be sign-extended. */ -#if defined(__mips_n32) -typedef long register32_t; -typedef long long register_t; -#define PRIxREGISTER32 "lx" -#define PRIxREGISTER "llx" +#if defined(__mips_o64) || defined(__mips_o32) +typedef __uint32_t fpregister_t; +typedef __uint32_t mips_fpreg_t; /* do not use */ +#else +typedef __uint64_t fpregister_t; +typedef __uint64_t mips_fpreg_t; /* do not use */ +#endif +#if defined(__mips_o32) +typedef __int32_t register_t; +typedef __uint32_t uregister_t; +typedef __int32_t mips_reg_t; /* do not use */ +typedef __uint32_t mips_ureg_t; /* do not use */ +#define PRIxREGISTER PRIx32 +#define PRIxUREGISTER PRIx32 #else -#if !defined(__mips_o32) -typedef int register32_t; -#define PRIxREGISTER32 "x" -#endif -#define PRIxREGISTER "lx" -typedef long register_t; -#endif /* __mips_n32 */ +typedef __int64_t register_t; +typedef __uint64_t uregister_t; +typedef __int64_t mips_reg_t; /* do not use */ +typedef __uint64_t mips_ureg_t; /* do not use */ +typedef __int32_t register32_t; +typedef __uint32_t uregister32_t; +#define PRIxREGISTER32 PRIx32 +#define PRIxUREGISTER32 PRIx32 +#define PRIxREGISTER PRIx64 +#define PRIxUREGISTER PRIx64 +#endif /* __mips_o32 */ #if defined(_KERNEL) typedef struct label_t { Index: src/sys/arch/mips/mips/db_disasm.c diff -u src/sys/arch/mips/mips/db_disasm.c:1.19 src/sys/arch/mips/mips/db_disasm.c:1.19.62.1 --- src/sys/arch/mips/mips/db_disasm.c:1.19 Wed Feb 28 04:21:53 2007 +++ src/sys/arch/mips/mips/db_disasm.c Sun Aug 23 06:38:07 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.19 2007/02/28 04:21:53 thorpej Exp $ */ +/* $NetBSD: db_disasm.c,v 1.19.62.1 2009/08/23 06:38:07 matt Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2007/02/28 04:21:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19.62.1 2009/08/23 06:38:07 matt Exp $"); #include #include @@ -509,8 +509,8 @@ db_printf("%s", symname); else db_printf("<%s+%lx>", symname, diff); - db_printf("\t[ad
CVS commit: [matt-nb5-mips64] src/sys/sys
Module Name:src Committed By: matt Date: Sun Aug 23 06:35:20 UTC 2009 Modified Files: src/sys/sys [matt-nb5-mips64]: exec.h Log Message: Change various u_long to vaddr_t or vsize_t as appropriate. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.124.10.1 src/sys/sys/exec.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/sys/exec.h diff -u src/sys/sys/exec.h:1.124 src/sys/sys/exec.h:1.124.10.1 --- src/sys/sys/exec.h:1.124 Wed Jul 2 17:28:57 2008 +++ src/sys/sys/exec.h Sun Aug 23 06:35:19 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.h,v 1.124 2008/07/02 17:28:57 ad Exp $ */ +/* $NetBSD: exec.h,v 1.124.10.1 2009/08/23 06:35:19 matt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -150,7 +150,7 @@ int (*es_copyargs)(struct lwp *, struct exec_package *, struct ps_strings *, char **, void *); /* Set registers before execution */ - void (*es_setregs)(struct lwp *, struct exec_package *, u_long); + void (*es_setregs)(struct lwp *, struct exec_package *, vaddr_t); /* Dump core */ int (*es_coredump)(struct lwp *, void *); int (*es_setup_stack)(struct lwp *, struct exec_package *); @@ -178,14 +178,14 @@ struct exec_vmcmd_set ep_vmcmds; /* vmcmds used to build vmspace */ struct vnode *ep_vp; /* executable's vnode */ struct vattr *ep_vap; /* executable's attributes */ - u_long ep_taddr; /* process's text address */ - u_long ep_tsize; /* size of process's text */ - u_long ep_daddr; /* process's data(+bss) address */ - u_long ep_dsize; /* size of process's data(+bss) */ - u_long ep_maxsaddr; /* proc's max stack addr ("top") */ - u_long ep_minsaddr; /* proc's min stack addr ("bottom") */ - u_long ep_ssize; /* size of process's stack */ - u_long ep_entry; /* process's entry point */ + vaddr_t ep_taddr; /* process's text address */ + vsize_t ep_tsize; /* size of process's text */ + vaddr_t ep_daddr; /* process's data(+bss) address */ + vsize_t ep_dsize; /* size of process's data(+bss) */ + vaddr_t ep_maxsaddr; /* proc's max stack addr ("top") */ + vaddr_t ep_minsaddr; /* proc's min stack addr ("bottom") */ + vsize_t ep_ssize; /* size of process's stack */ + vaddr_t ep_entry; /* process's entry point */ vaddr_t ep_vm_minaddr; /* bottom of process address space */ vaddr_t ep_vm_maxaddr; /* top of process address space */ u_int ep_flags; /* flags; see below. */ @@ -212,10 +212,10 @@ struct exec_vmcmd { int (*ev_proc)(struct lwp *, struct exec_vmcmd *); /* procedure to run for region of vmspace */ - u_long ev_len; /* length of the segment to map */ - u_long ev_addr; /* address in the vmspace to place it at */ + vsize_t ev_len; /* length of the segment to map */ + vaddr_t ev_addr; /* address in the vmspace to place it at */ struct vnode *ev_vp; /* vnode pointer for the file w/the data */ - u_long ev_offset; /* offset in the file for the data */ + vsize_t ev_offset; /* offset in the file for the data */ u_int ev_prot; /* protections for segment */ int ev_flags; #define VMCMD_RELATIVE 0x0001 /* ev_addr is relative to base entry */
CVS commit: [matt-nb5-mips64] src/sys/arch/mips
Module Name:src Committed By: uebayasi Date: Sun Aug 23 04:38:34 UTC 2009 Modified Files: src/sys/arch/mips/conf [matt-nb5-mips64]: files.mips src/sys/arch/mips/mips [matt-nb5-mips64]: db_trace.c trap.c Log Message: Make ddb(4) trace work on 64-bit ABIs. For now: - Values are shown in 32-bit. - Only 4 arguments are shown. - DDB_TRACE (heuristic version) is left as is. Reviewed By:matt To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.58.24.1 src/sys/arch/mips/conf/files.mips cvs rdiff -u -r1.35.38.1 -r1.35.38.2 src/sys/arch/mips/mips/db_trace.c cvs rdiff -u -r1.217.12.3 -r1.217.12.4 src/sys/arch/mips/mips/trap.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/mips/conf/files.mips diff -u src/sys/arch/mips/conf/files.mips:1.58 src/sys/arch/mips/conf/files.mips:1.58.24.1 --- src/sys/arch/mips/conf/files.mips:1.58 Fri Jan 25 21:12:12 2008 +++ src/sys/arch/mips/conf/files.mips Sun Aug 23 04:38:34 2009 @@ -1,4 +1,4 @@ -# $NetBSD: files.mips,v 1.58 2008/01/25 21:12:12 joerg Exp $ +# $NetBSD: files.mips,v 1.58.24.1 2009/08/23 04:38:34 uebayasi Exp $ # defflag opt_cputype.h NOFPU @@ -15,6 +15,8 @@ ENABLE_MIPS4_CACHE_R10K defflag opt_mips3_wired.h ENABLE_MIPS3_WIRED_MAP +defflag opt_ddb.h DDB_TRACE + file arch/mips/mips/locore_mips1.S mips1 file arch/mips/mips/locore_mips3.S mips3 | mips4 | mips32 | mips64 file arch/mips/mips/mips3_subr.S (mips3 | mips4) & !mips3_5900 Index: src/sys/arch/mips/mips/db_trace.c diff -u src/sys/arch/mips/mips/db_trace.c:1.35.38.1 src/sys/arch/mips/mips/db_trace.c:1.35.38.2 --- src/sys/arch/mips/mips/db_trace.c:1.35.38.1 Fri Aug 21 17:44:08 2009 +++ src/sys/arch/mips/mips/db_trace.c Sun Aug 23 04:38:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.35.38.1 2009/08/21 17:44:08 matt Exp $ */ +/* $NetBSD: db_trace.c,v 1.35.38.2 2009/08/23 04:38:34 uebayasi Exp $ */ /* * Mach Operating System @@ -27,7 +27,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35.38.1 2009/08/21 17:44:08 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35.38.2 2009/08/23 04:38:34 uebayasi Exp $"); + +#include "opt_ddb.h" #include #include @@ -186,7 +188,7 @@ #define MIPS_JR_RA 0x03e8 /* instruction code for jr ra */ #define MIPS_JR_K0 0x0348 /* instruction code for jr k0 */ #define MIPS_ERET 0x4218 /* instruction code for eret */ - unsigned va, pc, ra, sp, func; + register_t va, pc, ra, sp, func; int insn; InstFmt i; int stacksize; @@ -201,24 +203,24 @@ va = pc; do { va -= sizeof(int); - insn = *(int *)va; + insn = *(int *)(intptr_t)va; if (insn == MIPS_ERET) goto mips3_eret; } while (insn != MIPS_JR_RA && insn != MIPS_JR_K0); va += sizeof(int); mips3_eret: va += sizeof(int); - while (*(int *)va == 0x) + while (*(int *)(intptr_t)va == 0x) va += sizeof(int); func = va; stacksize = 0; do { - i.word = *(int *)va; - if (i.IType.op == OP_SW + i.word = *(int *)(intptr_t)va; + if (((i.IType.op == OP_SW) || (i.IType.op == OP_SD)) && i.IType.rs == _R_SP && i.IType.rt == _R_RA) -ra = *(int *)(sp + (short)i.IType.imm); - if (i.IType.op == OP_ADDIU +ra = *(int *)(intptr_t)(sp + (short)i.IType.imm); + if (((i.IType.op == OP_ADDIU) || (i.IType.op == OP_DADDIU)) && i.IType.rs == _R_SP && i.IType.rt == _R_SP) stacksize = -(short)i.IType.imm; @@ -229,7 +231,7 @@ if (name == 0) name = "?"; (*pr)("%s()+0x%x, called by %p, stack size %d\n", - name, pc - func, (void *)ra, stacksize); + name, pc - func, (void *)(intptr_t)ra, stacksize); if (ra == pc) { (*pr)("-- loop? --\n"); @@ -237,7 +239,7 @@ } sp += stacksize; pc = ra; - } while (pc > (unsigned)verylocore); + } while (pc > (intptr_t)verylocore); if (pc < 0x8000) (*pr)("-- user process --\n"); else Index: src/sys/arch/mips/mips/trap.c diff -u src/sys/arch/mips/mips/trap.c:1.217.12.3 src/sys/arch/mips/mips/trap.c:1.217.12.4 --- src/sys/arch/mips/mips/trap.c:1.217.12.3 Sun Aug 23 04:06:01 2009 +++ src/sys/arch/mips/mips/trap.c Sun Aug 23 04:38:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.217.12.3 2009/08/23 04:06:01 matt Exp $ */ +/* $NetBSD: trap.c,v 1.217.12.4 2009/08/23 04:38:34 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -78,7 +78,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.3 2009/08/23 04:06:01 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.4 2009/08/23 04:38:34 uebayasi Exp $"); #include "opt_cputype.h" /* which mips CPU levels do we support? */ #include "opt_ddb.h" @@ -664,7 +664,7 @@ #ifndef DDB_TRACE #if defined(DEBUG) || defined(DDB) || defined(KGDB) || defined(geo) -mips_reg_t kdbrpeek(vaddr_t); +mips_reg_t kdbrpeek(vaddr_t, size_t); int kdbpeek(vaddr_t addr) @@ -686,11 +686,1
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips
Module Name:src Committed By: matt Date: Sun Aug 23 04:06:01 UTC 2009 Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c vm_machdep.c Log Message: Deal with fp save/restore changes. Remove some more unneeded casts in trap. To generate a diff of this commit: cvs rdiff -u -r1.217.12.2 -r1.217.12.3 src/sys/arch/mips/mips/trap.c cvs rdiff -u -r1.121.6.1.2.1 -r1.121.6.1.2.2 \ src/sys/arch/mips/mips/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/mips/mips/trap.c diff -u src/sys/arch/mips/mips/trap.c:1.217.12.2 src/sys/arch/mips/mips/trap.c:1.217.12.3 --- src/sys/arch/mips/mips/trap.c:1.217.12.2 Fri Aug 21 17:45:19 2009 +++ src/sys/arch/mips/mips/trap.c Sun Aug 23 04:06:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.217.12.2 2009/08/21 17:45:19 matt Exp $ */ +/* $NetBSD: trap.c,v 1.217.12.3 2009/08/23 04:06:01 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -78,7 +78,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.2 2009/08/21 17:45:19 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.217.12.3 2009/08/23 04:06:01 matt Exp $"); #include "opt_cputype.h" /* which mips CPU levels do we support? */ #include "opt_ddb.h" @@ -454,7 +454,7 @@ case T_BREAK: #if defined(DDB) - kdb_trap(type, (mips_reg_t *) frame); + kdb_trap(type, frame->tf_regs); return; /* KERN */ #elif defined(KGDB) { @@ -469,13 +469,13 @@ * that db_machdep.h macros will work with it, and * allow gdb to alter the PC. */ - db_set_ddb_regs(type, (mips_reg_t *) frame); + db_set_ddb_regs(type, frame->f_regs); PC_BREAK_ADVANCE(f); if (!kgdb_trap(type, &ddb_regs)) printf("kgdb: ignored %s\n", trap_type[TRAPTYPE(cause)]); else -((mips_reg_t *)frame)[21] = f->f_regs[_R_PC]; +frame->tf_regs[TF_EPC] = f->f_regs[_R_PC]; return; } @@ -535,14 +535,10 @@ case T_COP_UNUSABLE+T_USER: #if !defined(SOFTFLOAT) && !defined(NOFPU) if ((cause & MIPS_CR_COP_ERR) == 0x1000) { - struct frame *f; - - f = l->l_md.md_regs; - savefpregs(fpcurlwp); /* yield FPA */ + savefpregs(fpcurlwp); /* yield FPA */ loadfpregs(l); /* load FPA */ fpcurlwp = l; l->l_md.md_flags |= MDP_FPUSED; - f->f_regs[_R_SR] |= MIPS_SR_COP_1_BIT; } else #endif { Index: src/sys/arch/mips/mips/vm_machdep.c diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.1 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.2 --- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.1 Fri Aug 21 17:43:14 2009 +++ src/sys/arch/mips/mips/vm_machdep.c Sun Aug 23 04:06:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.121.6.1.2.1 2009/08/21 17:43:14 matt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.121.6.1.2.2 2009/08/23 04:06:01 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -80,7 +80,7 @@ #include "opt_coredump.h" #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.121.6.1.2.1 2009/08/21 17:43:14 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.121.6.1.2.2 2009/08/23 04:06:01 matt Exp $"); #include #include @@ -234,7 +234,8 @@ { if ((l->l_md.md_flags & MDP_FPUSED) && l == fpcurlwp) - fpcurlwp = NULL; + fpcurlwp = &lwp0; /* save some NULL checks */ + KASSERT(fpcurlwp != l); } void
CVS commit: [matt-nb5-mips64] src/sys/arch/mips
Module Name:src Committed By: matt Date: Sun Aug 23 04:04:35 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: signal.h src/sys/arch/mips/mips [matt-nb5-mips64]: compat_13_machdep.c compat_16_machdep.c Log Message: In non-O32 kernels, make these syscalls return ENOSYS or sigexit(l, SIGILL) when called by non-O32 programs. Marshall the 64bits registers to and from their 32bit equivs and deal with FP differences. To generate a diff of this commit: cvs rdiff -u -r1.27.92.1 -r1.27.92.2 src/sys/arch/mips/include/signal.h cvs rdiff -u -r1.16.20.1 -r1.16.20.2 \ src/sys/arch/mips/mips/compat_13_machdep.c cvs rdiff -u -r1.12.14.1 -r1.12.14.2 \ src/sys/arch/mips/mips/compat_16_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/mips/include/signal.h diff -u src/sys/arch/mips/include/signal.h:1.27.92.1 src/sys/arch/mips/include/signal.h:1.27.92.2 --- src/sys/arch/mips/include/signal.h:1.27.92.1 Sun Aug 16 03:33:58 2009 +++ src/sys/arch/mips/include/signal.h Sun Aug 23 04:04:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.27.92.1 2009/08/16 03:33:58 matt Exp $ */ +/* $NetBSD: signal.h,v 1.27.92.2 2009/08/23 04:04:35 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -86,18 +86,22 @@ #endif /* _KERNEL && COMPAT_13 */ #if defined(_LIBC) || (defined(_KERNEL) && (defined(COMPAT_16) || defined(COMPAT_ULTRIX))) +/* + * Only need an O32 version. + */ struct sigcontext { int sc_onstack; /* sigstack state to restore */ int __sc_mask13; /* signal mask to restore (old style) */ - mips_reg_t sc_pc; /* pc at time of signal */ - mips_reg_t sc_regs[32]; /* processor regs 0 to 31 */ - mips_reg_t mullo, mulhi;/* mullo and mulhi registers... */ + int sc_pc; /* pc at time of signal */ + int sc_regs[32]; /* processor regs 0 to 31 */ + int mullo, mulhi; /* mullo and mulhi registers... */ int sc_fpused; /* fp has been used */ - mips_fpreg_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */ + int sc_fpregs[33]; /* fp regs 0 to 31 and csr */ int sc_fpc_eir; /* floating point exception instruction reg */ - long sc_xxx[8]; /* XXX reserved */ + int sc_xxx[8]; /* XXX reserved */ sigset_t sc_mask; /* signal mask to restore (new style) */ }; + #endif /* _LIBC || _KERNEL */ #endif /* !_LANGUAGE_ASSEMBLY */ Index: src/sys/arch/mips/mips/compat_13_machdep.c diff -u src/sys/arch/mips/mips/compat_13_machdep.c:1.16.20.1 src/sys/arch/mips/mips/compat_13_machdep.c:1.16.20.2 --- src/sys/arch/mips/mips/compat_13_machdep.c:1.16.20.1 Thu Aug 20 21:49:24 2009 +++ src/sys/arch/mips/mips/compat_13_machdep.c Sun Aug 23 04:04:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.16.20.1 2009/08/20 21:49:24 matt Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.16.20.2 2009/08/23 04:04:35 matt Exp $ */ /* * Copyright 1996 The Board of Trustees of The Leland Stanford @@ -15,7 +15,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.16.20.1 2009/08/20 21:49:24 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.16.20.2 2009/08/23 04:04:35 matt Exp $"); #include #include @@ -39,6 +39,10 @@ #define SDB_FPSTATE 0x04 #endif +#if !defined(__mips_o32) +#define fpreg fpreg_oabi +#endif + int compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args *uap, register_t *retval) { @@ -51,6 +55,11 @@ struct frame *f; sigset_t mask; +#if !defined(__mips_o32) + if (p->p_md.md_abi != _MIPS_BSD_ABI_O32) + return ENOSYS; +#endif + /* * The trampoline code hands us the context. * It is unsafe to keep track of it ourselves, in the event that a @@ -64,7 +73,7 @@ if ((error = copyin(scp, &ksc, sizeof(ksc))) != 0) return (error); - if ((u_int)ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */ + if ((uint32_t)ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */ return (EINVAL); /* Resture the register context. */ @@ -72,10 +81,16 @@ f->f_regs[_R_PC] = ksc.sc_pc; f->f_regs[_R_MULLO] = ksc.mullo; f->f_regs[_R_MULHI] = ksc.mulhi; +#if defined(__mips_o32) memcpy(&f->f_regs[1], &scp->sc_regs[1], sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0])); +#else + for (size_t i = 1; i < __arraycount(scp->sc_regs); i++) + f->f_regs[i] = scp->sc_regs[i]; +#endif if (scp->sc_fpused) - l->l_addr->u_pcb.pcb_fpregs = *(struct fpreg *)scp->sc_fpregs; + *(struct fpreg *)&l->l_addr->u_pcb.pcb_fpregs = + *(struct fpreg *)scp->sc_fpregs; mutex_enter(p->p_lock); Index: src/sys/arch/mips/mips/compat_16_machdep.c diff -u src/sys/arch/mips/mips/compat_16_machdep.c:1.12.14.1 src/sys/arch/mips/mips/compat_16_machdep.c:1.12.14.2 --- src/sys/arch/mips/mips/compat_16_machdep.c:1.12.14.1 Thu Aug 20 21:45:59 2009 +++ src/sys/arch/mips/mips/compat_16_machdep.c Sun Aug 23 04:04:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.12.14.1 20
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include
Module Name:src Committed By: matt Date: Sun Aug 23 03:57:42 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: cdefs.h Log Message: Use #if defined(__mips_xxx) not #if __mips_xxx To generate a diff of this commit: cvs rdiff -u -r1.12.78.2 -r1.12.78.3 src/sys/arch/mips/include/cdefs.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/mips/include/cdefs.h diff -u src/sys/arch/mips/include/cdefs.h:1.12.78.2 src/sys/arch/mips/include/cdefs.h:1.12.78.3 --- src/sys/arch/mips/include/cdefs.h:1.12.78.2 Fri Aug 21 17:18:32 2009 +++ src/sys/arch/mips/include/cdefs.h Sun Aug 23 03:57:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.12.78.2 2009/08/21 17:18:32 matt Exp $ */ +/* $NetBSD: cdefs.h,v 1.12.78.3 2009/08/23 03:57:42 matt Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. @@ -54,11 +54,11 @@ #define _MIPS_SIM_LP64_P(abi) ((abi) == _MIPS_SIM_ABIX32 || \ (abi) == _MIPS_SIM_ABI64) -#if __mips_n64 +#if defined(__mips_n64) #define _MIPS_BSD_API _MIPS_BSD_API_N64 -#elif __mips_n32 +#elif defined(__mips_n32) #define _MIPS_BSD_API _MIPS_BSD_API_N32 -#elif __mips_o64 +#elif defined(__mips_o64) #define _MIPS_BSD_API _MIPS_BSD_API_O64 #else #define _MIPS_BSD_API _MIPS_BSD_API_O32
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include
Module Name:src Committed By: matt Date: Sun Aug 23 03:53:48 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: reg.h Log Message: Add a fpreg_oabi for the O32/O64 version of fpreg. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.96.1 src/sys/arch/mips/include/reg.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/mips/include/reg.h diff -u src/sys/arch/mips/include/reg.h:1.12 src/sys/arch/mips/include/reg.h:1.12.96.1 --- src/sys/arch/mips/include/reg.h:1.12 Sun Dec 11 12:18:09 2005 +++ src/sys/arch/mips/include/reg.h Sun Aug 23 03:53:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: reg.h,v 1.12 2005/12/11 12:18:09 christos Exp $ */ +/* $NetBSD: reg.h,v 1.12.96.1 2009/08/23 03:53:47 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -88,4 +88,10 @@ mips_fpreg_t r_regs[33]; }; +#if defined(__mips_n32) || defined(__mips_n64) +struct fpreg_oabi { + int32_t r_regs[33]; +}; +#endif + #endif /*_MIPS_REG_H_*/
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips
Module Name:src Committed By: matt Date: Sun Aug 23 03:52:52 UTC 2009 Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: syscall.c Log Message: Add code to print the retval. Use _QUAD_{LOW,HIGH}WORD to divide up V0 on O32. To generate a diff of this commit: cvs rdiff -u -r1.37.12.4 -r1.37.12.5 src/sys/arch/mips/mips/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/mips/mips/syscall.c diff -u src/sys/arch/mips/mips/syscall.c:1.37.12.4 src/sys/arch/mips/mips/syscall.c:1.37.12.5 --- src/sys/arch/mips/mips/syscall.c:1.37.12.4 Sat Aug 22 16:55:19 2009 +++ src/sys/arch/mips/mips/syscall.c Sun Aug 23 03:52:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.37.12.4 2009/08/22 16:55:19 matt Exp $ */ +/* $NetBSD: syscall.c,v 1.37.12.5 2009/08/23 03:52:52 matt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -107,7 +107,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.4 2009/08/22 16:55:19 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.5 2009/08/23 03:52:52 matt Exp $"); #if defined(_KERNEL_OPT) #include "opt_sa.h" @@ -383,16 +383,19 @@ * If this is from O32 and it's a 64bit quantity, * split it into 2 32bit values in adjacent registers. */ -#if BYTE_ORDER == BIG_ENDIAN - frame->f_regs[_R_V1] = (int32_t) frame->f_regs[_R_V0]; - frame->f_regs[_R_V0] >>= 32; -#endif -#if BYTE_ORDER == LITTLE_ENDIAN - frame->f_regs[_R_V1] = frame->f_regs[_R_V0] >> 32; - frame->f_regs[_R_V0] = (int32_t) frame->f_regs[_R_V0]; -#endif + mips_reg_t tmp = frame->f_regs[_R_V0]; + frame->f_regs[_R_V0 + _QUAD_LOWWORD] = (int32_t) tmp; + frame->f_regs[_R_V0 + _QUAD_HIGHWORD] = tmp >> 32; } #endif +#if 0 + if (p->p_emul->e_syscallnames) + printf("syscall %s:", p->p_emul->e_syscallnames[code]); + else + printf("syscall %u:", code); + printf(" return v0=%#"PRIxREGISTER" v1=%#"PRIxREGISTER"\n", + frame->f_regs[_R_V0], frame->f_regs[_R_V1]); +#endif frame->f_regs[_R_A3] = 0; break; case ERESTART:
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include
Module Name:src Committed By: matt Date: Sun Aug 23 03:51:35 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: endian_machdep.h Log Message: Add REG_SHI and REG_SLO To generate a diff of this commit: cvs rdiff -u -r1.1.154.1 -r1.1.154.2 \ src/sys/arch/mips/include/endian_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/mips/include/endian_machdep.h diff -u src/sys/arch/mips/include/endian_machdep.h:1.1.154.1 src/sys/arch/mips/include/endian_machdep.h:1.1.154.2 --- src/sys/arch/mips/include/endian_machdep.h:1.1.154.1 Thu Aug 20 10:05:34 2009 +++ src/sys/arch/mips/include/endian_machdep.h Sun Aug 23 03:51:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: endian_machdep.h,v 1.1.154.1 2009/08/20 10:05:34 matt Exp $ */ +/* $NetBSD: endian_machdep.h,v 1.1.154.2 2009/08/23 03:51:35 matt Exp $ */ #ifndef _BYTE_ORDER # error Define MIPS target CPU endian-ness in port-specific header file. @@ -17,9 +17,13 @@ # if SZREG == 4 # define REG_LHI lwr # define REG_LLO lwl +# define REG_SHI swr +# define REG_SLO swl # else # define REG_LHI ldr # define REG_LLO ldl +# define REG_SHI sdr +# define REG_SLO sdl # endif #endif @@ -31,9 +35,13 @@ # if SZREG == 4 # define REG_LHI lwl # define REG_LLO lwr +# define REG_SHI swl +# define REG_SLO swr # else # define REG_LHI ldl # define REG_LLO ldr +# define REG_SHI sdl +# define REG_SLO sdr # endif #endif
CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/conf
Module Name:src Committed By: matt Date: Sun Aug 23 03:43:33 UTC 2009 Modified Files: src/sys/arch/evbmips/conf [matt-nb5-mips64]: std.malta Log Message: Compile MALTA with -mmips64 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.94.1 src/sys/arch/evbmips/conf/std.malta 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/evbmips/conf/std.malta diff -u src/sys/arch/evbmips/conf/std.malta:1.5 src/sys/arch/evbmips/conf/std.malta:1.5.94.1 --- src/sys/arch/evbmips/conf/std.malta:1.5 Sun Dec 11 12:17:11 2005 +++ src/sys/arch/evbmips/conf/std.malta Sun Aug 23 03:43:33 2009 @@ -1,4 +1,4 @@ -# $NetBSD: std.malta,v 1.5 2005/12/11 12:17:11 christos Exp $ +# $NetBSD: std.malta,v 1.5.94.1 2009/08/23 03:43:33 matt Exp $ machine evbmips mips include "conf/std" # MI standard options @@ -11,6 +11,7 @@ options EXEC_ELF32 # exec ELF32 binaries options EXEC_SCRIPT # exec #! scripts +makeoptions CFLAGS+="-mips64" makeoptions DEFTEXTADDR="0x8010" makeoptions BOARDTYPE="malta"
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include
Module Name:src Committed By: matt Date: Sun Aug 23 03:40:15 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: elf_machdep.h Log Message: Make sure we only don't run other sized ELFs. To generate a diff of this commit: cvs rdiff -u -r1.10.96.4 -r1.10.96.5 src/sys/arch/mips/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/mips/include/elf_machdep.h diff -u src/sys/arch/mips/include/elf_machdep.h:1.10.96.4 src/sys/arch/mips/include/elf_machdep.h:1.10.96.5 --- src/sys/arch/mips/include/elf_machdep.h:1.10.96.4 Sat Aug 22 06:46:45 2009 +++ src/sys/arch/mips/include/elf_machdep.h Sun Aug 23 03:40:14 2009 @@ -1,23 +1,31 @@ -/* $NetBSD: elf_machdep.h,v 1.10.96.4 2009/08/22 06:46:45 matt Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.10.96.5 2009/08/23 03:40:14 matt Exp $ */ #ifndef _MIPS_ELF_MACHDEP_H_ #define _MIPS_ELF_MACHDEP_H_ #if defined(ELFSIZE) #if ELFSIZE == 32 +#ifdef _LP64 +#define ELF32_MACHDEP_ID_CASES /* xxx */ +#else #define ELF32_MACHDEP_ID_CASES \ case EM_MIPS: \ break; +#endif /* _LP64 */ #define ELF32_MACHDEP_ID EM_MIPS -#endif +#endif /* ELFSIZE == 32 */ #if ELFSIZE == 64 +#ifdef _LP64 #define ELF64_MACHDEP_ID_CASES \ case EM_MIPS: \ break; +#else +#define ELF64_MACHDEP_ID_CASES /* xxx */ +#endif /* _LP64 */ #define ELF64_MACHDEP_ID EM_MIPS -#endif +#endif /* ELFSIZE == 64 */ #endif /* defined(ELFSIZE) */ #ifdef _LP64
CVS commit: [matt-nb5-mips64] src/sys/arch/sbmips/include
Module Name:src Committed By: matt Date: Sun Aug 23 03:39:29 UTC 2009 Modified Files: src/sys/arch/sbmips/include [matt-nb5-mips64]: loadfile_machdep.h Log Message: Enable ELF64 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.18.1 src/sys/arch/sbmips/include/loadfile_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/sbmips/include/loadfile_machdep.h diff -u src/sys/arch/sbmips/include/loadfile_machdep.h:1.3 src/sys/arch/sbmips/include/loadfile_machdep.h:1.3.18.1 --- src/sys/arch/sbmips/include/loadfile_machdep.h:1.3 Mon Apr 28 20:23:34 2008 +++ src/sys/arch/sbmips/include/loadfile_machdep.h Sun Aug 23 03:39:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_machdep.h,v 1.3 2008/04/28 20:23:34 martin Exp $ */ +/* $NetBSD: loadfile_machdep.h,v 1.3.18.1 2009/08/23 03:39:29 matt Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,6 +30,7 @@ */ #define BOOT_ELF32 +#define BOOT_ELF64 #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
CVS commit: [matt-nb5-mips64] src/sys
Module Name:src Committed By: matt Date: Sun Aug 23 03:38:19 UTC 2009 Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: types.h src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c process_machdep.c src/sys/kern [matt-nb5-mips64]: core_elf32.c sys_process.c src/sys/sys [matt-nb5-mips64]: ptrace.h Log Message: Change lazy fp load/save is done. fpcurlwp is never NULL. If no current lwp has the FP, then fpcurlwp is set to lwp0. this allows many check for NULL and avoids a few null-derefs. Since savefpregs clear COP1, loadfpregs can be called to reload fpregs. If it notices that situation, it just sets COP1 and returns Save does not reset fpcurlwp, just clears COP1. load does set fpcurlwp. If MIPS3_SR_FR is set, all 32 64-bit FP registers are saved/restored via Xdc1. If MIPS3_SR_FR is clear, only 32 32-bit FP register are saved/restore via Xwc1. This preserves the existing ABI. To generate a diff of this commit: cvs rdiff -u -r1.43.36.2 -r1.43.36.3 src/sys/arch/mips/include/types.h cvs rdiff -u -r1.205.4.1.2.1.2.2 -r1.205.4.1.2.1.2.3 \ src/sys/arch/mips/mips/mips_machdep.c cvs rdiff -u -r1.29.62.1 -r1.29.62.2 src/sys/arch/mips/mips/process_machdep.c cvs rdiff -u -r1.32.16.1 -r1.32.16.2 src/sys/kern/core_elf32.c cvs rdiff -u -r1.143.4.1 -r1.143.4.1.4.1 src/sys/kern/sys_process.c cvs rdiff -u -r1.40 -r1.40.28.1 src/sys/sys/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/mips/include/types.h diff -u src/sys/arch/mips/include/types.h:1.43.36.2 src/sys/arch/mips/include/types.h:1.43.36.3 --- src/sys/arch/mips/include/types.h:1.43.36.2 Fri Aug 21 17:29:42 2009 +++ src/sys/arch/mips/include/types.h Sun Aug 23 03:38:19 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.43.36.2 2009/08/21 17:29:42 matt Exp $ */ +/* $NetBSD: types.h,v 1.43.36.3 2009/08/23 03:38:19 matt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -110,6 +110,7 @@ #define __HAVE_AST_PERPROC #define __HAVE_SYSCALL_INTERN +#define __HAVE_PROCESS_XFPREGS #ifdef MIPS3_PLUS /* XXX bogus! */ #define __HAVE_CPU_COUNTER #endif Index: src/sys/arch/mips/mips/mips_machdep.c diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.2 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.3 --- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.2 Fri Aug 21 17:48:57 2009 +++ src/sys/arch/mips/mips/mips_machdep.c Sun Aug 23 03:38:19 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.2 2009/08/21 17:48:57 matt Exp $ */ +/* $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.3 2009/08/23 03:38:19 matt Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -112,7 +112,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.2 2009/08/21 17:48:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.3 2009/08/23 03:38:19 matt Exp $"); #include "opt_cputype.h" @@ -783,6 +783,7 @@ */ lwp0.l_cpu = &cpu_info_store; cpu_info_store.ci_curlwp = &lwp0; + cpu_info_store.ci_fpcurlwp = &lwp0; curlwp = &lwp0; mycpu = NULL; @@ -1119,6 +1120,15 @@ f->f_regs[_R_PC] = (int)pack->ep_entry & ~3; f->f_regs[_R_T9] = (int)pack->ep_entry & ~3; /* abicall requirement */ f->f_regs[_R_SR] = PSL_USERSET; +#if !defined(__mips_o32) + /* + * allow 64bit ops in userland for non-O32 ABIs + */ + if (l->l_proc->p_md.md_abi != _MIPS_BSD_API_O32) + f->f_regs[_R_SR] |= MIPS_SR_UX; + if (_MIPS_SIM_NEWABI_P(l->l_proc->p_md.md_abi)) + f->f_regs[_R_SR] |= MIPS3_SR_FR; +#endif /* * Set up arguments for _start(): * _start(stack, obj, cleanup, ps_strings); @@ -1134,7 +1144,7 @@ f->f_regs[_R_A3] = (intptr_t)l->l_proc->p_psstr; if ((l->l_md.md_flags & MDP_FPUSED) && l == fpcurlwp) - fpcurlwp = NULL; + fpcurlwp = &lwp0; memset(&l->l_addr->u_pcb.pcb_fpregs, 0, sizeof(struct fpreg)); l->l_md.md_flags &= ~MDP_FPUSED; l->l_md.md_ss_addr = 0; @@ -1493,171 +1503,273 @@ } void -savefpregs(l) - struct lwp *l; +savefpregs(struct lwp *l) { #ifndef NOFPU - u_int32_t status, fpcsr; - mips_fpreg_t *fp; - struct frame *f; - - if (l == NULL) + struct frame * const f = l->l_md.md_regs; + mips_fpreg_t * const fp = l->l_addr->u_pcb.pcb_fpregs.r_regs; + uint32_t status, fpcsr; + + /* + * Don't do anything if the FPU is already off. + */ + if ((f->f_regs[_R_SR] & MIPS_SR_COP_1_BIT) == 0) return; + + /* + * this process yielded FPA. + */ + KASSERT(f->f_regs[_R_SR] & MIPS_SR_COP_1_BIT); /* it should be on */ + /* * turnoff interrupts enabling CP1 to read FPCSR register. */ __asm volatile ( - ".set noreorder \n\t" - ".set noat \n\t" - "mfc0 %0, $" ___STRING(MIPS_COP_0_STATUS) " \n\t" - "li $1, %2 \n\t" - "mtc0 $1, $" ___STRING(MIPS_COP_0_STATUS) " \n\t" + ".set noreorder""\n\t" + ".set noat" "\n\t" + "mfc0 %0, $" ___STRING(MIPS_COP_0_STATUS
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips
Module Name:src Committed By: matt Date: Sun Aug 23 03:25:10 UTC 2009 Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: db_interface.c Log Message: taken curlwp == NULL check. To generate a diff of this commit: cvs rdiff -u -r1.64.16.1 -r1.64.16.2 src/sys/arch/mips/mips/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/mips/mips/db_interface.c diff -u src/sys/arch/mips/mips/db_interface.c:1.64.16.1 src/sys/arch/mips/mips/db_interface.c:1.64.16.2 --- src/sys/arch/mips/mips/db_interface.c:1.64.16.1 Thu Aug 20 21:49:24 2009 +++ src/sys/arch/mips/mips/db_interface.c Sun Aug 23 03:25:09 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.64.16.1 2009/08/20 21:49:24 matt Exp $ */ +/* $NetBSD: db_interface.c,v 1.64.16.2 2009/08/23 03:25:09 matt Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.1 2009/08/20 21:49:24 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.2 2009/08/23 03:25:09 matt Exp $"); #include "opt_cputype.h" /* which mips CPUs do we support? */ #include "opt_ddb.h" @@ -715,7 +715,7 @@ vaddr_t ra; unsigned fpucsr; - fpucsr = curlwp ? PCB_FSR(&curlwp->l_addr->u_pcb) : 0; + fpucsr = PCB_FSR(&curlwp->l_addr->u_pcb); ra = MachEmulateBranch((struct frame *)regs, pc, fpucsr, 0); return ra; }
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips
Module Name:src Committed By: matt Date: Sun Aug 23 03:24:09 UTC 2009 Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_exec.c Log Message: Only print the ABI when it changes. To generate a diff of this commit: cvs rdiff -u -r1.50.54.1.4.2 -r1.50.54.1.4.3 \ src/sys/arch/mips/mips/cpu_exec.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/mips/mips/cpu_exec.c diff -u src/sys/arch/mips/mips/cpu_exec.c:1.50.54.1.4.2 src/sys/arch/mips/mips/cpu_exec.c:1.50.54.1.4.3 --- src/sys/arch/mips/mips/cpu_exec.c:1.50.54.1.4.2 Fri Aug 21 17:38:23 2009 +++ src/sys/arch/mips/mips/cpu_exec.c Sun Aug 23 03:24:08 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_exec.c,v 1.50.54.1.4.2 2009/08/21 17:38:23 matt Exp $ */ +/* $NetBSD: cpu_exec.c,v 1.50.54.1.4.3 2009/08/23 03:24:08 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.50.54.1.4.2 2009/08/21 17:38:23 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.50.54.1.4.3 2009/08/23 03:24:08 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_ultrix.h" @@ -316,6 +316,7 @@ { struct proc * const p = l->l_proc; const Elf32_Ehdr * const eh = eh0; + int old_abi = p->p_md.md_abi; /* * Verify we can support the architecture. @@ -350,12 +351,14 @@ #if !defined(__mips_o32) case EF_MIPS_ABI2: p->p_md.md_abi = _MIPS_BSD_API_N32; - printf("pid %d(%p): ABI set to N32 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); + if (old_abi != p->p_md.md_abi) + printf("pid %d(%p): ABI set to N32 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); return 0; #endif case EF_MIPS_ABI_O32: p->p_md.md_abi = _MIPS_BSD_API_O32; - printf("pid %d(%p): ABI set to O32 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); + if (old_abi != p->p_md.md_abi) + printf("pid %d(%p): ABI set to O32 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); return 0; default: return ENOEXEC; @@ -405,6 +408,7 @@ { struct proc * const p = l->l_proc; const Elf64_Ehdr * const eh = eh0; + int old_abi = p->p_md.md_abi; switch (eh->e_flags & EF_MIPS_ARCH) { case EF_MIPS_ARCH_1: @@ -436,11 +440,13 @@ switch (eh->e_flags & EF_MIPS_ARCH) { case 0: p->p_md.md_abi = _MIPS_BSD_API_N64; - printf("pid %d(%p): ABI set to N64 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); + if (old_abi != p->p_md.md_abi) + printf("pid %d(%p): ABI set to N64 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); return 0; case EF_MIPS_ABI_O64: p->p_md.md_abi = _MIPS_BSD_API_O64; - printf("pid %d(%p): ABI set to O64 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); + if (old_abi != p->p_md.md_abi) + printf("pid %d(%p): ABI set to O64 (e_flags=%#x)\n", p->p_pid, p, eh->e_flags); return 0; default: return ENOEXEC;
CVS commit: src/sys/arch/atari
Module Name:src Committed By: mrg Date: Sun Aug 23 01:27:13 UTC 2009 Modified Files: src/sys/arch/atari/atari: atari_init.c src/sys/arch/atari/include: iomap.h src/sys/arch/atari/isa: isa_machdep.c Log Message: fix atari builds in two ways: - isa_detach_hook() was missing a parameter name (hi dyoung!) - PCI_CONF_SIZE -> PCI_CONFIG_SIZE; pcivar.h has a PCI_CONF_SIZE now (hi jak!) To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/include/iomap.h cvs rdiff -u -r1.35 -r1.36 src/sys/arch/atari/isa/isa_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/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.85 src/sys/arch/atari/atari/atari_init.c:1.86 --- src/sys/arch/atari/atari/atari_init.c:1.85 Sat Aug 22 18:26:42 2009 +++ src/sys/arch/atari/atari/atari_init.c Sun Aug 23 01:27:13 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.85 2009/08/22 18:26:42 tsutsui Exp $ */ +/* $NetBSD: atari_init.c,v 1.86 2009/08/23 01:27:13 mrg Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.85 2009/08/22 18:26:42 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.86 2009/08/23 01:27:13 mrg Exp $"); #include "opt_ddb.h" #include "opt_mbtype.h" @@ -324,7 +324,7 @@ * If present, add pci areas */ if (machineid & ATARI_HADES) - ptextra += btoc(PCI_CONF_SIZE + PCI_IO_SIZE + PCI_MEM_SIZE); + ptextra += btoc(PCI_CONFIG_SIZE + PCI_IO_SIZE + PCI_MEM_SIZE); if (machineid & ATARI_MILAN) ptextra += btoc(PCI_IO_SIZE + PCI_MEM_SIZE); ptextra += btoc(BOOTM_VA_POOL); @@ -776,9 +776,9 @@ * Only Hades maps the PCI-config space! */ pci_conf_addr = ioaddr; - ioaddr += PCI_CONF_SIZE; + ioaddr += PCI_CONFIG_SIZE; pg= &pt[pci_conf_addr / PAGE_SIZE]; - epg = &pg[btoc(PCI_CONF_SIZE)]; + epg = &pg[btoc(PCI_CONFIG_SIZE)]; mask = PCI_CONFM_PHYS; pg_proto = PCI_CONFB_PHYS | PG_RW | PG_CI | PG_V; for (; pg < epg; mask <<= 1) Index: src/sys/arch/atari/include/iomap.h diff -u src/sys/arch/atari/include/iomap.h:1.12 src/sys/arch/atari/include/iomap.h:1.13 --- src/sys/arch/atari/include/iomap.h:1.12 Wed Apr 2 07:35:55 2003 +++ src/sys/arch/atari/include/iomap.h Sun Aug 23 01:27:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: iomap.h,v 1.12 2003/04/02 07:35:55 thorpej Exp $ */ +/* $NetBSD: iomap.h,v 1.13 2009/08/23 01:27:12 mrg Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -81,9 +81,9 @@ /* * Pre-allocated PCI-memory regions (atari_init.c). We need those in the * boot-stages. - * XXX: Can probably be reduced to only PCI_CONF_SIZE (Leo). + * XXX: Can probably be reduced to only PCI_CONFIG_SIZE (Leo). */ -#define PCI_CONF_SIZE (4 * PAGE_SIZE) +#define PCI_CONFIG_SIZE (4 * PAGE_SIZE) #define PCI_IO_SIZE (PAGE_SIZE) #define PCI_MEM_SIZE (PAGE_SIZE) Index: src/sys/arch/atari/isa/isa_machdep.c diff -u src/sys/arch/atari/isa/isa_machdep.c:1.35 src/sys/arch/atari/isa/isa_machdep.c:1.36 --- src/sys/arch/atari/isa/isa_machdep.c:1.35 Wed Aug 19 15:15:21 2009 +++ src/sys/arch/atari/isa/isa_machdep.c Sun Aug 23 01:27:13 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.35 2009/08/19 15:15:21 dyoung Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.36 2009/08/23 01:27:13 mrg Exp $ */ /* * Copyright (c) 1997 Leo Weppelman. All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.35 2009/08/19 15:15:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.36 2009/08/23 01:27:13 mrg Exp $"); #include #include @@ -155,7 +155,7 @@ } void -isa_detach_hook(isa_chipset_tag_t, device_t self) +isa_detach_hook(isa_chipset_tag_t ic, device_t self) { }
CVS commit: src/sys/compat/ossaudio
Module Name:src Committed By: christos Date: Sat Aug 22 23:31:16 UTC 2009 Modified Files: src/sys/compat/ossaudio: ossaudio.c Log Message: add a lot more debugging and error checking. Alas, skype seems to be happy getting back our values, but still does not work. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/compat/ossaudio/ossaudio.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/compat/ossaudio/ossaudio.c diff -u src/sys/compat/ossaudio/ossaudio.c:1.64 src/sys/compat/ossaudio/ossaudio.c:1.65 --- src/sys/compat/ossaudio/ossaudio.c:1.64 Thu Nov 13 05:05:52 2008 +++ src/sys/compat/ossaudio/ossaudio.c Sat Aug 22 19:31:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.64 2008/11/13 10:05:52 ad Exp $ */ +/* $NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $ */ /*- * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.64 2008/11/13 10:05:52 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $"); #include #include @@ -66,6 +66,88 @@ static void setblocksize(file_t *, struct audio_info *); +#ifdef AUDIO_DEBUG +static const char * +compat_ossaudio_getcmd(u_long cmd) +{ + static char buf[64]; + switch (cmd) { +#define _DO(_a) \ + case _a: \ + return # _a; +_DO(OSS_SNDCTL_DSP_RESET) +_DO(OSS_SNDCTL_DSP_SYNC) +_DO(OSS_SNDCTL_DSP_SPEED) +_DO(OSS_SOUND_PCM_READ_RATE) +_DO(OSS_SNDCTL_DSP_STEREO) +_DO(OSS_SNDCTL_DSP_GETBLKSIZE) +_DO(OSS_SNDCTL_DSP_SETFMT) +_DO(OSS_SOUND_PCM_READ_BITS) +_DO(OSS_SNDCTL_DSP_CHANNELS) +_DO(OSS_SOUND_PCM_READ_CHANNELS) +_DO(OSS_SOUND_PCM_WRITE_FILTER) +_DO(OSS_SOUND_PCM_READ_FILTER) +_DO(OSS_SNDCTL_DSP_POST) +_DO(OSS_SNDCTL_DSP_SUBDIVIDE) +_DO(OSS_SNDCTL_DSP_SETFRAGMENT) +_DO(OSS_SNDCTL_DSP_GETFMTS) +_DO(OSS_SNDCTL_DSP_GETOSPACE) +_DO(OSS_SNDCTL_DSP_GETISPACE) +_DO(OSS_SNDCTL_DSP_NONBLOCK) +_DO(OSS_SNDCTL_DSP_GETCAPS) +_DO(OSS_SNDCTL_DSP_GETTRIGGER) +_DO(OSS_SNDCTL_DSP_SETTRIGGER) +_DO(OSS_SNDCTL_DSP_GETIPTR) +_DO(OSS_SNDCTL_DSP_GETOPTR) +_DO(OSS_SNDCTL_DSP_MAPINBUF) +_DO(OSS_SNDCTL_DSP_MAPOUTBUF) +_DO(OSS_SNDCTL_DSP_SETSYNCRO) +_DO(OSS_SNDCTL_DSP_SETDUPLEX) +_DO(OSS_SNDCTL_DSP_GETODELAY) +_DO(OSS_SNDCTL_DSP_PROFILE) +_DO(OSS_SOUND_MIXER_INFO) +_DO(OSS_SOUND_OLD_MIXER_INFO) +_DO(OSS_GET_VERSION) +_DO(OSS_SEQ_RESET) +_DO(OSS_SEQ_SYNC) +_DO(OSS_SYNTH_INFO) +_DO(OSS_SEQ_CTRLRATE) +_DO(OSS_SEQ_GETOUTCOUNT) +_DO(OSS_SEQ_GETINCOUNT) +_DO(OSS_SEQ_PERCMODE) +_DO(OSS_SEQ_TESTMIDI) +_DO(OSS_SEQ_RESETSAMPLES) +_DO(OSS_SEQ_NRSYNTHS) +_DO(OSS_SEQ_NRMIDIS) +#ifdef notyet +_DO(OSS_MIDI_INFO) +#endif +_DO(OSS_SEQ_THRESHOLD) +_DO(OSS_MEMAVL) +_DO(OSS_FM_4OP_ENABLE) +_DO(OSS_SEQ_PANIC) +_DO(OSS_SEQ_OUTOFBAND) +_DO(OSS_SEQ_GETTIME) +_DO(OSS_ID) +_DO(OSS_CONTROL) +_DO(OSS_REMOVESAMPLE) +_DO(OSS_TMR_TIMEBASE) +_DO(OSS_TMR_START) +_DO(OSS_TMR_STOP) +_DO(OSS_TMR_CONTINUE) +_DO(OSS_TMR_TEMPO) +_DO(OSS_TMR_SOURCE) +_DO(OSS_TMR_METRONOME) +_DO(OSS_TMR_SELECT) +#undef _DO + default: + (void)snprintf(buf, sizeof(buf), "*0x%lx*", cmd); + return buf; + } +} +#endif + + static int compat_ossaudio_modcmd(modcmd_t cmd, void *arg) { @@ -108,7 +190,7 @@ } com = SCARG(uap, com); - DPRINTF(("oss_ioctl_audio: com=%08lx\n", com)); + DPRINTF(("%s: com=%s\n", __func__, compat_ossaudio_getcmd(com))); retval[0] = 0; @@ -116,13 +198,17 @@ switch (com) { case OSS_SNDCTL_DSP_RESET: error = ioctlf(fp, AUDIO_FLUSH, NULL); - if (error) + if (error) { + DPRINTF(("%s: AUDIO_FLUSH %d\n", __func__, error)); goto out; + } break; case OSS_SNDCTL_DSP_SYNC: error = ioctlf(fp, AUDIO_DRAIN, NULL); - if (error) + if (error) { + DPRINTF(("%s: AUDIO_DRAIN %d\n", __func__, error)); goto out; + } break; case OSS_SNDCTL_DSP_POST: /* This call is merely advisory, and may be a nop. */ @@ -130,56 +216,93 @@ case OSS_SNDCTL_DSP_SPEED: AUDIO_INITINFO(&tmpinfo); error = copyin(SCARG(uap, data), &idat, sizeof idat); - if (error) + if (error) { + DPRINTF(("%s: SNDCTL_DSP_SPEED %d\n", + __func__, error)); goto out; + } tmpinfo.play.sample_rate = tmpinfo.record.sample_rate = idat; + DPRINTF(("%s: SNDCTL_DSP_SPEED > %d\n", __func__, idat)); error = ioctlf(fp, AUDIO_SETINFO, &tmpinfo); - DPRINTF(("oss_sys_ioctl: SNDCTL_DSP_SPEED %d = %d\n", - idat, error)); - if (error) + if (error) { + DPRINTF(("%s: SNDCTL_DSP_SPEED %d = %d\n", + __func__, idat, error)); goto out; + } /* fall into ... */ case OSS_SOUND_PCM_READ_RATE: error = ioctlf(fp, AUDIO_GETBUFINFO, &tmpinfo); - if (error) + if (error) { + DPRINTF(("%s: AUDIO_GETBUFINFO %d\n", + __func__, error)); goto out; + } idat = tmpinfo.play.sample_rate; + DPRINTF(("%s: SNDCTL_PCM_READ_RATE < %d\n", __func__, idat)); error = copyout(&idat, SCARG(uap, data), sizeof idat); - if (error) + if
CVS commit: src/sys/arch/pmax/include
Module Name:src Committed By: he Date: Sat Aug 22 23:08:01 UTC 2009 Modified Files: src/sys/arch/pmax/include: loadfile_machdep.h Log Message: Remove BOOT_AOUT, since our mips ports no longer deal with a.out. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/pmax/include/loadfile_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/pmax/include/loadfile_machdep.h diff -u src/sys/arch/pmax/include/loadfile_machdep.h:1.6 src/sys/arch/pmax/include/loadfile_machdep.h:1.7 --- src/sys/arch/pmax/include/loadfile_machdep.h:1.6 Mon Apr 28 20:23:31 2008 +++ src/sys/arch/pmax/include/loadfile_machdep.h Sat Aug 22 23:08:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_machdep.h,v 1.6 2008/04/28 20:23:31 martin Exp $ */ +/* $NetBSD: loadfile_machdep.h,v 1.7 2009/08/22 23:08:01 he Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -32,7 +32,6 @@ #ifndef _PMAX_LOADFILE_MACHDEP_H_ #define _PMAX_LOADFILE_MACHDEP_H_ -#define BOOT_AOUT #define BOOT_ECOFF #define BOOT_ELF32
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 21:55:08 UTC 2009 Modified Files: src/usr.bin/sort: sort.1 Log Message: Bring nearer to reality. Note that -H is now ignored. Move -S and -s (and -H) to the first list of options since they are global ones, not ones that override the ordering rules. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/sort/sort.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/sort.1 diff -u src/usr.bin/sort/sort.1:1.27 src/usr.bin/sort/sort.1:1.28 --- src/usr.bin/sort/sort.1:1.27 Wed Mar 11 13:58:30 2009 +++ src/usr.bin/sort/sort.1 Sat Aug 22 21:55:08 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: sort.1,v 1.27 2009/03/11 13:58:30 joerg Exp $ +.\" $NetBSD: sort.1,v 1.28 2009/08/22 21:55:08 dsl Exp $ .\" .\" Copyright (c) 2000-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -59,7 +59,7 @@ .\" .\" @(#)sort.1 8.1 (Berkeley) 6/6/93 .\" -.Dd January 13, 2001 +.Dd August 22, 2009 .Dt SORT 1 .Os .Sh NAME @@ -97,6 +97,9 @@ .Nm returns 0. .Nm +.It Fl H +Ignored for compatibility with earlier versions of +.Nm . .Fl c produces no output. .It Fl m @@ -106,6 +109,15 @@ .Ar output file to be used instead of the standard output. This file can be the same as one of the input files. +.It Fl S +Don't use stable sort. +Default is to use stable sort. +.It Fl s +Use stable sort, keeps records with equal keys in their original order. +This is the default. +Provided for compatibility with other +.Nm +implementations only. .It Fl T Ar dir Use .Ar dir @@ -158,18 +170,6 @@ option.) .It Fl r Reverse the sense of comparisons. -.It Fl S -Don't use stable sort. -Default is to use stable sort. -.It Fl s -Use stable sort. -This is the default. -Provided for compatibility with other -.Nm -implementations only. -.It Fl H -Use a merge sort instead of a radix sort. -This option should be used for files larger than 60Mb. .El .Pp The treatment of field separators can be altered using these options: @@ -416,10 +416,9 @@ and is used since .Nx 1.6 . .Sh BUGS -To sort files larger than 60Mb, use -.Nm -.Fl H ; -files larger than 704Mb must be sorted in smaller pieces, then merged. +Posix requires the locale's thousands separator be ignored in numbers. +It may be faster to sort very large files in pieces and then explicitly +merge them. .Sh NOTES This .Nm
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 21:50:32 UTC 2009 Modified Files: src/usr.bin/sort: init.c Log Message: and at the start of key fields are supposed to be sorted as if part of the data. This is a bit fubar since we need a value than sorts before any byte value as a key field separator - so need 257 byte values (since radixsort() doesn't take a length for each record). For now map '\t' to 0x01 and hope no one will notice! To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/sort/init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/init.c diff -u src/usr.bin/sort/init.c:1.20 src/usr.bin/sort/init.c:1.21 --- src/usr.bin/sort/init.c:1.20 Sat Aug 22 10:53:28 2009 +++ src/usr.bin/sort/init.c Sat Aug 22 21:50:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.20 2009/08/22 10:53:28 dsl Exp $ */ +/* $NetBSD: init.c,v 1.21 2009/08/22 21:50:32 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ #include "sort.h" #ifndef lint -__RCSID("$NetBSD: init.c,v 1.20 2009/08/22 10:53:28 dsl Exp $"); +__RCSID("$NetBSD: init.c,v 1.21 2009/08/22 21:50:32 dsl Exp $"); __SCCSID("@(#)init.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -338,20 +338,16 @@ int i; int next_weight = SINGL_FLD ? 1 : 2; int rev_weight = SINGL_FLD ? 255 : 254; - int had_field_sep = 0; + int had_field_sep = SINGL_FLD; for (i = 0; i < 256; i++) { unweighted[i] = i; if (d_mask[i] & REC_D_F) continue; - if (d_mask[i] & FLD_D && !SINGL_FLD) { + if (!had_field_sep && d_mask[i] & FLD_D) { + /* First/only separator sorts before any data */ ascii[i] = 1; Rascii[i] = 255; - if (had_field_sep) { -/* avoid confusion in key dumps */ -next_weight++; -rev_weight--; - } had_field_sep = 1; continue; }
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 21:43:53 UTC 2009 Modified Files: src/usr.bin/sort: sort.c Log Message: Put radixsort() and sradixsort() the correct way around. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.bin/sort/sort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/sort.c diff -u src/usr.bin/sort/sort.c:1.52 src/usr.bin/sort/sort.c:1.53 --- src/usr.bin/sort/sort.c:1.52 Sat Aug 22 10:53:28 2009 +++ src/usr.bin/sort/sort.c Sat Aug 22 21:43:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sort.c,v 1.52 2009/08/22 10:53:28 dsl Exp $ */ +/* $NetBSD: sort.c,v 1.53 2009/08/22 21:43:53 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ #endif /* not lint */ #ifndef lint -__RCSID("$NetBSD: sort.c,v 1.52 2009/08/22 10:53:28 dsl Exp $"); +__RCSID("$NetBSD: sort.c,v 1.53 2009/08/22 21:43:53 dsl Exp $"); __SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -196,10 +196,10 @@ break; case 's': /* for GNU sort compatibility (this is our default) */ - radix_sort = radixsort; + radix_sort = sradixsort; break; case 'S': - radix_sort = sradixsort; + radix_sort = radixsort; break; case 't': if (SEP_FLAG)
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 21:28:55 UTC 2009 Modified Files: src/usr.bin/sort: fields.c Log Message: Fix generation of unmasked alpha keys. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/sort/fields.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/fields.c diff -u src/usr.bin/sort/fields.c:1.26 src/usr.bin/sort/fields.c:1.27 --- src/usr.bin/sort/fields.c:1.26 Sat Aug 22 21:19:40 2009 +++ src/usr.bin/sort/fields.c Sat Aug 22 21:28:55 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fields.c,v 1.26 2009/08/22 21:19:40 dsl Exp $ */ +/* $NetBSD: fields.c,v 1.27 2009/08/22 21:28:55 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ #include "sort.h" #ifndef lint -__RCSID("$NetBSD: fields.c,v 1.26 2009/08/22 21:19:40 dsl Exp $"); +__RCSID("$NetBSD: fields.c,v 1.27 2009/08/22 21:28:55 dsl Exp $"); __SCCSID("@(#)fields.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -205,7 +205,7 @@ mask = cur_fld->mask; lweight = cur_fld->weights; for (; start < end; start++) { - if (mask && mask[*start]) { + if (!mask || mask[*start]) { *tablepos++ = lweight[*start]; } }
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 21:19:41 UTC 2009 Modified Files: src/usr.bin/sort: fields.c Log Message: Only process each number digit once. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/sort/fields.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/fields.c diff -u src/usr.bin/sort/fields.c:1.25 src/usr.bin/sort/fields.c:1.26 --- src/usr.bin/sort/fields.c:1.25 Sat Aug 22 10:53:28 2009 +++ src/usr.bin/sort/fields.c Sat Aug 22 21:19:40 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fields.c,v 1.25 2009/08/22 10:53:28 dsl Exp $ */ +/* $NetBSD: fields.c,v 1.26 2009/08/22 21:19:40 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ #include "sort.h" #ifndef lint -__RCSID("$NetBSD: fields.c,v 1.25 2009/08/22 10:53:28 dsl Exp $"); +__RCSID("$NetBSD: fields.c,v 1.26 2009/08/22 21:19:40 dsl Exp $"); __SCCSID("@(#)fields.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -335,7 +335,7 @@ for (last_nz_pos = pos; line < lineend; ) { if (pos >= bufend) return NULL; - ch = *line; + ch = *line++; val = (ch - '0') * 10; if (val > 90) { if (ch == DECIMAL_POINT && !had_dp) {
CVS commit: src/sys/arch/atari/atari
Module Name:src Committed By: tsutsui Date: Sat Aug 22 18:26:42 UTC 2009 Modified Files: src/sys/arch/atari/atari: atari_init.c Log Message: wrap long lines, fix indent. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/arch/atari/atari/atari_init.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/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.84 src/sys/arch/atari/atari/atari_init.c:1.85 --- src/sys/arch/atari/atari/atari_init.c:1.84 Wed Aug 19 19:39:05 2009 +++ src/sys/arch/atari/atari/atari_init.c Sat Aug 22 18:26:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.84 2009/08/19 19:39:05 he Exp $ */ +/* $NetBSD: atari_init.c,v 1.85 2009/08/22 18:26:42 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.84 2009/08/19 19:39:05 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.85 2009/08/22 18:26:42 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_mbtype.h" @@ -178,9 +178,10 @@ int kernel_copyback = 1; void -start_c(int id, u_int ttphystart, u_int ttphysize, u_int stphysize, char *esym_addr) +start_c(int id, u_int ttphystart, u_int ttphysize, u_int stphysize, +char *esym_addr) /* id: Machine id */ - /* ttphystart, ttphysize: Start address and size of TT-ram */ + /* ttphystart, ttphysize: Start address and size of TT-ram */ /* stphysize: Size of ST-ram */ /* esym_addr: Address of kernel '_esym' symbol */ { @@ -732,7 +733,7 @@ */ static void map_io_areas(paddr_t ptpa, psize_t ptsize, u_int ptextra) - /* ptsize: Size of 'pt' in bytes */ + /* ptsize: Size of 'pt' in bytes */ /* ptextra: #of additional I/O pte's */ { extern void bootm_init(vaddr_t, pt_entry_t *, u_long); @@ -872,7 +873,7 @@ cpu_kcore_hdr_t *h = &cpu_kcore_hdr; struct m68k_kcore_hdr *m = &h->un._m68k; extern char end[]; - int i; + int i; memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr)); @@ -926,11 +927,12 @@ } void -mmu030_setup(paddr_t sysseg_pa, u_int kstsize, paddr_t ptpa, psize_t ptsize, paddr_t sysptmap_pa, paddr_t kbase) +mmu030_setup(paddr_t sysseg_pa, u_int kstsize, paddr_t ptpa, psize_t ptsize, +paddr_t sysptmap_pa, paddr_t kbase) /* sysseg_pa: System segment table */ /* kstsize: size of 'sysseg' in pages */ - /* ptpa: Kernel page table */ - /* ptsize: size of 'pt' in bytes */ + /* ptpa: Kernel page table */ + /* ptsize: size of 'pt' in bytes */ /* sysptmap_pa: System page table */ { st_entry_t sg_proto, *sg, *esg; @@ -977,11 +979,12 @@ #if defined(M68040) || defined(M68060) void -mmu040_setup(paddr_t sysseg_pa, u_int kstsize, paddr_t ptpa, psize_t ptsize, paddr_t sysptmap_pa, paddr_t kbase) +mmu040_setup(paddr_t sysseg_pa, u_int kstsize, paddr_t ptpa, psize_t ptsize, +paddr_t sysptmap_pa, paddr_t kbase) /* sysseg_pa: System segment table */ /* kstsize: size of 'sysseg' in pages */ - /* ptpa: Kernel page table */ - /* ptsize: size of 'pt' in bytes */ + /* ptpa: Kernel page table */ + /* ptsize: size of 'pt' in bytes */ /* sysptmap_pa: System page table */ { int nl1desc, nl2desc, i;
CVS commit: src/usr.bin/nbperf
Module Name:src Committed By: joerg Date: Sat Aug 22 17:52:18 UTC 2009 Modified Files: src/usr.bin/nbperf: graph2.c graph3.c nbperf.c nbperf.h Log Message: GCC's propolice complains about dynamic stack arrays to bite the bullet and introduce a compile constant that limits the number of hash results. Verify that the choosen hash function is not beyond that limit and just the upper limit as static size in the graph tree functions. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/nbperf/graph2.c \ src/usr.bin/nbperf/graph3.c src/usr.bin/nbperf/nbperf.c \ src/usr.bin/nbperf/nbperf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/nbperf/graph2.c diff -u src/usr.bin/nbperf/graph2.c:1.1 src/usr.bin/nbperf/graph2.c:1.2 --- src/usr.bin/nbperf/graph2.c:1.1 Sat Aug 15 16:21:04 2009 +++ src/usr.bin/nbperf/graph2.c Sat Aug 22 17:52:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: graph2.c,v 1.1 2009/08/15 16:21:04 joerg Exp $ */ +/* $NetBSD: graph2.c,v 1.2 2009/08/22 17:52:17 joerg Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. * All rights reserved. @@ -32,7 +32,7 @@ */ #include -__RCSID("$NetBSD: graph2.c,v 1.1 2009/08/15 16:21:04 joerg Exp $"); +__RCSID("$NetBSD: graph2.c,v 1.2 2009/08/22 17:52:17 joerg Exp $"); #include #include @@ -75,7 +75,7 @@ graph2_hash(struct nbperf *nbperf, struct graph2 *graph) { struct vertex2 *v; - uint32_t hashes[nbperf->hash_size]; + uint32_t hashes[NBPERF_MAX_HASH_SIZE]; size_t i; for (i = 0; i < graph->e; ++i) { Index: src/usr.bin/nbperf/graph3.c diff -u src/usr.bin/nbperf/graph3.c:1.1 src/usr.bin/nbperf/graph3.c:1.2 --- src/usr.bin/nbperf/graph3.c:1.1 Sat Aug 15 16:21:05 2009 +++ src/usr.bin/nbperf/graph3.c Sat Aug 22 17:52:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: graph3.c,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ +/* $NetBSD: graph3.c,v 1.2 2009/08/22 17:52:17 joerg Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. * All rights reserved. @@ -32,7 +32,7 @@ */ #include -__RCSID("$NetBSD: graph3.c,v 1.1 2009/08/15 16:21:05 joerg Exp $"); +__RCSID("$NetBSD: graph3.c,v 1.2 2009/08/22 17:52:17 joerg Exp $"); #include #include @@ -75,7 +75,7 @@ graph3_hash(struct nbperf *nbperf, struct graph3 *graph) { struct vertex3 *v; - uint32_t hashes[nbperf->hash_size]; + uint32_t hashes[NBPERF_MAX_HASH_SIZE]; size_t i; for (i = 0; i < graph->e; ++i) { Index: src/usr.bin/nbperf/nbperf.c diff -u src/usr.bin/nbperf/nbperf.c:1.1 src/usr.bin/nbperf/nbperf.c:1.2 --- src/usr.bin/nbperf/nbperf.c:1.1 Sat Aug 15 16:21:05 2009 +++ src/usr.bin/nbperf/nbperf.c Sat Aug 22 17:52:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: nbperf.c,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ +/* $NetBSD: nbperf.c,v 1.2 2009/08/22 17:52:17 joerg Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. * All rights reserved. @@ -32,7 +32,7 @@ */ #include -__RCSID("$NetBSD: nbperf.c,v 1.1 2009/08/15 16:21:05 joerg Exp $"); +__RCSID("$NetBSD: nbperf.c,v 1.2 2009/08/22 17:52:17 joerg Exp $"); #include #include @@ -87,6 +87,8 @@ nbperf->print_hash = mi_vector_hash_print_hash; return; } + if (nbperf->hash_size > NBPERF_MAX_HASH_SIZE) + errx(1, "Hash function creates too many output values"); errx(1, "Unknown hash function: %s", arg); } Index: src/usr.bin/nbperf/nbperf.h diff -u src/usr.bin/nbperf/nbperf.h:1.1 src/usr.bin/nbperf/nbperf.h:1.2 --- src/usr.bin/nbperf/nbperf.h:1.1 Sat Aug 15 16:21:05 2009 +++ src/usr.bin/nbperf/nbperf.h Sat Aug 22 17:52:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: nbperf.h,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ +/* $NetBSD: nbperf.h,v 1.2 2009/08/22 17:52:17 joerg Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. * All rights reserved. @@ -31,6 +31,8 @@ * SUCH DAMAGE. */ +#define NBPERF_MAX_HASH_SIZE 3 + struct nbperf { FILE *output; FILE *map_output;
CVS commit: src/sys/dev/tc
Module Name:src Committed By: tsutsui Date: Sat Aug 22 17:38:06 UTC 2009 Modified Files: src/sys/dev/tc: bba.c cfb.c mfb.c px.c pxg.c sfb.c sfbplus.c stic.c tcds.c tfb.c xcfb.c Log Message: u_intNN_t -> uintNN_t To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/tc/bba.c src/sys/dev/tc/px.c cvs rdiff -u -r1.56 -r1.57 src/sys/dev/tc/cfb.c src/sys/dev/tc/tfb.c cvs rdiff -u -r1.53 -r1.54 src/sys/dev/tc/mfb.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/tc/pxg.c src/sys/dev/tc/sfbplus.c cvs rdiff -u -r1.79 -r1.80 src/sys/dev/tc/sfb.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/tc/stic.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/tc/tcds.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/tc/xcfb.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/dev/tc/bba.c diff -u src/sys/dev/tc/bba.c:1.36 src/sys/dev/tc/bba.c:1.37 --- src/sys/dev/tc/bba.c:1.36 Tue May 12 14:47:04 2009 +++ src/sys/dev/tc/bba.c Sat Aug 22 17:38:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bba.c,v 1.36 2009/05/12 14:47:04 cegger Exp $ */ +/* $NetBSD: bba.c,v 1.37 2009/08/22 17:38:06 tsutsui Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ /* maxine/alpha baseboard audio (bba) */ #include -__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.36 2009/05/12 14:47:04 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.37 2009/08/22 17:38:06 tsutsui Exp $"); #include #include @@ -186,7 +186,7 @@ static int bba_intr(void *); static void bba_reset(struct bba_softc *, int); -static void bba_codec_dwrite(struct am7930_softc *, int, u_int8_t); +static void bba_codec_dwrite(struct am7930_softc *, int, uint8_t); static uint8_t bba_codec_dread(struct am7930_softc *, int); static int @@ -513,7 +513,7 @@ struct bba_softc *sc; struct bba_dma_state *d; tc_addr_t phys, nphys; - u_int32_t ssr; + uint32_t ssr; int state = 0; DPRINTF(("bba_trigger_input: sc=%p start=%p end=%p blksize=%d intr=%p(%p)\n", Index: src/sys/dev/tc/px.c diff -u src/sys/dev/tc/px.c:1.36 src/sys/dev/tc/px.c:1.37 --- src/sys/dev/tc/px.c:1.36 Tue May 12 14:47:04 2009 +++ src/sys/dev/tc/px.c Sat Aug 22 17:38:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: px.c,v 1.36 2009/05/12 14:47:04 cegger Exp $ */ +/* $NetBSD: px.c,v 1.37 2009/08/22 17:38:06 tsutsui Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.36 2009/05/12 14:47:04 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.37 2009/08/22 17:38:06 tsutsui Exp $"); #include #include @@ -98,14 +98,14 @@ static int px_intr(void *); static uint32_t *px_pbuf_get(struct stic_info *); -static int px_pbuf_post(struct stic_info *, u_int32_t *); +static int px_pbuf_post(struct stic_info *, uint32_t *); void px_cnattach(tc_addr_t); struct px_softc { device_t px_dev; struct stic_info *px_si; - volatile u_int32_t *px_qpoll[PX_BUF_COUNT]; + volatile uint32_t *px_qpoll[PX_BUF_COUNT]; }; CFATTACH_DECL_NEW(px, sizeof(struct px_softc), @@ -159,7 +159,7 @@ v = i * STIC_PACKET_SIZE + si->si_buf_phys + STIC_XCOMM_SIZE; v = ((v & 0x8000) << 3) | (v & 0x7fff); - px->px_qpoll[i] = (volatile u_int32_t *) + px->px_qpoll[i] = (volatile uint32_t *) ((char *)si->si_slotbase + (v >> 9)); } @@ -209,11 +209,11 @@ bpa = VM_PAGE_TO_PHYS(TAILQ_FIRST(&pglist)); } - si->si_vdac = (u_int32_t *)(kva + PX_VDAC_OFFSET); - si->si_vdac_reset = (u_int32_t *)(kva + PX_VDAC_RESET_OFFSET); + si->si_vdac = (uint32_t *)(kva + PX_VDAC_OFFSET); + si->si_vdac_reset = (uint32_t *)(kva + PX_VDAC_RESET_OFFSET); si->si_stic = (volatile struct stic_regs *)(kva + PX_STIC_OFFSET); - si->si_stamp = (u_int32_t *)(kva + PX_STAMP_OFFSET); - si->si_buf = (u_int32_t *)TC_PHYS_TO_UNCACHED(bpa); + si->si_stamp = (uint32_t *)(kva + PX_STAMP_OFFSET); + si->si_buf = (uint32_t *)TC_PHYS_TO_UNCACHED(bpa); si->si_buf_phys = bpa; si->si_buf_size = PX_BUF_SIZE; si->si_disptype = WSDISPLAY_TYPE_PX; @@ -314,13 +314,13 @@ si->si_pbuf_select ^= STIC_PACKET_SIZE; off = si->si_pbuf_select + STIC_XCOMM_SIZE; - return ((u_int32_t *)((char *)si->si_buf + off)); + return ((uint32_t *)((char *)si->si_buf + off)); } static int -px_pbuf_post(struct stic_info *si, u_int32_t *buf) +px_pbuf_post(struct stic_info *si, uint32_t *buf) { - volatile u_int32_t *poll, junk; + volatile uint32_t *poll, junk; volatile struct stic_regs *sr; u_long v; int c; @@ -330,7 +330,7 @@ /* Get address of poll register for this buffer. */ v = (u_long)STIC_KSEG_TO_PHYS(buf); v = ((v & 0x8000) << 3) | (v & 0x7fff); - poll = (volatile u_int32_t *)((char *)si->si_slotbase + (v >> 9)); + poll = (volatile uint32_t *)((char *)si->si_slotbase + (v >> 9)); /* * Read the poll register and make sure the stamp wants to accept Index: src/sys/dev/tc/cfb.c diff -u src/sys/dev/tc/cfb.c:1.56 src/s
CVS commit: src/sys/dev/tc
Module Name:src Committed By: tsutsui Date: Sat Aug 22 17:36:13 UTC 2009 Modified Files: src/sys/dev/tc: sfbplus.c Log Message: MALLOC() -> malloc() To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/tc/sfbplus.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/dev/tc/sfbplus.c diff -u src/sys/dev/tc/sfbplus.c:1.31 src/sys/dev/tc/sfbplus.c:1.32 --- src/sys/dev/tc/sfbplus.c:1.31 Wed Jul 9 13:19:33 2008 +++ src/sys/dev/tc/sfbplus.c Sat Aug 22 17:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sfbplus.c,v 1.31 2008/07/09 13:19:33 joerg Exp $ */ +/* $NetBSD: sfbplus.c,v 1.32 2009/08/22 17:36:12 tsutsui Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.31 2008/07/09 13:19:33 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.32 2009/08/22 17:36:12 tsutsui Exp $"); #include #include @@ -263,8 +263,7 @@ sc->nscreens = 1; } else { - MALLOC(ri, struct rasops_info *, sizeof(struct rasops_info), - M_DEVBUF, M_NOWAIT); + ri = malloc(sizeof(struct rasops_info), M_DEVBUF, M_NOWAIT); if (ri == NULL) { printf(": can't alloc memory\n"); return;
CVS commit: src/usr.bin/unzip
Module Name:src Committed By: joerg Date: Sat Aug 22 17:19:11 UTC 2009 Modified Files: src/usr.bin/unzip: unzip.1 unzip.c Log Message: Add support for -c, make the output of -l/-v more similar to infozip. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/unzip/unzip.1 cvs rdiff -u -r1.2 -r1.3 src/usr.bin/unzip/unzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/unzip/unzip.1 diff -u src/usr.bin/unzip/unzip.1:1.3 src/usr.bin/unzip/unzip.1:1.4 --- src/usr.bin/unzip/unzip.1:1.3 Sat Aug 22 02:19:42 2009 +++ src/usr.bin/unzip/unzip.1 Sat Aug 22 17:19:11 2009 @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: revision 180125$ -.\" $NetBSD: unzip.1,v 1.3 2009/08/22 02:19:42 joerg Exp $ +.\" $NetBSD: unzip.1,v 1.4 2009/08/22 17:19:11 joerg Exp $ .\" .Dd August 22, 2009 .Dt UNZIP 1 @@ -45,6 +45,12 @@ .It Fl a When extracting a text file, convert DOS-style line endings to Unix-style line endings. +.It Fl c +Extract to stdout/screen. +When extracting files from the zipfile, they are written to stdout. +This is similar to +.Fl p , +but doesn't suppress normal output. .It Fl d Ar dir Extract files into the specified directory rather than the current directory. Index: src/usr.bin/unzip/unzip.c diff -u src/usr.bin/unzip/unzip.c:1.2 src/usr.bin/unzip/unzip.c:1.3 --- src/usr.bin/unzip/unzip.c:1.2 Sat Aug 22 02:19:42 2009 +++ src/usr.bin/unzip/unzip.c Sat Aug 22 17:19:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: unzip.c,v 1.2 2009/08/22 02:19:42 joerg Exp $ */ +/* $NetBSD: unzip.c,v 1.3 2009/08/22 17:19:11 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: unzip.c,v 1.2 2009/08/22 02:19:42 joerg Exp $"); +__RCSID("$NetBSD: unzip.c,v 1.3 2009/08/22 17:19:11 joerg Exp $"); #include #include @@ -57,17 +57,18 @@ /* command-line options */ static int a_opt; /* convert EOL */ +static int c_opt; /* extract to stoud */ static const char *d_arg; /* directory */ static int f_opt; /* update existing files only */ static int j_opt; /* junk directories */ static int L_opt; /* lowercase names */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ -static int p_opt; /* extract to stdout */ +static int p_opt; /* extract to stdout, quiet */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ -static int v_opt; /* verbose */ +static int v_opt; /* verbose/list */ /* time when unzip started */ static time_t now; @@ -666,6 +667,9 @@ return; } + if (c_opt) + info("x %s\n", pathname); + text = a_opt; warn = 0; cr = 0; @@ -677,9 +681,10 @@ /* left over CR from previous buffer */ if (a_opt && cr) { - if (len == 0 || buffer[0] != '\n') -if (write(STDOUT_FILENO, "\r", 1) != 1) + if (len == 0 || buffer[0] != '\n') { +if (fwrite("\r", 1, 1, stderr) != 1) error("write('%s')", pathname); + } cr = 0; } @@ -709,7 +714,7 @@ /* simple case */ if (!a_opt || !text) { - if (write(STDOUT_FILENO, buffer, len) != len) + if (fwrite(buffer, 1, len, stdout) != (size_t)len) error("write('%s')", pathname); continue; } @@ -732,7 +737,7 @@ if (q[1] == '\n') break; } - if (write(STDOUT_FILENO, p, q - p) != q - p) + if (fwrite(p, 1, q - p, stdout) != (size_t)(q - p)) error("write('%s')", pathname); } } @@ -746,27 +751,23 @@ static void list(struct archive *a, struct archive_entry *e) { - static int printed_header; char buf[20]; time_t mtime; - if (!printed_header && !q_opt) { - printed_header = 1; - printf(" Length MethodSize Ratio Date Time CRC-32Name\n"); - printf(" -- --- - --\n"); - } + mtime = archive_entry_mtime(e); + strftime(buf, sizeof(buf), "%m-%d-%g %R", localtime(&mtime)); - if (v_opt == 2) { - mtime = archive_entry_mtime(e); - strftime(buf, sizeof(buf), "%m-%d-%g %R", localtime(&mtime)); + if (v_opt == 1) { + printf(" %8ju %s %s\n", + (uintmax_t)archive_entry_size(e), + buf, archive_entry_pathname(e)); + } else if (v_opt == 2) { printf("%8ju Stored %7ju 0%% %s %08x %s\n", (uintmax_t)archive_entry_size(e), (uintmax_t)archive_entry_size(e), buf, 0U, archive_entry_pathname(e)); - } else { - printf("%s\n", archive_entry_pathname(e)); } ac(archive_read_data_skip(a)); } @@ -807,6 +808,7 @@ struct archive *a; struct archive_entry *e; int fd, ret; + uintmax_t total_size, file_count; if ((fd = open(fn, O_RDONLY)) < 0) error("%s", fn); @@ -815,6 +817,16 @@ ac(archive_read_support_format_zip(a)); ac(archive_read_open_fd(a, fd, 8192)); + if (v_opt == 1) { + printf(" Length Date Time Name\n"); + printf(" \n");
CVS commit: [matt-nb5-mips64] src/sys/sys
Module Name:src Committed By: matt Date: Sat Aug 22 17:05:21 UTC 2009 Modified Files: src/sys/sys [matt-nb5-mips64]: systm.h Log Message: Use correct shift count (off by 1). To generate a diff of this commit: cvs rdiff -u -r1.228.4.2.4.1 -r1.228.4.2.4.2 src/sys/sys/systm.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/sys/systm.h diff -u src/sys/sys/systm.h:1.228.4.2.4.1 src/sys/sys/systm.h:1.228.4.2.4.2 --- src/sys/sys/systm.h:1.228.4.2.4.1 Sat Aug 22 00:13:24 2009 +++ src/sys/sys/systm.h Sat Aug 22 17:05:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: systm.h,v 1.228.4.2.4.1 2009/08/22 00:13:24 matt Exp $ */ +/* $NetBSD: systm.h,v 1.228.4.2.4.2 2009/08/22 17:05:21 matt Exp $ */ /*- * Copyright (c) 1982, 1988, 1991, 1993 @@ -141,7 +141,7 @@ #define SYCALL_ARG7_64 0x100 #define SYCALL_RET_64_P(sy) ((sy)->sy_flags & SYCALL_RET_64) #define SYCALL_ARG_64_P(sy, n) ((sy)->sy_flags & (SYCALL_ARG0_64 << (n))) -#define SYCALL_ARG_64_MASK(sy) (((sy)->sy_flags >> 16) & 0xff) +#define SYCALL_ARG_64_MASK(sy) (((sy)->sy_flags >> 17) & 0xff) #define SYCALL_NARGS64(sy) (((sy)->sy_flags >> 12) & 0x0f) #define SYCALL_NARGS64_VAL(n) ((n) << 12)
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips
Module Name:src Committed By: matt Date: Sat Aug 22 16:55:19 UTC 2009 Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: syscall.c Log Message: Use sy_narg, not sy_argsize! Add debug code to pretty print args. To generate a diff of this commit: cvs rdiff -u -r1.37.12.3 -r1.37.12.4 src/sys/arch/mips/mips/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/mips/mips/syscall.c diff -u src/sys/arch/mips/mips/syscall.c:1.37.12.3 src/sys/arch/mips/mips/syscall.c:1.37.12.4 --- src/sys/arch/mips/mips/syscall.c:1.37.12.3 Sat Aug 22 00:28:42 2009 +++ src/sys/arch/mips/mips/syscall.c Sat Aug 22 16:55:19 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.37.12.3 2009/08/22 00:28:42 matt Exp $ */ +/* $NetBSD: syscall.c,v 1.37.12.4 2009/08/22 16:55:19 matt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -107,7 +107,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.3 2009/08/22 00:28:42 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37.12.4 2009/08/22 16:55:19 matt Exp $"); #if defined(_KERNEL_OPT) #include "opt_sa.h" @@ -227,13 +227,12 @@ else callp += code; - nargs = callp->sy_argsize; + nargs = callp->sy_narg; frame->f_regs[_R_V0] = 0; #if !defined(__mips_o32) if (abi != _MIPS_BSD_API_O32) { #endif CTASSERT(sizeof(copyargs[0]) == sizeof(fargs[0])); - /* rval[1] already is V1 */ if (nargs <= nregs) { /* * Just use the frame for the source of arguments @@ -241,6 +240,7 @@ args = fargs; } else { const size_t nsaved = _MIPS_SIM_NEWABI_P(abi) ? 0 : 4; + KASSERT(nargs <= __arraycount(copyargs)); args = copyargs; /* * Copy the arguments passed via register from the * trap frame to our argument array @@ -352,6 +352,22 @@ } while (/*CONSTCOND*/ 0); /* avoid a goto */ #endif +#if 0 + if (p->p_emul->e_syscallnames) + printf("syscall %s:", p->p_emul->e_syscallnames[code]); + else + printf("syscall %u:", code); + if (nargs == 0) + printf(" "); + else for (size_t j = 0; j < nargs; j++) { + if (j == nregs) printf(" *"); + printf(" [%s%zu]=%#"PRIxREGISTER, + SYCALL_ARG_64_P(callp, j) ? "+" : "", + j, args[j]); + } + printf("\n"); +#endif + if (__predict_false(p->p_trace_enabled) && (error = trace_enter(code, args, nargs)) != 0) goto out;
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 15:16:50 UTC 2009 Modified Files: src/usr.bin/sort: msort.c Log Message: Add some comments and clarifications to this inpeneterable code. When merging ensure we accurable sort records with identical keys by file-number, otherwise a 'stable' sort won't be! To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/sort/msort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/msort.c diff -u src/usr.bin/sort/msort.c:1.23 src/usr.bin/sort/msort.c:1.24 --- src/usr.bin/sort/msort.c:1.23 Sat Aug 22 10:53:28 2009 +++ src/usr.bin/sort/msort.c Sat Aug 22 15:16:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: msort.c,v 1.23 2009/08/22 10:53:28 dsl Exp $ */ +/* $NetBSD: msort.c,v 1.24 2009/08/22 15:16:50 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include "fsort.h" #ifndef lint -__RCSID("$NetBSD: msort.c,v 1.23 2009/08/22 10:53:28 dsl Exp $"); +__RCSID("$NetBSD: msort.c,v 1.24 2009/08/22 15:16:50 dsl Exp $"); __SCCSID("@(#)msort.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -139,7 +139,7 @@ { int c, i, j, nf = nfiles; struct mfile *flistb[MERGE_FNUM], **flist = flistb, *cfile; - size_t availsz = bufsize; + size_t availsz; static void *bufs[MERGE_FNUM + 1]; static size_t bufs_sz[MERGE_FNUM + 1]; @@ -191,47 +191,65 @@ } } + /* + * We now loop reading a new record from the file with the + * 'sorted first' existing record. + * As each record is added, the 'first' record is written to the + * output file - maintaining one record from each file in the sorted + * list. + */ cfile = (struct mfile *) bufs[nf]; - cfile->flno = flist[0]->flno; cfile->end = (u_char *) cfile + bufs_sz[nf]; - while (nfiles) { - for (c = 1; c == 1;) { - c = get(cfile->flno, 0, NULL, nfiles, cfile->rec, - cfile->end, ftbl); - if (c == EOF) { -put(flist[0]->rec, outfp); -if (--nfiles > 0) { - flist++; - cfile->flno = flist[0]->flno; -} + cfile->flno = flist[0]->flno; + for (;;) { + c = get(cfile->flno, 0, NULL, nfiles, cfile->rec, + cfile->end, ftbl); + if (c == EOF) { + /* Write out last record from now-empty input */ + put(flist[0]->rec, outfp); + if (--nfiles == 0) break; - } - if (c == BUFFEND) { -char *oldbuf = (char *) cfile; -availsz = (char *) cfile->end - oldbuf; -availsz *= 2; -cfile = realloc(oldbuf, availsz); -if (!cfile) - err(2, "merge: realloc"); - -for (i = 0; i < nf + 1; i++) { - if (bufs[i] == oldbuf) { - bufs[i] = (char *)cfile; - bufs_sz[i] = availsz; - break; - } + /* Replace from file with now-first sorted record. */ + /* (Moving base 'flist' saves copying everything!) */ + flist++; + cfile->flno = flist[0]->flno; + continue; + } + if (c == BUFFEND) { + /* Buffer not large enough - double in size */ + char *oldbuf = (char *) cfile; + availsz = (char *) cfile->end - oldbuf; + availsz *= 2; + cfile = realloc(oldbuf, availsz); + if (!cfile) +err(2, "merge: realloc"); + cfile->end = (u_char *)cfile + availsz; + + /* Update pointers we'll use for next merge */ + for (i = 0; i < nf + 1; i++) { +if (bufs[i] == oldbuf) { + bufs[i] = (char *)cfile; + bufs_sz[i] = availsz; + break; } - -cfile->end = (u_char *)cfile + availsz; -c = 1; -continue; } - - c = insert(flist, &cfile, nfiles, DELETE); - if (c == 0) -put(cfile->rec, outfp); + /* Read again from same file into same buffer */ + continue; } - } + + /* Add into sort, removing the original first entry */ + c = insert(flist, &cfile, nfiles, DELETE); + + /* + * 'cfile' is now the buffer from the old record from the + * file we just read, but with the file number of the + * current 'first record. + * (Unless we are rejecting a duplicate, when c == 1 and + * it is unchanged!) + */ + if (c == 0) + put(cfile->rec, outfp); + } } /* @@ -240,67 +258,64 @@ */ static int insert(struct mfile **flist, struct mfile **rec, int ttop, int delete) - /* delete, ttop: delete = 0 or 1 */ { struct mfile *tmprec = *rec; int mid, top = ttop, bot = 0, cmpv = 1; for (mid = top / 2; bot + 1 != top; mid = (bot + top) / 2) { cmpv = cmp(tmprec->rec, flist[mid]->rec); - if (cmpv < 0) - top = mid; - else if (cmpv > 0) - bot = mid; - else { + if (cmpv == 0 ) { if (UNIQUE) -break; - +/* Duplicate key, read another record */ +return 1; /* - * Apply sort by fileno, to give priority - * to earlier specified files, hence providing - * more stable sort. - * If fileno is same, the new record should - * be put _after_ the previous entry. + * Apply sort by fileno, to give priority to earlier + * specified files, hence providing a stable sort. + * We could truncate the
CVS commit: src/usr.bin/sort
Module Name:src Committed By: dsl Date: Sat Aug 22 10:53:28 UTC 2009 Modified Files: src/usr.bin/sort: append.c fields.c files.c fsort.c init.c msort.c sort.c sort.h Log Message: Rework the way sort generates sort keys: - If we generate a key, it is always sortable using memcmp() - If we are sorting the whole record, then a weight-table must be used during compares. - Major surgery to encoding of numbers to ensure unique keys for equal numeric values. Reverse numerics are handled by inverting the sign. - Case folding (-f) is handled when the sort keys are generated. No other code has to care at all. - Key uniqueness (-u) is done during merge for large datasets. It only has to be done when writing the output file for small files. Since the file is in key order this is simple! Probably fixes all of: PR/27257 PR/25551 PR/22182 PR/31095 PR/30504 PR/36816 PR/37860 PR/39308 Also PR/18614 should no longer die, but a little more work needs to be done on the merging for very large files. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/sort/append.c src/usr.bin/sort/init.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/sort/fields.c src/usr.bin/sort/sort.h cvs rdiff -u -r1.34 -r1.35 src/usr.bin/sort/files.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/sort/fsort.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/sort/msort.c cvs rdiff -u -r1.51 -r1.52 src/usr.bin/sort/sort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/sort/append.c diff -u src/usr.bin/sort/append.c:1.19 src/usr.bin/sort/append.c:1.20 --- src/usr.bin/sort/append.c:1.19 Thu Aug 20 06:36:25 2009 +++ src/usr.bin/sort/append.c Sat Aug 22 10:53:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: append.c,v 1.19 2009/08/20 06:36:25 dsl Exp $ */ +/* $NetBSD: append.c,v 1.20 2009/08/22 10:53:28 dsl Exp $ */ /*- * Copyright (c) 2000-2003 The NetBSD Foundation, Inc. @@ -64,118 +64,82 @@ #include "sort.h" #ifndef lint -__RCSID("$NetBSD: append.c,v 1.19 2009/08/20 06:36:25 dsl Exp $"); +__RCSID("$NetBSD: append.c,v 1.20 2009/08/22 10:53:28 dsl Exp $"); __SCCSID("@(#)append.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ #include #include -#define OUTPUT { \ - if ((n = cpos - ppos) > 1) { \ - ppos -= n; \ - radix_sort(ppos, n, wts1, REC_D); \ - for (; ppos < cpos; ppos++) {\ - prec = (const RECHEADER *) (*ppos - REC_DATA_OFFSET);\ - put(prec, fp); \ - } \ - } else put(prec, fp); \ +static int +wt_cmp(const u_char *a, const u_char *b, size_t len, u_char *wts) +{ +size_t i; + +for (i = 0; i < len; i++) { + if (wts[*a++] != wts[*b++]) + return 1; +} + +return 0; } /* * copy sorted lines to output; check for uniqueness */ void -append(const u_char **keylist, int nelem, FILE *fp, put_func_t put, -struct field *ftbl) +append(const u_char **keylist, int nelem, FILE *fp, put_func_t put, u_char *wts) { - u_char *wts, *wts1; - int n; - const u_char **cpos, **ppos, **lastkey; - const u_char *cend, *pend, *start; + const u_char **cpos, **lastkey; const struct recheader *crec, *prec; + size_t plen; - if (*keylist == '\0' && UNIQUE) + lastkey = keylist + nelem; + if (!UNIQUE || wts == NULL) { + for (cpos = keylist; cpos < lastkey; cpos++) + put((const RECHEADER *)(*cpos - REC_DATA_OFFSET), fp); return; - - wts1 = wts = ftbl[0].weights; - if ((!UNIQUE) && SINGL_FLD && ftbl[0].flags & F) { - /* Folding case */ - if (ftbl[0].flags & R) - wts1 = Rascii; - else - wts1 = ascii; } - lastkey = keylist + nelem; - if (SINGL_FLD && (UNIQUE || wts1 != wts)) { - ppos = keylist; - prec = (const RECHEADER *) (*ppos - REC_DATA_OFFSET); - if (UNIQUE) - put(prec, fp); + if (nelem == 0) + return; + + cpos = keylist; + prec = (const RECHEADER *) (*cpos - REC_DATA_OFFSET); + + if (!SINGL_FLD) { + /* Key for each line is already in adjacent bytes */ + plen = prec->offset; for (cpos = &keylist[1]; cpos < lastkey; cpos++) { crec = (const RECHEADER *) (*cpos - REC_DATA_OFFSET); - if (crec->length == prec->length) { -/* - * Set pend and cend so that trailing NUL and - * record separator is ignored. - */ -pend = (const u_char *) &prec->data + prec->length - 2; -cend = (const u_char *) &crec->data + crec->length - 2; -for (start = *cpos; cend >= start; cend--) { - if (wts[*cend] != wts[*pend]) - break; - pend--; -} -if (pend + 1 != *ppos) { - if (!UNIQUE) { - OUTPUT; - } else - put(crec, fp); - ppos = cpos; - prec = crec; -} - } else { -if (!UNIQUE) { - OUTPUT; -} else - put(crec, fp); -ppos = cpos; -prec = crec; + if (crec->offset == plen + && memcmp(crec->data, prec->data, plen) == 0) { +/* Duplicate key */ +continue; } + put(prec, fp); + prec = crec; + plen = prec->offset; } - if (!UNIQUE) { O
CVS commit: src/sys/arch/mvme68k/stand/bootxx
Module Name:src Committed By: he Date: Sat Aug 22 10:02:21 UTC 2009 Modified Files: src/sys/arch/mvme68k/stand/bootxx: bootxx.c Log Message: This one needs , so include it explicitly. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mvme68k/stand/bootxx/bootxx.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/mvme68k/stand/bootxx/bootxx.c diff -u src/sys/arch/mvme68k/stand/bootxx/bootxx.c:1.15 src/sys/arch/mvme68k/stand/bootxx/bootxx.c:1.16 --- src/sys/arch/mvme68k/stand/bootxx/bootxx.c:1.15 Mon Apr 28 20:23:29 2008 +++ src/sys/arch/mvme68k/stand/bootxx/bootxx.c Sat Aug 22 10:02:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bootxx.c,v 1.15 2008/04/28 20:23:29 martin Exp $ */ +/* $NetBSD: bootxx.c,v 1.16 2009/08/22 10:02:21 he Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -43,6 +43,7 @@ #include #include #include +#include #include #include