• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_
6 #define SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_
7 
8 #if defined(__x86_64__)
9 
10 #define MIN_SYSCALL         0u
11 #define MAX_PUBLIC_SYSCALL  1024u
12 #define MAX_SYSCALL         MAX_PUBLIC_SYSCALL
13 
14 #elif defined(__i386__)
15 
16 #define MIN_SYSCALL         0u
17 #define MAX_PUBLIC_SYSCALL  1024u
18 #define MAX_SYSCALL         MAX_PUBLIC_SYSCALL
19 
20 #elif defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__))
21 
22 // ARM EABI includes "ARM private" system calls starting at |__ARM_NR_BASE|,
23 // and a "ghost syscall private to the kernel", cmpxchg,
24 // at |__ARM_NR_BASE+0x00fff0|.
25 // See </arch/arm/include/asm/unistd.h> in the Linux kernel.
26 
27 // __NR_SYSCALL_BASE is 0 in thumb and ARM EABI.
28 #define MIN_SYSCALL         0u
29 #define MAX_PUBLIC_SYSCALL  (MIN_SYSCALL + 1024u)
30 // __ARM_NR_BASE is __NR_SYSCALL_BASE + 0xf0000u
31 #define MIN_PRIVATE_SYSCALL 0xf0000u
32 #define MAX_PRIVATE_SYSCALL (MIN_PRIVATE_SYSCALL + 16u)
33 #define MIN_GHOST_SYSCALL   (MIN_PRIVATE_SYSCALL + 0xfff0u)
34 #define MAX_SYSCALL         (MIN_GHOST_SYSCALL + 4u)
35 
36 #elif defined(__mips__) && (_MIPS_SIM == _ABIO32)
37 
38 #include <asm/unistd.h>  // for __NR_O32_Linux and __NR_Linux_syscalls
39 #define MIN_SYSCALL         __NR_O32_Linux
40 #define MAX_PUBLIC_SYSCALL  (MIN_SYSCALL + __NR_Linux_syscalls)
41 #define MAX_SYSCALL         MAX_PUBLIC_SYSCALL
42 
43 #elif defined(__mips__) && (_MIPS_SIM == _ABI64)
44 
45 #error "Add support to header file"
46 
47 #elif defined(__aarch64__)
48 
49 #define MIN_SYSCALL 0u
50 #define MAX_PUBLIC_SYSCALL 279u
51 #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
52 
53 #else
54 #error "Unsupported architecture"
55 #endif
56 
57 #endif  // SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_
58