Port to Sparc Linux. Files changed: _linux.cfg, _linux.h.
authorwtc
Tue, 09 Jun 1998 00:51:10 +0000
changeset 153 d283652451429b4dfd1845e94e7130ab8c4aa8c4
parent 152 c4f05d6dfe9439e46aab86bc5a79b821682786b6
child 154 8f8b4e31800c71c3fb0ce5de06015ec9aaf127b6
push idunknown
push userunknown
push dateunknown
Port to Sparc Linux. Files changed: _linux.cfg, _linux.h.
pr/include/md/_linux.cfg
pr/include/md/_linux.h
--- a/pr/include/md/_linux.cfg
+++ b/pr/include/md/_linux.cfg
@@ -155,17 +155,61 @@
 #define PR_ALIGN_OF_INT64   2
 #define PR_ALIGN_OF_FLOAT   2
 #define PR_ALIGN_OF_DOUBLE  2
 #define PR_ALIGN_OF_POINTER 2
 
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
-#else /* x86 */
+#elif defined(__sparc__)
+
+#undef	IS_LITTLE_ENDIAN
+#define	IS_BIG_ENDIAN 1
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    32
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   5
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__i386__)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
 #define PR_BYTES_PER_INT    4
 #define PR_BYTES_PER_INT64  8
@@ -199,16 +243,20 @@
 #define PR_ALIGN_OF_INT64   4
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
+#else
+
+#error "Unknown CPU architecture"
+
 #endif
 
 #define	HAVE_LONG_LONG
 /*
  * XXX These two macros need to be investigated for different architectures.
  */
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -28,18 +28,22 @@
 #define PR_LINKER_ARCH	"linux"
 #define _PR_SI_SYSNAME  "LINUX"
 #ifdef __powerpc__
 #define _PR_SI_ARCHITECTURE "ppc"
 #elif defined(__alpha)
 #define _PR_SI_ARCHITECTURE "alpha"
 #elif defined(__mc68000__)
 #define _PR_SI_ARCHITECTURE "m68k"
+#elif defined(__sparc__)
+#define _PR_SI_ARCHITECTURE "sparc"
+#elif defined(__i386__)
+#define _PR_SI_ARCHITECTURE "x86"
 #else
-#define _PR_SI_ARCHITECTURE "x86"
+#error "Unknown CPU architecture"
 #endif
 #define PR_DLL_SUFFIX		".so"
 
 #define _PR_VMBASE              0x30000000
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
@@ -116,33 +120,45 @@ extern void _MD_CleanupBeforeExit(void);
 #define _MD_SET_FP(_t, val)
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) ((void *) 0)
 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
 
 /* XXX not sure if this is correct, or maybe it should be 17? */
 #define PR_NUM_GCREGS 9
 
-#else
+#elif defined(__sparc__)
+/* Sparc */
+#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__fp
+#define _MD_SET_FP(_t, val)
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) ((void *) 0)
+#define _MD_SP_TYPE __ptr_t
+
+#elif defined(__i386__)
 /* Intel based Linux */
 #if defined(__GLIBC__) && __GLIBC__ >= 2
 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_BP] = val)
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_BP])
 #define _MD_SP_TYPE int
 #else
 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__bp = val)
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) &((_t)->md.context[0].__jmpbuf[0].__bp)
 #define _MD_SP_TYPE __ptr_t
 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
 #define PR_NUM_GCREGS   6
 
+#else
+
+#error "Unknown CPU architecture"
+
 #endif /*__powerpc__*/
 
 /*
 ** Initialize a thread context to run "_main()" when started
 */
 #ifdef __powerpc__
 
 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)  \