From owner-svn-src-all@freebsd.org Fri Jan 3 10:03:36 2020 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 DC94C1ECF26; Fri, 3 Jan 2020 10:03:36 +0000 (UTC) (envelope-from andrew@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 47q0pw5ZJNz4dYB; Fri, 3 Jan 2020 10:03:36 +0000 (UTC) (envelope-from andrew@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 BA79C2A634; Fri, 3 Jan 2020 10:03:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003A3amh030515; Fri, 3 Jan 2020 10:03:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003A3akg030514; Fri, 3 Jan 2020 10:03:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202001031003.003A3akg030514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 3 Jan 2020 10:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356316 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 356316 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: Fri, 03 Jan 2020 10:03:36 -0000 Author: andrew Date: Fri Jan 3 10:03:36 2020 New Revision: 356316 URL: https://svnweb.freebsd.org/changeset/base/356316 Log: Add the 8 and 16 bit atomic load/store functions with a barrier on arm64. Reviewed by: cem MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22966 Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Fri Jan 3 04:37:47 2020 (r356315) +++ head/sys/arm64/include/atomic.h Fri Jan 3 10:03:36 2020 (r356316) @@ -448,6 +448,34 @@ atomic_swap_64(volatile uint64_t *p, uint64_t val) return (ret); } +static __inline uint8_t +atomic_load_acq_8(volatile uint8_t *p) +{ + uint8_t ret; + + __asm __volatile( + "ldarb %w0, [%1] \n" + : "=&r" (ret) + : "r" (p) + : "memory"); + + return (ret); +} + +static __inline uint16_t +atomic_load_acq_16(volatile uint16_t *p) +{ + uint16_t ret; + + __asm __volatile( + "ldarh %w0, [%1] \n" + : "=&r" (ret) + : "r" (p) + : "memory"); + + return (ret); +} + static __inline uint32_t atomic_load_acq_32(volatile uint32_t *p) { @@ -474,6 +502,28 @@ atomic_load_acq_64(volatile uint64_t *p) : "memory"); return (ret); +} + +static __inline void +atomic_store_rel_8(volatile uint8_t *p, uint8_t val) +{ + + __asm __volatile( + "stlrb %w0, [%1] \n" + : + : "r" (val), "r" (p) + : "memory"); +} + +static __inline void +atomic_store_rel_16(volatile uint16_t *p, uint16_t val) +{ + + __asm __volatile( + "stlrh %w0, [%1] \n" + : + : "r" (val), "r" (p) + : "memory"); } static __inline void