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

Side by Side Diff: sandbox/linux/seccomp-bpf/syscall_iterator.cc

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 7 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
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 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" 5 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" 8 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h"
9 9
10 namespace sandbox { 10 namespace sandbox {
11 11
12 uint32_t SyscallIterator::Next() { 12 uint32_t SyscallIterator::Next() {
13 if (done_) { 13 if (done_) {
14 return num_; 14 return num_;
15 } 15 }
16 16
17 uint32_t val; 17 uint32_t val;
18 do { 18 do {
19 #if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
20 // |num_| has been initialized to 4000, which we assume is also MIN_SYSCALL.
21 // This is true for Mips O32 ABI.
22 COMPILE_ASSERT(MIN_SYSCALL == __NR_Linux, min_syscall_should_be_4000);
jln (very slow on Chromium) 2014/05/02 20:42:04 The syscall iterator should always start at 0, thi
nedeljko 2014/05/07 15:40:05 I initialized num_ to 0 in constructor in new patc
23 #else
19 // |num_| has been initialized to 0, which we assume is also MIN_SYSCALL. 24 // |num_| has been initialized to 0, which we assume is also MIN_SYSCALL.
20 // This true for supported architectures (Intel and ARM EABI). 25 // This true for supported architectures (Intel and ARM EABI).
21 COMPILE_ASSERT(MIN_SYSCALL == 0u, min_syscall_should_always_be_zero); 26 COMPILE_ASSERT(MIN_SYSCALL == 0u, min_syscall_should_always_be_zero);
27 #endif
22 val = num_; 28 val = num_;
23 29
24 // First we iterate up to MAX_PUBLIC_SYSCALL, which is equal to MAX_SYSCALL 30 // First we iterate up to MAX_PUBLIC_SYSCALL, which is equal to MAX_SYSCALL
25 // on Intel architectures, but leaves room for private syscalls on ARM. 31 // on Intel architectures, but leaves room for private syscalls on ARM.
26 if (num_ <= MAX_PUBLIC_SYSCALL) { 32 if (num_ <= MAX_PUBLIC_SYSCALL) {
27 if (invalid_only_ && num_ < MAX_PUBLIC_SYSCALL) { 33 if (invalid_only_ && num_ < MAX_PUBLIC_SYSCALL) {
28 num_ = MAX_PUBLIC_SYSCALL; 34 num_ = MAX_PUBLIC_SYSCALL;
29 } else { 35 } else {
30 ++num_; 36 ++num_;
31 } 37 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #if defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__)) 89 #if defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__))
84 bool SyscallIterator::IsArmPrivate(uint32_t num) { 90 bool SyscallIterator::IsArmPrivate(uint32_t num) {
85 return (num >= MIN_PRIVATE_SYSCALL && num <= MAX_PRIVATE_SYSCALL) || 91 return (num >= MIN_PRIVATE_SYSCALL && num <= MAX_PRIVATE_SYSCALL) ||
86 (num >= MIN_GHOST_SYSCALL && num <= MAX_SYSCALL); 92 (num >= MIN_GHOST_SYSCALL && num <= MAX_SYSCALL);
87 } 93 }
88 #else 94 #else
89 bool SyscallIterator::IsArmPrivate(uint32_t) { return false; } 95 bool SyscallIterator::IsArmPrivate(uint32_t) { return false; }
90 #endif 96 #endif
91 97
92 } // namespace sandbox 98 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698