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

Side by Side Diff: src/trusted/validator_arm/baseline_classes.cc

Issue 11194045: Change BKPT and UDF encodings on ARM. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Update copyright. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/validator_arm/armv7.table ('k') | src/trusted/validator_arm/gen/arm32_decode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/validator_arm/baseline_classes.h" 7 #include "native_client/src/trusted/validator_arm/baseline_classes.h"
8 8
9 #include <assert.h> 9 #include <assert.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 UNREFERENCED_PARAMETER(i); 83 UNREFERENCED_PARAMETER(i);
84 return true; 84 return true;
85 } 85 }
86 86
87 int32_t BranchImmediate24::branch_target_offset(Instruction i) const { 87 int32_t BranchImmediate24::branch_target_offset(Instruction i) const {
88 return imm24.relative_address(i); 88 return imm24.relative_address(i);
89 } 89 }
90 90
91 // BreakPointAndConstantPoolHead 91 // BreakPointAndConstantPoolHead
92 SafetyLevel BreakPointAndConstantPoolHead::safety(const Instruction i) const { 92 SafetyLevel BreakPointAndConstantPoolHead::safety(const Instruction i) const {
93 return i.GetCondition() == Instruction::AL 93 if (i.GetCondition() != Instruction::AL)
94 ? MAY_BE_SAFE 94 return UNPREDICTABLE;
95 : UNPREDICTABLE; 95 // Restrict BKPT's encoding to values we've chosen as safe.
96 if ((i.Bits(31, 0) == kLiteralPoolHead) ||
97 (i.Bits(31, 0) == kBreakpoint))
98 return MAY_BE_SAFE;
99 return FORBIDDEN_OPERANDS;
96 } 100 }
101
97 bool BreakPointAndConstantPoolHead:: 102 bool BreakPointAndConstantPoolHead::
98 is_literal_pool_head(const Instruction i) const { 103 is_literal_pool_head(const Instruction i) const {
99 return i.Bits(31, 0) == kLiteralPoolHeadInstruction; 104 return i.Bits(31, 0) == kLiteralPoolHead;
100 } 105 }
101 106
102 // BranchToRegister 107 // BranchToRegister
103 SafetyLevel BranchToRegister::safety(const Instruction i) const { 108 SafetyLevel BranchToRegister::safety(const Instruction i) const {
104 // Extra NaCl constraint: can't branch to PC. This would branch to 8 bytes 109 // Extra NaCl constraint: can't branch to PC. This would branch to 8 bytes
105 // after the current instruction. This instruction should be in an instruction 110 // after the current instruction. This instruction should be in an instruction
106 // pair, the mask should therefore be to PC and fail checking, but there's 111 // pair, the mask should therefore be to PC and fail checking, but there's
107 // little harm in checking. 112 // little harm in checking.
108 if (m.reg(i).Equals(Register::Pc())) return FORBIDDEN_OPERANDS; 113 if (m.reg(i).Equals(Register::Pc())) return FORBIDDEN_OPERANDS;
109 114
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 } 1525 }
1521 1526
1522 // InstructionBarrier 1527 // InstructionBarrier
1523 SafetyLevel InstructionBarrier::safety(Instruction i) const { 1528 SafetyLevel InstructionBarrier::safety(Instruction i) const {
1524 if (option.value(i) != 0xF) 1529 if (option.value(i) != 0xF)
1525 return FORBIDDEN_OPERANDS; 1530 return FORBIDDEN_OPERANDS;
1526 return UncondDecoder::safety(i); 1531 return UncondDecoder::safety(i);
1527 } 1532 }
1528 1533
1529 } // namespace nacl_arm_dec 1534 } // namespace nacl_arm_dec
OLDNEW
« no previous file with comments | « src/trusted/validator_arm/armv7.table ('k') | src/trusted/validator_arm/gen/arm32_decode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698