| 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 66%
|
| 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 fc7c1a85ed6a81f15a71c1f29357d679c0234899..883b2090561da5c9bbd21e07a1510f6d6fc56495 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
|
| @@ -1,25 +1,24 @@
|
| /*
|
| - * Copyright (c) 2012 The Native Client Authors. All rights reserved.
|
| - * Use of this source code is governed by a BSD-style license that can be
|
| - * found in the LICENSE file.
|
| - */
|
| +* Copyright (c) 2012 The Native Client Authors. All rights reserved.
|
| +* Use of this source code is governed by a BSD-style license that can be
|
| +* found in the LICENSE file.
|
| +*/
|
|
|
| /*
|
| * NaCl Service Runtime, C-level context switch code.
|
| */
|
|
|
| #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);
|
| }
|
|
|
| @@ -28,7 +27,7 @@ NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp,
|
| 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;
|
| @@ -43,6 +42,20 @@ NORETURN void NaClStartThreadInApp(struct NaClAppThread *natp,
|
| */
|
| context->sysret = context->stack_ptr;
|
|
|
| + /*
|
| + * Define load/store and jump masks before switching to app
|
| + */
|
| + context->t6 = NACL_CONTROL_FLOW_MASK;
|
| + context->t7 = NACL_DATA_FLOW_MASK;
|
| +
|
| + /*
|
| + * Just to be sure that app does not spoil gp
|
| + */
|
| + context->global_ptr = NaClGetGlobalPtr();
|
| +
|
| + /*
|
| + * context stored in $a0
|
| + */
|
| NaClSwitch(context);
|
| }
|
|
|
|
|