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-mips / segment.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-25  |  2.4 KB  |  112 lines

  1. /*
  2.  * include/asm-mips/segment.h
  3.  *
  4.  * This file is subject to the terms and conditions of the GNU General Public
  5.  * License.  See the file "COPYING" in the main directory of this archive
  6.  * for more details.
  7.  *
  8.  * Copyright (C) 1994, 1995 by Ralf Baechle
  9.  *
  10.  */
  11. #ifndef __ASM_MIPS_SEGMENT_H
  12. #define __ASM_MIPS_SEGMENT_H
  13.  
  14. /*
  15.  * Memory segments (32bit kernel mode addresses)
  16.  */
  17. #define KUSEG                   0x00000000
  18. #define KSEG0                   0x80000000
  19. #define KSEG1                   0xa0000000
  20. #define KSEG2                   0xc0000000
  21. #define KSEG3                   0xe0000000
  22.  
  23. /*
  24.  * returns the kernel segment base of a given address
  25.  */
  26. #define KSEGX(a)                (a & 0xe0000000)
  27.  
  28. #ifndef __ASSEMBLY__
  29.  
  30. /*
  31.  * Beware: the xxx_fs_word functions work on 16bit words!
  32.  */
  33. #define get_fs_byte(addr) get_user_byte((char *)(addr))
  34. static inline unsigned char get_user_byte(const char *addr)
  35. {
  36.     return *addr;
  37. }
  38.  
  39. #define get_fs_word(addr) get_user_word((short *)(addr))
  40. static inline unsigned short get_user_word(const short *addr)
  41. {
  42.     return *addr;
  43. }
  44.  
  45. #define get_fs_long(addr) get_user_long((int *)(addr))
  46. static inline unsigned long get_user_long(const int *addr)
  47. {
  48.     return *addr;
  49. }
  50.  
  51. #define get_fs_dlong(addr) get_user_dlong((long long *)(addr))
  52. static inline unsigned long get_user_dlong(const long long *addr)
  53. {
  54.     return *addr;
  55. }
  56.  
  57. #define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
  58. static inline void put_user_byte(char val,char *addr)
  59. {
  60.     *addr = val;
  61. }
  62.  
  63. #define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
  64. static inline void put_user_word(short val,short * addr)
  65. {
  66.     *addr = val;
  67. }
  68.  
  69. #define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
  70. static inline void put_user_long(unsigned long val,int * addr)
  71. {
  72.     *addr = val;
  73. }
  74.  
  75. #define put_fs_dlong(x,addr) put_user_dlong((x),(int *)(addr))
  76. static inline void put_user_dlong(unsigned long val,long long * addr)
  77. {
  78.     *addr = val;
  79. }
  80.  
  81. #define memcpy_fromfs(to, from, n) memcpy((to),(from),(n))
  82.  
  83. #define memcpy_tofs(to, from, n) memcpy((to),(from),(n))
  84.  
  85. /*
  86.  * For segmented architectures, these are used to specify which segment
  87.  * to use for the above functions.
  88.  *
  89.  * MIPS is not segmented, so these are just dummies.
  90.  */
  91.  
  92. #define KERNEL_DS 0
  93. #define USER_DS 1
  94.  
  95. static inline unsigned long get_fs(void)
  96. {
  97.     return 0;
  98. }
  99.  
  100. static inline unsigned long get_ds(void)
  101. {
  102.     return 0;
  103. }
  104.  
  105. static inline void set_fs(unsigned long val)
  106. {
  107. }
  108.  
  109. #endif /* !__ASSEMBLY__ */
  110.  
  111. #endif /* __ASM_MIPS_SEGMENT_H */
  112.