Skip to content

Commit

Permalink
Remove debug wraps
Browse files Browse the repository at this point in the history
Signed-off-by: Visual Ehrmanntraut <30368284+VisualEhrmanntraut@users.noreply.github.com>
  • Loading branch information
VisualEhrmanntraut committed Oct 3, 2023
1 parent add84c3 commit b2712f4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
20 changes: 0 additions & 20 deletions NootRX/HWLibs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ bool HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t sl
SolveRequestPlus solveRequest {"_CAILAsicCapsInitTable", orgCapsInitTable, kCAILAsicCapsInitTablePattern};
solveRequest.solve(patcher, id, slide, size);

if (checkKernelArgument("-CKUltraDebug")) {
RouteRequestPlus request {"_psp_cos_log", wrapPspCosLog, this->orgPspCosLog, kPspCosLogPattern};
PANIC_COND(!request.route(patcher, id, slide, size), "HWLibs", "Failed to route psp_cos_log");
}

if (NootRXMain::callback->chipType == ChipType::Navi22) {
RouteRequestPlus requests[] = {
{"_psp_cmd_km_submit", wrapPspCmdKmSubmit, this->orgPspCmdKmSubmit, kPspCmdKmSubmitPattern,
Expand Down Expand Up @@ -132,12 +127,6 @@ bool HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t sl
MachInfo::setKernelWriting(false, KernelPatcher::kernelWriteLock);
DBGLOG("HWLibs", "Applied DDI Caps patches");

if (checkKernelArgument("-CKUltraDebug")) {
const LookupPatchPlus patch {&kextRadeonX6810HWLibs, AtiPowerPlayServicesCOriginal,
AtiPowerPlayServicesCPatched, 1};
PANIC_COND(!patch.apply(patcher, slide, size), "HWLibs", "Failed to apply debug patch");
}

if (NootRXMain::callback->chipType == ChipType::Navi22) {
const LookupPatchPlus patches[] = {
{&kextRadeonX6810HWLibs, kGcSwInitOriginal, kGcSwInitOriginalMask, kGcSwInitPatched,
Expand Down Expand Up @@ -218,15 +207,6 @@ const char *HWLibs::wrapGetMatchProperty() {
return "Load6810";
}

void HWLibs::wrapPspCosLog(void *pspData, UInt32 param2, UInt64 param3, UInt32 param4, char *param5) {
if (param5) {
kprintf("AMD TTL COS: %s", param5);
auto len = strlen(param5);
if (len > 0 && param5[len - 1] != '\n') { kprintf("\n"); }
}
FunctionCast(wrapPspCosLog, callback->orgPspCosLog)(pspData, param2, param3, param4, param5);
}

CAILResult HWLibs::wrapPspCmdKmSubmit(void *psp, void *ctx, void *param3, void *param4) {
char filename[128] = {0};
auto &size = getMember<UInt32>(ctx, 0xC);
Expand Down
10 changes: 0 additions & 10 deletions NootRX/HWLibs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ class HWLibs {
bool processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t slide, size_t size);

private:
mach_vm_address_t orgPspCosLog {0};
mach_vm_address_t orgPspCmdKmSubmit {0};
mach_vm_address_t orgSmu1107SendMessageWithParameter {0};

static const char *wrapGetMatchProperty(void);
static void wrapPspCosLog(void *pspData, UInt32 param2, UInt64 param3, UInt32 param4, char *param5);
static CAILResult wrapPspCmdKmSubmit(void *psp, void *ctx, void *param3, void *param4);
static CAILResult wrapSmu1107SendMessageWithParameter(void *smum, UInt32 msgId, UInt32 param);
};
Expand All @@ -41,10 +39,6 @@ static const UInt8 kDeviceCapabilityTblPattern[] = {0x82, 0x00, 0x00, 0x00, 0x00
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xCA, 0xAD, 0xDE, 0x00, 0x00,
0x00, 0x00, 0xFE, 0xCA, 0xAD, 0xDE, 0x00, 0x00, 0x00, 0x00};

static const UInt8 kPspCosLogPattern[] = {0x55, 0x48, 0x89, 0xE5, 0x48, 0x83, 0xEC, 0x30, 0x31, 0xC0, 0x48, 0x89, 0x45,
0xF0, 0x48, 0x89, 0x45, 0xE8, 0x48, 0x89, 0x45, 0xE0, 0x48, 0x89, 0x45, 0xD8, 0x48, 0x89, 0x45, 0xD0, 0xC7, 0x45,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x7F, 0x10};

static const UInt8 kPspCmdKmSubmitPattern[] = {0x55, 0x48, 0x89, 0xE5, 0x41, 0x57, 0x41, 0x56, 0x41, 0x55, 0x41, 0x54,
0x53, 0x50, 0x49, 0x89, 0xCD, 0x49, 0x89, 0xD7, 0x49, 0x89, 0xF4, 0x48, 0x89, 0xFB, 0x48, 0x8D, 0x75, 0xD0, 0xC7,
0x06, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00};
Expand Down Expand Up @@ -101,10 +95,6 @@ static const UInt8 kSmu1107CheckFwVersionOriginalMask[] = {0xFF, 0xFF, 0xFF, 0xF
static const UInt8 kSmu1107CheckFwVersionPatched[] = {0x66, 0x90, 0x66, 0x90, 0x90, 0x00, 0x00};
static const UInt8 kSmu1107CheckFwVersionPatchedMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00};

//! Force allow all log levels.
static const UInt8 AtiPowerPlayServicesCOriginal[] = {0x8B, 0x40, 0x60, 0x48, 0x8D};
static const UInt8 AtiPowerPlayServicesCPatched[] = {0x6A, 0xFF, 0x58, 0x48, 0x8D};

//! Ventura cleaned up some code and removed support for SDMA 5.2.2, force 5.2.4 route.
static const UInt8 kSdmaInitFunctionPointerOriginal[] = {0x00, 0x00, 0x00, 0x41, 0x83, 0xFE, 0x04, 0x75, 0x00};
static const UInt8 kSdmaInitFunctionPointerOriginalMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00};
Expand Down

0 comments on commit b2712f4

Please sign in to comment.