Skip to content

Commit 2d35296

Browse files
committed
Cleared the cache for trampoline[0] in patch.h
1 parent 9d2ab1e commit 2d35296

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ttyd-tools/rel/include/patch.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <ttyd/OSCache.h>
4+
35
#include <cstdint>
46

57
namespace mod::patch {
@@ -12,8 +14,12 @@ Func hookFunction(Func function, Dest destination)
1214
uint32_t *instructions = reinterpret_cast<uint32_t *>(function);
1315

1416
uint32_t *trampoline = new uint32_t[2];
17+
1518
// Original instruction
1619
trampoline[0] = instructions[0];
20+
ttyd::OSCache::DCFlushRange(&trampoline[0], sizeof(uint32_t));
21+
ttyd::OSCache::ICInvalidateRange(&trampoline[0], sizeof(uint32_t));
22+
1723
// Branch to original function past hook
1824
writeBranch(&trampoline[1], &instructions[1]);
1925

0 commit comments

Comments
 (0)