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

Unified Diff: src/trusted/service_runtime/linux/nacl_bootstrap.c

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: Second update per Mark's comments. 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 side-by-side diff with in-line comments
Download patch
Index: src/trusted/service_runtime/linux/nacl_bootstrap.c
diff --git a/src/trusted/service_runtime/linux/nacl_bootstrap.c b/src/trusted/service_runtime/linux/nacl_bootstrap.c
index 6a7537769c324f180cdf12d5e3cccfa63a1c573f..b8503184afd2d1d3af4fe1d0da32a80cd97039bb 100644
--- a/src/trusted/service_runtime/linux/nacl_bootstrap.c
+++ b/src/trusted/service_runtime/linux/nacl_bootstrap.c
@@ -264,6 +264,8 @@ static ElfW(Addr) load_elf_file(const char *filename,
case EM_X86_64:
#elif defined(__arm__)
case EM_ARM:
+#elif defined(__mips__)
+ case EM_MIPS:
#else
# error "Don't know the e_machine value for this architecture!"
#endif
@@ -667,6 +669,24 @@ asm(".pushsection \".text\",\"ax\",%progbits\n"
"blx r0\n" /* Jump to the entry point. */
".popsection"
);
+#elif defined(__mips__)
+ asm(".pushsection \".text\",\"ax\",%progbits\n"
Mark Seaborn 2012/09/18 03:24:34 Nit: don't indent this line, because it's a top-le
petarj 2012/09/19 17:27:51 Done.
+ ".globl _start\n"
+ ".type _start,@function\n"
+ "_start:\n"
+ ".set noreorder\n"
+ "addiu $fp, $zero, 0\n"
+ "addiu $ra, $zero, 0\n"
+ "addiu $s8, $sp, 0\n" /* Save starting SP in s8. */
+ "addiu $a0, $sp, 0\n"
+ "addiu $sp, $sp, -16\n"
+ "jal do_load\n"
+ "nop\n"
+ "addiu $sp, $s8, 0\n" /* Restore the saved SP. */
+ "jr $v0\n" /* Jump to the entry point. */
+ "nop\n"
+ ".popsection"
+ );
#else
# error "Need stack-preserving _start code for this architecture!"
#endif

Powered by Google App Engine
This is Rietveld 408576698