+/* This only works for static symbols. */
+static inline lispobj
+StaticSymbolFunction(lispobj sym)
+{
+ return ((struct fdefn *)native_pointer(SymbolValue(sym, 0)))->fun;
+}
+
+/* These are for use during GC, on the current thread, or on prenatal
+ * threads only. */
+#if defined(LISP_FEATURE_SB_THREAD)
+#define get_binding_stack_pointer(thread) \
+ ((thread)->binding_stack_pointer)
+#define set_binding_stack_pointer(thread,value) \
+ ((thread)->binding_stack_pointer = (lispobj *)(value))
+#define access_control_stack_pointer(thread) \
+ ((thread)->control_stack_pointer)
+# if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
+#define access_control_frame_pointer(thread) \
+ ((thread)->control_frame_pointer)
+# endif
+#elif defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
+#define get_binding_stack_pointer(thread) \
+ SymbolValue(BINDING_STACK_POINTER, thread)
+#define set_binding_stack_pointer(thread,value) \
+ SetSymbolValue(BINDING_STACK_POINTER, (lispobj)(value), thread)
+#define access_control_stack_pointer(thread) \
+ (current_control_stack_pointer)
+#else
+#define get_binding_stack_pointer(thread) \
+ (current_binding_stack_pointer)
+#define set_binding_stack_pointer(thread,value) \
+ (current_binding_stack_pointer = (lispobj *)(value))
+#define access_control_stack_pointer(thread) \
+ (current_control_stack_pointer)
+#define access_control_frame_pointer(thread) \
+ (current_control_frame_pointer)
+#endif
+
+#if defined(LISP_FEATURE_SB_THREAD) && defined(LISP_FEATURE_GCC_TLS)
+extern __thread struct thread *current_thread;
+#endif
+
+/* This is clearly per-arch and possibly even per-OS code, but we can't
+ * put it somewhere sensible like x86-linux-os.c because it needs too
+ * much stuff like struct thread and all_threads to be defined, which
+ * usually aren't by that time. So, it's here instead. Sorry */
+
+static inline struct thread *arch_os_get_current_thread(void)