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

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: 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/nacl_config.h"
8
9 .text
10
11 /*
12 * This trusted code is linked into the service_runtime and
13 * executed when switching from the service runtime to a nacl
14 * module. This happens when a main nacl thread is created and starting to
15 * execute the nacl code, or when nacl module is returning from a system
16 * call. This piece of code lives in a service runtime part of address space.
17 * The one and only argument is in register a0
18 *
19 * a0 -- address of thread context (struct NaClThreadContext)
20 */
21
22 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSwitch):
23
24 .set noreorder
25
26 /*
27 * We clear registers a1, a2, a3, t0, t1, t2, t3, t4, t5 and ra to avoid
28 * information leaks. The remaining registers are overwritten by the code that
29 * follows after.
30 */
31
32 addu $a1, $zero, $zero
33 addu $a2, $zero, $zero
34 addu $a3, $zero, $zero
35 addu $t0, $zero, $zero
36 addu $t1, $zero, $zero
37 addu $t2, $zero, $zero
38 addu $t3, $zero, $zero
39 addu $t4, $zero, $zero
40 addu $t5, $zero, $zero
41 addu $ra, $zero, $zero
42
43 /* NACL_CALLEE_SAVE_LIST BEGIN */
44 lw $t6, 0($a0)
45 lw $t7, 4($a0)
46 lw $s0, 8($a0)
47 lw $s1, 12($a0)
48 lw $s2, 16($a0)
49 lw $s3, 20($a0)
50 lw $s4, 24($a0)
51 lw $s5, 28($a0)
52 lw $s6, 32($a0)
53 lw $s7, 36($a0)
54 lw $t8, 40($a0)
55 lw $gp, 44($a0)
56 lw $sp, 48($a0)
57 lw $fp, 52($a0)
58 /* NACL_CALLEE_SAVE_LIST END*/
59
60 lw $v0, 60($a0) /* context->sysret */
61 lw $v1, 64($a0) /* context->new_prog_ctr */
62
63 /* At startup, context->sysret contains not the the return value, but the
64 first argument. Put it in a0. */
65 addu $a0, $v0, $zero
66
67 /* Transfer control to untrusted code */
68 jr $v1
69 nop
70
71 .set reorder
72
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698