| 220 | } |
| 221 | |
| 222 | static inline void do_sdl(uint8_t* rdram, gpr offset, gpr reg, gpr val) { |
| 223 | // Calculate the overall address |
| 224 | gpr address = (offset + reg); |
| 225 | |
| 226 | // Get the initial value of the aligned dword |
| 227 | gpr dword_address = address & ~0x7; |
| 228 | uint64_t initial_value = load_doubleword(rdram, 0, dword_address); |
| 229 | |
| 230 | // Mask the initial value and shift the input value appropriately |
| 231 | gpr misalignment = address & 0x7; |
| 232 | uint64_t masked_initial_value = initial_value & ~(0xFFFFFFFFFFFFFFFFu >> (misalignment * 8)); |
| 233 | uint64_t shifted_input_value = val >> (misalignment * 8); |
| 234 | |
| 235 | uint64_t ret = masked_initial_value | shifted_input_value; |
| 236 | uint32_t lo = (uint32_t)ret; |
| 237 | uint32_t hi = (uint32_t)(ret >> 32); |
| 238 | |
| 239 | MEM_W(0, dword_address + 4) = lo; |
| 240 | MEM_W(0, dword_address + 0) = hi; |
| 241 | } |
| 242 | |
| 243 | static inline void do_sdr(uint8_t* rdram, gpr offset, gpr reg, gpr val) { |
| 244 | // Calculate the overall address |
nothing calls this directly
no test coverage detected