From owner-svn-src-projects@FreeBSD.ORG Fri May 9 08:20:48 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CF0F8ED; Fri, 9 May 2014 08:20:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B4757C8; Fri, 9 May 2014 08:20:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s498KmuO026292; Fri, 9 May 2014 08:20:48 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s498KmtA026291; Fri, 9 May 2014 08:20:48 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201405090820.s498KmtA026291@svn.freebsd.org> From: Andrew Turner Date: Fri, 9 May 2014 08:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265758 - projects/arm64/sys/arm64/arm64 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 May 2014 08:20:48 -0000 Author: andrew Date: Fri May 9 08:20:47 2014 New Revision: 265758 URL: http://svnweb.freebsd.org/changeset/base/265758 Log: Implement spinlocks Modified: projects/arm64/sys/arm64/arm64/machdep.c Modified: projects/arm64/sys/arm64/arm64/machdep.c ============================================================================== --- projects/arm64/sys/arm64/arm64/machdep.c Fri May 9 08:18:57 2014 (r265757) +++ projects/arm64/sys/arm64/arm64/machdep.c Fri May 9 08:20:47 2014 (r265758) @@ -218,15 +218,31 @@ void cpu_switch(struct thread *old, stru void spinlock_enter(void) { + struct thread *td; + register_t daif; - printf("spinlock_enter\n"); + td = curthread; + if (td->td_md.md_spinlock_count == 0) { + daif = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_daif = daif; + } else + td->td_md.md_spinlock_count++; + critical_enter(); } void spinlock_exit(void) { + struct thread *td; + register_t daif; - printf("spinlock_exit\n"); + td = curthread; + critical_exit(); + daif = td->td_md.md_saved_daif; + td->td_md.md_spinlock_count--; + if (td->td_md.md_spinlock_count == 0) + intr_restore(daif); } #ifndef _SYS_SYSPROTO_H_