For reading/writing it would be useful to ask the Wii U whether the memory area chosen for the respective operation is "safe" to use or not. I wrote the following piece of code:
What does it do? It checks the memory range from start to end and in byte steps with the OSIsAddressValid() library function since we need to assure that every single address in-between is readable.
Is there a range version since I assume my implementation could be slightly slow for checking big ranges?
OSIsAddressRangeDCValid() is for the CPU data cache only. Alternatively I found syscall_get_map_virtual_address_range(), __OSValidateAddressSpaceRange() in coreinit.rpl.
Code:
int validateAddressRange(int starting_address, int ending_address) {
for (int current_address = starting_address; current_address <= ending_address; current_address++) {
int is_current_address_valid = OSIsAddressValid((void *) current_address);
if (!is_current_address_valid) {
return 0;
}
}
return 1;
}
Is there a range version since I assume my implementation could be slightly slow for checking big ranges?
OSIsAddressRangeDCValid() is for the CPU data cache only. Alternatively I found syscall_get_map_virtual_address_range(), __OSValidateAddressSpaceRange() in coreinit.rpl.