| OLD | NEW |
| 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.h" | 5 #include "sandbox/linux/seccomp-bpf/syscall.h" |
| 6 | 6 |
| 7 #include <asm/unistd.h> | 7 #include <asm/unistd.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 #else | 136 #else |
| 137 "stmfd sp!, {fp, lr}\n" | 137 "stmfd sp!, {fp, lr}\n" |
| 138 "add fp, sp, #4\n" | 138 "add fp, sp, #4\n" |
| 139 #endif | 139 #endif |
| 140 // Check if "r0" is negative. If so, do not attempt to make a | 140 // Check if "r0" is negative. If so, do not attempt to make a |
| 141 // system call. Instead, compute the return address that is visible | 141 // system call. Instead, compute the return address that is visible |
| 142 // to the kernel after we execute "swi 0". This address can be | 142 // to the kernel after we execute "swi 0". This address can be |
| 143 // used as a marker that BPF code inspects. | 143 // used as a marker that BPF code inspects. |
| 144 "cmp r0, #0\n" | 144 "cmp r0, #0\n" |
| 145 "bge 1f\n" | 145 "bge 1f\n" |
| 146 "ldr r0, =2f\n" | 146 "adr r0, 2f\n" |
| 147 "b 2f\n" | 147 "b 2f\n" |
| 148 // We declared (almost) all clobbered registers to the compiler. On | 148 // We declared (almost) all clobbered registers to the compiler. On |
| 149 // ARM there is no particular register pressure. So, we can go | 149 // ARM there is no particular register pressure. So, we can go |
| 150 // ahead and directly copy the entries from the arguments array | 150 // ahead and directly copy the entries from the arguments array |
| 151 // into the appropriate CPU registers. | 151 // into the appropriate CPU registers. |
| 152 "1:ldr r5, [r6, #20]\n" | 152 "1:ldr r5, [r6, #20]\n" |
| 153 "ldr r4, [r6, #16]\n" | 153 "ldr r4, [r6, #16]\n" |
| 154 "ldr r3, [r6, #12]\n" | 154 "ldr r3, [r6, #12]\n" |
| 155 "ldr r2, [r6, #8]\n" | 155 "ldr r2, [r6, #8]\n" |
| 156 "ldr r1, [r6, #4]\n" | 156 "ldr r1, [r6, #4]\n" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ret = inout; | 234 ret = inout; |
| 235 } | 235 } |
| 236 #else | 236 #else |
| 237 errno = ENOSYS; | 237 errno = ENOSYS; |
| 238 intptr_t ret = -1; | 238 intptr_t ret = -1; |
| 239 #endif | 239 #endif |
| 240 return ret; | 240 return ret; |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace sandbox | 243 } // namespace sandbox |
| OLD | NEW |