processor-generic.h 2.7 KB

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