root/include/asm-alpha/system.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. xchg_u32
  2. xchg_u64
  3. xchg_ptr

   1 #ifndef __ALPHA_SYSTEM_H
   2 #define __ALPHA_SYSTEM_H
   3 
   4 /*
   5  * System defines.. Note that this is included both from .c and .S
   6  * files, so it does only defines, not any C code.
   7  */
   8 
   9 /*
  10  * We leave one page for the initial stack page, and one page for
  11  * the initial process structure. Also, the console eats 3 MB for
  12  * the initial bootloader (one of which we can reclaim later).
  13  * So the initial load address is 0xfffffc0000304000UL
  14  */
  15 #define INIT_PCB        0xfffffc0000300000
  16 #define INIT_STACK      0xfffffc0000302000
  17 #define START_ADDR      0xfffffc0000304000
  18 #define START_SIZE      (32*1024)
  19 
  20 /*
  21  * Common PAL-code
  22  */
  23 #define PAL_halt          0
  24 #define PAL_cflush        1
  25 #define PAL_draina        2
  26 #define PAL_cobratt       9
  27 #define PAL_bpt         128
  28 #define PAL_bugchk      129
  29 #define PAL_chmk        131
  30 #define PAL_callsys     131
  31 #define PAL_imb         134
  32 #define PAL_rduniq      158
  33 #define PAL_wruniq      159
  34 #define PAL_gentrap     170
  35 #define PAL_nphalt      190
  36 
  37 /*
  38  * VMS specific PAL-code
  39  */
  40 #define PAL_swppal      10
  41 #define PAL_mfpr_vptb   41
  42 
  43 /*
  44  * OSF specific PAL-code
  45  */
  46 #define PAL_mtpr_mces   17
  47 #define PAL_wrfen       43
  48 #define PAL_wrvptptr    45
  49 #define PAL_jtopal      46
  50 #define PAL_swpctx      48
  51 #define PAL_wrval       49
  52 #define PAL_rdval       50
  53 #define PAL_tbi         51
  54 #define PAL_wrent       52
  55 #define PAL_swpipl      53
  56 #define PAL_rdps        54
  57 #define PAL_wrkgp       55
  58 #define PAL_wrusp       56
  59 #define PAL_wrperfmon   57
  60 #define PAL_rdusp       58
  61 #define PAL_whami       60
  62 #define PAL_rtsys       61
  63 #define PAL_rti         63
  64 
  65 #ifndef __ASSEMBLY__
  66 
  67 extern void wrent(void *, unsigned long);
  68 extern void wrkgp(unsigned long);
  69 
  70 #define halt() __asm__ __volatile__(".long 0");
  71 #define move_to_user_mode() halt()
  72 #define switch_to(x) halt()
  73 
  74 #ifndef mb
  75 #define mb() __asm__ __volatile__("mb": : :"memory")
  76 #endif
  77 
  78 #define swpipl(__new_ipl) \
  79 ({ unsigned long __old_ipl; \
  80 __asm__ __volatile__( \
  81         "bis %1,%1,$16\n\t" \
  82         ".long 53\n\t" \
  83         "bis $0,$0,%0" \
  84         : "=r" (__old_ipl) \
  85         : "r" (__new_ipl) \
  86         : "$0", "$1", "$16", "$22", "$23", "$24", "$25"); \
  87 __old_ipl; })
  88 
  89 #define cli()                   swpipl(7)
  90 #define sti()                   swpipl(0)
  91 #define save_flags(flags)       do { flags = swpipl(7); } while (0)
  92 #define restore_flags(flags)    swpipl(flags)
  93 
  94 extern inline unsigned long xchg_u32(int * m, unsigned long val)
     /* [previous][next][first][last][top][bottom][index][help] */
  95 {
  96         unsigned long dummy, dummy2;
  97 
  98         __asm__ __volatile__(
  99                 "\n1:\t"
 100                 "ldl_l %0,%1\n\t"
 101                 "bis %2,%2,%3\n\t"
 102                 "stl_c %3,%1\n\t"
 103                 "beq %3,1b\n"
 104                 : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
 105                 : "1" (*m), "2" (val));
 106         return val;
 107 }
 108 
 109 extern inline unsigned long xchg_u64(long * m, unsigned long val)
     /* [previous][next][first][last][top][bottom][index][help] */
 110 {
 111         unsigned long dummy, dummy2;
 112 
 113         __asm__ __volatile__(
 114                 "\n1:\t"
 115                 "ldq_l %0,%1\n\t"
 116                 "bis %2,%2,%3\n\t"
 117                 "stq_c %3,%1\n\t"
 118                 "beq %3,1b\n"
 119                 : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
 120                 : "1" (*m), "2" (val));
 121         return val;
 122 }
 123 
 124 extern inline void * xchg_ptr(void *m, void *val)
     /* [previous][next][first][last][top][bottom][index][help] */
 125 {
 126         return (void *) xchg_u64((long *) m, (unsigned long) val);
 127 }
 128 
 129 #endif /* __ASSEMBLY__ */
 130 
 131 #endif

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