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