ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-um / processor-generic.h
1 /* 
2  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef __UM_PROCESSOR_GENERIC_H
7 #define __UM_PROCESSOR_GENERIC_H
8
9 struct pt_regs;
10
11 struct task_struct;
12
13 #include "linux/config.h"
14 #include "linux/signal.h"
15 #include "asm/ptrace.h"
16 #include "asm/siginfo.h"
17 #include "choose-mode.h"
18
19 struct mm_struct;
20
21 #define current_text_addr() ((void *) 0)
22
23 #define cpu_relax()     do ; while (0)
24
25 #ifdef CONFIG_MODE_TT
26 struct proc_tt_mode {
27         int extern_pid;
28         int tracing;
29         int switch_pipe[2];
30         int singlestep_syscall;
31         int vm_seq;
32 };
33 #endif
34
35 #ifdef CONFIG_MODE_SKAS
36 struct proc_skas_mode {
37         void *switch_buf;
38         void *fork_buf;
39 };
40 #endif
41
42 struct thread_struct {
43         int forking;
44         unsigned long kernel_stack;
45         int nsyscalls;
46         struct pt_regs regs;
47         unsigned long cr2;
48         int err;
49         void *fault_addr;
50         void *fault_catcher;
51         struct task_struct *prev_sched;
52         unsigned long temp_stack;
53         void *exec_buf;
54         struct arch_thread arch;
55         union {
56 #ifdef CONFIG_MODE_TT
57                 struct proc_tt_mode tt;
58 #endif
59 #ifdef CONFIG_MODE_SKAS
60                 struct proc_skas_mode skas;
61 #endif
62         } mode;
63         struct {
64                 int op;
65                 union {
66                         struct {
67                                 int pid;
68                         } fork, exec;
69                         struct {
70                                 int (*proc)(void *);
71                                 void *arg;
72                         } thread;
73                         struct {
74                                 void (*proc)(void *);
75                                 void *arg;
76                         } cb;
77                 } u;
78         } request;
79 };
80
81 #define INIT_THREAD \
82 { \
83         .forking                = 0, \
84         .kernel_stack           = 0, \
85         .nsyscalls              = 0, \
86         .regs                   = EMPTY_REGS, \
87         .cr2                    = 0, \
88         .err                    = 0, \
89         .fault_addr             = NULL, \
90         .prev_sched             = NULL, \
91         .temp_stack             = 0, \
92         .exec_buf               = NULL, \
93         .arch                   = INIT_ARCH_THREAD, \
94         .request                = { 0 } \
95 }
96
97 typedef struct {
98         unsigned long seg;
99 } mm_segment_t;
100
101 extern struct task_struct *alloc_task_struct(void);
102 extern void free_task_struct(struct task_struct *task);
103
104 extern void release_thread(struct task_struct *);
105 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
106 extern void dump_thread(struct pt_regs *regs, struct user *u);
107
108 extern unsigned long thread_saved_pc(struct task_struct *t);
109
110 #define init_stack      (init_thread_union.stack)
111
112 /*
113  * User space process size: 3GB (default).
114  */
115 extern unsigned long task_size;
116
117 #define TASK_SIZE       (task_size)
118
119 /* This decides where the kernel will search for a free chunk of vm
120  * space during mmap's.
121  */
122 #define TASK_UNMAPPED_BASE      (0x40000000)
123
124 extern void start_thread(struct pt_regs *regs, unsigned long entry, 
125                          unsigned long stack);
126
127 struct cpuinfo_um {
128         unsigned long loops_per_jiffy;
129         int ipi_pipe[2];
130 };
131
132 extern struct cpuinfo_um boot_cpu_data;
133
134 #define my_cpu_data             cpu_data[smp_processor_id()]
135
136 #ifdef CONFIG_SMP
137 extern struct cpuinfo_um cpu_data[];
138 #define current_cpu_data cpu_data[smp_processor_id()]
139 #else
140 #define cpu_data (&boot_cpu_data)
141 #define current_cpu_data boot_cpu_data
142 #endif
143
144 #define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs))
145 #define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs))
146 #define get_wchan(p) (0)
147
148 #endif
149
150 /*
151  * Overrides for Emacs so that we follow Linus's tabbing style.
152  * Emacs will notice this stuff at the end of the file and automatically
153  * adjust the settings for this buffer only.  This must remain at the end
154  * of the file.
155  * ---------------------------------------------------------------------------
156  * Local variables:
157  * c-file-style: "linux"
158  * End:
159  */