| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 32 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 33 | 33 |
| 34 .text | 34 .text |
| 35 .globl IDENTIFIER(NaClSwitch) | 35 .globl IDENTIFIER(NaClSwitch) |
| 36 HIDDEN(NaClSwitch) |
| 36 IDENTIFIER(NaClSwitch): | 37 IDENTIFIER(NaClSwitch): |
| 37 | 38 |
| 38 /* | 39 /* |
| 39 * This code is executed when switching from the service runtime to a nacl | 40 * This code is executed when switching from the service runtime to a nacl |
| 40 * module. This happens when a main nacl thread is created and starting to | 41 * module. This happens when a main nacl thread is created and starting to |
| 41 * execute the nacle code, or when nacl module is returning from a system | 42 * execute the nacle code, or when nacl module is returning from a system |
| 42 * call. This piece of code lives in a service runtime part of address space. | 43 * call. This piece of code lives in a service runtime part of address space. |
| 43 * the one and only argument is in register r0 | 44 * the one and only argument is in register r0 |
| 44 * | 45 * |
| 45 * r0 -- address of thread context (struct NaClThreadContext) | 46 * r0 -- address of thread context (struct NaClThreadContext) |
| 46 */ | 47 */ |
| 47 | 48 |
| 48 /* clear registers r2,r3, lr, flag and status fields in CPSR (status | 49 /* clear registers r2,r3, lr, flag and status fields in CPSR (status |
| 49 * register). This might be necessary to avoid information leaks, the rest | 50 * register). This might be necessary to avoid information leaks, the rest |
| 50 * register are overwritten by the following code and the code in springboard. | 51 * register are overwritten by the following code and the code in springboard. |
| 51 */ | 52 */ |
| 52 mov r2, #0 | 53 mov r2, #0 |
| 53 mov r3, #0 | 54 mov r3, #0 |
| 54 mov lr, #0 | 55 mov lr, #0 |
| 55 msr cpsr_fs, #0 | 56 msr cpsr_fs, #0 |
| 56 | 57 |
| 57 ldmia r0!, {r4, r5, r6, r7, r8, r9, r10, fp, sp} | 58 ldmia r0!, {r4, r5, r6, r7, r8, r9, r10, fp, sp} |
| 58 add r0, #4 /* skip prog_ctr in struct NaClThreadContext */ | 59 add r0, #4 /* skip prog_ctr in struct NaClThreadContext */ |
| 59 ldmia r0, {r0, r1, pc} | 60 ldmia r0, {r0, r1, pc} |
| 60 | |
| OLD | NEW |