mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-04-02 23:29:52 +00:00
platinum: cleanup non-DWORD register reads.
This commit is contained in:
parent
2d68b72dbd
commit
54ce23d0a8
@ -88,4 +88,9 @@ inline void set_bit(T &val, const int bit_num) {
|
||||
val |= ((T)1 << bit_num);
|
||||
}
|
||||
|
||||
static inline uint32_t extract_with_wrap_around(uint32_t val, int pos, int size) {
|
||||
return (uint32_t)((((uint64_t)val << 32) | val) >> ((8 - (pos & 3) - size) << 3)) &
|
||||
((1LL << (size << 3)) - 1);
|
||||
}
|
||||
|
||||
#endif // BIT_OPS_H
|
||||
|
@ -101,6 +101,8 @@ int PlatinumCtrl::device_postinit() {
|
||||
}
|
||||
|
||||
uint32_t PlatinumCtrl::read(uint32_t rgn_start, uint32_t offset, int size) {
|
||||
uint32_t value;
|
||||
|
||||
if (rgn_start == VRAM_REGION_BASE) {
|
||||
if (offset < this->vram_size) {
|
||||
// HACK: half bank configurations should return invalid data
|
||||
@ -117,8 +119,6 @@ uint32_t PlatinumCtrl::read(uint32_t rgn_start, uint32_t offset, int size) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t value;
|
||||
|
||||
switch (offset >> 4) {
|
||||
case PlatinumReg::CPU_ID:
|
||||
value = this->cpu_id;
|
||||
@ -195,9 +195,10 @@ uint32_t PlatinumCtrl::read(uint32_t rgn_start, uint32_t offset, int size) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
uint32_t result = (uint32_t)( (((uint64_t)value << 32) | value) >> ((8 - (offset & 3) - size) << 3)) & ( (1LL << (size << 3)) - 1 );
|
||||
|
||||
return result;
|
||||
if (size == 4)
|
||||
return value;
|
||||
else
|
||||
return extract_with_wrap_around(value, offset, size);
|
||||
}
|
||||
|
||||
void PlatinumCtrl::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user