diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-04-19 23:18:54 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-04-19 23:18:54 -0400 |
commit | d94411414754b65d9d745987db1ed84b92765f61 (patch) | |
tree | 014f7da79beba992130ccc6cff6ce53601bae4ee /src/util.c | |
parent | ff82b24f0096b022e1071670ed5c886fc223b588 (diff) | |
download | seabios-d94411414754b65d9d745987db1ed84b92765f61.tar.gz |
Fixup previous memcpy optimization.
Different gcc versions handle __builtin_memcpy differently.
Add -minline-all-string to force inlining of memcpy on old gcc.
Always use __builtin_memcpy for all memcpy calls.
Use memcpy4() for the option rom case where 4-byte accesses is important.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -181,25 +181,15 @@ memcpy_far(u16 d_seg, void *d_far, u16 s_seg, const void *s_far, size_t len) : "cc", "memory"); } -noinline void * -__memcpy(void *d1, const void *s1, size_t len) +// Memcpy that uses 4-byte accesses +void +memcpy4(void *d1, const void *s1, size_t len) { - void *d = d1; - if (((u32)d1 | (u32)s1 | len) & 3) { - // non-aligned memcpy - asm volatile( - "rep movsb (%%esi),%%es:(%%edi)\n" - : "+c"(len), "+S"(s1), "+D"(d) - : : "cc", "memory"); - return d1; - } - // Common case - use 4-byte copy len /= 4; asm volatile( "rep movsl (%%esi),%%es:(%%edi)\n" - : "+c"(len), "+S"(s1), "+D"(d) + : "+c"(len), "+S"(s1), "+D"(d1) : : "cc", "memory"); - return d1; } void * |