|
From: <sv...@va...> - 2005-12-27 01:44:37
|
Author: sewardj
Date: 2005-12-27 01:44:33 +0000 (Tue, 27 Dec 2005)
New Revision: 5444
Log:
Check that the two sigprocmasks haven't failed.
Modified:
trunk/coregrind/m_syswrap/syscall-amd64-linux.S
Modified: trunk/coregrind/m_syswrap/syscall-amd64-linux.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syscall-amd64-linux.S 2005-12-26 21:01:31 U=
TC (rev 5443)
+++ trunk/coregrind/m_syswrap/syscall-amd64-linux.S 2005-12-27 01:44:33 U=
TC (rev 5444)
@@ -109,67 +109,83 @@
=20
PUSH_di_si_dx_cx_8
=20
- movq $__NR_rt_sigprocmask, %rax // syscall #
- movq $VKI_SIG_SETMASK, %rdi // how
- movq %rdx, %rsi // sysmask
- movq %rcx, %rdx // postmask
- movq %r8, %r10 // nsigwords
- syscall
+ movq $__NR_rt_sigprocmask, %rax // syscall #
+ movq $VKI_SIG_SETMASK, %rdi // how
+ movq %rdx, %rsi // sysmask
+ movq %rcx, %rdx // postmask
+ movq %r8, %r10 // nsigwords
+ syscall
=20
POP_di_si_dx_cx_8
=09
- testl %eax, %eax
- js 5f /* sigprocmask failed */
+ testq %rax, %rax
+ js 7f /* sigprocmask failed */
=20
/* OK, that worked. Now do the syscall proper. */
=09
PUSH_di_si_dx_cx_8
=20
- movq %rsi, %rax /* rax --> VexGuestAMD64State * */
- pushq %rdi /* syscallno -> stack */
- movq OFFSET_amd64_RDI(%rax), %rdi
- movq OFFSET_amd64_RSI(%rax), %rsi
- movq OFFSET_amd64_RDX(%rax), %rdx
- movq OFFSET_amd64_R10(%rax), %r10
- movq OFFSET_amd64_R8(%rax), %r8
- movq OFFSET_amd64_R9(%rax), %r9
- popq %rax /* syscallno -> %rax */
+ movq %rsi, %rax /* rax --> VexGuestAMD64State * */
+ pushq %rdi /* syscallno -> stack */
+ movq OFFSET_amd64_RDI(%rax), %rdi
+ movq OFFSET_amd64_RSI(%rax), %rsi
+ movq OFFSET_amd64_RDX(%rax), %rdx
+ movq OFFSET_amd64_R10(%rax), %r10
+ movq OFFSET_amd64_R8(%rax), %r8
+ movq OFFSET_amd64_R9(%rax), %r9
+ popq %rax /* syscallno -> %rax */
=09
- /* If rip=3D=3D2, then the syscall was either just about
- to start, or was interrupted and the kernel was=20
- restarting it. */
-2: syscall
-3: /* In the range [3, 4), the syscall result is in %rax,=20
- but hasn't been committed to RAX. */
+ /* If rip=3D=3D2, then the syscall was either just about
+ to start, or was interrupted and the kernel was=20
+ restarting it. */
+2: syscall
+3: /* In the range [3, 4), the syscall result is in %rax,=20
+ but hasn't been committed to RAX. */
=20
POP_di_si_dx_cx_8
=20
movq %rax, OFFSET_amd64_RAX(%rsi) /* save back to RAX */
=20
-4: /* Re-block signals. If eip is in [4,5), then the syscall is complet=
e and=20
- we needn't worry about it. */
+4: /* Re-block signals. If eip is in [4,5), then the syscall=20
+ is complete and we needn't worry about it. */
+
PUSH_di_si_dx_cx_8
=20
- movq $__NR_rt_sigprocmask, %rax // syscall #
- movq $VKI_SIG_SETMASK, %rdi // how
- movq %rcx, %rsi // postmask
- xorq %rdx, %rdx // NULL
- movq %r8, %r10 // nsigwords
- syscall
+ movq $__NR_rt_sigprocmask, %rax // syscall #
+ movq $VKI_SIG_SETMASK, %rdi // how
+ movq %rcx, %rsi // postmask
+ xorq %rdx, %rdx // NULL
+ movq %r8, %r10 // nsigwords
+ syscall
=20
POP_di_si_dx_cx_8
=20
+ testq %rax, %rax
+ js 7f /* sigprocmask failed */
+
5: /* now safe from signals */
- =09
+ movq $0, %rax /* SUCCESS */
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbp
popq %rbx
-#undef FSZ
ret
=20
+7: /* failure: return 0x8000 | error code */
+ negq %rax
+ andq $0x7FFF, %rax
+ orq $0x8000, %rax
+ popq %r15
+ popq %r14
+ popq %r13
+ popq %r12
+ popq %rbp
+ popq %rbx
+ ret
+#undef FSZ
+
.section .rodata
/* export the ranges so that
VG_(fixup_guest_state_after_syscall_interrupted) can do the
|