home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / include / asm-mips / processor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-09  |  5.1 KB  |  222 lines

  1. /*
  2.  * include/asm-mips/processor.h
  3.  *
  4.  * Copyright (C) 1994  Waldorf Electronics
  5.  * written by Ralf Baechle
  6.  */
  7.  
  8. #ifndef __ASM_MIPS_PROCESSOR_H
  9. #define __ASM_MIPS_PROCESSOR_H
  10.  
  11. #if !defined (__ASSEMBLY__)
  12. #include <asm/system.h>
  13.  
  14. /*
  15.  * System setup and hardware bug flags..
  16.  */
  17. extern char wait_available;        /* only available on R4[26]00 */
  18.  
  19. extern unsigned long intr_count;
  20. extern unsigned long event;
  21.  
  22. #if defined (__R4000__)
  23.  
  24. #define start_bh_atomic()        \
  25. __asm__ __volatile__(            \
  26.     ".set\tnoreorder\n\t"    \
  27.     ".set\tnoat\n\t"         \
  28.     "ll\t$1,(%0)\n"          \
  29.     "1:\taddiu\t$1,$1,1\n\t" \
  30.     "sc\t$1,(%0)\n\t"        \
  31.     "beqzl\t$1,1b\n\t"       \
  32.     "ll\t$1,(%0)\n\t"        \
  33.     ".set\tat\n\t"           \
  34.     ".set\treorder"          \
  35.     : /* no outputs */       \
  36.     : "r" (&intr_count));
  37.  
  38. #define end_bh_atomic()          \
  39. __asm__ __volatile__(            \
  40.     ".set\tnoreorder\n\t"    \
  41.     ".set\tnoat\n\t"         \
  42.     "ll\t$1,(%0)\n"          \
  43.     "1:\tsubu\t$1,$1,1\n\t"  \
  44.     "sc\t$1,(%0)\n\t"        \
  45.     "beqzl\t$1,1b\n\t"       \
  46.     "ll\t$1,(%0)\n\t"        \
  47.     ".set\tat\n\t"           \
  48.     ".set\treorder"          \
  49.     : /* no outputs */       \
  50.     : "r" (&intr_count));
  51.  
  52. #else /* !defined (__R4000__) */
  53.  
  54. #define start_bh_atomic() \
  55. {int flags; save_flags(flags); cli(); intr_count++; restore_flags(flags)}
  56.  
  57. #define end_bh_atomic() \
  58. {int flags; save_flags(flags); cli(); intr_count--; restore_flags(flags)}
  59.  
  60. #endif
  61.  
  62. /*
  63.  * Bus types (default is ISA, but people can check others with these..)
  64.  * MCA_bus hardcoded to 0 for now.
  65.  *
  66.  * This needs to be extended since MIPS systems are being delivered with
  67.  * numerous different types of bus systems.
  68.  */
  69. extern int EISA_bus;
  70. #define MCA_bus 0
  71. #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  72.  
  73. /*
  74.  * MIPS has no problems with write protection
  75.  */
  76. #define wp_works_ok 1
  77. #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  78.  
  79. /*
  80.  * User space process size: 2GB. This is hardcoded into a few places,
  81.  * so don't change it unless you know what you are doing.
  82.  */
  83. #define TASK_SIZE    (0x80000000UL)
  84.  
  85. /*
  86.  * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
  87.  */
  88. #define IO_BITMAP_SIZE    32
  89.  
  90. #define NUM_FPU_REGS    32
  91.  
  92. struct mips_fpu_hard_struct {
  93.     double fp_regs[NUM_FPU_REGS];
  94.     unsigned int control;
  95. };
  96.  
  97. /*
  98.  * FIXME: no fpu emulator yet (but who cares anyway?)
  99.  */
  100. struct mips_fpu_soft_struct {
  101.     long    dummy;
  102.     };
  103.  
  104. union mips_fpu_union {
  105.         struct mips_fpu_hard_struct hard;
  106.         struct mips_fpu_soft_struct soft;
  107. };
  108.  
  109. #define INIT_FPU { \
  110.     0, \
  111. }
  112.  
  113. /*
  114.  * If you change thread_struct remember to change the #defines below too!
  115.  */
  116. struct thread_struct {
  117.         /*
  118.          * saved main processor registers
  119.          */
  120.         unsigned long   reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
  121.         unsigned long                               reg28, reg29, reg30, reg31;
  122.     /*
  123.      * saved cp0 stuff
  124.      */
  125.     unsigned long cp0_status;
  126.     /*
  127.      * saved fpu/fpu emulator stuff
  128.      */
  129.     union mips_fpu_union fpu;
  130.     /*
  131.      * Other stuff associated with the process
  132.      */
  133.     unsigned long cp0_badvaddr;
  134.     unsigned long error_code;
  135.     unsigned long trap_no;
  136.     unsigned long ksp;        /* Top of kernel stack   */
  137.     unsigned long fs;        /* "Segment" pointer     */
  138.     unsigned long pg_dir;        /* L1 page table pointer */
  139. };
  140.  
  141. #endif /* !defined (__ASSEMBLY__) */
  142.  
  143. /*
  144.  * If you change the #defines remember to change thread_struct above too!
  145.  */
  146. #define TOFF_REG16        0
  147. #define TOFF_REG17        (TOFF_REG16+4)
  148. #define TOFF_REG18        (TOFF_REG17+4)
  149. #define TOFF_REG19        (TOFF_REG18+4)
  150. #define TOFF_REG20        (TOFF_REG19+4)
  151. #define TOFF_REG21        (TOFF_REG20+4)
  152. #define TOFF_REG22        (TOFF_REG21+4)
  153. #define TOFF_REG23        (TOFF_REG22+4)
  154. #define TOFF_REG28        (TOFF_REG23+4)
  155. #define TOFF_REG29        (TOFF_REG28+4)
  156. #define TOFF_REG30        (TOFF_REG29+4)
  157. #define TOFF_REG31        (TOFF_REG30+4)
  158. #define TOFF_CP0_STATUS        (TOFF_REG31+4)
  159. /*
  160.  * Pad for 8 byte boundary!
  161.  */
  162. #define TOFF_FPU        (((TOFF_CP0_STATUS+4)+(8-1))&~(8-1))
  163. #define TOFF_CP0_BADVADDR    (TOFF_FPU+264)
  164. #define TOFF_ERROR_CODE        (TOFF_CP0_BADVADDR+4)
  165. #define TOFF_TRAP_NO        (TOFF_ERROR_CODE+4)
  166. #define TOFF_KSP        (TOFF_TRAP_NO+4)
  167. #define TOFF_FS            (TOFF_KSP+4)
  168. #define TOFF_PG_DIR        (TOFF_FS+4)
  169.  
  170. #if !defined (__ASSEMBLY__)
  171.  
  172. #define INIT_TSS  { \
  173.         /* \
  174.          * saved main processor registers \
  175.          */ \
  176.     0, 0, 0, 0, 0, 0, 0, 0, \
  177.                 0, 0, 0, 0, \
  178.     /* \
  179.      * saved cp0 stuff \
  180.      */ \
  181.     0, \
  182.     /* \
  183.      * saved fpu/fpu emulator stuff \
  184.      */ \
  185.     INIT_FPU, \
  186.     /* \
  187.      * Other stuff associated with the process\
  188.      */ \
  189.     0, 0, 0, (((unsigned long)init_kernel_stack)+4096-8), \
  190.     KERNEL_DS, (unsigned long) swapper_pg_dir \
  191. }
  192.  
  193. #ifdef __KERNEL__
  194.  
  195. /*
  196.  * switch_to(n) should switch tasks to task nr n, first
  197.  * checking that n isn't the current task, in which case it does nothing.
  198.  */
  199. asmlinkage void resume(struct task_struct *tsk, int offset);
  200.  
  201. #define switch_to(n) \
  202.     resume(n, ((int)(&((struct task_struct *)0)->tss)))
  203.  
  204. /*
  205.  * Does the process account for user or for system time?
  206.  */
  207. #if defined (__R4000__)
  208.  
  209. #define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x18))
  210.  
  211. #else /* !defined (__R4000__) */
  212.  
  213. #error "#define USES_USER_TIME(regs)!"
  214.  
  215. #endif /* !defined (__R4000__) */
  216.  
  217. #endif /* __KERNEL__ */
  218.  
  219. #endif /* !defined (__ASSEMBLY__) */
  220.  
  221. #endif /* __ASM_MIPS_PROCESSOR_H */
  222.