processor-generic.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_PROCESSOR_GENERIC_H
  6. #define __UM_PROCESSOR_GENERIC_H
  7. struct pt_regs;
  8. struct task_struct;
  9. #include "asm/ptrace.h"
  10. #include "registers.h"
  11. #include "sysdep/archsetjmp.h"
  12. #include <linux/prefetch.h>
  13. struct mm_struct;
  14. struct thread_struct {
  15. struct task_struct *saved_task;
  16. /*
  17. * This flag is set to 1 before calling do_fork (and analyzed in
  18. * copy_thread) to mark that we are begin called from userspace (fork /
  19. * vfork / clone), and reset to 0 after. It is left to 0 when called
  20. * from kernelspace (i.e. kernel_thread() or fork_idle(),
  21. * as of 2.6.11).
  22. */
  23. int forking;
  24. struct pt_regs regs;
  25. int singlestep_syscall;
  26. void *fault_addr;
  27. jmp_buf *fault_catcher;
  28. struct task_struct *prev_sched;
  29. unsigned long temp_stack;
  30. jmp_buf *exec_buf;
  31. struct arch_thread arch;
  32. jmp_buf switch_buf;
  33. int mm_count;
  34. struct {
  35. int op;
  36. union {
  37. struct {
  38. int pid;
  39. } fork, exec;
  40. struct {
  41. int (*proc)(void *);
  42. void *arg;
  43. } thread;
  44. struct {
  45. void (*proc)(void *);
  46. void *arg;
  47. } cb;
  48. } u;
  49. } request;
  50. };
  51. #define INIT_THREAD \
  52. { \
  53. .forking = 0, \
  54. .regs = EMPTY_REGS, \
  55. .fault_addr = NULL, \
  56. .prev_sched = NULL, \
  57. .temp_stack = 0, \
  58. .exec_buf = NULL, \
  59. .arch = INIT_ARCH_THREAD, \
  60. .request = { 0 } \
  61. }
  62. extern struct task_struct *alloc_task_struct_node(int node);
  63. static inline void release_thread(struct task_struct *task)
  64. {
  65. }
  66. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  67. static inline void prepare_to_copy(struct task_struct *tsk)
  68. {
  69. }
  70. extern unsigned long thread_saved_pc(struct task_struct *t);
  71. static inline void mm_copy_segments(struct mm_struct *from_mm,
  72. struct mm_struct *new_mm)
  73. {
  74. }
  75. #define init_stack (init_thread_union.stack)
  76. /*
  77. * User space process size: 3GB (default).
  78. */
  79. extern unsigned long task_size;
  80. #define TASK_SIZE (task_size)
  81. #undef STACK_TOP
  82. #undef STACK_TOP_MAX
  83. extern unsigned long stacksizelim;
  84. #define STACK_ROOM (stacksizelim)
  85. #define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
  86. #define STACK_TOP_MAX STACK_TOP
  87. /* This decides where the kernel will search for a free chunk of vm
  88. * space during mmap's.
  89. */
  90. #define TASK_UNMAPPED_BASE (0x40000000)
  91. extern void start_thread(struct pt_regs *regs, unsigned long entry,
  92. unsigned long stack);
  93. struct cpuinfo_um {
  94. unsigned long loops_per_jiffy;
  95. int ipi_pipe[2];
  96. };
  97. extern struct cpuinfo_um boot_cpu_data;
  98. #define my_cpu_data cpu_data[smp_processor_id()]
  99. #ifdef CONFIG_SMP
  100. extern struct cpuinfo_um cpu_data[];
  101. #define current_cpu_data cpu_data[smp_processor_id()]
  102. #else
  103. #define cpu_data (&boot_cpu_data)
  104. #define current_cpu_data boot_cpu_data
  105. #endif
  106. #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
  107. extern unsigned long get_wchan(struct task_struct *p);
  108. #endif