Skip to content
Snippets Groups Projects
Commit d0f3efca authored by Austin Clements's avatar Austin Clements
Browse files

Use stosl in memset; makes boot time bearable

parent e25b74ca
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,11 @@
void*
memset(void *dst, int c, uint n)
{
stosb(dst, c, n);
if ((int)dst%4 == 0 && n%4 == 0){
c &= 0xFF;
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
} else
stosb(dst, c, n);
return dst;
}
......
......@@ -48,6 +48,15 @@ stosb(void *addr, int data, int cnt)
"memory", "cc");
}
static inline void
stosl(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosl" :
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
struct segdesc;
static inline void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment