1 /*
2 * include/asm-alpha/processor.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7 #ifndef __ASM_ALPHA_PROCESSOR_H
8 #define __ASM_ALPHA_PROCESSOR_H
9
10 /*
11 * Returns current instruction pointer ("program counter").
12 */
13 #define current_text_addr() \
14 ({ void *__pc; __asm__ ("br %0,.+4" : "=r"(__pc)); __pc; })
15
16 /*
17 * We have a 42-bit user address space: 4TB user VM...
18 */
19 #define TASK_SIZE (0x40000000000UL)
20
21 /* This decides where the kernel will search for a free chunk of vm
22 * space during mmap's.
23 */
24 #define TASK_UNMAPPED_BASE \
25 ((current->personality & ADDR_LIMIT_32BIT) ? 0x40000000 : TASK_SIZE / 2)
26
27 /*
28 * Bus types
29 */
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 */
34
35 typedef struct {
36 unsigned long seg;
37 } mm_segment_t;
38
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;
47 /*
48 * bit 0: floating point enable
49 * bit 62: performance monitor enable
50 */
51 unsigned long pal_flags;
52 unsigned long res1, res2;
53
54 /*
55 * The fields below are Linux-specific:
56 *
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
61 */
62 unsigned long flags;
63
64 /* Perform syscall argument validation (get/set_fs). */
65 mm_segment_t fs;
66
67 /* Breakpoint handling for ptrace. */
68 unsigned long bpt_addr[2];
69 unsigned int bpt_insn[2];
70 int bpt_nsaved;
71 };
72
73 #define INIT_MMAP { &init_mm, PAGE_OFFSET, PAGE_OFFSET+0x10000000, \
74 NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
75
76 #define INIT_THREAD { \
77 0, 0, 0, \
78 0, 0, 0, \
79 0, 0, 0, \
80 0, \
81 KERNEL_DS \
82 }
83
84 #define THREAD_SIZE (2*PAGE_SIZE)
85
86 #include <asm/ptrace.h>
87
88 /*
89 * Return saved PC of a blocked thread. This assumes the frame
90 * pointer is the 6th saved long on the kernel stack and that the
91 * saved return address is the first long in the frame. This all
92 * holds provided the thread blocked through a call to schedule() ($15
93 * is the frame pointer in schedule() and $15 is saved at offset 48 by
94 * entry.S:do_switch_stack).
95 *
96 * Under heavy swap load I've seen this lose in an ugly way. So do
97 * some extra sanity checking on the ranges we expect these pointers
98 * to be in so that we can fail gracefully. This is just for ps after
99 * all. -- r~
100 */
101 extern inline unsigned long thread_saved_pc(struct thread_struct *t)
102 {
103 unsigned long fp, sp = t->ksp, base = (unsigned long)t;
104
105 if (sp > base && sp+6*8 < base + 16*1024) {
106 fp = ((unsigned long*)sp)[6];
107 if (fp > sp && fp < base + 16*1024)
108 return *(unsigned long *)fp;
109 }
110
111 return 0;
112 }
113
114 /* Do necessary setup to start up a newly executed thread. */
115 extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
116
117 struct task_struct;
118
119 /* Free all resources held by a thread. */
120 extern void release_thread(struct task_struct *);
121
122 /* Create a kernel thread without removing it from tasklists. */
123 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
124
125 #define copy_segments(tsk, mm) do { } while (0)
126 #define release_segments(mm) do { } while (0)
127
128 unsigned long get_wchan(struct task_struct *p);
129
130 /* See arch/alpha/kernel/ptrace.c for details. */
131 #define PT_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \
132 + (long)&((struct pt_regs *)0)->reg)
133
134 #define SW_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \
135 - sizeof(struct switch_stack) \
136 + (long)&((struct switch_stack *)0)->reg)
137
138 #define KSTK_EIP(tsk) \
139 (*(unsigned long *)(PT_REG(pc) + (unsigned long)(tsk)))
140
141 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
142
143 /* NOTE: The task struct and the stack go together! */
144 #define alloc_task_struct() \
145 ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
146 #define free_task_struct(p) free_pages((unsigned long)(p),1)
147 #define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
148
149 #define init_task (init_task_union.task)
150 #define init_stack (init_task_union.stack)
151
152 #endif /* __ASM_ALPHA_PROCESSOR_H */
153
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.