]> granicus.if.org Git - strace/commitdiff
aarch64: swap 64-bit and 32-bit personalities
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 9 Dec 2015 00:43:39 +0000 (00:43 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 9 Dec 2015 01:09:11 +0000 (01:09 +0000)
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.

14 files changed:
defs.h
file.c
linux/aarch64/errnoent1.h
linux/aarch64/get_error.c
linux/aarch64/get_scno.c
linux/aarch64/get_syscall_args.c
linux/aarch64/ioctls_arch0.h
linux/aarch64/ioctls_arch1.h
linux/aarch64/ioctls_inc0.h
linux/aarch64/ioctls_inc1.h
linux/aarch64/syscallent.h
linux/aarch64/syscallent1.h
linux/arm/arch_sigreturn.c
syscall.c

diff --git a/defs.h b/defs.h
index d0bef9416b7899cf77ba3b6eb1148ee1b992d554..0538bcf55ef73ab4463e98c10d8963dd69ac62f6 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -237,13 +237,12 @@ extern char *stpcpy(char *dst, const char *src);
 #ifdef AARCH64
 /* The existing ARM personality, then AArch64 */
 # define SUPPORTED_PERSONALITIES 2
-# define PERSONALITY0_WORDSIZE 4
-# define PERSONALITY1_WORDSIZE 8
-# define DEFAULT_PERSONALITY 1
+# define PERSONALITY0_WORDSIZE 8
+# define PERSONALITY1_WORDSIZE 4
 # ifdef HAVE_M32_MPERS
-#  define PERSONALITY0_INCLUDE_FUNCS "m32_funcs.h"
-#  define PERSONALITY0_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
-#  define PERSONALITY0_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
+#  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
+#  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
 # endif
 #endif
 
diff --git a/file.c b/file.c
index 7f0b1b4f06e0c47a804b31e19b78923cec3ce423..3ea0b5da6165cc5c37a54c71cd5c5cb2b8f6dbe9 100644 (file)
--- a/file.c
+++ b/file.c
@@ -118,11 +118,7 @@ struct stat32 {
        unsigned int    __unused4;
        unsigned int    __unused5;
 };
-#  ifdef AARCH64
-#   define STAT32_PERSONALITY 0
-#  else
-#   define STAT32_PERSONALITY 1
-#  endif
+#  define STAT32_PERSONALITY 1
 # elif defined POWERPC64
 struct stat32 {
        unsigned int    st_dev;
index babc7f2f16769c8009537e43ac786835b200bb8e..a0394d45bd1d47183baa9ea13c927c3277f7402c 100644 (file)
@@ -1,2 +1,2 @@
-/* Native AArch64 */
+/* ARM personality */
 #include "errnoent.h"
index c5c0f69cc2c9cdc0b3d4d6ec039a30bc94c4e8b7..a3aa12727c9c1758069d612fb237599725019393 100644 (file)
@@ -5,7 +5,7 @@
 static void
 get_error(struct tcb *tcp, const bool check_errno)
 {
-       if (tcp->currpers == 0) {
+       if (tcp->currpers == 1) {
                arm_get_error(tcp, check_errno);
                return;
        }
index a712a94866dd9eaa8714f995c34a8eb2143a8407..c0fd4822330f7bccfabcb9578f19439199ed2e52 100644 (file)
@@ -8,14 +8,14 @@ arch_get_scno(struct tcb *tcp)
                case sizeof(aarch64_regs):
                        /* We are in 64-bit mode */
                        scno = aarch64_regs.regs[8];
-                       update_personality(tcp, 1);
+                       update_personality(tcp, 0);
                        break;
                case sizeof(arm_regs):
                        /* We are in 32-bit mode */
                        /* Note: we don't support OABI, unlike 32-bit ARM build */
                        scno = arm_regs.ARM_r7;
                        scno = shuffle_scno(scno);
-                       update_personality(tcp, 0);
+                       update_personality(tcp, 1);
                        break;
        }
 
index b92130130c105ef18bd10cc9c71084682c6d8c1b..ea6e497dc7beb07f4dbb45da79500d315d998d8f 100644 (file)
@@ -6,7 +6,7 @@
 static int
 get_syscall_args(struct tcb *tcp)
 {
-       if (tcp->currpers == 0)
+       if (tcp->currpers == 1)
                return arm_get_syscall_args(tcp);
        tcp->u_arg[0] = aarch64_regs.regs[0];
        tcp->u_arg[1] = aarch64_regs.regs[1];
index b722d22b4a161de66d30a2596c850583d7fa29ed..6a674ccd2abe07dc4dd8ffd902f9665e197ca075 100644 (file)
@@ -1 +1 @@
-#include "arm/ioctls_arch0.h"
+/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */
index 6a674ccd2abe07dc4dd8ffd902f9665e197ca075..b722d22b4a161de66d30a2596c850583d7fa29ed 100644 (file)
@@ -1 +1 @@
-/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */
+#include "arm/ioctls_arch0.h"
index 46c11b11fa25791c3159520271399796c7788256..f9939faa410a7047df1d545b80865851baa1d5bc 100644 (file)
@@ -1 +1 @@
-#include "arm/ioctls_inc0.h"
+#include "64/ioctls_inc.h"
index f9939faa410a7047df1d545b80865851baa1d5bc..46c11b11fa25791c3159520271399796c7788256 100644 (file)
@@ -1 +1 @@
-#include "64/ioctls_inc.h"
+#include "arm/ioctls_inc0.h"
index 1b892be03a76fd5a59e06258185711ae9b1cdb23..286e0cb37ec987f6aa88e847cd25481d1ff116cd 100644 (file)
@@ -1 +1,71 @@
-#include "../arm/syscallent.h"
+#include "64/syscallent.h"
+
+/* Arch-specific block, not used on AArch64 */
+[244 ... 259] = { },
+
+/* Quote from asm-generic/unistd.h:
+ *
+ * All syscalls below here should go away really,
+ * these are provided for both review and as a porting
+ * help for the C library version.
+ *
+ * Last chance: are any of these important enough to
+ * enable by default?
+ */
+
+[1024] = { 3,  TD|TF,          SEN(open),              "open"          },
+[1025] = { 2,  TF,             SEN(link),              "link"          },
+[1026] = { 1,  TF,             SEN(unlink),            "unlink"        },
+[1027] = { 3,  TF,             SEN(mknod),             "mknod"         },
+[1028] = { 2,  TF,             SEN(chmod),             "chmod"         },
+[1029] = { 3,  TF,             SEN(chown),             "chown"         },
+[1030] = { 2,  TF,             SEN(mkdir),             "mkdir"         },
+[1031] = { 1,  TF,             SEN(rmdir),             "rmdir"         },
+[1032] = { 3,  TF,             SEN(chown),             "lchown"        },
+[1033] = { 2,  TF,             SEN(access),            "access"        },
+[1034] = { 2,  TF,             SEN(rename),            "rename"        },
+[1035] = { 3,  TF,             SEN(readlink),          "readlink"      },
+[1036] = { 2,  TF,             SEN(symlink),           "symlink"       },
+[1037] = { 2,  TF,             SEN(utimes),            "utimes"        },
+[1038] = { 2,  TF,             SEN(stat),              "stat"          },
+[1039] = { 2,  TF,             SEN(lstat),             "lstat"         },
+[1040] = { 1,  TD,             SEN(pipe),              "pipe"          },
+[1041] = { 2,  TD,             SEN(dup2),              "dup2"          },
+[1042] = { 1,  TD,             SEN(epoll_create),      "epoll_create"  },
+[1043] = { 0,  TD,             SEN(inotify_init),      "inotify_init"  },
+[1044] = { 1,  TD,             SEN(eventfd),           "eventfd"       },
+[1045] = { 3,  TD|TS,          SEN(signalfd),          "signalfd"      },
+[1046] = { 4,  TD|TN,          SEN(sendfile64),        "sendfile"      },
+[1047] = { 2,  TD,             SEN(ftruncate),         "ftruncate"     },
+[1048] = { 2,  TF,             SEN(truncate),          "truncate"      },
+[1049] = { 2,  TF,             SEN(stat),              "stat"          },
+[1050] = { 2,  TF,             SEN(lstat),             "lstat"         },
+[1051] = { 2,  TD,             SEN(fstat),             "fstat"         },
+[1052] = { 3,  TD,             SEN(fcntl),             "fcntl"         },
+[1053] = { 4,  TD,             SEN(fadvise64),         "fadvise64"     },
+[1054] = { 4,  TD|TF,          SEN(newfstatat),        "newfstatat"    },
+[1055] = { 2,  TD,             SEN(fstatfs),           "fstatfs"       },
+[1056] = { 2,  TF,             SEN(statfs),            "statfs"        },
+[1057] = { 3,  TD,             SEN(lseek),             "lseek"         },
+[1058] = { 6,  TD|TM|SI,       SEN(mmap),              "mmap"          },
+[1059] = { 1,  0,              SEN(alarm),             "alarm"         },
+[1060] = { 0,  0,              SEN(getpgrp),           "getpgrp"       },
+[1061] = { 0,  TS,             SEN(pause),             "pause"         },
+[1062] = { 1,  0,              SEN(time),              "time"          },
+[1063] = { 2,  TF,             SEN(utime),             "utime"         },
+[1064] = { 2,  TD|TF,          SEN(creat),             "creat"         },
+[1065] = { 3,  TD,             SEN(getdents),          "getdents"      },
+[1066] = { 3,  TD|TF,          SEN(futimesat),         "futimesat"     },
+[1067] = { 5,  TD,             SEN(select),            "select"        },
+[1068] = { 3,  TD,             SEN(poll),              "poll"          },
+[1069] = { 4,  TD,             SEN(epoll_wait),        "epoll_wait"    },
+[1070] = { 2,  0,              SEN(ustat),             "ustat"         },
+[1071] = { 0,  TP,             SEN(vfork),             "vfork"         },
+[1072] = { 4,  TP,             SEN(wait4),             "wait4"         },
+[1073] = { 6,  TN,             SEN(recv),              "recv"          },
+[1074] = { 4,  TN,             SEN(send),              "send"          },
+[1075] = { 2,  0,              SEN(bdflush),           "bdflush"       },
+[1076] = { 1,  TF,             SEN(umount),            "umount"        },
+[1077] = { 1,  TF,             SEN(uselib),            "uselib"        },
+[1078] = { 1,  0,              SEN(sysctl),            "sysctl"        },
+[1079] = { 0,  TP,             SEN(fork),              "fork"          },
index 286e0cb37ec987f6aa88e847cd25481d1ff116cd..1b892be03a76fd5a59e06258185711ae9b1cdb23 100644 (file)
@@ -1,71 +1 @@
-#include "64/syscallent.h"
-
-/* Arch-specific block, not used on AArch64 */
-[244 ... 259] = { },
-
-/* Quote from asm-generic/unistd.h:
- *
- * All syscalls below here should go away really,
- * these are provided for both review and as a porting
- * help for the C library version.
- *
- * Last chance: are any of these important enough to
- * enable by default?
- */
-
-[1024] = { 3,  TD|TF,          SEN(open),              "open"          },
-[1025] = { 2,  TF,             SEN(link),              "link"          },
-[1026] = { 1,  TF,             SEN(unlink),            "unlink"        },
-[1027] = { 3,  TF,             SEN(mknod),             "mknod"         },
-[1028] = { 2,  TF,             SEN(chmod),             "chmod"         },
-[1029] = { 3,  TF,             SEN(chown),             "chown"         },
-[1030] = { 2,  TF,             SEN(mkdir),             "mkdir"         },
-[1031] = { 1,  TF,             SEN(rmdir),             "rmdir"         },
-[1032] = { 3,  TF,             SEN(chown),             "lchown"        },
-[1033] = { 2,  TF,             SEN(access),            "access"        },
-[1034] = { 2,  TF,             SEN(rename),            "rename"        },
-[1035] = { 3,  TF,             SEN(readlink),          "readlink"      },
-[1036] = { 2,  TF,             SEN(symlink),           "symlink"       },
-[1037] = { 2,  TF,             SEN(utimes),            "utimes"        },
-[1038] = { 2,  TF,             SEN(stat),              "stat"          },
-[1039] = { 2,  TF,             SEN(lstat),             "lstat"         },
-[1040] = { 1,  TD,             SEN(pipe),              "pipe"          },
-[1041] = { 2,  TD,             SEN(dup2),              "dup2"          },
-[1042] = { 1,  TD,             SEN(epoll_create),      "epoll_create"  },
-[1043] = { 0,  TD,             SEN(inotify_init),      "inotify_init"  },
-[1044] = { 1,  TD,             SEN(eventfd),           "eventfd"       },
-[1045] = { 3,  TD|TS,          SEN(signalfd),          "signalfd"      },
-[1046] = { 4,  TD|TN,          SEN(sendfile64),        "sendfile"      },
-[1047] = { 2,  TD,             SEN(ftruncate),         "ftruncate"     },
-[1048] = { 2,  TF,             SEN(truncate),          "truncate"      },
-[1049] = { 2,  TF,             SEN(stat),              "stat"          },
-[1050] = { 2,  TF,             SEN(lstat),             "lstat"         },
-[1051] = { 2,  TD,             SEN(fstat),             "fstat"         },
-[1052] = { 3,  TD,             SEN(fcntl),             "fcntl"         },
-[1053] = { 4,  TD,             SEN(fadvise64),         "fadvise64"     },
-[1054] = { 4,  TD|TF,          SEN(newfstatat),        "newfstatat"    },
-[1055] = { 2,  TD,             SEN(fstatfs),           "fstatfs"       },
-[1056] = { 2,  TF,             SEN(statfs),            "statfs"        },
-[1057] = { 3,  TD,             SEN(lseek),             "lseek"         },
-[1058] = { 6,  TD|TM|SI,       SEN(mmap),              "mmap"          },
-[1059] = { 1,  0,              SEN(alarm),             "alarm"         },
-[1060] = { 0,  0,              SEN(getpgrp),           "getpgrp"       },
-[1061] = { 0,  TS,             SEN(pause),             "pause"         },
-[1062] = { 1,  0,              SEN(time),              "time"          },
-[1063] = { 2,  TF,             SEN(utime),             "utime"         },
-[1064] = { 2,  TD|TF,          SEN(creat),             "creat"         },
-[1065] = { 3,  TD,             SEN(getdents),          "getdents"      },
-[1066] = { 3,  TD|TF,          SEN(futimesat),         "futimesat"     },
-[1067] = { 5,  TD,             SEN(select),            "select"        },
-[1068] = { 3,  TD,             SEN(poll),              "poll"          },
-[1069] = { 4,  TD,             SEN(epoll_wait),        "epoll_wait"    },
-[1070] = { 2,  0,              SEN(ustat),             "ustat"         },
-[1071] = { 0,  TP,             SEN(vfork),             "vfork"         },
-[1072] = { 4,  TP,             SEN(wait4),             "wait4"         },
-[1073] = { 6,  TN,             SEN(recv),              "recv"          },
-[1074] = { 4,  TN,             SEN(send),              "send"          },
-[1075] = { 2,  0,              SEN(bdflush),           "bdflush"       },
-[1076] = { 1,  TF,             SEN(umount),            "umount"        },
-[1077] = { 1,  TF,             SEN(uselib),            "uselib"        },
-[1078] = { 1,  0,              SEN(sysctl),            "sysctl"        },
-[1079] = { 0,  TP,             SEN(fork),              "fork"          },
+#include "../arm/syscallent.h"
index 6d32ac5d2719dd2403c933ec68ad80a998ebe2d8..28726a27f4eaee52a141bebf5313e90e09eb3c5c 100644 (file)
@@ -7,7 +7,7 @@ arch_sigreturn(struct tcb *tcp)
 
        const long addr =
 #ifdef AARCH64
-               current_personality == 1 ?
+               tcp->currpers == 0 ?
                        (*aarch64_sp_ptr + SIZEOF_STRUCT_SIGINFO +
                         offsetof(struct ucontext, uc_sigmask)) :
 #endif
index fae5f6b5dcf3170ad0b918946123cbfa1128e0aa..66154f7e28f6083a1dadd041d137f57c92edeb74 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -346,7 +346,7 @@ update_personality(struct tcb *tcp, unsigned int personality)
 # elif defined X32
 #  define PERSONALITY_NAMES {"x32", "32 bit"}
 # elif defined AARCH64
-#  define PERSONALITY_NAMES {"32-bit", "AArch64"}
+#  define PERSONALITY_NAMES {"64 bit", "32 bit"}
 # elif defined TILE
 #  define PERSONALITY_NAMES {"64-bit", "32-bit"}
 # endif