| Index: src/trusted/service_runtime/arch/mips/nacl_switch_to_app_mips.c
|
| diff --git a/src/trusted/service_runtime/arch/arm/nacl_switch_to_app_arm.c b/src/trusted/service_runtime/arch/mips/nacl_switch_to_app_mips.c
|
| similarity index 79%
|
| copy from src/trusted/service_runtime/arch/arm/nacl_switch_to_app_arm.c
|
| copy to src/trusted/service_runtime/arch/mips/nacl_switch_to_app_mips.c
|
| index 9a2f913f82105af85ebe669f4d14efbe75cfe0ed..fc750fe4a20aabc823867d8569dfe04387e8d87d 100644
|
| --- a/src/trusted/service_runtime/arch/arm/nacl_switch_to_app_arm.c
|
| +++ b/src/trusted/service_runtime/arch/mips/nacl_switch_to_app_mips.c
|
| @@ -9,26 +9,27 @@
|
| */
|
|
|
| #include "native_client/src/shared/platform/nacl_check.h"
|
| -#include "native_client/src/trusted/service_runtime/sel_ldr.h"
|
| -#include "native_client/src/trusted/service_runtime/arch/arm/sel_rt.h"
|
| +#include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h"
|
| #include "native_client/src/trusted/service_runtime/nacl_app_thread.h"
|
| #include "native_client/src/trusted/service_runtime/nacl_globals.h"
|
| #include "native_client/src/trusted/service_runtime/nacl_switch_to_app.h"
|
| +#include "native_client/src/trusted/service_runtime/sel_ldr.h"
|
|
|
| void NaClInitSwitchToApp(struct NaClApp *nap) {
|
| - /*
|
| - * We don't need anything here. We might need it in future if e.g.
|
| - * we start letting untrusted code use NEON extensions.
|
| - */
|
| + /*
|
| + * We don't need anything here.
|
| + */
|
| UNREFERENCED_PARAMETER(nap);
|
| }
|
|
|
| NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp,
|
| uint32_t new_prog_ctr) {
|
| + struct NaClApp *nap;
|
| struct NaClThreadContext *context;
|
|
|
| - natp->user.trusted_stack_ptr = NaClGetStackPtr() & ~0xf;
|
| + natp->user.trusted_stack_ptr = (NaClGetStackPtr() & ~0xf) + 4;
|
|
|
| + nap = natp->nap;
|
| context = &natp->user;
|
| context->new_prog_ctr = new_prog_ctr;
|
|
|
| @@ -41,6 +42,14 @@ NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp,
|
| */
|
| context->sysret = context->stack_ptr;
|
|
|
| + /*
|
| + * Just to be sure that app does not spoil gp
|
| + */
|
| + context->global_ptr = NaClGetGlobalPtr();
|
| +
|
| + /*
|
| + * context stored in $a0
|
| + */
|
| NaClSwitch(context);
|
| }
|
|
|
|
|