Chromium Code Reviews| Index: src/trusted/platform_qualify/arch/mips/nacl_dep_qualify_arch.c | 
| diff --git a/src/trusted/platform_qualify/arch/arm/nacl_dep_qualify_arch.c b/src/trusted/platform_qualify/arch/mips/nacl_dep_qualify_arch.c | 
| similarity index 59% | 
| copy from src/trusted/platform_qualify/arch/arm/nacl_dep_qualify_arch.c | 
| copy to src/trusted/platform_qualify/arch/mips/nacl_dep_qualify_arch.c | 
| index 3d6d3531ef0880d80829d644cc9de00ccdcc1f0d..42c4fd1a462c3c5594c377cad68b5e11fb5a8268 100644 | 
| --- a/src/trusted/platform_qualify/arch/arm/nacl_dep_qualify_arch.c | 
| +++ b/src/trusted/platform_qualify/arch/mips/nacl_dep_qualify_arch.c | 
| @@ -1,5 +1,5 @@ | 
| /* | 
| - * Copyright 2010 The Native Client Authors. All rights reserved. | 
| + * Copyright 2012 The Native Client Authors. All rights reserved. | 
| * Use of this source code is governed by a BSD-style license that can | 
| * be found in the LICENSE file. | 
| */ | 
| @@ -9,8 +9,9 @@ | 
| #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h" | 
| #include "native_client/src/include/nacl_macros.h" | 
| -/* Assembled equivalent of "bx lr" */ | 
| -#define INST_BX_LR 0xE12FFF1E | 
| +/* Assembled equivalent of "jr ra" */ | 
| +#define INST_JR_RA 0x3E00008 | 
| +#define INST_NOP 0x0000000 | 
| int NaClCheckDEP() { | 
| /* | 
| @@ -21,17 +22,16 @@ int NaClCheckDEP() { | 
| nacl_void_thunk NaClGenerateThunk(char *buf, size_t size_in_bytes) { | 
| /* | 
| - * Place a "bx lr" at the next aligned address after buf. Instructions | 
| - * are always little-endian, regardless of data setting. | 
| + * Place a "jr ra" at the next aligned address after buf. Instructions | 
| + * are always little-endian, regardless of data setting. We also place opcode | 
| + * for "nop" (which is zero) because of delay slot in Mips. | 
| */ | 
| - char *aligned_buf = (char *) (((uintptr_t) buf + 3) & ~3); | 
| + uint32_t *aligned_buf = (uint32_t *) (((uintptr_t) buf + 3) & ~3); | 
| - if (aligned_buf + 4 > buf + size_in_bytes) return 0; | 
| + if ((char*)aligned_buf + 8 > buf + size_in_bytes) return 0; | 
| 
 
Mark Seaborn
2012/09/18 03:24:34
Nit: NaCl spacing style is "(char *) aligned_buf"
 
petarj
2012/09/19 17:27:51
Done.
 
 | 
| - aligned_buf[0] = (char) (INST_BX_LR >> 0); | 
| - aligned_buf[1] = (char) (INST_BX_LR >> 8); | 
| - aligned_buf[2] = (char) (INST_BX_LR >> 16); | 
| - aligned_buf[3] = (char) (INST_BX_LR >> 24); | 
| + aligned_buf[0] = (uint32_t) INST_JR_RA; | 
| + aligned_buf[1] = (uint32_t) INST_NOP; | 
| /* | 
| * ISO C prevents a direct data->function cast, because the pointers aren't |