From owner-svn-src-all@freebsd.org Tue Oct 8 21:14:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EE84137245; Tue, 8 Oct 2019 21:14:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nqpr03trz4Wdl; Tue, 8 Oct 2019 21:14:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D960D6334; Tue, 8 Oct 2019 21:14:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98LEBFB077239; Tue, 8 Oct 2019 21:14:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98LEB2r077230; Tue, 8 Oct 2019 21:14:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910082114.x98LEB2r077230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 8 Oct 2019 21:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353327 - in head/sys: amd64/include x86/include X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: amd64/include x86/include X-SVN-Commit-Revision: 353327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 21:14:12 -0000 Author: mjg Date: Tue Oct 8 21:14:11 2019 New Revision: 353327 URL: https://svnweb.freebsd.org/changeset/base/353327 Log: amd64: plug spurious cld instructions ABI already guarantees the direction is forward. Note this does not take care of i386-specific cld's. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21906 Modified: head/sys/amd64/include/cpufunc.h head/sys/x86/include/bus.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Tue Oct 8 21:14:09 2019 (r353326) +++ head/sys/amd64/include/cpufunc.h Tue Oct 8 21:14:11 2019 (r353327) @@ -231,7 +231,7 @@ inl(u_int port) static __inline void insb(u_int port, void *addr, size_t count) { - __asm __volatile("cld; rep; insb" + __asm __volatile("rep; insb" : "+D" (addr), "+c" (count) : "d" (port) : "memory"); @@ -240,7 +240,7 @@ insb(u_int port, void *addr, size_t count) static __inline void insw(u_int port, void *addr, size_t count) { - __asm __volatile("cld; rep; insw" + __asm __volatile("rep; insw" : "+D" (addr), "+c" (count) : "d" (port) : "memory"); @@ -249,7 +249,7 @@ insw(u_int port, void *addr, size_t count) static __inline void insl(u_int port, void *addr, size_t count) { - __asm __volatile("cld; rep; insl" + __asm __volatile("rep; insl" : "+D" (addr), "+c" (count) : "d" (port) : "memory"); @@ -285,7 +285,7 @@ outl(u_int port, u_int data) static __inline void outsb(u_int port, const void *addr, size_t count) { - __asm __volatile("cld; rep; outsb" + __asm __volatile("rep; outsb" : "+S" (addr), "+c" (count) : "d" (port)); } @@ -293,7 +293,7 @@ outsb(u_int port, const void *addr, size_t count) static __inline void outsw(u_int port, const void *addr, size_t count) { - __asm __volatile("cld; rep; outsw" + __asm __volatile("rep; outsw" : "+S" (addr), "+c" (count) : "d" (port)); } @@ -301,7 +301,7 @@ outsw(u_int port, const void *addr, size_t count) static __inline void outsl(u_int port, const void *addr, size_t count) { - __asm __volatile("cld; rep; outsl" + __asm __volatile("rep; outsl" : "+S" (addr), "+c" (count) : "d" (port)); } Modified: head/sys/x86/include/bus.h ============================================================================== --- head/sys/x86/include/bus.h Tue Oct 8 21:14:09 2019 (r353326) +++ head/sys/x86/include/bus.h Tue Oct 8 21:14:11 2019 (r353327) @@ -280,7 +280,6 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_ else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: movb (%2),%%al \n\ stosb \n\ loop 1b" : @@ -301,7 +300,6 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_ else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: movw (%2),%%ax \n\ stosw \n\ loop 1b" : @@ -322,7 +320,6 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_ else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: movl (%2),%%eax \n\ stosl \n\ loop 1b" : @@ -367,7 +364,6 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: inb %w2,%%al \n\ stosb \n\ incl %2 \n\ @@ -380,7 +376,6 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsb" : "=D" (addr), "=c" (count), "=S" (_port_) : @@ -399,7 +394,6 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: inw %w2,%%ax \n\ stosw \n\ addl $2,%2 \n\ @@ -412,7 +406,6 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsw" : "=D" (addr), "=c" (count), "=S" (_port_) : @@ -431,7 +424,6 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: inl %w2,%%eax \n\ stosl \n\ addl $4,%2 \n\ @@ -444,7 +436,6 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsl" : "=D" (addr), "=c" (count), "=S" (_port_) : @@ -559,7 +550,6 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsb \n\ movb %%al,(%2) \n\ loop 1b" : @@ -580,7 +570,6 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsw \n\ movw %%ax,(%2) \n\ loop 1b" : @@ -601,7 +590,6 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsl \n\ movl %%eax,(%2) \n\ loop 1b" : @@ -647,7 +635,6 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_spac int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsb \n\ outb %%al,%w0 \n\ incl %0 \n\ @@ -660,7 +647,6 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_spac bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsb" : "=D" (_port_), "=S" (addr), "=c" (count) : @@ -679,7 +665,6 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_spac int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsw \n\ outw %%ax,%w0 \n\ addl $2,%0 \n\ @@ -692,7 +677,6 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_spac bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsw" : "=D" (_port_), "=S" (addr), "=c" (count) : @@ -711,7 +695,6 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_spac int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ 1: lodsl \n\ outl %%eax,%w0 \n\ addl $4,%0 \n\ @@ -724,7 +707,6 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_spac bus_space_handle_t _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ - cld \n\ repne \n\ movsl" : "=D" (_port_), "=S" (addr), "=c" (count) :