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" |
+ ".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 |