mirror of
https://github.com/wiiu-env/libkernel.git
synced 2024-11-22 12:49:19 +01:00
30 lines
942 B
C++
30 lines
942 B
C++
#include "kernel/kernel.h"
|
|
#include <coreinit/cache.h>
|
|
#include <coreinit/memorymap.h>
|
|
|
|
void KernelReadPTE(uint32_t outputAddr, int32_t length) {
|
|
auto dst = (uint32_t) OSEffectiveToPhysical(outputAddr);
|
|
uint32_t src = 0xFFE20000;
|
|
ICInvalidateRange(&dst, 4);
|
|
DCFlushRange(&dst, 4);
|
|
DCFlushRange(&src, 4);
|
|
KernelCopyData(dst, src, length);
|
|
DCFlushRange((void *) outputAddr, length);
|
|
ICInvalidateRange((void *) outputAddr, length);
|
|
}
|
|
|
|
void KernelWritePTE(uint32_t inputAddr, int32_t length) {
|
|
uint32_t dst = 0xFFE20000;
|
|
auto src = (uint32_t) OSEffectiveToPhysical(inputAddr);
|
|
ICInvalidateRange(&src, 4);
|
|
DCFlushRange(&src, 4);
|
|
KernelCopyData(dst, src, length);
|
|
}
|
|
|
|
void KernelNOPAtPhysicalAddress(uint32_t addr) {
|
|
uint32_t dst = 0x60000000;
|
|
ICInvalidateRange(&dst, 4);
|
|
DCFlushRange(&dst, 4);
|
|
KernelCopyData(addr, (uint32_t) OSEffectiveToPhysical((uint32_t) &dst), 4);
|
|
}
|