pre-2.3.4..
[davej-history.git] / include / asm-alpha / processor.h
blob754a4e8f835f7150401f6c17907a6546a3d1b2ee
1 /*
2 * include/asm-alpha/processor.h
4 * Copyright (C) 1994 Linus Torvalds
5 */
7 #ifndef __ASM_ALPHA_PROCESSOR_H
8 #define __ASM_ALPHA_PROCESSOR_H
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
14 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
17 * We have a 42-bit user address space: 4TB user VM...
19 #define TASK_SIZE (0x40000000000UL)
21 /* This decides where the kernel will search for a free chunk of vm
22 * space during mmap's.
24 #define TASK_UNMAPPED_BASE \
25 ((current->personality & ADDR_LIMIT_32BIT) ? 0x40000000 : TASK_SIZE / 2)
28 * Bus types
30 #define EISA_bus 1
31 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
32 #define MCA_bus 0
33 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
35 typedef struct {
36 unsigned long seg;
37 } mm_segment_t;
39 struct thread_struct {
40 /* the fields below are used by PALcode and must match struct pcb: */
41 unsigned long ksp;
42 unsigned long usp;
43 unsigned long ptbr;
44 unsigned int pcc;
45 unsigned int asn;
46 unsigned long unique;
48 * bit 0: floating point enable
49 * bit 62: performance monitor enable
51 unsigned long pal_flags;
52 unsigned long res1, res2;
55 * The fields below are Linux-specific:
57 * bit 1..5: IEEE_TRAP_ENABLE bits (see fpu.h)
58 * bit 6..8: UAC bits (see sysinfo.h)
59 * bit 17..21: IEEE_STATUS_MASK bits (see fpu.h)
60 * bit 63: die_if_kernel recursion lock
62 unsigned long flags;
64 /* Perform syscall argument validation (get/set_fs). */
65 mm_segment_t fs;
67 /* Breakpoint handling for ptrace. */
68 unsigned long bpt_addr[2];
69 unsigned int bpt_insn[2];
70 int bpt_nsaved;
73 #define INIT_MMAP { &init_mm, PAGE_OFFSET, PAGE_OFFSET+0x10000000, \
74 NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
76 #define INIT_TSS { \
77 0, 0, 0, \
78 0, 0, 0, \
79 0, 0, 0, \
80 0, \
81 KERNEL_DS \
84 #include <asm/ptrace.h>
87 * Return saved PC of a blocked thread. This assumes the frame
88 * pointer is the 6th saved long on the kernel stack and that the
89 * saved return address is the first long in the frame. This all
90 * holds provided the thread blocked through a call to schedule() ($15
91 * is the frame pointer in schedule() and $15 is saved at offset 48 by
92 * entry.S:do_switch_stack).
94 * Under heavy swap load I've seen this lose in an ugly way. So do
95 * some extra sanity checking on the ranges we expect these pointers
96 * to be in so that we can fail gracefully. This is just for ps after
97 * all. -- r~
99 extern inline unsigned long thread_saved_pc(struct thread_struct *t)
101 unsigned long fp, sp = t->ksp, base = (unsigned long)t;
103 if (sp > base && sp+6*8 < base + 16*1024) {
104 fp = ((unsigned long*)sp)[6];
105 if (fp > sp && fp < base + 16*1024)
106 return *(unsigned long *)fp;
109 return 0;
113 * Do necessary setup to start up a newly executed thread.
115 extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
117 /* Free all resources held by a thread. */
118 extern void release_thread(struct task_struct *);
120 #define copy_segments(nr, tsk, mm) do { } while (0)
121 #define release_segments(mm) do { } while (0)
122 #define forget_segments() do { } while (0)
124 /* NOTE: The task struct and the stack go together! */
125 #define alloc_task_struct() \
126 ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
127 #define free_task_struct(p) free_pages((unsigned long)(p),1)
129 #define init_task (init_task_union.task)
130 #define init_stack (init_task_union.stack)
132 #endif /* __ASM_ALPHA_PROCESSOR_H */