root/include/asm-ppc/segment.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __put_user
  2. __get_user
  3. get_user_byte
  4. get_user_word
  5. get_user_long
  6. get_user_quad
  7. put_user_byte
  8. put_user_word
  9. put_user_long
  10. put_user_quad
  11. get_fs
  12. get_ds
  13. set_fs

   1 #ifndef _ASM_PPC_SEGMENT_H
   2 #define _ASM_PPC_SEGMENT_H
   3 
   4 #include <linux/string.h>
   5 
   6 #define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr)))
   7 #define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr))))
   8 
   9 extern int bad_user_access_length(void);
  10 
  11 static inline void __put_user(unsigned long x, void * y, int size)
     /* [previous][next][first][last][top][bottom][index][help] */
  12 {
  13         switch (size) {
  14                 case 1:
  15                         *(char *) y = x;
  16                         break;
  17                 case 2:
  18                         *(short *) y = x;
  19                         break;
  20                 case 4:
  21                         *(int *) y = x;
  22                         break;
  23                 case 8:
  24                         *(long *) y = x;
  25                         break;
  26                 default:
  27                         bad_user_access_length();
  28         }
  29 }
  30 
  31 static inline unsigned long __get_user(const void * y, int size)
     /* [previous][next][first][last][top][bottom][index][help] */
  32 {
  33         switch (size) {
  34                 case 1:
  35                         return *(unsigned char *) y;
  36                 case 2:
  37                         return *(unsigned short *) y;
  38                 case 4:
  39                         return *(unsigned int *) y;
  40                 case 8:
  41                         return *(unsigned long *) y;
  42                 default:
  43                         return bad_user_access_length();
  44         }
  45 }
  46 
  47 static inline unsigned char get_user_byte(const char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  48 {
  49         return *addr;
  50 }
  51 
  52 #define get_fs_byte(addr) get_user_byte((char *)(addr))
  53 
  54 static inline unsigned short get_user_word(const short *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  55 {
  56         return *addr;
  57 }
  58 
  59 #define get_fs_word(addr) get_user_word((short *)(addr))
  60 
  61 static inline unsigned long get_user_long(const int *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  62 {
  63         return *addr;
  64 }
  65 
  66 #define get_fs_long(addr) get_user_long((int *)(addr))
  67 
  68 static inline unsigned long get_user_quad(const long *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  69 {
  70         return *addr;
  71 }
  72 
  73 #define get_fs_quad(addr) get_user_quad((long *)(addr))
  74 
  75 static inline void put_user_byte(char val,char *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77         *addr = val;
  78 }
  79 
  80 #define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
  81 
  82 static inline void put_user_word(short val,short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  83 {
  84         *addr = val;
  85 }
  86 
  87 #define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
  88 
  89 static inline void put_user_long(unsigned long val,int * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  90 {
  91         *addr = val;
  92 }
  93 
  94 #define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
  95 
  96 static inline void put_user_quad(unsigned long val,long * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  97 {
  98         *addr = val;
  99 }
 100 
 101 #define put_fs_quad(x,addr) put_user_quad((x),(long *)(addr))
 102 
 103 #define memcpy_fromfs(to, from, n) memcpy((to),(from),(n))
 104 
 105 #define memcpy_tofs(to, from, n) memcpy((to),(from),(n))
 106 
 107 /*
 108  * For segmented architectures, these are used to specify which segment
 109  * to use for the above functions.
 110  *
 111  * The powerpc is not segmented, so these are just dummies.
 112  */
 113 
 114 #define KERNEL_DS 0
 115 #define USER_DS 1
 116 
 117 static inline unsigned long get_fs(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 118 {
 119         return 0;
 120 }
 121 
 122 static inline unsigned long get_ds(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 123 {
 124         return 0;
 125 }
 126 
 127 static inline void set_fs(unsigned long val)
     /* [previous][next][first][last][top][bottom][index][help] */
 128 {
 129 }
 130 
 131 #endif /* _ASM_SEGMENT_H */

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