diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-04-25 21:31:25 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-04-25 21:31:25 +0000 |
commit | 99f2c1afbd977dfb2f1ee7c57932c6430dae32d2 (patch) | |
tree | 7fb7d638a1c9473d9fde762b1b86b4926219aeba /sys/arch/amd64 | |
parent | 3359f9df87afe1ba911626314803d08996db40a6 (diff) |
We now following the ABI and always clear cld on function entry, so remove
the extra CLD instructions from when that wasn't true
testing miod@ krw@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/bus_space.c | 46 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/copy.S | 10 | ||||
-rw-r--r-- | sys/arch/amd64/include/pio.h | 14 |
3 files changed, 32 insertions, 38 deletions
diff --git a/sys/arch/amd64/amd64/bus_space.c b/sys/arch/amd64/amd64/bus_space.c index 5cf9a745314..87813aab39d 100644 --- a/sys/arch/amd64/amd64/bus_space.c +++ b/sys/arch/amd64/amd64/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.25 2014/11/16 12:30:56 deraadt Exp $ */ +/* $OpenBSD: bus_space.c,v 1.26 2015/04/25 21:31:24 guenther Exp $ */ /* $NetBSD: bus_space.c,v 1.2 2003/03/14 18:47:53 christos Exp $ */ /*- @@ -694,7 +694,7 @@ x86_bus_space_io_read_region_1(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile(" cld ;" + __asm volatile( "1: inb %w1,%%al ;" " stosb ;" " incl %1 ;" @@ -714,7 +714,7 @@ x86_bus_space_io_read_region_2(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile(" cld ;" + __asm volatile( "1: inw %w1,%%ax ;" " stosw ;" " addl $2,%1 ;" @@ -734,7 +734,7 @@ x86_bus_space_io_read_region_4(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile("cld ;" + __asm volatile( "1: inl %w1,%%eax ;" " stosl ;" " addl $4,%1 ;" @@ -813,7 +813,7 @@ x86_bus_space_io_write_region_1(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile("cld ;" + __asm volatile( "1: lodsb ;" " outb %%al,%w1 ;" " incl %1 ;" @@ -833,7 +833,7 @@ x86_bus_space_io_write_region_2(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile("cld ;" + __asm volatile( "1: lodsw ;" " outw %%ax,%w1 ;" " addl $2,%1 ;" @@ -853,7 +853,7 @@ x86_bus_space_io_write_region_4(bus_space_handle_t h, int dummy3; int __x; u_int32_t port = h + o; - __asm volatile(" cld ;" + __asm volatile( "1: lodsl ;" " outl %%eax,%w1 ;" " addl $4,%1 ;" @@ -1066,7 +1066,7 @@ x86_bus_space_mem_read_multi_1(bus_space_handle_t h, bus_size_t o, int dummy2; void *dummy3; int __x; - __asm volatile(" cld ;" + __asm volatile( "1: movb (%2),%%al ;" " stosb ;" " loop 1b" : @@ -1083,7 +1083,7 @@ x86_bus_space_mem_read_multi_2(bus_space_handle_t h, bus_size_t o, int dummy2; void *dummy3; int __x; - __asm volatile(" cld ;" + __asm volatile( "1: movw (%2),%%ax ;" " stosw ;" " loop 1b" : @@ -1100,7 +1100,7 @@ x86_bus_space_mem_read_multi_4(bus_space_handle_t h, bus_size_t o, int dummy2; void *dummy3; int __x; - __asm volatile(" cld ;" + __asm volatile( "1: movl (%2),%%eax ;" " stosl ;" " loop 1b" : @@ -1117,7 +1117,7 @@ x86_bus_space_mem_read_multi_8(bus_space_handle_t h, bus_size_t o, int dummy2; void *dummy3; int __x; - __asm volatile(" cld ;" + __asm volatile( "1: movq (%2),%%rax ;" " stosq ;" " loop 1b" : @@ -1133,7 +1133,7 @@ x86_bus_space_mem_read_region_1(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile(" cld ;" + __asm volatile( " repne ;" " movsb" : "=S" (dummy1), "=D" (dummy2), "=c" (dummy3) : @@ -1148,7 +1148,7 @@ x86_bus_space_mem_read_region_2(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile(" cld ;" + __asm volatile( " repne ;" " movsw" : "=S" (dummy1), "=D" (dummy2), "=c" (dummy3) : @@ -1163,7 +1163,7 @@ x86_bus_space_mem_read_region_4(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsl" : "=S" (dummy1), "=D" (dummy2), "=c" (dummy3) : @@ -1178,7 +1178,7 @@ x86_bus_space_mem_read_region_8(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsq" : "=S" (dummy1), "=D" (dummy2), "=c" (dummy3) : @@ -1206,7 +1206,7 @@ x86_bus_space_mem_write_multi_1(bus_space_handle_t h, int dummy2; void *dummy3; int __x; - __asm volatile("cld ;" + __asm volatile( "1: lodsb ;" " movb %%al,(%2) ;" " loop 1b" : @@ -1222,7 +1222,7 @@ x86_bus_space_mem_write_multi_2(bus_space_handle_t h, int dummy2; void *dummy3; int __x; - __asm volatile("cld ;" + __asm volatile( "1: lodsw ;" " movw %%ax,(%2) ;" " loop 1b" : @@ -1238,7 +1238,7 @@ x86_bus_space_mem_write_multi_4(bus_space_handle_t h, int dummy2; void *dummy3; int __x; - __asm volatile("cld ;" + __asm volatile( "1: lodsl ;" " movl %%eax,(%2) ;" " loop 1b" : @@ -1254,7 +1254,7 @@ x86_bus_space_mem_write_multi_8(bus_space_handle_t h, int dummy2; void *dummy3; int __x; - __asm volatile("cld ;" + __asm volatile( "1: lodsq ;" " movq %%rax,(%2) ;" " loop 1b" : @@ -1269,7 +1269,7 @@ x86_bus_space_mem_write_region_1(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsb" : "=D" (dummy1), "=S" (dummy2), "=c" (dummy3) : @@ -1284,7 +1284,7 @@ x86_bus_space_mem_write_region_2(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsw" : "=D" (dummy1), "=S" (dummy2), "=c" (dummy3) : @@ -1299,7 +1299,7 @@ x86_bus_space_mem_write_region_4(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsl" : "=D" (dummy1), "=S" (dummy2), "=c" (dummy3) : @@ -1314,7 +1314,7 @@ x86_bus_space_mem_write_region_8(bus_space_handle_t h, int dummy1; void *dummy2; int dummy3; - __asm volatile("cld ;" + __asm volatile( " repne ;" " movsq" : "=D" (dummy1), "=S" (dummy2), "=c" (dummy3) : diff --git a/sys/arch/amd64/amd64/copy.S b/sys/arch/amd64/amd64/copy.S index c638e2d1683..ba71b7fa2be 100644 --- a/sys/arch/amd64/amd64/copy.S +++ b/sys/arch/amd64/amd64/copy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: copy.S,v 1.6 2015/01/16 10:17:51 sf Exp $ */ +/* $OpenBSD: copy.S,v 1.7 2015/04/25 21:31:24 guenther Exp $ */ /* $NetBSD: copy.S,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /* @@ -81,8 +81,7 @@ ENTRY(kcopy) subq %rsi,%rax cmpq %rcx,%rax # overlapping? jb 1f - cld # nope, copy forward - shrq $3,%rcx # copy by 64-bit words + shrq $3,%rcx # nope, copy forward by 64-bit words rep movsq @@ -134,7 +133,6 @@ ENTRY(copyout) leaq _C_LABEL(copy_fault)(%rip),%r11 movq %r11,PCB_ONFAULT(%rdx) SMAP_STAC - cld movq %rax,%rcx shrq $3,%rcx rep @@ -165,7 +163,6 @@ ENTRY(copyin) ja _C_LABEL(copy_efault) 3: /* bcopy(%rsi, %rdi, %rax); */ - cld movq %rax,%rcx shrq $3,%rcx rep @@ -211,7 +208,6 @@ ENTRY(copyoutstr) movq %rax,%r8 1: incq %rdx - cld 1: decq %rdx jz 2f @@ -254,7 +250,6 @@ ENTRY(copyinstr) movq %rax,%r8 1: incq %rdx - cld 1: decq %rdx jz 2f @@ -296,7 +291,6 @@ ENTRY(copystr) movq %rdx,%r8 incq %rdx - cld 1: decq %rdx jz 4f diff --git a/sys/arch/amd64/include/pio.h b/sys/arch/amd64/include/pio.h index 928564c73d8..8715a186b19 100644 --- a/sys/arch/amd64/include/pio.h +++ b/sys/arch/amd64/include/pio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pio.h,v 1.4 2014/03/29 18:09:28 guenther Exp $ */ +/* $OpenBSD: pio.h,v 1.5 2015/04/25 21:31:24 guenther Exp $ */ /* $NetBSD: pio.h,v 1.2 2003/02/27 11:22:46 fvdl Exp $ */ /*- @@ -78,7 +78,7 @@ insb(unsigned port, void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\tinsb" : + __asm volatile("repne\n\tinsb" : "=D" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt) : "memory"); @@ -108,7 +108,7 @@ insw(unsigned port, void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\tinsw" : + __asm volatile("repne\n\tinsw" : "=D" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt) : "memory"); @@ -138,7 +138,7 @@ insl(unsigned port, void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\tinsl" : + __asm volatile("repne\n\tinsl" : "=D" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt) : "memory"); @@ -165,7 +165,7 @@ outsb(unsigned port, const void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\toutsb" : + __asm volatile("repne\n\toutsb" : "=S" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt)); } @@ -191,7 +191,7 @@ outsw(unsigned port, const void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\toutsw" : + __asm volatile("repne\n\toutsw" : "=S" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt)); } @@ -217,7 +217,7 @@ outsl(unsigned port, const void *addr, int cnt) { void *dummy1; int dummy2; - __asm volatile("cld\n\trepne\n\toutsl" : + __asm volatile("repne\n\toutsl" : "=S" (dummy1), "=c" (dummy2) : "d" (port), "0" (addr), "1" (cnt)); } |