diff --git a/linux/x86_64/get_scno.c b/linux/x86_64/get_scno.c index af3329a1..a87987e1 100644 --- a/linux/x86_64/get_scno.c +++ b/linux/x86_64/get_scno.c @@ -30,6 +30,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef X86_64 +# define X32_PERSONALITY_NUMBER 2 +#else +# define X32_PERSONALITY_NUMBER 0 +#endif + /* Return codes: 1 - ok, 0 - ignore, other - error. */ static int arch_get_scno(struct tcb *tcp) diff --git a/syscall.c b/syscall.c index 36f32799..fed5d7cd 100644 --- a/syscall.c +++ b/syscall.c @@ -987,12 +987,6 @@ shuffle_scno(unsigned long scno) # define shuffle_scno(scno) ((long)(scno)) #endif -const char * -syscall_name(long scno) -{ - return SCNO_IS_VALID(scno) ? sysent[scno].sys_name: NULL; -} - const char * err_name(unsigned long err) { @@ -1740,3 +1734,13 @@ get_syscall_result(struct tcb *tcp) #ifdef HAVE_GETREGS_OLD # include "getregs_old.c" #endif + +const char * +syscall_name(long scno) +{ +#if defined X32_PERSONALITY_NUMBER && defined __X32_SYSCALL_BIT + if (current_personality == X32_PERSONALITY_NUMBER) + scno &= ~__X32_SYSCALL_BIT; +#endif + return SCNO_IS_VALID(scno) ? sysent[scno].sys_name: NULL; +}