Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: sandbox/linux/seccomp-bpf/syscall.h

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Update per code review Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc ('k') | sandbox/linux/seccomp-bpf/syscall.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ 6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__
7 7
8 #include <signal.h>
8 #include <stdint.h> 9 #include <stdint.h>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "sandbox/sandbox_export.h" 12 #include "sandbox/sandbox_export.h"
12 13
13 namespace sandbox { 14 namespace sandbox {
14 15
15 // This purely static class can be used to perform system calls with some 16 // This purely static class can be used to perform system calls with some
16 // low-level control. 17 // low-level control.
17 class SANDBOX_EXPORT Syscall { 18 class SANDBOX_EXPORT Syscall {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return Call(nr, p0, p1, 0, 0, 0, 0); 74 return Call(nr, p0, p1, 0, 0, 0, 0);
74 } 75 }
75 76
76 template <class T0> 77 template <class T0>
77 static inline intptr_t Call(int nr, T0 p0) { 78 static inline intptr_t Call(int nr, T0 p0) {
78 return Call(nr, p0, 0, 0, 0, 0, 0); 79 return Call(nr, p0, 0, 0, 0, 0, 0);
79 } 80 }
80 81
81 static inline intptr_t Call(int nr) { return Call(nr, 0, 0, 0, 0, 0, 0); } 82 static inline intptr_t Call(int nr) { return Call(nr, 0, 0, 0, 0, 0, 0); }
82 83
84 // Set the registers in |ctx| to match what they would be after a system call
85 // returning |ret_val|. |ret_val| must follow the Syscall::Call() convention
86 // of being -errno on errors.
87 static void PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx);
88
83 private: 89 private:
84 DISALLOW_IMPLICIT_CONSTRUCTORS(Syscall); 90 DISALLOW_IMPLICIT_CONSTRUCTORS(Syscall);
jln (very slow on Chromium) 2014/06/20 21:18:18 This should always be at the bottom of the private
nedeljko 2014/07/09 13:29:57 Done.
91
92 #if defined(__mips__)
93 // This function basically does on MIPS what SandboxSyscall() is doing on
94 // other architectures. However, because of specificity of MIPS regarding
95 // handelling syscall errors, SandboxSyscall() is made as a wrapper for this
96 // function in order for SandboxSyscall() to behave more like on othere
97 // architectures on places where return value from SandboxSyscall() is used
98 // directly (like in most tests).
99 // The syscall "nr" is called with arguments that are set in an array on which
100 // pointer "args" points to and an information weather there is an error or no
101 // is returned to SandboxSyscall() by err_stat.
102 static intptr_t SandboxSyscallRaw(int nr,
103 const intptr_t* args,
104 intptr_t* err_stat);
105 #endif // defined(__mips__)};
85 }; 106 };
86 107
87 } // namespace sandbox 108 } // namespace sandbox
88 109
89 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ 110 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc ('k') | sandbox/linux/seccomp-bpf/syscall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698