From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jordan Justen Subject: Re: [edk2] [PATCH v3 21/27] Ovmf/Xen: add ARM and AArch64 support to XenBusDxe Date: Wed, 04 Feb 2015 13:10:35 -0800 Message-ID: <20150204211035.11847.54872__15995.4249313616$1423084353$gmane$org@jljusten-ivy> References: <1422991212-9257-1-git-send-email-ard.biesheuvel@linaro.org> <1422991212-9257-22-git-send-email-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1422991212-9257-22-git-send-email-ard.biesheuvel@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: edk2-devel@lists.sourceforge.net, Ard Biesheuvel , lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org, julien.grall@linaro.org List-Id: xen-devel@lists.xenproject.org On 2015-02-03 11:20:06, Ard Biesheuvel wrote: > This patch adds support to XenBusDxe for executing on ARM and AArch64 > machines (the former only when built with GCC). > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > OvmfPkg/XenBusDxe/AtomicsGcc.c | 44 +++++++++++++++++++++++++++++++++++++++++ > OvmfPkg/XenBusDxe/XenBusDxe.inf | 3 +++ > 2 files changed, 47 insertions(+) > create mode 100644 OvmfPkg/XenBusDxe/AtomicsGcc.c > > diff --git a/OvmfPkg/XenBusDxe/AtomicsGcc.c b/OvmfPkg/XenBusDxe/AtomicsGcc.c > new file mode 100644 > index 000000000000..a0bdcbf67440 > --- /dev/null > +++ b/OvmfPkg/XenBusDxe/AtomicsGcc.c > @@ -0,0 +1,44 @@ > +/** @file > + Arch-independent implementations of XenBusDxe atomics using GCC __builtins > + > + Copyright (C) 2014, Linaro Ltd. > + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the BSD License > + which accompanies this distribution. The full text of the license may be found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +UINT16 > +EFIAPI > +InternalSyncCompareExchange16 ( > + IN volatile UINT16 *Value, > + IN UINT16 CompareValue, > + IN UINT16 ExchangeValue Can you instead get InterlockedCompareExchange16 added to BaseSynchronizationLib? http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/10470 -Jordan > + ) > +{ > + return __sync_val_compare_and_swap_2 (Value, CompareValue, ExchangeValue); > +} > + > +INT32 > +EFIAPI > +TestAndClearBit ( > + IN INT32 Bit, > + IN volatile VOID *Address > + ) > +{ > + // > + // Calculate the effective address relative to 'Address' based on the > + // higher order bits of 'Bit'. Use signed shift instead of division to > + // ensure we round towards -Inf, and end up with a positive shift in 'Bit', > + // even if 'Bit' itself is negative. > + // > + Address += (Bit >> 5) * sizeof(INT32); > + Bit &= 31; > + > + return (__sync_fetch_and_and_4 (Address, ~(1U << Bit)) & (1U << Bit)) != 0; > +} > diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf > index 31553ac5a64a..949ec0a0c732 100644 > --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf > +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf > @@ -54,6 +54,9 @@ > X64/InterlockedCompareExchange16.nasm > X64/TestAndClearBit.nasm > > +[Sources.AARCH64, Sources.ARM] > + AtomicsGcc.c | GCC > + > [LibraryClasses] > UefiDriverEntryPoint > UefiBootServicesTableLib > -- > 1.8.3.2 > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/edk2-devel