Chromium Code Reviews| Index: src/trusted/service_runtime/sel_validate_image.c |
| diff --git a/src/trusted/service_runtime/sel_validate_image.c b/src/trusted/service_runtime/sel_validate_image.c |
| index 45703bb494ba91bcfdabe9422c966a27a6621082..7cd43d040b2ae9a9ee505eb97a798eaf3c52fd99 100644 |
| --- a/src/trusted/service_runtime/sel_validate_image.c |
| +++ b/src/trusted/service_runtime/sel_validate_image.c |
| @@ -28,6 +28,11 @@ static int NaClValidateStatus(NaClValidationStatus status) { |
| int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr, |
| uint8_t *data, size_t size) { |
| NaClValidationStatus status = NaClValidationSucceeded; |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
|
Karl
2011/08/30 19:53:52
Again, I think this code is confusing build with t
|
| + uintptr_t entry = nap->user_entry_pt ? |
| + nap->user_entry_pt : nap->initial_entry_pt; |
| + uint8_t thumb = entry & 1; |
| +#endif |
| if (nap->validator_stub_out_mode) { |
| /* In stub out mode, we do two passes. The second pass acts as a |
| sanity check that bad instructions were indeed overwritten with |
| @@ -37,7 +42,11 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr, |
| NACL_TARGET_SUBARCH)( |
| NaClApplyValidationDoStubout, |
| guest_addr, data, size, |
| - nap->bundle_size, TRUE); |
| + nap->bundle_size, TRUE |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| +, thumb |
|
Karl
2011/08/30 19:53:52
Why is "thumb" needed. Isn't it already communicat
bsy
2011/09/01 00:30:00
stylistically speaking, conditionally adding an ac
jasonwkim
2011/09/16 20:09:16
Fixex
|
| +#endif |
| +); |
| } |
| if (status == NaClValidationSucceeded) { |
| status = NACL_SUBARCH_NAME(ApplyValidator, |
| @@ -45,7 +54,11 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr, |
| NACL_TARGET_SUBARCH)( |
| NaClApplyCodeValidation, |
| guest_addr, data, size, |
| - nap->bundle_size, TRUE); |
| + nap->bundle_size, TRUE |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| +, thumb |
|
Karl
2011/08/30 19:53:52
Same question as above.
|
| +#endif |
| +); |
| } |
| return NaClValidateStatus(status); |
| } |
| @@ -53,30 +66,46 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr, |
| int NaClValidateCodeReplacement(struct NaClApp *nap, uintptr_t guest_addr, |
| uint8_t *data_old, uint8_t *data_new, |
| size_t size) { |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| + uintptr_t entry = nap->user_entry_pt ? |
| + nap->user_entry_pt : nap->initial_entry_pt; |
| + uint8_t thumb = entry & 1; |
| +#endif |
| if (nap->validator_stub_out_mode) return LOAD_BAD_FILE; |
| if ((guest_addr % nap->bundle_size) != 0 || |
| (size % nap->bundle_size) != 0) { |
| return LOAD_BAD_FILE; |
| } |
| - |
| return NaClValidateStatus( |
| NACL_SUBARCH_NAME(ApplyValidatorCodeReplacement, |
| NACL_TARGET_ARCH, |
| NACL_TARGET_SUBARCH) |
| - (guest_addr, data_old, data_new, size, nap->bundle_size)); |
| + (guest_addr, data_old, data_new, size, nap->bundle_size |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| +, thumb |
| +#endif |
| +)); |
| } |
| int NaClCopyCode(struct NaClApp *nap, uintptr_t guest_addr, |
| uint8_t *data_old, uint8_t *data_new, |
| size_t size) { |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| + uintptr_t entry = nap->user_entry_pt ? |
| + nap->user_entry_pt : nap->initial_entry_pt; |
| + uint8_t thumb = entry & 1; |
| +#endif |
| return NaClValidateStatus( |
| NACL_SUBARCH_NAME(ApplyValidatorCopy, |
| NACL_TARGET_ARCH, |
| NACL_TARGET_SUBARCH) |
| - (guest_addr, data_old, data_new, size, nap->bundle_size)); |
| + (guest_addr, data_old, data_new, size, nap->bundle_size |
| +#if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| +, thumb |
| +#endif |
| +)); |
| } |
| - |
| NaClErrorCode NaClValidateImage(struct NaClApp *nap) { |
| uintptr_t memp; |
| uintptr_t endp; |