Kernel

The PS4 kernel is based on FreeBSD 9.1 with some additions from the later version. This mean the PS4 system is Unix-like.

Functions

This is a list of functions that was defined in the PS4 kernel. All offset here is an offset in the memory, not a file offset.

acquire_per_file_info_obj

This function populate a fileinfo field on the obj parameter. It will never be invoked on a non-dynamic SELF.

Parameters

  1. imgp: A pointer to image_params.
  2. obj: A pointer to Obj_Entry.

Returns

  • i32: zero on success or errno in case of error.

Locations

VersionOffset
9.00x0021A680

fast_syscall

This is an entry point of syscall instruction. It is almost identical to the FreeBSD version. It use standard System V AMD64 ABI for kernel interface the same as Linux, except rax is an actual errno in case of error (not a negative errno like Linux). The rax and rdx is also used for storing the return value. The CF on rFLAGS will be set if rax is an errno. In this case the rax will never be a zero.

Locations

VersionOffset
9.00x000001C0

Variables

This is a list of global variables in the PS4 kernel. All offset here are an offset in the memory, not a file offset.

proc0

proc0 is a proc structure represents the kernel process.

Locations

VersionOffset
9.00x01B90E00

Data Types

This is a list of data types that are using in the PS4 kernel.

proc

proc represents a single process in the system, including the kernel itself. This struct mostly the same as FreeBSD version with some PS4 specific.

9.0TypeNameDescription
0x010thread *p_threads_first
0x018thread **p_threads_last
0x020mtxp_slock
0x040ucred *p_ucred
0x0A0sigacts *p_sigacts
0x0A8i32p_flag
0x0B0i32p_pid
0x0D8proc *p_pptr
0x0F8mtxp_mtx
0x118ksiginfo *p_ksi
0x120sigqueuep_sigqueue
0x168vmspace *p_vmspace
0x2B8vnode *p_textvp
0x2D4i32p_sig
0x300thread *p_singlethread
0x308i32p_suspcount
0x310thread *p_xthread
0x330char *unk3
0x340rtld *p_dynlib
0x384u32unk40x02 = ET_SCE_REPLAY_EXEC
0x450i32p_osrel
0x454char[32]p_comm
0x474char[1024]basename
0x880sysentvec *p_sysent
0x888pargs *p_args
0x8ACchar[?]p_randomized_path
0x9ACu16p_xstat
0x9B0knlistp_klist
0x9E0i32p_numthreads
0xA38u16p_acflag
0xA78mqueue_notifier *p_mqnotifier
0xA80kdtrace_proc *p_dtrace
0xA88cvp_pwait
0xA98cvp_dbgwait
0xAF4i32unk1Seems like image type?
0xB10char[28]unk2Seems like a struct.
0xB40u32sdk_version

self_auth_info

This struct contains authorization information. The PS4 rely on this struct to determine what actions can be done for each thread. The PS4 obtained this struct from application image through the SAMU. Some examples of this structs can be found here.

9.0TypeNameDescription
0x00u64paidProgram Authority ID
0x08u64[4]capsBit flags indicated what permissions are allowed.
0x28u64[4]attrs
0x48u8[64]

thread

thread represents a single thread in a process. This struct mostly the same as FreeBSD version with some PS4 specific.

9.0TypeNameDescription
0x008proc *td_procThe process of this thread.
0x088i32td_tidThread ID.
0x090sigqueuetd_sigqueuePending signals.
0x0D4i32td_flags
0x0D8i32td_inhibitors
0x0DCi32td_pflags
0x0E8void *td_wchan
0x130ucred *td_ucred
0x220u32td_pticks
0x270i32td_xsig
0x284char[32]td_name
0x2A8file *td_fpop
0x2B0i32td_dbgflags
0x388pcb *td_pcb
0x390i32td_state
0x398i64[2]td_retvalrax and rdx to return from current syscall.
0x3A8callouttd_slpcallout
0x3E0trapframe *td_frameUser space CPU states.
0x438i32td_errno