| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 7 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 8 | 8 |
| 9 /* | 9 /* |
| 10 * The IRT uses its own private TLS, leaving r9 for the application. | 10 * The IRT uses its own private TLS, leaving r9 for the application. |
| 11 * We must define __aeabi_read_tp to get the private one instead of | 11 * We must define __aeabi_read_tp to get the private one instead of |
| 12 * the standard one. The EABI requires that this function preserve | 12 * the standard one. The EABI requires that this function preserve |
| 13 * all registers except r0 (the return value register). A normal | 13 * all registers except r0 (the return value register). A normal |
| 14 * function is permitted to clobber r1, r2, and r3 as well, so we | 14 * function is permitted to clobber r1, r2, and r3 as well, so we |
| 15 * cannot define this in C. | 15 * cannot define this in C. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 .globl __aeabi_read_tp | 18 .globl __aeabi_read_tp |
| 19 .type __aeabi_read_tp,%function | 19 .type __aeabi_read_tp,%function |
| 20 .p2align NACL_BLOCK_SHIFT | 20 .p2align NACL_BLOCK_SHIFT |
| 21 __aeabi_read_tp: | 21 __aeabi_read_tp: |
| 22 push {r1, r2, r3, lr} | 22 push {r1, r2, r3, lr} |
| 23 | 23 nop |
| 24 /* | 24 nop |
| 25 * Insert enough nops so the call is the last instruction in the bundle. | 25 /* NOTE: The call must be last slot in the bundle. |
| 26 * Consider using the pnacl specifc pseudo opcodes |
| 27 * once we build this with llvm-mc only. |
| 26 */ | 28 */ |
| 27 .rept ((NACL_BLOCK_SIZE - (. - __aeabi_read_tp)) / 4) - 1 | |
| 28 nop | |
| 29 .endr | |
| 30 bl __nacl_read_tp | 29 bl __nacl_read_tp |
| 31 | 30 |
| 32 pop {r1, r2, r3, lr} | 31 pop {r1, r2, r3, lr} |
| 33 bic lr, lr, #NACL_CONTROL_FLOW_MASK | 32 bic lr, lr, #NACL_CONTROL_FLOW_MASK |
| 34 bx lr | 33 bx lr |
| OLD | NEW |