Skip to content

Conversation

@mitchellwaite
Copy link

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:

image

// 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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@InvoxiPlayGames works fine in both the emulator and on real hardware. I've made the change.

image

@InvoxiPlayGames InvoxiPlayGames merged commit d950aee into Free60Project:master Dec 4, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants