Reads 32-bit data form the memory address. @param VmPtr A pointer to VM context. @param Addr The memory address. @return The 32-bit value from the memory address. **/
| 5229 | |
| 5230 | **/ |
| 5231 | UINT32 |
| 5232 | VmReadMem32 ( |
| 5233 | IN VM_CONTEXT *VmPtr, |
| 5234 | IN UINTN Addr |
| 5235 | ) |
| 5236 | { |
| 5237 | UINT32 Data; |
| 5238 | |
| 5239 | // |
| 5240 | // Convert the address if it's in the stack gap |
| 5241 | // |
| 5242 | Addr = ConvertStackAddr (VmPtr, Addr); |
| 5243 | // |
| 5244 | // Read direct if aligned |
| 5245 | // |
| 5246 | if (IS_ALIGNED (Addr, sizeof (UINT32))) { |
| 5247 | return * (UINT32 *) Addr; |
| 5248 | } |
| 5249 | // |
| 5250 | // Return unaligned data |
| 5251 | // |
| 5252 | Data = (UINT32) VmReadMem16 (VmPtr, Addr); |
| 5253 | Data |= (VmReadMem16 (VmPtr, Addr + 2) << 16); |
| 5254 | return Data; |
| 5255 | } |
| 5256 | |
| 5257 | /** |
| 5258 | Reads 64-bit data form the memory address. |
no test coverage detected