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

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