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" \ > > + : "=r"(r)) > > +#define EXCEPTION_REGION_END(r, lb) \ > > + asm volatile("popq %%rdx\n\t" \ > > + "mov $0, %0\n\t" \ > > + lb":\n\t": \ > > + "=r"(r) :: "%rdx") > > These mess up the stack, no? So if any intervening code uses %rsp based > addressing, it will get incorrect information. Yes, but I meant to only include instruction directly in the “region”, and support nobody should touch $rsp then. It's directly and simple enough. > > I suggest using a special data section like the kernel. Kind of more complex... > > Also, most tests that use asm don't need an exception region, but will > want to trap an exception on a single address. So need a macro designed > 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 don't know how to get it)... Use a label here seems the simplest way to get the address right. -- regards Yang, Sheng -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html