1*7c478bd9Sstevel@tonic-gate/* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate/* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate#include <sys/param.h> 30*7c478bd9Sstevel@tonic-gate#include <sys/errno.h> 31*7c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h> 32*7c478bd9Sstevel@tonic-gate#include <sys/vtrace.h> 33*7c478bd9Sstevel@tonic-gate#include <sys/machthread.h> 34*7c478bd9Sstevel@tonic-gate#include <sys/clock.h> 35*7c478bd9Sstevel@tonic-gate#include <sys/asi.h> 36*7c478bd9Sstevel@tonic-gate#include <sys/fsr.h> 37*7c478bd9Sstevel@tonic-gate#include <sys/privregs.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate#if !defined(lint) 40*7c478bd9Sstevel@tonic-gate#include "assym.h" 41*7c478bd9Sstevel@tonic-gate#endif /* lint */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate/* 45*7c478bd9Sstevel@tonic-gate * Pseudo-code to aid in understanding the control flow of the 46*7c478bd9Sstevel@tonic-gate * bcopy routine. 47*7c478bd9Sstevel@tonic-gate * 48*7c478bd9Sstevel@tonic-gate * On entry to bcopy: 49*7c478bd9Sstevel@tonic-gate * 50*7c478bd9Sstevel@tonic-gate * %l6 = curthread->t_lofault; 51*7c478bd9Sstevel@tonic-gate * used_block_copy = FALSE; ! %l6 |= 1 52*7c478bd9Sstevel@tonic-gate * if (%l6 != NULL) { 53*7c478bd9Sstevel@tonic-gate * curthread->t_lofault = .copyerr; 54*7c478bd9Sstevel@tonic-gate * caller_error_handler = TRUE ! %l6 |= 2 55*7c478bd9Sstevel@tonic-gate * } 56*7c478bd9Sstevel@tonic-gate * 57*7c478bd9Sstevel@tonic-gate * if (length < VIS_COPY) 58*7c478bd9Sstevel@tonic-gate * goto regular_copy; 59*7c478bd9Sstevel@tonic-gate * 60*7c478bd9Sstevel@tonic-gate * if (!use_vis) 61*7c478bd9Sstevel@tonic-gate * goto_regular_copy; 62*7c478bd9Sstevel@tonic-gate * 63*7c478bd9Sstevel@tonic-gate * if (curthread->t_lwp == NULL) { 64*7c478bd9Sstevel@tonic-gate * ! Kernel threads do not have pcb's in which to store 65*7c478bd9Sstevel@tonic-gate * ! the floating point state, disallow preemption during 66*7c478bd9Sstevel@tonic-gate * ! the copy. 67*7c478bd9Sstevel@tonic-gate * kpreempt_disable(curthread); 68*7c478bd9Sstevel@tonic-gate * } 69*7c478bd9Sstevel@tonic-gate * 70*7c478bd9Sstevel@tonic-gate * old_fprs = %fprs; 71*7c478bd9Sstevel@tonic-gate * old_gsr = %gsr; 72*7c478bd9Sstevel@tonic-gate * if (%fprs.fef) { 73*7c478bd9Sstevel@tonic-gate * ! If we need to save 4 blocks of fpregs then make sure 74*7c478bd9Sstevel@tonic-gate * ! the length is still appropriate for that extra overhead. 75*7c478bd9Sstevel@tonic-gate * if (length < (large_length + (64 * 4))) { 76*7c478bd9Sstevel@tonic-gate * if (curthread->t_lwp == NULL) 77*7c478bd9Sstevel@tonic-gate * kpreempt_enable(curthread); 78*7c478bd9Sstevel@tonic-gate * goto regular_copy; 79*7c478bd9Sstevel@tonic-gate * } 80*7c478bd9Sstevel@tonic-gate * %fprs.fef = 1; 81*7c478bd9Sstevel@tonic-gate * save current fpregs on stack using blockstore 82*7c478bd9Sstevel@tonic-gate * } else { 83*7c478bd9Sstevel@tonic-gate * %fprs.fef = 1; 84*7c478bd9Sstevel@tonic-gate * } 85*7c478bd9Sstevel@tonic-gate * 86*7c478bd9Sstevel@tonic-gate * used_block_copy = 1; ! %l6 |= 1 87*7c478bd9Sstevel@tonic-gate * do_blockcopy_here; 88*7c478bd9Sstevel@tonic-gate * 89*7c478bd9Sstevel@tonic-gate * In lofault handler: 90*7c478bd9Sstevel@tonic-gate * curthread->t_lofault = .copyerr2; 91*7c478bd9Sstevel@tonic-gate * Continue on with the normal exit handler 92*7c478bd9Sstevel@tonic-gate * 93*7c478bd9Sstevel@tonic-gate * On exit: 94*7c478bd9Sstevel@tonic-gate * call_kpreempt = 0; 95*7c478bd9Sstevel@tonic-gate * if (used_block_copy) { ! %l6 & 1 96*7c478bd9Sstevel@tonic-gate * %gsr = old_gsr; 97*7c478bd9Sstevel@tonic-gate * if (old_fprs & FPRS_FEF) 98*7c478bd9Sstevel@tonic-gate * restore fpregs from stack using blockload 99*7c478bd9Sstevel@tonic-gate * else 100*7c478bd9Sstevel@tonic-gate * zero fpregs 101*7c478bd9Sstevel@tonic-gate * %fprs = old_fprs; 102*7c478bd9Sstevel@tonic-gate * if (curthread->t_lwp == NULL) { 103*7c478bd9Sstevel@tonic-gate * kpreempt_enable(curthread); 104*7c478bd9Sstevel@tonic-gate * call_kpreempt = 1; 105*7c478bd9Sstevel@tonic-gate * } 106*7c478bd9Sstevel@tonic-gate * } 107*7c478bd9Sstevel@tonic-gate * curthread->t_lofault = (%l6 & ~3); 108*7c478bd9Sstevel@tonic-gate * if (call_kpreempt) 109*7c478bd9Sstevel@tonic-gate * kpreempt(%pil); 110*7c478bd9Sstevel@tonic-gate * return (0) 111*7c478bd9Sstevel@tonic-gate * 112*7c478bd9Sstevel@tonic-gate * In second lofault handler (.copyerr2): 113*7c478bd9Sstevel@tonic-gate * We've tried to restore fp state from the stack and failed. To 114*7c478bd9Sstevel@tonic-gate * prevent from returning with a corrupted fp state, we will panic. 115*7c478bd9Sstevel@tonic-gate */ 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate/* 118*7c478bd9Sstevel@tonic-gate * Notes on preserving existing fp state: 119*7c478bd9Sstevel@tonic-gate * 120*7c478bd9Sstevel@tonic-gate * When a copyOP decides to use fp we may have to preserve existing 121*7c478bd9Sstevel@tonic-gate * floating point state. It is not the caller's state that we need to 122*7c478bd9Sstevel@tonic-gate * preserve - the rest of the kernel does not use fp and, anyway, fp 123*7c478bd9Sstevel@tonic-gate * registers are volatile across a call. Some examples: 124*7c478bd9Sstevel@tonic-gate * 125*7c478bd9Sstevel@tonic-gate * - userland has fp state and is interrupted (device interrupt 126*7c478bd9Sstevel@tonic-gate * or trap) and within the interrupt/trap handling we use 127*7c478bd9Sstevel@tonic-gate * bcopy() 128*7c478bd9Sstevel@tonic-gate * - another (higher level) interrupt or trap handler uses bcopy 129*7c478bd9Sstevel@tonic-gate * while a bcopy from an earlier interrupt is still active 130*7c478bd9Sstevel@tonic-gate * - an asynchronous error trap occurs while fp state exists (in 131*7c478bd9Sstevel@tonic-gate * userland or in kernel copy) and the tl0 component of the handling 132*7c478bd9Sstevel@tonic-gate * uses bcopy 133*7c478bd9Sstevel@tonic-gate * - a user process with fp state incurs a copy-on-write fault and 134*7c478bd9Sstevel@tonic-gate * hwblkpagecopy always uses fp 135*7c478bd9Sstevel@tonic-gate * 136*7c478bd9Sstevel@tonic-gate * We therefore need a per-call place in which to preserve fp state - 137*7c478bd9Sstevel@tonic-gate * using our stack is ideal (and since fp copy cannot be leaf optimized 138*7c478bd9Sstevel@tonic-gate * because of calls it makes, this is no hardship). 139*7c478bd9Sstevel@tonic-gate * 140*7c478bd9Sstevel@tonic-gate * To make sure that floating point state is always saved and restored 141*7c478bd9Sstevel@tonic-gate * correctly, the following "big rules" must be followed when the floating 142*7c478bd9Sstevel@tonic-gate * point registers will be used: 143*7c478bd9Sstevel@tonic-gate * 144*7c478bd9Sstevel@tonic-gate * 1. %l6 always holds the caller's lofault handler. Also in this register, 145*7c478bd9Sstevel@tonic-gate * Bit 1 (FPUSED_FLAG) indicates that the floating point registers are in 146*7c478bd9Sstevel@tonic-gate * use. Bit 2 (BCOPY_FLAG) indicates that the call was to bcopy. 147*7c478bd9Sstevel@tonic-gate * 148*7c478bd9Sstevel@tonic-gate * 2. The FPUSED flag indicates that all FP state has been successfully stored 149*7c478bd9Sstevel@tonic-gate * on the stack. It should not be set until this save has been completed. 150*7c478bd9Sstevel@tonic-gate * 151*7c478bd9Sstevel@tonic-gate * 3. The FPUSED flag should not be cleared on exit until all FP state has 152*7c478bd9Sstevel@tonic-gate * been restored from the stack. If an error occurs while restoring 153*7c478bd9Sstevel@tonic-gate * data from the stack, the error handler can check this flag to see if 154*7c478bd9Sstevel@tonic-gate * a restore is necessary. 155*7c478bd9Sstevel@tonic-gate * 156*7c478bd9Sstevel@tonic-gate * 4. Code run under the new lofault handler must be kept to a minimum. In 157*7c478bd9Sstevel@tonic-gate * particular, any calls to kpreempt() should not be made until after the 158*7c478bd9Sstevel@tonic-gate * lofault handler has been restored. 159*7c478bd9Sstevel@tonic-gate */ 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate/* 162*7c478bd9Sstevel@tonic-gate * This shadows sys/machsystm.h which can't be included due to the lack of 163*7c478bd9Sstevel@tonic-gate * _ASM guards in include files it references. Change it here, change it there. 164*7c478bd9Sstevel@tonic-gate */ 165*7c478bd9Sstevel@tonic-gate#define VIS_COPY_THRESHOLD 900 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate/* 168*7c478bd9Sstevel@tonic-gate * Less then or equal this number of bytes we will always copy byte-for-byte 169*7c478bd9Sstevel@tonic-gate */ 170*7c478bd9Sstevel@tonic-gate#define SMALL_LIMIT 7 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate/* 173*7c478bd9Sstevel@tonic-gate * Flags set in the lower bits of the t_lofault address: 174*7c478bd9Sstevel@tonic-gate * FPUSED_FLAG: The FP registers were in use and must be restored 175*7c478bd9Sstevel@tonic-gate * BCOPY_FLAG: Set for bcopy calls, cleared for kcopy calls 176*7c478bd9Sstevel@tonic-gate * COPY_FLAGS: Both of the above 177*7c478bd9Sstevel@tonic-gate * 178*7c478bd9Sstevel@tonic-gate * Other flags: 179*7c478bd9Sstevel@tonic-gate * KPREEMPT_FLAG: kpreempt needs to be called 180*7c478bd9Sstevel@tonic-gate */ 181*7c478bd9Sstevel@tonic-gate#define FPUSED_FLAG 1 182*7c478bd9Sstevel@tonic-gate#define BCOPY_FLAG 2 183*7c478bd9Sstevel@tonic-gate#define COPY_FLAGS (FPUSED_FLAG | BCOPY_FLAG) 184*7c478bd9Sstevel@tonic-gate#define KPREEMPT_FLAG 4 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate/* 187*7c478bd9Sstevel@tonic-gate * Size of stack frame in order to accomodate a 64-byte aligned 188*7c478bd9Sstevel@tonic-gate * floating-point register save area and 2 32-bit temp locations. 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate#define HWCOPYFRAMESIZE ((64 * 5) + (2 * 4)) 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate#define SAVED_FPREGS_OFFSET (64 * 5) 193*7c478bd9Sstevel@tonic-gate#define SAVED_FPRS_OFFSET (SAVED_FPREGS_OFFSET + 4) 194*7c478bd9Sstevel@tonic-gate#define SAVED_GSR_OFFSET (SAVED_FPRS_OFFSET + 4) 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate/* 197*7c478bd9Sstevel@tonic-gate * Common macros used by the various versions of the block copy 198*7c478bd9Sstevel@tonic-gate * routines in this file. 199*7c478bd9Sstevel@tonic-gate */ 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate#define FZERO \ 202*7c478bd9Sstevel@tonic-gate fzero %f0 ;\ 203*7c478bd9Sstevel@tonic-gate fzero %f2 ;\ 204*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f4 ;\ 205*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f6 ;\ 206*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f8 ;\ 207*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f10 ;\ 208*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f12 ;\ 209*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f14 ;\ 210*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f16 ;\ 211*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f18 ;\ 212*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f20 ;\ 213*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f22 ;\ 214*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f24 ;\ 215*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f26 ;\ 216*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f28 ;\ 217*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f30 ;\ 218*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f32 ;\ 219*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f34 ;\ 220*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f36 ;\ 221*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f38 ;\ 222*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f40 ;\ 223*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f42 ;\ 224*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f44 ;\ 225*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f46 ;\ 226*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f48 ;\ 227*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f50 ;\ 228*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f52 ;\ 229*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f54 ;\ 230*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f56 ;\ 231*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f58 ;\ 232*7c478bd9Sstevel@tonic-gate faddd %f0, %f2, %f60 ;\ 233*7c478bd9Sstevel@tonic-gate fmuld %f0, %f2, %f62 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate#define FALIGN_D0 \ 237*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d48 ;\ 238*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d50 ;\ 239*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d52 ;\ 240*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d54 ;\ 241*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d56 ;\ 242*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d58 ;\ 243*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d60 ;\ 244*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d62 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate#define FALIGN_D16 \ 247*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d48 ;\ 248*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d50 ;\ 249*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d52 ;\ 250*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d54 ;\ 251*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d56 ;\ 252*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d58 ;\ 253*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d60 ;\ 254*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d62 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate#define FALIGN_D32 \ 257*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d48 ;\ 258*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d50 ;\ 259*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d52 ;\ 260*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d54 ;\ 261*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d56 ;\ 262*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d58 ;\ 263*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d60 ;\ 264*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d62 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate#define FALIGN_D2 \ 267*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d48 ;\ 268*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d50 ;\ 269*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d52 ;\ 270*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d54 ;\ 271*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d56 ;\ 272*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d58 ;\ 273*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d60 ;\ 274*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d62 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate#define FALIGN_D18 \ 277*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d48 ;\ 278*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d50 ;\ 279*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d52 ;\ 280*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d54 ;\ 281*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d56 ;\ 282*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d58 ;\ 283*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d60 ;\ 284*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d62 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate#define FALIGN_D34 \ 287*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d48 ;\ 288*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d50 ;\ 289*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d52 ;\ 290*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d54 ;\ 291*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d56 ;\ 292*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d58 ;\ 293*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d60 ;\ 294*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d62 295*7c478bd9Sstevel@tonic-gate 296*7c478bd9Sstevel@tonic-gate#define FALIGN_D4 \ 297*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d48 ;\ 298*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d50 ;\ 299*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d52 ;\ 300*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d54 ;\ 301*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d56 ;\ 302*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d58 ;\ 303*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d60 ;\ 304*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d62 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate#define FALIGN_D20 \ 307*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d48 ;\ 308*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d50 ;\ 309*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d52 ;\ 310*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d54 ;\ 311*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d56 ;\ 312*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d58 ;\ 313*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d60 ;\ 314*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d62 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate#define FALIGN_D36 \ 317*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d48 ;\ 318*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d50 ;\ 319*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d52 ;\ 320*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d54 ;\ 321*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d56 ;\ 322*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d58 ;\ 323*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d60 ;\ 324*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d62 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate#define FALIGN_D6 \ 327*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d48 ;\ 328*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d50 ;\ 329*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d52 ;\ 330*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d54 ;\ 331*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d56 ;\ 332*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d58 ;\ 333*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d60 ;\ 334*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d62 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gate#define FALIGN_D22 \ 337*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d48 ;\ 338*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d50 ;\ 339*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d52 ;\ 340*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d54 ;\ 341*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d56 ;\ 342*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d58 ;\ 343*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d60 ;\ 344*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d62 345*7c478bd9Sstevel@tonic-gate 346*7c478bd9Sstevel@tonic-gate#define FALIGN_D38 \ 347*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d48 ;\ 348*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d50 ;\ 349*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d52 ;\ 350*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d54 ;\ 351*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d56 ;\ 352*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d58 ;\ 353*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d60 ;\ 354*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d62 355*7c478bd9Sstevel@tonic-gate 356*7c478bd9Sstevel@tonic-gate#define FALIGN_D8 \ 357*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d48 ;\ 358*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d50 ;\ 359*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d52 ;\ 360*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d54 ;\ 361*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d56 ;\ 362*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d58 ;\ 363*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d60 ;\ 364*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d62 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate#define FALIGN_D24 \ 367*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d48 ;\ 368*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d50 ;\ 369*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d52 ;\ 370*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d54 ;\ 371*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d56 ;\ 372*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d58 ;\ 373*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d60 ;\ 374*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d62 375*7c478bd9Sstevel@tonic-gate 376*7c478bd9Sstevel@tonic-gate#define FALIGN_D40 \ 377*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d48 ;\ 378*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d50 ;\ 379*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d52 ;\ 380*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d54 ;\ 381*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d56 ;\ 382*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d58 ;\ 383*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d60 ;\ 384*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d62 385*7c478bd9Sstevel@tonic-gate 386*7c478bd9Sstevel@tonic-gate#define FALIGN_D10 \ 387*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d48 ;\ 388*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d50 ;\ 389*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d52 ;\ 390*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d54 ;\ 391*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d56 ;\ 392*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d58 ;\ 393*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d60 ;\ 394*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d62 395*7c478bd9Sstevel@tonic-gate 396*7c478bd9Sstevel@tonic-gate#define FALIGN_D26 \ 397*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d48 ;\ 398*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d50 ;\ 399*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d52 ;\ 400*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d54 ;\ 401*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d56 ;\ 402*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d58 ;\ 403*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d60 ;\ 404*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d62 405*7c478bd9Sstevel@tonic-gate 406*7c478bd9Sstevel@tonic-gate#define FALIGN_D42 \ 407*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d48 ;\ 408*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d50 ;\ 409*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d52 ;\ 410*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d54 ;\ 411*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d56 ;\ 412*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d58 ;\ 413*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d60 ;\ 414*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d62 415*7c478bd9Sstevel@tonic-gate 416*7c478bd9Sstevel@tonic-gate#define FALIGN_D12 \ 417*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d48 ;\ 418*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d50 ;\ 419*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d52 ;\ 420*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d54 ;\ 421*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d56 ;\ 422*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d58 ;\ 423*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d60 ;\ 424*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d62 425*7c478bd9Sstevel@tonic-gate 426*7c478bd9Sstevel@tonic-gate#define FALIGN_D28 \ 427*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d48 ;\ 428*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d50 ;\ 429*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d52 ;\ 430*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d54 ;\ 431*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d56 ;\ 432*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d58 ;\ 433*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d60 ;\ 434*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d62 435*7c478bd9Sstevel@tonic-gate 436*7c478bd9Sstevel@tonic-gate#define FALIGN_D44 \ 437*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d48 ;\ 438*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d50 ;\ 439*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d52 ;\ 440*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d54 ;\ 441*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d56 ;\ 442*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d58 ;\ 443*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d60 ;\ 444*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d62 445*7c478bd9Sstevel@tonic-gate 446*7c478bd9Sstevel@tonic-gate#define FALIGN_D14 \ 447*7c478bd9Sstevel@tonic-gate faligndata %d14, %d16, %d48 ;\ 448*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d50 ;\ 449*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d52 ;\ 450*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d54 ;\ 451*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d56 ;\ 452*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d58 ;\ 453*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d60 ;\ 454*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d62 455*7c478bd9Sstevel@tonic-gate 456*7c478bd9Sstevel@tonic-gate#define FALIGN_D30 \ 457*7c478bd9Sstevel@tonic-gate faligndata %d30, %d32, %d48 ;\ 458*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d50 ;\ 459*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d52 ;\ 460*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d54 ;\ 461*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d56 ;\ 462*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d58 ;\ 463*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d60 ;\ 464*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d62 465*7c478bd9Sstevel@tonic-gate 466*7c478bd9Sstevel@tonic-gate#define FALIGN_D46 \ 467*7c478bd9Sstevel@tonic-gate faligndata %d46, %d0, %d48 ;\ 468*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d50 ;\ 469*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d52 ;\ 470*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d54 ;\ 471*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d56 ;\ 472*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d58 ;\ 473*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d60 ;\ 474*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d62 475*7c478bd9Sstevel@tonic-gate 476*7c478bd9Sstevel@tonic-gate 477*7c478bd9Sstevel@tonic-gate/* 478*7c478bd9Sstevel@tonic-gate * Copy a block of storage, returning an error code if `from' or 479*7c478bd9Sstevel@tonic-gate * `to' takes a kernel pagefault which cannot be resolved. 480*7c478bd9Sstevel@tonic-gate * Returns errno value on pagefault error, 0 if all ok 481*7c478bd9Sstevel@tonic-gate */ 482*7c478bd9Sstevel@tonic-gate 483*7c478bd9Sstevel@tonic-gate 484*7c478bd9Sstevel@tonic-gate 485*7c478bd9Sstevel@tonic-gate#if defined(lint) 486*7c478bd9Sstevel@tonic-gate 487*7c478bd9Sstevel@tonic-gate/* ARGSUSED */ 488*7c478bd9Sstevel@tonic-gateint 489*7c478bd9Sstevel@tonic-gatekcopy(const void *from, void *to, size_t count) 490*7c478bd9Sstevel@tonic-gate{ return(0); } 491*7c478bd9Sstevel@tonic-gate 492*7c478bd9Sstevel@tonic-gate#else /* lint */ 493*7c478bd9Sstevel@tonic-gate 494*7c478bd9Sstevel@tonic-gate .seg ".text" 495*7c478bd9Sstevel@tonic-gate .align 4 496*7c478bd9Sstevel@tonic-gate 497*7c478bd9Sstevel@tonic-gate ENTRY(kcopy) 498*7c478bd9Sstevel@tonic-gate 499*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 500*7c478bd9Sstevel@tonic-gate set .copyerr, %l6 ! copyerr is lofault value 501*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], %l7 ! save existing handler 502*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier (see copy.s) 503*7c478bd9Sstevel@tonic-gate stn %l6, [THREAD_REG + T_LOFAULT] ! set t_lofault 504*7c478bd9Sstevel@tonic-gate ! 505*7c478bd9Sstevel@tonic-gate ! Note that we carefully do *not* flag the setting of 506*7c478bd9Sstevel@tonic-gate ! t_lofault. 507*7c478bd9Sstevel@tonic-gate ! 508*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .do_copy ! common code 509*7c478bd9Sstevel@tonic-gate mov %l7, %l6 510*7c478bd9Sstevel@tonic-gate 511*7c478bd9Sstevel@tonic-gate/* 512*7c478bd9Sstevel@tonic-gate * We got here because of a fault during kcopy or bcopy if a fault 513*7c478bd9Sstevel@tonic-gate * handler existed when bcopy was called. 514*7c478bd9Sstevel@tonic-gate * Errno value is in %g1. 515*7c478bd9Sstevel@tonic-gate */ 516*7c478bd9Sstevel@tonic-gate.copyerr: 517*7c478bd9Sstevel@tonic-gate set .copyerr2, %l1 518*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 519*7c478bd9Sstevel@tonic-gate stn %l1, [THREAD_REG + T_LOFAULT] ! set t_lofault 520*7c478bd9Sstevel@tonic-gate btst FPUSED_FLAG, %l6 521*7c478bd9Sstevel@tonic-gate bz %icc, 1f 522*7c478bd9Sstevel@tonic-gate and %l6, BCOPY_FLAG, %l1 ! copy flag to %l1 523*7c478bd9Sstevel@tonic-gate 524*7c478bd9Sstevel@tonic-gate membar #Sync 525*7c478bd9Sstevel@tonic-gate 526*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_GSR_OFFSET], %o2 ! restore gsr 527*7c478bd9Sstevel@tonic-gate wr %o2, 0, %gsr 528*7c478bd9Sstevel@tonic-gate 529*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_FPRS_OFFSET], %o3 530*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 531*7c478bd9Sstevel@tonic-gate bz %icc, 4f 532*7c478bd9Sstevel@tonic-gate nop 533*7c478bd9Sstevel@tonic-gate 534*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 535*7c478bd9Sstevel@tonic-gate membar #Sync 536*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 537*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 538*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d0 539*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 540*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d16 541*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 542*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d32 543*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 544*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d48 545*7c478bd9Sstevel@tonic-gate membar #Sync 546*7c478bd9Sstevel@tonic-gate 547*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 2f 548*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 549*7c478bd9Sstevel@tonic-gate 550*7c478bd9Sstevel@tonic-gate4: 551*7c478bd9Sstevel@tonic-gate FZERO ! zero all of the fpregs 552*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 553*7c478bd9Sstevel@tonic-gate 554*7c478bd9Sstevel@tonic-gate2: ldn [THREAD_REG + T_LWP], %o2 555*7c478bd9Sstevel@tonic-gate tst %o2 556*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, 1f 557*7c478bd9Sstevel@tonic-gate nop 558*7c478bd9Sstevel@tonic-gate 559*7c478bd9Sstevel@tonic-gate ldsb [THREAD_REG + T_PREEMPT], %l0 560*7c478bd9Sstevel@tonic-gate deccc %l0 561*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 1f 562*7c478bd9Sstevel@tonic-gate stb %l0, [THREAD_REG + T_PREEMPT] 563*7c478bd9Sstevel@tonic-gate 564*7c478bd9Sstevel@tonic-gate ! Check for a kernel preemption request 565*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_CPU], %l0 566*7c478bd9Sstevel@tonic-gate ldub [%l0 + CPU_KPRUNRUN], %l0 567*7c478bd9Sstevel@tonic-gate tst %l0 568*7c478bd9Sstevel@tonic-gate bnz,a,pt %ncc, 1f ! Need to call kpreempt? 569*7c478bd9Sstevel@tonic-gate or %l1, KPREEMPT_FLAG, %l1 ! If so, set the flag 570*7c478bd9Sstevel@tonic-gate 571*7c478bd9Sstevel@tonic-gate ! 572*7c478bd9Sstevel@tonic-gate ! Need to cater for the different expectations of kcopy 573*7c478bd9Sstevel@tonic-gate ! and bcopy. kcopy will *always* set a t_lofault handler 574*7c478bd9Sstevel@tonic-gate ! If it fires, we're expected to just return the error code 575*7c478bd9Sstevel@tonic-gate ! and *not* to invoke any existing error handler. As far as 576*7c478bd9Sstevel@tonic-gate ! bcopy is concerned, we only set t_lofault if there was an 577*7c478bd9Sstevel@tonic-gate ! existing lofault handler. In that case we're expected to 578*7c478bd9Sstevel@tonic-gate ! invoke the previously existing handler after restting the 579*7c478bd9Sstevel@tonic-gate ! t_lofault value. 580*7c478bd9Sstevel@tonic-gate ! 581*7c478bd9Sstevel@tonic-gate1: 582*7c478bd9Sstevel@tonic-gate andn %l6, COPY_FLAGS, %l6 ! remove flags from lofault address 583*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 584*7c478bd9Sstevel@tonic-gate stn %l6, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 585*7c478bd9Sstevel@tonic-gate 586*7c478bd9Sstevel@tonic-gate ! call kpreempt if necessary 587*7c478bd9Sstevel@tonic-gate btst KPREEMPT_FLAG, %l1 588*7c478bd9Sstevel@tonic-gate bz,pt %icc, 2f 589*7c478bd9Sstevel@tonic-gate nop 590*7c478bd9Sstevel@tonic-gate call kpreempt 591*7c478bd9Sstevel@tonic-gate rdpr %pil, %o0 ! pass %pil 592*7c478bd9Sstevel@tonic-gate2: 593*7c478bd9Sstevel@tonic-gate btst BCOPY_FLAG, %l1 594*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 3f 595*7c478bd9Sstevel@tonic-gate nop 596*7c478bd9Sstevel@tonic-gate ret 597*7c478bd9Sstevel@tonic-gate restore %g1, 0, %o0 598*7c478bd9Sstevel@tonic-gate 599*7c478bd9Sstevel@tonic-gate3: 600*7c478bd9Sstevel@tonic-gate ! 601*7c478bd9Sstevel@tonic-gate ! We're here via bcopy. There *must* have been an error handler 602*7c478bd9Sstevel@tonic-gate ! in place otheerwise we would have died a nasty death already. 603*7c478bd9Sstevel@tonic-gate ! 604*7c478bd9Sstevel@tonic-gate jmp %l6 ! goto real handler 605*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 ! dispose of copy window 606*7c478bd9Sstevel@tonic-gate 607*7c478bd9Sstevel@tonic-gate/* 608*7c478bd9Sstevel@tonic-gate * We got here because of a fault in .copyerr. We can't safely restore fp 609*7c478bd9Sstevel@tonic-gate * state, so we panic. 610*7c478bd9Sstevel@tonic-gate */ 611*7c478bd9Sstevel@tonic-gatefp_panic_msg: 612*7c478bd9Sstevel@tonic-gate .asciz "Unable to restore fp state after copy operation" 613*7c478bd9Sstevel@tonic-gate 614*7c478bd9Sstevel@tonic-gate .align 4 615*7c478bd9Sstevel@tonic-gate.copyerr2: 616*7c478bd9Sstevel@tonic-gate set fp_panic_msg, %o0 617*7c478bd9Sstevel@tonic-gate call panic 618*7c478bd9Sstevel@tonic-gate nop 619*7c478bd9Sstevel@tonic-gate SET_SIZE(kcopy) 620*7c478bd9Sstevel@tonic-gate#endif /* lint */ 621*7c478bd9Sstevel@tonic-gate 622*7c478bd9Sstevel@tonic-gate 623*7c478bd9Sstevel@tonic-gate/* 624*7c478bd9Sstevel@tonic-gate * Copy a block of storage - must not overlap (from + len <= to). 625*7c478bd9Sstevel@tonic-gate * Registers: l6 - saved t_lofault 626*7c478bd9Sstevel@tonic-gate * 627*7c478bd9Sstevel@tonic-gate * Copy a page of memory. 628*7c478bd9Sstevel@tonic-gate * Assumes double word alignment and a count >= 256. 629*7c478bd9Sstevel@tonic-gate */ 630*7c478bd9Sstevel@tonic-gate#if defined(lint) 631*7c478bd9Sstevel@tonic-gate 632*7c478bd9Sstevel@tonic-gate/* ARGSUSED */ 633*7c478bd9Sstevel@tonic-gatevoid 634*7c478bd9Sstevel@tonic-gatebcopy(const void *from, void *to, size_t count) 635*7c478bd9Sstevel@tonic-gate{} 636*7c478bd9Sstevel@tonic-gate 637*7c478bd9Sstevel@tonic-gate#else /* lint */ 638*7c478bd9Sstevel@tonic-gate 639*7c478bd9Sstevel@tonic-gate ENTRY(bcopy) 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 642*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], %l6 ! save t_lofault 643*7c478bd9Sstevel@tonic-gate tst %l6 644*7c478bd9Sstevel@tonic-gate ! 645*7c478bd9Sstevel@tonic-gate ! We've already captured whether t_lofault was zero on entry. 646*7c478bd9Sstevel@tonic-gate ! We need to mark ourselves as being from bcopy since both 647*7c478bd9Sstevel@tonic-gate ! kcopy and bcopy use the same code path. If BCOPY_FLAG is set 648*7c478bd9Sstevel@tonic-gate ! and the saved lofault was zero, we won't reset lofault on 649*7c478bd9Sstevel@tonic-gate ! returning. 650*7c478bd9Sstevel@tonic-gate ! 651*7c478bd9Sstevel@tonic-gate or %l6, BCOPY_FLAG, %l6 652*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .do_copy 653*7c478bd9Sstevel@tonic-gate sethi %hi(.copyerr), %o2 654*7c478bd9Sstevel@tonic-gate or %o2, %lo(.copyerr), %o2 655*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 656*7c478bd9Sstevel@tonic-gate stn %o2, [THREAD_REG + T_LOFAULT] ! install new vector 657*7c478bd9Sstevel@tonic-gate 658*7c478bd9Sstevel@tonic-gate.do_copy: 659*7c478bd9Sstevel@tonic-gate cmp %i2, 12 ! for small counts 660*7c478bd9Sstevel@tonic-gate blu %ncc, .bytecp ! just copy bytes 661*7c478bd9Sstevel@tonic-gate .empty 662*7c478bd9Sstevel@tonic-gate 663*7c478bd9Sstevel@tonic-gate cmp %i2, VIS_COPY_THRESHOLD ! for large counts 664*7c478bd9Sstevel@tonic-gate blu,pt %ncc, .bcb_punt 665*7c478bd9Sstevel@tonic-gate .empty 666*7c478bd9Sstevel@tonic-gate 667*7c478bd9Sstevel@tonic-gate ! 668*7c478bd9Sstevel@tonic-gate ! Check to see if VIS acceleration is enabled 669*7c478bd9Sstevel@tonic-gate ! 670*7c478bd9Sstevel@tonic-gate sethi %hi(use_hw_bcopy), %o2 671*7c478bd9Sstevel@tonic-gate ld [%o2 + %lo(use_hw_bcopy)], %o2 672*7c478bd9Sstevel@tonic-gate tst %o2 673*7c478bd9Sstevel@tonic-gate bz,pn %icc, .bcb_punt 674*7c478bd9Sstevel@tonic-gate nop 675*7c478bd9Sstevel@tonic-gate 676*7c478bd9Sstevel@tonic-gate subcc %i1, %i0, %i3 677*7c478bd9Sstevel@tonic-gate bneg,a,pn %ncc, 1f 678*7c478bd9Sstevel@tonic-gate neg %i3 679*7c478bd9Sstevel@tonic-gate1: 680*7c478bd9Sstevel@tonic-gate /* 681*7c478bd9Sstevel@tonic-gate * Compare against 256 since we should be checking block addresses 682*7c478bd9Sstevel@tonic-gate * and (dest & ~63) - (src & ~63) can be 3 blocks even if 683*7c478bd9Sstevel@tonic-gate * src = dest + (64 * 3) + 63. 684*7c478bd9Sstevel@tonic-gate */ 685*7c478bd9Sstevel@tonic-gate cmp %i3, 256 686*7c478bd9Sstevel@tonic-gate blu,pn %ncc, .bcb_punt 687*7c478bd9Sstevel@tonic-gate nop 688*7c478bd9Sstevel@tonic-gate 689*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LWP], %o3 690*7c478bd9Sstevel@tonic-gate tst %o3 691*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, 1f 692*7c478bd9Sstevel@tonic-gate nop 693*7c478bd9Sstevel@tonic-gate 694*7c478bd9Sstevel@tonic-gate ! kpreempt_disable(); 695*7c478bd9Sstevel@tonic-gate ldsb [THREAD_REG + T_PREEMPT], %o2 696*7c478bd9Sstevel@tonic-gate inc %o2 697*7c478bd9Sstevel@tonic-gate stb %o2, [THREAD_REG + T_PREEMPT] 698*7c478bd9Sstevel@tonic-gate 699*7c478bd9Sstevel@tonic-gate1: 700*7c478bd9Sstevel@tonic-gate rd %fprs, %o2 ! check for unused fp 701*7c478bd9Sstevel@tonic-gate st %o2, [%fp + STACK_BIAS - SAVED_FPRS_OFFSET] ! save orig %fprs 702*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o2 703*7c478bd9Sstevel@tonic-gate bz,a %icc, .do_blockcopy 704*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 705*7c478bd9Sstevel@tonic-gate 706*7c478bd9Sstevel@tonic-gate.bcb_fpregs_inuse: 707*7c478bd9Sstevel@tonic-gate cmp %i2, VIS_COPY_THRESHOLD+(64*4) ! for large counts (larger 708*7c478bd9Sstevel@tonic-gate bgeu %ncc, 1f ! if we have to save the fpregs) 709*7c478bd9Sstevel@tonic-gate nop 710*7c478bd9Sstevel@tonic-gate 711*7c478bd9Sstevel@tonic-gate tst %o3 712*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, .bcb_punt 713*7c478bd9Sstevel@tonic-gate nop 714*7c478bd9Sstevel@tonic-gate 715*7c478bd9Sstevel@tonic-gate ldsb [THREAD_REG + T_PREEMPT], %l0 716*7c478bd9Sstevel@tonic-gate deccc %l0 717*7c478bd9Sstevel@tonic-gate bnz,pn %icc, .bcb_punt 718*7c478bd9Sstevel@tonic-gate stb %l0, [THREAD_REG + T_PREEMPT] 719*7c478bd9Sstevel@tonic-gate 720*7c478bd9Sstevel@tonic-gate ! Check for a kernel preemption request 721*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_CPU], %l0 722*7c478bd9Sstevel@tonic-gate ldub [%l0 + CPU_KPRUNRUN], %l0 723*7c478bd9Sstevel@tonic-gate tst %l0 724*7c478bd9Sstevel@tonic-gate bz,pt %icc, .bcb_punt 725*7c478bd9Sstevel@tonic-gate nop 726*7c478bd9Sstevel@tonic-gate 727*7c478bd9Sstevel@tonic-gate ! Attempt to preempt 728*7c478bd9Sstevel@tonic-gate call kpreempt 729*7c478bd9Sstevel@tonic-gate rdpr %pil, %o0 ! pass %pil 730*7c478bd9Sstevel@tonic-gate 731*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .bcb_punt 732*7c478bd9Sstevel@tonic-gate nop 733*7c478bd9Sstevel@tonic-gate 734*7c478bd9Sstevel@tonic-gate1: 735*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 736*7c478bd9Sstevel@tonic-gate 737*7c478bd9Sstevel@tonic-gate ! save in-use fpregs on stack 738*7c478bd9Sstevel@tonic-gate membar #Sync 739*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 740*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 741*7c478bd9Sstevel@tonic-gate stda %d0, [%o2]ASI_BLK_P 742*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 743*7c478bd9Sstevel@tonic-gate stda %d16, [%o2]ASI_BLK_P 744*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 745*7c478bd9Sstevel@tonic-gate stda %d32, [%o2]ASI_BLK_P 746*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 747*7c478bd9Sstevel@tonic-gate stda %d48, [%o2]ASI_BLK_P 748*7c478bd9Sstevel@tonic-gate membar #Sync 749*7c478bd9Sstevel@tonic-gate 750*7c478bd9Sstevel@tonic-gate.do_blockcopy: 751*7c478bd9Sstevel@tonic-gate membar #StoreStore|#StoreLoad|#LoadStore 752*7c478bd9Sstevel@tonic-gate 753*7c478bd9Sstevel@tonic-gate rd %gsr, %o2 754*7c478bd9Sstevel@tonic-gate st %o2, [%fp + STACK_BIAS - SAVED_GSR_OFFSET] ! save gsr 755*7c478bd9Sstevel@tonic-gate 756*7c478bd9Sstevel@tonic-gate ! Set the lower bit in the saved t_lofault to indicate 757*7c478bd9Sstevel@tonic-gate ! that we need to clear the %fprs register on the way 758*7c478bd9Sstevel@tonic-gate ! out 759*7c478bd9Sstevel@tonic-gate or %l6, FPUSED_FLAG, %l6 760*7c478bd9Sstevel@tonic-gate 761*7c478bd9Sstevel@tonic-gate ! Swap src/dst since the code below is memcpy code 762*7c478bd9Sstevel@tonic-gate ! and memcpy/bcopy have different calling sequences 763*7c478bd9Sstevel@tonic-gate mov %i1, %i5 764*7c478bd9Sstevel@tonic-gate mov %i0, %i1 765*7c478bd9Sstevel@tonic-gate mov %i5, %i0 766*7c478bd9Sstevel@tonic-gate 767*7c478bd9Sstevel@tonic-gate!!! This code is nearly identical to the version in the sun4u 768*7c478bd9Sstevel@tonic-gate!!! libc_psr. Most bugfixes made to that file should be 769*7c478bd9Sstevel@tonic-gate!!! merged into this routine. 770*7c478bd9Sstevel@tonic-gate 771*7c478bd9Sstevel@tonic-gate andcc %i0, 7, %o3 772*7c478bd9Sstevel@tonic-gate bz,pt %ncc, blkcpy 773*7c478bd9Sstevel@tonic-gate sub %o3, 8, %o3 774*7c478bd9Sstevel@tonic-gate neg %o3 775*7c478bd9Sstevel@tonic-gate sub %i2, %o3, %i2 776*7c478bd9Sstevel@tonic-gate 777*7c478bd9Sstevel@tonic-gate ! Align Destination on double-word boundary 778*7c478bd9Sstevel@tonic-gate 779*7c478bd9Sstevel@tonic-gate2: ldub [%i1], %o4 780*7c478bd9Sstevel@tonic-gate inc %i1 781*7c478bd9Sstevel@tonic-gate inc %i0 782*7c478bd9Sstevel@tonic-gate deccc %o3 783*7c478bd9Sstevel@tonic-gate bgu %ncc, 2b 784*7c478bd9Sstevel@tonic-gate stb %o4, [%i0 - 1] 785*7c478bd9Sstevel@tonic-gateblkcpy: 786*7c478bd9Sstevel@tonic-gate andcc %i0, 63, %i3 787*7c478bd9Sstevel@tonic-gate bz,pn %ncc, blalign ! now block aligned 788*7c478bd9Sstevel@tonic-gate sub %i3, 64, %i3 789*7c478bd9Sstevel@tonic-gate neg %i3 ! bytes till block aligned 790*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 ! update %i2 with new count 791*7c478bd9Sstevel@tonic-gate 792*7c478bd9Sstevel@tonic-gate ! Copy %i3 bytes till dst is block (64 byte) aligned. use 793*7c478bd9Sstevel@tonic-gate ! double word copies. 794*7c478bd9Sstevel@tonic-gate 795*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g1 796*7c478bd9Sstevel@tonic-gate ldd [%g1], %d0 797*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 798*7c478bd9Sstevel@tonic-gate6: 799*7c478bd9Sstevel@tonic-gate ldd [%g1], %d2 800*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 801*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 802*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 803*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 804*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 805*7c478bd9Sstevel@tonic-gate bz,pn %ncc, blalign 806*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 807*7c478bd9Sstevel@tonic-gate ldd [%g1], %d0 808*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 809*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 810*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 811*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 812*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 813*7c478bd9Sstevel@tonic-gate bgu,pn %ncc, 6b 814*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 815*7c478bd9Sstevel@tonic-gate 816*7c478bd9Sstevel@tonic-gateblalign: 817*7c478bd9Sstevel@tonic-gate membar #StoreLoad 818*7c478bd9Sstevel@tonic-gate ! %i2 = total length 819*7c478bd9Sstevel@tonic-gate ! %i3 = blocks (length - 64) / 64 820*7c478bd9Sstevel@tonic-gate ! %i4 = doubles remaining (length - blocks) 821*7c478bd9Sstevel@tonic-gate sub %i2, 64, %i3 822*7c478bd9Sstevel@tonic-gate andn %i3, 63, %i3 823*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i4 824*7c478bd9Sstevel@tonic-gate andn %i4, 7, %i4 825*7c478bd9Sstevel@tonic-gate sub %i4, 16, %i4 826*7c478bd9Sstevel@tonic-gate sub %i2, %i4, %i2 827*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 828*7c478bd9Sstevel@tonic-gate 829*7c478bd9Sstevel@tonic-gate andn %i1, 0x3f, %l7 ! blk aligned address 830*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g0 ! gen %gsr 831*7c478bd9Sstevel@tonic-gate 832*7c478bd9Sstevel@tonic-gate srl %i1, 3, %l5 ! bits 3,4,5 are now least sig in %l5 833*7c478bd9Sstevel@tonic-gate andcc %l5, 7, %i5 ! mask everything except bits 1,2 3 834*7c478bd9Sstevel@tonic-gate add %i1, %i4, %i1 835*7c478bd9Sstevel@tonic-gate add %i1, %i3, %i1 836*7c478bd9Sstevel@tonic-gate 837*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 838*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 839*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 840*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 841*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 842*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 843*7c478bd9Sstevel@tonic-gate sub %i3, 128, %i3 844*7c478bd9Sstevel@tonic-gate 845*7c478bd9Sstevel@tonic-gate ! switch statement to get us to the right 8 byte blk within a 846*7c478bd9Sstevel@tonic-gate ! 64 byte block 847*7c478bd9Sstevel@tonic-gate cmp %i5, 4 848*7c478bd9Sstevel@tonic-gate bgeu,a hlf 849*7c478bd9Sstevel@tonic-gate cmp %i5, 6 850*7c478bd9Sstevel@tonic-gate cmp %i5, 2 851*7c478bd9Sstevel@tonic-gate bgeu,a sqtr 852*7c478bd9Sstevel@tonic-gate nop 853*7c478bd9Sstevel@tonic-gate cmp %i5, 1 854*7c478bd9Sstevel@tonic-gate be,a seg1 855*7c478bd9Sstevel@tonic-gate nop 856*7c478bd9Sstevel@tonic-gate ba,pt %ncc, seg0 857*7c478bd9Sstevel@tonic-gate nop 858*7c478bd9Sstevel@tonic-gatesqtr: 859*7c478bd9Sstevel@tonic-gate be,a seg2 860*7c478bd9Sstevel@tonic-gate nop 861*7c478bd9Sstevel@tonic-gate ba,pt %ncc, seg3 862*7c478bd9Sstevel@tonic-gate nop 863*7c478bd9Sstevel@tonic-gate 864*7c478bd9Sstevel@tonic-gatehlf: 865*7c478bd9Sstevel@tonic-gate bgeu,a fqtr 866*7c478bd9Sstevel@tonic-gate nop 867*7c478bd9Sstevel@tonic-gate cmp %i5, 5 868*7c478bd9Sstevel@tonic-gate be,a seg5 869*7c478bd9Sstevel@tonic-gate nop 870*7c478bd9Sstevel@tonic-gate ba,pt %ncc, seg4 871*7c478bd9Sstevel@tonic-gate nop 872*7c478bd9Sstevel@tonic-gatefqtr: 873*7c478bd9Sstevel@tonic-gate be,a seg6 874*7c478bd9Sstevel@tonic-gate nop 875*7c478bd9Sstevel@tonic-gate ba,pt %ncc, seg7 876*7c478bd9Sstevel@tonic-gate nop 877*7c478bd9Sstevel@tonic-gate 878*7c478bd9Sstevel@tonic-gate 879*7c478bd9Sstevel@tonic-gateseg0: 880*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 881*7c478bd9Sstevel@tonic-gate FALIGN_D0 882*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 883*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 884*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 885*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 886*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 887*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 888*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 889*7c478bd9Sstevel@tonic-gate FALIGN_D16 890*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 891*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 892*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 893*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 894*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 895*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 896*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 897*7c478bd9Sstevel@tonic-gate FALIGN_D32 898*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 899*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 900*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 901*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 902*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 903*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 904*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg0 905*7c478bd9Sstevel@tonic-gate 906*7c478bd9Sstevel@tonic-gate0: 907*7c478bd9Sstevel@tonic-gate FALIGN_D16 908*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 909*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 910*7c478bd9Sstevel@tonic-gate membar #Sync 911*7c478bd9Sstevel@tonic-gate FALIGN_D32 912*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 913*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd0 914*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 915*7c478bd9Sstevel@tonic-gate 916*7c478bd9Sstevel@tonic-gate1: 917*7c478bd9Sstevel@tonic-gate FALIGN_D32 918*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 919*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 920*7c478bd9Sstevel@tonic-gate membar #Sync 921*7c478bd9Sstevel@tonic-gate FALIGN_D0 922*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 923*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd16 924*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 925*7c478bd9Sstevel@tonic-gate 926*7c478bd9Sstevel@tonic-gate2: 927*7c478bd9Sstevel@tonic-gate FALIGN_D0 928*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 929*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 930*7c478bd9Sstevel@tonic-gate membar #Sync 931*7c478bd9Sstevel@tonic-gate FALIGN_D16 932*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 933*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd32 934*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 935*7c478bd9Sstevel@tonic-gate 936*7c478bd9Sstevel@tonic-gateseg1: 937*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 938*7c478bd9Sstevel@tonic-gate FALIGN_D2 939*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 940*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 941*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 942*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 943*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 944*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 945*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 946*7c478bd9Sstevel@tonic-gate FALIGN_D18 947*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 948*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 949*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 950*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 951*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 952*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 953*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 954*7c478bd9Sstevel@tonic-gate FALIGN_D34 955*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 956*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 957*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 958*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 959*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 960*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 961*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg1 962*7c478bd9Sstevel@tonic-gate0: 963*7c478bd9Sstevel@tonic-gate FALIGN_D18 964*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 965*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 966*7c478bd9Sstevel@tonic-gate membar #Sync 967*7c478bd9Sstevel@tonic-gate FALIGN_D34 968*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 969*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd2 970*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 971*7c478bd9Sstevel@tonic-gate 972*7c478bd9Sstevel@tonic-gate1: 973*7c478bd9Sstevel@tonic-gate FALIGN_D34 974*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 975*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 976*7c478bd9Sstevel@tonic-gate membar #Sync 977*7c478bd9Sstevel@tonic-gate FALIGN_D2 978*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 979*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd18 980*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 981*7c478bd9Sstevel@tonic-gate 982*7c478bd9Sstevel@tonic-gate2: 983*7c478bd9Sstevel@tonic-gate FALIGN_D2 984*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 985*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 986*7c478bd9Sstevel@tonic-gate membar #Sync 987*7c478bd9Sstevel@tonic-gate FALIGN_D18 988*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 989*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd34 990*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 991*7c478bd9Sstevel@tonic-gate 992*7c478bd9Sstevel@tonic-gateseg2: 993*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 994*7c478bd9Sstevel@tonic-gate FALIGN_D4 995*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 996*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 997*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 998*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 999*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1000*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1001*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1002*7c478bd9Sstevel@tonic-gate FALIGN_D20 1003*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1004*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1005*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1006*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1007*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1008*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1009*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1010*7c478bd9Sstevel@tonic-gate FALIGN_D36 1011*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1012*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1013*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1014*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1015*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1016*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1017*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg2 1018*7c478bd9Sstevel@tonic-gate 1019*7c478bd9Sstevel@tonic-gate0: 1020*7c478bd9Sstevel@tonic-gate FALIGN_D20 1021*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1022*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1023*7c478bd9Sstevel@tonic-gate membar #Sync 1024*7c478bd9Sstevel@tonic-gate FALIGN_D36 1025*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1026*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd4 1027*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1028*7c478bd9Sstevel@tonic-gate 1029*7c478bd9Sstevel@tonic-gate1: 1030*7c478bd9Sstevel@tonic-gate FALIGN_D36 1031*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1032*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1033*7c478bd9Sstevel@tonic-gate membar #Sync 1034*7c478bd9Sstevel@tonic-gate FALIGN_D4 1035*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1036*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd20 1037*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1038*7c478bd9Sstevel@tonic-gate 1039*7c478bd9Sstevel@tonic-gate2: 1040*7c478bd9Sstevel@tonic-gate FALIGN_D4 1041*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1042*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1043*7c478bd9Sstevel@tonic-gate membar #Sync 1044*7c478bd9Sstevel@tonic-gate FALIGN_D20 1045*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1046*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd36 1047*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1048*7c478bd9Sstevel@tonic-gate 1049*7c478bd9Sstevel@tonic-gateseg3: 1050*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 1051*7c478bd9Sstevel@tonic-gate FALIGN_D6 1052*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 1053*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1054*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1055*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1056*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1057*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1058*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1059*7c478bd9Sstevel@tonic-gate FALIGN_D22 1060*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1061*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1062*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1063*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1064*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1065*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1066*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1067*7c478bd9Sstevel@tonic-gate FALIGN_D38 1068*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1069*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1070*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1071*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1072*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1073*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1074*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg3 1075*7c478bd9Sstevel@tonic-gate 1076*7c478bd9Sstevel@tonic-gate0: 1077*7c478bd9Sstevel@tonic-gate FALIGN_D22 1078*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1079*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1080*7c478bd9Sstevel@tonic-gate membar #Sync 1081*7c478bd9Sstevel@tonic-gate FALIGN_D38 1082*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1083*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd6 1084*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1085*7c478bd9Sstevel@tonic-gate 1086*7c478bd9Sstevel@tonic-gate1: 1087*7c478bd9Sstevel@tonic-gate FALIGN_D38 1088*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1089*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1090*7c478bd9Sstevel@tonic-gate membar #Sync 1091*7c478bd9Sstevel@tonic-gate FALIGN_D6 1092*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1093*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd22 1094*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1095*7c478bd9Sstevel@tonic-gate 1096*7c478bd9Sstevel@tonic-gate2: 1097*7c478bd9Sstevel@tonic-gate FALIGN_D6 1098*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1099*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1100*7c478bd9Sstevel@tonic-gate membar #Sync 1101*7c478bd9Sstevel@tonic-gate FALIGN_D22 1102*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1103*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd38 1104*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1105*7c478bd9Sstevel@tonic-gate 1106*7c478bd9Sstevel@tonic-gateseg4: 1107*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 1108*7c478bd9Sstevel@tonic-gate FALIGN_D8 1109*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 1110*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1111*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1112*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1113*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1114*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1115*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1116*7c478bd9Sstevel@tonic-gate FALIGN_D24 1117*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1118*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1119*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1120*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1121*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1122*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1123*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1124*7c478bd9Sstevel@tonic-gate FALIGN_D40 1125*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1126*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1127*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1128*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1129*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1130*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1131*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg4 1132*7c478bd9Sstevel@tonic-gate 1133*7c478bd9Sstevel@tonic-gate0: 1134*7c478bd9Sstevel@tonic-gate FALIGN_D24 1135*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1136*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1137*7c478bd9Sstevel@tonic-gate membar #Sync 1138*7c478bd9Sstevel@tonic-gate FALIGN_D40 1139*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1140*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd8 1141*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1142*7c478bd9Sstevel@tonic-gate 1143*7c478bd9Sstevel@tonic-gate1: 1144*7c478bd9Sstevel@tonic-gate FALIGN_D40 1145*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1146*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1147*7c478bd9Sstevel@tonic-gate membar #Sync 1148*7c478bd9Sstevel@tonic-gate FALIGN_D8 1149*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1150*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd24 1151*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1152*7c478bd9Sstevel@tonic-gate 1153*7c478bd9Sstevel@tonic-gate2: 1154*7c478bd9Sstevel@tonic-gate FALIGN_D8 1155*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1156*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1157*7c478bd9Sstevel@tonic-gate membar #Sync 1158*7c478bd9Sstevel@tonic-gate FALIGN_D24 1159*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1160*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd40 1161*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1162*7c478bd9Sstevel@tonic-gate 1163*7c478bd9Sstevel@tonic-gateseg5: 1164*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 1165*7c478bd9Sstevel@tonic-gate FALIGN_D10 1166*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 1167*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1168*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1169*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1170*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1171*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1172*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1173*7c478bd9Sstevel@tonic-gate FALIGN_D26 1174*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1175*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1176*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1177*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1178*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1179*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1180*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1181*7c478bd9Sstevel@tonic-gate FALIGN_D42 1182*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1183*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1184*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1185*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1186*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1187*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1188*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg5 1189*7c478bd9Sstevel@tonic-gate 1190*7c478bd9Sstevel@tonic-gate0: 1191*7c478bd9Sstevel@tonic-gate FALIGN_D26 1192*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1193*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1194*7c478bd9Sstevel@tonic-gate membar #Sync 1195*7c478bd9Sstevel@tonic-gate FALIGN_D42 1196*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1197*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd10 1198*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1199*7c478bd9Sstevel@tonic-gate 1200*7c478bd9Sstevel@tonic-gate1: 1201*7c478bd9Sstevel@tonic-gate FALIGN_D42 1202*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1203*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1204*7c478bd9Sstevel@tonic-gate membar #Sync 1205*7c478bd9Sstevel@tonic-gate FALIGN_D10 1206*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1207*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd26 1208*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1209*7c478bd9Sstevel@tonic-gate 1210*7c478bd9Sstevel@tonic-gate2: 1211*7c478bd9Sstevel@tonic-gate FALIGN_D10 1212*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1213*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1214*7c478bd9Sstevel@tonic-gate membar #Sync 1215*7c478bd9Sstevel@tonic-gate FALIGN_D26 1216*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1217*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd42 1218*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1219*7c478bd9Sstevel@tonic-gate 1220*7c478bd9Sstevel@tonic-gateseg6: 1221*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 1222*7c478bd9Sstevel@tonic-gate FALIGN_D12 1223*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 1224*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1225*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1226*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1227*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1228*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1229*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1230*7c478bd9Sstevel@tonic-gate FALIGN_D28 1231*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1232*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1233*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1234*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1235*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1236*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1237*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1238*7c478bd9Sstevel@tonic-gate FALIGN_D44 1239*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1240*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1241*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1242*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1243*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1244*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1245*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg6 1246*7c478bd9Sstevel@tonic-gate 1247*7c478bd9Sstevel@tonic-gate0: 1248*7c478bd9Sstevel@tonic-gate FALIGN_D28 1249*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1250*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1251*7c478bd9Sstevel@tonic-gate membar #Sync 1252*7c478bd9Sstevel@tonic-gate FALIGN_D44 1253*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1254*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd12 1255*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1256*7c478bd9Sstevel@tonic-gate 1257*7c478bd9Sstevel@tonic-gate1: 1258*7c478bd9Sstevel@tonic-gate FALIGN_D44 1259*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1260*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1261*7c478bd9Sstevel@tonic-gate membar #Sync 1262*7c478bd9Sstevel@tonic-gate FALIGN_D12 1263*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1264*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd28 1265*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1266*7c478bd9Sstevel@tonic-gate 1267*7c478bd9Sstevel@tonic-gate2: 1268*7c478bd9Sstevel@tonic-gate FALIGN_D12 1269*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1270*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1271*7c478bd9Sstevel@tonic-gate membar #Sync 1272*7c478bd9Sstevel@tonic-gate FALIGN_D28 1273*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1274*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd44 1275*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1276*7c478bd9Sstevel@tonic-gate 1277*7c478bd9Sstevel@tonic-gateseg7: 1278*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 1279*7c478bd9Sstevel@tonic-gate FALIGN_D14 1280*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 1281*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1282*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1283*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1284*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 1285*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1286*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 1287*7c478bd9Sstevel@tonic-gate FALIGN_D30 1288*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 1289*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1290*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1291*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1292*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 1293*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1294*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 1295*7c478bd9Sstevel@tonic-gate FALIGN_D46 1296*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 1297*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1298*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 1299*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 1300*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 1301*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1302*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, seg7 1303*7c478bd9Sstevel@tonic-gate 1304*7c478bd9Sstevel@tonic-gate0: 1305*7c478bd9Sstevel@tonic-gate FALIGN_D30 1306*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1307*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1308*7c478bd9Sstevel@tonic-gate membar #Sync 1309*7c478bd9Sstevel@tonic-gate FALIGN_D46 1310*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1311*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd14 1312*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1313*7c478bd9Sstevel@tonic-gate 1314*7c478bd9Sstevel@tonic-gate1: 1315*7c478bd9Sstevel@tonic-gate FALIGN_D46 1316*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1317*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1318*7c478bd9Sstevel@tonic-gate membar #Sync 1319*7c478bd9Sstevel@tonic-gate FALIGN_D14 1320*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1321*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd30 1322*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1323*7c478bd9Sstevel@tonic-gate 1324*7c478bd9Sstevel@tonic-gate2: 1325*7c478bd9Sstevel@tonic-gate FALIGN_D14 1326*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1327*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1328*7c478bd9Sstevel@tonic-gate membar #Sync 1329*7c478bd9Sstevel@tonic-gate FALIGN_D30 1330*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 1331*7c478bd9Sstevel@tonic-gate ba,pt %ncc, blkd46 1332*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1333*7c478bd9Sstevel@tonic-gate 1334*7c478bd9Sstevel@tonic-gate 1335*7c478bd9Sstevel@tonic-gate ! 1336*7c478bd9Sstevel@tonic-gate ! dribble out the last partial block 1337*7c478bd9Sstevel@tonic-gate ! 1338*7c478bd9Sstevel@tonic-gateblkd0: 1339*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1340*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1341*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d48 1342*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1343*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1344*7c478bd9Sstevel@tonic-gateblkd2: 1345*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1346*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1347*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d48 1348*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1349*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1350*7c478bd9Sstevel@tonic-gateblkd4: 1351*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1352*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1353*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d48 1354*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1355*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1356*7c478bd9Sstevel@tonic-gateblkd6: 1357*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1358*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1359*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d48 1360*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1361*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1362*7c478bd9Sstevel@tonic-gateblkd8: 1363*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1364*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1365*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d48 1366*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1367*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1368*7c478bd9Sstevel@tonic-gateblkd10: 1369*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1370*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1371*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d48 1372*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1373*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1374*7c478bd9Sstevel@tonic-gateblkd12: 1375*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1376*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1377*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d48 1378*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1379*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1380*7c478bd9Sstevel@tonic-gateblkd14: 1381*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1382*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1383*7c478bd9Sstevel@tonic-gate fsrc1 %d14, %d0 1384*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, blkleft 1385*7c478bd9Sstevel@tonic-gate 1386*7c478bd9Sstevel@tonic-gateblkd16: 1387*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1388*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1389*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d48 1390*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1391*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1392*7c478bd9Sstevel@tonic-gateblkd18: 1393*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1394*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1395*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d48 1396*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1397*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1398*7c478bd9Sstevel@tonic-gateblkd20: 1399*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1400*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1401*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d48 1402*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1403*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1404*7c478bd9Sstevel@tonic-gateblkd22: 1405*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1406*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1407*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d48 1408*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1409*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1410*7c478bd9Sstevel@tonic-gateblkd24: 1411*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1412*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1413*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d48 1414*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1415*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1416*7c478bd9Sstevel@tonic-gateblkd26: 1417*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1418*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1419*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d48 1420*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1421*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1422*7c478bd9Sstevel@tonic-gateblkd28: 1423*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1424*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1425*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d48 1426*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1427*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1428*7c478bd9Sstevel@tonic-gateblkd30: 1429*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1430*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1431*7c478bd9Sstevel@tonic-gate fsrc1 %d30, %d0 1432*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, blkleft 1433*7c478bd9Sstevel@tonic-gateblkd32: 1434*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1435*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1436*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d48 1437*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1438*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1439*7c478bd9Sstevel@tonic-gateblkd34: 1440*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1441*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1442*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d48 1443*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1444*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1445*7c478bd9Sstevel@tonic-gateblkd36: 1446*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1447*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1448*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d48 1449*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1450*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1451*7c478bd9Sstevel@tonic-gateblkd38: 1452*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1453*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1454*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d48 1455*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1456*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1457*7c478bd9Sstevel@tonic-gateblkd40: 1458*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1459*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1460*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d48 1461*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1462*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1463*7c478bd9Sstevel@tonic-gateblkd42: 1464*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1465*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1466*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d48 1467*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1468*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1469*7c478bd9Sstevel@tonic-gateblkd44: 1470*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1471*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1472*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d48 1473*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 1474*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1475*7c478bd9Sstevel@tonic-gateblkd46: 1476*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1477*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1478*7c478bd9Sstevel@tonic-gate fsrc1 %d46, %d0 1479*7c478bd9Sstevel@tonic-gate 1480*7c478bd9Sstevel@tonic-gateblkleft: 1481*7c478bd9Sstevel@tonic-gate1: 1482*7c478bd9Sstevel@tonic-gate ldd [%l7], %d2 1483*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 1484*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1485*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 1486*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 1487*7c478bd9Sstevel@tonic-gate blu,pn %ncc, blkdone 1488*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1489*7c478bd9Sstevel@tonic-gate ldd [%l7], %d0 1490*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 1491*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 1492*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 1493*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 1494*7c478bd9Sstevel@tonic-gate bgeu,pt %ncc, 1b 1495*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 1496*7c478bd9Sstevel@tonic-gate 1497*7c478bd9Sstevel@tonic-gateblkdone: 1498*7c478bd9Sstevel@tonic-gate tst %i2 1499*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .bcb_exit 1500*7c478bd9Sstevel@tonic-gate and %l3, 0x4, %l3 ! fprs.du = fprs.dl = 0 1501*7c478bd9Sstevel@tonic-gate 1502*7c478bd9Sstevel@tonic-gate7: ldub [%i1], %i4 1503*7c478bd9Sstevel@tonic-gate inc %i1 1504*7c478bd9Sstevel@tonic-gate inc %i0 1505*7c478bd9Sstevel@tonic-gate deccc %i2 1506*7c478bd9Sstevel@tonic-gate bgu,pt %ncc, 7b 1507*7c478bd9Sstevel@tonic-gate stb %i4, [%i0 - 1] 1508*7c478bd9Sstevel@tonic-gate 1509*7c478bd9Sstevel@tonic-gate.bcb_exit: 1510*7c478bd9Sstevel@tonic-gate membar #StoreLoad|#StoreStore 1511*7c478bd9Sstevel@tonic-gate btst FPUSED_FLAG, %l6 1512*7c478bd9Sstevel@tonic-gate bz %icc, 1f 1513*7c478bd9Sstevel@tonic-gate and %l6, COPY_FLAGS, %l1 ! Store flags in %l1 1514*7c478bd9Sstevel@tonic-gate ! We can't clear the flags from %l6 yet. 1515*7c478bd9Sstevel@tonic-gate ! If there's an error, .copyerr will 1516*7c478bd9Sstevel@tonic-gate ! need them 1517*7c478bd9Sstevel@tonic-gate 1518*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_GSR_OFFSET], %o2 ! restore gsr 1519*7c478bd9Sstevel@tonic-gate wr %o2, 0, %gsr 1520*7c478bd9Sstevel@tonic-gate 1521*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_FPRS_OFFSET], %o3 1522*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 1523*7c478bd9Sstevel@tonic-gate bz %icc, 4f 1524*7c478bd9Sstevel@tonic-gate nop 1525*7c478bd9Sstevel@tonic-gate 1526*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 1527*7c478bd9Sstevel@tonic-gate membar #Sync 1528*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 1529*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 1530*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d0 1531*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 1532*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d16 1533*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 1534*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d32 1535*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 1536*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d48 1537*7c478bd9Sstevel@tonic-gate membar #Sync 1538*7c478bd9Sstevel@tonic-gate 1539*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 2f 1540*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 1541*7c478bd9Sstevel@tonic-gate 1542*7c478bd9Sstevel@tonic-gate4: 1543*7c478bd9Sstevel@tonic-gate FZERO ! zero all of the fpregs 1544*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 1545*7c478bd9Sstevel@tonic-gate 1546*7c478bd9Sstevel@tonic-gate2: ldn [THREAD_REG + T_LWP], %o2 1547*7c478bd9Sstevel@tonic-gate tst %o2 1548*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, 1f 1549*7c478bd9Sstevel@tonic-gate nop 1550*7c478bd9Sstevel@tonic-gate 1551*7c478bd9Sstevel@tonic-gate ldsb [THREAD_REG + T_PREEMPT], %l0 1552*7c478bd9Sstevel@tonic-gate deccc %l0 1553*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 1f 1554*7c478bd9Sstevel@tonic-gate stb %l0, [THREAD_REG + T_PREEMPT] 1555*7c478bd9Sstevel@tonic-gate 1556*7c478bd9Sstevel@tonic-gate ! Check for a kernel preemption request 1557*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_CPU], %l0 1558*7c478bd9Sstevel@tonic-gate ldub [%l0 + CPU_KPRUNRUN], %l0 1559*7c478bd9Sstevel@tonic-gate tst %l0 1560*7c478bd9Sstevel@tonic-gate bnz,a,pt %ncc, 1f ! Need to call kpreempt? 1561*7c478bd9Sstevel@tonic-gate or %l1, KPREEMPT_FLAG, %l1 ! If so, set the flag 1562*7c478bd9Sstevel@tonic-gate 1563*7c478bd9Sstevel@tonic-gate1: 1564*7c478bd9Sstevel@tonic-gate btst BCOPY_FLAG, %l1 1565*7c478bd9Sstevel@tonic-gate bz,pn %icc, 3f 1566*7c478bd9Sstevel@tonic-gate andncc %l6, COPY_FLAGS, %l6 1567*7c478bd9Sstevel@tonic-gate 1568*7c478bd9Sstevel@tonic-gate ! 1569*7c478bd9Sstevel@tonic-gate ! Here via bcopy. Check to see if the handler was NULL. 1570*7c478bd9Sstevel@tonic-gate ! If so, just return quietly. Otherwise, reset the 1571*7c478bd9Sstevel@tonic-gate ! handler and go home. 1572*7c478bd9Sstevel@tonic-gate ! 1573*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 3f 1574*7c478bd9Sstevel@tonic-gate nop 1575*7c478bd9Sstevel@tonic-gate 1576*7c478bd9Sstevel@tonic-gate ! 1577*7c478bd9Sstevel@tonic-gate ! Null handler. Check for kpreempt flag, call if necessary, 1578*7c478bd9Sstevel@tonic-gate ! then return. 1579*7c478bd9Sstevel@tonic-gate ! 1580*7c478bd9Sstevel@tonic-gate btst KPREEMPT_FLAG, %l1 1581*7c478bd9Sstevel@tonic-gate bz,pt %icc, 2f 1582*7c478bd9Sstevel@tonic-gate nop 1583*7c478bd9Sstevel@tonic-gate call kpreempt 1584*7c478bd9Sstevel@tonic-gate rdpr %pil, %o0 ! pass %pil 1585*7c478bd9Sstevel@tonic-gate2: 1586*7c478bd9Sstevel@tonic-gate ret 1587*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 1588*7c478bd9Sstevel@tonic-gate 1589*7c478bd9Sstevel@tonic-gate ! 1590*7c478bd9Sstevel@tonic-gate ! Here via kcopy or bcopy with a handler.Reset the 1591*7c478bd9Sstevel@tonic-gate ! fault handler. 1592*7c478bd9Sstevel@tonic-gate ! 1593*7c478bd9Sstevel@tonic-gate3: 1594*7c478bd9Sstevel@tonic-gate membar #Sync 1595*7c478bd9Sstevel@tonic-gate stn %l6, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 1596*7c478bd9Sstevel@tonic-gate 1597*7c478bd9Sstevel@tonic-gate ! call kpreempt if necessary 1598*7c478bd9Sstevel@tonic-gate btst KPREEMPT_FLAG, %l1 1599*7c478bd9Sstevel@tonic-gate bz,pt %icc, 4f 1600*7c478bd9Sstevel@tonic-gate nop 1601*7c478bd9Sstevel@tonic-gate call kpreempt 1602*7c478bd9Sstevel@tonic-gate rdpr %pil, %o0 1603*7c478bd9Sstevel@tonic-gate4: 1604*7c478bd9Sstevel@tonic-gate ret 1605*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 1606*7c478bd9Sstevel@tonic-gate 1607*7c478bd9Sstevel@tonic-gate.bcb_punt: 1608*7c478bd9Sstevel@tonic-gate ! 1609*7c478bd9Sstevel@tonic-gate ! use aligned transfers where possible 1610*7c478bd9Sstevel@tonic-gate ! 1611*7c478bd9Sstevel@tonic-gate xor %i0, %i1, %o4 ! xor from and to address 1612*7c478bd9Sstevel@tonic-gate btst 7, %o4 ! if lower three bits zero 1613*7c478bd9Sstevel@tonic-gate bz %icc, .aldoubcp ! can align on double boundary 1614*7c478bd9Sstevel@tonic-gate .empty ! assembler complaints about label 1615*7c478bd9Sstevel@tonic-gate 1616*7c478bd9Sstevel@tonic-gate xor %i0, %i1, %o4 ! xor from and to address 1617*7c478bd9Sstevel@tonic-gate btst 3, %o4 ! if lower two bits zero 1618*7c478bd9Sstevel@tonic-gate bz %icc, .alwordcp ! can align on word boundary 1619*7c478bd9Sstevel@tonic-gate btst 3, %i0 ! delay slot, from address unaligned? 1620*7c478bd9Sstevel@tonic-gate ! 1621*7c478bd9Sstevel@tonic-gate ! use aligned reads and writes where possible 1622*7c478bd9Sstevel@tonic-gate ! this differs from wordcp in that it copes 1623*7c478bd9Sstevel@tonic-gate ! with odd alignment between source and destnation 1624*7c478bd9Sstevel@tonic-gate ! using word reads and writes with the proper shifts 1625*7c478bd9Sstevel@tonic-gate ! in between to align transfers to and from memory 1626*7c478bd9Sstevel@tonic-gate ! i0 - src address, i1 - dest address, i2 - count 1627*7c478bd9Sstevel@tonic-gate ! i3, i4 - tmps for used generating complete word 1628*7c478bd9Sstevel@tonic-gate ! i5 (word to write) 1629*7c478bd9Sstevel@tonic-gate ! l0 size in bits of upper part of source word (US) 1630*7c478bd9Sstevel@tonic-gate ! l1 size in bits of lower part of source word (LS = 32 - US) 1631*7c478bd9Sstevel@tonic-gate ! l2 size in bits of upper part of destination word (UD) 1632*7c478bd9Sstevel@tonic-gate ! l3 size in bits of lower part of destination word (LD = 32 - UD) 1633*7c478bd9Sstevel@tonic-gate ! l4 number of bytes leftover after aligned transfers complete 1634*7c478bd9Sstevel@tonic-gate ! l5 the number 32 1635*7c478bd9Sstevel@tonic-gate ! 1636*7c478bd9Sstevel@tonic-gate mov 32, %l5 ! load an oft-needed constant 1637*7c478bd9Sstevel@tonic-gate bz .align_dst_only 1638*7c478bd9Sstevel@tonic-gate btst 3, %i1 ! is destnation address aligned? 1639*7c478bd9Sstevel@tonic-gate clr %i4 ! clear registers used in either case 1640*7c478bd9Sstevel@tonic-gate bz %icc, .align_src_only 1641*7c478bd9Sstevel@tonic-gate clr %l0 1642*7c478bd9Sstevel@tonic-gate ! 1643*7c478bd9Sstevel@tonic-gate ! both source and destination addresses are unaligned 1644*7c478bd9Sstevel@tonic-gate ! 1645*7c478bd9Sstevel@tonic-gate1: ! align source 1646*7c478bd9Sstevel@tonic-gate ldub [%i0], %i3 ! read a byte from source address 1647*7c478bd9Sstevel@tonic-gate add %i0, 1, %i0 ! increment source address 1648*7c478bd9Sstevel@tonic-gate or %i4, %i3, %i4 ! or in with previous bytes (if any) 1649*7c478bd9Sstevel@tonic-gate btst 3, %i0 ! is source aligned? 1650*7c478bd9Sstevel@tonic-gate add %l0, 8, %l0 ! increment size of upper source (US) 1651*7c478bd9Sstevel@tonic-gate bnz,a 1b 1652*7c478bd9Sstevel@tonic-gate sll %i4, 8, %i4 ! make room for next byte 1653*7c478bd9Sstevel@tonic-gate 1654*7c478bd9Sstevel@tonic-gate sub %l5, %l0, %l1 ! generate shift left count (LS) 1655*7c478bd9Sstevel@tonic-gate sll %i4, %l1, %i4 ! prepare to get rest 1656*7c478bd9Sstevel@tonic-gate ld [%i0], %i3 ! read a word 1657*7c478bd9Sstevel@tonic-gate add %i0, 4, %i0 ! increment source address 1658*7c478bd9Sstevel@tonic-gate srl %i3, %l0, %i5 ! upper src bits into lower dst bits 1659*7c478bd9Sstevel@tonic-gate or %i4, %i5, %i5 ! merge 1660*7c478bd9Sstevel@tonic-gate mov 24, %l3 ! align destination 1661*7c478bd9Sstevel@tonic-gate1: 1662*7c478bd9Sstevel@tonic-gate srl %i5, %l3, %i4 ! prepare to write a single byte 1663*7c478bd9Sstevel@tonic-gate stb %i4, [%i1] ! write a byte 1664*7c478bd9Sstevel@tonic-gate add %i1, 1, %i1 ! increment destination address 1665*7c478bd9Sstevel@tonic-gate sub %i2, 1, %i2 ! decrement count 1666*7c478bd9Sstevel@tonic-gate btst 3, %i1 ! is destination aligned? 1667*7c478bd9Sstevel@tonic-gate bnz,a 1b 1668*7c478bd9Sstevel@tonic-gate sub %l3, 8, %l3 ! delay slot, decrement shift count (LD) 1669*7c478bd9Sstevel@tonic-gate sub %l5, %l3, %l2 ! generate shift left count (UD) 1670*7c478bd9Sstevel@tonic-gate sll %i5, %l2, %i5 ! move leftover into upper bytes 1671*7c478bd9Sstevel@tonic-gate cmp %l2, %l0 ! cmp # reqd to fill dst w old src left 1672*7c478bd9Sstevel@tonic-gate bgu %ncc, .more_needed ! need more to fill than we have 1673*7c478bd9Sstevel@tonic-gate nop 1674*7c478bd9Sstevel@tonic-gate 1675*7c478bd9Sstevel@tonic-gate sll %i3, %l1, %i3 ! clear upper used byte(s) 1676*7c478bd9Sstevel@tonic-gate srl %i3, %l1, %i3 1677*7c478bd9Sstevel@tonic-gate ! get the odd bytes between alignments 1678*7c478bd9Sstevel@tonic-gate sub %l0, %l2, %l0 ! regenerate shift count 1679*7c478bd9Sstevel@tonic-gate sub %l5, %l0, %l1 ! generate new shift left count (LS) 1680*7c478bd9Sstevel@tonic-gate and %i2, 3, %l4 ! must do remaining bytes if count%4 > 0 1681*7c478bd9Sstevel@tonic-gate andn %i2, 3, %i2 ! # of aligned bytes that can be moved 1682*7c478bd9Sstevel@tonic-gate srl %i3, %l0, %i4 1683*7c478bd9Sstevel@tonic-gate or %i5, %i4, %i5 1684*7c478bd9Sstevel@tonic-gate st %i5, [%i1] ! write a word 1685*7c478bd9Sstevel@tonic-gate subcc %i2, 4, %i2 ! decrement count 1686*7c478bd9Sstevel@tonic-gate bz %ncc, .unalign_out 1687*7c478bd9Sstevel@tonic-gate add %i1, 4, %i1 ! increment destination address 1688*7c478bd9Sstevel@tonic-gate 1689*7c478bd9Sstevel@tonic-gate b 2f 1690*7c478bd9Sstevel@tonic-gate sll %i3, %l1, %i5 ! get leftover into upper bits 1691*7c478bd9Sstevel@tonic-gate.more_needed: 1692*7c478bd9Sstevel@tonic-gate sll %i3, %l0, %i3 ! save remaining byte(s) 1693*7c478bd9Sstevel@tonic-gate srl %i3, %l0, %i3 1694*7c478bd9Sstevel@tonic-gate sub %l2, %l0, %l1 ! regenerate shift count 1695*7c478bd9Sstevel@tonic-gate sub %l5, %l1, %l0 ! generate new shift left count 1696*7c478bd9Sstevel@tonic-gate sll %i3, %l1, %i4 ! move to fill empty space 1697*7c478bd9Sstevel@tonic-gate b 3f 1698*7c478bd9Sstevel@tonic-gate or %i5, %i4, %i5 ! merge to complete word 1699*7c478bd9Sstevel@tonic-gate ! 1700*7c478bd9Sstevel@tonic-gate ! the source address is aligned and destination is not 1701*7c478bd9Sstevel@tonic-gate ! 1702*7c478bd9Sstevel@tonic-gate.align_dst_only: 1703*7c478bd9Sstevel@tonic-gate ld [%i0], %i4 ! read a word 1704*7c478bd9Sstevel@tonic-gate add %i0, 4, %i0 ! increment source address 1705*7c478bd9Sstevel@tonic-gate mov 24, %l0 ! initial shift alignment count 1706*7c478bd9Sstevel@tonic-gate1: 1707*7c478bd9Sstevel@tonic-gate srl %i4, %l0, %i3 ! prepare to write a single byte 1708*7c478bd9Sstevel@tonic-gate stb %i3, [%i1] ! write a byte 1709*7c478bd9Sstevel@tonic-gate add %i1, 1, %i1 ! increment destination address 1710*7c478bd9Sstevel@tonic-gate sub %i2, 1, %i2 ! decrement count 1711*7c478bd9Sstevel@tonic-gate btst 3, %i1 ! is destination aligned? 1712*7c478bd9Sstevel@tonic-gate bnz,a 1b 1713*7c478bd9Sstevel@tonic-gate sub %l0, 8, %l0 ! delay slot, decrement shift count 1714*7c478bd9Sstevel@tonic-gate.xfer: 1715*7c478bd9Sstevel@tonic-gate sub %l5, %l0, %l1 ! generate shift left count 1716*7c478bd9Sstevel@tonic-gate sll %i4, %l1, %i5 ! get leftover 1717*7c478bd9Sstevel@tonic-gate3: 1718*7c478bd9Sstevel@tonic-gate and %i2, 3, %l4 ! must do remaining bytes if count%4 > 0 1719*7c478bd9Sstevel@tonic-gate andn %i2, 3, %i2 ! # of aligned bytes that can be moved 1720*7c478bd9Sstevel@tonic-gate2: 1721*7c478bd9Sstevel@tonic-gate ld [%i0], %i3 ! read a source word 1722*7c478bd9Sstevel@tonic-gate add %i0, 4, %i0 ! increment source address 1723*7c478bd9Sstevel@tonic-gate srl %i3, %l0, %i4 ! upper src bits into lower dst bits 1724*7c478bd9Sstevel@tonic-gate or %i5, %i4, %i5 ! merge with upper dest bits (leftover) 1725*7c478bd9Sstevel@tonic-gate st %i5, [%i1] ! write a destination word 1726*7c478bd9Sstevel@tonic-gate subcc %i2, 4, %i2 ! decrement count 1727*7c478bd9Sstevel@tonic-gate bz %ncc, .unalign_out ! check if done 1728*7c478bd9Sstevel@tonic-gate add %i1, 4, %i1 ! increment destination address 1729*7c478bd9Sstevel@tonic-gate b 2b ! loop 1730*7c478bd9Sstevel@tonic-gate sll %i3, %l1, %i5 ! get leftover 1731*7c478bd9Sstevel@tonic-gate.unalign_out: 1732*7c478bd9Sstevel@tonic-gate tst %l4 ! any bytes leftover? 1733*7c478bd9Sstevel@tonic-gate bz %ncc, .cpdone 1734*7c478bd9Sstevel@tonic-gate .empty ! allow next instruction in delay slot 1735*7c478bd9Sstevel@tonic-gate1: 1736*7c478bd9Sstevel@tonic-gate sub %l0, 8, %l0 ! decrement shift 1737*7c478bd9Sstevel@tonic-gate srl %i3, %l0, %i4 ! upper src byte into lower dst byte 1738*7c478bd9Sstevel@tonic-gate stb %i4, [%i1] ! write a byte 1739*7c478bd9Sstevel@tonic-gate subcc %l4, 1, %l4 ! decrement count 1740*7c478bd9Sstevel@tonic-gate bz %ncc, .cpdone ! done? 1741*7c478bd9Sstevel@tonic-gate add %i1, 1, %i1 ! increment destination 1742*7c478bd9Sstevel@tonic-gate tst %l0 ! any more previously read bytes 1743*7c478bd9Sstevel@tonic-gate bnz %ncc, 1b ! we have leftover bytes 1744*7c478bd9Sstevel@tonic-gate mov %l4, %i2 ! delay slot, mv cnt where dbytecp wants 1745*7c478bd9Sstevel@tonic-gate b .dbytecp ! let dbytecp do the rest 1746*7c478bd9Sstevel@tonic-gate sub %i0, %i1, %i0 ! i0 gets the difference of src and dst 1747*7c478bd9Sstevel@tonic-gate ! 1748*7c478bd9Sstevel@tonic-gate ! the destination address is aligned and the source is not 1749*7c478bd9Sstevel@tonic-gate ! 1750*7c478bd9Sstevel@tonic-gate.align_src_only: 1751*7c478bd9Sstevel@tonic-gate ldub [%i0], %i3 ! read a byte from source address 1752*7c478bd9Sstevel@tonic-gate add %i0, 1, %i0 ! increment source address 1753*7c478bd9Sstevel@tonic-gate or %i4, %i3, %i4 ! or in with previous bytes (if any) 1754*7c478bd9Sstevel@tonic-gate btst 3, %i0 ! is source aligned? 1755*7c478bd9Sstevel@tonic-gate add %l0, 8, %l0 ! increment shift count (US) 1756*7c478bd9Sstevel@tonic-gate bnz,a .align_src_only 1757*7c478bd9Sstevel@tonic-gate sll %i4, 8, %i4 ! make room for next byte 1758*7c478bd9Sstevel@tonic-gate b,a .xfer 1759*7c478bd9Sstevel@tonic-gate ! 1760*7c478bd9Sstevel@tonic-gate ! if from address unaligned for double-word moves, 1761*7c478bd9Sstevel@tonic-gate ! move bytes till it is, if count is < 56 it could take 1762*7c478bd9Sstevel@tonic-gate ! longer to align the thing than to do the transfer 1763*7c478bd9Sstevel@tonic-gate ! in word size chunks right away 1764*7c478bd9Sstevel@tonic-gate ! 1765*7c478bd9Sstevel@tonic-gate.aldoubcp: 1766*7c478bd9Sstevel@tonic-gate cmp %i2, 56 ! if count < 56, use wordcp, it takes 1767*7c478bd9Sstevel@tonic-gate blu,a %ncc, .alwordcp ! longer to align doubles than words 1768*7c478bd9Sstevel@tonic-gate mov 3, %o0 ! mask for word alignment 1769*7c478bd9Sstevel@tonic-gate call .alignit ! copy bytes until aligned 1770*7c478bd9Sstevel@tonic-gate mov 7, %o0 ! mask for double alignment 1771*7c478bd9Sstevel@tonic-gate ! 1772*7c478bd9Sstevel@tonic-gate ! source and destination are now double-word aligned 1773*7c478bd9Sstevel@tonic-gate ! i3 has aligned count returned by alignit 1774*7c478bd9Sstevel@tonic-gate ! 1775*7c478bd9Sstevel@tonic-gate and %i2, 7, %i2 ! unaligned leftover count 1776*7c478bd9Sstevel@tonic-gate sub %i0, %i1, %i0 ! i0 gets the difference of src and dst 1777*7c478bd9Sstevel@tonic-gate5: 1778*7c478bd9Sstevel@tonic-gate ldx [%i0+%i1], %o4 ! read from address 1779*7c478bd9Sstevel@tonic-gate stx %o4, [%i1] ! write at destination address 1780*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 ! dec count 1781*7c478bd9Sstevel@tonic-gate bgu %ncc, 5b 1782*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 ! delay slot, inc to address 1783*7c478bd9Sstevel@tonic-gate cmp %i2, 4 ! see if we can copy a word 1784*7c478bd9Sstevel@tonic-gate blu %ncc, .dbytecp ! if 3 or less bytes use bytecp 1785*7c478bd9Sstevel@tonic-gate .empty 1786*7c478bd9Sstevel@tonic-gate ! 1787*7c478bd9Sstevel@tonic-gate ! for leftover bytes we fall into wordcp, if needed 1788*7c478bd9Sstevel@tonic-gate ! 1789*7c478bd9Sstevel@tonic-gate.wordcp: 1790*7c478bd9Sstevel@tonic-gate and %i2, 3, %i2 ! unaligned leftover count 1791*7c478bd9Sstevel@tonic-gate5: 1792*7c478bd9Sstevel@tonic-gate ld [%i0+%i1], %o4 ! read from address 1793*7c478bd9Sstevel@tonic-gate st %o4, [%i1] ! write at destination address 1794*7c478bd9Sstevel@tonic-gate subcc %i3, 4, %i3 ! dec count 1795*7c478bd9Sstevel@tonic-gate bgu %ncc, 5b 1796*7c478bd9Sstevel@tonic-gate add %i1, 4, %i1 ! delay slot, inc to address 1797*7c478bd9Sstevel@tonic-gate b,a .dbytecp 1798*7c478bd9Sstevel@tonic-gate 1799*7c478bd9Sstevel@tonic-gate ! we come here to align copies on word boundaries 1800*7c478bd9Sstevel@tonic-gate.alwordcp: 1801*7c478bd9Sstevel@tonic-gate call .alignit ! go word-align it 1802*7c478bd9Sstevel@tonic-gate mov 3, %o0 ! bits that must be zero to be aligned 1803*7c478bd9Sstevel@tonic-gate b .wordcp 1804*7c478bd9Sstevel@tonic-gate sub %i0, %i1, %i0 ! i0 gets the difference of src and dst 1805*7c478bd9Sstevel@tonic-gate 1806*7c478bd9Sstevel@tonic-gate ! 1807*7c478bd9Sstevel@tonic-gate ! byte copy, works with any alignment 1808*7c478bd9Sstevel@tonic-gate ! 1809*7c478bd9Sstevel@tonic-gate.bytecp: 1810*7c478bd9Sstevel@tonic-gate b .dbytecp 1811*7c478bd9Sstevel@tonic-gate sub %i0, %i1, %i0 ! i0 gets difference of src and dst 1812*7c478bd9Sstevel@tonic-gate 1813*7c478bd9Sstevel@tonic-gate ! 1814*7c478bd9Sstevel@tonic-gate ! differenced byte copy, works with any alignment 1815*7c478bd9Sstevel@tonic-gate ! assumes dest in %i1 and (source - dest) in %i0 1816*7c478bd9Sstevel@tonic-gate ! 1817*7c478bd9Sstevel@tonic-gate1: 1818*7c478bd9Sstevel@tonic-gate stb %o4, [%i1] ! write to address 1819*7c478bd9Sstevel@tonic-gate inc %i1 ! inc to address 1820*7c478bd9Sstevel@tonic-gate.dbytecp: 1821*7c478bd9Sstevel@tonic-gate deccc %i2 ! dec count 1822*7c478bd9Sstevel@tonic-gate bgeu,a %ncc, 1b ! loop till done 1823*7c478bd9Sstevel@tonic-gate ldub [%i0+%i1], %o4 ! read from address 1824*7c478bd9Sstevel@tonic-gate ! 1825*7c478bd9Sstevel@tonic-gate ! FPUSED_FLAG will not have been set in any path leading to 1826*7c478bd9Sstevel@tonic-gate ! this point. No need to deal with it. 1827*7c478bd9Sstevel@tonic-gate ! 1828*7c478bd9Sstevel@tonic-gate.cpdone: 1829*7c478bd9Sstevel@tonic-gate btst BCOPY_FLAG, %l6 1830*7c478bd9Sstevel@tonic-gate bz,pn %icc, 2f 1831*7c478bd9Sstevel@tonic-gate andncc %l6, BCOPY_FLAG, %l6 1832*7c478bd9Sstevel@tonic-gate ! 1833*7c478bd9Sstevel@tonic-gate ! Here via bcopy. Check to see if the handler was NULL. 1834*7c478bd9Sstevel@tonic-gate ! If so, just return quietly. Otherwise, reset the 1835*7c478bd9Sstevel@tonic-gate ! handler and go home. 1836*7c478bd9Sstevel@tonic-gate ! 1837*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 2f 1838*7c478bd9Sstevel@tonic-gate nop 1839*7c478bd9Sstevel@tonic-gate ! 1840*7c478bd9Sstevel@tonic-gate ! Null handler. 1841*7c478bd9Sstevel@tonic-gate ! 1842*7c478bd9Sstevel@tonic-gate ret 1843*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 1844*7c478bd9Sstevel@tonic-gate ! 1845*7c478bd9Sstevel@tonic-gate ! Here via kcopy or bcopy with a handler.Reset the 1846*7c478bd9Sstevel@tonic-gate ! fault handler. 1847*7c478bd9Sstevel@tonic-gate ! 1848*7c478bd9Sstevel@tonic-gate2: 1849*7c478bd9Sstevel@tonic-gate membar #Sync 1850*7c478bd9Sstevel@tonic-gate stn %l6, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 1851*7c478bd9Sstevel@tonic-gate ret 1852*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 ! return (0) 1853*7c478bd9Sstevel@tonic-gate 1854*7c478bd9Sstevel@tonic-gate/* 1855*7c478bd9Sstevel@tonic-gate * Common code used to align transfers on word and doubleword 1856*7c478bd9Sstevel@tonic-gate * boudaries. Aligns source and destination and returns a count 1857*7c478bd9Sstevel@tonic-gate * of aligned bytes to transfer in %i3 1858*7c478bd9Sstevel@tonic-gate */ 1859*7c478bd9Sstevel@tonic-gate1: 1860*7c478bd9Sstevel@tonic-gate inc %i0 ! inc from 1861*7c478bd9Sstevel@tonic-gate stb %o4, [%i1] ! write a byte 1862*7c478bd9Sstevel@tonic-gate inc %i1 ! inc to 1863*7c478bd9Sstevel@tonic-gate dec %i2 ! dec count 1864*7c478bd9Sstevel@tonic-gate.alignit: 1865*7c478bd9Sstevel@tonic-gate btst %o0, %i0 ! %o0 is bit mask to check for alignment 1866*7c478bd9Sstevel@tonic-gate bnz,a 1b 1867*7c478bd9Sstevel@tonic-gate ldub [%i0], %o4 ! read next byte 1868*7c478bd9Sstevel@tonic-gate 1869*7c478bd9Sstevel@tonic-gate retl 1870*7c478bd9Sstevel@tonic-gate andn %i2, %o0, %i3 ! return size of aligned bytes 1871*7c478bd9Sstevel@tonic-gate SET_SIZE(bcopy) 1872*7c478bd9Sstevel@tonic-gate 1873*7c478bd9Sstevel@tonic-gate#endif /* lint */ 1874*7c478bd9Sstevel@tonic-gate 1875*7c478bd9Sstevel@tonic-gate/* 1876*7c478bd9Sstevel@tonic-gate * Block copy with possibly overlapped operands. 1877*7c478bd9Sstevel@tonic-gate */ 1878*7c478bd9Sstevel@tonic-gate 1879*7c478bd9Sstevel@tonic-gate#if defined(lint) 1880*7c478bd9Sstevel@tonic-gate 1881*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 1882*7c478bd9Sstevel@tonic-gatevoid 1883*7c478bd9Sstevel@tonic-gateovbcopy(const void *from, void *to, size_t count) 1884*7c478bd9Sstevel@tonic-gate{} 1885*7c478bd9Sstevel@tonic-gate 1886*7c478bd9Sstevel@tonic-gate#else /* lint */ 1887*7c478bd9Sstevel@tonic-gate 1888*7c478bd9Sstevel@tonic-gate ENTRY(ovbcopy) 1889*7c478bd9Sstevel@tonic-gate tst %o2 ! check count 1890*7c478bd9Sstevel@tonic-gate bgu,a %ncc, 1f ! nothing to do or bad arguments 1891*7c478bd9Sstevel@tonic-gate subcc %o0, %o1, %o3 ! difference of from and to address 1892*7c478bd9Sstevel@tonic-gate 1893*7c478bd9Sstevel@tonic-gate retl ! return 1894*7c478bd9Sstevel@tonic-gate nop 1895*7c478bd9Sstevel@tonic-gate1: 1896*7c478bd9Sstevel@tonic-gate bneg,a %ncc, 2f 1897*7c478bd9Sstevel@tonic-gate neg %o3 ! if < 0, make it positive 1898*7c478bd9Sstevel@tonic-gate2: cmp %o2, %o3 ! cmp size and abs(from - to) 1899*7c478bd9Sstevel@tonic-gate bleu %ncc, bcopy ! if size <= abs(diff): use bcopy, 1900*7c478bd9Sstevel@tonic-gate .empty ! no overlap 1901*7c478bd9Sstevel@tonic-gate cmp %o0, %o1 ! compare from and to addresses 1902*7c478bd9Sstevel@tonic-gate blu %ncc, .ov_bkwd ! if from < to, copy backwards 1903*7c478bd9Sstevel@tonic-gate nop 1904*7c478bd9Sstevel@tonic-gate ! 1905*7c478bd9Sstevel@tonic-gate ! Copy forwards. 1906*7c478bd9Sstevel@tonic-gate ! 1907*7c478bd9Sstevel@tonic-gate.ov_fwd: 1908*7c478bd9Sstevel@tonic-gate ldub [%o0], %o3 ! read from address 1909*7c478bd9Sstevel@tonic-gate inc %o0 ! inc from address 1910*7c478bd9Sstevel@tonic-gate stb %o3, [%o1] ! write to address 1911*7c478bd9Sstevel@tonic-gate deccc %o2 ! dec count 1912*7c478bd9Sstevel@tonic-gate bgu %ncc, .ov_fwd ! loop till done 1913*7c478bd9Sstevel@tonic-gate inc %o1 ! inc to address 1914*7c478bd9Sstevel@tonic-gate 1915*7c478bd9Sstevel@tonic-gate retl ! return 1916*7c478bd9Sstevel@tonic-gate nop 1917*7c478bd9Sstevel@tonic-gate ! 1918*7c478bd9Sstevel@tonic-gate ! Copy backwards. 1919*7c478bd9Sstevel@tonic-gate ! 1920*7c478bd9Sstevel@tonic-gate.ov_bkwd: 1921*7c478bd9Sstevel@tonic-gate deccc %o2 ! dec count 1922*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o2], %o3 ! get byte at end of src 1923*7c478bd9Sstevel@tonic-gate bgu %ncc, .ov_bkwd ! loop till done 1924*7c478bd9Sstevel@tonic-gate stb %o3, [%o1 + %o2] ! delay slot, store at end of dst 1925*7c478bd9Sstevel@tonic-gate 1926*7c478bd9Sstevel@tonic-gate retl ! return 1927*7c478bd9Sstevel@tonic-gate nop 1928*7c478bd9Sstevel@tonic-gate SET_SIZE(ovbcopy) 1929*7c478bd9Sstevel@tonic-gate 1930*7c478bd9Sstevel@tonic-gate#endif /* lint */ 1931*7c478bd9Sstevel@tonic-gate 1932*7c478bd9Sstevel@tonic-gate/* 1933*7c478bd9Sstevel@tonic-gate * hwblkpagecopy() 1934*7c478bd9Sstevel@tonic-gate * 1935*7c478bd9Sstevel@tonic-gate * Copies exactly one page. This routine assumes the caller (ppcopy) 1936*7c478bd9Sstevel@tonic-gate * has already disabled kernel preemption and has checked 1937*7c478bd9Sstevel@tonic-gate * use_hw_bcopy. 1938*7c478bd9Sstevel@tonic-gate */ 1939*7c478bd9Sstevel@tonic-gate#ifdef lint 1940*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 1941*7c478bd9Sstevel@tonic-gatevoid 1942*7c478bd9Sstevel@tonic-gatehwblkpagecopy(const void *src, void *dst) 1943*7c478bd9Sstevel@tonic-gate{ } 1944*7c478bd9Sstevel@tonic-gate#else /* lint */ 1945*7c478bd9Sstevel@tonic-gate ENTRY(hwblkpagecopy) 1946*7c478bd9Sstevel@tonic-gate ! get another window w/space for three aligned blocks of saved fpregs 1947*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + 4*64), %sp 1948*7c478bd9Sstevel@tonic-gate 1949*7c478bd9Sstevel@tonic-gate ! %i0 - source address (arg) 1950*7c478bd9Sstevel@tonic-gate ! %i1 - destination address (arg) 1951*7c478bd9Sstevel@tonic-gate ! %i2 - length of region (not arg) 1952*7c478bd9Sstevel@tonic-gate ! %l0 - saved fprs 1953*7c478bd9Sstevel@tonic-gate ! %l1 - pointer to saved fpregs 1954*7c478bd9Sstevel@tonic-gate 1955*7c478bd9Sstevel@tonic-gate rd %fprs, %l0 ! check for unused fp 1956*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %l0 1957*7c478bd9Sstevel@tonic-gate bz 1f 1958*7c478bd9Sstevel@tonic-gate membar #Sync 1959*7c478bd9Sstevel@tonic-gate 1960*7c478bd9Sstevel@tonic-gate ! save in-use fpregs on stack 1961*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 193, %l1 1962*7c478bd9Sstevel@tonic-gate and %l1, -64, %l1 1963*7c478bd9Sstevel@tonic-gate stda %d0, [%l1]ASI_BLK_P 1964*7c478bd9Sstevel@tonic-gate add %l1, 64, %l3 1965*7c478bd9Sstevel@tonic-gate stda %d16, [%l3]ASI_BLK_P 1966*7c478bd9Sstevel@tonic-gate add %l3, 64, %l3 1967*7c478bd9Sstevel@tonic-gate stda %d32, [%l3]ASI_BLK_P 1968*7c478bd9Sstevel@tonic-gate membar #Sync 1969*7c478bd9Sstevel@tonic-gate 1970*7c478bd9Sstevel@tonic-gate1: wr %g0, FPRS_FEF, %fprs 1971*7c478bd9Sstevel@tonic-gate ldda [%i0]ASI_BLK_P, %d0 1972*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1973*7c478bd9Sstevel@tonic-gate set PAGESIZE - 64, %i2 1974*7c478bd9Sstevel@tonic-gate 1975*7c478bd9Sstevel@tonic-gate2: ldda [%i0]ASI_BLK_P, %d16 1976*7c478bd9Sstevel@tonic-gate fsrc1 %d0, %d32 1977*7c478bd9Sstevel@tonic-gate fsrc1 %d2, %d34 1978*7c478bd9Sstevel@tonic-gate fsrc1 %d4, %d36 1979*7c478bd9Sstevel@tonic-gate fsrc1 %d6, %d38 1980*7c478bd9Sstevel@tonic-gate fsrc1 %d8, %d40 1981*7c478bd9Sstevel@tonic-gate fsrc1 %d10, %d42 1982*7c478bd9Sstevel@tonic-gate fsrc1 %d12, %d44 1983*7c478bd9Sstevel@tonic-gate fsrc1 %d14, %d46 1984*7c478bd9Sstevel@tonic-gate stda %d32, [%i1]ASI_BLK_P 1985*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 1986*7c478bd9Sstevel@tonic-gate subcc %i2, 64, %i2 1987*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 3f 1988*7c478bd9Sstevel@tonic-gate add %i1, 64, %i1 1989*7c478bd9Sstevel@tonic-gate ldda [%i0]ASI_BLK_P, %d0 1990*7c478bd9Sstevel@tonic-gate fsrc1 %d16, %d32 1991*7c478bd9Sstevel@tonic-gate fsrc1 %d18, %d34 1992*7c478bd9Sstevel@tonic-gate fsrc1 %d20, %d36 1993*7c478bd9Sstevel@tonic-gate fsrc1 %d22, %d38 1994*7c478bd9Sstevel@tonic-gate fsrc1 %d24, %d40 1995*7c478bd9Sstevel@tonic-gate fsrc1 %d26, %d42 1996*7c478bd9Sstevel@tonic-gate fsrc1 %d28, %d44 1997*7c478bd9Sstevel@tonic-gate fsrc1 %d30, %d46 1998*7c478bd9Sstevel@tonic-gate stda %d32, [%i1]ASI_BLK_P 1999*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2000*7c478bd9Sstevel@tonic-gate sub %i2, 64, %i2 2001*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 2b 2002*7c478bd9Sstevel@tonic-gate add %i1, 64, %i1 2003*7c478bd9Sstevel@tonic-gate 2004*7c478bd9Sstevel@tonic-gate3: membar #Sync 2005*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %l0 2006*7c478bd9Sstevel@tonic-gate bz 4f 2007*7c478bd9Sstevel@tonic-gate stda %d16, [%i1]ASI_BLK_P 2008*7c478bd9Sstevel@tonic-gate 2009*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 2010*7c478bd9Sstevel@tonic-gate membar #Sync 2011*7c478bd9Sstevel@tonic-gate ldda [%l1]ASI_BLK_P, %d0 2012*7c478bd9Sstevel@tonic-gate add %l1, 64, %l3 2013*7c478bd9Sstevel@tonic-gate ldda [%l3]ASI_BLK_P, %d16 2014*7c478bd9Sstevel@tonic-gate add %l3, 64, %l3 2015*7c478bd9Sstevel@tonic-gate ldda [%l3]ASI_BLK_P, %d32 2016*7c478bd9Sstevel@tonic-gate 2017*7c478bd9Sstevel@tonic-gate4: wr %l0, 0, %fprs ! restore fprs 2018*7c478bd9Sstevel@tonic-gate membar #Sync 2019*7c478bd9Sstevel@tonic-gate ret 2020*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 2021*7c478bd9Sstevel@tonic-gate SET_SIZE(hwblkpagecopy) 2022*7c478bd9Sstevel@tonic-gate#endif /* lint */ 2023*7c478bd9Sstevel@tonic-gate 2024*7c478bd9Sstevel@tonic-gate 2025*7c478bd9Sstevel@tonic-gate/* 2026*7c478bd9Sstevel@tonic-gate * Transfer data to and from user space - 2027*7c478bd9Sstevel@tonic-gate * Note that these routines can cause faults 2028*7c478bd9Sstevel@tonic-gate * It is assumed that the kernel has nothing at 2029*7c478bd9Sstevel@tonic-gate * less than KERNELBASE in the virtual address space. 2030*7c478bd9Sstevel@tonic-gate * 2031*7c478bd9Sstevel@tonic-gate * Note that copyin(9F) and copyout(9F) are part of the 2032*7c478bd9Sstevel@tonic-gate * DDI/DKI which specifies that they return '-1' on "errors." 2033*7c478bd9Sstevel@tonic-gate * 2034*7c478bd9Sstevel@tonic-gate * Sigh. 2035*7c478bd9Sstevel@tonic-gate * 2036*7c478bd9Sstevel@tonic-gate * So there's two extremely similar routines - xcopyin() and xcopyout() 2037*7c478bd9Sstevel@tonic-gate * which return the errno that we've faithfully computed. This 2038*7c478bd9Sstevel@tonic-gate * allows other callers (e.g. uiomove(9F)) to work correctly. 2039*7c478bd9Sstevel@tonic-gate * Given that these are used pretty heavily, we expand the calling 2040*7c478bd9Sstevel@tonic-gate * sequences inline for all flavours (rather than making wrappers). 2041*7c478bd9Sstevel@tonic-gate * 2042*7c478bd9Sstevel@tonic-gate * There are also stub routines for xcopyout_little and xcopyin_little, 2043*7c478bd9Sstevel@tonic-gate * which currently are intended to handle requests of <= 16 bytes from 2044*7c478bd9Sstevel@tonic-gate * do_unaligned. Future enhancement to make them handle 8k pages efficiently 2045*7c478bd9Sstevel@tonic-gate * is left as an exercise... 2046*7c478bd9Sstevel@tonic-gate */ 2047*7c478bd9Sstevel@tonic-gate 2048*7c478bd9Sstevel@tonic-gate/* 2049*7c478bd9Sstevel@tonic-gate * Copy user data to kernel space (copyOP/xcopyOP/copyOP_noerr) 2050*7c478bd9Sstevel@tonic-gate * 2051*7c478bd9Sstevel@tonic-gate * General theory of operation: 2052*7c478bd9Sstevel@tonic-gate * 2053*7c478bd9Sstevel@tonic-gate * The only difference between default_copy{in,out} and 2054*7c478bd9Sstevel@tonic-gate * default_xcopy{in,out} is in the error handling routine they invoke 2055*7c478bd9Sstevel@tonic-gate * when a memory access error is seen. default_xcopyOP returns the errno 2056*7c478bd9Sstevel@tonic-gate * while default_copyOP returns -1 (see above). copy{in,out}_noerr set 2057*7c478bd9Sstevel@tonic-gate * a special flag (by oring the value 2 into the fault handler address) 2058*7c478bd9Sstevel@tonic-gate * if they are called with a fault handler already in place. That flag 2059*7c478bd9Sstevel@tonic-gate * causes the default handlers to trampoline to the previous handler 2060*7c478bd9Sstevel@tonic-gate * upon an error. 2061*7c478bd9Sstevel@tonic-gate * 2062*7c478bd9Sstevel@tonic-gate * None of the copyops routines grab a window until it's decided that 2063*7c478bd9Sstevel@tonic-gate * we need to do a HW block copy operation. This saves a window 2064*7c478bd9Sstevel@tonic-gate * spill/fill when we're called during socket ops. The typical IO 2065*7c478bd9Sstevel@tonic-gate * path won't cause spill/fill traps. 2066*7c478bd9Sstevel@tonic-gate * 2067*7c478bd9Sstevel@tonic-gate * This code uses a set of 4 limits for the maximum size that will 2068*7c478bd9Sstevel@tonic-gate * be copied given a particular input/output address alignment. 2069*7c478bd9Sstevel@tonic-gate * the default limits are: 2070*7c478bd9Sstevel@tonic-gate * 2071*7c478bd9Sstevel@tonic-gate * single byte aligned - 900 (hw_copy_limit_1) 2072*7c478bd9Sstevel@tonic-gate * two byte aligned - 1800 (hw_copy_limit_2) 2073*7c478bd9Sstevel@tonic-gate * four byte aligned - 3600 (hw_copy_limit_4) 2074*7c478bd9Sstevel@tonic-gate * eight byte aligned - 7200 (hw_copy_limit_8) 2075*7c478bd9Sstevel@tonic-gate * 2076*7c478bd9Sstevel@tonic-gate * If the value for a particular limit is zero, the copy will be done 2077*7c478bd9Sstevel@tonic-gate * via the copy loops rather than VIS. 2078*7c478bd9Sstevel@tonic-gate * 2079*7c478bd9Sstevel@tonic-gate * Flow: 2080*7c478bd9Sstevel@tonic-gate * 2081*7c478bd9Sstevel@tonic-gate * If count == zero return zero. 2082*7c478bd9Sstevel@tonic-gate * 2083*7c478bd9Sstevel@tonic-gate * Store the previous lo_fault handler into %g6. 2084*7c478bd9Sstevel@tonic-gate * Place our secondary lofault handler into %g5. 2085*7c478bd9Sstevel@tonic-gate * Place the address of our nowindow fault handler into %o3. 2086*7c478bd9Sstevel@tonic-gate * Place the address of the windowed fault handler into %o4. 2087*7c478bd9Sstevel@tonic-gate * --> We'll use this handler if we end up grabbing a window 2088*7c478bd9Sstevel@tonic-gate * --> before we use VIS instructions. 2089*7c478bd9Sstevel@tonic-gate * 2090*7c478bd9Sstevel@tonic-gate * If count is less than or equal to SMALL_LIMIT (7) we 2091*7c478bd9Sstevel@tonic-gate * always do a byte for byte copy. 2092*7c478bd9Sstevel@tonic-gate * 2093*7c478bd9Sstevel@tonic-gate * If count is > SMALL_LIMIT, we check the alignment of the input 2094*7c478bd9Sstevel@tonic-gate * and output pointers. Based on the alignment we check count 2095*7c478bd9Sstevel@tonic-gate * against a soft limit of VIS_COPY_THRESHOLD (900 on spitfire). If 2096*7c478bd9Sstevel@tonic-gate * we're larger than VIS_COPY_THRESHOLD, we check against a limit based 2097*7c478bd9Sstevel@tonic-gate * on detected alignment. If we exceed the alignment value we copy 2098*7c478bd9Sstevel@tonic-gate * via VIS instructions. 2099*7c478bd9Sstevel@tonic-gate * 2100*7c478bd9Sstevel@tonic-gate * If we don't exceed one of the limits, we store -count in %o3, 2101*7c478bd9Sstevel@tonic-gate * we store the number of chunks (8, 4, 2 or 1 byte) operated 2102*7c478bd9Sstevel@tonic-gate * on in our basic copy loop in %o2. Following this we branch 2103*7c478bd9Sstevel@tonic-gate * to the appropriate copy loop and copy that many chunks. 2104*7c478bd9Sstevel@tonic-gate * Since we've been adding the chunk size to %o3 each time through 2105*7c478bd9Sstevel@tonic-gate * as well as decrementing %o2, we can tell if any data is 2106*7c478bd9Sstevel@tonic-gate * is left to be copied by examining %o3. If that is zero, we're 2107*7c478bd9Sstevel@tonic-gate * done and can go home. If not, we figure out what the largest 2108*7c478bd9Sstevel@tonic-gate * chunk size left to be copied is and branch to that copy loop 2109*7c478bd9Sstevel@tonic-gate * unless there's only one byte left. We load that as we're 2110*7c478bd9Sstevel@tonic-gate * branching to code that stores it just before we return. 2111*7c478bd9Sstevel@tonic-gate * 2112*7c478bd9Sstevel@tonic-gate * There is one potential situation in which we start to do a VIS 2113*7c478bd9Sstevel@tonic-gate * copy but decide to punt and return to the copy loops. There is 2114*7c478bd9Sstevel@tonic-gate * (in the default configuration) a window of 256 bytes between 2115*7c478bd9Sstevel@tonic-gate * the single byte aligned copy limit and what VIS treats as its 2116*7c478bd9Sstevel@tonic-gate * minimum if floating point is in use in the calling app. We need 2117*7c478bd9Sstevel@tonic-gate * to be prepared to handle this. See the .small_copyOP label for 2118*7c478bd9Sstevel@tonic-gate * details. 2119*7c478bd9Sstevel@tonic-gate * 2120*7c478bd9Sstevel@tonic-gate * Fault handlers are invoked if we reference memory that has no 2121*7c478bd9Sstevel@tonic-gate * current mapping. All forms share the same copyio_fault handler. 2122*7c478bd9Sstevel@tonic-gate * This routine handles fixing up the stack and general housecleaning. 2123*7c478bd9Sstevel@tonic-gate * Each copy operation has a simple fault handler that is then called 2124*7c478bd9Sstevel@tonic-gate * to do the work specific to the invidual operation. The handlers 2125*7c478bd9Sstevel@tonic-gate * for default_copyOP and copyOP_noerr are found at the end of 2126*7c478bd9Sstevel@tonic-gate * default_copyout. The handlers for default_xcopyOP are found at the 2127*7c478bd9Sstevel@tonic-gate * end of xdefault_copyin. 2128*7c478bd9Sstevel@tonic-gate */ 2129*7c478bd9Sstevel@tonic-gate 2130*7c478bd9Sstevel@tonic-gate/* 2131*7c478bd9Sstevel@tonic-gate * Copy kernel data to user space (copyout/xcopyout/xcopyout_little). 2132*7c478bd9Sstevel@tonic-gate */ 2133*7c478bd9Sstevel@tonic-gate 2134*7c478bd9Sstevel@tonic-gate#if defined(lint) 2135*7c478bd9Sstevel@tonic-gate 2136*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 2137*7c478bd9Sstevel@tonic-gateint 2138*7c478bd9Sstevel@tonic-gatecopyout(const void *kaddr, void *uaddr, size_t count) 2139*7c478bd9Sstevel@tonic-gate{ return (0); } 2140*7c478bd9Sstevel@tonic-gate 2141*7c478bd9Sstevel@tonic-gate#else /* lint */ 2142*7c478bd9Sstevel@tonic-gate 2143*7c478bd9Sstevel@tonic-gate/* 2144*7c478bd9Sstevel@tonic-gate * We save the arguments in the following registers in case of a fault: 2145*7c478bd9Sstevel@tonic-gate * kaddr - %g2 2146*7c478bd9Sstevel@tonic-gate * uaddr - %g3 2147*7c478bd9Sstevel@tonic-gate * count - %g4 2148*7c478bd9Sstevel@tonic-gate */ 2149*7c478bd9Sstevel@tonic-gate#define SAVE_SRC %g2 2150*7c478bd9Sstevel@tonic-gate#define SAVE_DST %g3 2151*7c478bd9Sstevel@tonic-gate#define SAVE_COUNT %g4 2152*7c478bd9Sstevel@tonic-gate 2153*7c478bd9Sstevel@tonic-gate#define REAL_LOFAULT %g5 2154*7c478bd9Sstevel@tonic-gate#define SAVED_LOFAULT %g6 2155*7c478bd9Sstevel@tonic-gate 2156*7c478bd9Sstevel@tonic-gate/* 2157*7c478bd9Sstevel@tonic-gate * Generic copyio fault handler. This is the first line of defense when a 2158*7c478bd9Sstevel@tonic-gate * fault occurs in (x)copyin/(x)copyout. In order for this to function 2159*7c478bd9Sstevel@tonic-gate * properly, the value of the 'real' lofault handler should be in REAL_LOFAULT. 2160*7c478bd9Sstevel@tonic-gate * This allows us to share common code for all the flavors of the copy 2161*7c478bd9Sstevel@tonic-gate * operations, including the _noerr versions. 2162*7c478bd9Sstevel@tonic-gate * 2163*7c478bd9Sstevel@tonic-gate * Note that this function will restore the original input parameters before 2164*7c478bd9Sstevel@tonic-gate * calling REAL_LOFAULT. So the real handler can vector to the appropriate 2165*7c478bd9Sstevel@tonic-gate * member of the t_copyop structure, if needed. 2166*7c478bd9Sstevel@tonic-gate */ 2167*7c478bd9Sstevel@tonic-gate ENTRY(copyio_fault) 2168*7c478bd9Sstevel@tonic-gate btst FPUSED_FLAG, SAVED_LOFAULT 2169*7c478bd9Sstevel@tonic-gate bz 1f 2170*7c478bd9Sstevel@tonic-gate andn SAVED_LOFAULT, FPUSED_FLAG, SAVED_LOFAULT 2171*7c478bd9Sstevel@tonic-gate 2172*7c478bd9Sstevel@tonic-gate membar #Sync 2173*7c478bd9Sstevel@tonic-gate 2174*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_GSR_OFFSET], %o2 2175*7c478bd9Sstevel@tonic-gate wr %o2, 0, %gsr ! restore gsr 2176*7c478bd9Sstevel@tonic-gate 2177*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_FPRS_OFFSET], %o3 2178*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 2179*7c478bd9Sstevel@tonic-gate bz 4f 2180*7c478bd9Sstevel@tonic-gate nop 2181*7c478bd9Sstevel@tonic-gate 2182*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 2183*7c478bd9Sstevel@tonic-gate membar #Sync 2184*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 2185*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 2186*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d0 2187*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2188*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d16 2189*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2190*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d32 2191*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2192*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d48 2193*7c478bd9Sstevel@tonic-gate membar #Sync 2194*7c478bd9Sstevel@tonic-gate 2195*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 1f 2196*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 2197*7c478bd9Sstevel@tonic-gate 2198*7c478bd9Sstevel@tonic-gate4: 2199*7c478bd9Sstevel@tonic-gate FZERO ! zero all of the fpregs 2200*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 2201*7c478bd9Sstevel@tonic-gate 2202*7c478bd9Sstevel@tonic-gate1: 2203*7c478bd9Sstevel@tonic-gate 2204*7c478bd9Sstevel@tonic-gate restore 2205*7c478bd9Sstevel@tonic-gate 2206*7c478bd9Sstevel@tonic-gate mov SAVE_SRC, %o0 2207*7c478bd9Sstevel@tonic-gate mov SAVE_DST, %o1 2208*7c478bd9Sstevel@tonic-gate jmp REAL_LOFAULT 2209*7c478bd9Sstevel@tonic-gate mov SAVE_COUNT, %o2 2210*7c478bd9Sstevel@tonic-gate SET_SIZE(copyio_fault) 2211*7c478bd9Sstevel@tonic-gate 2212*7c478bd9Sstevel@tonic-gate ENTRY(copyio_fault_nowindow) 2213*7c478bd9Sstevel@tonic-gate membar #Sync 2214*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 2215*7c478bd9Sstevel@tonic-gate 2216*7c478bd9Sstevel@tonic-gate mov SAVE_SRC, %o0 2217*7c478bd9Sstevel@tonic-gate mov SAVE_DST, %o1 2218*7c478bd9Sstevel@tonic-gate jmp REAL_LOFAULT 2219*7c478bd9Sstevel@tonic-gate mov SAVE_COUNT, %o2 2220*7c478bd9Sstevel@tonic-gate SET_SIZE(copyio_fault_nowindow) 2221*7c478bd9Sstevel@tonic-gate 2222*7c478bd9Sstevel@tonic-gate ENTRY(copyout) 2223*7c478bd9Sstevel@tonic-gate sethi %hi(.copyout_err), REAL_LOFAULT 2224*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.copyout_err), REAL_LOFAULT 2225*7c478bd9Sstevel@tonic-gate 2226*7c478bd9Sstevel@tonic-gate.do_copyout: 2227*7c478bd9Sstevel@tonic-gate ! 2228*7c478bd9Sstevel@tonic-gate ! Check the length and bail if zero. 2229*7c478bd9Sstevel@tonic-gate ! 2230*7c478bd9Sstevel@tonic-gate tst %o2 2231*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, 1f 2232*7c478bd9Sstevel@tonic-gate nop 2233*7c478bd9Sstevel@tonic-gate retl 2234*7c478bd9Sstevel@tonic-gate clr %o0 2235*7c478bd9Sstevel@tonic-gate1: 2236*7c478bd9Sstevel@tonic-gate sethi %hi(copyio_fault), %o4 2237*7c478bd9Sstevel@tonic-gate or %o4, %lo(copyio_fault), %o4 2238*7c478bd9Sstevel@tonic-gate sethi %hi(copyio_fault_nowindow), %o3 2239*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], SAVED_LOFAULT 2240*7c478bd9Sstevel@tonic-gate or %o3, %lo(copyio_fault_nowindow), %o3 2241*7c478bd9Sstevel@tonic-gate membar #Sync 2242*7c478bd9Sstevel@tonic-gate stn %o3, [THREAD_REG + T_LOFAULT] 2243*7c478bd9Sstevel@tonic-gate 2244*7c478bd9Sstevel@tonic-gate mov %o0, SAVE_SRC 2245*7c478bd9Sstevel@tonic-gate mov %o1, SAVE_DST 2246*7c478bd9Sstevel@tonic-gate mov %o2, SAVE_COUNT 2247*7c478bd9Sstevel@tonic-gate 2248*7c478bd9Sstevel@tonic-gate ! 2249*7c478bd9Sstevel@tonic-gate ! Check to see if we're more than SMALL_LIMIT (7 bytes). 2250*7c478bd9Sstevel@tonic-gate ! Run in leaf mode, using the %o regs as our input regs. 2251*7c478bd9Sstevel@tonic-gate ! 2252*7c478bd9Sstevel@tonic-gate subcc %o2, SMALL_LIMIT, %o3 2253*7c478bd9Sstevel@tonic-gate bgu,a,pt %ncc, .dco_ns 2254*7c478bd9Sstevel@tonic-gate or %o0, %o1, %o3 2255*7c478bd9Sstevel@tonic-gate ! 2256*7c478bd9Sstevel@tonic-gate ! What was previously ".small_copyout" 2257*7c478bd9Sstevel@tonic-gate ! Do full differenced copy. 2258*7c478bd9Sstevel@tonic-gate ! 2259*7c478bd9Sstevel@tonic-gate.dcobcp: 2260*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 ! negate count 2261*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 ! make %o0 point at the end 2262*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 ! make %o1 point at the end 2263*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcocl 2264*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o3], %o4 ! load first byte 2265*7c478bd9Sstevel@tonic-gate ! 2266*7c478bd9Sstevel@tonic-gate ! %o0 and %o2 point at the end and remain pointing at the end 2267*7c478bd9Sstevel@tonic-gate ! of their buffers. We pull things out by adding %o3 (which is 2268*7c478bd9Sstevel@tonic-gate ! the negation of the length) to the buffer end which gives us 2269*7c478bd9Sstevel@tonic-gate ! the curent location in the buffers. By incrementing %o3 we walk 2270*7c478bd9Sstevel@tonic-gate ! through both buffers without having to bump each buffer's 2271*7c478bd9Sstevel@tonic-gate ! pointer. A very fast 4 instruction loop. 2272*7c478bd9Sstevel@tonic-gate ! 2273*7c478bd9Sstevel@tonic-gate .align 16 2274*7c478bd9Sstevel@tonic-gate.dcocl: 2275*7c478bd9Sstevel@tonic-gate stba %o4, [%o1 + %o3]ASI_USER 2276*7c478bd9Sstevel@tonic-gate inccc %o3 2277*7c478bd9Sstevel@tonic-gate bl,a,pt %ncc, .dcocl 2278*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o3], %o4 2279*7c478bd9Sstevel@tonic-gate ! 2280*7c478bd9Sstevel@tonic-gate ! We're done. Go home. 2281*7c478bd9Sstevel@tonic-gate ! 2282*7c478bd9Sstevel@tonic-gate membar #Sync 2283*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] 2284*7c478bd9Sstevel@tonic-gate retl 2285*7c478bd9Sstevel@tonic-gate clr %o0 2286*7c478bd9Sstevel@tonic-gate ! 2287*7c478bd9Sstevel@tonic-gate ! Try aligned copies from here. 2288*7c478bd9Sstevel@tonic-gate ! 2289*7c478bd9Sstevel@tonic-gate.dco_ns: 2290*7c478bd9Sstevel@tonic-gate ! %o0 = kernel addr (to be copied from) 2291*7c478bd9Sstevel@tonic-gate ! %o1 = user addr (to be copied to) 2292*7c478bd9Sstevel@tonic-gate ! %o2 = length 2293*7c478bd9Sstevel@tonic-gate ! %o3 = %o1 | %o2 (used for alignment checking) 2294*7c478bd9Sstevel@tonic-gate ! %o4 is alternate lo_fault 2295*7c478bd9Sstevel@tonic-gate ! %o5 is original lo_fault 2296*7c478bd9Sstevel@tonic-gate ! 2297*7c478bd9Sstevel@tonic-gate ! See if we're single byte aligned. If we are, check the 2298*7c478bd9Sstevel@tonic-gate ! limit for single byte copies. If we're smaller or equal, 2299*7c478bd9Sstevel@tonic-gate ! bounce to the byte for byte copy loop. Otherwise do it in 2300*7c478bd9Sstevel@tonic-gate ! HW (if enabled). 2301*7c478bd9Sstevel@tonic-gate ! 2302*7c478bd9Sstevel@tonic-gate btst 1, %o3 2303*7c478bd9Sstevel@tonic-gate bz,pt %icc, .dcoh8 2304*7c478bd9Sstevel@tonic-gate btst 7, %o3 2305*7c478bd9Sstevel@tonic-gate ! 2306*7c478bd9Sstevel@tonic-gate ! Single byte aligned. Do we do it via HW or via 2307*7c478bd9Sstevel@tonic-gate ! byte for byte? Do a quick no memory reference 2308*7c478bd9Sstevel@tonic-gate ! check to pick up small copies. 2309*7c478bd9Sstevel@tonic-gate ! 2310*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 2311*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcobcp 2312*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_1), %o3 2313*7c478bd9Sstevel@tonic-gate ! 2314*7c478bd9Sstevel@tonic-gate ! Big enough that we need to check the HW limit for 2315*7c478bd9Sstevel@tonic-gate ! this size copy. 2316*7c478bd9Sstevel@tonic-gate ! 2317*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_1)], %o3 2318*7c478bd9Sstevel@tonic-gate ! 2319*7c478bd9Sstevel@tonic-gate ! Is HW copy on? If not, do everything byte for byte. 2320*7c478bd9Sstevel@tonic-gate ! 2321*7c478bd9Sstevel@tonic-gate tst %o3 2322*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcobcp 2323*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 2324*7c478bd9Sstevel@tonic-gate ! 2325*7c478bd9Sstevel@tonic-gate ! If we're less than or equal to the single byte copy limit, 2326*7c478bd9Sstevel@tonic-gate ! bop to the copy loop. 2327*7c478bd9Sstevel@tonic-gate ! 2328*7c478bd9Sstevel@tonic-gate bge,pt %ncc, .dcobcp 2329*7c478bd9Sstevel@tonic-gate nop 2330*7c478bd9Sstevel@tonic-gate ! 2331*7c478bd9Sstevel@tonic-gate ! We're big enough and copy is on. Do it with HW. 2332*7c478bd9Sstevel@tonic-gate ! 2333*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyout 2334*7c478bd9Sstevel@tonic-gate nop 2335*7c478bd9Sstevel@tonic-gate.dcoh8: 2336*7c478bd9Sstevel@tonic-gate ! 2337*7c478bd9Sstevel@tonic-gate ! 8 byte aligned? 2338*7c478bd9Sstevel@tonic-gate ! 2339*7c478bd9Sstevel@tonic-gate bnz,a %ncc, .dcoh4 2340*7c478bd9Sstevel@tonic-gate btst 3, %o3 2341*7c478bd9Sstevel@tonic-gate ! 2342*7c478bd9Sstevel@tonic-gate ! See if we're in the "small range". 2343*7c478bd9Sstevel@tonic-gate ! If so, go off and do the copy. 2344*7c478bd9Sstevel@tonic-gate ! If not, load the hard limit. %o3 is 2345*7c478bd9Sstevel@tonic-gate ! available for reuse. 2346*7c478bd9Sstevel@tonic-gate ! 2347*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 2348*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcos8 2349*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_8), %o3 2350*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_8)], %o3 2351*7c478bd9Sstevel@tonic-gate ! 2352*7c478bd9Sstevel@tonic-gate ! If it's zero, there's no HW bcopy. 2353*7c478bd9Sstevel@tonic-gate ! Bop off to the aligned copy. 2354*7c478bd9Sstevel@tonic-gate ! 2355*7c478bd9Sstevel@tonic-gate tst %o3 2356*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcos8 2357*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 2358*7c478bd9Sstevel@tonic-gate ! 2359*7c478bd9Sstevel@tonic-gate ! We're negative if our size is larger than hw_copy_limit_8. 2360*7c478bd9Sstevel@tonic-gate ! 2361*7c478bd9Sstevel@tonic-gate bge,pt %ncc, .dcos8 2362*7c478bd9Sstevel@tonic-gate nop 2363*7c478bd9Sstevel@tonic-gate ! 2364*7c478bd9Sstevel@tonic-gate ! HW assist is on and we're large enough. Do it. 2365*7c478bd9Sstevel@tonic-gate ! 2366*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyout 2367*7c478bd9Sstevel@tonic-gate nop 2368*7c478bd9Sstevel@tonic-gate.dcos8: 2369*7c478bd9Sstevel@tonic-gate ! 2370*7c478bd9Sstevel@tonic-gate ! Housekeeping for copy loops. Uses same idea as in the byte for 2371*7c478bd9Sstevel@tonic-gate ! byte copy loop above. 2372*7c478bd9Sstevel@tonic-gate ! 2373*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 2374*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 2375*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 2376*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dodebc 2377*7c478bd9Sstevel@tonic-gate srl %o2, 3, %o2 ! Number of 8 byte chunks to copy 2378*7c478bd9Sstevel@tonic-gate ! 2379*7c478bd9Sstevel@tonic-gate ! 4 byte aligned? 2380*7c478bd9Sstevel@tonic-gate ! 2381*7c478bd9Sstevel@tonic-gate.dcoh4: 2382*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, .dcoh2 2383*7c478bd9Sstevel@tonic-gate ! 2384*7c478bd9Sstevel@tonic-gate ! See if we're in the "small range". 2385*7c478bd9Sstevel@tonic-gate ! If so, go off an do the copy. 2386*7c478bd9Sstevel@tonic-gate ! If not, load the hard limit. %o3 is 2387*7c478bd9Sstevel@tonic-gate ! available for reuse. 2388*7c478bd9Sstevel@tonic-gate ! 2389*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 2390*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcos4 2391*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_4), %o3 2392*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_4)], %o3 2393*7c478bd9Sstevel@tonic-gate ! 2394*7c478bd9Sstevel@tonic-gate ! If it's zero, there's no HW bcopy. 2395*7c478bd9Sstevel@tonic-gate ! Bop off to the aligned copy. 2396*7c478bd9Sstevel@tonic-gate ! 2397*7c478bd9Sstevel@tonic-gate tst %o3 2398*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcos4 2399*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 2400*7c478bd9Sstevel@tonic-gate ! 2401*7c478bd9Sstevel@tonic-gate ! We're negative if our size is larger than hw_copy_limit_4. 2402*7c478bd9Sstevel@tonic-gate ! 2403*7c478bd9Sstevel@tonic-gate bge,pt %ncc, .dcos4 2404*7c478bd9Sstevel@tonic-gate nop 2405*7c478bd9Sstevel@tonic-gate ! 2406*7c478bd9Sstevel@tonic-gate ! HW assist is on and we're large enough. Do it. 2407*7c478bd9Sstevel@tonic-gate ! 2408*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyout 2409*7c478bd9Sstevel@tonic-gate nop 2410*7c478bd9Sstevel@tonic-gate.dcos4: 2411*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 2412*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 2413*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 2414*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dodfbc 2415*7c478bd9Sstevel@tonic-gate srl %o2, 2, %o2 ! Number of 4 byte chunks to copy 2416*7c478bd9Sstevel@tonic-gate ! 2417*7c478bd9Sstevel@tonic-gate ! We must be 2 byte aligned. Off we go. 2418*7c478bd9Sstevel@tonic-gate ! The check for small copies was done in the 2419*7c478bd9Sstevel@tonic-gate ! delay at .dcoh4 2420*7c478bd9Sstevel@tonic-gate ! 2421*7c478bd9Sstevel@tonic-gate.dcoh2: 2422*7c478bd9Sstevel@tonic-gate ble %ncc, .dcos2 2423*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_2), %o3 2424*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_2)], %o3 2425*7c478bd9Sstevel@tonic-gate tst %o3 2426*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcos2 2427*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 2428*7c478bd9Sstevel@tonic-gate bge,pt %ncc, .dcos2 2429*7c478bd9Sstevel@tonic-gate nop 2430*7c478bd9Sstevel@tonic-gate ! 2431*7c478bd9Sstevel@tonic-gate ! HW is on and we're big enough. Do it. 2432*7c478bd9Sstevel@tonic-gate ! 2433*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyout 2434*7c478bd9Sstevel@tonic-gate nop 2435*7c478bd9Sstevel@tonic-gate.dcos2: 2436*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 2437*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 2438*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 2439*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dodtbc 2440*7c478bd9Sstevel@tonic-gate srl %o2, 1, %o2 ! Number of 2 byte chunks to copy 2441*7c478bd9Sstevel@tonic-gate.small_copyout: 2442*7c478bd9Sstevel@tonic-gate ! 2443*7c478bd9Sstevel@tonic-gate ! Why are we doing this AGAIN? There are certain conditions in 2444*7c478bd9Sstevel@tonic-gate ! big_copyout that will cause us to forego the HW assisted copies 2445*7c478bd9Sstevel@tonic-gate ! and bounce back to a non-HW assisted copy. This dispatches those 2446*7c478bd9Sstevel@tonic-gate ! copies. Note that we branch around this in the main line code. 2447*7c478bd9Sstevel@tonic-gate ! 2448*7c478bd9Sstevel@tonic-gate ! We make no check for limits or HW enablement here. We've 2449*7c478bd9Sstevel@tonic-gate ! already been told that we're a poster child so just go off 2450*7c478bd9Sstevel@tonic-gate ! and do it. 2451*7c478bd9Sstevel@tonic-gate ! 2452*7c478bd9Sstevel@tonic-gate or %o0, %o1, %o3 2453*7c478bd9Sstevel@tonic-gate btst 1, %o3 2454*7c478bd9Sstevel@tonic-gate bnz %icc, .dcobcp ! Most likely 2455*7c478bd9Sstevel@tonic-gate btst 7, %o3 2456*7c478bd9Sstevel@tonic-gate bz %icc, .dcos8 2457*7c478bd9Sstevel@tonic-gate btst 3, %o3 2458*7c478bd9Sstevel@tonic-gate bz %icc, .dcos4 2459*7c478bd9Sstevel@tonic-gate nop 2460*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcos2 2461*7c478bd9Sstevel@tonic-gate nop 2462*7c478bd9Sstevel@tonic-gate .align 32 2463*7c478bd9Sstevel@tonic-gate.dodebc: 2464*7c478bd9Sstevel@tonic-gate ldx [%o0 + %o3], %o4 2465*7c478bd9Sstevel@tonic-gate deccc %o2 2466*7c478bd9Sstevel@tonic-gate stxa %o4, [%o1 + %o3]ASI_USER 2467*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .dodebc 2468*7c478bd9Sstevel@tonic-gate addcc %o3, 8, %o3 2469*7c478bd9Sstevel@tonic-gate ! 2470*7c478bd9Sstevel@tonic-gate ! End of copy loop. Check to see if we're done. Most 2471*7c478bd9Sstevel@tonic-gate ! eight byte aligned copies end here. 2472*7c478bd9Sstevel@tonic-gate ! 2473*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcofh 2474*7c478bd9Sstevel@tonic-gate nop 2475*7c478bd9Sstevel@tonic-gate ! 2476*7c478bd9Sstevel@tonic-gate ! Something is left - do it byte for byte. 2477*7c478bd9Sstevel@tonic-gate ! 2478*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcocl 2479*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o3], %o4 ! load next byte 2480*7c478bd9Sstevel@tonic-gate ! 2481*7c478bd9Sstevel@tonic-gate ! Four byte copy loop. %o2 is the number of 4 byte chunks to copy. 2482*7c478bd9Sstevel@tonic-gate ! 2483*7c478bd9Sstevel@tonic-gate .align 32 2484*7c478bd9Sstevel@tonic-gate.dodfbc: 2485*7c478bd9Sstevel@tonic-gate lduw [%o0 + %o3], %o4 2486*7c478bd9Sstevel@tonic-gate deccc %o2 2487*7c478bd9Sstevel@tonic-gate sta %o4, [%o1 + %o3]ASI_USER 2488*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .dodfbc 2489*7c478bd9Sstevel@tonic-gate addcc %o3, 4, %o3 2490*7c478bd9Sstevel@tonic-gate ! 2491*7c478bd9Sstevel@tonic-gate ! End of copy loop. Check to see if we're done. Most 2492*7c478bd9Sstevel@tonic-gate ! four byte aligned copies end here. 2493*7c478bd9Sstevel@tonic-gate ! 2494*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcofh 2495*7c478bd9Sstevel@tonic-gate nop 2496*7c478bd9Sstevel@tonic-gate ! 2497*7c478bd9Sstevel@tonic-gate ! Something is left. Do it byte for byte. 2498*7c478bd9Sstevel@tonic-gate ! 2499*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcocl 2500*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o3], %o4 ! load next byte 2501*7c478bd9Sstevel@tonic-gate ! 2502*7c478bd9Sstevel@tonic-gate ! two byte aligned copy loop. %o2 is the number of 2 byte chunks to 2503*7c478bd9Sstevel@tonic-gate ! copy. 2504*7c478bd9Sstevel@tonic-gate ! 2505*7c478bd9Sstevel@tonic-gate .align 32 2506*7c478bd9Sstevel@tonic-gate.dodtbc: 2507*7c478bd9Sstevel@tonic-gate lduh [%o0 + %o3], %o4 2508*7c478bd9Sstevel@tonic-gate deccc %o2 2509*7c478bd9Sstevel@tonic-gate stha %o4, [%o1 + %o3]ASI_USER 2510*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .dodtbc 2511*7c478bd9Sstevel@tonic-gate addcc %o3, 2, %o3 2512*7c478bd9Sstevel@tonic-gate ! 2513*7c478bd9Sstevel@tonic-gate ! End of copy loop. Anything left? 2514*7c478bd9Sstevel@tonic-gate ! 2515*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcofh 2516*7c478bd9Sstevel@tonic-gate nop 2517*7c478bd9Sstevel@tonic-gate ! 2518*7c478bd9Sstevel@tonic-gate ! Deal with the last byte 2519*7c478bd9Sstevel@tonic-gate ! 2520*7c478bd9Sstevel@tonic-gate ldub [%o0 + %o3], %o4 2521*7c478bd9Sstevel@tonic-gate stba %o4, [%o1 + %o3]ASI_USER 2522*7c478bd9Sstevel@tonic-gate.dcofh: 2523*7c478bd9Sstevel@tonic-gate membar #Sync 2524*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 2525*7c478bd9Sstevel@tonic-gate retl 2526*7c478bd9Sstevel@tonic-gate clr %o0 2527*7c478bd9Sstevel@tonic-gate 2528*7c478bd9Sstevel@tonic-gate.big_copyout: 2529*7c478bd9Sstevel@tonic-gate ! 2530*7c478bd9Sstevel@tonic-gate ! Are we using the FP registers? 2531*7c478bd9Sstevel@tonic-gate ! 2532*7c478bd9Sstevel@tonic-gate rd %fprs, %o3 ! check for unused fp 2533*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 2534*7c478bd9Sstevel@tonic-gate bnz %icc, .copyout_fpregs_inuse 2535*7c478bd9Sstevel@tonic-gate nop 2536*7c478bd9Sstevel@tonic-gate ! 2537*7c478bd9Sstevel@tonic-gate ! We're going to go off and do a block copy. 2538*7c478bd9Sstevel@tonic-gate ! Switch fault hendlers and grab a window. We 2539*7c478bd9Sstevel@tonic-gate ! don't do a membar #Sync since we've done only 2540*7c478bd9Sstevel@tonic-gate ! kernel data to this point. 2541*7c478bd9Sstevel@tonic-gate ! 2542*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 2543*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 2544*7c478bd9Sstevel@tonic-gate ! 2545*7c478bd9Sstevel@tonic-gate ! %o3 is now %i3. Save original %fprs. 2546*7c478bd9Sstevel@tonic-gate ! 2547*7c478bd9Sstevel@tonic-gate st %i3, [%fp + STACK_BIAS - SAVED_FPRS_OFFSET] 2548*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .do_block_copyout ! Not in use. Go off and do it. 2549*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs ! clear %fprs 2550*7c478bd9Sstevel@tonic-gate ! 2551*7c478bd9Sstevel@tonic-gate.copyout_fpregs_inuse: 2552*7c478bd9Sstevel@tonic-gate ! 2553*7c478bd9Sstevel@tonic-gate ! We're here if the FP regs are in use. Need to see if the request 2554*7c478bd9Sstevel@tonic-gate ! exceeds our suddenly larger minimum. 2555*7c478bd9Sstevel@tonic-gate ! 2556*7c478bd9Sstevel@tonic-gate cmp %i2, VIS_COPY_THRESHOLD+(64*4) ! for large counts (larger 2557*7c478bd9Sstevel@tonic-gate bl %ncc, .small_copyout 2558*7c478bd9Sstevel@tonic-gate nop 2559*7c478bd9Sstevel@tonic-gate ! 2560*7c478bd9Sstevel@tonic-gate ! We're going to go off and do a block copy. 2561*7c478bd9Sstevel@tonic-gate ! Change to the heavy duty fault handler and grab a window first. 2562*7c478bd9Sstevel@tonic-gate ! 2563*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 2564*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 2565*7c478bd9Sstevel@tonic-gate st %i3, [%fp + STACK_BIAS - SAVED_FPRS_OFFSET] 2566*7c478bd9Sstevel@tonic-gate ! 2567*7c478bd9Sstevel@tonic-gate ! save in-use fpregs on stack 2568*7c478bd9Sstevel@tonic-gate ! 2569*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 2570*7c478bd9Sstevel@tonic-gate membar #Sync 2571*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 2572*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 2573*7c478bd9Sstevel@tonic-gate stda %d0, [%o2]ASI_BLK_P 2574*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2575*7c478bd9Sstevel@tonic-gate stda %d16, [%o2]ASI_BLK_P 2576*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2577*7c478bd9Sstevel@tonic-gate stda %d32, [%o2]ASI_BLK_P 2578*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 2579*7c478bd9Sstevel@tonic-gate stda %d48, [%o2]ASI_BLK_P 2580*7c478bd9Sstevel@tonic-gate membar #Sync 2581*7c478bd9Sstevel@tonic-gate 2582*7c478bd9Sstevel@tonic-gate.do_block_copyout: 2583*7c478bd9Sstevel@tonic-gate membar #StoreStore|#StoreLoad|#LoadStore 2584*7c478bd9Sstevel@tonic-gate 2585*7c478bd9Sstevel@tonic-gate rd %gsr, %o2 2586*7c478bd9Sstevel@tonic-gate st %o2, [%fp + STACK_BIAS - SAVED_GSR_OFFSET] ! save gsr 2587*7c478bd9Sstevel@tonic-gate 2588*7c478bd9Sstevel@tonic-gate ! Set the lower bit in the saved t_lofault to indicate 2589*7c478bd9Sstevel@tonic-gate ! that we need to clear the %fprs register on the way 2590*7c478bd9Sstevel@tonic-gate ! out 2591*7c478bd9Sstevel@tonic-gate or SAVED_LOFAULT, FPUSED_FLAG, SAVED_LOFAULT 2592*7c478bd9Sstevel@tonic-gate 2593*7c478bd9Sstevel@tonic-gate ! Swap src/dst since the code below is memcpy code 2594*7c478bd9Sstevel@tonic-gate ! and memcpy/bcopy have different calling sequences 2595*7c478bd9Sstevel@tonic-gate mov %i1, %i5 2596*7c478bd9Sstevel@tonic-gate mov %i0, %i1 2597*7c478bd9Sstevel@tonic-gate mov %i5, %i0 2598*7c478bd9Sstevel@tonic-gate 2599*7c478bd9Sstevel@tonic-gate!!! This code is nearly identical to the version in the sun4u 2600*7c478bd9Sstevel@tonic-gate!!! libc_psr. Most bugfixes made to that file should be 2601*7c478bd9Sstevel@tonic-gate!!! merged into this routine. 2602*7c478bd9Sstevel@tonic-gate 2603*7c478bd9Sstevel@tonic-gate andcc %i0, 7, %o3 2604*7c478bd9Sstevel@tonic-gate bz %ncc, copyout_blkcpy 2605*7c478bd9Sstevel@tonic-gate sub %o3, 8, %o3 2606*7c478bd9Sstevel@tonic-gate neg %o3 2607*7c478bd9Sstevel@tonic-gate sub %i2, %o3, %i2 2608*7c478bd9Sstevel@tonic-gate 2609*7c478bd9Sstevel@tonic-gate ! Align Destination on double-word boundary 2610*7c478bd9Sstevel@tonic-gate 2611*7c478bd9Sstevel@tonic-gate2: ldub [%i1], %o4 2612*7c478bd9Sstevel@tonic-gate inc %i1 2613*7c478bd9Sstevel@tonic-gate stba %o4, [%i0]ASI_USER 2614*7c478bd9Sstevel@tonic-gate deccc %o3 2615*7c478bd9Sstevel@tonic-gate bgu %ncc, 2b 2616*7c478bd9Sstevel@tonic-gate inc %i0 2617*7c478bd9Sstevel@tonic-gatecopyout_blkcpy: 2618*7c478bd9Sstevel@tonic-gate andcc %i0, 63, %i3 2619*7c478bd9Sstevel@tonic-gate bz,pn %ncc, copyout_blalign ! now block aligned 2620*7c478bd9Sstevel@tonic-gate sub %i3, 64, %i3 2621*7c478bd9Sstevel@tonic-gate neg %i3 ! bytes till block aligned 2622*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 ! update %i2 with new count 2623*7c478bd9Sstevel@tonic-gate 2624*7c478bd9Sstevel@tonic-gate ! Copy %i3 bytes till dst is block (64 byte) aligned. use 2625*7c478bd9Sstevel@tonic-gate ! double word copies. 2626*7c478bd9Sstevel@tonic-gate 2627*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g1 2628*7c478bd9Sstevel@tonic-gate ldd [%g1], %d0 2629*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 2630*7c478bd9Sstevel@tonic-gate6: 2631*7c478bd9Sstevel@tonic-gate ldd [%g1], %d2 2632*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 2633*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 2634*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 2635*7c478bd9Sstevel@tonic-gate stda %d8, [%i0]ASI_USER 2636*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 2637*7c478bd9Sstevel@tonic-gate bz,pn %ncc, copyout_blalign 2638*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 2639*7c478bd9Sstevel@tonic-gate ldd [%g1], %d0 2640*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 2641*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 2642*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 2643*7c478bd9Sstevel@tonic-gate stda %d8, [%i0]ASI_USER 2644*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 2645*7c478bd9Sstevel@tonic-gate bgu,pn %ncc, 6b 2646*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 2647*7c478bd9Sstevel@tonic-gate 2648*7c478bd9Sstevel@tonic-gatecopyout_blalign: 2649*7c478bd9Sstevel@tonic-gate membar #StoreLoad 2650*7c478bd9Sstevel@tonic-gate ! %i2 = total length 2651*7c478bd9Sstevel@tonic-gate ! %i3 = blocks (length - 64) / 64 2652*7c478bd9Sstevel@tonic-gate ! %i4 = doubles remaining (length - blocks) 2653*7c478bd9Sstevel@tonic-gate sub %i2, 64, %i3 2654*7c478bd9Sstevel@tonic-gate andn %i3, 63, %i3 2655*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i4 2656*7c478bd9Sstevel@tonic-gate andn %i4, 7, %i4 2657*7c478bd9Sstevel@tonic-gate sub %i4, 16, %i4 2658*7c478bd9Sstevel@tonic-gate sub %i2, %i4, %i2 2659*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 2660*7c478bd9Sstevel@tonic-gate 2661*7c478bd9Sstevel@tonic-gate andn %i1, 0x3f, %l7 ! blk aligned address 2662*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g0 ! gen %gsr 2663*7c478bd9Sstevel@tonic-gate 2664*7c478bd9Sstevel@tonic-gate srl %i1, 3, %l5 ! bits 3,4,5 are now least sig in %l5 2665*7c478bd9Sstevel@tonic-gate andcc %l5, 7, %i5 ! mask everything except bits 1,2 3 2666*7c478bd9Sstevel@tonic-gate add %i1, %i4, %i1 2667*7c478bd9Sstevel@tonic-gate add %i1, %i3, %i1 2668*7c478bd9Sstevel@tonic-gate 2669*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2670*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2671*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2672*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2673*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2674*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2675*7c478bd9Sstevel@tonic-gate sub %i3, 128, %i3 2676*7c478bd9Sstevel@tonic-gate 2677*7c478bd9Sstevel@tonic-gate ! switch statement to get us to the right 8 byte blk within a 2678*7c478bd9Sstevel@tonic-gate ! 64 byte block 2679*7c478bd9Sstevel@tonic-gate 2680*7c478bd9Sstevel@tonic-gate cmp %i5, 4 2681*7c478bd9Sstevel@tonic-gate bgeu,a copyout_hlf 2682*7c478bd9Sstevel@tonic-gate cmp %i5, 6 2683*7c478bd9Sstevel@tonic-gate cmp %i5, 2 2684*7c478bd9Sstevel@tonic-gate bgeu,a copyout_sqtr 2685*7c478bd9Sstevel@tonic-gate nop 2686*7c478bd9Sstevel@tonic-gate cmp %i5, 1 2687*7c478bd9Sstevel@tonic-gate be,a copyout_seg1 2688*7c478bd9Sstevel@tonic-gate nop 2689*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_seg0 2690*7c478bd9Sstevel@tonic-gate nop 2691*7c478bd9Sstevel@tonic-gatecopyout_sqtr: 2692*7c478bd9Sstevel@tonic-gate be,a copyout_seg2 2693*7c478bd9Sstevel@tonic-gate nop 2694*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_seg3 2695*7c478bd9Sstevel@tonic-gate nop 2696*7c478bd9Sstevel@tonic-gate 2697*7c478bd9Sstevel@tonic-gatecopyout_hlf: 2698*7c478bd9Sstevel@tonic-gate bgeu,a copyout_fqtr 2699*7c478bd9Sstevel@tonic-gate nop 2700*7c478bd9Sstevel@tonic-gate cmp %i5, 5 2701*7c478bd9Sstevel@tonic-gate be,a copyout_seg5 2702*7c478bd9Sstevel@tonic-gate nop 2703*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_seg4 2704*7c478bd9Sstevel@tonic-gate nop 2705*7c478bd9Sstevel@tonic-gatecopyout_fqtr: 2706*7c478bd9Sstevel@tonic-gate be,a copyout_seg6 2707*7c478bd9Sstevel@tonic-gate nop 2708*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_seg7 2709*7c478bd9Sstevel@tonic-gate nop 2710*7c478bd9Sstevel@tonic-gate 2711*7c478bd9Sstevel@tonic-gatecopyout_seg0: 2712*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2713*7c478bd9Sstevel@tonic-gate FALIGN_D0 2714*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2715*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2716*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2717*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2718*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 2719*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2720*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 2721*7c478bd9Sstevel@tonic-gate FALIGN_D16 2722*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2723*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2724*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2725*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2726*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 2727*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2728*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 2729*7c478bd9Sstevel@tonic-gate FALIGN_D32 2730*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2731*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2732*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2733*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2734*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 2735*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2736*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg0 2737*7c478bd9Sstevel@tonic-gate 2738*7c478bd9Sstevel@tonic-gate0: 2739*7c478bd9Sstevel@tonic-gate FALIGN_D16 2740*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2741*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2742*7c478bd9Sstevel@tonic-gate membar #Sync 2743*7c478bd9Sstevel@tonic-gate FALIGN_D32 2744*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2745*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd0 2746*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2747*7c478bd9Sstevel@tonic-gate 2748*7c478bd9Sstevel@tonic-gate1: 2749*7c478bd9Sstevel@tonic-gate FALIGN_D32 2750*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2751*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2752*7c478bd9Sstevel@tonic-gate membar #Sync 2753*7c478bd9Sstevel@tonic-gate FALIGN_D0 2754*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2755*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd16 2756*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2757*7c478bd9Sstevel@tonic-gate 2758*7c478bd9Sstevel@tonic-gate2: 2759*7c478bd9Sstevel@tonic-gate FALIGN_D0 2760*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2761*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2762*7c478bd9Sstevel@tonic-gate membar #Sync 2763*7c478bd9Sstevel@tonic-gate FALIGN_D16 2764*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2765*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd32 2766*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2767*7c478bd9Sstevel@tonic-gate 2768*7c478bd9Sstevel@tonic-gatecopyout_seg1: 2769*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2770*7c478bd9Sstevel@tonic-gate FALIGN_D2 2771*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2772*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2773*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2774*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2775*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 2776*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2777*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 2778*7c478bd9Sstevel@tonic-gate FALIGN_D18 2779*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2780*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2781*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2782*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2783*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 2784*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2785*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 2786*7c478bd9Sstevel@tonic-gate FALIGN_D34 2787*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2788*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2789*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2790*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2791*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 2792*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2793*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg1 2794*7c478bd9Sstevel@tonic-gate0: 2795*7c478bd9Sstevel@tonic-gate FALIGN_D18 2796*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2797*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2798*7c478bd9Sstevel@tonic-gate membar #Sync 2799*7c478bd9Sstevel@tonic-gate FALIGN_D34 2800*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2801*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd2 2802*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2803*7c478bd9Sstevel@tonic-gate 2804*7c478bd9Sstevel@tonic-gate1: 2805*7c478bd9Sstevel@tonic-gate FALIGN_D34 2806*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2807*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2808*7c478bd9Sstevel@tonic-gate membar #Sync 2809*7c478bd9Sstevel@tonic-gate FALIGN_D2 2810*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2811*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd18 2812*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2813*7c478bd9Sstevel@tonic-gate 2814*7c478bd9Sstevel@tonic-gate2: 2815*7c478bd9Sstevel@tonic-gate FALIGN_D2 2816*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2817*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2818*7c478bd9Sstevel@tonic-gate membar #Sync 2819*7c478bd9Sstevel@tonic-gate FALIGN_D18 2820*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2821*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd34 2822*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2823*7c478bd9Sstevel@tonic-gate 2824*7c478bd9Sstevel@tonic-gatecopyout_seg2: 2825*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2826*7c478bd9Sstevel@tonic-gate FALIGN_D4 2827*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2828*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2829*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2830*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2831*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 2832*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2833*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 2834*7c478bd9Sstevel@tonic-gate FALIGN_D20 2835*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2836*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2837*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2838*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2839*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 2840*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2841*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 2842*7c478bd9Sstevel@tonic-gate FALIGN_D36 2843*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2844*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2845*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2846*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2847*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 2848*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2849*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg2 2850*7c478bd9Sstevel@tonic-gate 2851*7c478bd9Sstevel@tonic-gate0: 2852*7c478bd9Sstevel@tonic-gate FALIGN_D20 2853*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2854*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2855*7c478bd9Sstevel@tonic-gate membar #Sync 2856*7c478bd9Sstevel@tonic-gate FALIGN_D36 2857*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2858*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd4 2859*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2860*7c478bd9Sstevel@tonic-gate 2861*7c478bd9Sstevel@tonic-gate1: 2862*7c478bd9Sstevel@tonic-gate FALIGN_D36 2863*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2864*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2865*7c478bd9Sstevel@tonic-gate membar #Sync 2866*7c478bd9Sstevel@tonic-gate FALIGN_D4 2867*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2868*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd20 2869*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2870*7c478bd9Sstevel@tonic-gate 2871*7c478bd9Sstevel@tonic-gate2: 2872*7c478bd9Sstevel@tonic-gate FALIGN_D4 2873*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2874*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2875*7c478bd9Sstevel@tonic-gate membar #Sync 2876*7c478bd9Sstevel@tonic-gate FALIGN_D20 2877*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2878*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd36 2879*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2880*7c478bd9Sstevel@tonic-gate 2881*7c478bd9Sstevel@tonic-gatecopyout_seg3: 2882*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2883*7c478bd9Sstevel@tonic-gate FALIGN_D6 2884*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2885*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2886*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2887*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2888*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 2889*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2890*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 2891*7c478bd9Sstevel@tonic-gate FALIGN_D22 2892*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2893*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2894*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2895*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2896*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 2897*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2898*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 2899*7c478bd9Sstevel@tonic-gate FALIGN_D38 2900*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2901*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2902*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2903*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2904*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 2905*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2906*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg3 2907*7c478bd9Sstevel@tonic-gate 2908*7c478bd9Sstevel@tonic-gate0: 2909*7c478bd9Sstevel@tonic-gate FALIGN_D22 2910*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2911*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2912*7c478bd9Sstevel@tonic-gate membar #Sync 2913*7c478bd9Sstevel@tonic-gate FALIGN_D38 2914*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2915*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd6 2916*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2917*7c478bd9Sstevel@tonic-gate 2918*7c478bd9Sstevel@tonic-gate1: 2919*7c478bd9Sstevel@tonic-gate FALIGN_D38 2920*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2921*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2922*7c478bd9Sstevel@tonic-gate membar #Sync 2923*7c478bd9Sstevel@tonic-gate FALIGN_D6 2924*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2925*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd22 2926*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2927*7c478bd9Sstevel@tonic-gate 2928*7c478bd9Sstevel@tonic-gate2: 2929*7c478bd9Sstevel@tonic-gate FALIGN_D6 2930*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2931*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2932*7c478bd9Sstevel@tonic-gate membar #Sync 2933*7c478bd9Sstevel@tonic-gate FALIGN_D22 2934*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2935*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd38 2936*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2937*7c478bd9Sstevel@tonic-gate 2938*7c478bd9Sstevel@tonic-gatecopyout_seg4: 2939*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2940*7c478bd9Sstevel@tonic-gate FALIGN_D8 2941*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2942*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2943*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2944*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2945*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 2946*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2947*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 2948*7c478bd9Sstevel@tonic-gate FALIGN_D24 2949*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 2950*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2951*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2952*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2953*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 2954*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2955*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 2956*7c478bd9Sstevel@tonic-gate FALIGN_D40 2957*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 2958*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2959*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 2960*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 2961*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 2962*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2963*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg4 2964*7c478bd9Sstevel@tonic-gate 2965*7c478bd9Sstevel@tonic-gate0: 2966*7c478bd9Sstevel@tonic-gate FALIGN_D24 2967*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2968*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2969*7c478bd9Sstevel@tonic-gate membar #Sync 2970*7c478bd9Sstevel@tonic-gate FALIGN_D40 2971*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2972*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd8 2973*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2974*7c478bd9Sstevel@tonic-gate 2975*7c478bd9Sstevel@tonic-gate1: 2976*7c478bd9Sstevel@tonic-gate FALIGN_D40 2977*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2978*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2979*7c478bd9Sstevel@tonic-gate membar #Sync 2980*7c478bd9Sstevel@tonic-gate FALIGN_D8 2981*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2982*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd24 2983*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2984*7c478bd9Sstevel@tonic-gate 2985*7c478bd9Sstevel@tonic-gate2: 2986*7c478bd9Sstevel@tonic-gate FALIGN_D8 2987*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2988*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2989*7c478bd9Sstevel@tonic-gate membar #Sync 2990*7c478bd9Sstevel@tonic-gate FALIGN_D24 2991*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 2992*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd40 2993*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 2994*7c478bd9Sstevel@tonic-gate 2995*7c478bd9Sstevel@tonic-gatecopyout_seg5: 2996*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 2997*7c478bd9Sstevel@tonic-gate FALIGN_D10 2998*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 2999*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3000*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3001*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3002*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 3003*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3004*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 3005*7c478bd9Sstevel@tonic-gate FALIGN_D26 3006*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 3007*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3008*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3009*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3010*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 3011*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3012*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 3013*7c478bd9Sstevel@tonic-gate FALIGN_D42 3014*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 3015*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3016*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3017*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3018*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 3019*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3020*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg5 3021*7c478bd9Sstevel@tonic-gate 3022*7c478bd9Sstevel@tonic-gate0: 3023*7c478bd9Sstevel@tonic-gate FALIGN_D26 3024*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3025*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3026*7c478bd9Sstevel@tonic-gate membar #Sync 3027*7c478bd9Sstevel@tonic-gate FALIGN_D42 3028*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3029*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd10 3030*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3031*7c478bd9Sstevel@tonic-gate 3032*7c478bd9Sstevel@tonic-gate1: 3033*7c478bd9Sstevel@tonic-gate FALIGN_D42 3034*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3035*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3036*7c478bd9Sstevel@tonic-gate membar #Sync 3037*7c478bd9Sstevel@tonic-gate FALIGN_D10 3038*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3039*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd26 3040*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3041*7c478bd9Sstevel@tonic-gate 3042*7c478bd9Sstevel@tonic-gate2: 3043*7c478bd9Sstevel@tonic-gate FALIGN_D10 3044*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3045*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3046*7c478bd9Sstevel@tonic-gate membar #Sync 3047*7c478bd9Sstevel@tonic-gate FALIGN_D26 3048*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3049*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd42 3050*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3051*7c478bd9Sstevel@tonic-gate 3052*7c478bd9Sstevel@tonic-gatecopyout_seg6: 3053*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 3054*7c478bd9Sstevel@tonic-gate FALIGN_D12 3055*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 3056*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3057*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3058*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3059*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 3060*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3061*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 3062*7c478bd9Sstevel@tonic-gate FALIGN_D28 3063*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 3064*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3065*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3066*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3067*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 3068*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3069*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 3070*7c478bd9Sstevel@tonic-gate FALIGN_D44 3071*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 3072*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3073*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3074*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3075*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 3076*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3077*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg6 3078*7c478bd9Sstevel@tonic-gate 3079*7c478bd9Sstevel@tonic-gate0: 3080*7c478bd9Sstevel@tonic-gate FALIGN_D28 3081*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3082*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3083*7c478bd9Sstevel@tonic-gate membar #Sync 3084*7c478bd9Sstevel@tonic-gate FALIGN_D44 3085*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3086*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd12 3087*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3088*7c478bd9Sstevel@tonic-gate 3089*7c478bd9Sstevel@tonic-gate1: 3090*7c478bd9Sstevel@tonic-gate FALIGN_D44 3091*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3092*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3093*7c478bd9Sstevel@tonic-gate membar #Sync 3094*7c478bd9Sstevel@tonic-gate FALIGN_D12 3095*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3096*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd28 3097*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3098*7c478bd9Sstevel@tonic-gate 3099*7c478bd9Sstevel@tonic-gate2: 3100*7c478bd9Sstevel@tonic-gate FALIGN_D12 3101*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3102*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3103*7c478bd9Sstevel@tonic-gate membar #Sync 3104*7c478bd9Sstevel@tonic-gate FALIGN_D28 3105*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3106*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd44 3107*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3108*7c478bd9Sstevel@tonic-gate 3109*7c478bd9Sstevel@tonic-gatecopyout_seg7: 3110*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 3111*7c478bd9Sstevel@tonic-gate FALIGN_D14 3112*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d0 3113*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3114*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3115*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3116*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 3117*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3118*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 3119*7c478bd9Sstevel@tonic-gate FALIGN_D30 3120*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d16 3121*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3122*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3123*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3124*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 3125*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3126*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 3127*7c478bd9Sstevel@tonic-gate FALIGN_D46 3128*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_P, %d32 3129*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3130*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3131*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3132*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 3133*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3134*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_seg7 3135*7c478bd9Sstevel@tonic-gate 3136*7c478bd9Sstevel@tonic-gate0: 3137*7c478bd9Sstevel@tonic-gate FALIGN_D30 3138*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3139*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3140*7c478bd9Sstevel@tonic-gate membar #Sync 3141*7c478bd9Sstevel@tonic-gate FALIGN_D46 3142*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3143*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd14 3144*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3145*7c478bd9Sstevel@tonic-gate 3146*7c478bd9Sstevel@tonic-gate1: 3147*7c478bd9Sstevel@tonic-gate FALIGN_D46 3148*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3149*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3150*7c478bd9Sstevel@tonic-gate membar #Sync 3151*7c478bd9Sstevel@tonic-gate FALIGN_D14 3152*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3153*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd30 3154*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3155*7c478bd9Sstevel@tonic-gate 3156*7c478bd9Sstevel@tonic-gate2: 3157*7c478bd9Sstevel@tonic-gate FALIGN_D14 3158*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3159*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3160*7c478bd9Sstevel@tonic-gate membar #Sync 3161*7c478bd9Sstevel@tonic-gate FALIGN_D30 3162*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_AIUS 3163*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyout_blkd46 3164*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3165*7c478bd9Sstevel@tonic-gate 3166*7c478bd9Sstevel@tonic-gate 3167*7c478bd9Sstevel@tonic-gate ! 3168*7c478bd9Sstevel@tonic-gate ! dribble out the last partial block 3169*7c478bd9Sstevel@tonic-gate ! 3170*7c478bd9Sstevel@tonic-gatecopyout_blkd0: 3171*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3172*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3173*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d48 3174*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3175*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3176*7c478bd9Sstevel@tonic-gatecopyout_blkd2: 3177*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3178*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3179*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d48 3180*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3181*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3182*7c478bd9Sstevel@tonic-gatecopyout_blkd4: 3183*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3184*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3185*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d48 3186*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3187*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3188*7c478bd9Sstevel@tonic-gatecopyout_blkd6: 3189*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3190*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3191*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d48 3192*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3193*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3194*7c478bd9Sstevel@tonic-gatecopyout_blkd8: 3195*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3196*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3197*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d48 3198*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3199*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3200*7c478bd9Sstevel@tonic-gatecopyout_blkd10: 3201*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3202*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3203*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d48 3204*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3205*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3206*7c478bd9Sstevel@tonic-gatecopyout_blkd12: 3207*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3208*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3209*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d48 3210*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3211*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3212*7c478bd9Sstevel@tonic-gatecopyout_blkd14: 3213*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3214*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3215*7c478bd9Sstevel@tonic-gate fsrc1 %d14, %d0 3216*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_blkleft 3217*7c478bd9Sstevel@tonic-gate 3218*7c478bd9Sstevel@tonic-gatecopyout_blkd16: 3219*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3220*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3221*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d48 3222*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3223*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3224*7c478bd9Sstevel@tonic-gatecopyout_blkd18: 3225*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3226*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3227*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d48 3228*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3229*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3230*7c478bd9Sstevel@tonic-gatecopyout_blkd20: 3231*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3232*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3233*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d48 3234*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3235*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3236*7c478bd9Sstevel@tonic-gatecopyout_blkd22: 3237*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3238*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3239*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d48 3240*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3241*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3242*7c478bd9Sstevel@tonic-gatecopyout_blkd24: 3243*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3244*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3245*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d48 3246*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3247*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3248*7c478bd9Sstevel@tonic-gatecopyout_blkd26: 3249*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3250*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3251*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d48 3252*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3253*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3254*7c478bd9Sstevel@tonic-gatecopyout_blkd28: 3255*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3256*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3257*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d48 3258*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3259*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3260*7c478bd9Sstevel@tonic-gatecopyout_blkd30: 3261*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3262*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3263*7c478bd9Sstevel@tonic-gate fsrc1 %d30, %d0 3264*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyout_blkleft 3265*7c478bd9Sstevel@tonic-gatecopyout_blkd32: 3266*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3267*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3268*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d48 3269*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3270*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3271*7c478bd9Sstevel@tonic-gatecopyout_blkd34: 3272*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3273*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3274*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d48 3275*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3276*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3277*7c478bd9Sstevel@tonic-gatecopyout_blkd36: 3278*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3279*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3280*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d48 3281*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3282*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3283*7c478bd9Sstevel@tonic-gatecopyout_blkd38: 3284*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3285*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3286*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d48 3287*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3288*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3289*7c478bd9Sstevel@tonic-gatecopyout_blkd40: 3290*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3291*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3292*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d48 3293*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3294*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3295*7c478bd9Sstevel@tonic-gatecopyout_blkd42: 3296*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3297*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3298*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d48 3299*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3300*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3301*7c478bd9Sstevel@tonic-gatecopyout_blkd44: 3302*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3303*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3304*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d48 3305*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_USER 3306*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3307*7c478bd9Sstevel@tonic-gatecopyout_blkd46: 3308*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3309*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3310*7c478bd9Sstevel@tonic-gate fsrc1 %d46, %d0 3311*7c478bd9Sstevel@tonic-gate 3312*7c478bd9Sstevel@tonic-gatecopyout_blkleft: 3313*7c478bd9Sstevel@tonic-gate1: 3314*7c478bd9Sstevel@tonic-gate ldd [%l7], %d2 3315*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 3316*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3317*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 3318*7c478bd9Sstevel@tonic-gate stda %d8, [%i0]ASI_USER 3319*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyout_blkdone 3320*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3321*7c478bd9Sstevel@tonic-gate ldd [%l7], %d0 3322*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 3323*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 3324*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 3325*7c478bd9Sstevel@tonic-gate stda %d8, [%i0]ASI_USER 3326*7c478bd9Sstevel@tonic-gate bgeu,pt %ncc, 1b 3327*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3328*7c478bd9Sstevel@tonic-gate 3329*7c478bd9Sstevel@tonic-gatecopyout_blkdone: 3330*7c478bd9Sstevel@tonic-gate tst %i2 3331*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .copyout_exit 3332*7c478bd9Sstevel@tonic-gate and %l3, 0x4, %l3 ! fprs.du = fprs.dl = 0 3333*7c478bd9Sstevel@tonic-gate 3334*7c478bd9Sstevel@tonic-gate7: ldub [%i1], %i4 3335*7c478bd9Sstevel@tonic-gate inc %i1 3336*7c478bd9Sstevel@tonic-gate stba %i4, [%i0]ASI_USER 3337*7c478bd9Sstevel@tonic-gate inc %i0 3338*7c478bd9Sstevel@tonic-gate deccc %i2 3339*7c478bd9Sstevel@tonic-gate bgu %ncc, 7b 3340*7c478bd9Sstevel@tonic-gate nop 3341*7c478bd9Sstevel@tonic-gate 3342*7c478bd9Sstevel@tonic-gate.copyout_exit: 3343*7c478bd9Sstevel@tonic-gate membar #StoreLoad|#StoreStore 3344*7c478bd9Sstevel@tonic-gate btst FPUSED_FLAG, SAVED_LOFAULT 3345*7c478bd9Sstevel@tonic-gate bz 1f 3346*7c478bd9Sstevel@tonic-gate nop 3347*7c478bd9Sstevel@tonic-gate 3348*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_GSR_OFFSET], %o2 3349*7c478bd9Sstevel@tonic-gate wr %o2, 0, %gsr ! restore gsr 3350*7c478bd9Sstevel@tonic-gate 3351*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_FPRS_OFFSET], %o3 3352*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 3353*7c478bd9Sstevel@tonic-gate bz 4f 3354*7c478bd9Sstevel@tonic-gate nop 3355*7c478bd9Sstevel@tonic-gate 3356*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 3357*7c478bd9Sstevel@tonic-gate membar #Sync 3358*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 3359*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 3360*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d0 3361*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3362*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d16 3363*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3364*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d32 3365*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3366*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d48 3367*7c478bd9Sstevel@tonic-gate membar #Sync 3368*7c478bd9Sstevel@tonic-gate 3369*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 1f 3370*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 3371*7c478bd9Sstevel@tonic-gate 3372*7c478bd9Sstevel@tonic-gate4: 3373*7c478bd9Sstevel@tonic-gate FZERO ! zero all of the fpregs 3374*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 3375*7c478bd9Sstevel@tonic-gate 3376*7c478bd9Sstevel@tonic-gate1: 3377*7c478bd9Sstevel@tonic-gate andn SAVED_LOFAULT, FPUSED_FLAG, SAVED_LOFAULT 3378*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 3379*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 3380*7c478bd9Sstevel@tonic-gate ret 3381*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 3382*7c478bd9Sstevel@tonic-gate 3383*7c478bd9Sstevel@tonic-gate.copyout_err: 3384*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_COPYOPS], %o4 3385*7c478bd9Sstevel@tonic-gate brz %o4, 2f 3386*7c478bd9Sstevel@tonic-gate nop 3387*7c478bd9Sstevel@tonic-gate ldn [%o4 + CP_COPYOUT], %g2 3388*7c478bd9Sstevel@tonic-gate jmp %g2 3389*7c478bd9Sstevel@tonic-gate nop 3390*7c478bd9Sstevel@tonic-gate2: 3391*7c478bd9Sstevel@tonic-gate retl 3392*7c478bd9Sstevel@tonic-gate mov -1, %o0 3393*7c478bd9Sstevel@tonic-gate SET_SIZE(copyout) 3394*7c478bd9Sstevel@tonic-gate 3395*7c478bd9Sstevel@tonic-gate#endif /* lint */ 3396*7c478bd9Sstevel@tonic-gate 3397*7c478bd9Sstevel@tonic-gate 3398*7c478bd9Sstevel@tonic-gate#ifdef lint 3399*7c478bd9Sstevel@tonic-gate 3400*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3401*7c478bd9Sstevel@tonic-gateint 3402*7c478bd9Sstevel@tonic-gatexcopyout(const void *kaddr, void *uaddr, size_t count) 3403*7c478bd9Sstevel@tonic-gate{ return (0); } 3404*7c478bd9Sstevel@tonic-gate 3405*7c478bd9Sstevel@tonic-gate#else /* lint */ 3406*7c478bd9Sstevel@tonic-gate 3407*7c478bd9Sstevel@tonic-gate ENTRY(xcopyout) 3408*7c478bd9Sstevel@tonic-gate sethi %hi(.xcopyout_err), REAL_LOFAULT 3409*7c478bd9Sstevel@tonic-gate b .do_copyout 3410*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.xcopyout_err), REAL_LOFAULT 3411*7c478bd9Sstevel@tonic-gate.xcopyout_err: 3412*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_COPYOPS], %o4 3413*7c478bd9Sstevel@tonic-gate brz %o4, 2f 3414*7c478bd9Sstevel@tonic-gate nop 3415*7c478bd9Sstevel@tonic-gate ldn [%o4 + CP_XCOPYOUT], %g2 3416*7c478bd9Sstevel@tonic-gate jmp %g2 3417*7c478bd9Sstevel@tonic-gate nop 3418*7c478bd9Sstevel@tonic-gate2: 3419*7c478bd9Sstevel@tonic-gate retl 3420*7c478bd9Sstevel@tonic-gate mov %g1, %o0 3421*7c478bd9Sstevel@tonic-gate SET_SIZE(xcopyout) 3422*7c478bd9Sstevel@tonic-gate 3423*7c478bd9Sstevel@tonic-gate#endif /* lint */ 3424*7c478bd9Sstevel@tonic-gate 3425*7c478bd9Sstevel@tonic-gate#ifdef lint 3426*7c478bd9Sstevel@tonic-gate 3427*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3428*7c478bd9Sstevel@tonic-gateint 3429*7c478bd9Sstevel@tonic-gatexcopyout_little(const void *kaddr, void *uaddr, size_t count) 3430*7c478bd9Sstevel@tonic-gate{ return (0); } 3431*7c478bd9Sstevel@tonic-gate 3432*7c478bd9Sstevel@tonic-gate#else /* lint */ 3433*7c478bd9Sstevel@tonic-gate 3434*7c478bd9Sstevel@tonic-gate ENTRY(xcopyout_little) 3435*7c478bd9Sstevel@tonic-gate sethi %hi(.little_err), %o4 3436*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], %o5 3437*7c478bd9Sstevel@tonic-gate or %o4, %lo(.little_err), %o4 3438*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 3439*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 3440*7c478bd9Sstevel@tonic-gate 3441*7c478bd9Sstevel@tonic-gate subcc %g0, %o2, %o3 3442*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 3443*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f ! check for zero bytes 3444*7c478bd9Sstevel@tonic-gate sub %o2, 1, %o4 3445*7c478bd9Sstevel@tonic-gate add %o0, %o4, %o0 ! start w/last byte 3446*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 3447*7c478bd9Sstevel@tonic-gate ldub [%o0+%o3], %o4 3448*7c478bd9Sstevel@tonic-gate 3449*7c478bd9Sstevel@tonic-gate1: stba %o4, [%o1+%o3]ASI_AIUSL 3450*7c478bd9Sstevel@tonic-gate inccc %o3 3451*7c478bd9Sstevel@tonic-gate sub %o0, 2, %o0 ! get next byte 3452*7c478bd9Sstevel@tonic-gate bcc,a,pt %ncc, 1b 3453*7c478bd9Sstevel@tonic-gate ldub [%o0+%o3], %o4 3454*7c478bd9Sstevel@tonic-gate 3455*7c478bd9Sstevel@tonic-gate2: membar #Sync ! sync error barrier 3456*7c478bd9Sstevel@tonic-gate stn %o5, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 3457*7c478bd9Sstevel@tonic-gate retl 3458*7c478bd9Sstevel@tonic-gate mov %g0, %o0 ! return (0) 3459*7c478bd9Sstevel@tonic-gate SET_SIZE(xcopyout_little) 3460*7c478bd9Sstevel@tonic-gate 3461*7c478bd9Sstevel@tonic-gate#endif /* lint */ 3462*7c478bd9Sstevel@tonic-gate 3463*7c478bd9Sstevel@tonic-gate/* 3464*7c478bd9Sstevel@tonic-gate * Copy user data to kernel space (copyin/xcopyin/xcopyin_little) 3465*7c478bd9Sstevel@tonic-gate */ 3466*7c478bd9Sstevel@tonic-gate 3467*7c478bd9Sstevel@tonic-gate#if defined(lint) 3468*7c478bd9Sstevel@tonic-gate 3469*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 3470*7c478bd9Sstevel@tonic-gateint 3471*7c478bd9Sstevel@tonic-gatecopyin(const void *uaddr, void *kaddr, size_t count) 3472*7c478bd9Sstevel@tonic-gate{ return (0); } 3473*7c478bd9Sstevel@tonic-gate 3474*7c478bd9Sstevel@tonic-gate#else /* lint */ 3475*7c478bd9Sstevel@tonic-gate 3476*7c478bd9Sstevel@tonic-gate ENTRY(copyin) 3477*7c478bd9Sstevel@tonic-gate sethi %hi(.copyin_err), REAL_LOFAULT 3478*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.copyin_err), REAL_LOFAULT 3479*7c478bd9Sstevel@tonic-gate 3480*7c478bd9Sstevel@tonic-gate.do_copyin: 3481*7c478bd9Sstevel@tonic-gate ! 3482*7c478bd9Sstevel@tonic-gate ! Check the length and bail if zero. 3483*7c478bd9Sstevel@tonic-gate ! 3484*7c478bd9Sstevel@tonic-gate tst %o2 3485*7c478bd9Sstevel@tonic-gate bnz,pt %ncc, 1f 3486*7c478bd9Sstevel@tonic-gate nop 3487*7c478bd9Sstevel@tonic-gate retl 3488*7c478bd9Sstevel@tonic-gate clr %o0 3489*7c478bd9Sstevel@tonic-gate1: 3490*7c478bd9Sstevel@tonic-gate sethi %hi(copyio_fault), %o4 3491*7c478bd9Sstevel@tonic-gate or %o4, %lo(copyio_fault), %o4 3492*7c478bd9Sstevel@tonic-gate sethi %hi(copyio_fault_nowindow), %o3 3493*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], SAVED_LOFAULT 3494*7c478bd9Sstevel@tonic-gate or %o3, %lo(copyio_fault_nowindow), %o3 3495*7c478bd9Sstevel@tonic-gate membar #Sync 3496*7c478bd9Sstevel@tonic-gate stn %o3, [THREAD_REG + T_LOFAULT] 3497*7c478bd9Sstevel@tonic-gate 3498*7c478bd9Sstevel@tonic-gate mov %o0, SAVE_SRC 3499*7c478bd9Sstevel@tonic-gate mov %o1, SAVE_DST 3500*7c478bd9Sstevel@tonic-gate mov %o2, SAVE_COUNT 3501*7c478bd9Sstevel@tonic-gate 3502*7c478bd9Sstevel@tonic-gate ! 3503*7c478bd9Sstevel@tonic-gate ! Check to see if we're more than SMALL_LIMIT. 3504*7c478bd9Sstevel@tonic-gate ! 3505*7c478bd9Sstevel@tonic-gate subcc %o2, SMALL_LIMIT, %o3 3506*7c478bd9Sstevel@tonic-gate bgu,a,pt %ncc, .dci_ns 3507*7c478bd9Sstevel@tonic-gate or %o0, %o1, %o3 3508*7c478bd9Sstevel@tonic-gate ! 3509*7c478bd9Sstevel@tonic-gate ! What was previously ".small_copyin" 3510*7c478bd9Sstevel@tonic-gate ! 3511*7c478bd9Sstevel@tonic-gate.dcibcp: 3512*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 ! setup for copy loop 3513*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 3514*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 3515*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcicl 3516*7c478bd9Sstevel@tonic-gate lduba [%o0 + %o3]ASI_USER, %o4 3517*7c478bd9Sstevel@tonic-gate ! 3518*7c478bd9Sstevel@tonic-gate ! %o0 and %o1 point at the end and remain pointing at the end 3519*7c478bd9Sstevel@tonic-gate ! of their buffers. We pull things out by adding %o3 (which is 3520*7c478bd9Sstevel@tonic-gate ! the negation of the length) to the buffer end which gives us 3521*7c478bd9Sstevel@tonic-gate ! the curent location in the buffers. By incrementing %o3 we walk 3522*7c478bd9Sstevel@tonic-gate ! through both buffers without having to bump each buffer's 3523*7c478bd9Sstevel@tonic-gate ! pointer. A very fast 4 instruction loop. 3524*7c478bd9Sstevel@tonic-gate ! 3525*7c478bd9Sstevel@tonic-gate .align 16 3526*7c478bd9Sstevel@tonic-gate.dcicl: 3527*7c478bd9Sstevel@tonic-gate stb %o4, [%o1 + %o3] 3528*7c478bd9Sstevel@tonic-gate inccc %o3 3529*7c478bd9Sstevel@tonic-gate bl,a,pt %ncc, .dcicl 3530*7c478bd9Sstevel@tonic-gate lduba [%o0 + %o3]ASI_USER, %o4 3531*7c478bd9Sstevel@tonic-gate ! 3532*7c478bd9Sstevel@tonic-gate ! We're done. Go home. 3533*7c478bd9Sstevel@tonic-gate ! 3534*7c478bd9Sstevel@tonic-gate membar #Sync 3535*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] 3536*7c478bd9Sstevel@tonic-gate retl 3537*7c478bd9Sstevel@tonic-gate clr %o0 3538*7c478bd9Sstevel@tonic-gate ! 3539*7c478bd9Sstevel@tonic-gate ! Try aligned copies from here. 3540*7c478bd9Sstevel@tonic-gate ! 3541*7c478bd9Sstevel@tonic-gate.dci_ns: 3542*7c478bd9Sstevel@tonic-gate ! 3543*7c478bd9Sstevel@tonic-gate ! See if we're single byte aligned. If we are, check the 3544*7c478bd9Sstevel@tonic-gate ! limit for single byte copies. If we're smaller, or equal, 3545*7c478bd9Sstevel@tonic-gate ! bounce to the byte for byte copy loop. Otherwise do it in 3546*7c478bd9Sstevel@tonic-gate ! HW (if enabled). 3547*7c478bd9Sstevel@tonic-gate ! 3548*7c478bd9Sstevel@tonic-gate btst 1, %o3 3549*7c478bd9Sstevel@tonic-gate bz,a,pt %icc, .dcih8 3550*7c478bd9Sstevel@tonic-gate btst 7, %o3 3551*7c478bd9Sstevel@tonic-gate ! 3552*7c478bd9Sstevel@tonic-gate ! We're single byte aligned. 3553*7c478bd9Sstevel@tonic-gate ! 3554*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 3555*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcibcp 3556*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_1), %o3 3557*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_1)], %o3 3558*7c478bd9Sstevel@tonic-gate ! 3559*7c478bd9Sstevel@tonic-gate ! Is HW copy on? If not do everything byte for byte. 3560*7c478bd9Sstevel@tonic-gate ! 3561*7c478bd9Sstevel@tonic-gate tst %o3 3562*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcibcp 3563*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 3564*7c478bd9Sstevel@tonic-gate ! 3565*7c478bd9Sstevel@tonic-gate ! Are we bigger than the HW limit? If not 3566*7c478bd9Sstevel@tonic-gate ! go to byte for byte. 3567*7c478bd9Sstevel@tonic-gate ! 3568*7c478bd9Sstevel@tonic-gate bge,pt %ncc, .dcibcp 3569*7c478bd9Sstevel@tonic-gate nop 3570*7c478bd9Sstevel@tonic-gate ! 3571*7c478bd9Sstevel@tonic-gate ! We're big enough and copy is on. Do it with HW. 3572*7c478bd9Sstevel@tonic-gate ! 3573*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyin 3574*7c478bd9Sstevel@tonic-gate nop 3575*7c478bd9Sstevel@tonic-gate.dcih8: 3576*7c478bd9Sstevel@tonic-gate ! 3577*7c478bd9Sstevel@tonic-gate ! 8 byte aligned? 3578*7c478bd9Sstevel@tonic-gate ! 3579*7c478bd9Sstevel@tonic-gate bnz,a %ncc, .dcih4 3580*7c478bd9Sstevel@tonic-gate btst 3, %o3 3581*7c478bd9Sstevel@tonic-gate ! 3582*7c478bd9Sstevel@tonic-gate ! We're eight byte aligned. 3583*7c478bd9Sstevel@tonic-gate ! 3584*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 3585*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcis8 3586*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_8), %o3 3587*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_8)], %o3 3588*7c478bd9Sstevel@tonic-gate ! 3589*7c478bd9Sstevel@tonic-gate ! Is HW assist on? If not, do it with the aligned copy. 3590*7c478bd9Sstevel@tonic-gate ! 3591*7c478bd9Sstevel@tonic-gate tst %o3 3592*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcis8 3593*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 3594*7c478bd9Sstevel@tonic-gate bge %ncc, .dcis8 3595*7c478bd9Sstevel@tonic-gate nop 3596*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyin 3597*7c478bd9Sstevel@tonic-gate nop 3598*7c478bd9Sstevel@tonic-gate.dcis8: 3599*7c478bd9Sstevel@tonic-gate ! 3600*7c478bd9Sstevel@tonic-gate ! Housekeeping for copy loops. Uses same idea as in the byte for 3601*7c478bd9Sstevel@tonic-gate ! byte copy loop above. 3602*7c478bd9Sstevel@tonic-gate ! 3603*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 3604*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 3605*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 3606*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .didebc 3607*7c478bd9Sstevel@tonic-gate srl %o2, 3, %o2 ! Number of 8 byte chunks to copy 3608*7c478bd9Sstevel@tonic-gate ! 3609*7c478bd9Sstevel@tonic-gate ! 4 byte aligned? 3610*7c478bd9Sstevel@tonic-gate ! 3611*7c478bd9Sstevel@tonic-gate.dcih4: 3612*7c478bd9Sstevel@tonic-gate bnz %ncc, .dcih2 3613*7c478bd9Sstevel@tonic-gate subcc %o2, VIS_COPY_THRESHOLD, %o3 3614*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcis4 3615*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_4), %o3 3616*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_4)], %o3 3617*7c478bd9Sstevel@tonic-gate ! 3618*7c478bd9Sstevel@tonic-gate ! Is HW assist on? If not, do it with the aligned copy. 3619*7c478bd9Sstevel@tonic-gate ! 3620*7c478bd9Sstevel@tonic-gate tst %o3 3621*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcis4 3622*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 3623*7c478bd9Sstevel@tonic-gate ! 3624*7c478bd9Sstevel@tonic-gate ! We're negative if our size is less than or equal to hw_copy_limit_4. 3625*7c478bd9Sstevel@tonic-gate ! 3626*7c478bd9Sstevel@tonic-gate bge %ncc, .dcis4 3627*7c478bd9Sstevel@tonic-gate nop 3628*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyin 3629*7c478bd9Sstevel@tonic-gate nop 3630*7c478bd9Sstevel@tonic-gate.dcis4: 3631*7c478bd9Sstevel@tonic-gate ! 3632*7c478bd9Sstevel@tonic-gate ! Housekeeping for copy loops. Uses same idea as in the byte 3633*7c478bd9Sstevel@tonic-gate ! for byte copy loop above. 3634*7c478bd9Sstevel@tonic-gate ! 3635*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 3636*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 3637*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 3638*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .didfbc 3639*7c478bd9Sstevel@tonic-gate srl %o2, 2, %o2 ! Number of 4 byte chunks to copy 3640*7c478bd9Sstevel@tonic-gate.dcih2: 3641*7c478bd9Sstevel@tonic-gate ! 3642*7c478bd9Sstevel@tonic-gate ! We're two byte aligned. Check for "smallness" 3643*7c478bd9Sstevel@tonic-gate ! done in delay at .dcih4 3644*7c478bd9Sstevel@tonic-gate ! 3645*7c478bd9Sstevel@tonic-gate bleu,pt %ncc, .dcis2 3646*7c478bd9Sstevel@tonic-gate sethi %hi(hw_copy_limit_2), %o3 3647*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(hw_copy_limit_2)], %o3 3648*7c478bd9Sstevel@tonic-gate ! 3649*7c478bd9Sstevel@tonic-gate ! Is HW assist on? If not, do it with the aligned copy. 3650*7c478bd9Sstevel@tonic-gate ! 3651*7c478bd9Sstevel@tonic-gate tst %o3 3652*7c478bd9Sstevel@tonic-gate bz,pn %icc, .dcis2 3653*7c478bd9Sstevel@tonic-gate subcc %o3, %o2, %o3 3654*7c478bd9Sstevel@tonic-gate ! 3655*7c478bd9Sstevel@tonic-gate ! Are we larger than the HW limit? 3656*7c478bd9Sstevel@tonic-gate ! 3657*7c478bd9Sstevel@tonic-gate bge %ncc, .dcis2 3658*7c478bd9Sstevel@tonic-gate nop 3659*7c478bd9Sstevel@tonic-gate ! 3660*7c478bd9Sstevel@tonic-gate ! HW assist is on and we're large enough to use it. 3661*7c478bd9Sstevel@tonic-gate ! 3662*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .big_copyin 3663*7c478bd9Sstevel@tonic-gate nop 3664*7c478bd9Sstevel@tonic-gate ! 3665*7c478bd9Sstevel@tonic-gate ! Housekeeping for copy loops. Uses same idea as in the byte 3666*7c478bd9Sstevel@tonic-gate ! for byte copy loop above. 3667*7c478bd9Sstevel@tonic-gate ! 3668*7c478bd9Sstevel@tonic-gate.dcis2: 3669*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 3670*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 3671*7c478bd9Sstevel@tonic-gate sub %g0, %o2, %o3 3672*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .didtbc 3673*7c478bd9Sstevel@tonic-gate srl %o2, 1, %o2 ! Number of 2 byte chunks to copy 3674*7c478bd9Sstevel@tonic-gate ! 3675*7c478bd9Sstevel@tonic-gate.small_copyin: 3676*7c478bd9Sstevel@tonic-gate ! 3677*7c478bd9Sstevel@tonic-gate ! Why are we doing this AGAIN? There are certain conditions in 3678*7c478bd9Sstevel@tonic-gate ! big copyin that will cause us to forgo the HW assisted copys 3679*7c478bd9Sstevel@tonic-gate ! and bounce back to a non-hw assisted copy. This dispatches 3680*7c478bd9Sstevel@tonic-gate ! those copies. Note that we branch around this in the main line 3681*7c478bd9Sstevel@tonic-gate ! code. 3682*7c478bd9Sstevel@tonic-gate ! 3683*7c478bd9Sstevel@tonic-gate ! We make no check for limits or HW enablement here. We've 3684*7c478bd9Sstevel@tonic-gate ! already been told that we're a poster child so just go off 3685*7c478bd9Sstevel@tonic-gate ! and do it. 3686*7c478bd9Sstevel@tonic-gate ! 3687*7c478bd9Sstevel@tonic-gate or %o0, %o1, %o3 3688*7c478bd9Sstevel@tonic-gate btst 1, %o3 3689*7c478bd9Sstevel@tonic-gate bnz %icc, .dcibcp ! Most likely 3690*7c478bd9Sstevel@tonic-gate btst 7, %o3 3691*7c478bd9Sstevel@tonic-gate bz %icc, .dcis8 3692*7c478bd9Sstevel@tonic-gate btst 3, %o3 3693*7c478bd9Sstevel@tonic-gate bz %icc, .dcis4 3694*7c478bd9Sstevel@tonic-gate nop 3695*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcis2 3696*7c478bd9Sstevel@tonic-gate nop 3697*7c478bd9Sstevel@tonic-gate ! 3698*7c478bd9Sstevel@tonic-gate ! Eight byte aligned copies. A steal from the original .small_copyin 3699*7c478bd9Sstevel@tonic-gate ! with modifications. %o2 is number of 8 byte chunks to copy. When 3700*7c478bd9Sstevel@tonic-gate ! done, we examine %o3. If this is < 0, we have 1 - 7 bytes more 3701*7c478bd9Sstevel@tonic-gate ! to copy. 3702*7c478bd9Sstevel@tonic-gate ! 3703*7c478bd9Sstevel@tonic-gate .align 32 3704*7c478bd9Sstevel@tonic-gate.didebc: 3705*7c478bd9Sstevel@tonic-gate ldxa [%o0 + %o3]ASI_USER, %o4 3706*7c478bd9Sstevel@tonic-gate deccc %o2 3707*7c478bd9Sstevel@tonic-gate stx %o4, [%o1 + %o3] 3708*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .didebc 3709*7c478bd9Sstevel@tonic-gate addcc %o3, 8, %o3 3710*7c478bd9Sstevel@tonic-gate ! 3711*7c478bd9Sstevel@tonic-gate ! End of copy loop. Most 8 byte aligned copies end here. 3712*7c478bd9Sstevel@tonic-gate ! 3713*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcifh 3714*7c478bd9Sstevel@tonic-gate nop 3715*7c478bd9Sstevel@tonic-gate ! 3716*7c478bd9Sstevel@tonic-gate ! Something is left. Do it byte for byte. 3717*7c478bd9Sstevel@tonic-gate ! 3718*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcicl 3719*7c478bd9Sstevel@tonic-gate lduba [%o0 + %o3]ASI_USER, %o4 3720*7c478bd9Sstevel@tonic-gate ! 3721*7c478bd9Sstevel@tonic-gate ! 4 byte copy loop. %o2 is number of 4 byte chunks to copy. 3722*7c478bd9Sstevel@tonic-gate ! 3723*7c478bd9Sstevel@tonic-gate .align 32 3724*7c478bd9Sstevel@tonic-gate.didfbc: 3725*7c478bd9Sstevel@tonic-gate lduwa [%o0 + %o3]ASI_USER, %o4 3726*7c478bd9Sstevel@tonic-gate deccc %o2 3727*7c478bd9Sstevel@tonic-gate st %o4, [%o1 + %o3] 3728*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .didfbc 3729*7c478bd9Sstevel@tonic-gate addcc %o3, 4, %o3 3730*7c478bd9Sstevel@tonic-gate ! 3731*7c478bd9Sstevel@tonic-gate ! End of copy loop. Most 4 byte aligned copies end here. 3732*7c478bd9Sstevel@tonic-gate ! 3733*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcifh 3734*7c478bd9Sstevel@tonic-gate nop 3735*7c478bd9Sstevel@tonic-gate ! 3736*7c478bd9Sstevel@tonic-gate ! Something is left. Do it byte for byte. 3737*7c478bd9Sstevel@tonic-gate ! 3738*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .dcicl 3739*7c478bd9Sstevel@tonic-gate lduba [%o0 + %o3]ASI_USER, %o4 3740*7c478bd9Sstevel@tonic-gate ! 3741*7c478bd9Sstevel@tonic-gate ! 2 byte aligned copy loop. %o2 is number of 2 byte chunks to 3742*7c478bd9Sstevel@tonic-gate ! copy. 3743*7c478bd9Sstevel@tonic-gate ! 3744*7c478bd9Sstevel@tonic-gate .align 32 3745*7c478bd9Sstevel@tonic-gate.didtbc: 3746*7c478bd9Sstevel@tonic-gate lduha [%o0 + %o3]ASI_USER, %o4 3747*7c478bd9Sstevel@tonic-gate deccc %o2 3748*7c478bd9Sstevel@tonic-gate sth %o4, [%o1 + %o3] 3749*7c478bd9Sstevel@tonic-gate bg,pt %ncc, .didtbc 3750*7c478bd9Sstevel@tonic-gate addcc %o3, 2, %o3 3751*7c478bd9Sstevel@tonic-gate ! 3752*7c478bd9Sstevel@tonic-gate ! End of copy loop. Most 2 byte aligned copies end here. 3753*7c478bd9Sstevel@tonic-gate ! 3754*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .dcifh 3755*7c478bd9Sstevel@tonic-gate nop 3756*7c478bd9Sstevel@tonic-gate ! 3757*7c478bd9Sstevel@tonic-gate ! Deal with the last byte 3758*7c478bd9Sstevel@tonic-gate ! 3759*7c478bd9Sstevel@tonic-gate lduba [%o0 + %o3]ASI_USER, %o4 3760*7c478bd9Sstevel@tonic-gate stb %o4, [%o1 + %o3] 3761*7c478bd9Sstevel@tonic-gate.dcifh: 3762*7c478bd9Sstevel@tonic-gate membar #Sync 3763*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 3764*7c478bd9Sstevel@tonic-gate retl 3765*7c478bd9Sstevel@tonic-gate clr %o0 3766*7c478bd9Sstevel@tonic-gate 3767*7c478bd9Sstevel@tonic-gate.big_copyin: 3768*7c478bd9Sstevel@tonic-gate ! 3769*7c478bd9Sstevel@tonic-gate ! Are we using the FP registers? 3770*7c478bd9Sstevel@tonic-gate ! 3771*7c478bd9Sstevel@tonic-gate rd %fprs, %o3 ! check for unused fp 3772*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 3773*7c478bd9Sstevel@tonic-gate bnz %ncc, .copyin_fpregs_inuse 3774*7c478bd9Sstevel@tonic-gate nop 3775*7c478bd9Sstevel@tonic-gate ! 3776*7c478bd9Sstevel@tonic-gate ! We're going off to do a block copy. 3777*7c478bd9Sstevel@tonic-gate ! Switch fault hendlers and grab a window. We 3778*7c478bd9Sstevel@tonic-gate ! don't do a membar #Sync since we've done only 3779*7c478bd9Sstevel@tonic-gate ! kernel data to this point. 3780*7c478bd9Sstevel@tonic-gate ! 3781*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 3782*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 3783*7c478bd9Sstevel@tonic-gate ! 3784*7c478bd9Sstevel@tonic-gate ! %o3 is %i3 after the save... 3785*7c478bd9Sstevel@tonic-gate ! 3786*7c478bd9Sstevel@tonic-gate st %i3, [%fp + STACK_BIAS - SAVED_FPRS_OFFSET] 3787*7c478bd9Sstevel@tonic-gate ba,pt %ncc, .do_blockcopyin 3788*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 3789*7c478bd9Sstevel@tonic-gate.copyin_fpregs_inuse: 3790*7c478bd9Sstevel@tonic-gate ! 3791*7c478bd9Sstevel@tonic-gate ! We're here if the FP regs are in use. Need to see if the request 3792*7c478bd9Sstevel@tonic-gate ! exceeds our suddenly larger minimum. 3793*7c478bd9Sstevel@tonic-gate ! 3794*7c478bd9Sstevel@tonic-gate cmp %i2, VIS_COPY_THRESHOLD+(64*4) 3795*7c478bd9Sstevel@tonic-gate bl %ncc, .small_copyin 3796*7c478bd9Sstevel@tonic-gate nop 3797*7c478bd9Sstevel@tonic-gate ! 3798*7c478bd9Sstevel@tonic-gate ! We're going off and do a block copy. 3799*7c478bd9Sstevel@tonic-gate ! Change to the heavy duty fault handler and grab a window first. 3800*7c478bd9Sstevel@tonic-gate ! New handler is passed in 3801*7c478bd9Sstevel@tonic-gate ! 3802*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 3803*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp 3804*7c478bd9Sstevel@tonic-gate ! 3805*7c478bd9Sstevel@tonic-gate ! %o3 is now %i3 3806*7c478bd9Sstevel@tonic-gate ! 3807*7c478bd9Sstevel@tonic-gate st %i3, [%fp + STACK_BIAS - SAVED_FPRS_OFFSET] 3808*7c478bd9Sstevel@tonic-gate 3809*7c478bd9Sstevel@tonic-gate ! save in-use fpregs on stack 3810*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 3811*7c478bd9Sstevel@tonic-gate membar #Sync 3812*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 3813*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 3814*7c478bd9Sstevel@tonic-gate stda %d0, [%o2]ASI_BLK_P 3815*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3816*7c478bd9Sstevel@tonic-gate stda %d16, [%o2]ASI_BLK_P 3817*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3818*7c478bd9Sstevel@tonic-gate stda %d32, [%o2]ASI_BLK_P 3819*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 3820*7c478bd9Sstevel@tonic-gate stda %d48, [%o2]ASI_BLK_P 3821*7c478bd9Sstevel@tonic-gate membar #Sync 3822*7c478bd9Sstevel@tonic-gate 3823*7c478bd9Sstevel@tonic-gate.do_blockcopyin: 3824*7c478bd9Sstevel@tonic-gate membar #StoreStore|#StoreLoad|#LoadStore 3825*7c478bd9Sstevel@tonic-gate 3826*7c478bd9Sstevel@tonic-gate rd %gsr, %o2 3827*7c478bd9Sstevel@tonic-gate st %o2, [%fp + STACK_BIAS - SAVED_GSR_OFFSET] ! save gsr 3828*7c478bd9Sstevel@tonic-gate 3829*7c478bd9Sstevel@tonic-gate ! Set the lower bit in the saved t_lofault to indicate 3830*7c478bd9Sstevel@tonic-gate ! that we need to clear the %fprs register on the way 3831*7c478bd9Sstevel@tonic-gate ! out 3832*7c478bd9Sstevel@tonic-gate or SAVED_LOFAULT, FPUSED_FLAG, SAVED_LOFAULT 3833*7c478bd9Sstevel@tonic-gate 3834*7c478bd9Sstevel@tonic-gate ! Swap src/dst since the code below is memcpy code 3835*7c478bd9Sstevel@tonic-gate ! and memcpy/bcopy have different calling sequences 3836*7c478bd9Sstevel@tonic-gate mov %i1, %i5 3837*7c478bd9Sstevel@tonic-gate mov %i0, %i1 3838*7c478bd9Sstevel@tonic-gate mov %i5, %i0 3839*7c478bd9Sstevel@tonic-gate 3840*7c478bd9Sstevel@tonic-gate!!! This code is nearly identical to the version in the sun4u 3841*7c478bd9Sstevel@tonic-gate!!! libc_psr. Most bugfixes made to that file should be 3842*7c478bd9Sstevel@tonic-gate!!! merged into this routine. 3843*7c478bd9Sstevel@tonic-gate 3844*7c478bd9Sstevel@tonic-gate andcc %i0, 7, %o3 3845*7c478bd9Sstevel@tonic-gate bz copyin_blkcpy 3846*7c478bd9Sstevel@tonic-gate sub %o3, 8, %o3 3847*7c478bd9Sstevel@tonic-gate neg %o3 3848*7c478bd9Sstevel@tonic-gate sub %i2, %o3, %i2 3849*7c478bd9Sstevel@tonic-gate 3850*7c478bd9Sstevel@tonic-gate ! Align Destination on double-word boundary 3851*7c478bd9Sstevel@tonic-gate 3852*7c478bd9Sstevel@tonic-gate2: lduba [%i1]ASI_USER, %o4 3853*7c478bd9Sstevel@tonic-gate inc %i1 3854*7c478bd9Sstevel@tonic-gate inc %i0 3855*7c478bd9Sstevel@tonic-gate deccc %o3 3856*7c478bd9Sstevel@tonic-gate bgu %ncc, 2b 3857*7c478bd9Sstevel@tonic-gate stb %o4, [%i0-1] 3858*7c478bd9Sstevel@tonic-gatecopyin_blkcpy: 3859*7c478bd9Sstevel@tonic-gate andcc %i0, 63, %i3 3860*7c478bd9Sstevel@tonic-gate bz,pn %ncc, copyin_blalign ! now block aligned 3861*7c478bd9Sstevel@tonic-gate sub %i3, 64, %i3 3862*7c478bd9Sstevel@tonic-gate neg %i3 ! bytes till block aligned 3863*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 ! update %i2 with new count 3864*7c478bd9Sstevel@tonic-gate 3865*7c478bd9Sstevel@tonic-gate ! Copy %i3 bytes till dst is block (64 byte) aligned. use 3866*7c478bd9Sstevel@tonic-gate ! double word copies. 3867*7c478bd9Sstevel@tonic-gate 3868*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g1 3869*7c478bd9Sstevel@tonic-gate ldda [%g1]ASI_USER, %d0 3870*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 3871*7c478bd9Sstevel@tonic-gate6: 3872*7c478bd9Sstevel@tonic-gate ldda [%g1]ASI_USER, %d2 3873*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 3874*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 3875*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 3876*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 3877*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 3878*7c478bd9Sstevel@tonic-gate bz,pn %ncc, copyin_blalign 3879*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3880*7c478bd9Sstevel@tonic-gate ldda [%g1]ASI_USER, %d0 3881*7c478bd9Sstevel@tonic-gate add %g1, 8, %g1 3882*7c478bd9Sstevel@tonic-gate subcc %i3, 8, %i3 3883*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 3884*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 3885*7c478bd9Sstevel@tonic-gate add %i1, 8, %i1 3886*7c478bd9Sstevel@tonic-gate bgu,pn %ncc, 6b 3887*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 3888*7c478bd9Sstevel@tonic-gate 3889*7c478bd9Sstevel@tonic-gatecopyin_blalign: 3890*7c478bd9Sstevel@tonic-gate membar #StoreLoad 3891*7c478bd9Sstevel@tonic-gate ! %i2 = total length 3892*7c478bd9Sstevel@tonic-gate ! %i3 = blocks (length - 64) / 64 3893*7c478bd9Sstevel@tonic-gate ! %i4 = doubles remaining (length - blocks) 3894*7c478bd9Sstevel@tonic-gate sub %i2, 64, %i3 3895*7c478bd9Sstevel@tonic-gate andn %i3, 63, %i3 3896*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i4 3897*7c478bd9Sstevel@tonic-gate andn %i4, 7, %i4 3898*7c478bd9Sstevel@tonic-gate sub %i4, 16, %i4 3899*7c478bd9Sstevel@tonic-gate sub %i2, %i4, %i2 3900*7c478bd9Sstevel@tonic-gate sub %i2, %i3, %i2 3901*7c478bd9Sstevel@tonic-gate 3902*7c478bd9Sstevel@tonic-gate andn %i1, 0x3f, %l7 ! blk aligned address 3903*7c478bd9Sstevel@tonic-gate alignaddr %i1, %g0, %g0 ! gen %gsr 3904*7c478bd9Sstevel@tonic-gate 3905*7c478bd9Sstevel@tonic-gate srl %i1, 3, %l5 ! bits 3,4,5 are now least sig in %l5 3906*7c478bd9Sstevel@tonic-gate andcc %l5, 7, %i5 ! mask everything except bits 1,2 3 3907*7c478bd9Sstevel@tonic-gate add %i1, %i4, %i1 3908*7c478bd9Sstevel@tonic-gate add %i1, %i3, %i1 3909*7c478bd9Sstevel@tonic-gate 3910*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 3911*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3912*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 3913*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3914*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 3915*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3916*7c478bd9Sstevel@tonic-gate sub %i3, 128, %i3 3917*7c478bd9Sstevel@tonic-gate 3918*7c478bd9Sstevel@tonic-gate ! switch statement to get us to the right 8 byte blk within a 3919*7c478bd9Sstevel@tonic-gate ! 64 byte block 3920*7c478bd9Sstevel@tonic-gate 3921*7c478bd9Sstevel@tonic-gate cmp %i5, 4 3922*7c478bd9Sstevel@tonic-gate bgeu,a copyin_hlf 3923*7c478bd9Sstevel@tonic-gate cmp %i5, 6 3924*7c478bd9Sstevel@tonic-gate cmp %i5, 2 3925*7c478bd9Sstevel@tonic-gate bgeu,a copyin_sqtr 3926*7c478bd9Sstevel@tonic-gate nop 3927*7c478bd9Sstevel@tonic-gate cmp %i5, 1 3928*7c478bd9Sstevel@tonic-gate be,a copyin_seg1 3929*7c478bd9Sstevel@tonic-gate nop 3930*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_seg0 3931*7c478bd9Sstevel@tonic-gate nop 3932*7c478bd9Sstevel@tonic-gatecopyin_sqtr: 3933*7c478bd9Sstevel@tonic-gate be,a copyin_seg2 3934*7c478bd9Sstevel@tonic-gate nop 3935*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_seg3 3936*7c478bd9Sstevel@tonic-gate nop 3937*7c478bd9Sstevel@tonic-gate 3938*7c478bd9Sstevel@tonic-gatecopyin_hlf: 3939*7c478bd9Sstevel@tonic-gate bgeu,a copyin_fqtr 3940*7c478bd9Sstevel@tonic-gate nop 3941*7c478bd9Sstevel@tonic-gate cmp %i5, 5 3942*7c478bd9Sstevel@tonic-gate be,a copyin_seg5 3943*7c478bd9Sstevel@tonic-gate nop 3944*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_seg4 3945*7c478bd9Sstevel@tonic-gate nop 3946*7c478bd9Sstevel@tonic-gatecopyin_fqtr: 3947*7c478bd9Sstevel@tonic-gate be,a copyin_seg6 3948*7c478bd9Sstevel@tonic-gate nop 3949*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_seg7 3950*7c478bd9Sstevel@tonic-gate nop 3951*7c478bd9Sstevel@tonic-gate 3952*7c478bd9Sstevel@tonic-gatecopyin_seg0: 3953*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 3954*7c478bd9Sstevel@tonic-gate FALIGN_D0 3955*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 3956*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3957*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3958*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3959*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 3960*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3961*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 3962*7c478bd9Sstevel@tonic-gate FALIGN_D16 3963*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 3964*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3965*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3966*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3967*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 3968*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3969*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 3970*7c478bd9Sstevel@tonic-gate FALIGN_D32 3971*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 3972*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3973*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 3974*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 3975*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 3976*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3977*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg0 3978*7c478bd9Sstevel@tonic-gate 3979*7c478bd9Sstevel@tonic-gate0: 3980*7c478bd9Sstevel@tonic-gate FALIGN_D16 3981*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3982*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3983*7c478bd9Sstevel@tonic-gate membar #Sync 3984*7c478bd9Sstevel@tonic-gate FALIGN_D32 3985*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3986*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd0 3987*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3988*7c478bd9Sstevel@tonic-gate 3989*7c478bd9Sstevel@tonic-gate1: 3990*7c478bd9Sstevel@tonic-gate FALIGN_D32 3991*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3992*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3993*7c478bd9Sstevel@tonic-gate membar #Sync 3994*7c478bd9Sstevel@tonic-gate FALIGN_D0 3995*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 3996*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd16 3997*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 3998*7c478bd9Sstevel@tonic-gate 3999*7c478bd9Sstevel@tonic-gate2: 4000*7c478bd9Sstevel@tonic-gate FALIGN_D0 4001*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4002*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4003*7c478bd9Sstevel@tonic-gate membar #Sync 4004*7c478bd9Sstevel@tonic-gate FALIGN_D16 4005*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4006*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd32 4007*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4008*7c478bd9Sstevel@tonic-gate 4009*7c478bd9Sstevel@tonic-gatecopyin_seg1: 4010*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4011*7c478bd9Sstevel@tonic-gate FALIGN_D2 4012*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4013*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4014*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4015*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4016*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4017*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4018*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4019*7c478bd9Sstevel@tonic-gate FALIGN_D18 4020*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4021*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4022*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4023*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4024*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4025*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4026*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4027*7c478bd9Sstevel@tonic-gate FALIGN_D34 4028*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4029*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4030*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4031*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4032*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4033*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4034*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg1 4035*7c478bd9Sstevel@tonic-gate0: 4036*7c478bd9Sstevel@tonic-gate FALIGN_D18 4037*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4038*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4039*7c478bd9Sstevel@tonic-gate membar #Sync 4040*7c478bd9Sstevel@tonic-gate FALIGN_D34 4041*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4042*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd2 4043*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4044*7c478bd9Sstevel@tonic-gate 4045*7c478bd9Sstevel@tonic-gate1: 4046*7c478bd9Sstevel@tonic-gate FALIGN_D34 4047*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4048*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4049*7c478bd9Sstevel@tonic-gate membar #Sync 4050*7c478bd9Sstevel@tonic-gate FALIGN_D2 4051*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4052*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd18 4053*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4054*7c478bd9Sstevel@tonic-gate 4055*7c478bd9Sstevel@tonic-gate2: 4056*7c478bd9Sstevel@tonic-gate FALIGN_D2 4057*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4058*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4059*7c478bd9Sstevel@tonic-gate membar #Sync 4060*7c478bd9Sstevel@tonic-gate FALIGN_D18 4061*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4062*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd34 4063*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4064*7c478bd9Sstevel@tonic-gatecopyin_seg2: 4065*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4066*7c478bd9Sstevel@tonic-gate FALIGN_D4 4067*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4068*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4069*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4070*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4071*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4072*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4073*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4074*7c478bd9Sstevel@tonic-gate FALIGN_D20 4075*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4076*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4077*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4078*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4079*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4080*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4081*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4082*7c478bd9Sstevel@tonic-gate FALIGN_D36 4083*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4084*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4085*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4086*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4087*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4088*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4089*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg2 4090*7c478bd9Sstevel@tonic-gate 4091*7c478bd9Sstevel@tonic-gate0: 4092*7c478bd9Sstevel@tonic-gate FALIGN_D20 4093*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4094*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4095*7c478bd9Sstevel@tonic-gate membar #Sync 4096*7c478bd9Sstevel@tonic-gate FALIGN_D36 4097*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4098*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd4 4099*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4100*7c478bd9Sstevel@tonic-gate 4101*7c478bd9Sstevel@tonic-gate1: 4102*7c478bd9Sstevel@tonic-gate FALIGN_D36 4103*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4104*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4105*7c478bd9Sstevel@tonic-gate membar #Sync 4106*7c478bd9Sstevel@tonic-gate FALIGN_D4 4107*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4108*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd20 4109*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4110*7c478bd9Sstevel@tonic-gate 4111*7c478bd9Sstevel@tonic-gate2: 4112*7c478bd9Sstevel@tonic-gate FALIGN_D4 4113*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4114*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4115*7c478bd9Sstevel@tonic-gate membar #Sync 4116*7c478bd9Sstevel@tonic-gate FALIGN_D20 4117*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4118*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd36 4119*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4120*7c478bd9Sstevel@tonic-gate 4121*7c478bd9Sstevel@tonic-gatecopyin_seg3: 4122*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4123*7c478bd9Sstevel@tonic-gate FALIGN_D6 4124*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4125*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4126*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4127*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4128*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4129*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4130*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4131*7c478bd9Sstevel@tonic-gate FALIGN_D22 4132*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4133*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4134*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4135*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4136*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4137*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4138*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4139*7c478bd9Sstevel@tonic-gate FALIGN_D38 4140*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4141*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4142*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4143*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4144*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4145*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4146*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg3 4147*7c478bd9Sstevel@tonic-gate 4148*7c478bd9Sstevel@tonic-gate0: 4149*7c478bd9Sstevel@tonic-gate FALIGN_D22 4150*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4151*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4152*7c478bd9Sstevel@tonic-gate membar #Sync 4153*7c478bd9Sstevel@tonic-gate FALIGN_D38 4154*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4155*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd6 4156*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4157*7c478bd9Sstevel@tonic-gate 4158*7c478bd9Sstevel@tonic-gate1: 4159*7c478bd9Sstevel@tonic-gate FALIGN_D38 4160*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4161*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4162*7c478bd9Sstevel@tonic-gate membar #Sync 4163*7c478bd9Sstevel@tonic-gate FALIGN_D6 4164*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4165*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd22 4166*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4167*7c478bd9Sstevel@tonic-gate 4168*7c478bd9Sstevel@tonic-gate2: 4169*7c478bd9Sstevel@tonic-gate FALIGN_D6 4170*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4171*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4172*7c478bd9Sstevel@tonic-gate membar #Sync 4173*7c478bd9Sstevel@tonic-gate FALIGN_D22 4174*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4175*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd38 4176*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4177*7c478bd9Sstevel@tonic-gate 4178*7c478bd9Sstevel@tonic-gatecopyin_seg4: 4179*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4180*7c478bd9Sstevel@tonic-gate FALIGN_D8 4181*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4182*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4183*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4184*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4185*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4186*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4187*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4188*7c478bd9Sstevel@tonic-gate FALIGN_D24 4189*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4190*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4191*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4192*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4193*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4194*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4195*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4196*7c478bd9Sstevel@tonic-gate FALIGN_D40 4197*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4198*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4199*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4200*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4201*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4202*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4203*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg4 4204*7c478bd9Sstevel@tonic-gate 4205*7c478bd9Sstevel@tonic-gate0: 4206*7c478bd9Sstevel@tonic-gate FALIGN_D24 4207*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4208*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4209*7c478bd9Sstevel@tonic-gate membar #Sync 4210*7c478bd9Sstevel@tonic-gate FALIGN_D40 4211*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4212*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd8 4213*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4214*7c478bd9Sstevel@tonic-gate 4215*7c478bd9Sstevel@tonic-gate1: 4216*7c478bd9Sstevel@tonic-gate FALIGN_D40 4217*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4218*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4219*7c478bd9Sstevel@tonic-gate membar #Sync 4220*7c478bd9Sstevel@tonic-gate FALIGN_D8 4221*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4222*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd24 4223*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4224*7c478bd9Sstevel@tonic-gate 4225*7c478bd9Sstevel@tonic-gate2: 4226*7c478bd9Sstevel@tonic-gate FALIGN_D8 4227*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4228*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4229*7c478bd9Sstevel@tonic-gate membar #Sync 4230*7c478bd9Sstevel@tonic-gate FALIGN_D24 4231*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4232*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd40 4233*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4234*7c478bd9Sstevel@tonic-gate 4235*7c478bd9Sstevel@tonic-gatecopyin_seg5: 4236*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4237*7c478bd9Sstevel@tonic-gate FALIGN_D10 4238*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4239*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4240*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4241*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4242*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4243*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4244*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4245*7c478bd9Sstevel@tonic-gate FALIGN_D26 4246*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4247*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4248*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4249*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4250*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4251*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4252*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4253*7c478bd9Sstevel@tonic-gate FALIGN_D42 4254*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4255*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4256*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4257*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4258*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4259*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4260*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg5 4261*7c478bd9Sstevel@tonic-gate 4262*7c478bd9Sstevel@tonic-gate0: 4263*7c478bd9Sstevel@tonic-gate FALIGN_D26 4264*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4265*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4266*7c478bd9Sstevel@tonic-gate membar #Sync 4267*7c478bd9Sstevel@tonic-gate FALIGN_D42 4268*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4269*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd10 4270*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4271*7c478bd9Sstevel@tonic-gate 4272*7c478bd9Sstevel@tonic-gate1: 4273*7c478bd9Sstevel@tonic-gate FALIGN_D42 4274*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4275*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4276*7c478bd9Sstevel@tonic-gate membar #Sync 4277*7c478bd9Sstevel@tonic-gate FALIGN_D10 4278*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4279*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd26 4280*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4281*7c478bd9Sstevel@tonic-gate 4282*7c478bd9Sstevel@tonic-gate2: 4283*7c478bd9Sstevel@tonic-gate FALIGN_D10 4284*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4285*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4286*7c478bd9Sstevel@tonic-gate membar #Sync 4287*7c478bd9Sstevel@tonic-gate FALIGN_D26 4288*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4289*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd42 4290*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4291*7c478bd9Sstevel@tonic-gate 4292*7c478bd9Sstevel@tonic-gatecopyin_seg6: 4293*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4294*7c478bd9Sstevel@tonic-gate FALIGN_D12 4295*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4296*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4297*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4298*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4299*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4300*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4301*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4302*7c478bd9Sstevel@tonic-gate FALIGN_D28 4303*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4304*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4305*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4306*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4307*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4308*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4309*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4310*7c478bd9Sstevel@tonic-gate FALIGN_D44 4311*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4312*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4313*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4314*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4315*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4316*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4317*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg6 4318*7c478bd9Sstevel@tonic-gate 4319*7c478bd9Sstevel@tonic-gate0: 4320*7c478bd9Sstevel@tonic-gate FALIGN_D28 4321*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4322*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4323*7c478bd9Sstevel@tonic-gate membar #Sync 4324*7c478bd9Sstevel@tonic-gate FALIGN_D44 4325*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4326*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd12 4327*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4328*7c478bd9Sstevel@tonic-gate 4329*7c478bd9Sstevel@tonic-gate1: 4330*7c478bd9Sstevel@tonic-gate FALIGN_D44 4331*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4332*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4333*7c478bd9Sstevel@tonic-gate membar #Sync 4334*7c478bd9Sstevel@tonic-gate FALIGN_D12 4335*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4336*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd28 4337*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4338*7c478bd9Sstevel@tonic-gate 4339*7c478bd9Sstevel@tonic-gate2: 4340*7c478bd9Sstevel@tonic-gate FALIGN_D12 4341*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4342*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4343*7c478bd9Sstevel@tonic-gate membar #Sync 4344*7c478bd9Sstevel@tonic-gate FALIGN_D28 4345*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4346*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd44 4347*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4348*7c478bd9Sstevel@tonic-gate 4349*7c478bd9Sstevel@tonic-gatecopyin_seg7: 4350*7c478bd9Sstevel@tonic-gate ! 1st chunk - %d0 low, %d16 high, %d32 pre, %d48 dst 4351*7c478bd9Sstevel@tonic-gate FALIGN_D14 4352*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d0 4353*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4354*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4355*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4356*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 0f 4357*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4358*7c478bd9Sstevel@tonic-gate ! 2nd chunk - %d0 pre, %d16 low, %d32 high, %d48 dst 4359*7c478bd9Sstevel@tonic-gate FALIGN_D30 4360*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d16 4361*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4362*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4363*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4364*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 1f 4365*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4366*7c478bd9Sstevel@tonic-gate ! 3rd chunk - %d0 high, %d16 pre, %d32 low, %d48 dst 4367*7c478bd9Sstevel@tonic-gate FALIGN_D46 4368*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_BLK_AIUS, %d32 4369*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4370*7c478bd9Sstevel@tonic-gate add %l7, 64, %l7 4371*7c478bd9Sstevel@tonic-gate subcc %i3, 64, %i3 4372*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4373*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4374*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_seg7 4375*7c478bd9Sstevel@tonic-gate 4376*7c478bd9Sstevel@tonic-gate0: 4377*7c478bd9Sstevel@tonic-gate FALIGN_D30 4378*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4379*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4380*7c478bd9Sstevel@tonic-gate membar #Sync 4381*7c478bd9Sstevel@tonic-gate FALIGN_D46 4382*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4383*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd14 4384*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4385*7c478bd9Sstevel@tonic-gate 4386*7c478bd9Sstevel@tonic-gate1: 4387*7c478bd9Sstevel@tonic-gate FALIGN_D46 4388*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4389*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4390*7c478bd9Sstevel@tonic-gate membar #Sync 4391*7c478bd9Sstevel@tonic-gate FALIGN_D14 4392*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4393*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd30 4394*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4395*7c478bd9Sstevel@tonic-gate 4396*7c478bd9Sstevel@tonic-gate2: 4397*7c478bd9Sstevel@tonic-gate FALIGN_D14 4398*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4399*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4400*7c478bd9Sstevel@tonic-gate membar #Sync 4401*7c478bd9Sstevel@tonic-gate FALIGN_D30 4402*7c478bd9Sstevel@tonic-gate stda %d48, [%i0]ASI_BLK_P 4403*7c478bd9Sstevel@tonic-gate ba,pt %ncc, copyin_blkd46 4404*7c478bd9Sstevel@tonic-gate add %i0, 64, %i0 4405*7c478bd9Sstevel@tonic-gate 4406*7c478bd9Sstevel@tonic-gate 4407*7c478bd9Sstevel@tonic-gate ! 4408*7c478bd9Sstevel@tonic-gate ! dribble out the last partial block 4409*7c478bd9Sstevel@tonic-gate ! 4410*7c478bd9Sstevel@tonic-gatecopyin_blkd0: 4411*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4412*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4413*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d48 4414*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4415*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4416*7c478bd9Sstevel@tonic-gatecopyin_blkd2: 4417*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4418*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4419*7c478bd9Sstevel@tonic-gate faligndata %d2, %d4, %d48 4420*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4421*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4422*7c478bd9Sstevel@tonic-gatecopyin_blkd4: 4423*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4424*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4425*7c478bd9Sstevel@tonic-gate faligndata %d4, %d6, %d48 4426*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4427*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4428*7c478bd9Sstevel@tonic-gatecopyin_blkd6: 4429*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4430*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4431*7c478bd9Sstevel@tonic-gate faligndata %d6, %d8, %d48 4432*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4433*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4434*7c478bd9Sstevel@tonic-gatecopyin_blkd8: 4435*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4436*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4437*7c478bd9Sstevel@tonic-gate faligndata %d8, %d10, %d48 4438*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4439*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4440*7c478bd9Sstevel@tonic-gatecopyin_blkd10: 4441*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4442*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4443*7c478bd9Sstevel@tonic-gate faligndata %d10, %d12, %d48 4444*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4445*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4446*7c478bd9Sstevel@tonic-gatecopyin_blkd12: 4447*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4448*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4449*7c478bd9Sstevel@tonic-gate faligndata %d12, %d14, %d48 4450*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4451*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4452*7c478bd9Sstevel@tonic-gatecopyin_blkd14: 4453*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4454*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4455*7c478bd9Sstevel@tonic-gate fsrc1 %d14, %d0 4456*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_blkleft 4457*7c478bd9Sstevel@tonic-gate 4458*7c478bd9Sstevel@tonic-gatecopyin_blkd16: 4459*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4460*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4461*7c478bd9Sstevel@tonic-gate faligndata %d16, %d18, %d48 4462*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4463*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4464*7c478bd9Sstevel@tonic-gatecopyin_blkd18: 4465*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4466*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4467*7c478bd9Sstevel@tonic-gate faligndata %d18, %d20, %d48 4468*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4469*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4470*7c478bd9Sstevel@tonic-gatecopyin_blkd20: 4471*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4472*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4473*7c478bd9Sstevel@tonic-gate faligndata %d20, %d22, %d48 4474*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4475*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4476*7c478bd9Sstevel@tonic-gatecopyin_blkd22: 4477*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4478*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4479*7c478bd9Sstevel@tonic-gate faligndata %d22, %d24, %d48 4480*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4481*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4482*7c478bd9Sstevel@tonic-gatecopyin_blkd24: 4483*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4484*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4485*7c478bd9Sstevel@tonic-gate faligndata %d24, %d26, %d48 4486*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4487*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4488*7c478bd9Sstevel@tonic-gatecopyin_blkd26: 4489*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4490*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4491*7c478bd9Sstevel@tonic-gate faligndata %d26, %d28, %d48 4492*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4493*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4494*7c478bd9Sstevel@tonic-gatecopyin_blkd28: 4495*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4496*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4497*7c478bd9Sstevel@tonic-gate faligndata %d28, %d30, %d48 4498*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4499*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4500*7c478bd9Sstevel@tonic-gatecopyin_blkd30: 4501*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4502*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4503*7c478bd9Sstevel@tonic-gate fsrc1 %d30, %d0 4504*7c478bd9Sstevel@tonic-gate ba,a,pt %ncc, copyin_blkleft 4505*7c478bd9Sstevel@tonic-gatecopyin_blkd32: 4506*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4507*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4508*7c478bd9Sstevel@tonic-gate faligndata %d32, %d34, %d48 4509*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4510*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4511*7c478bd9Sstevel@tonic-gatecopyin_blkd34: 4512*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4513*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4514*7c478bd9Sstevel@tonic-gate faligndata %d34, %d36, %d48 4515*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4516*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4517*7c478bd9Sstevel@tonic-gatecopyin_blkd36: 4518*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4519*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4520*7c478bd9Sstevel@tonic-gate faligndata %d36, %d38, %d48 4521*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4522*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4523*7c478bd9Sstevel@tonic-gatecopyin_blkd38: 4524*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4525*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4526*7c478bd9Sstevel@tonic-gate faligndata %d38, %d40, %d48 4527*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4528*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4529*7c478bd9Sstevel@tonic-gatecopyin_blkd40: 4530*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4531*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4532*7c478bd9Sstevel@tonic-gate faligndata %d40, %d42, %d48 4533*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4534*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4535*7c478bd9Sstevel@tonic-gatecopyin_blkd42: 4536*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4537*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4538*7c478bd9Sstevel@tonic-gate faligndata %d42, %d44, %d48 4539*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4540*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4541*7c478bd9Sstevel@tonic-gatecopyin_blkd44: 4542*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4543*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4544*7c478bd9Sstevel@tonic-gate faligndata %d44, %d46, %d48 4545*7c478bd9Sstevel@tonic-gate std %d48, [%i0] 4546*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4547*7c478bd9Sstevel@tonic-gatecopyin_blkd46: 4548*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4549*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4550*7c478bd9Sstevel@tonic-gate fsrc1 %d46, %d0 4551*7c478bd9Sstevel@tonic-gate 4552*7c478bd9Sstevel@tonic-gatecopyin_blkleft: 4553*7c478bd9Sstevel@tonic-gate1: 4554*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_USER, %d2 4555*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 4556*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4557*7c478bd9Sstevel@tonic-gate faligndata %d0, %d2, %d8 4558*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 4559*7c478bd9Sstevel@tonic-gate blu,pn %ncc, copyin_blkdone 4560*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4561*7c478bd9Sstevel@tonic-gate ldda [%l7]ASI_USER, %d0 4562*7c478bd9Sstevel@tonic-gate add %l7, 8, %l7 4563*7c478bd9Sstevel@tonic-gate subcc %i4, 8, %i4 4564*7c478bd9Sstevel@tonic-gate faligndata %d2, %d0, %d8 4565*7c478bd9Sstevel@tonic-gate std %d8, [%i0] 4566*7c478bd9Sstevel@tonic-gate bgeu,pt %ncc, 1b 4567*7c478bd9Sstevel@tonic-gate add %i0, 8, %i0 4568*7c478bd9Sstevel@tonic-gate 4569*7c478bd9Sstevel@tonic-gatecopyin_blkdone: 4570*7c478bd9Sstevel@tonic-gate tst %i2 4571*7c478bd9Sstevel@tonic-gate bz,pt %ncc, .copyin_exit 4572*7c478bd9Sstevel@tonic-gate and %l3, 0x4, %l3 ! fprs.du = fprs.dl = 0 4573*7c478bd9Sstevel@tonic-gate 4574*7c478bd9Sstevel@tonic-gate7: lduba [%i1]ASI_USER, %i4 4575*7c478bd9Sstevel@tonic-gate inc %i1 4576*7c478bd9Sstevel@tonic-gate inc %i0 4577*7c478bd9Sstevel@tonic-gate deccc %i2 4578*7c478bd9Sstevel@tonic-gate bgu %ncc, 7b 4579*7c478bd9Sstevel@tonic-gate stb %i4, [%i0 - 1] 4580*7c478bd9Sstevel@tonic-gate 4581*7c478bd9Sstevel@tonic-gate.copyin_exit: 4582*7c478bd9Sstevel@tonic-gate membar #StoreLoad|#StoreStore 4583*7c478bd9Sstevel@tonic-gate btst FPUSED_FLAG, SAVED_LOFAULT 4584*7c478bd9Sstevel@tonic-gate bz %icc, 1f 4585*7c478bd9Sstevel@tonic-gate nop 4586*7c478bd9Sstevel@tonic-gate 4587*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_GSR_OFFSET], %o2 ! restore gsr 4588*7c478bd9Sstevel@tonic-gate wr %o2, 0, %gsr 4589*7c478bd9Sstevel@tonic-gate 4590*7c478bd9Sstevel@tonic-gate ld [%fp + STACK_BIAS - SAVED_FPRS_OFFSET], %o3 4591*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %o3 4592*7c478bd9Sstevel@tonic-gate bz %icc, 4f 4593*7c478bd9Sstevel@tonic-gate nop 4594*7c478bd9Sstevel@tonic-gate 4595*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 4596*7c478bd9Sstevel@tonic-gate membar #Sync 4597*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 257, %o2 4598*7c478bd9Sstevel@tonic-gate and %o2, -64, %o2 4599*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d0 4600*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 4601*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d16 4602*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 4603*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d32 4604*7c478bd9Sstevel@tonic-gate add %o2, 64, %o2 4605*7c478bd9Sstevel@tonic-gate ldda [%o2]ASI_BLK_P, %d48 4606*7c478bd9Sstevel@tonic-gate membar #Sync 4607*7c478bd9Sstevel@tonic-gate 4608*7c478bd9Sstevel@tonic-gate ba,pt %ncc, 1f 4609*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 4610*7c478bd9Sstevel@tonic-gate 4611*7c478bd9Sstevel@tonic-gate4: 4612*7c478bd9Sstevel@tonic-gate FZERO ! zero all of the fpregs 4613*7c478bd9Sstevel@tonic-gate wr %o3, 0, %fprs ! restore fprs 4614*7c478bd9Sstevel@tonic-gate 4615*7c478bd9Sstevel@tonic-gate1: 4616*7c478bd9Sstevel@tonic-gate andn SAVED_LOFAULT, FPUSED_FLAG, SAVED_LOFAULT 4617*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 4618*7c478bd9Sstevel@tonic-gate stn SAVED_LOFAULT, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 4619*7c478bd9Sstevel@tonic-gate ret 4620*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 4621*7c478bd9Sstevel@tonic-gate.copyin_err: 4622*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_COPYOPS], %o4 4623*7c478bd9Sstevel@tonic-gate brz %o4, 2f 4624*7c478bd9Sstevel@tonic-gate nop 4625*7c478bd9Sstevel@tonic-gate ldn [%o4 + CP_COPYIN], %g2 4626*7c478bd9Sstevel@tonic-gate jmp %g2 4627*7c478bd9Sstevel@tonic-gate nop 4628*7c478bd9Sstevel@tonic-gate2: 4629*7c478bd9Sstevel@tonic-gate retl 4630*7c478bd9Sstevel@tonic-gate mov -1, %o0 4631*7c478bd9Sstevel@tonic-gate SET_SIZE(copyin) 4632*7c478bd9Sstevel@tonic-gate 4633*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4634*7c478bd9Sstevel@tonic-gate 4635*7c478bd9Sstevel@tonic-gate#ifdef lint 4636*7c478bd9Sstevel@tonic-gate 4637*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4638*7c478bd9Sstevel@tonic-gateint 4639*7c478bd9Sstevel@tonic-gatexcopyin(const void *uaddr, void *kaddr, size_t count) 4640*7c478bd9Sstevel@tonic-gate{ return (0); } 4641*7c478bd9Sstevel@tonic-gate 4642*7c478bd9Sstevel@tonic-gate#else /* lint */ 4643*7c478bd9Sstevel@tonic-gate 4644*7c478bd9Sstevel@tonic-gate ENTRY(xcopyin) 4645*7c478bd9Sstevel@tonic-gate sethi %hi(.xcopyin_err), REAL_LOFAULT 4646*7c478bd9Sstevel@tonic-gate b .do_copyin 4647*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.xcopyin_err), REAL_LOFAULT 4648*7c478bd9Sstevel@tonic-gate.xcopyin_err: 4649*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_COPYOPS], %o4 4650*7c478bd9Sstevel@tonic-gate brz %o4, 2f 4651*7c478bd9Sstevel@tonic-gate nop 4652*7c478bd9Sstevel@tonic-gate ldn [%o4 + CP_XCOPYIN], %g2 4653*7c478bd9Sstevel@tonic-gate jmp %g2 4654*7c478bd9Sstevel@tonic-gate nop 4655*7c478bd9Sstevel@tonic-gate2: 4656*7c478bd9Sstevel@tonic-gate retl 4657*7c478bd9Sstevel@tonic-gate mov %g1, %o0 4658*7c478bd9Sstevel@tonic-gate SET_SIZE(xcopyin) 4659*7c478bd9Sstevel@tonic-gate 4660*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4661*7c478bd9Sstevel@tonic-gate 4662*7c478bd9Sstevel@tonic-gate#ifdef lint 4663*7c478bd9Sstevel@tonic-gate 4664*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4665*7c478bd9Sstevel@tonic-gateint 4666*7c478bd9Sstevel@tonic-gatexcopyin_little(const void *uaddr, void *kaddr, size_t count) 4667*7c478bd9Sstevel@tonic-gate{ return (0); } 4668*7c478bd9Sstevel@tonic-gate 4669*7c478bd9Sstevel@tonic-gate#else /* lint */ 4670*7c478bd9Sstevel@tonic-gate 4671*7c478bd9Sstevel@tonic-gate ENTRY(xcopyin_little) 4672*7c478bd9Sstevel@tonic-gate sethi %hi(.little_err), %o4 4673*7c478bd9Sstevel@tonic-gate ldn [THREAD_REG + T_LOFAULT], %o5 4674*7c478bd9Sstevel@tonic-gate or %o4, %lo(.little_err), %o4 4675*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 4676*7c478bd9Sstevel@tonic-gate stn %o4, [THREAD_REG + T_LOFAULT] 4677*7c478bd9Sstevel@tonic-gate 4678*7c478bd9Sstevel@tonic-gate subcc %g0, %o2, %o3 4679*7c478bd9Sstevel@tonic-gate add %o0, %o2, %o0 4680*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f ! check for zero bytes 4681*7c478bd9Sstevel@tonic-gate sub %o2, 1, %o4 4682*7c478bd9Sstevel@tonic-gate add %o0, %o4, %o0 ! start w/last byte 4683*7c478bd9Sstevel@tonic-gate add %o1, %o2, %o1 4684*7c478bd9Sstevel@tonic-gate lduba [%o0+%o3]ASI_AIUSL, %o4 4685*7c478bd9Sstevel@tonic-gate 4686*7c478bd9Sstevel@tonic-gate1: stb %o4, [%o1+%o3] 4687*7c478bd9Sstevel@tonic-gate inccc %o3 4688*7c478bd9Sstevel@tonic-gate sub %o0, 2, %o0 ! get next byte 4689*7c478bd9Sstevel@tonic-gate bcc,a,pt %ncc, 1b 4690*7c478bd9Sstevel@tonic-gate lduba [%o0+%o3]ASI_AIUSL, %o4 4691*7c478bd9Sstevel@tonic-gate 4692*7c478bd9Sstevel@tonic-gate2: membar #Sync ! sync error barrier 4693*7c478bd9Sstevel@tonic-gate stn %o5, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 4694*7c478bd9Sstevel@tonic-gate retl 4695*7c478bd9Sstevel@tonic-gate mov %g0, %o0 ! return (0) 4696*7c478bd9Sstevel@tonic-gate 4697*7c478bd9Sstevel@tonic-gate.little_err: 4698*7c478bd9Sstevel@tonic-gate membar #Sync ! sync error barrier 4699*7c478bd9Sstevel@tonic-gate stn %o5, [THREAD_REG + T_LOFAULT] ! restore old t_lofault 4700*7c478bd9Sstevel@tonic-gate retl 4701*7c478bd9Sstevel@tonic-gate mov %g1, %o0 4702*7c478bd9Sstevel@tonic-gate SET_SIZE(xcopyin_little) 4703*7c478bd9Sstevel@tonic-gate 4704*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4705*7c478bd9Sstevel@tonic-gate 4706*7c478bd9Sstevel@tonic-gate 4707*7c478bd9Sstevel@tonic-gate/* 4708*7c478bd9Sstevel@tonic-gate * Copy a block of storage - must not overlap (from + len <= to). 4709*7c478bd9Sstevel@tonic-gate * No fault handler installed (to be called under on_fault()) 4710*7c478bd9Sstevel@tonic-gate */ 4711*7c478bd9Sstevel@tonic-gate#if defined(lint) 4712*7c478bd9Sstevel@tonic-gate 4713*7c478bd9Sstevel@tonic-gate/* ARGSUSED */ 4714*7c478bd9Sstevel@tonic-gatevoid 4715*7c478bd9Sstevel@tonic-gatecopyin_noerr(const void *ufrom, void *kto, size_t count) 4716*7c478bd9Sstevel@tonic-gate{} 4717*7c478bd9Sstevel@tonic-gate 4718*7c478bd9Sstevel@tonic-gate#else /* lint */ 4719*7c478bd9Sstevel@tonic-gate 4720*7c478bd9Sstevel@tonic-gate ENTRY(copyin_noerr) 4721*7c478bd9Sstevel@tonic-gate sethi %hi(.copyio_noerr), REAL_LOFAULT 4722*7c478bd9Sstevel@tonic-gate b .do_copyin 4723*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT 4724*7c478bd9Sstevel@tonic-gate.copyio_noerr: 4725*7c478bd9Sstevel@tonic-gate jmp SAVED_LOFAULT 4726*7c478bd9Sstevel@tonic-gate nop 4727*7c478bd9Sstevel@tonic-gate SET_SIZE(copyin_noerr) 4728*7c478bd9Sstevel@tonic-gate 4729*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4730*7c478bd9Sstevel@tonic-gate 4731*7c478bd9Sstevel@tonic-gate/* 4732*7c478bd9Sstevel@tonic-gate * Copy a block of storage - must not overlap (from + len <= to). 4733*7c478bd9Sstevel@tonic-gate * No fault handler installed (to be called under on_fault()) 4734*7c478bd9Sstevel@tonic-gate */ 4735*7c478bd9Sstevel@tonic-gate 4736*7c478bd9Sstevel@tonic-gate#if defined(lint) 4737*7c478bd9Sstevel@tonic-gate 4738*7c478bd9Sstevel@tonic-gate/* ARGSUSED */ 4739*7c478bd9Sstevel@tonic-gatevoid 4740*7c478bd9Sstevel@tonic-gatecopyout_noerr(const void *kfrom, void *uto, size_t count) 4741*7c478bd9Sstevel@tonic-gate{} 4742*7c478bd9Sstevel@tonic-gate 4743*7c478bd9Sstevel@tonic-gate#else /* lint */ 4744*7c478bd9Sstevel@tonic-gate 4745*7c478bd9Sstevel@tonic-gate ENTRY(copyout_noerr) 4746*7c478bd9Sstevel@tonic-gate sethi %hi(.copyio_noerr), REAL_LOFAULT 4747*7c478bd9Sstevel@tonic-gate b .do_copyout 4748*7c478bd9Sstevel@tonic-gate or REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT 4749*7c478bd9Sstevel@tonic-gate SET_SIZE(copyout_noerr) 4750*7c478bd9Sstevel@tonic-gate 4751*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4752*7c478bd9Sstevel@tonic-gate 4753*7c478bd9Sstevel@tonic-gate#if defined(lint) 4754*7c478bd9Sstevel@tonic-gate 4755*7c478bd9Sstevel@tonic-gateint use_hw_bcopy = 1; 4756*7c478bd9Sstevel@tonic-gateint use_hw_copyio = 1; 4757*7c478bd9Sstevel@tonic-gateint use_hw_bzero = 1; 4758*7c478bd9Sstevel@tonic-gateuint_t hw_copy_limit_1 = 0; 4759*7c478bd9Sstevel@tonic-gateuint_t hw_copy_limit_2 = 0; 4760*7c478bd9Sstevel@tonic-gateuint_t hw_copy_limit_4 = 0; 4761*7c478bd9Sstevel@tonic-gateuint_t hw_copy_limit_8 = 0; 4762*7c478bd9Sstevel@tonic-gate 4763*7c478bd9Sstevel@tonic-gate#else /* !lint */ 4764*7c478bd9Sstevel@tonic-gate 4765*7c478bd9Sstevel@tonic-gate .align 4 4766*7c478bd9Sstevel@tonic-gate DGDEF(use_hw_bcopy) 4767*7c478bd9Sstevel@tonic-gate .word 1 4768*7c478bd9Sstevel@tonic-gate DGDEF(use_hw_copyio) 4769*7c478bd9Sstevel@tonic-gate .word 1 4770*7c478bd9Sstevel@tonic-gate DGDEF(use_hw_bzero) 4771*7c478bd9Sstevel@tonic-gate .word 1 4772*7c478bd9Sstevel@tonic-gate DGDEF(hw_copy_limit_1) 4773*7c478bd9Sstevel@tonic-gate .word 0 4774*7c478bd9Sstevel@tonic-gate DGDEF(hw_copy_limit_2) 4775*7c478bd9Sstevel@tonic-gate .word 0 4776*7c478bd9Sstevel@tonic-gate DGDEF(hw_copy_limit_4) 4777*7c478bd9Sstevel@tonic-gate .word 0 4778*7c478bd9Sstevel@tonic-gate DGDEF(hw_copy_limit_8) 4779*7c478bd9Sstevel@tonic-gate .word 0 4780*7c478bd9Sstevel@tonic-gate 4781*7c478bd9Sstevel@tonic-gate .align 64 4782*7c478bd9Sstevel@tonic-gate .section ".text" 4783*7c478bd9Sstevel@tonic-gate#endif /* !lint */ 4784*7c478bd9Sstevel@tonic-gate 4785*7c478bd9Sstevel@tonic-gate 4786*7c478bd9Sstevel@tonic-gate/* 4787*7c478bd9Sstevel@tonic-gate * hwblkclr - clears block-aligned, block-multiple-sized regions that are 4788*7c478bd9Sstevel@tonic-gate * longer than 256 bytes in length using spitfire's block stores. If 4789*7c478bd9Sstevel@tonic-gate * the criteria for using this routine are not met then it calls bzero 4790*7c478bd9Sstevel@tonic-gate * and returns 1. Otherwise 0 is returned indicating success. 4791*7c478bd9Sstevel@tonic-gate * Caller is responsible for ensuring use_hw_bzero is true and that 4792*7c478bd9Sstevel@tonic-gate * kpreempt_disable() has been called. 4793*7c478bd9Sstevel@tonic-gate */ 4794*7c478bd9Sstevel@tonic-gate#ifdef lint 4795*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4796*7c478bd9Sstevel@tonic-gateint 4797*7c478bd9Sstevel@tonic-gatehwblkclr(void *addr, size_t len) 4798*7c478bd9Sstevel@tonic-gate{ 4799*7c478bd9Sstevel@tonic-gate return(0); 4800*7c478bd9Sstevel@tonic-gate} 4801*7c478bd9Sstevel@tonic-gate#else /* lint */ 4802*7c478bd9Sstevel@tonic-gate ! %i0 - start address 4803*7c478bd9Sstevel@tonic-gate ! %i1 - length of region (multiple of 64) 4804*7c478bd9Sstevel@tonic-gate ! %l0 - saved fprs 4805*7c478bd9Sstevel@tonic-gate ! %l1 - pointer to saved %d0 block 4806*7c478bd9Sstevel@tonic-gate ! %l2 - saved curthread->t_lwp 4807*7c478bd9Sstevel@tonic-gate 4808*7c478bd9Sstevel@tonic-gate ENTRY(hwblkclr) 4809*7c478bd9Sstevel@tonic-gate ! get another window w/space for one aligned block of saved fpregs 4810*7c478bd9Sstevel@tonic-gate save %sp, -SA(MINFRAME + 2*64), %sp 4811*7c478bd9Sstevel@tonic-gate 4812*7c478bd9Sstevel@tonic-gate ! Must be block-aligned 4813*7c478bd9Sstevel@tonic-gate andcc %i0, (64-1), %g0 4814*7c478bd9Sstevel@tonic-gate bnz,pn %ncc, 1f 4815*7c478bd9Sstevel@tonic-gate nop 4816*7c478bd9Sstevel@tonic-gate 4817*7c478bd9Sstevel@tonic-gate ! ... and must be 256 bytes or more 4818*7c478bd9Sstevel@tonic-gate cmp %i1, 256 4819*7c478bd9Sstevel@tonic-gate blu,pn %ncc, 1f 4820*7c478bd9Sstevel@tonic-gate nop 4821*7c478bd9Sstevel@tonic-gate 4822*7c478bd9Sstevel@tonic-gate ! ... and length must be a multiple of 64 4823*7c478bd9Sstevel@tonic-gate andcc %i1, (64-1), %g0 4824*7c478bd9Sstevel@tonic-gate bz,pn %ncc, 2f 4825*7c478bd9Sstevel@tonic-gate nop 4826*7c478bd9Sstevel@tonic-gate 4827*7c478bd9Sstevel@tonic-gate1: ! punt, call bzero but notify the caller that bzero was used 4828*7c478bd9Sstevel@tonic-gate mov %i0, %o0 4829*7c478bd9Sstevel@tonic-gate call bzero 4830*7c478bd9Sstevel@tonic-gate mov %i1, %o1 4831*7c478bd9Sstevel@tonic-gate ret 4832*7c478bd9Sstevel@tonic-gate restore %g0, 1, %o0 ! return (1) - did not use block operations 4833*7c478bd9Sstevel@tonic-gate 4834*7c478bd9Sstevel@tonic-gate2: rd %fprs, %l0 ! check for unused fp 4835*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %l0 4836*7c478bd9Sstevel@tonic-gate bz 1f 4837*7c478bd9Sstevel@tonic-gate nop 4838*7c478bd9Sstevel@tonic-gate 4839*7c478bd9Sstevel@tonic-gate ! save in-use fpregs on stack 4840*7c478bd9Sstevel@tonic-gate membar #Sync 4841*7c478bd9Sstevel@tonic-gate add %fp, STACK_BIAS - 65, %l1 4842*7c478bd9Sstevel@tonic-gate and %l1, -64, %l1 4843*7c478bd9Sstevel@tonic-gate stda %d0, [%l1]ASI_BLK_P 4844*7c478bd9Sstevel@tonic-gate 4845*7c478bd9Sstevel@tonic-gate1: membar #StoreStore|#StoreLoad|#LoadStore 4846*7c478bd9Sstevel@tonic-gate wr %g0, FPRS_FEF, %fprs 4847*7c478bd9Sstevel@tonic-gate wr %g0, ASI_BLK_P, %asi 4848*7c478bd9Sstevel@tonic-gate 4849*7c478bd9Sstevel@tonic-gate ! Clear block 4850*7c478bd9Sstevel@tonic-gate fzero %d0 4851*7c478bd9Sstevel@tonic-gate fzero %d2 4852*7c478bd9Sstevel@tonic-gate fzero %d4 4853*7c478bd9Sstevel@tonic-gate fzero %d6 4854*7c478bd9Sstevel@tonic-gate fzero %d8 4855*7c478bd9Sstevel@tonic-gate fzero %d10 4856*7c478bd9Sstevel@tonic-gate fzero %d12 4857*7c478bd9Sstevel@tonic-gate fzero %d14 4858*7c478bd9Sstevel@tonic-gate 4859*7c478bd9Sstevel@tonic-gate mov 256, %i3 4860*7c478bd9Sstevel@tonic-gate ba .pz_doblock 4861*7c478bd9Sstevel@tonic-gate nop 4862*7c478bd9Sstevel@tonic-gate 4863*7c478bd9Sstevel@tonic-gate.pz_blkstart: 4864*7c478bd9Sstevel@tonic-gate ! stda %d0, [%i0+192]%asi ! in dly slot of branch that got us here 4865*7c478bd9Sstevel@tonic-gate stda %d0, [%i0+128]%asi 4866*7c478bd9Sstevel@tonic-gate stda %d0, [%i0+64]%asi 4867*7c478bd9Sstevel@tonic-gate stda %d0, [%i0]%asi 4868*7c478bd9Sstevel@tonic-gate.pz_zinst: 4869*7c478bd9Sstevel@tonic-gate add %i0, %i3, %i0 4870*7c478bd9Sstevel@tonic-gate sub %i1, %i3, %i1 4871*7c478bd9Sstevel@tonic-gate.pz_doblock: 4872*7c478bd9Sstevel@tonic-gate cmp %i1, 256 4873*7c478bd9Sstevel@tonic-gate bgeu,a %ncc, .pz_blkstart 4874*7c478bd9Sstevel@tonic-gate stda %d0, [%i0+192]%asi 4875*7c478bd9Sstevel@tonic-gate 4876*7c478bd9Sstevel@tonic-gate cmp %i1, 64 4877*7c478bd9Sstevel@tonic-gate blu %ncc, .pz_finish 4878*7c478bd9Sstevel@tonic-gate 4879*7c478bd9Sstevel@tonic-gate andn %i1, (64-1), %i3 4880*7c478bd9Sstevel@tonic-gate srl %i3, 4, %i2 ! using blocks, 1 instr / 16 words 4881*7c478bd9Sstevel@tonic-gate set .pz_zinst, %i4 4882*7c478bd9Sstevel@tonic-gate sub %i4, %i2, %i4 4883*7c478bd9Sstevel@tonic-gate jmp %i4 4884*7c478bd9Sstevel@tonic-gate nop 4885*7c478bd9Sstevel@tonic-gate 4886*7c478bd9Sstevel@tonic-gate.pz_finish: 4887*7c478bd9Sstevel@tonic-gate membar #Sync 4888*7c478bd9Sstevel@tonic-gate btst FPRS_FEF, %l0 4889*7c478bd9Sstevel@tonic-gate bz,a .pz_finished 4890*7c478bd9Sstevel@tonic-gate wr %l0, 0, %fprs ! restore fprs 4891*7c478bd9Sstevel@tonic-gate 4892*7c478bd9Sstevel@tonic-gate ! restore fpregs from stack 4893*7c478bd9Sstevel@tonic-gate ldda [%l1]ASI_BLK_P, %d0 4894*7c478bd9Sstevel@tonic-gate membar #Sync 4895*7c478bd9Sstevel@tonic-gate wr %l0, 0, %fprs ! restore fprs 4896*7c478bd9Sstevel@tonic-gate 4897*7c478bd9Sstevel@tonic-gate.pz_finished: 4898*7c478bd9Sstevel@tonic-gate ret 4899*7c478bd9Sstevel@tonic-gate restore %g0, 0, %o0 ! return (bzero or not) 4900*7c478bd9Sstevel@tonic-gate SET_SIZE(hwblkclr) 4901*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4902*7c478bd9Sstevel@tonic-gate 4903*7c478bd9Sstevel@tonic-gate#ifdef lint 4904*7c478bd9Sstevel@tonic-gate/* Copy 32 bytes of data from src to dst using physical addresses */ 4905*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 4906*7c478bd9Sstevel@tonic-gatevoid 4907*7c478bd9Sstevel@tonic-gatehw_pa_bcopy32(uint64_t src, uint64_t dst) 4908*7c478bd9Sstevel@tonic-gate{} 4909*7c478bd9Sstevel@tonic-gate#else /*!lint */ 4910*7c478bd9Sstevel@tonic-gate 4911*7c478bd9Sstevel@tonic-gate /* 4912*7c478bd9Sstevel@tonic-gate * Copy 32 bytes of data from src (%o0) to dst (%o1) 4913*7c478bd9Sstevel@tonic-gate * using physical addresses. 4914*7c478bd9Sstevel@tonic-gate */ 4915*7c478bd9Sstevel@tonic-gate ENTRY_NP(hw_pa_bcopy32) 4916*7c478bd9Sstevel@tonic-gate rdpr %pstate, %g1 4917*7c478bd9Sstevel@tonic-gate andn %g1, PSTATE_IE, %g2 4918*7c478bd9Sstevel@tonic-gate wrpr %g0, %g2, %pstate 4919*7c478bd9Sstevel@tonic-gate 4920*7c478bd9Sstevel@tonic-gate ldxa [%o0]ASI_MEM, %o2 4921*7c478bd9Sstevel@tonic-gate add %o0, 8, %o0 4922*7c478bd9Sstevel@tonic-gate ldxa [%o0]ASI_MEM, %o3 4923*7c478bd9Sstevel@tonic-gate add %o0, 8, %o0 4924*7c478bd9Sstevel@tonic-gate ldxa [%o0]ASI_MEM, %o4 4925*7c478bd9Sstevel@tonic-gate add %o0, 8, %o0 4926*7c478bd9Sstevel@tonic-gate ldxa [%o0]ASI_MEM, %o5 4927*7c478bd9Sstevel@tonic-gate stxa %o2, [%o1]ASI_MEM 4928*7c478bd9Sstevel@tonic-gate add %o1, 8, %o1 4929*7c478bd9Sstevel@tonic-gate stxa %o3, [%o1]ASI_MEM 4930*7c478bd9Sstevel@tonic-gate add %o1, 8, %o1 4931*7c478bd9Sstevel@tonic-gate stxa %o4, [%o1]ASI_MEM 4932*7c478bd9Sstevel@tonic-gate add %o1, 8, %o1 4933*7c478bd9Sstevel@tonic-gate stxa %o5, [%o1]ASI_MEM 4934*7c478bd9Sstevel@tonic-gate 4935*7c478bd9Sstevel@tonic-gate membar #Sync 4936*7c478bd9Sstevel@tonic-gate retl 4937*7c478bd9Sstevel@tonic-gate wrpr %g0, %g1, %pstate 4938*7c478bd9Sstevel@tonic-gate SET_SIZE(hw_pa_bcopy32) 4939*7c478bd9Sstevel@tonic-gate#endif /* lint */ 4940