diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-03-03 16:55:15 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-03-03 16:55:15 -0800 |
commit | 6a3dfed789e30191406785ad013619984fba6dda (patch) | |
tree | 02c4994c742c0ecac43ee99dd568686ed68750bc /com32/lib | |
parent | d89b4716c23bd63d068a2fcad66613d7c9b77cc9 (diff) | |
download | syslinux-elf-6a3dfed789e30191406785ad013619984fba6dda.tar.gz syslinux-elf-6a3dfed789e30191406785ad013619984fba6dda.tar.xz syslinux-elf-6a3dfed789e30191406785ad013619984fba6dda.zip |
Drop unnecessary CLD instructions.
The EFI ABI spec states that DF=0 on ABI boundaries, and gcc expects
this. Assume it is safe to rely upon everywhere; drop unnecessary cld
instructions, except on entry and (obviously) after std.
Diffstat (limited to 'com32/lib')
-rw-r--r-- | com32/lib/memcpy.S | 1 | ||||
-rw-r--r-- | com32/lib/mempcpy.S | 1 | ||||
-rw-r--r-- | com32/lib/memset.c | 16 | ||||
-rw-r--r-- | com32/lib/sys/vesa/drawtxt.c | 2 | ||||
-rw-r--r-- | com32/lib/sys/vesa/fill.h | 6 |
5 files changed, 6 insertions, 20 deletions
diff --git a/com32/lib/memcpy.S b/com32/lib/memcpy.S index ed8e20e3..a893d247 100644 --- a/com32/lib/memcpy.S +++ b/com32/lib/memcpy.S @@ -19,7 +19,6 @@ memcpy: movl %ecx, %edx shrl $2, %ecx - cld rep ; movsl jnc 1f # The shrl had carry out if odd word count diff --git a/com32/lib/mempcpy.S b/com32/lib/mempcpy.S index aa17f471..eeab9187 100644 --- a/com32/lib/mempcpy.S +++ b/com32/lib/mempcpy.S @@ -19,7 +19,6 @@ mempcpy: movl %ecx, %edx shrl $2, %ecx - cld rep ; movsl jnc 1f # The shrl had carry out if odd word count diff --git a/com32/lib/memset.c b/com32/lib/memset.c index 522cc59a..516ad475 100644 --- a/com32/lib/memset.c +++ b/com32/lib/memset.c @@ -8,23 +8,11 @@ void *memset(void *dst, int c, size_t n) { char *q = dst; - -#if defined(__i386__) size_t nl = n >> 2; - asm volatile("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb" + + asm volatile("rep ; stosl ; movl %3,%0 ; rep ; stosb" : "+c" (nl), "+D" (q) : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3)); -#elif defined(__x86_64__) - size_t nq = n >> 3; - asm volatile("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb" - : "+c" (nq), "+D" (q) - : "a" ((unsigned char)c * 0x0101010101010101U), - "r" ((uint32_t)n & 7)); -#else - while ( n-- ) { - *q++ = c; - } -#endif return dst; } diff --git a/com32/lib/sys/vesa/drawtxt.c b/com32/lib/sys/vesa/drawtxt.c index 6e21a344..662eebef 100644 --- a/com32/lib/sys/vesa/drawtxt.c +++ b/com32/lib/sys/vesa/drawtxt.c @@ -40,7 +40,7 @@ static int cursor_x, cursor_y; static inline void *copy_dword(void *dst, void *src, size_t dword_count) { - asm volatile("cld; rep; movsl" + asm volatile("rep; movsl" : "+D" (dst), "+S" (src), "+c" (dword_count)); return dst; /* Updated destination pointer */ } diff --git a/com32/lib/sys/vesa/fill.h b/com32/lib/sys/vesa/fill.h index 4d4a9f97..63ca577b 100644 --- a/com32/lib/sys/vesa/fill.h +++ b/com32/lib/sys/vesa/fill.h @@ -37,19 +37,19 @@ static inline struct vesa_char *vesacon_fill(struct vesa_char *ptr, { switch (sizeof(struct vesa_char)) { case 1: - asm volatile("cld; rep; stosb" + asm volatile("rep; stosb" : "+D" (ptr), "+c" (count) : "a" (fill) : "memory"); break; case 2: - asm volatile("cld; rep; stosw" + asm volatile("rep; stosw" : "+D" (ptr), "+c" (count) : "a" (fill) : "memory"); break; case 4: - asm volatile("cld; rep; stosl" + asm volatile("rep; stosl" : "+D" (ptr), "+c" (count) : "a" (fill) : "memory"); |