From patchwork Wed Oct 6 07:18:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 234911 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o967FP8t009164 for ; Wed, 6 Oct 2010 07:15:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932136Ab0JFHP6 (ORCPT ); Wed, 6 Oct 2010 03:15:58 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:50894 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932110Ab0JFHP5 (ORCPT ); Wed, 6 Oct 2010 03:15:57 -0400 Received: by mail-pw0-f46.google.com with SMTP id 5so1626982pwj.19 for ; Wed, 06 Oct 2010 00:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=3jcs5soTW3quggOMFDgEhQOdtLdmhwSK+u/2X+LeDDg=; b=cVIsSXwYjEWsIQEWBv6rCr8lC+8cseK+8uk7/f1a3lFRzesg3W3Als+WeSc+DEORfI HqE9iyIIY8thFs5sy3CwMADIXbjXoiIobVPZJ0zAYk01msMzS/U+ZgdbHe3iNT6XXtvE HNtRZtml6/s6A7GlGh9v30ErrOEyxnneffwIw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=SSsMi0kqPC2hPCzl9KuIiRT5ctVasZNJrX+tmcmp2vqfHEtxKk6JqM1sYnJDv5YAJ9 BPzxPlQzbOGb+cq6h1+WAUxh+jbb+P2deepo8rYuN5DaJSugTZNc0iwdnqwA5bvlRZQj bEGm7oxYas/4vcsGehNyyI4u9m2G8EqXHvdhw= Received: by 10.142.223.7 with SMTP id v7mr772968wfg.358.1286349357655; Wed, 06 Oct 2010 00:15:57 -0700 (PDT) Received: from [127.0.0.1] (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id s5sm836705wak.12.2010.10.06.00.15.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 06 Oct 2010 00:15:56 -0700 (PDT) From: Magnus Damm To: linux@arm.linux.org.uk Cc: grant.likely@secretlab.ca, Magnus Damm , lethal@linux-sh.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org Date: Wed, 06 Oct 2010 16:18:05 +0900 Message-Id: <20101006071805.28048.37136.sendpatchset@t400s> In-Reply-To: <20101006071731.28048.89938.sendpatchset@t400s> References: <20101006071731.28048.89938.sendpatchset@t400s> Subject: [PATCH 04/08] ARM: Convert __irq_svc and __usr_svc to macros Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 06 Oct 2010 07:15:58 +0000 (UTC) --- 0004/arch/arm/include/asm/entry-header.S +++ work/arch/arm/include/asm/entry-header.S 2010-10-06 15:07:50.000000000 +0900 @@ -334,3 +334,81 @@ tsk .req r9 @ current thread_info #endif #endif .endm + + .macro __irq_svc, name + .align 5 + .globl __irq_svc_\name +__irq_svc_\name: + svc_entry + +#ifdef CONFIG_TRACE_IRQFLAGS + bl trace_hardirqs_off +#endif +#ifdef CONFIG_PREEMPT + get_thread_info tsk + ldr r8, [tsk, #TI_PREEMPT] @ get preempt count + add r7, r8, #1 @ increment it + str r7, [tsk, #TI_PREEMPT] +#endif + + irq_handler +#ifdef CONFIG_PREEMPT + str r8, [tsk, #TI_PREEMPT] @ restore preempt count + ldr r0, [tsk, #TI_FLAGS] @ get flags + teq r8, #0 @ if preempt count != 0 + movne r0, #0 @ force flags to 0 + tst r0, #_TIF_NEED_RESCHED + blne svc_preempt +#endif + ldr r4, [sp, #S_PSR] @ irqs are already disabled +#ifdef CONFIG_TRACE_IRQFLAGS + tst r4, #PSR_I_BIT + bleq trace_hardirqs_on +#endif + svc_exit r4 @ return from exception + UNWIND(.fnend ) +ENDPROC(__irq_svc_\name) + + .ltorg + +#ifdef CONFIG_PREEMPT +svc_preempt: + mov r8, lr +1: bl preempt_schedule_irq @ irq en/disable is done inside + ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS + tst r0, #_TIF_NEED_RESCHED + moveq pc, r8 @ go again + b 1b +#endif + .endm + + .macro __irq_usr, name + .align 5 + .globl __irq_usr_\name +__irq_usr_\name: + usr_entry + kuser_cmpxchg_check + + get_thread_info tsk +#ifdef CONFIG_PREEMPT + ldr r8, [tsk, #TI_PREEMPT] @ get preempt count + add r7, r8, #1 @ increment it + str r7, [tsk, #TI_PREEMPT] +#endif + + irq_handler +#ifdef CONFIG_PREEMPT + ldr r0, [tsk, #TI_PREEMPT] + str r8, [tsk, #TI_PREEMPT] + teq r0, r7 + ARM( strne r0, [r0, -r0] ) + THUMB( movne r0, #0 ) + THUMB( strne r0, [r0] ) +#endif + + mov why, #0 + b ret_to_user + UNWIND(.fnend ) +ENDPROC(__irq_usr_\name) + .ltorg + .endm --- 0004/arch/arm/kernel/entry-armv.S +++ work/arch/arm/kernel/entry-armv.S 2010-10-06 15:07:23.000000000 +0900 @@ -128,49 +128,7 @@ __dabt_svc: UNWIND(.fnend ) ENDPROC(__dabt_svc) - .align 5 -__irq_svc: - svc_entry - -#ifdef CONFIG_TRACE_IRQFLAGS - bl trace_hardirqs_off -#endif -#ifdef CONFIG_PREEMPT - get_thread_info tsk - ldr r8, [tsk, #TI_PREEMPT] @ get preempt count - add r7, r8, #1 @ increment it - str r7, [tsk, #TI_PREEMPT] -#endif - - irq_handler -#ifdef CONFIG_PREEMPT - str r8, [tsk, #TI_PREEMPT] @ restore preempt count - ldr r0, [tsk, #TI_FLAGS] @ get flags - teq r8, #0 @ if preempt count != 0 - movne r0, #0 @ force flags to 0 - tst r0, #_TIF_NEED_RESCHED - blne svc_preempt -#endif - ldr r4, [sp, #S_PSR] @ irqs are already disabled -#ifdef CONFIG_TRACE_IRQFLAGS - tst r4, #PSR_I_BIT - bleq trace_hardirqs_on -#endif - svc_exit r4 @ return from exception - UNWIND(.fnend ) -ENDPROC(__irq_svc) - - .ltorg - -#ifdef CONFIG_PREEMPT -svc_preempt: - mov r8, lr -1: bl preempt_schedule_irq @ irq en/disable is done inside - ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS - tst r0, #_TIF_NEED_RESCHED - moveq pc, r8 @ go again - b 1b -#endif + __irq_svc default .align 5 __und_svc: @@ -300,34 +258,7 @@ __dabt_usr: UNWIND(.fnend ) ENDPROC(__dabt_usr) - .align 5 -__irq_usr: - usr_entry - kuser_cmpxchg_check - - get_thread_info tsk -#ifdef CONFIG_PREEMPT - ldr r8, [tsk, #TI_PREEMPT] @ get preempt count - add r7, r8, #1 @ increment it - str r7, [tsk, #TI_PREEMPT] -#endif - - irq_handler -#ifdef CONFIG_PREEMPT - ldr r0, [tsk, #TI_PREEMPT] - str r8, [tsk, #TI_PREEMPT] - teq r0, r7 - ARM( strne r0, [r0, -r0] ) - THUMB( movne r0, #0 ) - THUMB( strne r0, [r0] ) -#endif - - mov why, #0 - b ret_to_user - UNWIND(.fnend ) -ENDPROC(__irq_usr) - - .ltorg + __irq_usr default .align 5 __und_usr: @@ -952,10 +883,10 @@ __stubs_start: */ vector_stub irq, IRQ_MODE, 4 - .long __irq_usr @ 0 (USR_26 / USR_32) + .long __irq_usr_default @ 0 (USR_26 / USR_32) .long __irq_invalid @ 1 (FIQ_26 / FIQ_32) .long __irq_invalid @ 2 (IRQ_26 / IRQ_32) - .long __irq_svc @ 3 (SVC_26 / SVC_32) + .long __irq_svc_default @ 3 (SVC_26 / SVC_32) .long __irq_invalid @ 4 .long __irq_invalid @ 5 .long __irq_invalid @ 6