| 90 | } |
| 91 | |
| 92 | bool Decoder::CheckRangeExecutable(uint64_t Address, uint64_t Size) { |
| 93 | // Treat FEX-internal X86 callbacks as always executable |
| 94 | if (EntryPoint == CTX->X86CodeGen.CallbackReturn) { |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | while (Address < ExecutableRangeBase || Address + Size > ExecutableRangeEnd) { |
| 99 | auto RangeInfo = CTX->SyscallHandler->QueryGuestExecutableRange(Thread, Address); |
| 100 | ExecutableRangeBase = RangeInfo.Base; |
| 101 | ExecutableRangeEnd = RangeInfo.Base + RangeInfo.Size; |
| 102 | ExecutableRangeWritable = RangeInfo.Writable; |
| 103 | |
| 104 | if (RangeInfo.Size == 0) { |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | uint64_t RangeRemainingSize = ExecutableRangeEnd - Address; |
| 109 | if (Size > RangeRemainingSize) { |
| 110 | Size -= RangeRemainingSize; |
| 111 | Address += RangeRemainingSize; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | return true; |
| 116 | } |
| 117 | |
| 118 | uint8_t Decoder::ReadByte() { |
| 119 | LOGMAN_THROW_A_FMT(InstructionSize < MAX_INST_SIZE, "Max instruction size exceeded!"); |
nothing calls this directly
no test coverage detected