diff --git a/sys/arch/arm32/arm32/bcopy_page.S b/sys/arch/arm/arm32/bcopy_page.S similarity index 98% rename from sys/arch/arm32/arm32/bcopy_page.S rename to sys/arch/arm/arm32/bcopy_page.S index 34003b2caf1b..585027e75c5d 100644 --- a/sys/arch/arm32/arm32/bcopy_page.S +++ b/sys/arch/arm/arm32/bcopy_page.S @@ -1,4 +1,4 @@ -/* $NetBSD: bcopy_page.S,v 1.5 1998/04/01 23:00:13 mark Exp $ */ +/* $NetBSD: bcopy_page.S,v 1.1 2001/03/04 08:25:39 matt Exp $ */ /* * Copyright (c) 1995 Scott Stevens diff --git a/sys/arch/arm32/arm32/bcopyinout.S b/sys/arch/arm/arm32/bcopyinout.S similarity index 98% rename from sys/arch/arm32/arm32/bcopyinout.S rename to sys/arch/arm/arm32/bcopyinout.S index 72ad2f9cde21..7d484960c69c 100644 --- a/sys/arch/arm32/arm32/bcopyinout.S +++ b/sys/arch/arm/arm32/bcopyinout.S @@ -1,4 +1,4 @@ -/* $NetBSD: bcopyinout.S,v 1.20 1999/10/26 06:53:41 cgd Exp $ */ +/* $NetBSD: bcopyinout.S,v 1.1 2001/03/04 08:25:39 matt Exp $ */ /* * Copyright (c) 1995-1998 Mark Brinicombe. diff --git a/sys/arch/arm32/arm32/compat_13_machdep.c b/sys/arch/arm/arm32/compat_13_machdep.c similarity index 98% rename from sys/arch/arm32/arm32/compat_13_machdep.c rename to sys/arch/arm/arm32/compat_13_machdep.c index 8e079f18da2c..e3c68749310e 100644 --- a/sys/arch/arm32/arm32/compat_13_machdep.c +++ b/sys/arch/arm/arm32/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.3 2001/02/28 18:15:43 bjh21 Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.1 2001/03/04 08:25:39 matt Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. diff --git a/sys/arch/arm32/arm32/copystr.S b/sys/arch/arm/arm32/copystr.S similarity index 98% rename from sys/arch/arm32/arm32/copystr.S rename to sys/arch/arm/arm32/copystr.S index ed6978c2c3fc..471079c57289 100644 --- a/sys/arch/arm32/arm32/copystr.S +++ b/sys/arch/arm/arm32/copystr.S @@ -1,4 +1,4 @@ -/* $NetBSD: copystr.S,v 1.13 1999/11/03 15:32:45 chs Exp $ */ +/* $NetBSD: copystr.S,v 1.1 2001/03/04 08:25:39 matt Exp $ */ /* * Copyright (c) 1995 Mark Brinicombe. diff --git a/sys/arch/arm32/arm32/strstr.c b/sys/arch/arm/arm32/strstr.c similarity index 97% rename from sys/arch/arm32/arm32/strstr.c rename to sys/arch/arm/arm32/strstr.c index ade4aadcc441..206dafb55fab 100644 --- a/sys/arch/arm32/arm32/strstr.c +++ b/sys/arch/arm/arm32/strstr.c @@ -1,4 +1,4 @@ -/* $NetBSD: strstr.c,v 1.3 1998/02/21 22:56:58 mark Exp $ */ +/* $NetBSD: strstr.c,v 1.1 2001/03/04 08:25:39 matt Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. diff --git a/sys/arch/arm/conf/files.arm b/sys/arch/arm/conf/files.arm index 7c2699685d1a..51f8270a1051 100644 --- a/sys/arch/arm/conf/files.arm +++ b/sys/arch/arm/conf/files.arm @@ -1,4 +1,4 @@ -# $NetBSD: files.arm,v 1.14 2001/03/04 05:17:41 matt Exp $ +# $NetBSD: files.arm,v 1.15 2001/03/04 08:25:38 matt Exp $ # temporary define to allow easy moving to ../arch/arm/arm32 defopt ARM32 @@ -52,6 +52,13 @@ file arch/arm/arm/disksubr_acorn.c disk file arch/arm/arm/disksubr_mbr.c disk # files common to arm32 implementations +file arch/arm/arm32/compat_13_machdep.c arm32 & compat_13 file arch/arm/arm32/pmap.c arm32 -file arch/arm/arm32/sys_machdep.c arm32 file arch/arm/arm32/syscall.c arm32 +file arch/arm/arm32/sys_machdep.c arm32 + +# arm32 library functions +file arch/arm/arm32/strstr.c arm32 +file arch/arm/arm32/bcopy_page.S arm32 +file arch/arm/arm32/bcopyinout.S arm32 +file arch/arm/arm32/copystr.S arm32 diff --git a/sys/arch/arm32/conf/files.arm32 b/sys/arch/arm32/conf/files.arm32 index f05a4abf7309..acac6ec17418 100644 --- a/sys/arch/arm32/conf/files.arm32 +++ b/sys/arch/arm32/conf/files.arm32 @@ -1,4 +1,4 @@ -# $NetBSD: files.arm32,v 1.97 2001/03/04 05:15:39 matt Exp $ +# $NetBSD: files.arm32,v 1.98 2001/03/04 08:25:38 matt Exp $ # # First try for arm-specific configuration info # @@ -341,12 +341,6 @@ file arch/arm32/arm32/spl.S file arch/arm32/arm32/intr.c file arch/arm32/dev/bus_space_notimpl.S -# library functions -file arch/arm32/arm32/strstr.c -file arch/arm32/arm32/bcopy_page.S -file arch/arm32/arm32/bcopyinout.S -file arch/arm32/arm32/copystr.S - # files related to the shell file arch/arm32/kshell/kshell_input.c kshell file arch/arm32/kshell/kshell_shell.c kshell @@ -484,10 +478,3 @@ include "dev/usb/files.usb" include "dev/wscons/files.wscons" include "dev/pckbc/files.pckbc" - -# -# Compatibility modules -# - -# Binary compatibility with previous NetBSD releases (COMPAT_XX) -file arch/arm32/arm32/compat_13_machdep.c compat_13 diff --git a/sys/arch/hpcarm/conf/files.hpcarm b/sys/arch/hpcarm/conf/files.hpcarm index 5e349838fec5..7589efe256ae 100644 --- a/sys/arch/hpcarm/conf/files.hpcarm +++ b/sys/arch/hpcarm/conf/files.hpcarm @@ -1,4 +1,4 @@ -# $NetBSD: files.hpcarm,v 1.7 2001/02/27 17:56:32 bjh21 Exp $ +# $NetBSD: files.hpcarm,v 1.8 2001/03/04 08:25:38 matt Exp $ # # First try for arm-specific configuration info # @@ -26,35 +26,28 @@ major {md = 18} #file arch/hpcarm/dev/kbd.c kbd needs-flag # Generic MD files -file arch/hpcarm/hpcarm/autoconf.c file arch/hpcarm/hpcarm/ast.c -file arch/hpcarm/hpcarm/conf.c -file arch/hpcarm/hpcarm/fault.c -file arch/hpcarm/hpcarm/procfs_machdep.c procfs -file arch/hpcarm/hpcarm/machdep.c -file arch/hpcarm/hpcarm/mem.c -file arch/hpcarm/hpcarm/cpufunc.c -file arch/hpcarm/hpcarm/stubs.c -file arch/hpcarm/hpcarm/undefined.c -file arch/hpcarm/hpcarm/process_machdep.c -file arch/hpcarm/hpcarm/sys_machdep.c -file arch/hpcarm/hpcarm/strstr.c -file arch/hpcarm/hpcarm/pmap.c -file arch/hpcarm/hpcarm/vm_machdep.c +file arch/hpcarm/hpcarm/autoconf.c file arch/hpcarm/hpcarm/blockio.S +file arch/hpcarm/hpcarm/bus_space_notimpl.S +file arch/hpcarm/hpcarm/conf.c +file arch/hpcarm/hpcarm/cpufunc.c file arch/hpcarm/hpcarm/cpufunc_asm.S file arch/hpcarm/hpcarm/cpuswitch.S file arch/hpcarm/hpcarm/exception.S -file arch/hpcarm/hpcarm/syscall.c -file arch/hpcarm/hpcarm/bcopyinout.S -file arch/hpcarm/hpcarm/bcopy_page.S +file arch/hpcarm/hpcarm/fault.c +file arch/hpcarm/hpcarm/fusu.S +file arch/hpcarm/hpcarm/intr.c +file arch/hpcarm/hpcarm/machdep.c +file arch/hpcarm/hpcarm/mem.c +file arch/hpcarm/hpcarm/process_machdep.c +file arch/hpcarm/hpcarm/procfs_machdep.c procfs file arch/hpcarm/hpcarm/setcpsr.S file arch/hpcarm/hpcarm/setstack.S file arch/hpcarm/hpcarm/spl.S -file arch/hpcarm/hpcarm/intr.c -file arch/hpcarm/hpcarm/copystr.S -file arch/hpcarm/hpcarm/fusu.S -file arch/hpcarm/hpcarm/bus_space_notimpl.S +file arch/hpcarm/hpcarm/stubs.c +file arch/hpcarm/hpcarm/undefined.c +file arch/hpcarm/hpcarm/vm_machdep.c # # H/PC Platform common files. @@ -66,9 +59,6 @@ include "dev/hpc/files.hpcfb" include "dev/hpc/files.hpckbd" include "dev/hpc/files.hpctp" -# Console autoconfiguration code: selects between a framebuffers -file dev/cons.c - # # Workstation Console # @@ -81,11 +71,6 @@ file dev/cninit.c #file arch/hpcarm/fpe-arm/armfpe_init.c armfpe #file arch/hpcarm/fpe-arm/armfpe.s armfpe -# DDB -file arch/hpcarm/hpcarm/db_interface.c ddb -file arch/hpcarm/hpcarm/db_trace.c ddb -file arch/hpcarm/hpcarm/db_machdep.c ddb - # HPCARM specific files file arch/hpcarm/hpcarm/hpc_machdep.c hpcarm @@ -126,7 +111,7 @@ include "dev/isa/files.isa" include "dev/ata/files.ata" major {wd = 16} -# Include SCSI stuff +# Include SCSI/ATAPI stuff include "dev/scsipi/files.scsipi" major {sd = 24} major {cd = 26} @@ -142,10 +127,3 @@ include "dev/mii/files.mii" # Include USB stuff include "dev/usb/files.usb" - -# -# Compatibility modules -# - -# Binary compatibility with previous NetBSD releases (COMPAT_XX) -file arch/hpcarm/hpcarm/compat_13_machdep.c compat_13 diff --git a/sys/arch/hpcarm/hpcarm/bcopy_page.S b/sys/arch/hpcarm/hpcarm/bcopy_page.S deleted file mode 100644 index 7dd2ec5dd52e..000000000000 --- a/sys/arch/hpcarm/hpcarm/bcopy_page.S +++ /dev/null @@ -1,152 +0,0 @@ -/* $NetBSD: bcopy_page.S,v 1.1 2001/02/23 03:48:08 ichiro Exp $ */ - -/* - * Copyright (c) 1995 Scott Stevens - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Scott Stevens. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * RiscBSD kernel project - * - * bcopy_page.S - * - * page optimised bcopy and bzero routines - * - * Created : 08/04/95 - */ - -#include -#include - -/* - * bcopy_page(src, dest) - * - * Optimised copy page routine. - * - * On entry: - * r0 - src address - * r1 - dest address - * - * Requires: - * number of bytes per page (NBPG) is a multiple of 512 - */ - -ENTRY(bcopy_page) - stmfd sp!, {r4-r10, lr} - mov r2, #(NBPG >> 9) - -Lloopcopy: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - - subs r2, r2, #1 - bne Lloopcopy - - ldmfd sp!, {r4-r10, pc} - -/* - * bzero_page(dest) - * - * Optimised zero page routine. - * - * On entry: - * r0 - dest address - * - * Requires: - * number of bytes per page (NBPG) is a multiple of 512 - */ - -ENTRY(bzero_page) - stmfd sp!, {r4-r10, lr} - mov r2, #(NBPG >> 9) - - mov r3, #0 - mov r4, #0 - mov r5, #0 - mov r6, #0 - mov r7, #0 - mov r8, #0 - mov r9, #0 - mov r10, #0 - -Lloopzero: - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - stmia r0!, {r3-r10} - - subs r2, r2, #1 - bne Lloopzero - - ldmfd sp!, {r4-r10, pc} diff --git a/sys/arch/hpcarm/hpcarm/bcopyinout.S b/sys/arch/hpcarm/hpcarm/bcopyinout.S deleted file mode 100644 index 204378cebdc4..000000000000 --- a/sys/arch/hpcarm/hpcarm/bcopyinout.S +++ /dev/null @@ -1,243 +0,0 @@ -/* $NetBSD: bcopyinout.S,v 1.1 2001/02/23 03:48:08 ichiro Exp $ */ - -/* - * Copyright (c) 1995-1998 Mark Brinicombe. - * Copyright (c) 1995 Brini. - * All rights reserved. - * - * This code is derived from software written for Brini by Mark Brinicombe - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mark Brinicombe. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * - * bcopyinout.S - * - * optimized and fault protected byte copy functions - * - * Created : 16/05/95 - */ - -#include "assym.h" - -#include -#include - - .text - .align 0 -Lcurpcb: - .word _C_LABEL(curpcb) - -Lvm_min_address: - .word VM_MIN_ADDRESS -Lvm_maxuser_address: - .word VM_MAXUSER_ADDRESS -Lvm_maxkern_address: - .word VM_MAXKERN_ADDRESS - -ENTRY(kcopy) - b do_copyinout - -/* - * r0 = user space address - * r1 = kernel space address - * r2 = length - * - * Copies bytes from user space to kernel space - */ - -ENTRY(copyin) - /* Validate user and kernel addresses */ - ldr r3, Lvm_min_address - cmp r0, r3 - bcc Lbadaddress - ldr r3, Lvm_maxuser_address - cmp r0, r3 - bcs Lbadaddress - cmp r1, r3 - bcc Lbadaddress - ldr r3, Lvm_maxkern_address - cmp r1, r3 - bcs Lbadaddress - - /* Quick exit if length is zero */ - teq r2, #0 - moveq r0, #0 - moveq pc, lr - - /* Do the actual copy */ - b do_copyinout - -/* - * r0 = kernel space address - * r1 = user space address - * r2 = length - * - * Copies bytes from user space to kernel space - */ - -Lpgbase: - .long PROCESS_PAGE_TBLS_BASE - -ENTRY(copyout) - /* Validate user and kernel addresses */ - ldr r3, Lvm_min_address - cmp r1, r3 - bcc Lbadaddress - ldr r3, Lvm_maxuser_address - cmp r1, r3 - bcs Lbadaddress - cmp r0, r3 - bcc Lbadaddress - ldr r3, Lvm_maxkern_address - cmp r0, r3 - bcs Lbadaddress - - /* Quick exit if length is zero */ - teq r2, #0 - moveq r0, #0 - moveq pc, lr - - /* Check the page protection for copy-on-write */ - stmfd sp!, {r4-r7} - ldr r4, Lcurpcb - ldr r4, [r4] - - ldr r5, [r4, #PCB_ONFAULT] - add r3, pc, #do_cowfault - . - 8 - str r3, [r4, #PCB_ONFAULT] - - ldr r3, Lpgbase - add r6, r3, r1, lsr #(PGSHIFT-2) - bic r6, r6, #3 /* beginning PTE */ - - mov r7, r1, lsl #(32-PGSHIFT) - add r7, r2, r7, lsr #(32-PGSHIFT) - sub r7, r7, #1 - mov r7, r7, lsr #(PGSHIFT) /* number of pages -1 */ - -do_ptecheck: - ldr r3, [r6] /* grab PTE */ - tst r3, #1 /* check writable bit */ - beq do_cowfault /* if clear, do COW fault */ -do_ptecheck_next: - add r6, r6, #4 - subs r7, r7, #1 - bpl do_ptecheck - str r5, [r4, #PCB_ONFAULT] - ldmfd sp!, {r4-r7} - - /* Do the actual copy */ - b do_copyinout - -do_cowfault: - stmfd sp!, {r0-r2, lr} - ldr r3, Lpgbase - sub r0, r6, r3 - mov r0, r0, lsl #(PGSHIFT-2) /* calculate VA of page */ - bl _C_LABEL(cowfault) - mov r3, r0 - ldmfd sp!, {r0-r2, lr} - teq r3, #0 /* check for error return */ - beq do_ptecheck_next - mov r0, r3 - str r5, [r4, #PCB_ONFAULT] - ldmfd sp!, {r4-r7} - mov pc, lr - -do_copyinout: - stmfd sp!, {r4, r5} - ldr r4, Lcurpcb - ldr r4, [r4] - -#ifdef DIAGNOSTIC - teq r4, #0x00000000 - beq Lcopyinoutpcbfault -#endif /* DIAGNOSTIC */ - - ldr r5, [r4, #PCB_ONFAULT] - add r3, pc, #Lcopyinoutfault - . - 8 - str r3, [r4, #PCB_ONFAULT] - - /* - * If less than 4 bytes or the source or destination address is - * not 32 bit aligned then copy it slowly, byte at a time. - * Otherwise copy it 32 bites at a time. - */ - subs r2, r2, #4 - bmi Lslow_copyinout - tst r0, #3 - tsteq r1, #3 - bne Lslow_copyinout - -Lcopyinout_loop: - ldr r3, [r0], #0x0004 - str r3, [r1], #0x0004 - subs r2, r2, #0x00000004 - bpl Lcopyinout_loop - - tst r2, #3 - beq Lcopyinout_exit - -Lslow_copyinout: - add r2, r2, #4 - -Lslow_copyinout_loop: - ldrb r3, [r0], #0x0001 - strb r3, [r1], #0x0001 - subs r2, r2, #0x00000001 - bne Lslow_copyinout_loop - -Lcopyinout_exit: - mov r0, #0x00000000 - str r5, [r4, #PCB_ONFAULT] - ldmfd sp!, {r4, r5} - mov pc, lr - -/* A fault occurred during the copy */ -Lcopyinoutfault: - str r5, [r4, #PCB_ONFAULT] - ldmfd sp!, {r4, r5} - - /* FALLTHROUGH */ - -/* Source or Destination address was bad so fail */ -Lbadaddress: - /* Don't return EFAULT if legnth was zero */ - teq r2, #0x00000000 - moveq r0, #0x00000000 - movne r0, #EFAULT - mov pc, lr - -#ifdef DIAGNOSTIC -Lcopyinoutpcbfault: - mov r2, r1 - mov r1, r0 - add r0, pc, #Lcopyinouttext - . - 8 - b _C_LABEL(panic) - -Lcopyinouttext: - .asciz "No valid PCB during copyinout() addr1=%08x addr2=%08x\n" - .align 0 -#endif /* DIAGNOSTIC */ diff --git a/sys/arch/hpcarm/hpcarm/copystr.S b/sys/arch/hpcarm/hpcarm/copystr.S deleted file mode 100644 index 5aba2254a33d..000000000000 --- a/sys/arch/hpcarm/hpcarm/copystr.S +++ /dev/null @@ -1,209 +0,0 @@ -/* $NetBSD: copystr.S,v 1.1 2001/02/23 03:48:09 ichiro Exp $ */ - -/* - * Copyright (c) 1995 Mark Brinicombe. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mark Brinicombe. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * copystr.S - * - * optimised and fault protected copystr functions - * - * Created : 16/05/95 - */ - -#include "assym.h" -#include -#include - - .text - .align 0 -Lcurpcb: - .word _C_LABEL(curpcb) - -Lvm_min_address: - .word VM_MIN_ADDRESS -Lvm_maxuser_address: - .word VM_MAXUSER_ADDRESS -Lvm_maxkern_address: - .word VM_MAXKERN_ADDRESS - -/* - * r0 - from - * r1 - to - * r2 - maxlens - * r3 - lencopied - * - * Copy string from r0 to r1 - */ - -ENTRY(copystr) - stmfd sp!, {r4-r5} - teq r2, #0x00000000 - mov r5, #0x00000000 - moveq r0, #ENAMETOOLONG - beq Lcopystrexit - -Lcopystr_loop: - ldrb r4, [r0], #0x0001 - strb r4, [r1], #0x0001 - add r5, r5, #0x00000001 - teq r4, #0x00000000 - teqne r5, r2 - bne Lcopystr_loop - - teq r4, #0x00000000 - moveq r0, #0x00000000 - movne r0, #ENAMETOOLONG - -Lcopystrexit: - teq r3, #0x00000000 - strne r5, [r3] - - ldmfd sp!, {r4-r5} - mov pc, lr - - -/* - * r0 - user space address - * r1 - kernel space address - * r2 - maxlens - * r3 - lencopied - * - * Copy string from user space to kernel space - */ - -ENTRY(copyinstr) - stmfd sp!, {r4-r6} - - /* Validate user and kernel addresses */ - ldr r4, Lvm_min_address - cmp r0, r4 - bcc Lbadaddress - ldr r4, Lvm_maxuser_address - cmp r0, r4 - bcs Lbadaddress - cmp r1, r4 - bcc Lbadaddress - ldr r4, Lvm_maxkern_address - cmp r1, r4 - bcs Lbadaddress - - /* Do the actual copy */ - b do_copyinoutstr - -/* - * r0 - kernel space address - * r1 - user space address - * r2 - maxlens - * r3 - lencopied - * - * Copy string from kernel space to user space - */ - -ENTRY(copyoutstr) - stmfd sp!, {r4-r6} - - /* Validate user and kernel addresses */ - ldr r4, Lvm_min_address - cmp r1, r4 - bcc Lbadaddress - ldr r4, Lvm_maxuser_address - cmp r1, r4 - bcs Lbadaddress - cmp r0, r4 - bcc Lbadaddress - ldr r4, Lvm_maxkern_address - cmp r0, r4 - bcs Lbadaddress - - /* Do the actual copy */ -do_copyinoutstr: - teq r2, #0x00000000 - mov r6, #0x00000000 - moveq r0, #ENAMETOOLONG - beq Lcopyinoutstrexit - - ldr r4, Lcurpcb - ldr r4, [r4] - -#ifdef DIAGNOSTIC - teq r4, #0x00000000 - beq Lcopystrpcbfault -#endif - - add r5, pc, #Lcopystrfault - . - 8 - str r5, [r4, #PCB_ONFAULT] - -Lcopyinoutstr_loop: - ldrb r5, [r0], #0x0001 - strb r5, [r1], #0x0001 - add r6, r6, #0x00000001 - teq r5, #0x00000000 - teqne r6, r2 - bne Lcopyinoutstr_loop - - mov r0, #0x00000000 - str r0, [r4, #PCB_ONFAULT] - - teq r5, #0x00000000 - moveq r0, #0x00000000 - movne r0, #ENAMETOOLONG - -Lcopyinoutstrexit: - teq r3, #0x00000000 - strne r6, [r3] - - ldmfd sp!, {r4-r6} - mov pc, lr - -/* A fault occurred during the copy */ -Lcopystrfault: - mov r0, #0x00000000 - str r0, [r4, #PCB_ONFAULT] - - /* FALLTHROUGH */ - -/* Source or Destination address was bad so fail */ -Lbadaddress: - ldmfd sp!, {r4-r6} - mov r0, #EFAULT - mov pc, lr - -#ifdef DIAGNOSTIC -Lcopystrpcbfault: - mov r2, r1 - mov r1, r0 - add r0, pc, #Lcopystrpcbfaulttext - . - 8 - b _C_LABEL(panic) - -Lcopystrpcbfaulttext: - .asciz "No valid PCB during copyinoutstr() addr1=%08x addr2=%08x\n" - .align 0 -#endif diff --git a/sys/arch/hpcarm/hpcarm/strstr.c b/sys/arch/hpcarm/hpcarm/strstr.c deleted file mode 100644 index aab2f803e2d9..000000000000 --- a/sys/arch/hpcarm/hpcarm/strstr.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: strstr.c,v 1.1 2001/02/23 03:48:13 ichiro Exp $ */ - -/* - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: strstr.c,v 1.4 1995/06/15 00:08:43 jtc Exp - */ - -#include -#include - -/* - * Find the first occurrence of find in s. - */ - -char * -strstr(s, find) - const char *s, *find; -{ - char c, sc; - size_t len; - - if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; - } - return ((char *)s); -} - -/* End of strstr.c */