From patchwork Fri Feb 10 02:54:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Tang" X-Patchwork-Id: 726390 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3vKKKh5Cdhz9s7N for ; Fri, 10 Feb 2017 13:54:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A37644AB34; Fri, 10 Feb 2017 03:54:26 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iplg5ScCVrs0; Fri, 10 Feb 2017 03:54:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DABA84A08A; Fri, 10 Feb 2017 03:54:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 20B724A08A for ; Fri, 10 Feb 2017 03:54:21 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qzteUXBjlNbz for ; Fri, 10 Feb 2017 03:54:20 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from highcastle.jtang.org (mail.jtang.org [173.10.136.73]) by theia.denx.de (Postfix) with ESMTP id BE8B44A068 for ; Fri, 10 Feb 2017 03:54:16 +0100 (CET) Received: from krondor.isles (krondor.isles [192.168.1.2]) (Authenticated sender: tang) by highcastle.jtang.org (Postfix) with ESMTPSA id 0635DBF05E; Thu, 9 Feb 2017 21:54:15 -0500 (EST) From: "J. Tang" Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Message-Id: Date: Thu, 9 Feb 2017 21:54:13 -0500 To: U-Boot Mailing List , Meng Bin , Simon Glass X-Mailer: Apple Mail (2.3259) Subject: [U-Boot] [PATCH] x86: Force 32-bit jumps in interrupt handlers X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Depending upon the compiler used, IRQ entries could vary in sizes. With GCC 5.x, the code generator will use short jumps for some IRQ entries but near jumps for others. For example, GCC 5.4.0 generates the following: $ objdump -d interrupt.o 00000207 : 207: 6a 12 push $0x12 209: eb 85 jmp 190 0000020b : 20b: 6a 13 push $0x13 20d: eb 81 jmp 190 0000020f : 20f: 6a 14 push $0x14 211: e9 7a ff ff ff jmp 190 00000216 : 216: 6a 15 push $0x15 218: e9 73 ff ff ff jmp 190 This causes a problem in cpu_init_interrupts(), because the IDT setup assumed same sizes for all IRQ entries. GCC 4.x always generated 32-bit jumps, so this previously was not a problem. The fix is to force 32-bit near jumps for all entries within the inline assembly. This works for GCC 5.x, and 4.x was already using that form of jumping. Signed-off-by: Jason Tang Reviewed-by: Bin Meng --- arch/x86/cpu/i386/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c index a058303..ba576fe 100644 --- a/arch/x86/cpu/i386/interrupt.c +++ b/arch/x86/cpu/i386/interrupt.c @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR; ".type irq_"#x", @function\n" \ "irq_"#x":\n" \ "pushl $"#x"\n" \ - "jmp irq_common_entry\n" + "jmp.d32 irq_common_entry\n" static char *exceptions[] = { "Divide Error",