[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/tests: Add EIP check to test_x86_emulator.c
On 08/07/2014 11:32 AM, Jan Beulich wrote: >>>> On 07.08.14 at 10:18, <andrew.cooper3@xxxxxxxxxx> wrote: >> On 07/08/2014 09:16, Razvan Cojocaru wrote: >>> The test now also checks that EIP was modified after emulating >>> instructions after (and including) the "movq %mm3,(%ecx)..." >>> code block. >>> >>> Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> >> >> These checks do check that the instruction pointer has changed, which >> catches your problem, but doesn't check that it has changed correctly. >> You need to work out exactly how long the instruction is a verify that >> eip points to first byte of the next instruction. > > And apart from that this should be done for all tests, not just the > MMX/SSE/AVX ones. The other tests already do this, but there it's simpler to check. For example: 218 printf("%-40s", "Testing addl %%ecx,%%eax..."); 219 instr[0] = 0x01; instr[1] = 0xc8; 220 regs.eflags = 0x200; 221 regs.eip = (unsigned long)&instr[0]; 222 regs.ecx = 0x12345678; 223 regs.eax = 0x7FFFFFFF; 224 rc = x86_emulate(&ctxt, &emulops); 225 if ( (rc != X86EMUL_OKAY) || 226 (regs.ecx != 0x12345678) || 227 (regs.eax != 0x92345677) || 228 (regs.eflags != 0xa94) || 229 (regs.eip != (unsigned long)&instr[2]) ) 230 goto fail; 231 printf("okay\n"); Thanks, Razvan Cojocaru _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |