1313#include <ps4/kernel.h>
1414#include <ps4/kern.h>
1515#include <ps4/payload.h>
16+ #include <ps4/machine.h>
1617
1718#include <float.h>
1819
@@ -71,6 +72,24 @@ void printHook(Ps4KernelFunctionHook *h)
7172 printf ("-> %p\n" , hook [i ]);
7273}
7374
75+ int hookMachineInstructionNext (void * base , size_t * next )
76+ {
77+ void * m = malloc (128 );
78+ ps4KernelMemoryCopy (base , m , 128 );
79+ int r = ps4MachineInstructionSeek (m , next );
80+ free (m );
81+ return r ;
82+ }
83+
84+ int hookMachineInstructionSeek (void * base , size_t * offset )
85+ {
86+ void * m = malloc (128 );
87+ ps4KernelMemoryCopy (base , m , 128 );
88+ int r = ps4MachineInstructionSeek (m , offset );
89+ free (m );
90+ return r ;
91+ }
92+
7493int main (int argc , char * * argv )
7594{
7695 void * a = ps4KernelDlSym ("sceSblACMgrIsJitApplicationProcess" );
@@ -94,8 +113,8 @@ int main(int argc, char **argv)
94113 // will not be needed and the call below (to hook) does
95114 // will not require a size argument.
96115 s = 12 ;
97- r = ps4KernelMachineInstructionSeek (a , & s );
98- printf ("ps4KernelMachineInstructionSeek : %i %zu\n" , r , s );
116+ r = hookMachineInstructionSeek (a , & s );
117+ printf ("hookMachineInstructionSeek : %i %zu\n" , r , s );
99118
100119 r = ps4KernelFunctionIsHooked (a );
101120 printf ("ps4KernelFunctionIsHooked: %i %p\n" , r , a );
0 commit comments