Add support for KernelReadPTE, KernelWritePTE, KernelNOPAtPhysicalAddress

This commit is contained in:
Maschell 2020-05-29 19:26:01 +02:00
parent 64038d55ec
commit 15e71afb9e
2 changed files with 38 additions and 0 deletions

View File

@ -5,8 +5,15 @@ extern "C"
{ {
#endif #endif
#include <cstdint>
extern void KernelCopyData(uint32_t dst, uint32_t src, uint32_t len); extern void KernelCopyData(uint32_t dst, uint32_t src, uint32_t len);
void KernelReadPTE(uint32_t outputAddr, int32_t length);
void KernelWritePTE(uint32_t inputAddr, int32_t length);
void KernelNOPAtPhysicalAddress(uint32_t addr);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

31
source/utils.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <cstdint>
#include <coreinit/cache.h>
#include <coreinit/memorymap.h>
#include "kernel/kernel.h"
void KernelReadPTE(uint32_t outputAddr, int32_t length) {
uint32_t 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;
uint32_t 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);
}