Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SH: define syscall_get_arch() for superh

This patch defines syscall_get_arch() for the superh platform. It does
so in both syscall_32.h and syscall_64.h. I'm not certain if the
implementation in syscall_64.h couldn't just be used in syscall.h as I
can't really track the setting of CONFIG_64BIT...

This way is safe, but we might be able to combine these if a superh
person were able to review...

[v2]
fixed indentation stoopidity (Sergei Shtylyov)
use AUDIT_ARCH_SH instead of EM_SH

Based-on-patch-by: Richard Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Cc: linux-sh@vger.kernel.org

+24
+10
arch/sh/include/asm/syscall_32.h
··· 1 1 #ifndef __ASM_SH_SYSCALL_32_H 2 2 #define __ASM_SH_SYSCALL_32_H 3 3 4 + #include <uapi/linux/audit.h> 4 5 #include <linux/kernel.h> 5 6 #include <linux/sched.h> 6 7 #include <linux/err.h> ··· 94 93 } 95 94 } 96 95 96 + static inline int syscall_get_arch(void) 97 + { 98 + int arch = AUDIT_ARCH_SH; 99 + 100 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 101 + arch |= __AUDIT_ARCH_LE; 102 + #endif 103 + return arch; 104 + } 97 105 #endif /* __ASM_SH_SYSCALL_32_H */
+14
arch/sh/include/asm/syscall_64.h
··· 1 1 #ifndef __ASM_SH_SYSCALL_64_H 2 2 #define __ASM_SH_SYSCALL_64_H 3 3 4 + #include <uapi/linux/audit.h> 4 5 #include <linux/kernel.h> 5 6 #include <linux/sched.h> 6 7 #include <asm/ptrace.h> ··· 62 61 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0])); 63 62 } 64 63 64 + static inline int syscall_get_arch(void) 65 + { 66 + int arch = AUDIT_ARCH_SH; 67 + 68 + #ifdef CONFIG_64BIT 69 + arch |= __AUDIT_ARCH_64BIT; 70 + #endif 71 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 72 + arch |= __AUDIT_ARCH_LE; 73 + #endif 74 + 75 + return arch; 76 + } 65 77 #endif /* __ASM_SH_SYSCALL_64_H */