(experimental). Limitations as commented in the code.
git-svn-id: svn://svn.valgrind.org/vex/trunk@1320
happen. Programs that set it to 1 and then rely on the resulting
SIGBUSs to inform them of misaligned accesses will not work.
+ Implementation sysenter is necessarily partial. sysenter is a kind
+ of system call entry. When doing a sysenter, the return address is
+ not known -- that is something that is beyond Vex's knowledge. So
+ the generated IR forces a return to the scheduler, which can do
+ what it likes to simulate the systemter, but it MUST set this
+ thread's guest_EIP field with the continuation address before
+ resuming execution. If that doesn't happen, the thread will jump
+ to address zero, which is probably fatal.
+
This module uses global variables and so is not MT-safe (if that
should ever become relevant).
"%cl", False );
break;
+ /* =-=-=-=-=-=-=-=-=- SYSENTER -=-=-=-=-=-=-=-=-=-= */
+
+ case 0x34:
+ /* Simple implementation needing a long explaination.
+
+ sysenter is a kind of syscall entry. The key thing here
+ is that the return address is not known -- that is
+ something that is beyond Vex's knowledge. So this IR
+ forces a return to the scheduler, which can do what it
+ likes to simulate the systemter, but it MUST set this
+ thread's guest_EIP field with the continuation address
+ before resuming execution. If that doesn't happen, the
+ thread will jump to address zero, which is probably
+ fatal.
+ */
+ jmp_lit(Ijk_SysenterX86, 0/*bogus next EIP value*/);
+ dres.whatNext = Dis_StopHere;
+ DIP("sysenter");
+ break;
+
/* =-=-=-=-=-=-=-=-=- XADD -=-=-=-=-=-=-=-=-=-= */
//-- case 0xC0: /* XADD Gb,Eb */
case Ijk_TInval:
*p++ = 0xBD;
p = emit32(p, VEX_TRC_JMP_TINVAL); break;
+ case Ijk_SysenterX86:
+ *p++ = 0xBD;
+ p = emit32(p, VEX_TRC_JMP_SYSENTER_X86); break;
case Ijk_Ret:
case Ijk_Call:
case Ijk_Boring:
void ppIRJumpKind ( IRJumpKind kind )
{
switch (kind) {
- case Ijk_Boring: vex_printf("Boring"); break;
- case Ijk_Call: vex_printf("Call"); break;
- case Ijk_Ret: vex_printf("Return"); break;
- case Ijk_ClientReq: vex_printf("ClientReq"); break;
- case Ijk_Syscall: vex_printf("Syscall"); break;
- case Ijk_Yield: vex_printf("Yield"); break;
- case Ijk_EmWarn: vex_printf("EmWarn"); break;
- case Ijk_NoDecode: vex_printf("NoDecode"); break;
- case Ijk_MapFail: vex_printf("MapFail"); break;
- case Ijk_TInval: vex_printf("Invalidate"); break;
- default: vpanic("ppIRJumpKind");
+ case Ijk_Boring: vex_printf("Boring"); break;
+ case Ijk_Call: vex_printf("Call"); break;
+ case Ijk_Ret: vex_printf("Return"); break;
+ case Ijk_ClientReq: vex_printf("ClientReq"); break;
+ case Ijk_Syscall: vex_printf("Syscall"); break;
+ case Ijk_Yield: vex_printf("Yield"); break;
+ case Ijk_EmWarn: vex_printf("EmWarn"); break;
+ case Ijk_NoDecode: vex_printf("NoDecode"); break;
+ case Ijk_MapFail: vex_printf("MapFail"); break;
+ case Ijk_TInval: vex_printf("Invalidate"); break;
+ case Ijk_SysenterX86: vex_printf("SysenterX86"); break;
+ default: vpanic("ppIRJumpKind");
}
}
Ijk_EmWarn, /* report emulation warning before continuing */
Ijk_NoDecode, /* next instruction cannot be decoded */
Ijk_MapFail, /* Vex-provided address translation failed */
- Ijk_TInval /* Invalidate translations before continuing. */
+ Ijk_TInval, /* Invalidate translations before continuing. */
+ Ijk_SysenterX86 /* X86 sysenter. guest_EIP becomes invalid
+ at the point this happens. */
}
IRJumpKind;
#define VEX_TRC_JMP_NODECODE 29 /* next instruction in not decodable */
#define VEX_TRC_JMP_MAPFAIL 31 /* address translation failed */
+#define VEX_TRC_JMP_SYSENTER_X86 9 /* simulate X86 sysenter before
+ continuing */
+
#endif /* ndef __LIBVEX_TRC_VALUES_H */