locore.h revision 1.3.6.2 1 /* $NetBSD: locore.h,v 1.3.6.2 2010/04/30 14:39:52 uebayasi Exp $ */
2
3 /*
4 * Copyright (c) 1996-2002 Eduardo Horvath
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 */
26
27 #undef CURLWP
28 #undef CPCB
29 #undef FPLWP
30
31 #define CURLWP (CPUINFO_VA + CI_CURLWP)
32 #define CPCB (CPUINFO_VA + CI_CPCB)
33 #define FPLWP (CPUINFO_VA + CI_FPLWP)
34
35 /*
36 * Here are some defines to try to maintain consistency but still
37 * support 32-and 64-bit compilers.
38 */
39 #ifdef _LP64
40 /* reg that points to base of data/text segment */
41 #define BASEREG %g4
42 /* first constants for storage allocation */
43 #define LNGSZ 8
44 #define LNGSHFT 3
45 #define PTRSZ 8
46 #define PTRSHFT 3
47 #define POINTER .xword
48 #define ULONG .xword
49 /* Now instructions to load/store pointers & long ints */
50 #define LDLNG ldx
51 #define LDULNG ldx
52 #define STLNG stx
53 #define STULNG stx
54 #define LDPTR ldx
55 #define LDPTRA ldxa
56 #define STPTR stx
57 #define STPTRA stxa
58 #define CASPTR casxa
59 /* Now something to calculate the stack bias */
60 #define STKB BIAS
61 #define CCCR %xcc
62 #else
63 #define BASEREG %g0
64 #define LNGSZ 4
65 #define LNGSHFT 2
66 #define PTRSZ 4
67 #define PTRSHFT 2
68 #define POINTER .word
69 #define ULONG .word
70 /* Instructions to load/store pointers & long ints */
71 #define LDLNG ldsw
72 #define LDULNG lduw
73 #define STLNG stw
74 #define STULNG stw
75 #define LDPTR lduw
76 #define LDPTRA lduwa
77 #define STPTR stw
78 #define STPTRA stwa
79 #define CASPTR casa
80 #define STKB 0
81 #define CCCR %icc
82 #endif
83
84 /* Give this real authority: reset the machine */
85 #define NOTREACHED sir
86
87 /* if < 32, copy by bytes, memcpy, kcopy, ... */
88 #define BCOPY_SMALL 32
89
90 /* use as needed to align things on longword boundaries */
91 #define _ALIGN .align 8
92 #define ICACHE_ALIGN .align 32
93