|
From: <sv...@va...> - 2005-12-22 20:16:08
|
Author: sewardj
Date: 2005-12-22 20:16:00 +0000 (Thu, 22 Dec 2005)
New Revision: 5411
Log:
Properly return error codes resulting from sigprocmask failures.
Not yet done: amd64, ppc32.
Modified:
trunk/coregrind/m_syswrap/syscall-x86-linux.S
Modified: trunk/coregrind/m_syswrap/syscall-x86-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-x86-linux.S 2005-12-22 20:14:57 UTC=
(rev 5410)
+++ trunk/coregrind/m_syswrap/syscall-x86-linux.S 2005-12-22 20:16:00 UTC=
(rev 5411)
@@ -1,7 +1,7 @@
=20
-##--------------------------------------------------------------------##
-##--- Support for doing system calls. syscall-x86-linux.S ---##
-##--------------------------------------------------------------------##
+/*--------------------------------------------------------------------*/
+/*--- Support for doing system calls. syscall-x86-linux.S ---*/
+/*--------------------------------------------------------------------*/
=20
/*
This file is part of Valgrind, a dynamic binary instrumentation
@@ -51,9 +51,10 @@
back to regs->m_eax on completion.
=09
Returns 0 if the syscall was successfully called (even if the
- syscall itself failed), or a -ve error code if one of the
- sigprocmasks failed (there's no way to determine which one
- failed).
+ syscall itself failed), or a nonzero error code in the lowest
+ 8 bits if one of the sigprocmasks failed (there's no way to
+ determine which one failed). And there's no obvious way to
+ recover from that either, but nevertheless we want to know.
=20
VG_(fixup_guest_state_after_syscall_interrupted) does the
thread state fixup in the case where we were interrupted by a
@@ -61,7 +62,7 @@
=09
Prototype:
=20
- Int ML_(do_syscall_for_client_WRK)(
+ UWord ML_(do_syscall_for_client_WRK)(
Int syscallno, // 0
void* guest_state, // 4
const vki_sigset_t *sysmask, // 8
@@ -94,7 +95,7 @@
movl 16+FSZ(%esp), %esi
int $0x80
testl %eax, %eax
- js 5f /* sigprocmask failed */
+ js 7f /* sigprocmask failed */
=09
movl 4+FSZ(%esp), %eax /* eax =3D=3D ThreadState * */
=20
@@ -122,16 +123,29 @@
xorl %edx, %edx
movl 16+FSZ(%esp), %esi
int $0x80
+ testl %eax, %eax
+ js 7f /* sigprocmask failed */
=20
5: /* now safe from signals */
- =09
+ movl $0, %eax /* SUCCESS */
popl %ebp
popl %ebx
popl %edi
popl %esi
-#undef FSZ
ret
=20
+7: /* failure: return 0x8000 | error code */
+ negl %eax
+ andl $0x7FFF, %eax
+ orl $0x8000, %eax
+ popl %ebp
+ popl %ebx
+ popl %edi
+ popl %esi
+ ret
+#undef FSZ
+
+=09
.section .rodata
/* export the ranges so that
VG_(fixup_guest_state_after_syscall_interrupted) can do the
@@ -152,6 +166,6 @@
/* Let the linker know we don't need an executable stack */
.section .note.GNU-stack,"",@progbits
=20
-##--------------------------------------------------------------------##
-##--- end ---##
-##--------------------------------------------------------------------##
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
|