#include "libvex_basictypes.h"
#include "libvex_ir.h"
-#include "libvex_guest_s390x.h" /* VexGuestS390XState */
#include "libvex.h" /* needed for bb_to_IR.h */
-#include "libvex_guest_offsets.h" /* OFFSET_s390x_SYSNO */
#include "libvex_s390x_common.h"
#include "main_util.h" /* vassert */
#include "main_globals.h" /* vex_traceflags */
S390_DECODE_ERROR
} s390_decode_t;
+
/*------------------------------------------------------------*/
/*--- Helpers for constructing IR. ---*/
/*------------------------------------------------------------*/
system_call(IRExpr *sysno)
{
/* Store the system call number in the pseudo register. */
- stmt(IRStmt_Put(OFFSET_s390x_SYSNO, sysno));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_SYSNO), sysno));
/* Store the current IA into guest_IP_AT_SYSCALL. libvex_ir.h says so. */
- stmt(IRStmt_Put(OFFSET_s390x_IP_AT_SYSCALL, mkU64(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_IP_AT_SYSCALL),
+ mkU64(guest_IA_curr_instr)));
/* It's important that all ArchRegs carry their up-to-date value
at this point. So we declare an end-of-block here, which
}
-/* Flags thunk offsets */
-#define S390X_GUEST_OFFSET_CC_OP S390X_GUEST_OFFSET(guest_CC_OP)
-#define S390X_GUEST_OFFSET_CC_DEP1 S390X_GUEST_OFFSET(guest_CC_DEP1)
-#define S390X_GUEST_OFFSET_CC_DEP2 S390X_GUEST_OFFSET(guest_CC_DEP2)
-#define S390X_GUEST_OFFSET_CC_NDEP S390X_GUEST_OFFSET(guest_CC_NDEP)
-
/*------------------------------------------------------------*/
/*--- Build the flags thunk. ---*/
/*------------------------------------------------------------*/
{
UInt op_off, dep1_off, dep2_off, ndep_off;
- op_off = S390X_GUEST_OFFSET_CC_OP;
- dep1_off = S390X_GUEST_OFFSET_CC_DEP1;
- dep2_off = S390X_GUEST_OFFSET_CC_DEP2;
- ndep_off = S390X_GUEST_OFFSET_CC_NDEP;
+ op_off = S390X_GUEST_OFFSET(guest_CC_OP);
+ dep1_off = S390X_GUEST_OFFSET(guest_CC_DEP1);
+ dep2_off = S390X_GUEST_OFFSET(guest_CC_DEP2);
+ ndep_off = S390X_GUEST_OFFSET(guest_CC_NDEP);
stmt(IRStmt_Put(op_off, op));
stmt(IRStmt_Put(dep1_off, dep1));
{
IRExpr **args, *call, *op, *dep1, *dep2, *ndep;
- op = IRExpr_Get(S390X_GUEST_OFFSET_CC_OP, Ity_I64);
- dep1 = IRExpr_Get(S390X_GUEST_OFFSET_CC_DEP1, Ity_I64);
- dep2 = IRExpr_Get(S390X_GUEST_OFFSET_CC_DEP2, Ity_I64);
- ndep = IRExpr_Get(S390X_GUEST_OFFSET_CC_NDEP, Ity_I64);
+ op = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_OP), Ity_I64);
+ dep1 = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_DEP1), Ity_I64);
+ dep2 = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_DEP2), Ity_I64);
+ ndep = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_NDEP), Ity_I64);
args = mkIRExprVec_4(op, dep1, dep2, ndep);
call = mkIRExprCCall(Ity_I32, 0 /*regparm*/,
IRExpr **args, *call, *op, *dep1, *dep2, *ndep, *mask;
mask = mkU64(m);
- op = IRExpr_Get(S390X_GUEST_OFFSET_CC_OP, Ity_I64);
- dep1 = IRExpr_Get(S390X_GUEST_OFFSET_CC_DEP1, Ity_I64);
- dep2 = IRExpr_Get(S390X_GUEST_OFFSET_CC_DEP2, Ity_I64);
- ndep = IRExpr_Get(S390X_GUEST_OFFSET_CC_NDEP, Ity_I64);
+ op = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_OP), Ity_I64);
+ dep1 = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_DEP1), Ity_I64);
+ dep2 = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_DEP2), Ity_I64);
+ ndep = IRExpr_Get(S390X_GUEST_OFFSET(guest_CC_NDEP), Ity_I64);
args = mkIRExprVec_5(mask, op, dep1, dep2, ndep);
call = mkIRExprCCall(Ity_I32, 0 /*regparm*/,
s390_call_calculate_icc(op,dep1,dep2,True)
-#define OFFB_TISTART S390X_GUEST_OFFSET(guest_TISTART)
-#define OFFB_TILEN S390X_GUEST_OFFSET(guest_TILEN)
/*------------------------------------------------------------*/
stmt(IRStmt_Dirty(d));
/* and restart */
- stmt(IRStmt_Put(OFFB_TISTART, mkU64(guest_IA_curr_instr)));
- stmt(IRStmt_Put(OFFB_TILEN, mkU64(4)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TISTART),
+ mkU64(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TILEN), mkU64(4)));
stmt(IRStmt_Exit(mkexpr(cond), Ijk_TInval,
IRConst_U64(guest_IA_curr_instr)));
mkIRExprVec_1(load(Ity_I64, mkexpr(addr2))));
stmt(IRStmt_Dirty(d));
/* and restart */
- stmt(IRStmt_Put(OFFB_TISTART, mkU64(guest_IA_curr_instr)));
- stmt(IRStmt_Put(OFFB_TILEN, mkU64(4)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TISTART),
+ mkU64(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TILEN), mkU64(4)));
stmt(IRStmt_Exit(IRExpr_Const(IRConst_U1(True)), Ijk_TInval,
IRConst_U64(guest_IA_curr_instr)));
/* we know that this will be invalidated */
stmt(IRStmt_Dirty(d));
/* and restart */
- stmt(IRStmt_Put(OFFB_TISTART, mkU64(guest_IA_curr_instr)));
- stmt(IRStmt_Put(OFFB_TILEN, mkU64(4)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TISTART), mkU64(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_TILEN), mkU64(4)));
stmt(IRStmt_Exit(mkexpr(cond), Ijk_TInval,
IRConst_U64(guest_IA_curr_instr)));
IA should be up-to-date since it made so at the start of each
insn, but nevertheless be paranoid and update it again right
now. */
- addStmtToIRSB(irsb, IRStmt_Put(S390X_GUEST_OFFSET(guest_IA),
- mkaddr_expr(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_IA),
+ mkaddr_expr(guest_IA_curr_instr)));
irsb->next = mkaddr_expr(guest_IA_next_instr);
irsb->jumpkind = Ijk_NoDecode;
resteer_data = callback_opaque;
/* Always update the guest IA. See comment in s390_isel_stmt for Ist_Put. */
- addStmtToIRSB(irsb, IRStmt_Put(S390X_GUEST_OFFSET(guest_IA),
- mkaddr_expr(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_IA),
+ mkaddr_expr(guest_IA_curr_instr)));
return disInstr_S390_WRK(guest_code + delta);
}
#include "libvex_basictypes.h"
#include "libvex.h"
#include "libvex_trc_values.h"
-#include "libvex_guest_offsets.h"
#include "libvex_s390x_common.h"
#include "main_util.h"
#include "host_generic_regs.h"
#include "host_s390_defs.h"
#include "host_s390_disasm.h"
+#include "guest_s390_defs.h" /* S390X_GUEST_OFFSET */
#include <stdarg.h>
/* KLUDGE: We need to know the hwcaps of the host when generating
/* Copy FPC from guest state to R0 and OR in the new rounding mode */
buf = s390_emit_L(buf, R0, 0, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc); // r0 = guest_fpc
+ S390X_GUEST_OFFSET(guest_fpc)); // r0 = guest_fpc
buf = s390_emit_NILL(buf, R0, 0xFFFC); /* Clear out right-most 2 bits */
buf = s390_emit_OILL(buf, R0, bits); /* OR in the new rounding mode */
if (rounding_mode != S390_ROUND_NEAREST_EVEN) {
/* Restore FPC register from guest state */
buf = s390_emit_LFPC(buf, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc); // fpc = guest_fpc
+ S390X_GUEST_OFFSET(guest_fpc)); // fpc = guest_fpc
}
return buf;
if (rounding_mode != S390_ROUND_NEAREST_EVEN) {
/* Restore FPC register from guest state */
buf = s390_emit_LFPC(buf, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc);
+ S390X_GUEST_OFFSET(guest_fpc));
}
return buf;
if (rounding_mode != S390_ROUND_NEAREST_EVEN) {
/* Restore FPC register from guest state */
buf = s390_emit_LFPC(buf, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc); // fpc = guest_fpc
+ S390X_GUEST_OFFSET(guest_fpc)); // fpc = guest_fpc
}
return buf;
if (rounding_mode != S390_ROUND_NEAREST_EVEN) {
/* Restore FPC register from guest state */
buf = s390_emit_LFPC(buf, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc); // fpc = guest_fpc
+ S390X_GUEST_OFFSET(guest_fpc)); // fpc = guest_fpc
}
return buf;
if (rounding_mode != S390_ROUND_NEAREST_EVEN) {
/* Restore FPC register from guest state */
buf = s390_emit_LFPC(buf, S390_REGNO_GUEST_STATE_POINTER,
- OFFSET_s390x_fpc); // fpc = guest_fpc
+ S390X_GUEST_OFFSET(guest_fpc)); // fpc = guest_fpc
}
return buf;
#include "libvex_ir.h"
#include "libvex.h"
#include "libvex_s390x_common.h"
-#include "libvex_guest_offsets.h"
#include "main_util.h"
#include "main_globals.h"
get_guest_reg(Int offset)
{
switch (offset) {
- case OFFSET_s390x_IA: return GUEST_IA;
- case OFFSET_s390x_CC_OP: return GUEST_CC_OP;
- case OFFSET_s390x_CC_DEP1: return GUEST_CC_DEP1;
- case OFFSET_s390x_CC_DEP2: return GUEST_CC_DEP2;
- case OFFSET_s390x_CC_NDEP: return GUEST_CC_NDEP;
- case OFFSET_s390x_SYSNO: return GUEST_SYSNO;
+ case S390X_GUEST_OFFSET(guest_IA): return GUEST_IA;
+ case S390X_GUEST_OFFSET(guest_CC_OP): return GUEST_CC_OP;
+ case S390X_GUEST_OFFSET(guest_CC_DEP1): return GUEST_CC_DEP1;
+ case S390X_GUEST_OFFSET(guest_CC_DEP2): return GUEST_CC_DEP2;
+ case S390X_GUEST_OFFSET(guest_CC_NDEP): return GUEST_CC_NDEP;
+ case S390X_GUEST_OFFSET(guest_SYSNO): return GUEST_SYSNO;
/* Also make sure there is never a partial write to one of
these registers. That would complicate matters. */
- case OFFSET_s390x_IA+1 ... OFFSET_s390x_IA+7:
- case OFFSET_s390x_CC_OP+1 ... OFFSET_s390x_CC_OP+7:
- case OFFSET_s390x_CC_DEP1+1 ... OFFSET_s390x_CC_DEP1+7:
- case OFFSET_s390x_CC_DEP2+1 ... OFFSET_s390x_CC_DEP2+7:
- case OFFSET_s390x_CC_NDEP+1 ... OFFSET_s390x_CC_NDEP+7:
+ case S390X_GUEST_OFFSET(guest_IA)+1 ... S390X_GUEST_OFFSET(guest_IA)+7:
+ case S390X_GUEST_OFFSET(guest_CC_OP)+1 ... S390X_GUEST_OFFSET(guest_CC_OP)+7:
+ case S390X_GUEST_OFFSET(guest_CC_DEP1)+1 ... S390X_GUEST_OFFSET(guest_CC_DEP1)+7:
+ case S390X_GUEST_OFFSET(guest_CC_DEP2)+1 ... S390X_GUEST_OFFSET(guest_CC_DEP2)+7:
+ case S390X_GUEST_OFFSET(guest_CC_NDEP)+1 ... S390X_GUEST_OFFSET(guest_CC_NDEP)+7:
vassert("partial update of this guest state register is not allowed");
break;