root/include/asm-sparc/wim.h

/* [previous][next][first][last][top][bottom][index][help] */
   1 /* wim.h: Defines the layout of the "Window Invalid Register" on
   2           Version 8 of the Sparc Architecture.
   3 
   4    Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
   5 */
   6 
   7 #ifndef __LINUX_SPARC_WIM_H
   8 #define __LINUX_SPARC_WIM_H
   9 
  10 #ifdef __LINUX_SPARC_V8     /* register doesn't exist on the V9 */
  11 
  12 /* The Window Invalid Register %wim, holds a set of which register
  13    windows are 'valid' at this point in time.
  14 
  15    ------------------------------------------------------------
  16    |W31|W30|W29|W28|W27|W26|W25|W24|W23|....|W5|W4|W3|W2|W1|W0|
  17    ------------------------------------------------------------
  18 
  19    Each register window on the chip gets one bit. If the bit is
  20    set then the window is currently 'invalid' and hardware will
  21    trap if that window is entered via a 'save', 'restore', or
  22    'rett' instruction. Privileged software is responsible for
  23    updating this on trap fills/spills etc. Therefore if a 'save'
  24    instruction is executed and it causes the Current Window
  25    Pointer to equal a register window which has its bit set in
  26    %wim we get a 'overflow' trap, a restore into such a register
  27    invokes a window 'spill' trap.
  28 */
  29 
  30 #define __LINUX_SPARC_HAS_WIM
  31 
  32 /* Macro to fine the %wim bit mask for the current window pointer */
  33 #define CWP_TO_WIM_MASK(cwp)  (1<<(cwp))
  34 
  35 /* Assembly version of above macro, 'cwp' and 'wimask' must be registers */
  36 #define ASM_CWP_TO_WIM_MASK(cwp,wimask) \
  37           or  %g0, 0x1, wimask \
  38           sll wimask, cwp, wimask
  39 
  40 /* Assembly macro to find if the given window is set to invalid in the %wim.
  41    Again 'window', 'result', and 'scratch' must be in registers. This leaves 
  42    a non-zero value in result if the window is indeed invalid. This routine
  43    works because we keep exactly one window invalid at all times to maximize
  44    register utilization, which means both kernel and user windows can be in
  45    the register file at the same time in certain trap situations.
  46 */
  47 #define ASM_REG_WIN_INVAL(window,result,scratch) \
  48          rd  %wim, result \
  49          or  %g0, 0x1, scratch \
  50          sll scratch, window, scratch \
  51          and scratch, result, result
  52 
  53 #endif /* !(__LINUX_SPARC_V8) */
  54 
  55 #endif  /* !(__LINUX_SPARC_WIM_H) */
  56 

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