This source file includes following definitions.
- get_fs_byte
- get_fs_byte
- get_fs_word
- get_fs_word
- get_fs_long
- get_fs_long
- get_fs_long
- get_fs_long
- put_fs_byte
- put_fs_byte
- put_fs_word
- put_fs_word
- put_fs_long
- put_fs_long
- put_fs_long
- put_fs_long
- memcpy_tofs
- memcpy_fromfs
- get_fs
- get_ds
- set_fs
1 static inline unsigned char get_fs_byte(const char * addr)
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)
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)
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)
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)
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)
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)
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)
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)
66 {
67 __asm__ ("movb %0,%%fs:%1": :"iq" (val),"m" (*addr));
68 }
69
70 static inline void put_fs_byte(char val,unsigned char *addr)
71 {
72 __asm__ ("movb %0,%%fs:%1": :"iq" (val),"m" (*addr));
73 }
74
75 static inline void put_fs_word(short val,short * addr)
76 {
77 __asm__ ("movw %0,%%fs:%1": :"ir" (val),"m" (*addr));
78 }
79
80 static inline void put_fs_word(short val,unsigned short * addr)
81 {
82 __asm__ ("movw %0,%%fs:%1": :"ir" (val),"m" (*addr));
83 }
84
85 static inline void put_fs_long(unsigned long val,int * addr)
86 {
87 __asm__ ("movl %0,%%fs:%1": :"ir" (val),"m" (*addr));
88 }
89
90 static inline void put_fs_long(unsigned long val,unsigned int * addr)
91 {
92 __asm__ ("movl %0,%%fs:%1": :"ir" (val),"m" (*addr));
93 }
94
95 static inline void put_fs_long(unsigned long val,long * addr)
96 {
97 __asm__ ("movl %0,%%fs:%1": :"ir" (val),"m" (*addr));
98 }
99
100 static inline void put_fs_long(unsigned long val,unsigned long * addr)
101 {
102 __asm__ ("movl %0,%%fs:%1": :"ir" (val),"m" (*addr));
103 }
104
105 static inline void memcpy_tofs(void * to, const void * from, unsigned long n)
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 :
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)
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 :
137 :"c" (n),"D" ((long) to),"S" ((long) from)
138 :"cx","di","si");
139 }
140
141
142
143
144
145
146
147
148 static inline unsigned long get_fs(void)
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)
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)
163 {
164 __asm__ __volatile__("mov %w0,%%fs": :"r" (val));
165 }
166