⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 md.h

📁 快速开发
💻 H
📖 第 1 页 / 共 2 页
字号:
#elif defined(__mips__)#define MD_STACK_GROWS_DOWN#define MD_INIT_CONTEXT(_thread, _sp, _main)               \  ST_BEGIN_MACRO                                           \  MD_SETJMP((_thread)->context);                           \  _thread->context[0].__jmpbuf[0].__pc = (__ptr_t) _main;  \  _thread->context[0].__jmpbuf[0].__sp = _sp;              \  ST_END_MACRO#else /* Not IA-64 or mips *//* * On linux, there are a few styles of jmpbuf format.  These vary based * on architecture/glibc combination. * * Most of the glibc based toggles were lifted from: * mozilla/nsprpub/pr/include/md/_linux.h *//* * Starting with glibc 2.4, JB_SP definitions are not public anymore. * They, however, can still be found in glibc source tree in * architecture-specific "jmpbuf-offsets.h" files. * Most importantly, the content of jmp_buf is mangled by setjmp to make * it completely opaque (the mangling can be disabled by setting the * LD_POINTER_GUARD environment variable before application execution). * Therefore we will use built-in _st_md_cxt_save/_st_md_cxt_restore * functions as a setjmp/longjmp replacement wherever they are available * unless USE_LIBC_SETJMP is defined. */#if defined(__powerpc__)#define MD_STACK_GROWS_DOWN#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)#ifndef JB_GPR1#define JB_GPR1 0#endif#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_GPR1]   #else/* not an error but certainly cause for caution */#error "Untested use of old glibc on powerpc"#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__misc[0]#endif /* glibc 2.1 or later */#elif defined(__alpha)#define MD_STACK_GROWS_DOWN#if defined(__GLIBC__) && __GLIBC__ >= 2#ifndef JB_SP#define JB_SP 8#endif#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_SP]#else/* not an error but certainly cause for caution */#error "Untested use of old glibc on alpha"#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__sp#endif#elif defined(__mc68000__)#define MD_STACK_GROWS_DOWN/* m68k still uses old style sigjmp_buf */#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__sp#elif defined(__sparc__)#define MD_STACK_GROWS_DOWN#if defined(__GLIBC__) && __GLIBC__ >= 2#ifndef JB_SP#define JB_SP 0#endif#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_SP]#else/* not an error but certainly cause for caution */#error "Untested use of old glic on sparc -- also using odd mozilla derived __fp"#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__fp#endif#elif defined(__i386__)#define MD_STACK_GROWS_DOWN#define MD_USE_BUILTIN_SETJMP#if defined(__GLIBC__) && __GLIBC__ >= 2#ifndef JB_SP#define JB_SP 4#endif#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_SP]#else/* not an error but certainly cause for caution */#error "Untested use of old glibc on i386"#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__sp#endif#elif defined(__amd64__) || defined(__x86_64__)#define MD_STACK_GROWS_DOWN#define MD_USE_BUILTIN_SETJMP#ifndef JB_RSP#define JB_RSP 6#endif#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_RSP]#elif defined(__arm__)#define MD_STACK_GROWS_DOWN#if defined(__GLIBC__) && __GLIBC__ >= 2#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[20]#else#error "ARM/Linux pre-glibc2 not supported yet"#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */#elif defined(__s390__)#define MD_STACK_GROWS_DOWN/* There is no JB_SP in glibc at this time. (glibc 2.2.5) */#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__gregs[9]#elif defined(__hppa__)#define MD_STACK_GROWS_UP/* yes, this is gross, unfortunately at the moment (2002/08/01) there is * a bug in hppa's glibc header definition for JB_SP, so we can't * use that... */#define MD_GET_SP(_t) (*(long *)(((char *)&(_t)->context[0].__jmpbuf[0]) + 76))#else#error "Unknown CPU architecture"#endif /* Cases with common MD_INIT_CONTEXT and different SP locations */#define MD_INIT_CONTEXT(_thread, _sp, _main) \  ST_BEGIN_MACRO                             \  if (MD_SETJMP((_thread)->context))         \    _main();                                 \  MD_GET_SP(_thread) = (long) (_sp);         \  ST_END_MACRO#endif /* Cases with different MD_INIT_CONTEXT */#if defined(MD_USE_BUILTIN_SETJMP) && !defined(USE_LIBC_SETJMP)#define MD_SETJMP(env) _st_md_cxt_save(env)#define MD_LONGJMP(env, val) _st_md_cxt_restore(env, val)extern int _st_md_cxt_save(jmp_buf env);extern void _st_md_cxt_restore(jmp_buf env, int val);#else#define MD_SETJMP(env) setjmp(env)#define MD_LONGJMP(env, val) longjmp(env, val)#endif#elif defined (NETBSD)#define MD_STACK_GROWS_DOWN#define MD_USE_BSD_ANON_MMAP#define MD_ACCEPT_NB_INHERITED#define MD_ALWAYS_UNSERIALIZED_ACCEPT#define MD_HAVE_SOCKLEN_T#define MD_SETJMP(env) _setjmp(env)#define MD_LONGJMP(env, val) _longjmp(env, val)#if defined(__i386__)#define MD_JB_SP   2#elif defined(__alpha__)#define MD_JB_SP  34#elif defined(__sparc__)#define MD_JB_SP   0#elif defined(__vax__)#define MD_JB_SP   2#else#error Unknown CPU architecture#endif#define MD_INIT_CONTEXT(_thread, _sp, _main)   \  ST_BEGIN_MACRO                               \  if (MD_SETJMP((_thread)->context))           \    _main();                                   \  (_thread)->context[MD_JB_SP] = (long) (_sp); \  ST_END_MACRO#define MD_GET_UTIME()            \  struct timeval tv;              \  (void) gettimeofday(&tv, NULL); \  return (tv.tv_sec * 1000000LL + tv.tv_usec)#elif defined (OPENBSD)#define MD_STACK_GROWS_DOWN#define MD_USE_BSD_ANON_MMAP#define MD_ACCEPT_NB_INHERITED#define MD_ALWAYS_UNSERIALIZED_ACCEPT#define MD_SETJMP(env) _setjmp(env)#define MD_LONGJMP(env, val) _longjmp(env, val)#if defined(__i386__)#define MD_JB_SP   2#elif defined(__alpha__)#define MD_JB_SP  34#elif defined(__sparc__)#define MD_JB_SP   0#elif defined(__amd64__)#define MD_JB_SP   6#else#error Unknown CPU architecture#endif#define MD_INIT_CONTEXT(_thread, _sp, _main)   \  ST_BEGIN_MACRO                               \  if (MD_SETJMP((_thread)->context))           \    _main();                                   \  (_thread)->context[MD_JB_SP] = (long) (_sp); \  ST_END_MACRO#define MD_GET_UTIME()            \  struct timeval tv;              \  (void) gettimeofday(&tv, NULL); \  return (tv.tv_sec * 1000000LL + tv.tv_usec)#elif defined (OSF1)#include <signal.h>#define MD_STACK_GROWS_DOWN#define MD_USE_SYSV_ANON_MMAP#define MD_ACCEPT_NB_NOT_INHERITED#define MD_ALWAYS_UNSERIALIZED_ACCEPT#define MD_SETJMP(env) _setjmp(env)#define MD_LONGJMP(env, val) _longjmp(env, val)#define MD_INIT_CONTEXT(_thread, _sp, _main)                         \  ST_BEGIN_MACRO                                                     \  if (MD_SETJMP((_thread)->context))                                 \    _main();                                                         \  ((struct sigcontext *)((_thread)->context))->sc_sp = (long) (_sp); \  ST_END_MACRO#define MD_GET_UTIME()            \  struct timeval tv;              \  (void) gettimeofday(&tv, NULL); \  return (tv.tv_sec * 1000000LL + tv.tv_usec)#elif defined (SOLARIS)#include <sys/filio.h>extern int getpagesize(void);#define MD_STACK_GROWS_DOWN#define MD_USE_SYSV_ANON_MMAP#define MD_ACCEPT_NB_NOT_INHERITED#define MD_SETJMP(env) setjmp(env)#define MD_LONGJMP(env, val) longjmp(env, val)#if defined(sparc) || defined(__sparc)#ifdef _LP64#define MD_STACK_PAD_SIZE 4095#endif#define MD_INIT_CONTEXT(_thread, _sp, _main) \  ST_BEGIN_MACRO                             \  (void) MD_SETJMP((_thread)->context);      \  (_thread)->context[1] = (long) (_sp);      \  (_thread)->context[2] = (long) _main;      \  ST_END_MACRO#elif defined(i386) || defined(__i386)#define MD_INIT_CONTEXT(_thread, _sp, _main) \  ST_BEGIN_MACRO                             \  (void) MD_SETJMP((_thread)->context);      \  (_thread)->context[4] = (long) (_sp);      \  (_thread)->context[5] = (long) _main;      \  ST_END_MACRO#elif defined(__amd64__)#define MD_INIT_CONTEXT(_thread, _sp, _main)   \  ST_BEGIN_MACRO                               \  if (MD_SETJMP((_thread)->context))           \    _main();                                   \  (_thread)->context[6] = (long) (_sp); \  ST_END_MACRO#else#error Unknown CPU architecture#endif#define MD_GET_UTIME() \  return (gethrtime() / 1000)#else#error Unknown OS#endif /* OS */#if !defined(MD_HAVE_POLL) && !defined(MD_DONT_HAVE_POLL)#define MD_HAVE_POLL#endif#ifndef MD_STACK_PAD_SIZE#define MD_STACK_PAD_SIZE 128#endif#if !defined(MD_HAVE_SOCKLEN_T) && !defined(socklen_t)#define socklen_t int#endif#ifndef MD_CAP_STACK#define MD_CAP_STACK(var_addr)#endif#endif /* !__ST_MD_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -