Index: head/sys/conf/files.mips =================================================================== --- head/sys/conf/files.mips (revision 334180) +++ head/sys/conf/files.mips (revision 334181) @@ -1,117 +1,116 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # # $FreeBSD$ # # Arch dependent files mips/mips/autoconf.c standard mips/mips/bus_space_generic.c standard mips/mips/busdma_machdep.c standard mips/mips/cache.c standard mips/mips/cache_mipsNN.c standard mips/mips/cpu.c standard mips/mips/db_disasm.c optional ddb mips/mips/db_interface.c optional ddb mips/mips/db_trace.c optional ddb mips/mips/dump_machdep.c standard mips/mips/elf_machdep.c standard mips/mips/exception.S standard mips/mips/fp.S standard mips/mips/freebsd32_machdep.c optional compat_freebsd32 mips/mips/gdb_machdep.c standard mips/mips/in_cksum.c optional inet mips/mips/libkern_machdep.c standard mips/mips/locore.S standard no-obj mips/mips/machdep.c standard mips/mips/mem.c optional mem mips/mips/minidump_machdep.c standard mips/mips/mp_machdep.c optional smp mips/mips/mpboot.S optional smp mips/mips/nexus.c standard mips/mips/ofw_machdep.c optional fdt mips/mips/pm_machdep.c standard mips/mips/pmap.c standard mips/mips/ptrace_machdep.c standard mips/mips/sc_machdep.c standard mips/mips/stack_machdep.c optional ddb | stack mips/mips/stdatomic.c standard \ compile-with "${NORMAL_C:N-Wmissing-prototypes}" mips/mips/support.S standard mips/mips/bcopy.S standard mips/mips/swtch.S standard mips/mips/sys_machdep.c standard mips/mips/tlb.c standard mips/mips/trap.c standard mips/mips/uio_machdep.c standard mips/mips/uma_machdep.c standard mips/mips/vm_machdep.c standard # misc opt-in bits kern/kern_clocksource.c standard kern/link_elf_obj.c standard kern/subr_busdma_bufalloc.c standard kern/subr_dummy_vdso_tc.c standard kern/subr_sfbuf.c optional mips | mipsel | mipsn32 kern/subr_sfbuf.c optional mipshf | mipselhf # gcc/clang runtime libkern/ffsl.c standard libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard -libkern/memmove.c standard libkern/cmpdi2.c optional mips | mipshf | mipsel | mipselhf libkern/ucmpdi2.c optional mips | mipshf | mipsel | mipselhf libkern/ashldi3.c standard libkern/ashrdi3.c standard # cfe support dev/cfe/cfe_api.c optional cfe dev/cfe/cfe_console.c optional cfe_console dev/cfe/cfe_env.c optional cfe_env # syscons support dev/fb/fb.c optional sc dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc mips/mips/sc_machdep.c optional sc # FDT support dev/uart/uart_cpu_fdt.c optional uart fdt # crypto support -- use generic crypto/blowfish/bf_enc.c optional crypto | ipsec | \ ipsec_support crypto/des/des_enc.c optional crypto | ipsec | \ ipsec_support | netsmb # AP common nvram interface MIPS specific, but maybe should be more generic dev/nvram2env/nvram2env_mips.c optional nvram2env dev/nvram2env/nvram2env.c optional nvram2env # hwpmc support dev/hwpmc/hwpmc_mips.c optional hwpmc dev/hwpmc/hwpmc_mips24k.c optional hwpmc_mips24k dev/hwpmc/hwpmc_mips74k.c optional hwpmc_mips74k # ofw support dev/ofw/ofwpci.c optional fdt pci # INTRNG support code kern/msi_if.m optional intrng kern/pic_if.m optional intrng kern/subr_intr.c optional intrng # INTRNG compatible MIPS32 interrupt controller mips/mips/mips_pic.c optional intrng # DTrace cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/dev/dtrace/mips/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/mips/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/mips/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" # Zstd contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Index: head/sys/mips/mips/bcopy.S =================================================================== --- head/sys/mips/mips/bcopy.S (revision 334180) +++ head/sys/mips/mips/bcopy.S (revision 334181) @@ -1,286 +1,287 @@ /* $NetBSD: bcopy.S,v 1.3 2009/12/14 00:39:00 matt Exp $ */ /* * Mach Operating System * Copyright (c) 1993 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * File: mips_bcopy.s * Author: Chris Maeda * Date: June 1993 * * Fast copy routine. Derived from aligned_block_copy. */ #include __FBSDID("$FreeBSD$"); #include #if defined(LIBC_SCCS) && !defined(lint) #if 0 ASMSTR("from: @(#)mips_bcopy.s 2.2 CMU 18/06/93") #else ASMSTR("$NetBSD: bcopy.S,v 1.3 2009/12/14 00:39:00 matt Exp $") #endif #endif /* LIBC_SCCS and not lint */ #ifdef __ABICALLS__ .abicalls #endif /* * bcopy(caddr_t src, caddr_t dst, unsigned int len) * * a0 src address * a1 dst address * a2 length */ #define SRCREG a0 #define DSTREG a1 #define SIZEREG a2 LEAF(memcpy) +XLEAF(memmove) .set noat .set noreorder move v0, a0 move a0, a1 move a1, v0 XLEAF(bcopy) XLEAF(ovbcopy) /* * Make sure we can copy forwards. */ sltu t0,SRCREG,DSTREG # t0 == SRCREG < DSTREG bne t0,zero,6f # copy backwards /* * There are four alignment cases (with frequency) * (Based on measurements taken with a DECstation 5000/200 * inside a Mach kernel.) * * aligned -> aligned (mostly) * unaligned -> aligned (sometimes) * aligned,unaligned -> unaligned (almost never) * * Note that we could add another case that checks if * the destination and source are unaligned but the * copy is alignable. eg if src and dest are both * on a halfword boundary. */ andi t1,DSTREG,(SZREG-1) # get last bits of dest bne t1,zero,3f # dest unaligned andi t0,SRCREG,(SZREG-1) # get last bits of src bne t0,zero,5f /* * Forward aligned->aligned copy, 8 words at a time. */ 98: li AT,-(SZREG*8) and t0,SIZEREG,AT # count truncated to multiples PTR_ADDU a3,SRCREG,t0 # run fast loop up to this addr sltu AT,SRCREG,a3 # any work to do? beq AT,zero,2f PTR_SUBU SIZEREG,t0 /* * loop body */ 1: # cp REG_L t3,(0*SZREG)(SRCREG) REG_L v1,(1*SZREG)(SRCREG) REG_L t0,(2*SZREG)(SRCREG) REG_L t1,(3*SZREG)(SRCREG) PTR_ADDU SRCREG,SZREG*8 REG_S t3,(0*SZREG)(DSTREG) REG_S v1,(1*SZREG)(DSTREG) REG_S t0,(2*SZREG)(DSTREG) REG_S t1,(3*SZREG)(DSTREG) REG_L t1,(-1*SZREG)(SRCREG) REG_L t0,(-2*SZREG)(SRCREG) REG_L v1,(-3*SZREG)(SRCREG) REG_L t3,(-4*SZREG)(SRCREG) PTR_ADDU DSTREG,SZREG*8 REG_S t1,(-1*SZREG)(DSTREG) REG_S t0,(-2*SZREG)(DSTREG) REG_S v1,(-3*SZREG)(DSTREG) bne SRCREG,a3,1b REG_S t3,(-4*SZREG)(DSTREG) /* * Copy a word at a time, no loop unrolling. */ 2: # wordcopy andi t2,SIZEREG,(SZREG-1) # get byte count / SZREG PTR_SUBU t2,SIZEREG,t2 # t2 = words to copy * SZREG beq t2,zero,3f PTR_ADDU t0,SRCREG,t2 # stop at t0 PTR_SUBU SIZEREG,SIZEREG,t2 1: REG_L t3,0(SRCREG) PTR_ADDU SRCREG,SZREG REG_S t3,0(DSTREG) bne SRCREG,t0,1b PTR_ADDU DSTREG,SZREG 3: # bytecopy beq SIZEREG,zero,4f # nothing left to do? nop 1: lb t3,0(SRCREG) PTR_ADDU SRCREG,1 sb t3,0(DSTREG) PTR_SUBU SIZEREG,1 bgtz SIZEREG,1b PTR_ADDU DSTREG,1 4: # copydone j ra nop /* * Copy from unaligned source to aligned dest. */ 5: # destaligned andi t0,SIZEREG,(SZREG-1) # t0 = bytecount mod SZREG PTR_SUBU a3,SIZEREG,t0 # number of words to transfer beq a3,zero,3b nop move SIZEREG,t0 # this many to do after we are done PTR_ADDU a3,SRCREG,a3 # stop point 1: REG_LHI t3,0(SRCREG) REG_LLO t3,SZREG-1(SRCREG) PTR_ADDI SRCREG,SZREG REG_S t3,0(DSTREG) bne SRCREG,a3,1b PTR_ADDI DSTREG,SZREG b 3b nop 6: # backcopy -- based on above PTR_ADDU SRCREG,SIZEREG PTR_ADDU DSTREG,SIZEREG andi t1,DSTREG,SZREG-1 # get last 3 bits of dest bne t1,zero,3f andi t0,SRCREG,SZREG-1 # get last 3 bits of src bne t0,zero,5f /* * Forward aligned->aligned copy, 8*4 bytes at a time. */ li AT,(-8*SZREG) and t0,SIZEREG,AT # count truncated to multiple of 32 beq t0,zero,2f # any work to do? PTR_SUBU SIZEREG,t0 PTR_SUBU a3,SRCREG,t0 /* * loop body */ 1: # cp REG_L t3,(-4*SZREG)(SRCREG) REG_L v1,(-3*SZREG)(SRCREG) REG_L t0,(-2*SZREG)(SRCREG) REG_L t1,(-1*SZREG)(SRCREG) PTR_SUBU SRCREG,8*SZREG REG_S t3,(-4*SZREG)(DSTREG) REG_S v1,(-3*SZREG)(DSTREG) REG_S t0,(-2*SZREG)(DSTREG) REG_S t1,(-1*SZREG)(DSTREG) REG_L t1,(3*SZREG)(SRCREG) REG_L t0,(2*SZREG)(SRCREG) REG_L v1,(1*SZREG)(SRCREG) REG_L t3,(0*SZREG)(SRCREG) PTR_SUBU DSTREG,8*SZREG REG_S t1,(3*SZREG)(DSTREG) REG_S t0,(2*SZREG)(DSTREG) REG_S v1,(1*SZREG)(DSTREG) bne SRCREG,a3,1b REG_S t3,(0*SZREG)(DSTREG) /* * Copy a word at a time, no loop unrolling. */ 2: # wordcopy andi t2,SIZEREG,SZREG-1 # get byte count / 4 PTR_SUBU t2,SIZEREG,t2 # t2 = number of words to copy beq t2,zero,3f PTR_SUBU t0,SRCREG,t2 # stop at t0 PTR_SUBU SIZEREG,SIZEREG,t2 1: REG_L t3,-SZREG(SRCREG) PTR_SUBU SRCREG,SZREG REG_S t3,-SZREG(DSTREG) bne SRCREG,t0,1b PTR_SUBU DSTREG,SZREG 3: # bytecopy beq SIZEREG,zero,4f # nothing left to do? nop 1: lb t3,-1(SRCREG) PTR_SUBU SRCREG,1 sb t3,-1(DSTREG) PTR_SUBU SIZEREG,1 bgtz SIZEREG,1b PTR_SUBU DSTREG,1 4: # copydone j ra nop /* * Copy from unaligned source to aligned dest. */ 5: # destaligned andi t0,SIZEREG,SZREG-1 # t0 = bytecount mod 4 PTR_SUBU a3,SIZEREG,t0 # number of words to transfer beq a3,zero,3b nop move SIZEREG,t0 # this many to do after we are done PTR_SUBU a3,SRCREG,a3 # stop point 1: REG_LHI t3,-SZREG(SRCREG) REG_LLO t3,-1(SRCREG) PTR_SUBU SRCREG,SZREG REG_S t3,-SZREG(DSTREG) bne SRCREG,a3,1b PTR_SUBU DSTREG,SZREG b 3b nop .set reorder .set at END(memcpy)