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