home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / asm-v850 / processor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  3.2 KB  |  120 lines

  1. /*
  2.  * include/asm-v850/processor.h
  3.  *
  4.  *  Copyright (C) 2001,02,03  NEC Electronics Corporation
  5.  *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  6.  *
  7.  * This file is subject to the terms and conditions of the GNU General
  8.  * Public License.  See the file COPYING in the main directory of this
  9.  * archive for more details.
  10.  *
  11.  * Written by Miles Bader <miles@gnu.org>
  12.  */
  13.  
  14. #ifndef __V850_PROCESSOR_H__
  15. #define __V850_PROCESSOR_H__
  16.  
  17. #ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe.  */
  18. #include <linux/thread_info.h>
  19. #endif
  20.  
  21. #include <asm/ptrace.h>
  22. #include <asm/entry.h>
  23.  
  24. /* Some code expects `segment' stuff to be defined here.  */
  25. #include <asm/segment.h>
  26.  
  27.  
  28. /*
  29.  * The only places this is used seem to be horrible bletcherous kludges,
  30.  * so we just define it to be as large as possible.
  31.  */
  32. #define TASK_SIZE    (0xFFFFFFFF)
  33.  
  34. /*
  35.  * This decides where the kernel will search for a free chunk of vm
  36.  * space during mmap's.  We won't be using it.
  37.  */
  38. #define TASK_UNMAPPED_BASE    0
  39.  
  40.  
  41. #ifndef __ASSEMBLY__
  42.  
  43.  
  44. /*
  45.  * Default implementation of macro that returns current
  46.  * instruction pointer ("program counter").
  47.  */
  48. #define current_text_addr()    ({ __label__ _l; _l: &&_l;})
  49.  
  50. /* If you change this, you must change the associated assembly-languages
  51.    constants defined below, THREAD_*.  */
  52. struct thread_struct {
  53.     /* kernel stack pointer (must be first field in structure) */
  54.     unsigned long  ksp;
  55. };
  56.  
  57. #define INIT_THREAD { sizeof init_stack + (unsigned long)init_stack }
  58.  
  59.  
  60. /* Do necessary setup to start up a newly executed thread.  */
  61. static inline void start_thread (struct pt_regs *regs,
  62.                  unsigned long pc, unsigned long usp)
  63. {
  64.     regs->pc = pc;
  65.     regs->gpr[GPR_SP] = usp;
  66.     regs->kernel_mode = 0;
  67. }
  68.  
  69. /* Free all resources held by a thread. */
  70. static inline void release_thread (struct task_struct *dead_task)
  71. {
  72. }
  73.  
  74. /* Prepare to copy thread state - unlazy all lazy status */
  75. #define prepare_to_copy(tsk)    do { } while (0)
  76.  
  77. extern int kernel_thread (int (*fn)(void *), void * arg, unsigned long flags);
  78.  
  79. /* Free current thread data structures etc.  */
  80. static inline void exit_thread (void)
  81. {
  82. }
  83.  
  84.  
  85. /* Return the registers saved during context-switch by the currently
  86.    not-running thread T.  Note that this only includes some registers!
  87.    See entry.S for details.  */
  88. #define thread_saved_regs(t) \
  89.    ((struct pt_regs*)((t)->thread.ksp + STATE_SAVE_PT_OFFSET))
  90. /* Return saved (kernel) PC of a blocked thread.  Actually, we return the
  91.    LP register, because the thread is actually blocked in switch_thread,
  92.    and we're interested in the PC it will _return_ to.  */
  93. #define thread_saved_pc(t)   (thread_saved_regs(t)->gpr[GPR_LP])
  94.  
  95.  
  96. unsigned long get_wchan (struct task_struct *p);
  97.  
  98.  
  99. /* Return some info about the user process TASK.  */
  100. #define task_tos(task)    ((unsigned long)task_stack_page(task) + THREAD_SIZE)
  101. #define task_pt_regs(task) ((struct pt_regs *)task_tos (task) - 1)
  102. #define task_sp(task)    (task_pt_regs (task)->gpr[GPR_SP])
  103. #define task_pc(task)    (task_pt_regs (task)->pc)
  104. /* Grotty old names for some.  */
  105. #define KSTK_EIP(task)    task_pc (task)
  106. #define KSTK_ESP(task)    task_sp (task)
  107.  
  108.  
  109. #define cpu_relax()    ((void)0)
  110.  
  111.  
  112. #else /* __ASSEMBLY__ */
  113.  
  114. #define THREAD_KSP    0
  115.  
  116. #endif /* !__ASSEMBLY__ */
  117.  
  118.  
  119. #endif /* __V850_PROCESSOR_H__ */
  120.