syscalls for the client.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4042
sigprocmasks failed (there's no way to determine which one
failed).
- VG_(interrupted_syscall)() does the thread state fixup in the
- case where we were interrupted by a signal.
+ VG_(fixup_guest_state_after_syscall_interrupted) does the
+ thread state fixup in the case where we were interrupted by a
+ signal.
Prototype:
- Int VG_(do_syscall_for_client_WRK(
+ Int ML_(do_syscall_for_client_WRK(
Int syscallno, // rdi
void* guest_state, // rsi
const vki_sigset_t *sysmask, // rdx
/* from vki_arch.h */
#define VKI_SIG_SETMASK 2
-.globl VG_(do_syscall_for_client_WRK)
-VG_(do_syscall_for_client_WRK):
+.globl ML_(do_syscall_for_client_WRK)
+ML_(do_syscall_for_client_WRK):
/* save callee-saved regs */
pushq %rbx
pushq %rbp
ret
.section .rodata
-/* export the ranges so that VG_(interrupted_syscall) can do the
- right thing */
+/* export the ranges so that
+ VG_(fixup_guest_state_after_syscall_interrupted) can do the
+ right thing */
-.globl VG_(blksys_setup)
-.globl VG_(blksys_restart)
-.globl VG_(blksys_complete)
-.globl VG_(blksys_committed)
-.globl VG_(blksys_finished)
-VG_(blksys_setup): .quad 1b
-VG_(blksys_restart): .quad 2b
-VG_(blksys_complete): .quad 3b
-VG_(blksys_committed): .quad 4b
-VG_(blksys_finished): .quad 5b
+.globl ML_(blksys_setup)
+.globl ML_(blksys_restart)
+.globl ML_(blksys_complete)
+.globl ML_(blksys_committed)
+.globl ML_(blksys_finished)
+ML_(blksys_setup): .quad 1b
+ML_(blksys_restart): .quad 2b
+ML_(blksys_complete): .quad 3b
+ML_(blksys_committed): .quad 4b
+ML_(blksys_finished): .quad 5b
.previous
/* Let the linker know we don't need an executable stack */
sigprocmasks failed (there's no way to determine which one
failed).
- VG_(interrupted_syscall)() does the thread state fixup in the
- case where we were interrupted by a signal.
+ VG_(fixup_guest_state_after_syscall_interrupted) does the
+ thread state fixup in the case where we were interrupted by a
+ signal.
Prototype:
- Int VG_(do_syscall_for_client_WRK)(
+ Int ML_(do_syscall_for_client_WRK)(
Int syscallno, // r3
void* guest_state, // r4
const vki_sigset_t *sysmask, // r5
/* from vki_arch.h */
#define VKI_SIG_SETMASK 2
-.globl VG_(do_syscall_for_client_WRK)
-VG_(do_syscall_for_client_WRK):
+.globl ML_(do_syscall_for_client_WRK)
+ML_(do_syscall_for_client_WRK):
/* make a stack frame */
stwu 1,-32(1)
stw 31,28(1)
VG_(fixup_guest_state_after_syscall_interrupted) can do the
right thing */
-.globl VG_(blksys_setup)
-.globl VG_(blksys_restart)
-.globl VG_(blksys_complete)
-.globl VG_(blksys_committed)
-.globl VG_(blksys_finished)
-VG_(blksys_setup): .long 1b
-VG_(blksys_restart): .long 2b
-VG_(blksys_complete): .long 3b
-VG_(blksys_committed): .long 4b
-VG_(blksys_finished): .long 5b
+.globl ML_(blksys_setup)
+.globl ML_(blksys_restart)
+.globl ML_(blksys_complete)
+.globl ML_(blksys_committed)
+.globl ML_(blksys_finished)
+ML_(blksys_setup): .long 1b
+ML_(blksys_restart): .long 2b
+ML_(blksys_complete): .long 3b
+ML_(blksys_committed): .long 4b
+ML_(blksys_finished): .long 5b
.previous
sigprocmasks failed (there's no way to determine which one
failed).
- VG_(interrupted_syscall)() does the thread state fixup in the
- case where we were interrupted by a signal.
+ VG_(fixup_guest_state_after_syscall_interrupted) does the
+ thread state fixup in the case where we were interrupted by a
+ signal.
Prototype:
- Int VG_(do_syscall_for_client_WRK)(
+ Int ML_(do_syscall_for_client_WRK)(
Int syscallno, // 0
void* guest_state, // 4
const vki_sigset_t *sysmask, // 8
/* from vki_arch.h */
#define VKI_SIG_SETMASK 2
-.globl VG_(do_syscall_for_client_WRK)
-VG_(do_syscall_for_client_WRK):
+.globl ML_(do_syscall_for_client_WRK)
+ML_(do_syscall_for_client_WRK):
/* save callee-saved regs */
push %esi
push %edi
VG_(fixup_guest_state_after_syscall_interrupted) can do the
right thing */
-.globl VG_(blksys_setup)
-.globl VG_(blksys_restart)
-.globl VG_(blksys_complete)
-.globl VG_(blksys_committed)
-.globl VG_(blksys_finished)
-VG_(blksys_setup): .long 1b
-VG_(blksys_restart): .long 2b
-VG_(blksys_complete): .long 3b
-VG_(blksys_committed): .long 4b
-VG_(blksys_finished): .long 5b
+.globl ML_(blksys_setup)
+.globl ML_(blksys_restart)
+.globl ML_(blksys_complete)
+.globl ML_(blksys_committed)
+.globl ML_(blksys_finished)
+ML_(blksys_setup): .long 1b
+ML_(blksys_restart): .long 2b
+ML_(blksys_complete): .long 3b
+ML_(blksys_committed): .long 4b
+ML_(blksys_finished): .long 5b
.previous
/* Let the linker know we don't need an executable stack */
VG_(fixup_guest_state_after_syscall_interrupted) to adjust the
thread's context to do the right thing.
- The _WRK function is handwritten assembly. It has some very magic
+ The _WRK function is handwritten assembly, implemented per-platform
+ in coregrind/m_syswrap/syscall-$PLAT.S. It has some very magic
properties. See comments at the top of
VG_(fixup_guest_state_after_syscall_interrupted) below for details.
*/
extern
-void VG_(do_syscall_for_client_WRK)( Int syscallno,
+void ML_(do_syscall_for_client_WRK)( Int syscallno,
void* guest_state,
const vki_sigset_t *syscall_mask,
const vki_sigset_t *restore_mask,
const vki_sigset_t* syscall_mask )
{
vki_sigset_t saved;
- VG_(do_syscall_for_client_WRK)(
+ ML_(do_syscall_for_client_WRK)(
syscallno, &tst->arch.vex,
syscall_mask, &saved, _VKI_NSIG_WORDS * sizeof(UWord)
);
*/
-/* These are addresses within VG_(_do_syscall_for_client). See syscall.S for
- details. */
-extern const Addr VG_(blksys_setup);
-extern const Addr VG_(blksys_restart);
-extern const Addr VG_(blksys_complete);
-extern const Addr VG_(blksys_committed);
-extern const Addr VG_(blksys_finished);
+/* These are addresses within ML_(do_syscall_for_client_WRK). See
+ syscall-$PLAT.S for details.
+*/
+extern const Addr ML_(blksys_setup);
+extern const Addr ML_(blksys_restart);
+extern const Addr ML_(blksys_complete);
+extern const Addr ML_(blksys_committed);
+extern const Addr ML_(blksys_finished);
/* Back up guest state to restart a system call. */
/* Figure out what the state of the syscall was by examining the
(real) IP at the time of the signal, and act accordingly. */
- if (ip < VG_(blksys_setup) || ip >= VG_(blksys_finished)) {
+ if (ip < ML_(blksys_setup) || ip >= ML_(blksys_finished)) {
VG_(printf)(" not in syscall (%p - %p)\n",
- VG_(blksys_setup), VG_(blksys_finished));
+ ML_(blksys_setup), ML_(blksys_finished));
/* Looks like we weren't in a syscall at all. Hmm. */
vg_assert(sci->status.what != SsIdle);
return;
Hence: */
vg_assert(sci->status.what != SsIdle);
- if (ip >= VG_(blksys_setup) && ip < VG_(blksys_restart)) {
+ if (ip >= ML_(blksys_setup) && ip < ML_(blksys_restart)) {
/* syscall hasn't even started; go around again */
if (debug)
VG_(printf)(" not started: restart\n");
}
else
- if (ip == VG_(blksys_restart)) {
+ if (ip == ML_(blksys_restart)) {
/* We're either about to run the syscall, or it was interrupted
and the kernel restarted it. Restart if asked, otherwise
EINTR it. */
}
else
- if (ip >= VG_(blksys_complete) && ip < VG_(blksys_committed)) {
+ if (ip >= ML_(blksys_complete) && ip < ML_(blksys_committed)) {
/* Syscall complete, but result hasn't been written back yet.
Write the SysRes we were supplied with back to the guest
state. */
}
else
- if (ip >= VG_(blksys_committed) && ip < VG_(blksys_finished)) {
+ if (ip >= ML_(blksys_committed) && ip < ML_(blksys_finished)) {
/* Result committed, but the signal mask has not been restored;
we expect our caller (the signal handler) will have fixed
this up. */