99#include <sys/syscall.h>
1010
1111#include <ps4/kernel.h>
12+ #include <ps4/internal/asmpayload.h>
1213
1314#include "kmain.h"
1415
@@ -17,23 +18,24 @@ int main(int argc, char **argv)
1718 int kargc = 1 ;
1819 char * kargv [2 ];
1920 char * moo = malloc (32 ); // A moo!! :D
21+ int i ;
2022
2123 kargv [0 ] = moo ;
2224 kargv [1 ] = NULL ;
2325
2426 printf ("uid: %zu\n" , getuid ());
25- // this syscall turns to return 0 after the first ps4KernelExecute
26- // do not call it directly - use the patching ps4KernelExecute
27- printf ("sys: %i\n" , syscall (SYS_ps4_kernel_execute , NULL ));
27+ // this syscall returns 0 after the first ps4KernelRun (see in a rerun process)
28+ // do not use this directly (just for show and tell here)
29+ // use the self-patching ps4KernelRun wrapper instead
30+ printf ("sys: %i\n" , syscall (SYS_ps4_kernel_run , NULL ));
2831
2932 strcpy (moo , "Hmm ... ? *yum, grass*" );
3033 int r = ps4KernelRun (kmain , kargc , kargv );
31- printf ("return: %i\n" , r );
34+ printf ("return (sceSblACMgrIsVideoplayerProcess) : %i\n" , r );
3235 printf ("moo: %s\n" , moo );
33- free (moo ); //Bye moo :(
3436
3537 printf ("uid: %zu\n" , getuid ());
36- printf ("sys: %i\n" , syscall (SYS_ps4_kernel_execute , NULL ));
38+ printf ("sys: %i\n" , syscall (SYS_ps4_kernel_run , NULL ));
3739
3840 printf ("ps4KernelIsInKernel(): %i\n" , ps4KernelIsInKernel ());
3941 printf ("ps4KernelDlSym(kernel_map): %p\n" , ps4KernelDlSym ("kernel_map" ));
@@ -42,5 +44,33 @@ int main(int argc, char **argv)
4244 ps4KernelEscalatePrivileges ();
4345 printf ("uid: %zu\n" , getuid ());
4446
47+ //ps4KernelUARTEnable();
48+
49+ // and some patching
50+ memset (moo , '\0' , 32 );
51+ void * sceSblACMgrIsVideoplayerProcess = ps4KernelDlSym ("sceSblACMgrIsVideoplayerProcess" );
52+ ps4KernelMemcpy (moo , sceSblACMgrIsVideoplayerProcess , 32 );
53+ for (i = 0 ; i < 32 ; ++ i )
54+ printf ("%02X" , ((unsigned char * )moo )[i ]);
55+ printf ("\n" );
56+
57+ r = ps4KernelRun (kmain2 , kargc , kargv );
58+ printf ("return2 (sceSblACMgrIsVideoplayerProcess): %i\n" , r );
59+
60+ ps4KernelMemcpy (moo , sceSblACMgrIsVideoplayerProcess , 32 );
61+ for (i = 0 ; i < 32 ; ++ i )
62+ printf ("%02X" , ((unsigned char * )moo )[i ]);
63+ printf ("\n" );
64+
65+ r = ps4KernelRun (kmain3 , kargc , kargv );
66+ printf ("return3 (sceSblACMgrIsVideoplayerProcess): %i\n" , r );
67+
68+ ps4KernelMemcpy (moo , sceSblACMgrIsVideoplayerProcess , 32 );
69+ for (i = 0 ; i < 32 ; ++ i )
70+ printf ("%02X" , ((unsigned char * )moo )[i ]);
71+ printf ("\n" );
72+
73+ free (moo ); //Bye moo, you did real good :(~
74+
4575 return EXIT_SUCCESS ;
4676}
0 commit comments