Home | History | Annotate | Line # | Download | only in include
asm.h revision 1.21.12.1
      1  1.21.12.1     skrll /*       $NetBSD: asm.h,v 1.21.12.1 2015/12/27 12:09:43 skrll Exp $        */
      2        1.1       eeh 
      3       1.19       mrg #include <sparc/asm.h>
      4       1.20  christos 
      5       1.20  christos /*
      6       1.20  christos  * Here are some defines to try to maintain consistency but still
      7       1.20  christos  * support 32-and 64-bit compilers.
      8       1.20  christos  */
      9       1.20  christos #ifdef _LP64
     10       1.20  christos /* reg that points to base of data/text segment */
     11       1.20  christos #define	BASEREG	%g4
     12       1.20  christos /* first constants for storage allocation */
     13       1.20  christos #define LNGSZ		8
     14       1.20  christos #define LNGSHFT		3
     15       1.20  christos #define PTRSZ		8
     16       1.20  christos #define PTRSHFT		3
     17       1.20  christos #define POINTER		.xword
     18       1.20  christos #define ULONG		.xword
     19       1.20  christos /* Now instructions to load/store pointers & long ints */
     20       1.20  christos #define LDLNG		ldx
     21       1.20  christos #define LDULNG		ldx
     22       1.20  christos #define STLNG		stx
     23       1.20  christos #define STULNG		stx
     24       1.20  christos #define LDPTR		ldx
     25       1.20  christos #define LDPTRA		ldxa
     26       1.20  christos #define STPTR		stx
     27       1.20  christos #define STPTRA		stxa
     28       1.21  nakayama #define	CASPTR		casx
     29       1.21  nakayama #define	CASPTRA		casxa
     30       1.20  christos /* Now something to calculate the stack bias */
     31       1.20  christos #define STKB		BIAS
     32       1.20  christos #define	CCCR		%xcc
     33       1.20  christos #else
     34       1.20  christos #define	BASEREG		%g0
     35       1.20  christos #define LNGSZ		4
     36       1.20  christos #define LNGSHFT		2
     37       1.20  christos #define PTRSZ		4
     38       1.20  christos #define PTRSHFT		2
     39       1.20  christos #define POINTER		.word
     40       1.20  christos #define ULONG		.word
     41       1.20  christos /* Instructions to load/store pointers & long ints */
     42       1.20  christos #define LDLNG		ldsw
     43       1.20  christos #define LDULNG		lduw
     44       1.20  christos #define STLNG		stw
     45       1.20  christos #define STULNG		stw
     46       1.20  christos #define LDPTR		lduw
     47       1.20  christos #define LDPTRA		lduwa
     48       1.20  christos #define STPTR		stw
     49       1.20  christos #define STPTRA		stwa
     50       1.21  nakayama #define	CASPTR		cas
     51       1.21  nakayama #define	CASPTRA		casa
     52       1.20  christos #define STKB		0
     53       1.20  christos #define	CCCR		%icc
     54       1.20  christos #endif
     55       1.20  christos 
     56       1.20  christos #if defined(_KERNEL) || defined(_RUMPKERNEL)
     57       1.20  christos /* Give this real authority: reset the machine */
     58       1.20  christos #define NOTREACHED	sir
     59       1.20  christos #else
     60       1.20  christos #define NOTREACHED
     61       1.20  christos #endif
     62       1.20  christos 
     63       1.20  christos /* if < 32, copy by bytes, memcpy, kcopy, ... */
     64       1.20  christos #define	BCOPY_SMALL	32
     65       1.20  christos 
     66       1.20  christos /* use as needed to align things on longword boundaries */
     67       1.20  christos #define	_ALIGN	.align 8
     68       1.20  christos #define ICACHE_ALIGN	.align	32
     69  1.21.12.1     skrll 
     70  1.21.12.1     skrll /*
     71  1.21.12.1     skrll  * Combine 2 regs -- used to convert 64-bit ILP32
     72  1.21.12.1     skrll  * values to LP64.
     73  1.21.12.1     skrll  */
     74  1.21.12.1     skrll #define	COMBINE(r1, r2, d)	\
     75  1.21.12.1     skrll 	clruw	r2;		\
     76  1.21.12.1     skrll 	sllx	r1, 32, d;	\
     77  1.21.12.1     skrll 	or	d, r2, d
     78  1.21.12.1     skrll 
     79  1.21.12.1     skrll /*
     80  1.21.12.1     skrll  * Split 64-bit value in 1 reg into high and low halves.
     81  1.21.12.1     skrll  * Used for ILP32 return values.
     82  1.21.12.1     skrll  */
     83  1.21.12.1     skrll #define	SPLIT(s, r0, r1)	\
     84  1.21.12.1     skrll 	srl	s, 0, r1;	\
     85  1.21.12.1     skrll 	srlx	s, 32, r0
     86  1.21.12.1     skrll 
     87  1.21.12.1     skrll #define	SPLIT_RETL(s, r0, r1)	\
     88  1.21.12.1     skrll 	srl	s, 0, r1;	\
     89  1.21.12.1     skrll 	retl;			\
     90  1.21.12.1     skrll 	 srlx	s, 32, r0
     91