is also done by the kernel for the fpc during execve. */
LibVEX_GuestS390X_initialise(&arch->vex);
- /* Zero out the shadow area. */
- VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestS390XState));
- VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestS390XState));
+ /* Mark all registers as undefined ... */
+ VG_(memset)(&arch->vex_shadow1, 0xFF, sizeof(VexGuestS390XState));
+ VG_(memset)(&arch->vex_shadow2, 0x00, sizeof(VexGuestS390XState));
+ /* ... except SP, FPC, and IA */
+ VG_(memset)((UChar *)&arch->vex_shadow1 + VG_O_STACK_PTR, 0x00, 8);
+ VG_(memset)((UChar *)&arch->vex_shadow1 + VG_O_FPC_REG, 0x00, 4);
+ VG_(memset)((UChar *)&arch->vex_shadow1 + VG_O_INSTR_PTR, 0x00, 8);
/* Put essential stuff into the new state. */
arch->vex.guest_SP = iifii.initial_client_SP;
arch->vex.guest_IA = iifii.initial_client_IP;
+ /* See sys_execve in <linux>/arch/s390/kernel/process.c */
+ arch->vex.guest_fpc = 0;
+
+ /* Tell the tool about the registers we just wrote */
+ VG_TRACK(post_reg_write, Vg_CoreStartup, /*tid*/1, VG_O_STACK_PTR, 8);
+ VG_TRACK(post_reg_write, Vg_CoreStartup, /*tid*/1, VG_O_FPC_REG, 4);
+ VG_TRACK(post_reg_write, Vg_CoreStartup, /*tid*/1, VG_O_INSTR_PTR, 8);
+ return;
# else
# error Unknown platform
# define VG_INSTR_PTR guest_IA
# define VG_STACK_PTR guest_SP
# define VG_FRAME_PTR guest_FP
+# define VG_FPC_REG guest_fpc
#else
# error Unknown arch
#endif
// Offsets for the Vex state
#define VG_O_STACK_PTR (offsetof(VexGuestArchState, VG_STACK_PTR))
#define VG_O_INSTR_PTR (offsetof(VexGuestArchState, VG_INSTR_PTR))
+#define VG_O_FPC_REG (offsetof(VexGuestArchState, VG_FPC_REG))
//-------------------------------------------------------------