root/include/asm/segment.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. get_fs_byte
  2. get_fs_byte
  3. get_fs_word
  4. get_fs_word
  5. get_fs_long
  6. get_fs_long
  7. get_fs_long
  8. get_fs_long
  9. put_fs_byte
  10. put_fs_byte
  11. put_fs_word
  12. put_fs_word
  13. put_fs_long
  14. put_fs_long
  15. put_fs_long
  16. put_fs_long
  17. memcpy_tofs
  18. memcpy_fromfs
  19. get_fs
  20. get_ds
  21. set_fs

   1 static inline unsigned char get_fs_byte(const char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
   2 {
   3         register unsigned char _v;
   4 
   5         __asm__ ("movb %%fs:%1,%0":"=q" (_v):"m" (*addr));
   6         return _v;
   7 }
   8 
   9 static inline unsigned char get_fs_byte(const unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  10 {
  11         register unsigned char _v;
  12 
  13         __asm__ ("movb %%fs:%1,%0":"=q" (_v):"m" (*addr));
  14         return _v;
  15 }
  16 
  17 static inline unsigned short get_fs_word(const short *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  18 {
  19         unsigned short _v;
  20 
  21         __asm__ ("movw %%fs:%1,%0":"=r" (_v):"m" (*addr));
  22         return _v;
  23 }
  24 
  25 static inline unsigned short get_fs_word(const unsigned short *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  26 {
  27         unsigned short _v;
  28 
  29         __asm__ ("movw %%fs:%1,%0":"=r" (_v):"m" (*addr));
  30         return _v;
  31 }
  32 
  33 static inline unsigned long get_fs_long(const int *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  34 {
  35         unsigned long _v;
  36 
  37         __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
  38         return _v;
  39 }
  40 
  41 static inline unsigned long get_fs_long(const unsigned int *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  42 {
  43         unsigned long _v;
  44 
  45         __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
  46         return _v;
  47 }
  48 
  49 static inline unsigned long get_fs_long(const long *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  50 {
  51         unsigned long _v;
  52 
  53         __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
  54         return _v;
  55 }
  56 
  57 static inline unsigned long get_fs_long(const unsigned long *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         unsigned long _v;
  60 
  61         __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
  62         return _v;
  63 }
  64 
  65 static inline void put_fs_byte(char val,char *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  66 {
  67 __asm__ ("movb %0,%%fs:%1": /* no outputs */ :"iq" (val),"m" (*addr));
  68 }
  69 
  70 static inline void put_fs_byte(char val,unsigned char *addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  71 {
  72 __asm__ ("movb %0,%%fs:%1": /* no outputs */ :"iq" (val),"m" (*addr));
  73 }
  74 
  75 static inline void put_fs_word(short val,short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77 __asm__ ("movw %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
  78 }
  79 
  80 static inline void put_fs_word(short val,unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  81 {
  82 __asm__ ("movw %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
  83 }
  84 
  85 static inline void put_fs_long(unsigned long val,int * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  86 {
  87 __asm__ ("movl %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
  88 }
  89 
  90 static inline void put_fs_long(unsigned long val,unsigned int * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  91 {
  92 __asm__ ("movl %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
  93 }
  94 
  95 static inline void put_fs_long(unsigned long val,long * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  96 {
  97 __asm__ ("movl %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
  98 }
  99 
 100 static inline void put_fs_long(unsigned long val,unsigned long * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 101 {
 102 __asm__ ("movl %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr));
 103 }
 104 
 105 static inline void memcpy_tofs(void * to, const void * from, unsigned long n)
     /* [previous][next][first][last][top][bottom][index][help] */
 106 {
 107 __asm__("cld\n\t"
 108         "push %%es\n\t"
 109         "push %%fs\n\t"
 110         "pop %%es\n\t"
 111         "testb $1,%%cl\n\t"
 112         "je 1f\n\t"
 113         "movsb\n"
 114         "1:\ttestb $2,%%cl\n\t"
 115         "je 2f\n\t"
 116         "movsw\n"
 117         "2:\tshrl $2,%%ecx\n\t"
 118         "rep ; movsl\n\t"
 119         "pop %%es"
 120         : /* no outputs */
 121         :"c" (n),"D" ((long) to),"S" ((long) from)
 122         :"cx","di","si");
 123 }
 124 
 125 static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
     /* [previous][next][first][last][top][bottom][index][help] */
 126 {
 127 __asm__("cld\n\t"
 128         "testb $1,%%cl\n\t"
 129         "je 1f\n\t"
 130         "fs ; movsb\n"
 131         "1:\ttestb $2,%%cl\n\t"
 132         "je 2f\n\t"
 133         "fs ; movsw\n"
 134         "2:\tshrl $2,%%ecx\n\t"
 135         "rep ; fs ; movsl"
 136         : /* no outputs */
 137         :"c" (n),"D" ((long) to),"S" ((long) from)
 138         :"cx","di","si");
 139 }
 140 
 141 /*
 142  * Someone who knows GNU asm better than I should double check the followig.
 143  * It seems to work, but I don't know if I'm doing something subtly wrong.
 144  * --- TYT, 11/24/91
 145  * [ nothing wrong here, Linus: I just changed the ax to be any reg ]
 146  */
 147 
 148 static inline unsigned long get_fs(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 149 {
 150         unsigned long _v;
 151         __asm__("mov %%fs,%w0":"=r" (_v):"0" (0));
 152         return _v;
 153 }
 154 
 155 static inline unsigned long get_ds(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 156 {
 157         unsigned long _v;
 158         __asm__("mov %%ds,%w0":"=r" (_v):"0" (0));
 159         return _v;
 160 }
 161 
 162 static inline void set_fs(unsigned long val)
     /* [previous][next][first][last][top][bottom][index][help] */
 163 {
 164         __asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val));
 165 }
 166 

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