Skip to content

Commit c37173f

Browse files
committed
aarch64: swap 64-bit and 32-bit personalities
Let native 64-bit personality be personality 0, and 32-bit personality be personality 1, to follow the traditional layout used for other architectures. * defs.h [AARCH64]: Swap PERSONALITY0_WORDSIZE and PERSONALITY1_WORDSIZE, remove DEFAULT_PERSONALITY. [AARCH64 && HAVE_M32_MPERS]: Rename PERSONALITY1_* to PERSONALITY0_*. * file.c [AARCH64 || defined X86_64 || defined X32]: Define STAT32_PERSONALITY for AARCH64 as well. * syscall.c (update_personality) [AARCH64]: Adjust PERSONALITY_NAMES. * linux/aarch64/errnoent1.h: Adjust comment. * linux/aarch64/get_error.c (get_error): Adjust tcp->currpers check. * linux/aarch64/get_syscall_args.c (get_syscall_args): Likewise. * linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Likewise. * linux/aarch64/get_scno.c (arch_get_scno): Adjust update_personality invocations. * linux/aarch64/ioctls_arch0.h: Swap with ... * linux/aarch64/ioctls_arch1.h: ... this file. * linux/aarch64/ioctls_inc0.h: Swap with ... * linux/aarch64/ioctls_inc1.h: ... this file. * linux/aarch64/syscallent.h: Swap with ... * linux/aarch64/syscallent1.h: ... this file.
1 parent e3a2fe0 commit c37173f

14 files changed

+89
-94
lines changed

defs.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,12 @@ extern char *stpcpy(char *dst, const char *src);
237237
#ifdef AARCH64
238238
/* The existing ARM personality, then AArch64 */
239239
# define SUPPORTED_PERSONALITIES 2
240-
# define PERSONALITY0_WORDSIZE 4
241-
# define PERSONALITY1_WORDSIZE 8
242-
# define DEFAULT_PERSONALITY 1
240+
# define PERSONALITY0_WORDSIZE 8
241+
# define PERSONALITY1_WORDSIZE 4
243242
# ifdef HAVE_M32_MPERS
244-
# define PERSONALITY0_INCLUDE_FUNCS "m32_funcs.h"
245-
# define PERSONALITY0_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
246-
# define PERSONALITY0_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
243+
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
244+
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
245+
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
247246
# endif
248247
#endif
249248

file.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ struct stat32 {
118118
unsigned int __unused4;
119119
unsigned int __unused5;
120120
};
121-
# ifdef AARCH64
122-
# define STAT32_PERSONALITY 0
123-
# else
124-
# define STAT32_PERSONALITY 1
125-
# endif
121+
# define STAT32_PERSONALITY 1
126122
# elif defined POWERPC64
127123
struct stat32 {
128124
unsigned int st_dev;

linux/aarch64/errnoent1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/* Native AArch64 */
1+
/* ARM personality */
22
#include "errnoent.h"

linux/aarch64/get_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
static void
66
get_error(struct tcb *tcp, const bool check_errno)
77
{
8-
if (tcp->currpers == 0) {
8+
if (tcp->currpers == 1) {
99
arm_get_error(tcp, check_errno);
1010
return;
1111
}

linux/aarch64/get_scno.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ arch_get_scno(struct tcb *tcp)
88
case sizeof(aarch64_regs):
99
/* We are in 64-bit mode */
1010
scno = aarch64_regs.regs[8];
11-
update_personality(tcp, 1);
11+
update_personality(tcp, 0);
1212
break;
1313
case sizeof(arm_regs):
1414
/* We are in 32-bit mode */
1515
/* Note: we don't support OABI, unlike 32-bit ARM build */
1616
scno = arm_regs.ARM_r7;
1717
scno = shuffle_scno(scno);
18-
update_personality(tcp, 0);
18+
update_personality(tcp, 1);
1919
break;
2020
}
2121

linux/aarch64/get_syscall_args.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
static int
77
get_syscall_args(struct tcb *tcp)
88
{
9-
if (tcp->currpers == 0)
9+
if (tcp->currpers == 1)
1010
return arm_get_syscall_args(tcp);
1111
tcp->u_arg[0] = aarch64_regs.regs[0];
1212
tcp->u_arg[1] = aarch64_regs.regs[1];

linux/aarch64/ioctls_arch0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#include "arm/ioctls_arch0.h"
1+
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */

linux/aarch64/ioctls_arch1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */
1+
#include "arm/ioctls_arch0.h"

linux/aarch64/ioctls_inc0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#include "arm/ioctls_inc0.h"
1+
#include "64/ioctls_inc.h"

linux/aarch64/ioctls_inc1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#include "64/ioctls_inc.h"
1+
#include "arm/ioctls_inc0.h"

0 commit comments

Comments
 (0)