1 /* arch.h 2 * Copyright 2014 The Chromium OS Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 * 6 * MINIJAIL_ARCH_NR #define's. 7 */ 8 9 #ifndef ARCH_H 10 #define ARCH_H 11 12 #include <linux/audit.h> 13 #include <stdint.h> 14 15 /* clang-format off */ 16 #if defined(__i386__) 17 # define MINIJAIL_ARCH_NR AUDIT_ARCH_I386 18 # define MINIJAIL_ARCH_NAME "x86" 19 #elif defined(__x86_64__) 20 # define MINIJAIL_ARCH_NR AUDIT_ARCH_X86_64 21 # define MINIJAIL_ARCH_NAME "x86_64" 22 #elif defined(__arm__) 23 /* 24 * <linux/audit.h> includes <linux/elf-em.h>, which does not define EM_ARM. 25 * <linux/elf.h> only includes <asm/elf.h> if we're in the kernel. 26 */ 27 # ifndef EM_ARM 28 # define EM_ARM 40 29 # endif 30 # define MINIJAIL_ARCH_NR AUDIT_ARCH_ARM 31 # define MINIJAIL_ARCH_NAME "arm" 32 #elif defined(__aarch64__) 33 # define MINIJAIL_ARCH_NR AUDIT_ARCH_AARCH64 34 # define MINIJAIL_ARCH_NAME "arm64" 35 #elif defined(__hppa__) 36 # define MINIJAIL_ARCH_NR AUDIT_ARCH_PARISC 37 # define MINIJAIL_ARCH_NAME "parisc" 38 #elif defined(__ia64__) 39 # define MINIJAIL_ARCH_NR AUDIT_ARCH_IA64 40 # define MINIJAIL_ARCH_NAME "ia64" 41 #elif defined(__mips__) 42 # if defined(__mips64) 43 # if defined(__MIPSEB__) 44 # define MINIJAIL_ARCH_NR AUDIT_ARCH_MIPS64 45 # define MINIJAIL_ARCH_NAME "mips64" 46 # else 47 # define MINIJAIL_ARCH_NR AUDIT_ARCH_MIPSEL64 48 # define MINIJAIL_ARCH_NAME "mipsel64" 49 # endif 50 # else 51 # if defined(__MIPSEB__) 52 # define MINIJAIL_ARCH_NR AUDIT_ARCH_MIPS 53 # define MINIJAIL_ARCH_NAME "mips" 54 # else 55 # define MINIJAIL_ARCH_NR AUDIT_ARCH_MIPSEL 56 # define MINIJAIL_ARCH_NAME "mipsel" 57 # endif 58 # endif 59 #elif defined(__powerpc64__) 60 # define MINIJAIL_ARCH_NR AUDIT_ARCH_PPC64 61 # define MINIJAIL_ARCH_NAME "ppc64" 62 #elif defined(__powerpc__) 63 # define MINIJAIL_ARCH_NR AUDIT_ARCH_PPC 64 # define MINIJAIL_ARCH_NAME "ppc" 65 #elif defined(__s390x__) 66 # define MINIJAIL_ARCH_NR AUDIT_ARCH_S390X 67 # define MINIJAIL_ARCH_NAME "s390x" 68 #elif defined(__s390__) 69 # define MINIJAIL_ARCH_NR AUDIT_ARCH_S390 70 # define MINIJAIL_ARCH_NAME "s390" 71 #elif defined(__sparc__) 72 # if defined(__arch64__) 73 # define AUDIT_ARCH_SPARC64 74 # define MINIJAIL_ARCH_NAME "sparc64" 75 # else 76 # define AUDIT_ARCH_SPARC 77 # define MINIJAIL_ARCH_NAME "sparc" 78 # endif 79 #else 80 # error "AUDIT_ARCH value unavailable" 81 #endif 82 /* clang-format on */ 83 84 #define MINIJAIL_ARCH_BITS sizeof(uintptr_t) * 8 85 86 #endif /* ARCH_H */ 87