From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 1/2] test: Add IDT framework Date: Thu, 10 Jun 2010 17:55:04 +0800 Message-ID: <201006101755.04411.sheng@linux.intel.com> References: <1276140703-30046-1-git-send-email-sheng@linux.intel.com> <4C10B51C.9070502@redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mga11.intel.com ([192.55.52.93]:13818 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753779Ab0FJJ6K convert rfc822-to-8bit (ORCPT ); Thu, 10 Jun 2010 05:58:10 -0400 In-Reply-To: <4C10B51C.9070502@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 10 June 2010 17:49:16 Avi Kivity wrote: > On 06/10/2010 06:31 AM, Sheng Yang wrote: > > + > > +#define EXCEPTION_REGION_BEGIN(r, lb) \ > > + asm volatile("pushq $"lb"\n\t" \ > > + "mov $2, %0\n\t" \ > > + : "=3Dr"(r)) > > +#define EXCEPTION_REGION_END(r, lb) \ > > + asm volatile("popq %%rdx\n\t" \ > > + "mov $0, %0\n\t" \ > > + lb":\n\t": \ > > + "=3Dr"(r) :: "%rdx") >=20 > These mess up the stack, no? So if any intervening code uses %rsp ba= sed > addressing, it will get incorrect information. Yes, but I meant to only include instruction directly in the =E2=80=9Cr= egion=E2=80=9D, and support=20 nobody should touch $rsp then. It's directly and simple enough. >=20 > I suggest using a special data section like the kernel. Kind of more complex... >=20 > Also, most tests that use asm don't need an exception region, but wil= l > want to trap an exception on a single address. So need a macro desig= ned > to be placed in asm in front of the faulting instruction. Use region here is due to we don't know the size of instruction(or I do= n't know=20 how to get it)... Use a label here seems the simplest way to get the ad= dress=20 right. -- regards Yang, Sheng