summaryrefslogtreecommitdiff
path: root/include/asm-alpha/processor.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@fidel.sfbay.redhat.com>2002-02-10 13:42:53 -0800
committerRichard Henderson <rth@fidel.sfbay.redhat.com>2002-02-10 13:42:53 -0800
commit374eeee8a8a50e12278dfa37021df7b6efe506c3 (patch)
tree2388fbed3bb98ad9f8f342c1353c2bbfb40e07c8 /include/asm-alpha/processor.h
parent74c0102446bb3160f186555bd133062003acf194 (diff)
Update Alpha UP for thread_info and scheduler changes.
Diffstat (limited to 'include/asm-alpha/processor.h')
-rw-r--r--include/asm-alpha/processor.h123
1 files changed, 32 insertions, 91 deletions
diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h
index 1c41ecccfaa8..cd77be47b2c3 100644
--- a/include/asm-alpha/processor.h
+++ b/include/asm-alpha/processor.h
@@ -38,83 +38,17 @@ typedef struct {
unsigned long seg;
} mm_segment_t;
-struct thread_struct {
- /* the fields below are used by PALcode and must match struct pcb: */
- unsigned long ksp;
- unsigned long usp;
- unsigned long ptbr;
- unsigned int pcc;
- unsigned int asn;
- unsigned long unique;
- /*
- * bit 0: floating point enable
- * bit 62: performance monitor enable
- */
- unsigned long pal_flags;
- unsigned long res1, res2;
-
- /*
- * The fields below are Linux-specific:
- *
- * bit 1..5: IEEE_TRAP_ENABLE bits (see fpu.h)
- * bit 6..8: UAC bits (see sysinfo.h)
- * bit 17..21: IEEE_STATUS_MASK bits (see fpu.h)
- * bit 63: die_if_kernel recursion lock
- */
- unsigned long flags;
-
- /* Perform syscall argument validation (get/set_fs). */
- mm_segment_t fs;
-
- /* Breakpoint handling for ptrace. */
- unsigned long bpt_addr[2];
- unsigned int bpt_insn[2];
- int bpt_nsaved;
-};
-
-#define INIT_THREAD { \
- 0, 0, 0, \
- 0, 0, 0, \
- 0, 0, 0, \
- 0, \
- KERNEL_DS \
-}
-
-#define THREAD_SIZE (2*PAGE_SIZE)
+/* This is dead. Everything has been moved to thread_info. */
+struct thread_struct { };
+#define INIT_THREAD { }
-#include <asm/ptrace.h>
-
-/*
- * Return saved PC of a blocked thread. This assumes the frame
- * pointer is the 6th saved long on the kernel stack and that the
- * saved return address is the first long in the frame. This all
- * holds provided the thread blocked through a call to schedule() ($15
- * is the frame pointer in schedule() and $15 is saved at offset 48 by
- * entry.S:do_switch_stack).
- *
- * Under heavy swap load I've seen this lose in an ugly way. So do
- * some extra sanity checking on the ranges we expect these pointers
- * to be in so that we can fail gracefully. This is just for ps after
- * all. -- r~
- */
-extern inline unsigned long thread_saved_pc(struct thread_struct *t)
-{
- unsigned long fp, sp = t->ksp, base = (unsigned long)t;
-
- if (sp > base && sp+6*8 < base + 16*1024) {
- fp = ((unsigned long*)sp)[6];
- if (fp > sp && fp < base + 16*1024)
- return *(unsigned long *)fp;
- }
-
- return 0;
-}
+/* Return saved PC of a blocked thread. */
+struct task_struct;
+extern unsigned long thread_saved_pc(struct task_struct *);
/* Do necessary setup to start up a newly executed thread. */
extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
-struct task_struct;
-
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
@@ -127,26 +61,18 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
unsigned long get_wchan(struct task_struct *p);
/* See arch/alpha/kernel/ptrace.c for details. */
-#define PT_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \
- + (long)&((struct pt_regs *)0)->reg)
+#define PT_REG(reg) \
+ (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
-#define SW_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \
- - sizeof(struct switch_stack) \
- + (long)&((struct switch_stack *)0)->reg)
+#define SW_REG(reg) \
+ (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
+ + offsetof(struct switch_stack, reg))
#define KSTK_EIP(tsk) \
- (*(unsigned long *)(PT_REG(pc) + (unsigned long)(tsk)))
-
-#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
-
-/* NOTE: The task struct and the stack go together! */
-#define alloc_task_struct() \
- ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
-#define free_task_struct(p) free_pages((unsigned long)(p),1)
-#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
+ (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
-#define init_task (init_task_union.task)
-#define init_stack (init_task_union.stack)
+#define KSTK_ESP(tsk) \
+ ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp)
#define cpu_relax() do { } while (0)
@@ -154,21 +80,36 @@ unsigned long get_wchan(struct task_struct *p);
#define ARCH_HAS_PREFETCHW
#define ARCH_HAS_SPINLOCK_PREFETCH
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
extern inline void prefetch(const void *ptr)
{
- __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
+ __builtin_prefetch(ptr, 0, 3);
}
extern inline void prefetchw(const void *ptr)
{
- __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
+ __builtin_prefetch(ptr, 1, 3);
}
extern inline void spin_lock_prefetch(const void *ptr)
{
+ __builtin_prefetch(ptr, 1, 3);
+}
+#else
+extern inline void prefetch(const void *ptr)
+{
__asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
}
-
+extern inline void prefetchw(const void *ptr)
+{
+ __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
+}
+
+extern inline void spin_lock_prefetch(const void *ptr)
+{
+ __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
+}
+#endif /* GCC 3.1 */
#endif /* __ASM_ALPHA_PROCESSOR_H */