From patchwork Thu Jan 13 20:51:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Dave Martin X-Patchwork-Id: 476711 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 p0DKsBxW003479 for ; Thu, 13 Jan 2011 20:54:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757044Ab1AMUv4 (ORCPT ); Thu, 13 Jan 2011 15:51:56 -0500 Received: from mail-gw0-f46.google.com ([74.125.83.46]:57175 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756635Ab1AMUv4 (ORCPT ); Thu, 13 Jan 2011 15:51:56 -0500 Received: by gwj20 with SMTP id 20so854719gwj.19 for ; Thu, 13 Jan 2011 12:51:55 -0800 (PST) Received: by 10.91.39.1 with SMTP id r1mr169477agj.149.1294951915171; Thu, 13 Jan 2011 12:51:55 -0800 (PST) Received: from LinaroE102765 ([63.133.153.66]) by mx.google.com with ESMTPS id b27sm457733ana.8.2011.01.13.12.51.53 (version=SSLv3 cipher=RC4-MD5); Thu, 13 Jan 2011 12:51:54 -0800 (PST) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org, Jean Pihet Subject: [PATCH v2 0/1] ARM: Thumb-2: Symbol manipulation macros for function body copying Date: Thu, 13 Jan 2011 14:51:44 -0600 Message-Id: <1294951905-23748-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 13 Jan 2011 20:54:12 +0000 (UTC) diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h index bc63116..636a765 100644 --- a/arch/arm/include/asm/unified.h +++ b/arch/arm/include/asm/unified.h @@ -24,6 +24,32 @@ .syntax unified #endif +#ifndef __ASSEMBLY__ +#include +#define __funcp_to_uint(funcp) ({ \ + uintptr_t __result; \ + \ + asm("" : "=r" (__result) : "0" (funcp)); \ + __result; \ + }) +#define __uint_to_funcp(i, funcp) ({ \ + typeof(funcp) __result; \ + \ + asm("" : "=r" (__result) : "0" (i)); \ + __result; \ + }) +#define FSYM_REBASE(funcp, dest_buf) \ + __uint_to_funcp((uintptr_t)(dest_buf) | FSYM_TYPE(funcp), funcp) + +#ifdef CONFIG_THUMB2_KERNEL +#define FSYM_BASE(funcp) ((void *)(__funcp_to_uint(funcp) & ~(uintptr_t)1)) +#define FSYM_TYPE(funcp) (__funcp_to_uint(funcp) & 1) +#else /* !CONFIG_THUMB2_KERNEL */ +#define FSYM_BASE(funcp) ((void *)__funcp_to_uint(funcp)) +#define FSYM_TYPE(funcp) 0 +#endif /* !CONFIG_THUMB2_KERNEL */ +#endif /* !__ASSEMBLY__ */ + #ifdef CONFIG_THUMB2_KERNEL #if __GNUC__ < 4