| 241 | } |
| 242 | |
| 243 | static inline void do_sdr(uint8_t* rdram, gpr offset, gpr reg, gpr val) { |
| 244 | // Calculate the overall address |
| 245 | gpr address = (offset + reg); |
| 246 | |
| 247 | // Get the initial value of the aligned dword |
| 248 | gpr dword_address = address & ~0x7; |
| 249 | uint64_t initial_value = load_doubleword(rdram, 0, dword_address); |
| 250 | |
| 251 | // Mask the initial value and shift the input value appropriately |
| 252 | gpr misalignment = address & 0x7; |
| 253 | uint64_t masked_initial_value = initial_value & ~(0xFFFFFFFFFFFFFFFFu << (56 - misalignment * 8)); |
| 254 | uint64_t shifted_input_value = val << (56 - misalignment * 8); |
| 255 | |
| 256 | uint64_t ret = masked_initial_value | shifted_input_value; |
| 257 | uint32_t lo = (uint32_t)ret; |
| 258 | uint32_t hi = (uint32_t)(ret >> 32); |
| 259 | |
| 260 | MEM_W(0, dword_address + 4) = lo; |
| 261 | MEM_W(0, dword_address + 0) = hi; |
| 262 | } |
| 263 | |
| 264 | static inline uint32_t get_cop1_cs() { |
| 265 | uint32_t rounding_mode = 0; |
nothing calls this directly
no test coverage detected