MMIO: Fix a megaderp in the UniqueID function causing handlers to be overwritten by other handlers.

This commit is contained in:
Pierre Bourdon 2014-02-23 08:34:05 +01:00
parent b8582b00a9
commit c06c8f0ec8

View File

@ -32,7 +32,7 @@ const u32 BLOCK_SIZE = 0x10000;
const u32 NUM_MMIOS = NUM_BLOCKS * BLOCK_SIZE;
// Compute the internal unique ID for a given MMIO address. This ID is computed
// from a very simple formula: (1 + block_id) * lower_16_bits(address).
// from a very simple formula: (block_id << 16) | lower_16_bits(address).
//
// The block ID can easily be computed by simply checking bit 24 (CC vs. CD).
inline u32 UniqueID(u32 address)
@ -42,7 +42,7 @@ inline u32 UniqueID(u32 address)
((address & 0xFFFF0000) == 0xCD800000),
"Trying to get the ID of a non-existing MMIO address.");
return (1 + ((address >> 24) & 1)) * (address & 0xFFFF);
return (((address >> 24) & 1) << 16) | (address & 0xFFFF);
}
// Some utilities functions to define MMIO mappings.