From patchwork Wed Dec 22 15:06:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 427921 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 oBMF6qIb013964 for ; Wed, 22 Dec 2010 15:06:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753516Ab0LVPGm (ORCPT ); Wed, 22 Dec 2010 10:06:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34279 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416Ab0LVPGc (ORCPT ); Wed, 22 Dec 2010 10:06:32 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBMF6WlE015818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Dec 2010 10:06:32 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBMF6Va0021231; Wed, 22 Dec 2010 10:06:32 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id C00AB18D3F9; Wed, 22 Dec 2010 17:06:29 +0200 (IST) From: Gleb Natapov To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH unit-tests 12/16] Fix exception handling on i386 arch. Date: Wed, 22 Dec 2010 17:06:25 +0200 Message-Id: <1293030389-1143-13-git-send-email-gleb@redhat.com> In-Reply-To: <1293030389-1143-1-git-send-email-gleb@redhat.com> References: <1293030389-1143-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@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, 22 Dec 2010 15:06:53 +0000 (UTC) diff --git a/lib/x86/desc.c b/lib/x86/desc.c index 2f73a5a..aa0b4f4 100644 --- a/lib/x86/desc.c +++ b/lib/x86/desc.c @@ -111,6 +111,9 @@ struct ex_record { extern struct ex_record exception_table_start, exception_table_end; +#ifndef __x86_64__ +__attribute__((regparm(1))) +#endif void do_handle_exception(struct ex_regs *regs) { struct ex_record *ex; @@ -162,7 +165,11 @@ asm (".pushsection .text \n\t" #endif "push %"R"di; push %"R"si; push %"R"bp; sub $"S", %"R"sp \n\t" "push %"R"bx; push %"R"dx; push %"R"cx; push %"R"ax \n\t" +#ifdef __x86_64__ "mov %"R"sp, %"R"di \n\t" +#else + "mov %"R"sp, %"R"ax \n\t" +#endif "call do_handle_exception \n\t" "pop %"R"ax; pop %"R"cx; pop %"R"dx; pop %"R"bx \n\t" "add $"S", %"R"sp; pop %"R"bp; pop %"R"si; pop %"R"di \n\t"