1*1341Sstevel/* 2*1341Sstevel * CDDL HEADER START 3*1341Sstevel * 4*1341Sstevel * The contents of this file are subject to the terms of the 5*1341Sstevel * Common Development and Distribution License (the "License"). 6*1341Sstevel * You may not use this file except in compliance with the License. 7*1341Sstevel * 8*1341Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1341Sstevel * or http://www.opensolaris.org/os/licensing. 10*1341Sstevel * See the License for the specific language governing permissions 11*1341Sstevel * and limitations under the License. 12*1341Sstevel * 13*1341Sstevel * When distributing Covered Code, include this CDDL HEADER in each 14*1341Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1341Sstevel * If applicable, add the following below this CDDL HEADER, with the 16*1341Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 17*1341Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 18*1341Sstevel * 19*1341Sstevel * CDDL HEADER END 20*1341Sstevel */ 21*1341Sstevel 22*1341Sstevel/* 23*1341Sstevel * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 24*1341Sstevel * Use is subject to license terms. 25*1341Sstevel */ 26*1341Sstevel 27*1341Sstevel#pragma ident "%Z%%M% %I% %E% SMI" 28*1341Sstevel 29*1341Sstevel#include <sys/param.h> 30*1341Sstevel#include <sys/errno.h> 31*1341Sstevel#include <sys/asm_linkage.h> 32*1341Sstevel#include <sys/vtrace.h> 33*1341Sstevel#include <sys/machthread.h> 34*1341Sstevel#include <sys/clock.h> 35*1341Sstevel#include <sys/asi.h> 36*1341Sstevel#include <sys/fsr.h> 37*1341Sstevel#include <sys/privregs.h> 38*1341Sstevel#include <sys/pte.h> 39*1341Sstevel#include <sys/mmu.h> 40*1341Sstevel#include <sys/spitregs.h> 41*1341Sstevel 42*1341Sstevel#if defined(lint) 43*1341Sstevel 44*1341Sstevel#else /* lint */ 45*1341Sstevel#include "assym.h" 46*1341Sstevel#endif /* lint */ 47*1341Sstevel 48*1341Sstevel#define TT_HSM 0x99 49*1341Sstevel 50*1341Sstevel#if defined(lint) 51*1341Sstevel/* ARGSUSED */ 52*1341Sstevelvoid 53*1341Sstevelac_blkcopy(caddr_t src, caddr_t dst, u_int linecount, u_int linesize) 54*1341Sstevel{} 55*1341Sstevel#else /* !lint */ 56*1341Sstevel! 57*1341Sstevel! Move a single cache line of data. Survive UE and CE on the read 58*1341Sstevel! 59*1341Sstevel! i0 = src va 60*1341Sstevel! i1 = dst va 61*1341Sstevel! i2 = line count 62*1341Sstevel! i3 = line size 63*1341Sstevel! i4 = cache of fpu state 64*1341Sstevel! 65*1341Sstevel ENTRY(ac_blkcopy) 66*1341Sstevel 67*1341Sstevel ! TODO: can we safely SAVE here 68*1341Sstevel save %sp, -SA(MINFRAME + 2*64), %sp 69*1341Sstevel 70*1341Sstevel ! XXX do we need to save the state of the fpu? 71*1341Sstevel rd %fprs, %i4 72*1341Sstevel btst (FPRS_DU|FPRS_DL|FPRS_FEF), %i4 73*1341Sstevel 74*1341Sstevel ! always enable FPU 75*1341Sstevel wr %g0, FPRS_FEF, %fprs 76*1341Sstevel 77*1341Sstevel bz,a 1f 78*1341Sstevel nop 79*1341Sstevel 80*1341Sstevel ! save in-use fpregs on stack 81*1341Sstevel membar #Sync 82*1341Sstevel add %fp, STACK_BIAS - 81, %o2 83*1341Sstevel and %o2, -64, %o2 84*1341Sstevel stda %d0, [%o2]ASI_BLK_P 85*1341Sstevel membar #Sync 86*1341Sstevel 87*1341Sstevel1: 88*1341Sstevel brz,pn %i2, 2f ! while (linecount) { 89*1341Sstevel nop 90*1341Sstevel ldda [%i0]ASI_BLK_P, %d0 ! *dst = *src; 91*1341Sstevel membar #Sync 92*1341Sstevel stda %d0, [%i1]ASI_BLK_COMMIT_P 93*1341Sstevel membar #Sync 94*1341Sstevel 95*1341Sstevel add %i0, %i3, %i0 ! dst++, src++; 96*1341Sstevel add %i1, %i3, %i1 97*1341Sstevel 98*1341Sstevel ba 1b ! linecount-- } 99*1341Sstevel dec %i2 100*1341Sstevel 101*1341Sstevel2: 102*1341Sstevel membar #Sync 103*1341Sstevel 104*1341Sstevel ! restore fp to the way we got it 105*1341Sstevel btst (FPRS_DU|FPRS_DL|FPRS_FEF), %i4 106*1341Sstevel bz,a 3f 107*1341Sstevel nop 108*1341Sstevel 109*1341Sstevel ! restore fpregs from stack 110*1341Sstevel add %fp, STACK_BIAS - 81, %o2 111*1341Sstevel and %o2, -64, %o2 112*1341Sstevel ldda [%o2]ASI_BLK_P, %d0 113*1341Sstevel membar #Sync 114*1341Sstevel 115*1341Sstevel3: 116*1341Sstevel wr %g0, %i4, %fprs ! fpu back to the way it was 117*1341Sstevel ret 118*1341Sstevel restore 119*1341Sstevel SET_SIZE(ac_blkcopy) 120*1341Sstevel#endif /* lint */ 121