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  * ARCH_NR #define's.
7  */
8 
9 #ifndef ARCH_H
10 #define ARCH_H
11 
12 #include <linux/audit.h>
13 
14 #if defined(__i386__)
15 #  define ARCH_NR AUDIT_ARCH_I386
16 #elif defined(__x86_64__)
17 #  define ARCH_NR AUDIT_ARCH_X86_64
18 #elif defined(__arm__)
19 /*
20  * <linux/audit.h> includes <linux/elf-em.h>, which does not define EM_ARM.
21  * <linux/elf.h> only includes <asm/elf.h> if we're in the kernel.
22  */
23 #  ifndef EM_ARM
24 #    define EM_ARM 40
25 #  endif
26 #  define ARCH_NR AUDIT_ARCH_ARM
27 #elif defined(__aarch64__)
28 #  define ARCH_NR AUDIT_ARCH_AARCH64
29 #elif defined(__hppa__)
30 #  define ARCH_NR AUDIT_ARCH_PARISC
31 #elif defined(__ia64__)
32 #  define ARCH_NR AUDIT_ARCH_IA64
33 #elif defined(__mips__)
34 #  if defined(__mips64)
35 #    if defined(__MIPSEB__)
36 #      define ARCH_NR AUDIT_ARCH_MIPS64
37 #    else
38 #      define ARCH_NR AUDIT_ARCH_MIPSEL64
39 #    endif
40 #  else
41 #    if defined(__MIPSEB__)
42 #      define ARCH_NR AUDIT_ARCH_MIPS
43 #    else
44 #      define ARCH_NR AUDIT_ARCH_MIPSEL
45 #    endif
46 #  endif
47 #elif defined(__powerpc64__)
48 #  define ARCH_NR AUDIT_ARCH_PPC64
49 #elif defined(__powerpc__)
50 #  define ARCH_NR AUDIT_ARCH_PPC
51 #elif defined(__s390x__)
52 #  define ARCH_NR AUDIT_ARCH_S390X
53 #elif defined(__s390__)
54 #  define ARCH_NR AUDIT_ARCH_S390
55 #elif defined(__sparc__)
56 #  if defined(__arch64__)
57 #    define AUDIT_ARCH_SPARC64
58 #  else
59 #    define AUDIT_ARCH_SPARC
60 #  endif
61 #else
62 #  error "AUDIT_ARCH value unavailable"
63 #endif
64 
65 #endif /* ARCH_H */
66