static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_amd64)
- return (CORE_ADDR**)(tst->arch.vex.guest_FS_ZERO + 0x8);
-#else
- vg_assert(0);
-#endif
+ VexGuestAMD64State* amd64 = (VexGuestAMD64State*)&tst->arch.vex;
+ return (CORE_ADDR**)((CORE_ADDR)amd64->guest_FS_ZERO + 0x8);
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_arm)
+ VexGuestARMState* arm = (VexGuestARMState*)&tst->arch.vex;
// arm dtv is pointed to by TPIDRURO
- return (CORE_ADDR**)(tst->arch.vex.guest_TPIDRURO);
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)arm->guest_TPIDRURO);
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_arm64)
+ VexGuestARM64State* arm64 = (VexGuestARM64State*)&tst->arch.vex;
// arm64 dtv is pointed to by TPIDR_EL0.
- return (CORE_ADDR**)(tst->arch.vex.guest_TPIDR_EL0);
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)arm64->guest_TPIDR_EL0);
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_mips32)
+ VexGuestMIPS32State* mips32 = (VexGuestMIPS32State*)&tst->arch.vex;
// mips32 dtv location similar to ppc64
- return (CORE_ADDR**)(tst->arch.vex.guest_ULR - 0x7000 - sizeof(CORE_ADDR));
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)mips32->guest_ULR
+ - 0x7000 - sizeof(CORE_ADDR));
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_mips64)
+ VexGuestMIPS64State* mips64 = (VexGuestMIPS64State*)&tst->arch.vex;
// mips64 dtv location similar to ppc64
- return (CORE_ADDR**)(tst->arch.vex.guest_ULR - 0x7000 - sizeof(CORE_ADDR));
- return NULL;
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)mips64->guest_ULR
+ - 0x7000 - sizeof(CORE_ADDR));
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_ppc32)
+ VexGuestPPC32State* ppc32 = (VexGuestPPC32State*)&tst->arch.vex;
// ppc32 dtv is located just before the tcb, which is 0x7000 before
// the thread id (r2)
- return (CORE_ADDR**)(tst->arch.vex.guest_GPR2 - 0x7000 - sizeof(CORE_ADDR));
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)ppc32->guest_GPR2
+ - 0x7000 - sizeof(CORE_ADDR));
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_ppc64be) || defined(VGA_ppc64le)
+ VexGuestPPC64State* ppc64 = (VexGuestPPC64State*)&tst->arch.vex;
// ppc64 dtv is located just before the tcb, which is 0x7000 before
// the thread id (r13)
- return (CORE_ADDR**)(tst->arch.vex.guest_GPR13 - 0x7000 - sizeof(CORE_ADDR));
-#else
- vg_assert(0);
-#endif
+ return (CORE_ADDR**)((CORE_ADDR)ppc64->guest_GPR13
+ - 0x7000 - sizeof(CORE_ADDR));
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_s390x)
+ VexGuestS390XState* s390x = (VexGuestS390XState*)&tst->arch.vex;
// Thread pointer is in a0 (high 32 bits) and a1. Dtv is the second word.
- return (CORE_ADDR**)(((CORE_ADDR)tst->arch.vex.guest_a0 << 32
- | (CORE_ADDR)tst->arch.vex.guest_a1)
+ return (CORE_ADDR**)((Addr)((Addr64)s390x->guest_a0 << 32
+ | (Addr64)s390x->guest_a1)
+ sizeof(CORE_ADDR));
-#else
- vg_assert(0);
-#endif
}
static struct valgrind_target_ops low_target = {
static CORE_ADDR** target_get_dtv (ThreadState *tst)
{
-#if defined(VGA_x86)
+ VexGuestX86State* x86 = (VexGuestX86State*)&tst->arch.vex;
// FIXME: should make the below formally visible from VEX.
extern ULong x86g_use_seg_selector ( HWord ldt, HWord gdt,
UInt seg_selector, UInt virtual_addr );
- ULong dtv_loc_g = x86g_use_seg_selector (tst->arch.vex.guest_LDT,
- tst->arch.vex.guest_GDT,
- tst->arch.vex.guest_GS,
+ ULong dtv_loc_g = x86g_use_seg_selector (x86->guest_LDT,
+ x86->guest_GDT,
+ x86->guest_GS,
0x4);
if (dtv_loc_g == 1ULL << 32) {
dlog(0, "Error getting x86 dtv\n");
CORE_ADDR dtv_loc = dtv_loc_g;
return (CORE_ADDR**)dtv_loc;
}
-#else
- vg_assert(0);
-#endif
}
static struct valgrind_target_ops low_target = {
stdinB: hgtls.stdinB.gdb
stdoutB_filter: filter_gdb
stderrB_filter: filter_make_empty
-# stderrB_filter_args: hg01_all_ok.c