OLD | NEW |
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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H |
9 | 9 |
10 /* | 10 /* |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 267 } |
268 | 268 |
269 bool IsJmpReg() const { | 269 bool IsJmpReg() const { |
270 return decoder_->IsJmpReg(); | 270 return decoder_->IsJmpReg(); |
271 } | 271 } |
272 | 272 |
273 bool IsLoadStore() const { | 273 bool IsLoadStore() const { |
274 return decoder_->IsLoadStore(); | 274 return decoder_->IsLoadStore(); |
275 } | 275 } |
276 | 276 |
| 277 bool IsLoadWord() const { |
| 278 return decoder_->IsLoadWord(); |
| 279 } |
| 280 |
| 281 uint32_t GetImm() const { |
| 282 return decoder_->GetImm(inst_); |
| 283 } |
| 284 |
277 bool IsDirectJump() const { | 285 bool IsDirectJump() const { |
278 return decoder_->IsDirectJump(); | 286 return decoder_->IsDirectJump(); |
279 } | 287 } |
280 | 288 |
281 bool IsDestGprReg(nacl_mips_dec::RegisterList rl) const { | 289 bool IsDestGprReg(nacl_mips_dec::RegisterList rl) const { |
282 return rl.ContainsAny(nacl_mips_dec::RegisterList(DestGprReg())); | 290 return rl.ContainsAny(nacl_mips_dec::RegisterList(DestGprReg())); |
283 } | 291 } |
284 | 292 |
285 bool IsDataRegMask() const { | 293 bool IsDataRegMask() const { |
286 return IsMask(DestGprReg(), nacl_mips_dec::Register::LoadStoreMask()); | 294 return IsMask(DestGprReg(), nacl_mips_dec::Register::LoadStoreMask()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 */ | 386 */ |
379 | 387 |
380 // An instruction is unsafe -- more information in the SafetyLevel. | 388 // An instruction is unsafe -- more information in the SafetyLevel. |
381 const char * const kProblemUnsafe = "kProblemUnsafe"; | 389 const char * const kProblemUnsafe = "kProblemUnsafe"; |
382 // A branch would break a pseudo-operation pattern. | 390 // A branch would break a pseudo-operation pattern. |
383 const char * const kProblemBranchSplitsPattern = "kProblemBranchSplitsPattern"; | 391 const char * const kProblemBranchSplitsPattern = "kProblemBranchSplitsPattern"; |
384 // A branch targets an invalid code address (out of segment). | 392 // A branch targets an invalid code address (out of segment). |
385 const char * const kProblemBranchInvalidDest = "kProblemBranchInvalidDest"; | 393 const char * const kProblemBranchInvalidDest = "kProblemBranchInvalidDest"; |
386 // A load/store uses an unsafe (non-masked) base address. | 394 // A load/store uses an unsafe (non-masked) base address. |
387 const char * const kProblemUnsafeLoadStore = "kProblemUnsafeLoadStore"; | 395 const char * const kProblemUnsafeLoadStore = "kProblemUnsafeLoadStore"; |
| 396 // A thread pointer load/store is unsafe. |
| 397 const char * const kProblemUnsafeLoadStoreThreadPointer = |
| 398 "kProblemUnsafeLoadStoreThreadPointer"; |
388 // An instruction updates a data-address register (e.g. SP) without masking. | 399 // An instruction updates a data-address register (e.g. SP) without masking. |
389 const char * const kProblemUnsafeDataWrite = "kProblemUnsafeDataWrite"; | 400 const char * const kProblemUnsafeDataWrite = "kProblemUnsafeDataWrite"; |
390 // An instruction updates a read-only register (e.g. t6, t7, t8). | 401 // An instruction updates a read-only register (e.g. t6, t7, t8). |
391 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister"; | 402 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister"; |
392 // A pseudo-op pattern crosses a bundle boundary. | 403 // A pseudo-op pattern crosses a bundle boundary. |
393 const char * const kProblemPatternCrossesBundle = | 404 const char * const kProblemPatternCrossesBundle = |
394 "kProblemPatternCrossesBundle"; | 405 "kProblemPatternCrossesBundle"; |
395 // A linking branch instruction is not in the last bundle slot. | 406 // A linking branch instruction is not in the last bundle slot. |
396 const char * const kProblemMisalignedCall = "kProblemMisalignedCall"; | 407 const char * const kProblemMisalignedCall = "kProblemMisalignedCall"; |
397 // A data register is found in a branch delay slot. | 408 // A data register is found in a branch delay slot. |
398 const char * const kProblemDataRegInDelaySlot = "kProblemDataRegInDelaySlot"; | 409 const char * const kProblemDataRegInDelaySlot = "kProblemDataRegInDelaySlot"; |
399 // A jump to trampoline instruction which is not a start of a bundle. | 410 // A jump to trampoline instruction which is not a start of a bundle. |
400 const char * const kProblemUnalignedJumpToTrampoline = | 411 const char * const kProblemUnalignedJumpToTrampoline = |
401 "kProblemUnalignedJumpToTrampoline"; | 412 "kProblemUnalignedJumpToTrampoline"; |
402 // A jump register instruction is not guarded. | 413 // A jump register instruction is not guarded. |
403 const char * const kProblemUnsafeJumpRegister = "kProblemUnsafeJumpRegister"; | 414 const char * const kProblemUnsafeJumpRegister = "kProblemUnsafeJumpRegister"; |
404 // Two consecutive branches/jumps. Branch/jump in the delay slot. | 415 // Two consecutive branches/jumps. Branch/jump in the delay slot. |
405 const char * const kProblemBranchInDelaySlot = "kProblemBranchInDelaySlot"; | 416 const char * const kProblemBranchInDelaySlot = "kProblemBranchInDelaySlot"; |
406 } // namespace nacl_mips_val | 417 } // namespace nacl_mips_val |
407 | 418 |
408 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H | 419 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_VALIDATOR_H |
OLD | NEW |