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

Unified Diff: src/trusted/service_runtime/arch/mips/nacl_switch.S

Issue 11308039: MIPS: Fix NaClSwitch() to set $t9 to the address of the entry point (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/arch/mips/nacl_switch.S
diff --git a/src/trusted/service_runtime/arch/mips/nacl_switch.S b/src/trusted/service_runtime/arch/mips/nacl_switch.S
index cf5446f16439b0ec7034bc67d632373f38ffcd38..c95d007f3742aaf365a975994085d422468c109a 100644
--- a/src/trusted/service_runtime/arch/mips/nacl_switch.S
+++ b/src/trusted/service_runtime/arch/mips/nacl_switch.S
@@ -24,12 +24,12 @@ DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSwitch):
.set noreorder
-/*
- * We clear registers a1, a2, a3, t0, t1, t2, t3, t4, t5 and ra to avoid
- * information leaks. The remaining registers are overwritten by the code that
- * follows after.
- */
-
+ /*
+ * We clear the following registers to avoid information leaks. The
+ * remaining registers are overwritten by the code that follows
+ * after.
+ */
+ addu $v1, $zero, $zero
addu $a1, $zero, $zero
addu $a2, $zero, $zero
addu $a3, $zero, $zero
@@ -62,14 +62,19 @@ DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClSwitch):
/* NACL_CALLEE_SAVE_LIST END*/
lw $v0, NACL_THREAD_CONTEXT_OFFSET_SYSRET($a0)
- lw $v1, NACL_THREAD_CONTEXT_OFFSET_NEW_PROG_CTR($a0)
+ lw $t9, NACL_THREAD_CONTEXT_OFFSET_NEW_PROG_CTR($a0)
/* At startup, context->sysret contains not the the return value, but the
first argument. Put it in a0. */
addu $a0, $v0, $zero
- /* Transfer control to untrusted code */
- jr $v1
+ /*
+ * Transfer control to untrusted code.
+ *
+ * We leave $t9 containing the address of the function being called,
+ * as required by the MIPS ABI.
+ */
+ jr $t9
nop
.set reorder
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698