syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32

* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
Clear __X32_SYSCALL_BIT from scno on x32 personality.
This commit is contained in:
Дмитрий Левин 2016-12-01 01:01:02 +00:00
parent 9936b91d9f
commit 3c8b673408
2 changed files with 16 additions and 6 deletions

View File

@ -30,6 +30,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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. */ /* Return codes: 1 - ok, 0 - ignore, other - error. */
static int static int
arch_get_scno(struct tcb *tcp) arch_get_scno(struct tcb *tcp)

View File

@ -987,12 +987,6 @@ shuffle_scno(unsigned long scno)
# define shuffle_scno(scno) ((long)(scno)) # define shuffle_scno(scno) ((long)(scno))
#endif #endif
const char *
syscall_name(long scno)
{
return SCNO_IS_VALID(scno) ? sysent[scno].sys_name: NULL;
}
const char * const char *
err_name(unsigned long err) err_name(unsigned long err)
{ {
@ -1740,3 +1734,13 @@ get_syscall_result(struct tcb *tcp)
#ifdef HAVE_GETREGS_OLD #ifdef HAVE_GETREGS_OLD
# include "getregs_old.c" # include "getregs_old.c"
#endif #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;
}