129949e86Sstevel/* 229949e86Sstevel * CDDL HEADER START 329949e86Sstevel * 429949e86Sstevel * The contents of this file are subject to the terms of the 529949e86Sstevel * Common Development and Distribution License (the "License"). 629949e86Sstevel * You may not use this file except in compliance with the License. 729949e86Sstevel * 829949e86Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 929949e86Sstevel * or http://www.opensolaris.org/os/licensing. 1029949e86Sstevel * See the License for the specific language governing permissions 1129949e86Sstevel * and limitations under the License. 1229949e86Sstevel * 1329949e86Sstevel * When distributing Covered Code, include this CDDL HEADER in each 1429949e86Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1529949e86Sstevel * If applicable, add the following below this CDDL HEADER, with the 1629949e86Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 1729949e86Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 1829949e86Sstevel * 1929949e86Sstevel * CDDL HEADER END 2029949e86Sstevel */ 2129949e86Sstevel 2229949e86Sstevel/* 2329949e86Sstevel * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 2429949e86Sstevel * Use is subject to license terms. 2529949e86Sstevel */ 2629949e86Sstevel 2729949e86Sstevel#include <sys/param.h> 2829949e86Sstevel#include <sys/errno.h> 2929949e86Sstevel#include <sys/asm_linkage.h> 3029949e86Sstevel#include <sys/vtrace.h> 3129949e86Sstevel#include <sys/machthread.h> 3229949e86Sstevel#include <sys/clock.h> 3329949e86Sstevel#include <sys/asi.h> 3429949e86Sstevel#include <sys/fsr.h> 3529949e86Sstevel#include <sys/privregs.h> 3629949e86Sstevel#include <sys/pte.h> 3729949e86Sstevel#include <sys/mmu.h> 3829949e86Sstevel#include <sys/spitregs.h> 3929949e86Sstevel 4029949e86Sstevel#include "assym.h" 4129949e86Sstevel 4229949e86Sstevel#define TT_HSM 0x99 4329949e86Sstevel 4429949e86Sstevel! 4529949e86Sstevel! Move a single cache line of data. Survive UE and CE on the read 4629949e86Sstevel! 4729949e86Sstevel! i0 = src va 4829949e86Sstevel! i1 = dst va 4929949e86Sstevel! i2 = line count 5029949e86Sstevel! i3 = line size 5129949e86Sstevel! i4 = cache of fpu state 5229949e86Sstevel! 5329949e86Sstevel ENTRY(ac_blkcopy) 5429949e86Sstevel 5529949e86Sstevel ! TODO: can we safely SAVE here 5629949e86Sstevel save %sp, -SA(MINFRAME + 2*64), %sp 5729949e86Sstevel 5829949e86Sstevel ! XXX do we need to save the state of the fpu? 5929949e86Sstevel rd %fprs, %i4 6029949e86Sstevel btst (FPRS_DU|FPRS_DL|FPRS_FEF), %i4 6129949e86Sstevel 6229949e86Sstevel ! always enable FPU 6329949e86Sstevel wr %g0, FPRS_FEF, %fprs 6429949e86Sstevel 6529949e86Sstevel bz,a 1f 6629949e86Sstevel nop 6729949e86Sstevel 6829949e86Sstevel ! save in-use fpregs on stack 6929949e86Sstevel membar #Sync 7029949e86Sstevel add %fp, STACK_BIAS - 81, %o2 7129949e86Sstevel and %o2, -64, %o2 7229949e86Sstevel stda %d0, [%o2]ASI_BLK_P 7329949e86Sstevel membar #Sync 7429949e86Sstevel 7529949e86Sstevel1: 7629949e86Sstevel brz,pn %i2, 2f ! while (linecount) { 7729949e86Sstevel nop 7829949e86Sstevel ldda [%i0]ASI_BLK_P, %d0 ! *dst = *src; 7929949e86Sstevel membar #Sync 8029949e86Sstevel stda %d0, [%i1]ASI_BLK_COMMIT_P 8129949e86Sstevel membar #Sync 8229949e86Sstevel 8329949e86Sstevel add %i0, %i3, %i0 ! dst++, src++; 8429949e86Sstevel add %i1, %i3, %i1 8529949e86Sstevel 8629949e86Sstevel ba 1b ! linecount-- } 8729949e86Sstevel dec %i2 8829949e86Sstevel 8929949e86Sstevel2: 9029949e86Sstevel membar #Sync 9129949e86Sstevel 9229949e86Sstevel ! restore fp to the way we got it 9329949e86Sstevel btst (FPRS_DU|FPRS_DL|FPRS_FEF), %i4 9429949e86Sstevel bz,a 3f 9529949e86Sstevel nop 9629949e86Sstevel 9729949e86Sstevel ! restore fpregs from stack 9829949e86Sstevel add %fp, STACK_BIAS - 81, %o2 9929949e86Sstevel and %o2, -64, %o2 10029949e86Sstevel ldda [%o2]ASI_BLK_P, %d0 10129949e86Sstevel membar #Sync 10229949e86Sstevel 10329949e86Sstevel3: 10429949e86Sstevel wr %g0, %i4, %fprs ! fpu back to the way it was 10529949e86Sstevel ret 10629949e86Sstevel restore 10729949e86Sstevel SET_SIZE(ac_blkcopy) 108