Skip to content

Commit

Permalink
5.05 update
Browse files Browse the repository at this point in the history
* adds rest mode support, SiSTRo brought this up.

Co-Authored-By: SiSTRo <sistr0@users.noreply.github.com>
  • Loading branch information
ChendoChap and SiSTR0 committed Apr 22, 2019
1 parent 87904b9 commit 0393c85
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@
- RPC server
- RPC client in C#

I use the standard fake pkg keys, created by flatz.

### General Notes
**Only for 5.05 Jailbroken PlayStation 4 consoles!**

The main jkpatch payload utilizes a port of CTurt's payload sdk. Change the [Makefile](payload/Makefile) to have `LIBPS4` point to the ps4-payload-sdk directory on your machine. I could have it referenced from the home directory but meh...
```makefile
# change this to point to your ps4-payload-sdk directory
LIBPS4 := /home/John/ps4-payload-sdk/libPS4
```
The main jkpatch payload utilizes [a port of CTurt's payload sdk](https://github.com/xvortex/ps4-hen-vtx).

If you decide to edit the `resolve` code in the kernel payload, make sure you do not mess with...
```c
Expand Down
1 change: 1 addition & 0 deletions kpayload/include/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define __vm_map_lock 0x19EFF0
#define __vm_map_unlock 0x19F060
#define __proc_rwmem 0x30D150
#define __eventhandler_register 0x1EC400

//net.c
#define __sys_socket 0x318EE0
Expand Down
1 change: 1 addition & 0 deletions kpayload/include/resolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int (*fpu_kern_leave)(struct thread *td, void *ctx);
void (*kern_reboot)(int magic);
int (*fill_regs)(struct thread *td, struct reg *rg);
int (*set_regs)(struct thread *td, struct reg *rg);
void (*eventhandler_register)(void *list, const char *name, void *func, void *arg, int priority);

// virtual memory
struct vmspace *(*vmspace_acquire_ref)(struct proc *p);
Expand Down
1 change: 1 addition & 0 deletions kpayload/source/resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ void resolve(uint64_t kernbase) {
r(vmspace_acquire_ref, __vmspace_acquire_ref);
r(fill_regs, __fill_regs);
r(set_regs, __set_regs);
r(eventhandler_register, __eventhandler_register);
}
23 changes: 21 additions & 2 deletions kpayload/source/rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "rpc.h"

struct proc *krpcproc;
int suspend_flag = 0;

int rpc_proc_load(struct proc *p, uint64_t address) {
void *rpcldraddr = NULL;
Expand Down Expand Up @@ -1060,7 +1061,9 @@ void rpc_handler(void *vfd) {

while (1) {
kthread_suspend_check();

if(suspend_flag) {
break;
}
pause("rpchandler", 15);

// wait to recv packets
Expand Down Expand Up @@ -1169,7 +1172,9 @@ void rpc_server_thread(void *arg) {

while (1) {
kthread_suspend_check();

if(suspend_flag) {
break;
}
// accept connection
newfd = net_accept(fd, NULL, NULL);

Expand Down Expand Up @@ -1198,10 +1203,24 @@ void rpc_server_thread(void *arg) {
kthread_exit();
}

void suspend_rpc() {
suspend_flag = 1;
uprintf("[jkpatch] suspending rpc server!");
}

void resume_rpc() {
suspend_flag = 0;
kproc_create(rpc_server_thread, NULL, &krpcproc, NULL, 0, "rpcproc");
uprintf("[jkpatch] restarted rpc server!");
}

void init_rpc() {
net_disable_copy_checks();

kproc_create(rpc_server_thread, NULL, &krpcproc, NULL, 0, "rpcproc");

uprintf("[jkpatch] started rpc server!");

eventhandler_register(NULL, "system_suspend_phase1", &suspend_rpc, NULL, 10000);
eventhandler_register(NULL, "system_resume_phase1", &resume_rpc, NULL, 10000);
}

0 comments on commit 0393c85

Please sign in to comment.