OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ | 7 #ifndef NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ |
8 #define NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ | 8 #define NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ |
9 | 9 |
10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 * "push {sp}" is undefined ("unpredictable") on ARM, so we move sp to | 247 * "push {sp}" is undefined ("unpredictable") on ARM, so we move sp to |
248 * a temporary register to push its original value. (Indeed, whether | 248 * a temporary register to push its original value. (Indeed, whether |
249 * sp is modified before or after being written differs between QEMU | 249 * sp is modified before or after being written differs between QEMU |
250 * and the Panda boards.) | 250 * and the Panda boards.) |
251 */ | 251 */ |
252 # define REGS_SAVER_FUNC(def_func, callee_func) \ | 252 # define REGS_SAVER_FUNC(def_func, callee_func) \ |
253 void def_func(); \ | 253 void def_func(); \ |
254 void callee_func(struct NaClSignalContext *regs); \ | 254 void callee_func(struct NaClSignalContext *regs); \ |
255 __asm__( \ | 255 __asm__( \ |
256 ".pushsection .text, \"ax\", %progbits\n" \ | 256 ".pushsection .text, \"ax\", %progbits\n" \ |
| 257 ".p2align 4\n" \ |
257 #def_func ":\n" \ | 258 #def_func ":\n" \ |
258 "push {r0}\n" /* Leave space for cpsr */ \ | 259 "push {r0}\n" /* Leave space for cpsr */ \ |
259 "push {r0}\n" /* Leave space for prog_ctr */ \ | 260 "push {r0}\n" /* Leave space for prog_ctr */ \ |
260 "push {r14}\n" \ | 261 "push {r14}\n" \ |
261 /* Save r0-r12 and sp; adjust sp for the pushes above */ \ | 262 /* Save r0-r12 and sp; adjust sp for the pushes above */ \ |
262 "add r14, sp, #0xc\n" \ | 263 "add r14, sp, #0xc\n" \ |
263 "push {r10-r12, r14}\n" \ | 264 "push {r10-r12, r14}\n" \ |
264 /* Push a dummy value for r9, which the tests need not compare */ \ | 265 /* Push a dummy value for r9, which the tests need not compare */ \ |
265 "mov r10, #0\n" \ | 266 "mov r10, #0\n" \ |
266 "push {r10}\n" \ | 267 "push {r10}\n" \ |
(...skipping 23 matching lines...) Expand all Loading... |
290 void RegsApplySandboxConstraints(struct NaClSignalContext *regs); | 291 void RegsApplySandboxConstraints(struct NaClSignalContext *regs); |
291 | 292 |
292 /* This compares for equality all registers saved by REGS_SAVER_FUNC. */ | 293 /* This compares for equality all registers saved by REGS_SAVER_FUNC. */ |
293 void RegsAssertEqual(const struct NaClSignalContext *actual, | 294 void RegsAssertEqual(const struct NaClSignalContext *actual, |
294 const struct NaClSignalContext *expected); | 295 const struct NaClSignalContext *expected); |
295 | 296 |
296 /* Zero out registers that are clobbered by function calls. */ | 297 /* Zero out registers that are clobbered by function calls. */ |
297 void RegsUnsetNonCalleeSavedRegisters(struct NaClSignalContext *regs); | 298 void RegsUnsetNonCalleeSavedRegisters(struct NaClSignalContext *regs); |
298 | 299 |
299 #endif | 300 #endif |
OLD | NEW |