Index: sandbox/linux/seccomp-bpf/syscall.h |
diff --git a/sandbox/linux/seccomp-bpf/syscall.h b/sandbox/linux/seccomp-bpf/syscall.h |
index 57970a35b040641069969b4874bf369a0aca990a..10e6836c69bceeb9cadf983ea18db857d04100e3 100644 |
--- a/sandbox/linux/seccomp-bpf/syscall.h |
+++ b/sandbox/linux/seccomp-bpf/syscall.h |
@@ -5,6 +5,7 @@ |
#ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
#define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
+#include <signal.h> |
#include <stdint.h> |
#include "base/macros.h" |
@@ -80,10 +81,30 @@ class SANDBOX_EXPORT Syscall { |
static inline intptr_t Call(int nr) { return Call(nr, 0, 0, 0, 0, 0, 0); } |
+ // Set the registers in |ctx| to match what they would be after a system call |
+ // returning |ret_val|. |ret_val| must follow the Syscall::Call() convention |
+ // of being -errno on errors. |
+ static void PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx); |
+ |
private: |
DISALLOW_IMPLICIT_CONSTRUCTORS(Syscall); |
}; |
+#if defined(__mips__) |
+// This function basically does on MIPS what SandboxSyscall() is doing on |
+// other architectures. However, because of specificity of MIPS regarding |
+// handelling syscall errors, SandboxSyscall() is made as a wrapper for this |
+// function in order for SandboxSyscall() to behave more like on othere |
+// architectures on places where return value from SandboxSyscall() is used |
+// directly (like in most tests). |
+// The syscall "nr" is called with arguments that are set in an array on which |
+// pointer "args" points to and an information weather there is an error or no |
+// is returned to SandboxSyscall() by err_stat. |
+intptr_t SandboxSyscallRaw(int nr, |
jln (very slow on Chromium)
2014/06/20 00:37:06
Let's add this as a private member of the class in
nedeljko
2014/06/20 14:09:51
Done.
|
+ const intptr_t* args, |
+ intptr_t* err_stat); |
+#endif // defined(__mips__) |
+ |
} // namespace sandbox |
#endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |