Change scope from VG_ to ML_ various assembly symbols to do with doing

syscalls for the client.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4042
This commit is contained in:
Julian Seward 2005-06-28 19:04:51 +00:00
parent 0ca1bd00b3
commit b0dc7633a7
4 changed files with 69 additions and 63 deletions

View File

@ -55,12 +55,13 @@
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
@ -72,8 +73,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 */
pushq %rbx
pushq %rbp
@ -170,19 +171,20 @@ VG_(do_syscall_for_client_WRK):
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 */

View File

@ -54,12 +54,13 @@
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
@ -69,8 +70,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):
/* make a stack frame */
stwu 1,-32(1)
stw 31,28(1)
@ -140,16 +141,16 @@ VG_(do_syscall_for_client_WRK):
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

View File

@ -55,12 +55,13 @@
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
@ -72,8 +73,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
@ -136,16 +137,16 @@ VG_(do_syscall_for_client_WRK):
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 */

View File

@ -185,12 +185,13 @@
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,
@ -202,7 +203,7 @@ void do_syscall_for_client ( Int syscallno,
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)
);
@ -901,13 +902,14 @@ void VG_(post_syscall) (ThreadId tid)
*/
/* 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. */
@ -1046,9 +1048,9 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid,
/* 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;
@ -1059,7 +1061,7 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid,
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");
@ -1068,7 +1070,7 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid,
}
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. */
@ -1085,7 +1087,7 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid,
}
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. */
@ -1098,7 +1100,7 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid,
}
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. */