* better
[mascara-docs.git] / i386 / linux-2.3.21 / arch / sparc64 / lib / VIS.h
blob9d93a70e7081f00ed10f725bc0060544bf57012e
1 /* $Id: VIS.h,v 1.4 1999/05/25 16:52:50 jj Exp $
2 * VIS.h: High speed copy/clear operations utilizing the UltraSparc
3 * Visual Instruction Set.
5 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1996, 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
7 */
9 /* VIS code can be used for numerous copy/set operation variants.
10 * It can be made to work in the kernel, one single instance,
11 * for all of memcpy, copy_to_user, and copy_from_user by setting
12 * the ASI src/dest globals correctly. Furthermore it can
13 * be used for kernel-->kernel page copies as well, a hook label
14 * is put in here just for this purpose.
16 * For userland, compiling this without __KERNEL__ defined makes
17 * it work just fine as a generic libc bcopy and memcpy.
18 * If for userland it is compiled with a 32bit gcc (but you need
19 * -Wa,-Av9a), the code will just rely on lower 32bits of
20 * IEU registers, if you compile it with 64bit gcc (ie. define
21 * __sparc_v9__), the code will use full 64bit.
24 #ifndef __VIS_H
25 #define __VIS_H
27 #ifdef __KERNEL__
28 #include <asm/head.h>
29 #include <asm/asi.h>
30 #else
31 #define ASI_AIUS 0x11 /* Secondary, user */
32 #define ASI_BLK_AIUS 0x71 /* Secondary, user, blk ld/st */
33 #define ASI_P 0x80 /* Primary, implicit */
34 #define ASI_S 0x81 /* Secondary, implicit */
35 #define ASI_BLK_COMMIT_P 0xe0 /* Primary, blk store commit */
36 #define ASI_BLK_COMMIT_S 0xe1 /* Secondary, blk store commit */
37 #define ASI_BLK_P 0xf0 /* Primary, blk ld/st */
38 #define ASI_BLK_S 0xf1 /* Secondary, blk ld/st */
39 #define FPRS_FEF 0x04
40 #endif
42 /* I'm telling you, they really did this chip right.
43 * Perhaps the SunSoft folks should visit some of the
44 * people in Sun Microelectronics and start some brain
45 * cell exchange program...
47 #define ASI_BLK_XOR (ASI_P ^ ASI_BLK_P)
48 /* Well, things get more hairy if we use ASI_AIUS as
49 * USER_DS and ASI_P as KERNEL_DS, we'd reach
50 * commit block stores this way which is not what we want...
52 /* ASI_P->ASI_BLK_P && ASI_AIUS->ASI_BLK_AIUS transitions can be done
53 * as blkasi = asi | ASI_BLK_OR
55 #define ASI_BLK_OR (ASI_BLK_P & ~ASI_P)
56 /* Transition back from ASI_BLK_P->ASI_P && ASI_BLK_AIUS->ASI_AIUS is
57 * more complicated:
58 * asi = blkasi ^ (blkasi >> 3) ^ ASI_BLK_XOR1
60 #define ASI_BLK_XOR1 (ASI_BLK_P ^ (ASI_BLK_P >> 3) ^ ASI_P)
62 #define asi_src %o3
63 #define asi_dest %o4
65 #ifdef __KERNEL__
66 #define ASI_SETSRC_BLK wr asi_src, 0, %asi;
67 #define ASI_SETSRC_NOBLK wr asi_src, 0, %asi;
68 #define ASI_SETDST_BLK wr asi_dest, 0, %asi;
69 #define ASI_SETDST_NOBLK wr asi_dest, 0, %asi;
70 #define ASIBLK %asi
71 #define ASINORMAL %asi
72 #define LDUB lduba
73 #define LDUH lduha
74 #define LDUW lduwa
75 #define LDX ldxa
76 #define LDD ldda
77 #define LDDF ldda
78 #define LDBLK ldda
79 #define STB stba
80 #define STH stha
81 #define STW stwa
82 #define STD stda
83 #define STX stxa
84 #define STDF stda
85 #define STBLK stda
86 #else
87 #define ASI_SETSRC_BLK
88 #define ASI_SETSRC_NOBLK
89 #define ASI_SETDST_BLK
90 #define ASI_SETDST_NOBLK
91 #define ASI_SETDST_SPECIAL
92 #define ASIBLK %asi
93 #define ASINORMAL
94 #define LDUB ldub
95 #define LDUH lduh
96 #define LDUW lduw
97 #define LDD ldd
98 #define LDX ldx
99 #define LDDF ldd
100 #define LDBLK ldda
101 #define STB stb
102 #define STH sth
103 #define STW stw
104 #define STD std
105 #define STX stx
106 #define STDF std
107 #define STBLK stda
108 #endif
110 #ifdef __KERNEL__
112 #define REGS_64BIT
114 #else
116 #ifndef REGS_64BIT
117 #ifdef __sparc_v9__
118 #define REGS_64BIT
119 #endif
120 #endif
122 #endif
124 #ifndef REGS_64BIT
125 #define xcc icc
126 #endif
128 #endif