root/include/asm-sparc/processor.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. start_bh_atomic
  2. end_bh_atomic

   1 /* include/asm-sparc/processor.h
   2  *
   3  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
   4  */
   5 
   6 #ifndef __ASM_SPARC_PROCESSOR_H
   7 #define __ASM_SPARC_PROCESSOR_H
   8 
   9 /*
  10  * Bus types
  11  */
  12 #define EISA_bus 1
  13 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
  14 #define MCA_bus 0
  15 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  16 
  17 /*
  18  * Write Protection works right in supervisor mode on the Sparc
  19  */
  20 
  21 #define wp_works_ok 1
  22 #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  23 
  24 /*
  25  * User space process size: 3GB. This is hardcoded into a few places,
  26  * so don't change it unless you know what you are doing.
  27  *
  28  * "this is gonna have to change to 1gig for the sparc" - David S. Miller
  29  */
  30 #define TASK_SIZE       (0xC0000000UL)
  31 
  32 /*
  33  * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
  34  */
  35 #define IO_BITMAP_SIZE  32
  36 
  37 /* The first five entries here MUST be the first four. This allows me to
  38  * do %lo(offset) loads and stores in entry.S. See TRAP_WIN_CLEAN to see
  39  * why.
  40  */
  41 
  42 struct thread_struct {
  43         unsigned long uwindows;       /* how many user windows are in the set */
  44         unsigned long wim;            /* user's window invalid mask */
  45         unsigned long w_saved;        /* how many windows saved in reg_window[] */
  46         unsigned long ksp;          /* kernel stack pointer */
  47         unsigned long usp;          /* user's sp, throw reg windows here */
  48         unsigned long psr;          /* save for condition codes */
  49         unsigned long reg_window[16*24];
  50         unsigned long cr3;          /* why changed from ptbr? */
  51         unsigned int pcc;
  52         unsigned int asn;
  53         unsigned long unique;
  54         unsigned long flags;
  55         unsigned long res1, res2;
  56         unsigned long pc;           /* program counter */
  57         unsigned long npc;          /* next program counter */
  58 
  59 /* 8 local registers + 8 in registers * 24 register windows.
  60  * Most sparcs I know of only have 8 windows implemented,
  61  * we determine how many at boot time and store that value
  62  * in nwindows.
  63  */
  64         unsigned long globl_regs[8];  /* global regs need to be saved too */
  65         unsigned long yreg;
  66         unsigned long float_regs[64]; /* V8 and below have 32, V9 has 64 */
  67 };
  68 
  69 #define INIT_MMAP { &init_task, 0x0, 0x40000000, \
  70                       PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC }
  71 
  72 #define INIT_TSS  { \
  73         0, 0, 0, 0, 0, 0, \
  74         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  75         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  76         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  77         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  78         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  79         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  80         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  81         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  82         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  83         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  84         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  85         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  86         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  87         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  88         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  89         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  90         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  91         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  92         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  93         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  94         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  95         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  96         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  97         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
  98         0, 0, 0, 0, 0, 0, 0, 0, 0, \
  99         { 0, 0, 0, 0, 0, 0, 0, 0, }, \
 100         0, \
 101         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 102         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 103         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 104         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
 105 }
 106 
 107 /* The thread_frame is what needs to be set up in certain circumstances
 108  * upon entry to a trap. It is also loaded sometimes during a window
 109  * spill if things don't go right (bad user stack pointer). In reality
 110  * it is not per-process per se, it just sits in the kernel stack while
 111  * the current process is in a handler then it is basically forgotten
 112  * about.
 113  */
 114 
 115 struct thread_frame {
 116   unsigned int thr_psr;
 117   unsigned int thr_pc;
 118   unsigned int thr_npc;
 119   unsigned int thr_y;
 120   unsigned int thr_globals[8];
 121   unsigned int thr_outs[8];
 122 };
 123 
 124 /*
 125  * These are the "cli()" and "sti()" for software interrupts
 126  * They work by increasing/decreasing the "intr_count" value, 
 127  * and as such can be nested arbitrarily.
 128  */
 129 extern inline void start_bh_atomic(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 130 {
 131         unsigned long dummy, psr;
 132         __asm__ __volatile__("rd %%psr, %2\n\t"
 133                              "wr %2, 0x20, %%psr\n\t"  /* disable traps */
 134                              "ld %1,%0\n\t"
 135                              "add %0,1,%0\n\t"
 136                              "st %0,%1\n\t"
 137                              "wr %2, 0x0, %%psr\n\t"   /* enable traps */
 138                              : "=r" (dummy), "=m" (intr_count)
 139                              : "0" (0), "r" (psr=0));
 140 }
 141 
 142 extern inline void end_bh_atomic(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 143 {
 144         unsigned long dummy, psr;
 145         __asm__ __volatile__("rd %%psr, %2\n\t"
 146                              "wr %2, 0x20, %%psr\n\t"
 147                              "ld %1,%0\n\t"
 148                              "sub %0,1,%0\n\t"
 149                              "st %0,%1\n\t"
 150                              "wr %2, 0x0, %%psr\n\t"
 151                              : "=r" (dummy), "=m" (intr_count)
 152                              : "0" (0), "r" (psr=0));
 153 }
 154 
 155 #endif /* __ASM_SPARC_PROCESSOR_H */
 156 

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