blob: be3ffec3a6a6ea29ee67f635a3675ee4ce7ea3ae [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include "asm/ptrace.h"
Allan Gravesfad1c452005-10-04 14:53:52 -040014#include "registers.h"
Jeff Dike3c917352006-09-27 01:50:40 -070015#include "sysdep/archsetjmp.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
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). */
Jeff Dike3eddddc2005-09-16 19:27:46 -070024 struct task_struct *saved_task;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 int forking;
26 int nsyscalls;
27 struct pt_regs regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 int singlestep_syscall;
29 void *fault_addr;
30 void *fault_catcher;
31 struct task_struct *prev_sched;
32 unsigned long temp_stack;
33 void *exec_buf;
34 struct arch_thread arch;
35 union {
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 struct {
Jeff Dike3c917352006-09-27 01:50:40 -070037 jmp_buf switch_buf;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 int mm_count;
39 } skas;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 } mode;
41 struct {
42 int op;
43 union {
44 struct {
45 int pid;
46 } fork, exec;
47 struct {
48 int (*proc)(void *);
49 void *arg;
50 } thread;
51 struct {
52 void (*proc)(void *);
53 void *arg;
54 } cb;
55 } u;
56 } request;
57};
58
59#define INIT_THREAD \
60{ \
61 .forking = 0, \
62 .nsyscalls = 0, \
63 .regs = EMPTY_REGS, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 .fault_addr = NULL, \
65 .prev_sched = NULL, \
66 .temp_stack = 0, \
67 .exec_buf = NULL, \
68 .arch = INIT_ARCH_THREAD, \
69 .request = { 0 } \
70}
71
72typedef struct {
73 unsigned long seg;
74} mm_segment_t;
75
76extern struct task_struct *alloc_task_struct(void);
77
78extern void release_thread(struct task_struct *);
79extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
Paolo 'Blaisorblade' Giarrussoc16993d2005-05-01 08:58:54 -070080
81static inline void prepare_to_copy(struct task_struct *tsk)
82{
83}
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86extern unsigned long thread_saved_pc(struct task_struct *t);
87
88static inline void mm_copy_segments(struct mm_struct *from_mm,
89 struct mm_struct *new_mm)
90{
91}
92
93#define init_stack (init_thread_union.stack)
94
95/*
96 * User space process size: 3GB (default).
97 */
98extern unsigned long task_size;
99
100#define TASK_SIZE (task_size)
101
102/* This decides where the kernel will search for a free chunk of vm
103 * space during mmap's.
104 */
105#define TASK_UNMAPPED_BASE (0x40000000)
106
107extern void start_thread(struct pt_regs *regs, unsigned long entry,
108 unsigned long stack);
109
110struct cpuinfo_um {
111 unsigned long loops_per_jiffy;
112 int ipi_pipe[2];
113};
114
115extern struct cpuinfo_um boot_cpu_data;
116
117#define my_cpu_data cpu_data[smp_processor_id()]
118
119#ifdef CONFIG_SMP
120extern struct cpuinfo_um cpu_data[];
121#define current_cpu_data cpu_data[smp_processor_id()]
122#else
123#define cpu_data (&boot_cpu_data)
124#define current_cpu_data boot_cpu_data
125#endif
126
Allan Gravesfad1c452005-10-04 14:53:52 -0400127
Allan Gravesfad1c452005-10-04 14:53:52 -0400128#define KSTK_REG(tsk, reg) \
Jeff Dike3c917352006-09-27 01:50:40 -0700129 get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130#define get_wchan(p) (0)
131
132#endif