Add function to query the system RAM size#60
Conversation
| // 0xE1040000 is the host bridge register where HWINIT stores a little endian uint32 | ||
| // representing the amount of memory (in bytes) installed on the system. CB_B looks | ||
| // here to determine whether or not to throw panic 0xAF (UNSUPPORTED_RAM_SIZE) | ||
| memcpy(&hostRegisterE104, (const void*)(0x80000200E1040000ULL), sizeof(hostRegisterE104)); |
There was a problem hiding this comment.
Is there a reason it's done like this with a memcpy as opposed to e.g.
unsigned int xenon_get_ram_size()
{
return __builtin_bswap32(*(unsigned int *)(0xE1040000));
}The upper 32-bits of the address should be ignored since libxenon runs in 32-bit mode with the PCI address space mapped at 0xE0000000 (https://github.com/Free60Project/libxenon/blob/master/libxenon/drivers/ppc/vm.c#L31), and assuming the controller is fine with regular 32-bit reads this should be better and cleaner than a memcpy.
There was a problem hiding this comment.
No reason in particular, I will test it with just the lower 32 bits of the address and if it's working as expected, I will commit the change and tag you again.
There was a problem hiding this comment.
@InvoxiPlayGames works fine in both the emulator and on real hardware. I've made the change.
HWINIT stores a little endian u32 in the host bridge register at 0xE1040000 representing the amount of RAM installed on the system. This PR adds a function to xb360.c to return that value in a big-endian format we can actually use.
I use it in my fork of XeLL, it correctly reports RAM sizes other than 512mb: