Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include "asm/ptrace.h" |
Allan Graves | fad1c45 | 2005-10-04 14:53:52 -0400 | [diff] [blame] | 14 | #include "registers.h" |
Jeff Dike | 3c91735 | 2006-09-27 01:50:40 -0700 | [diff] [blame] | 15 | #include "sysdep/archsetjmp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | struct mm_struct; |
| 18 | |
| 19 | struct thread_struct { |
Paolo 'Blaisorblade' Giarrusso | acef2e5 | 2005-05-01 08:58:56 -0700 | [diff] [blame] | 20 | /* 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 Dike | 3eddddc | 2005-09-16 19:27:46 -0700 | [diff] [blame] | 24 | struct task_struct *saved_task; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | int forking; |
| 26 | int nsyscalls; |
| 27 | struct pt_regs regs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | 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; |
Jeff Dike | 77bf440 | 2007-10-16 01:26:58 -0700 | [diff] [blame^] | 35 | jmp_buf switch_buf; |
| 36 | int mm_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | struct { |
| 38 | int op; |
| 39 | union { |
| 40 | struct { |
| 41 | int pid; |
| 42 | } fork, exec; |
| 43 | struct { |
| 44 | int (*proc)(void *); |
| 45 | void *arg; |
| 46 | } thread; |
| 47 | struct { |
| 48 | void (*proc)(void *); |
| 49 | void *arg; |
| 50 | } cb; |
| 51 | } u; |
| 52 | } request; |
| 53 | }; |
| 54 | |
| 55 | #define INIT_THREAD \ |
| 56 | { \ |
| 57 | .forking = 0, \ |
| 58 | .nsyscalls = 0, \ |
| 59 | .regs = EMPTY_REGS, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | .fault_addr = NULL, \ |
| 61 | .prev_sched = NULL, \ |
| 62 | .temp_stack = 0, \ |
| 63 | .exec_buf = NULL, \ |
| 64 | .arch = INIT_ARCH_THREAD, \ |
| 65 | .request = { 0 } \ |
| 66 | } |
| 67 | |
| 68 | typedef struct { |
| 69 | unsigned long seg; |
| 70 | } mm_segment_t; |
| 71 | |
| 72 | extern struct task_struct *alloc_task_struct(void); |
| 73 | |
Jeff Dike | 77bf440 | 2007-10-16 01:26:58 -0700 | [diff] [blame^] | 74 | static inline void release_thread(struct task_struct *task) |
| 75 | { |
| 76 | } |
| 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); |
Paolo 'Blaisorblade' Giarrusso | c16993d | 2005-05-01 08:58:54 -0700 | [diff] [blame] | 79 | |
| 80 | static inline void prepare_to_copy(struct task_struct *tsk) |
| 81 | { |
| 82 | } |
| 83 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
| 85 | extern unsigned long thread_saved_pc(struct task_struct *t); |
| 86 | |
| 87 | static inline void mm_copy_segments(struct mm_struct *from_mm, |
| 88 | struct mm_struct *new_mm) |
| 89 | { |
| 90 | } |
| 91 | |
| 92 | #define init_stack (init_thread_union.stack) |
| 93 | |
| 94 | /* |
| 95 | * User space process size: 3GB (default). |
| 96 | */ |
| 97 | extern unsigned long task_size; |
| 98 | |
| 99 | #define TASK_SIZE (task_size) |
| 100 | |
| 101 | /* This decides where the kernel will search for a free chunk of vm |
| 102 | * space during mmap's. |
| 103 | */ |
| 104 | #define TASK_UNMAPPED_BASE (0x40000000) |
| 105 | |
| 106 | extern void start_thread(struct pt_regs *regs, unsigned long entry, |
| 107 | unsigned long stack); |
| 108 | |
| 109 | struct cpuinfo_um { |
| 110 | unsigned long loops_per_jiffy; |
| 111 | int ipi_pipe[2]; |
| 112 | }; |
| 113 | |
| 114 | extern struct cpuinfo_um boot_cpu_data; |
| 115 | |
| 116 | #define my_cpu_data cpu_data[smp_processor_id()] |
| 117 | |
| 118 | #ifdef CONFIG_SMP |
| 119 | extern struct cpuinfo_um cpu_data[]; |
| 120 | #define current_cpu_data cpu_data[smp_processor_id()] |
| 121 | #else |
| 122 | #define cpu_data (&boot_cpu_data) |
| 123 | #define current_cpu_data boot_cpu_data |
| 124 | #endif |
| 125 | |
Allan Graves | fad1c45 | 2005-10-04 14:53:52 -0400 | [diff] [blame] | 126 | |
Jeff Dike | 77bf440 | 2007-10-16 01:26:58 -0700 | [diff] [blame^] | 127 | #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | #define get_wchan(p) (0) |
| 129 | |
| 130 | #endif |