|
@@ -192,17 +192,24 @@ memmove ( void *dest, const void *src, size_t len ) {
|
192
|
192
|
}
|
193
|
193
|
|
194
|
194
|
#define __HAVE_ARCH_MEMSET
|
195
|
|
-static inline void * memset(void *s, int c,size_t count)
|
196
|
|
-{
|
197
|
|
-int d0, d1;
|
198
|
|
-__asm__ __volatile__(
|
199
|
|
- "cld\n\t"
|
200
|
|
- "rep\n\t"
|
201
|
|
- "stosb"
|
202
|
|
- : "=&c" (d0), "=&D" (d1)
|
203
|
|
- :"a" (c),"1" (s),"0" (count)
|
204
|
|
- :"memory");
|
205
|
|
-return s;
|
|
195
|
+
|
|
196
|
+/**
|
|
197
|
+ * Fill memory region
|
|
198
|
+ *
|
|
199
|
+ * @v dest Destination address
|
|
200
|
+ * @v fill Fill pattern
|
|
201
|
+ * @v len Length
|
|
202
|
+ * @ret dest Destination address
|
|
203
|
+ */
|
|
204
|
+static inline void * memset ( void *dest, int fill, size_t len ) {
|
|
205
|
+ void *discard_D;
|
|
206
|
+ size_t discard_c;
|
|
207
|
+
|
|
208
|
+ __asm__ __volatile__ ( "rep stosb"
|
|
209
|
+ : "=&D" ( discard_D ), "=&c" ( discard_c )
|
|
210
|
+ : "0" ( dest ), "1" ( len ), "a" ( fill )
|
|
211
|
+ : "memory" );
|
|
212
|
+ return dest;
|
206
|
213
|
}
|
207
|
214
|
|
208
|
215
|
#define __HAVE_ARCH_MEMSWAP
|