summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1998-07-24 00:52:44 +0000
committerwtc%netscape.com <devnull@localhost>1998-07-24 00:52:44 +0000
commitbc5c3bd34cf25510db56949253ecf013b0159cb9 (patch)
tree4030f8c8a9df644b1407d6a080f8c2ee9bd88616
parent8ff15416ded3307d46b004e4a789455772a3e078 (diff)
downloadnspr-hg-bc5c3bd34cf25510db56949253ecf013b0159cb9.tar.gz
Merged Linux/MIPS patch contributed by Ralf <ralf@uni-koblenz.de>.
Files changed: _linux.cfg and _linux.h.
-rw-r--r--pr/include/md/_linux.cfg51
-rw-r--r--pr/include/md/_linux.h27
2 files changed, 78 insertions, 0 deletions
diff --git a/pr/include/md/_linux.cfg b/pr/include/md/_linux.cfg
index 969ebb70..50fffdc9 100644
--- a/pr/include/md/_linux.cfg
+++ b/pr/include/md/_linux.cfg
@@ -248,6 +248,57 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
+#elif defined(__mips__)
+
+#ifdef __MIPSEB__
+#define IS_BIG_ENDIAN 1
+#undef IS_LITTLE_ENDIAN
+#elif defined(__MIPSEL__)
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+#else
+#error "Unknown MIPS endianness."
+#endif
+
+#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
+
#else
#error "Unknown CPU architecture"
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
index 4d464087..548d4a92 100644
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -37,6 +37,8 @@
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
+#elif defined(__mips__)
+#define _PR_SI_ARCHITECTURE "mips"
#else
#error "Unknown CPU architecture"
#endif
@@ -150,6 +152,18 @@ extern void _MD_CleanupBeforeExit(void);
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#define PR_NUM_GCREGS 6
+#elif defined(__mips__)
+/* Linux/MIPS */
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
+#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val))
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp)
+#define _MD_SP_TYPE __ptr_t
+#else
+#error "Linux/MIPS pre-glibc2 not supported yet"
+#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
+
#else
#error "Unknown CPU architecture"
@@ -173,6 +187,19 @@ extern void _MD_CleanupBeforeExit(void);
_MD_SET_FP(_thread, 0); \
}
+#elif defined(__mips__)
+
+#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
+{ \
+ *status = PR_TRUE; \
+ (void) sigsetjmp(CONTEXT(_thread), 1); \
+ _thread->md.context[0].__jmpbuf[0].__pc = (__ptr_t) _main; \
+ _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
+ _thread->md.sp = _MD_GET_SP_PTR(_thread); \
+ _thread->md.fp = _MD_GET_FP_PTR(_thread); \
+ _MD_SET_FP(_thread, 0); \
+}
+
#else
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \