root/include/asm-mips/processor.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   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 
  72 /*
  73  * MIPS has no problems with write protection
  74  */
  75 #define wp_works_ok 1
  76 
  77 /*
  78  * User space process size: 2GB. This is hardcoded into a few places,
  79  * so don't change it unless you know what you are doing.
  80  */
  81 #define TASK_SIZE       0x80000000
  82 
  83 /*
  84  * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
  85  */
  86 #define IO_BITMAP_SIZE  32
  87 
  88 #define NUM_FPU_REGS    32
  89 
  90 struct mips_fpu_hard_struct {
  91         double fp_regs[NUM_FPU_REGS];
  92         unsigned int control;
  93 };
  94 
  95 /*
  96  * FIXME: no fpu emulator yet (but who cares anyway?)
  97  */
  98 struct mips_fpu_soft_struct {
  99         long    dummy;
 100         };
 101 
 102 union mips_fpu_union {
 103         struct mips_fpu_hard_struct hard;
 104         struct mips_fpu_soft_struct soft;
 105 };
 106 
 107 #define INIT_FPU { \
 108         0, \
 109 }
 110 
 111 /*
 112  * If you change thread_struct remember to change the #defines below too!
 113  */
 114 struct thread_struct {
 115         /*
 116          * saved main processor registers
 117          */
 118         unsigned long   reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
 119         unsigned long                               reg28, reg29, reg30, reg31;
 120         /*
 121          * saved cp0 stuff
 122          */
 123         unsigned long cp0_status;
 124         /*
 125          * saved fpu/fpu emulator stuff
 126          */
 127         union mips_fpu_union fpu;
 128         /*
 129          * Other stuff associated with the process
 130          */
 131         unsigned long cp0_badvaddr;
 132         unsigned long error_code;
 133         unsigned long trap_no;
 134         unsigned long ksp;              /* Top of kernel stack   */
 135         unsigned long fs;               /* "Segment" pointer     */
 136         unsigned long pg_dir;           /* L1 page table pointer */
 137 };
 138 
 139 #endif /* !defined (__ASSEMBLY__) */
 140 
 141 /*
 142  * If you change the #defines remember to change thread_struct above too!
 143  */
 144 #define TOFF_REG16              0
 145 #define TOFF_REG17              (TOFF_REG16+4)
 146 #define TOFF_REG18              (TOFF_REG17+4)
 147 #define TOFF_REG19              (TOFF_REG18+4)
 148 #define TOFF_REG20              (TOFF_REG19+4)
 149 #define TOFF_REG21              (TOFF_REG20+4)
 150 #define TOFF_REG22              (TOFF_REG21+4)
 151 #define TOFF_REG23              (TOFF_REG22+4)
 152 #define TOFF_REG28              (TOFF_REG23+4)
 153 #define TOFF_REG29              (TOFF_REG28+4)
 154 #define TOFF_REG30              (TOFF_REG29+4)
 155 #define TOFF_REG31              (TOFF_REG30+4)
 156 #define TOFF_CP0_STATUS         (TOFF_REG31+4)
 157 /*
 158  * Pad for 8 byte boundary!
 159  */
 160 #define TOFF_FPU                (((TOFF_CP0_STATUS+4)+(8-1))&~(8-1))
 161 #define TOFF_CP0_BADVADDR       (TOFF_FPU+264)
 162 #define TOFF_ERROR_CODE         (TOFF_CP0_BADVADDR+4)
 163 #define TOFF_TRAP_NO            (TOFF_ERROR_CODE+4)
 164 #define TOFF_KSP                (TOFF_TRAP_NO+4)
 165 #define TOFF_FS                 (TOFF_KSP+4)
 166 #define TOFF_PG_DIR             (TOFF_FS+4)
 167 
 168 #if !defined (__ASSEMBLY__)
 169 
 170 #define INIT_TSS  { \
 171         /* \
 172          * saved main processor registers \
 173          */ \
 174         0, 0, 0, 0, 0, 0, 0, 0, \
 175                     0, 0, 0, 0, \
 176         /* \
 177          * saved cp0 stuff \
 178          */ \
 179         0, \
 180         /* \
 181          * saved fpu/fpu emulator stuff \
 182          */ \
 183         INIT_FPU, \
 184         /* \
 185          * Other stuff associated with the process\
 186          */ \
 187         0, 0, 0, (((unsigned long)init_kernel_stack)+4096-8), \
 188         KERNEL_DS, (unsigned long) swapper_pg_dir \
 189 }
 190 
 191 #ifdef __KERNEL__
 192 
 193 /*
 194  * switch_to(n) should switch tasks to task nr n, first
 195  * checking that n isn't the current task, in which case it does nothing.
 196  */
 197 asmlinkage void resume(struct task_struct *tsk, int offset);
 198 
 199 #define switch_to(n) \
 200         resume(n, ((int)(&((struct task_struct *)0)->tss)))
 201 
 202 /*
 203  * Does the process account for user or for system time?
 204  */
 205 #if defined (__R4000__)
 206 
 207 #define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x18))
 208 
 209 #else /* !defined (__R4000__) */
 210 
 211 #error "#define USES_USER_TIME(regs)!"
 212 
 213 #endif /* !defined (__R4000__) */
 214 
 215 #endif /* __KERNEL__ */
 216 
 217 #endif /* !defined (__ASSEMBLY__) */
 218 
 219 #endif /* __ASM_MIPS_PROCESSOR_H */

/* [previous][next][first][last][top][bottom][index][help] */