home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / include / asm-alpha / system.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-24  |  3.3 KB  |  149 lines

  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.  * With a few other pages for various reasons, we'll use an initial
  14.  * load address of 0xfffffc0000310000UL
  15.  */
  16. #define BOOT_PCB    0x20000000
  17. #define BOOT_ADDR    0x20000000
  18. #define BOOT_SIZE    (16*1024)
  19.  
  20. #define KERNEL_START    0xfffffc0000300000
  21. #define SWAPPER_PGD    0xfffffc0000300000
  22. #define INIT_STACK    0xfffffc0000302000
  23. #define EMPTY_PGT    0xfffffc0000304000
  24. #define EMPTY_PGE    0xfffffc0000308000
  25. #define ZERO_PGE    0xfffffc000030A000
  26.  
  27. #define START_ADDR    0xfffffc0000310000
  28. #define START_SIZE    (1024*1024)
  29.  
  30. /*
  31.  * Common PAL-code
  32.  */
  33. #define PAL_halt      0
  34. #define PAL_cflush      1
  35. #define PAL_draina      2
  36. #define PAL_cobratt      9
  37. #define PAL_bpt        128
  38. #define PAL_bugchk    129
  39. #define PAL_chmk    131
  40. #define PAL_callsys    131
  41. #define PAL_imb        134
  42. #define PAL_rduniq    158
  43. #define PAL_wruniq    159
  44. #define PAL_gentrap    170
  45. #define PAL_nphalt    190
  46.  
  47. /*
  48.  * VMS specific PAL-code
  49.  */
  50. #define PAL_swppal    10
  51. #define PAL_mfpr_vptb    41
  52.  
  53. /*
  54.  * OSF specific PAL-code
  55.  */
  56. #define PAL_mtpr_mces    17
  57. #define PAL_wrfen    43
  58. #define PAL_wrvptptr    45
  59. #define PAL_jtopal    46
  60. #define PAL_swpctx    48
  61. #define PAL_wrval    49
  62. #define PAL_rdval    50
  63. #define PAL_tbi        51
  64. #define PAL_wrent    52
  65. #define PAL_swpipl    53
  66. #define PAL_rdps    54
  67. #define PAL_wrkgp    55
  68. #define PAL_wrusp    56
  69. #define PAL_wrperfmon    57
  70. #define PAL_rdusp    58
  71. #define PAL_whami    60
  72. #define PAL_rtsys    61
  73. #define PAL_rti        63
  74.  
  75. #ifndef __ASSEMBLY__
  76.  
  77. extern void wrent(void *, unsigned long);
  78. extern void wrkgp(unsigned long);
  79. extern void wrusp(unsigned long);
  80. extern unsigned long rdusp(void);
  81.  
  82. #define halt() __asm__ __volatile__(".long 0");
  83.  
  84. extern void alpha_switch_to(unsigned long pctxp);
  85.  
  86. #define switch_to(p) do { \
  87.     current = p; \
  88.     alpha_switch_to((unsigned long) &(p)->tss - 0xfffffc0000000000); \
  89. } while (0)
  90.  
  91. #ifndef mb
  92. #define mb() __asm__ __volatile__("mb": : :"memory")
  93. #endif
  94.  
  95. #define swpipl(__new_ipl) \
  96. ({ unsigned long __old_ipl; \
  97. __asm__ __volatile__( \
  98.     "bis %1,%1,$16\n\t" \
  99.     ".long 53\n\t" \
  100.     "bis $0,$0,%0" \
  101.     : "=r" (__old_ipl) \
  102.     : "r" (__new_ipl) \
  103.     : "$0", "$1", "$16", "$22", "$23", "$24", "$25"); \
  104. __old_ipl; })
  105.  
  106. #define cli()            swpipl(7)
  107. #define sti()            swpipl(0)
  108. #define save_flags(flags)    do { flags = swpipl(7); } while (0)
  109. #define restore_flags(flags)    swpipl(flags)
  110.  
  111. extern inline unsigned long xchg_u32(int * m, unsigned long val)
  112. {
  113.     unsigned long dummy, dummy2;
  114.  
  115.     __asm__ __volatile__(
  116.         "\n1:\t"
  117.         "ldl_l %0,%1\n\t"
  118.         "bis %2,%2,%3\n\t"
  119.         "stl_c %3,%1\n\t"
  120.         "beq %3,1b\n"
  121.         : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
  122.         : "1" (*m), "2" (val));
  123.     return val;
  124. }
  125.  
  126. extern inline unsigned long xchg_u64(long * m, unsigned long val)
  127. {
  128.     unsigned long dummy, dummy2;
  129.  
  130.     __asm__ __volatile__(
  131.         "\n1:\t"
  132.         "ldq_l %0,%1\n\t"
  133.         "bis %2,%2,%3\n\t"
  134.         "stq_c %3,%1\n\t"
  135.         "beq %3,1b\n"
  136.         : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
  137.         : "1" (*m), "2" (val));
  138.     return val;
  139. }
  140.  
  141. extern inline void * xchg_ptr(void *m, void *val)
  142. {
  143.     return (void *) xchg_u64((long *) m, (unsigned long) val);
  144. }
  145.  
  146. #endif /* __ASSEMBLY__ */
  147.  
  148. #endif
  149.