GENOFFSET(X86,x86,FS);
GENOFFSET(X86,x86,GS);
GENOFFSET(X86,x86,SS);
+ GENOFFSET(X86,x86,SETC);
// amd64
GENOFFSET(AMD64,amd64,RAX);
GENOFFSET(AMD64,amd64,R14);
GENOFFSET(AMD64,amd64,R15);
GENOFFSET(AMD64,amd64,RIP);
+ GENOFFSET(AMD64,amd64,SETC);
// ppc32
GENOFFSET(PPC32,ppc32,GPR0);
}
}
-#if defined(VGO_freebsd) || defined(VGO_darwin)
-
-/* This dummy function is just used to have an address just after
- amd64g_calculate_rflags_all_WRK */
-
-static
-void _______VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______ (void)
-{
-}
-
-/* Export addresses of amd64g_calculate_rflags_all_WRK and
- _______VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______
- Used in syswrap-main.c / VG_(post_syscall) in the case where
- the above function was interrupted and we need to work out
- what needs to be done for the resumption */
-
-Addr addr_amd64g_calculate_rflags_all_WRK = (Addr)amd64g_calculate_rflags_all_WRK;
-Addr addr________VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______ = (Addr)_______VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______;
-#endif
-
/* CALLED FROM GENERATED CODE: CLEAN HELPER */
/* Calculate all the 6 flags from the supplied thunk parameters. */
ULong amd64g_calculate_rflags_all ( ULong cc_op,
vex_state->guest_CC_NDEP = 0;
}
-#if defined(VGO_freebsd) || defined(VGO_darwin)
-/* Used in syswrap-main.c / VG_(post_syscall) in the case where
- the above function was interrupted and we need to work out
- what needs to be done for the resumption. These functions
- are extern so no need for 'addr' global variables */
-void _______VVVVVVVV_after_GuestAMD64_put_rflag_c_VVVVVVVV_______ (void)
-{
-}
-#endif
-
/*---------------------------------------------------------------*/
/*--- %rflags translation-time function specialisers. ---*/
/*--- These help iropt specialise calls the above run-time ---*/
vex_state->guest_EMNOTE = EmNote_NONE;
+ vex_state->guest_SETC = 0;
+
/* These should not ever be either read or written, but we
initialise them anyway. */
vex_state->guest_CMSTART = 0;
}
}
-#if defined(VGO_freebsd) || defined(VGO_darwin)
-
-/* see guest_amd64_helpers.c
- Used in syswrap-main.c / VG_(post_syscall) for signal
- resumption */
-
-static void _______VVVVVVVV_after_x86g_calculate_eflags_all_WRK_VVVVVVVV_______ (void)
-{
-}
-
-Addr addr_x86g_calculate_eflags_all_WRK = (Addr)x86g_calculate_eflags_all_WRK;
-Addr addr________VVVVVVVV_x86g_calculate_eflags_all_WRK_VVVVVVVV_______ = (Addr)_______VVVVVVVV_after_x86g_calculate_eflags_all_WRK_VVVVVVVV_______;
-#endif
-
-
/* CALLED FROM GENERATED CODE: CLEAN HELPER */
/* Calculate all the 6 flags from the supplied thunk parameters. */
UInt x86g_calculate_eflags_all ( UInt cc_op,
vex_state->guest_CC_NDEP = 0;
}
-#if defined(VGO_freebsd) || defined(VGO_darwin)
-
-/* Used in syswrap-main.c / VG_(post_syscall) for signal resumption */
-
-void _______VVVVVVVV_after_LibVEX_GuestX86_put_eflag_c_VVVVVVVV_______ (void)
-{
-}
-#endif
-
-
/*---------------------------------------------------------------*/
/*--- %eflags translation-time function specialisers. ---*/
/*--- These help iropt specialise calls the above run-time ---*/
vex_state->guest_SC_CLASS = 0;
vex_state->guest_IP_AT_SYSCALL = 0;
+ vex_state->guest_SETC = 0;
+
vex_state->padding1 = 0;
vex_state->padding2 = 0;
- vex_state->padding3 = 0;
}
/* Emulation notes */
UInt guest_EMNOTE;
- UInt pad2;
+ /* Used by Darwin and FreeBSD when setting the carry flag from
+ * ML_(do_syscall_for_client_WRK). Needed to determine how
+ * to restart interrupted syscalls. */
+ UInt guest_SETC;
/* Translation-invalidation area description. Not used on amd64
(there is no invalidate-icache insn), but needed so as to
been interrupted by a signal. */
UInt guest_IP_AT_SYSCALL;
+ UInt guest_SETC;
+
/* Padding to make it have an 16-aligned size */
UInt padding1;
UInt padding2;
- UInt padding3;
}
VexGuestX86State;
LibVEX_GuestX86_put_eflag_c ( UInt new_carry_flag,
/*MOD*/VexGuestX86State* vex_state );
-#if defined(VGO_freebsd) || defined(VGO_darwin)
-extern void _______VVVVVVVV_after_LibVEX_GuestX86_put_eflag_c_VVVVVVVV_______ (void);
-extern Addr addr_x86g_calculate_eflags_all_WRK;
-extern Addr addr________VVVVVVVV_x86g_calculate_eflags_all_WRK_VVVVVVVV_______;
-#endif
-
/* Do x87 save from the supplied VexGuestX86State structure and store the
result at the given address which represents a buffer of at least 108
bytes. */
movq %rax, %rdi /* arg1 = new flag */
movq %r11, %rsi /* arg2 = vex state */
addq $$24, %rsp /* remove syscall parameters */
+ movl $$1, OFFSET_amd64_SETC(%r11)
call _LibVEX_GuestAMD64_put_rflag_c
+ movq -16(%rbp), %r11
+ movl $$0, OFFSET_amd64_SETC(%r11)
.else
addq $$24, %rsp /* remove syscall parameters*/
.endif
movq %rax, %rdi /* arg1 = new flag */
movq %r11, %rsi /* arg2 = vex state */
addq $24, %rsp /* remove syscall parameters */
+ movl $1, OFFSET_amd64_SETC(%r11)
call LibVEX_GuestAMD64_put_rflag_c
+ movq -16(%rbp), %r11 /* r11 = VexGuestAMD64State * */
+ movl $0, OFFSET_amd64_SETC(%r11)
4: /* Re-block signals. If eip is in [4,5), then the syscall
is complete and we needn't worry about it. */
movl $$0, 0(%esp)
movb 12(%esp), %al
movb %al, 0(%esp)
+ movl $$1, OFFSET_x86_SETC(%ecx)
call _LibVEX_GuestX86_put_eflag_c
+ movl 12(%ebp), %ecx
+ movl $$0, OFFSET_x86_SETC(%ecx)
addl $$12, %esp
.endif
movl $0, 0(%esp)
movb 12(%esp), %al
movb %al, 0(%esp)
+ movl $1, OFFSET_x86_SETC(%ecx)
call LibVEX_GuestX86_put_eflag_c
+ movl 12(%ebp), %ecx
+ movl $0, OFFSET_x86_SETC(%ecx)
addl $12, %esp
4: /* Re-block signals. If eip is in [4,5), then the syscall is
#if defined(VGO_freebsd) || defined(VGO_darwin)
if (outside_range)
{
- /* This is not guaranteed to work since the compiler / link editor
- could lay out the binary functions in a different order to
- the source file. However, it seems to work. */
-
-#if defined (VGA_amd64)
-
- vg_assert((Addr)_______VVVVVVVV_after_GuestAMD64_put_rflag_c_VVVVVVVV_______ >
- (Addr)LibVEX_GuestAMD64_put_rflag_c );
-
- vg_assert(addr________VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______ >
- addr_amd64g_calculate_rflags_all_WRK);
-
- if ((ip >= (Addr)LibVEX_GuestAMD64_put_rflag_c &&
- ip < (Addr)_______VVVVVVVV_after_GuestAMD64_put_rflag_c_VVVVVVVV_______) ||
- (ip >= addr_amd64g_calculate_rflags_all_WRK &&
- ip < addr________VVVVVVVV_amd64g_calculate_rflags_all_WRK_VVVVVVVV_______))
-#else
-
- vg_assert((Addr)_______VVVVVVVV_after_LibVEX_GuestX86_put_eflag_c_VVVVVVVV_______ >
- (Addr)LibVEX_GuestX86_put_eflag_c);
-
- vg_assert(addr________VVVVVVVV_x86g_calculate_eflags_all_WRK_VVVVVVVV_______>
- addr_x86g_calculate_eflags_all_WRK);
-
- if ((ip >= (Addr)LibVEX_GuestX86_put_eflag_c &&
- ip < (Addr)_______VVVVVVVV_after_LibVEX_GuestX86_put_eflag_c_VVVVVVVV_______) ||
- (ip >= addr_x86g_calculate_eflags_all_WRK &&
- ip < addr________VVVVVVVV_x86g_calculate_eflags_all_WRK_VVVVVVVV_______))
-#endif
+ if (th_regs->vex.guest_SETC)
{
outside_range = False;
in_complete_to_committed = True;