Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/trusted/service_runtime/arch/mips/nacl_switch.S

Issue 10919162: [MIPS] Implementation of sel_ldr for MIPS architecture. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Rebase (Saturday morning). Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 #include "native_client/src/trusted/service_runtime/arch/mips/sel_rt.h"
8 #include "native_client/src/trusted/service_runtime/nacl_config.h"
9
10 .text
11
12 /*
13 * This trusted code is linked into the service_runtime and
14 * executed when switching from the service runtime to a nacl
15 * module. This happens when a main nacl thread is created and starting to
16 * execute the nacl code, or when nacl module is returning from a system
17 * call. This piece of code lives in a service runtime part of address space.
18 * The one and only argument is in register a0
19 *
20 * a0 -- address of thread context (struct NaClThreadContext)
21 */
22
23 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSwitch):
24
25 .set noreorder
26
27 /*
28 * We clear registers a1, a2, a3, t0, t1, t2, t3, t4, t5 and ra to avoid
29 * information leaks. The remaining registers are overwritten by the code that
30 * follows after.
31 */
32
33 addu $a1, $zero, $zero
34 addu $a2, $zero, $zero
35 addu $a3, $zero, $zero
36 addu $t0, $zero, $zero
37 addu $t1, $zero, $zero
38 addu $t2, $zero, $zero
39 addu $t3, $zero, $zero
40 addu $t4, $zero, $zero
41 addu $t5, $zero, $zero
42 addu $ra, $zero, $zero
43
44 /* NACL_CALLEE_SAVE_LIST BEGIN */
45
46 lui $t6, %hi(NACL_CONTROL_FLOW_MASK)
47 addiu $t6, $t6, %lo(NACL_CONTROL_FLOW_MASK)
48 lui $t7, %hi(NACL_DATA_FLOW_MASK)
49 addiu $t7, $t7, %lo(NACL_DATA_FLOW_MASK)
50 lw $s0, NACL_THREAD_CONTEXT_OFFSET_S0($a0)
51 lw $s1, NACL_THREAD_CONTEXT_OFFSET_S1($a0)
52 lw $s2, NACL_THREAD_CONTEXT_OFFSET_S2($a0)
53 lw $s3, NACL_THREAD_CONTEXT_OFFSET_S3($a0)
54 lw $s4, NACL_THREAD_CONTEXT_OFFSET_S4($a0)
55 lw $s5, NACL_THREAD_CONTEXT_OFFSET_S5($a0)
56 lw $s6, NACL_THREAD_CONTEXT_OFFSET_S6($a0)
57 lw $s7, NACL_THREAD_CONTEXT_OFFSET_S7($a0)
58 lw $t8, NACL_THREAD_CONTEXT_OFFSET_T8($a0)
59 lw $gp, NACL_THREAD_CONTEXT_OFFSET_GLOBAL_PTR($a0)
60 lw $sp, NACL_THREAD_CONTEXT_OFFSET_STACK_PTR($a0)
61 lw $fp, NACL_THREAD_CONTEXT_OFFSET_FRAME_PTR($a0)
62
63 /* NACL_CALLEE_SAVE_LIST END*/
64
65 lw $v0, NACL_THREAD_CONTEXT_OFFSET_SYSRET($a0)
66 lw $v1, NACL_THREAD_CONTEXT_OFFSET_NEW_PROG_CTR($a0)
67
68 /* At startup, context->sysret contains not the the return value, but the
69 first argument. Put it in a0. */
70 addu $a0, $v0, $zero
71
72 /* Transfer control to untrusted code */
73 jr $v1
74 nop
75
76 .set reorder
77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698