Skip to content

Commit ff8b38a

Browse files
authored
Tried to fix rest mode.
Tried to fix rest mode, but it's not very effective.
1 parent f7dff05 commit ff8b38a

File tree

18 files changed

+112
-85
lines changed

18 files changed

+112
-85
lines changed

installer/include/offsets/1001.h

-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
#define ROOTVNODE_addr 0x01B25BD0
1111
#define PMAP_STORE_addr 0x02182D60
1212
#define DT_HASH_SEGMENT_addr 0x00CE6DC8
13-
#define M_TEMP_addr 0x00109C20
1413

1514
// Functions
1615
#define pmap_protect_addr 0x000E2420
1716
#define pmap_protect_p_addr 0x000E2467
18-
#define malloc_addr 0x00109A60
19-
#define printf_addr 0x000C50F0
2017

2118
// Patches
2219
// debug menu error

installer/include/offsets/1100.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#ifndef OFFSET1100_H
2-
#define OFFSET1100_H
1+
#ifndef __OFFSETS_H__
2+
#define __OFFSETS_H__
3+
#pragma once
34

5+
// 11.00
46
#define XFAST_SYSCALL_addr 0x000001C0
57

68
// Names - Data

installer/include/offsets/900.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// offset900.h
2-
#ifndef OFFSET900_H
3-
#define OFFSET900_H
1+
#ifndef __OFFSETS_H__
2+
#define __OFFSETS_H__
3+
#pragma once
44

5+
// 9.00
56
#define XFAST_SYSCALL_addr 0x000001C0
67

78
// Names - Data

installer/source/main.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern unsigned kpayload_size;
1111

1212
int install_payload(struct thread *td, struct install_payload_args* args)
1313
{
14-
14+
UNUSED(td);
1515
uint8_t* kernel_base = (uint8_t*)(__readmsr(0xC0000082) - XFAST_SYSCALL_addr);
1616

1717
void (*pmap_protect)(void * pmap, uint64_t sva, uint64_t eva, uint8_t pr) = (void *)(kernel_base + pmap_protect_addr);
@@ -118,6 +118,7 @@ static inline void patch_update(void)
118118

119119
int _main(struct thread *td)
120120
{
121+
UNUSED(td);
121122
int result;
122123

123124
initKernel();
@@ -141,12 +142,11 @@ int _main(struct thread *td)
141142
printf_debug("install_payload: %d\n", result);
142143

143144
patch_update();
144-
145145
initSysUtil();
146146

147147
char fw_version[6] = {0};
148148
get_firmware_string(fw_version);
149-
printf_notification("Welcome to PS4HEN v"VERSION"\nPS4 Firmware %s", fw_version);
149+
printf_notification("Welcome To OG HEN v"VERSION"\nPS4 Firmware %s", fw_version);
150150

151151
printf_debug("Done.\n");
152152

kpayload/include/freebsd_helper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ TYPE_BEGIN(struct proc, 0x800); // XXX: random, don't use directly without fixin
151151
TYPE_FIELD(int pid, 0xB0);
152152
TYPE_FIELD(struct vmspace *p_vmspace, 0x168);
153153
TYPE_FIELD(char p_comm[32], 0x454);
154-
TYPE_FIELD(char titleid[16], 0x390);
154+
TYPE_FIELD(char titleid[16], 0x390);
155155
TYPE_FIELD(char contentid[64], 0x3D4);
156156
TYPE_FIELD(char path[64], 0x474);
157157

kpayload/include/offsets/1000.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __OFFSETS_H__
33
#pragma once
44

5-
//10.00
5+
// 10.00
66
// data
77
#define XFAST_SYSCALL_addr 0x000001C0
88
#define M_TEMP_addr 0x01532C00

kpayload/include/offsets/1001.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __OFFSETS_H__
33
#pragma once
44

5-
//10.01
5+
// 10.01
66
// data
77
#define XFAST_SYSCALL_addr 0x000001C0
88
#define M_TEMP_addr 0x01532C00

kpayload/include/offsets/1050.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __OFFSETS_H__
33
#pragma once
44

5-
//10.50
5+
// 10.50
66
// data
77
#define XFAST_SYSCALL_addr 0x000001C0
88
#define M_TEMP_addr 0x01A5FE30
@@ -61,8 +61,6 @@
6161
#define vm_map_lookup_entry_addr 0x00476910
6262
#define proc_rwmem_addr 0x004244A0
6363

64-
#define printf_hook 0x01A7AE88
65-
6664
// Fself hooks
6765
#define sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook 0x0064117C
6866
#define sceSblAuthMgrIsLoadable2_hook 0x006412CE

kpayload/include/offsets/1070-1071.h

-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
#define vm_map_lookup_entry_addr 0x00476910
6262
#define proc_rwmem_addr 0x004244A0
6363

64-
#define printf_hook 0x01A7AE88
65-
6664
// Fself hooks
6765
#define sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook 0x0064117C
6866
#define sceSblAuthMgrIsLoadable2_hook 0x006412CE

kpayload/include/offsets/1100.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#ifndef OFFSET1100_H
2-
#define OFFSET1100_H
1+
#ifndef __OFFSETS_H__
2+
#define __OFFSETS_H__
3+
#pragma once
34

45
// 11.00
56
// data

kpayload/include/offsets/700-702.h

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __OFFSETS_H__
33
#pragma once
44

5+
// 7.00 - 7.02
56
// data 700-702
67
#define XFAST_SYSCALL_addr 0x000001C0
78
#define M_TEMP_addr 0x01A7AE50

kpayload/include/offsets/750-751.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#define __OFFSETS_H__
33
#pragma once
44

5-
// data 7.50-7.51
5+
// 7.50 - 7.51
6+
// data
67
#define XFAST_SYSCALL_addr 0x000001C0
78
#define M_TEMP_addr 0x01556DA0
89
#define MINI_SYSCORE_SELF_BINARY_addr 0x015A8FC8

kpayload/include/offsets/755.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef __OFFSETS_H__
22
#define __OFFSETS_H__
33
#pragma once
4-
// 7.55
54

5+
// 7.55
66
// data
77
#define XFAST_SYSCALL_addr 0x000001C0
88
#define M_TEMP_addr 0x01556DA0

kpayload/include/offsets/900.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef __OFFSETS_H__
22
#define __OFFSETS_H__
33
#pragma once
4-
// 9.00
54

5+
// 9.00
66
// data
77
#define XFAST_SYSCALL_addr 0x000001C0
88
#define M_TEMP_addr 0x015621E0

kpayload/source/fpkg.c

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern int (*fpu_kern_enter)(struct thread *td, struct fpu_kern_ctx *ctx, uint32
1717
extern int (*fpu_kern_leave)(struct thread *td, struct fpu_kern_ctx *ctx) PAYLOAD_BSS;
1818
extern void* (*memcpy)(void* dst, const void* src, size_t len) PAYLOAD_BSS;
1919
extern void* (*memset)(void *s, int c, size_t n) PAYLOAD_BSS;
20-
extern int (*printf)(const char *fmt, ...) PAYLOAD_BSS;
2120

2221
extern struct sbl_map_list_entry** SBL_DRIVER_MAPPED_PAGES PAYLOAD_BSS;
2322
extern struct sx* SBL_PFS_SX PAYLOAD_BSS;

kpayload/source/fself.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ extern void* (*malloc)(unsigned long size, void* type, int flags) PAYLOAD_BSS;
1616
extern void (*free)(void* addr, void* type) PAYLOAD_BSS;
1717
extern char * (*strstr) (const char *haystack, const char *needle) PAYLOAD_BSS;
1818
extern void* (*memcpy)(void* dst, const void* src, size_t len) PAYLOAD_BSS;
19-
extern int (*printf)(const char *fmt, ...) PAYLOAD_BSS;
2019
extern size_t (*strlen)(const char *str) PAYLOAD_BSS;
2120

2221
extern void* M_TEMP PAYLOAD_BSS;
@@ -287,8 +286,11 @@ PAYLOAD_CODE int my_sceSblAuthMgrVerifyHeader(struct self_context* ctx)
287286

288287
PAYLOAD_CODE int my_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox(unsigned long service_id, uint8_t* request, void* response)
289288
{
289+
#pragma GCC diagnostic push
290+
#pragma GCC diagnostic ignored "-Wframe-address"
290291
// self_context is first param of caller. 0x08 = sizeof(struct self_context*)
291292
uint8_t* frame = (uint8_t*)__builtin_frame_address(1);
293+
#pragma GCC diagnostic pop
292294
struct self_context* ctx = *(struct self_context**)(frame - 0x08);
293295

294296
int is_unsigned = ctx && is_fake_self(ctx);
@@ -302,8 +304,11 @@ PAYLOAD_CODE int my_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox(unsigne
302304

303305
PAYLOAD_CODE int my_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox(unsigned long service_id, uint8_t* request, void* response)
304306
{
307+
#pragma GCC diagnostic push
308+
#pragma GCC diagnostic ignored "-Wframe-address"
305309
// self_context is first param of caller. 0x08 = sizeof(struct self_context*)
306310
uint8_t* frame = (uint8_t*)__builtin_frame_address(1);
311+
#pragma GCC diagnostic pop
307312
struct self_context* ctx = *(struct self_context**)(frame - 0x08);
308313

309314
vm_offset_t segment_data_gpu_va = *(unsigned long*)(request + 0x08);

kpayload/source/main.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void* (*memcpy)(void* dst, const void* src, size_t len) PAYLOAD_BSS;
2525
void* (*memset)(void *s, int c, size_t n) PAYLOAD_BSS;
2626
size_t (*strlen)(const char *str) PAYLOAD_BSS;
2727
int (*printf)(const char *fmt, ...) PAYLOAD_BSS;
28-
void (*eventhandler_register)(void *list, const char *name, void *func, void *key, void *arg, int priority) PAYLOAD_BSS; // 5.5x-6.72
28+
void (*eventhandler_register)(void *list, const char *name, void *func, void *arg, int priority) PAYLOAD_BSS;
2929

3030
void* M_TEMP PAYLOAD_BSS;
3131
uint8_t* MINI_SYSCORE_SELF_BINARY PAYLOAD_BSS;
@@ -84,9 +84,11 @@ extern void install_fpkg_hooks(void) PAYLOAD_CODE;
8484
extern void install_patches(void) PAYLOAD_CODE;
8585
extern void install_fake_signout_patch(void) PAYLOAD_CODE;
8686
extern void install_syscall_hooks(void) PAYLOAD_CODE;
87-
extern int shellcore_fpkg_patch(void) PAYLOAD_CODE;
87+
extern void shellcore_patch(void) PAYLOAD_CODE;
88+
8889

8990
#define resolve(name) name = (void *)(kernbase + name##_addr)
91+
9092
PAYLOAD_CODE void resolve_kdlsym()
9193
{
9294
uint64_t kernbase = getkernbase();
@@ -102,7 +104,7 @@ PAYLOAD_CODE void resolve_kdlsym()
102104
resolve(SBL_KEYMGR_BUF_VA);
103105
resolve(SBL_KEYMGR_BUF_GVA);
104106
resolve(FPU_CTX);
105-
resolve(SYSENT);
107+
resolve(SYSENT);
106108

107109
// common
108110
resolve(memcmp);
@@ -148,14 +150,14 @@ PAYLOAD_CODE void resolve_kdlsym()
148150
resolve(vm_map_lookup_entry);
149151
}
150152

151-
PAYLOAD_CODE int my_entrypoint()
153+
PAYLOAD_CODE void my_entrypoint()
152154
{
153155
resolve_kdlsym();
154156
install_fself_hooks();
155157
install_fpkg_hooks();
156158
install_patches();
157-
install_syscall_hooks();
158-
return shellcore_fpkg_patch();
159+
install_syscall_hooks();
160+
shellcore_patch();
159161
}
160162

161163
struct {

0 commit comments

Comments
 (0)