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