summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsrinivas <devnull@localhost>1998-05-01 19:45:13 +0000
committersrinivas <devnull@localhost>1998-05-01 19:45:13 +0000
commit3ad67ac6ce693909c671b5757c07d4ecfacb58a2 (patch)
tree1028f583515c8e89eb552a07917f87ce682e6c4a
parent800db41cf94d12a7ea2c4778056086b1dae00ea7 (diff)
downloadnspr-hg-3ad67ac6ce693909c671b5757c07d4ecfacb58a2.tar.gz
Initialize the outermost stack frame for the thread and setup pointers to the
stack-pointer/frame-pointer words in the thread's context structure. Useful for displaying thread stacks in the debugger.
-rw-r--r--pr/include/md/_linux.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
index 756edbab..4a47df4f 100644
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -73,6 +73,9 @@ extern void _MD_CleanupBeforeExit(void);
#ifdef __powerpc__
/* PowerPC based MkLinux */
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
+#define _MD_SET_FP(_t, val)
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) ((void *) 0)
/* aix = 64, macos = 70 */
#define PR_NUM_GCREGS 64
@@ -81,9 +84,15 @@ extern void _MD_CleanupBeforeExit(void);
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
+#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 long int
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
+#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
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
@@ -99,8 +108,14 @@ extern void _MD_CleanupBeforeExit(void);
*/
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
+#define _MD_SET_FP(_t, val)
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) ((void *) 0)
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
+#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? */
@@ -110,9 +125,15 @@ extern void _MD_CleanupBeforeExit(void);
/* 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
@@ -131,6 +152,9 @@ extern void _MD_CleanupBeforeExit(void);
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
+ _thread->md.sp = _MD_GET_SP_PTR(_thread); \
+ _thread->md.fp = _MD_GET_FP_PTR(_thread); \
+ _MD_SET_FP(_thread, 0); \
}
#else
@@ -142,6 +166,9 @@ extern void _MD_CleanupBeforeExit(void);
_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); \
}
#endif /*__powerpc__*/
@@ -166,6 +193,8 @@ extern void _MD_CleanupBeforeExit(void);
struct _MDThread {
PR_CONTEXT_TYPE context;
+ void *sp;
+ void *fp;
int id;
int errcode;
};