| 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 /* | 7 /* |
| 8 * NaCl Service Runtime, C-level context switch code. | 8 * NaCl Service Runtime, C-level context switch code. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp, | 26 NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp, |
| 27 uint32_t new_prog_ctr) { | 27 uint32_t new_prog_ctr) { |
| 28 struct NaClApp *nap; | 28 struct NaClApp *nap; |
| 29 struct NaClThreadContext *context; | 29 struct NaClThreadContext *context; |
| 30 | 30 |
| 31 natp->sys.stack_ptr = NaClGetStackPtr() & ~0xf; | 31 natp->sys.stack_ptr = NaClGetStackPtr() & ~0xf; |
| 32 | 32 |
| 33 nap = natp->nap; | 33 nap = natp->nap; |
| 34 context = &natp->user; | 34 context = &natp->user; |
| 35 context->new_eip = new_prog_ctr; | 35 context->new_prog_ctr = new_prog_ctr; |
| 36 | 36 |
| 37 /* | 37 /* |
| 38 * At startup this is not the return value, but the first argument. | 38 * At startup this is not the return value, but the first argument. |
| 39 * In the initial thread, it gets the pointer to the information | 39 * In the initial thread, it gets the pointer to the information |
| 40 * block on the stack. Additional threads do not expect anything in | 40 * block on the stack. Additional threads do not expect anything in |
| 41 * particular in the first argument register, so we don't bother to | 41 * particular in the first argument register, so we don't bother to |
| 42 * conditionalize this. | 42 * conditionalize this. |
| 43 */ | 43 */ |
| 44 context->sysret = context->stack_ptr; | 44 context->sysret = context->stack_ptr; |
| 45 | 45 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 /* | 56 /* |
| 57 * syscall return | 57 * syscall return |
| 58 */ | 58 */ |
| 59 NORETURN void NaClSwitchToApp(struct NaClAppThread *natp, | 59 NORETURN void NaClSwitchToApp(struct NaClAppThread *natp, |
| 60 uint32_t new_prog_ctr) { | 60 uint32_t new_prog_ctr) { |
| 61 struct NaClApp *nap; | 61 struct NaClApp *nap; |
| 62 struct NaClThreadContext *context; | 62 struct NaClThreadContext *context; |
| 63 | 63 |
| 64 nap = natp->nap; | 64 nap = natp->nap; |
| 65 context = &natp->user; | 65 context = &natp->user; |
| 66 context->new_eip = new_prog_ctr; | 66 context->new_prog_ctr = new_prog_ctr; |
| 67 context->sysret = natp->sysret; | 67 context->sysret = natp->sysret; |
| 68 | 68 |
| 69 NaClSwitch(context); | 69 NaClSwitch(context); |
| 70 } | 70 } |
| OLD | NEW |