OLD | NEW |
1 /* ********************************************************** | 1 /* ********************************************************** |
2 * Copyright (c) 2011-2014 Google, Inc. All rights reserved. | 2 * Copyright (c) 2011-2014 Google, Inc. All rights reserved. |
3 * Copyright (c) 2001-2010 VMware, Inc. All rights reserved. | 3 * Copyright (c) 2001-2010 VMware, Inc. All rights reserved. |
4 * **********************************************************/ | 4 * **********************************************************/ |
5 | 5 |
6 /* | 6 /* |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions are met: | 8 * modification, are permitted provided that the following conditions are met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright notice, | 10 * * Redistributions of source code must retain the above copyright notice, |
(...skipping 4091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4102 } | 4102 } |
4103 return false; | 4103 return false; |
4104 } | 4104 } |
4105 | 4105 |
4106 /* returns false if need to rebuild bb: in that case this routine will | 4106 /* returns false if need to rebuild bb: in that case this routine will |
4107 * set the bb flags needed to ensure successful mangling 2nd time around | 4107 * set the bb flags needed to ensure successful mangling 2nd time around |
4108 */ | 4108 */ |
4109 static bool | 4109 static bool |
4110 mangle_bb_ilist(dcontext_t *dcontext, build_bb_t *bb) | 4110 mangle_bb_ilist(dcontext_t *dcontext, build_bb_t *bb) |
4111 { | 4111 { |
| 4112 #ifdef X86 |
4112 if (TEST(FRAG_SELFMOD_SANDBOXED, bb->flags)) { | 4113 if (TEST(FRAG_SELFMOD_SANDBOXED, bb->flags)) { |
4113 byte *selfmod_start, *selfmod_end; | 4114 byte *selfmod_start, *selfmod_end; |
4114 /* sandbox requires that bb have no direct cti followings! | 4115 /* sandbox requires that bb have no direct cti followings! |
4115 * check_thread_vm_area should have ensured this for us | 4116 * check_thread_vm_area should have ensured this for us |
4116 */ | 4117 */ |
4117 ASSERT(!TEST(FRAG_HAS_DIRECT_CTI, bb->flags)); | 4118 ASSERT(!TEST(FRAG_HAS_DIRECT_CTI, bb->flags)); |
4118 LOG(THREAD, LOG_INTERP, 2, | 4119 LOG(THREAD, LOG_INTERP, 2, |
4119 "fragment overlaps selfmod area, inserting sandboxing\n"); | 4120 "fragment overlaps selfmod area, inserting sandboxing\n"); |
4120 /* only reason can't be trace is don't have mechanism set up | 4121 /* only reason can't be trace is don't have mechanism set up |
4121 * to store app code for each trace bb and update sandbox code | 4122 * to store app code for each trace bb and update sandbox code |
(...skipping 25 matching lines...) Expand all Loading... |
4147 bb->flags = FRAG_SELFMOD_SANDBOXED; /* lose all other flags */ | 4148 bb->flags = FRAG_SELFMOD_SANDBOXED; /* lose all other flags */ |
4148 bb->full_decode = true; /* full decode this time! */ | 4149 bb->full_decode = true; /* full decode this time! */ |
4149 bb->follow_direct = false; | 4150 bb->follow_direct = false; |
4150 bb->exit_type = 0; /* i#577 */ | 4151 bb->exit_type = 0; /* i#577 */ |
4151 bb->exit_target = NULL; /* i#928 */ | 4152 bb->exit_target = NULL; /* i#928 */ |
4152 /* overlap info will be reset by check_new_page_start */ | 4153 /* overlap info will be reset by check_new_page_start */ |
4153 return false; | 4154 return false; |
4154 } | 4155 } |
4155 STATS_INC(num_sandboxed_fragments); | 4156 STATS_INC(num_sandboxed_fragments); |
4156 } | 4157 } |
| 4158 #endif /* X86 */ |
4157 | 4159 |
4158 DOLOG(4, LOG_INTERP, { | 4160 DOLOG(4, LOG_INTERP, { |
4159 LOG(THREAD, LOG_INTERP, 4, "bb ilist before mangling:\n"); | 4161 LOG(THREAD, LOG_INTERP, 4, "bb ilist before mangling:\n"); |
4160 instrlist_disassemble(dcontext, bb->start_pc, bb->ilist, THREAD); | 4162 instrlist_disassemble(dcontext, bb->start_pc, bb->ilist, THREAD); |
4161 }); | 4163 }); |
4162 mangle(dcontext, bb->ilist, &bb->flags, true, bb->record_translation); | 4164 mangle(dcontext, bb->ilist, &bb->flags, true, bb->record_translation); |
4163 DOLOG(4, LOG_INTERP, { | 4165 DOLOG(4, LOG_INTERP, { |
4164 LOG(THREAD, LOG_INTERP, 4, "bb ilist after mangling:\n"); | 4166 LOG(THREAD, LOG_INTERP, 4, "bb ilist after mangling:\n"); |
4165 instrlist_disassemble(dcontext, bb->start_pc, bb->ilist, THREAD); | 4167 instrlist_disassemble(dcontext, bb->start_pc, bb->ilist, THREAD); |
4166 }); | 4168 }); |
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7783 (*target)++; | 7785 (*target)++; |
7784 else | 7786 else |
7785 (*target)--; | 7787 (*target)--; |
7786 } | 7788 } |
7787 #endif | 7789 #endif |
7788 } | 7790 } |
7789 emulate_failure: | 7791 emulate_failure: |
7790 instr_free(dcontext, &instr); | 7792 instr_free(dcontext, &instr); |
7791 return next_pc; | 7793 return next_pc; |
7792 } | 7794 } |
OLD | NEW |