From patchwork Fri Dec 13 09:19:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 300947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 64AB12C00A0 for ; Fri, 13 Dec 2013 20:20:27 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8AC9893AF3; Fri, 13 Dec 2013 09:20:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lIl5VAi0mcIa; Fri, 13 Dec 2013 09:20:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 103E3939AA; Fri, 13 Dec 2013 09:20:26 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 565D61CE87B for ; Fri, 13 Dec 2013 09:20:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 52D162F003 for ; Fri, 13 Dec 2013 09:20:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nM7ucHLjJi1u for ; Fri, 13 Dec 2013 09:20:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from vaxjo.synopsys.com (us02smtp1.synopsys.com [198.182.60.75]) by silver.osuosl.org (Postfix) with ESMTP id B3DEA27B74 for ; Fri, 13 Dec 2013 09:20:24 +0000 (UTC) Received: from WBSNus02mta1 (us02secmta1.synopsys.com [10.12.235.96]) by vaxjo.synopsys.com (Postfix) with ESMTP id 6D812DA62; Fri, 13 Dec 2013 01:20:24 -0800 (PST) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 5CADB4E213; Fri, 13 Dec 2013 01:20:24 -0800 (PST) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 40D8D4E202; Fri, 13 Dec 2013 01:20:24 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 34D4FA18; Fri, 13 Dec 2013 01:20:24 -0800 (PST) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 2E866A17; Fri, 13 Dec 2013 01:20:24 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 13 Dec 2013 01:20:24 -0800 Received: from vineetg-E6520.internal.synopsys.com (10.12.197.95) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 13 Dec 2013 14:50:19 +0530 From: Vineet Gupta To: Subject: [PATCH v3 4/7] LT.old: Add ARC support Date: Fri, 13 Dec 2013 14:49:23 +0530 Message-ID: <1386926366-16910-5-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1386926366-16910-1-git-send-email-vgupta@synopsys.com> References: <1386926366-16910-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.197.95] Cc: Vineet Gupta , Francois Bedard X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: uclibc-bounces@uclibc.org Signed-off-by: Vineet Gupta --- .../linuxthreads.old/sysdeps/arc/pt-machine.h | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h diff --git a/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h new file mode 100644 index 000000000000..8df1e77e3915 --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) + * + * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. + */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 +#include + +#ifndef PT_EI +# define PT_EI __extern_always_inline +#endif + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +PT_EI long int +testandset (int *spinlock) +{ + unsigned int old = 1; + + /* Atomically exchange @spinlock with 1 */ + __asm__ __volatile__( + "ex %0, [%1]" + : "+r" (old) + : "r" (spinlock) + : "memory"); + + return old; + +} + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. + I don't trust register variables, so let's do this the safe way. */ +#define CURRENT_STACK_FRAME \ +__extension__ ({ char *__sp; __asm__ ("mov %0,sp" : "=r" (__sp)); __sp; }) + +#else +#error PT_MACHINE already defined +#endif /* pt-machine.h */