diff options
author | Jeremy Linton | 2018-12-11 19:27:29 +0100 |
---|---|---|
committer | Jeremy Linton | 2018-12-11 19:27:29 +0100 |
commit | 32865bd5df59f14fd3fe6651acebde99b0691b5d (patch) | |
tree | 29e495f1370d8a0aa53c12d19516ed8379dca690 /sys-utils/lscpu.c | |
parent | lslogins: make valid_pwd() more robust (diff) | |
download | kernel-qcow2-util-linux-32865bd5df59f14fd3fe6651acebde99b0691b5d.tar.gz kernel-qcow2-util-linux-32865bd5df59f14fd3fe6651acebde99b0691b5d.tar.xz kernel-qcow2-util-linux-32865bd5df59f14fd3fe6651acebde99b0691b5d.zip |
lscpu: Add aarch32 detection on aarch64
aarch32 support is an optional feature of ARMv8, as CPUs
which don't support aarch32 become more common, lets make
sure that lscpu can tell a user quickly if they are on a
machine that only supports 64-bit.
Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r-- | sys-utils/lscpu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 1ff9069f3..245be6e5c 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -33,6 +33,7 @@ #include <stdarg.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/personality.h> #if (defined(__x86_64__) || defined(__i386__)) # if !defined( __SANITIZE_ADDRESS__) @@ -332,6 +333,19 @@ init_mode(struct lscpu_modifier *mod) defined(__s390x__) || defined(__s390__) || defined(__sparc_v9__) m |= MODE_32BIT; #endif + +#if defined(__aarch64__) + { + /* personality() is the most reliable way (since 4.7) + * to determine aarch32 support */ + int pers = personality(PER_LINUX32); + if (pers != -1) { + personality(pers); + m |= MODE_32BIT; + } + m |= MODE_64BIT; + } +#endif return m; } |