From c7bab903e6bca980d28740669f29bd74dbdfd94c Mon Sep 17 00:00:00 2001 From: srinivas Date: Fri, 1 May 1998 19:45:13 +0000 Subject: [PATCH] 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. git-svn-id: svn://10.0.0.236/trunk@1019 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/nsprpub/pr/include/md/_linux.h | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mozilla/nsprpub/pr/include/md/_linux.h b/mozilla/nsprpub/pr/include/md/_linux.h index 756edbab0e3..4a47df4f867 100644 --- a/mozilla/nsprpub/pr/include/md/_linux.h +++ b/mozilla/nsprpub/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; };