Execute the EBC CMP instruction. Instruction syntax: CMP[32|64][eq|lte|gte|ulte|ugte] R1, {@}R2 {Index16|Immed16} @param VmPtr A pointer to a VM context. @retval EFI_UNSUPPORTED The opcodes/operands is not supported. @retval EFI_SUCCESS The instruction is executed successfully. **/
| 3164 | |
| 3165 | **/ |
| 3166 | EFI_STATUS |
| 3167 | ExecuteCMP ( |
| 3168 | IN VM_CONTEXT *VmPtr |
| 3169 | ) |
| 3170 | { |
| 3171 | UINT8 Opcode; |
| 3172 | UINT8 Operands; |
| 3173 | UINT8 Size; |
| 3174 | INT16 Index16; |
| 3175 | UINT32 Flag; |
| 3176 | INT64 Op2; |
| 3177 | INT64 Op1; |
| 3178 | |
| 3179 | // |
| 3180 | // Get opcode and operands |
| 3181 | // |
| 3182 | Opcode = GETOPCODE (VmPtr); |
| 3183 | Operands = GETOPERANDS (VmPtr); |
| 3184 | // |
| 3185 | // Get the register data we're going to compare to |
| 3186 | // |
| 3187 | Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)]; |
| 3188 | // |
| 3189 | // Get immediate data |
| 3190 | // |
| 3191 | if ((Opcode & OPCODE_M_IMMDATA) != 0) { |
| 3192 | if (OPERAND2_INDIRECT (Operands)) { |
| 3193 | Index16 = VmReadIndex16 (VmPtr, 2); |
| 3194 | } else { |
| 3195 | Index16 = VmReadImmed16 (VmPtr, 2); |
| 3196 | } |
| 3197 | |
| 3198 | Size = 4; |
| 3199 | } else { |
| 3200 | Index16 = 0; |
| 3201 | Size = 2; |
| 3202 | } |
| 3203 | // |
| 3204 | // Now get Op2 |
| 3205 | // |
| 3206 | if (OPERAND2_INDIRECT (Operands)) { |
| 3207 | if ((Opcode & OPCODE_M_64BIT) != 0) { |
| 3208 | Op2 = (INT64) VmReadMem64 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16)); |
| 3209 | } else { |
| 3210 | // |
| 3211 | // 32-bit operations. 0-extend the values for all cases. |
| 3212 | // |
| 3213 | Op2 = (INT64) (UINT64) ((UINT32) VmReadMem32 (VmPtr, (UINTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16))); |
| 3214 | } |
| 3215 | } else { |
| 3216 | Op2 = VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index16; |
| 3217 | } |
| 3218 | // |
| 3219 | // Now do the compare |
| 3220 | // |
| 3221 | Flag = 0; |
| 3222 | if ((Opcode & OPCODE_M_64BIT) != 0) { |
| 3223 | // |
nothing calls this directly
no test coverage detected