blob: b953b1ad3b020ac8e9866d8f4d0655b38dfb9ac1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
9struct pt_regs;
10
11struct task_struct;
12
13#include "linux/config.h"
14#include "asm/ptrace.h"
15#include "choose-mode.h"
16
17struct mm_struct;
18
19struct thread_struct {
Paolo 'Blaisorblade' Giarrussoacef2e52005-05-01 08:58:56 -070020 /* This flag is set to 1 before calling do_fork (and analyzed in
21 * copy_thread) to mark that we are begin called from userspace (fork /
22 * vfork / clone), and reset to 0 after. It is left to 0 when called
23 * from kernelspace (i.e. kernel_thread() or fork_idle(), as of 2.6.11). */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 int forking;
25 int nsyscalls;
26 struct pt_regs regs;
27 unsigned long cr2;
28 int err;
29 unsigned long trap_no;
30 int singlestep_syscall;
31 void *fault_addr;
32 void *fault_catcher;
33 struct task_struct *prev_sched;
34 unsigned long temp_stack;
35 void *exec_buf;
36 struct arch_thread arch;
37 union {
38#ifdef CONFIG_MODE_TT
39 struct {
40 int extern_pid;
41 int tracing;
42 int switch_pipe[2];
43 int vm_seq;
44 } tt;
45#endif
46#ifdef CONFIG_MODE_SKAS
47 struct {
48 void *switch_buf;
49 void *fork_buf;
50 int mm_count;
51 } skas;
52#endif
53 } mode;
54 struct {
55 int op;
56 union {
57 struct {
58 int pid;
59 } fork, exec;
60 struct {
61 int (*proc)(void *);
62 void *arg;
63 } thread;
64 struct {
65 void (*proc)(void *);
66 void *arg;
67 } cb;
68 } u;
69 } request;
70};
71
72#define INIT_THREAD \
73{ \
74 .forking = 0, \
75 .nsyscalls = 0, \
76 .regs = EMPTY_REGS, \
77 .cr2 = 0, \
78 .err = 0, \
79 .fault_addr = NULL, \
80 .prev_sched = NULL, \
81 .temp_stack = 0, \
82 .exec_buf = NULL, \
83 .arch = INIT_ARCH_THREAD, \
84 .request = { 0 } \
85}
86
87typedef struct {
88 unsigned long seg;
89} mm_segment_t;
90
91extern struct task_struct *alloc_task_struct(void);
92
93extern void release_thread(struct task_struct *);
94extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
95extern void dump_thread(struct pt_regs *regs, struct user *u);
Paolo 'Blaisorblade' Giarrussoc16993d2005-05-01 08:58:54 -070096
97static inline void prepare_to_copy(struct task_struct *tsk)
98{
99}
100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
102extern unsigned long thread_saved_pc(struct task_struct *t);
103
104static inline void mm_copy_segments(struct mm_struct *from_mm,
105 struct mm_struct *new_mm)
106{
107}
108
109#define init_stack (init_thread_union.stack)
110
111/*
112 * User space process size: 3GB (default).
113 */
114extern unsigned long task_size;
115
116#define TASK_SIZE (task_size)
117
118/* This decides where the kernel will search for a free chunk of vm
119 * space during mmap's.
120 */
121#define TASK_UNMAPPED_BASE (0x40000000)
122
123extern void start_thread(struct pt_regs *regs, unsigned long entry,
124 unsigned long stack);
125
126struct cpuinfo_um {
127 unsigned long loops_per_jiffy;
128 int ipi_pipe[2];
129};
130
131extern struct cpuinfo_um boot_cpu_data;
132
133#define my_cpu_data cpu_data[smp_processor_id()]
134
135#ifdef CONFIG_SMP
136extern struct cpuinfo_um cpu_data[];
137#define current_cpu_data cpu_data[smp_processor_id()]
138#else
139#define cpu_data (&boot_cpu_data)
140#define current_cpu_data boot_cpu_data
141#endif
142
143#define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs))
144#define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs))
145#define get_wchan(p) (0)
146
147#endif
148
149/*
150 * Overrides for Emacs so that we follow Linus's tabbing style.
151 * Emacs will notice this stuff at the end of the file and automatically
152 * adjust the settings for this buffer only. This must remain at the end
153 * of the file.
154 * ---------------------------------------------------------------------------
155 * Local variables:
156 * c-file-style: "linux"
157 * End:
158 */