code:
#pragma once
#include <Boot/Config.hpp>

// Offsets initially ported by SocraticBliss, and zecoxao, redone by kozarovv

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_474
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x0030F8A0
#define kdlsym_addr__mtx_lock_sleep                        0x0030F910
#define kdlsym_addr__mtx_lock_spin_flags                   0x0030FC70
#define kdlsym_addr__mtx_unlock_flags                      0x0030FB40
#define kdlsym_addr__mtx_unlock_sleep                      0x0030FC10
#define kdlsym_addr__mtx_unlock_spin_flags                 0x0030FE30
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x00629880
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x00625410
#define kdlsym_addr__sx_init_flags                         0x00390720
#define kdlsym_addr__sx_slock                              0x003907A0
#define kdlsym_addr__sx_sunlock                            0x00390920
#define kdlsym_addr__sx_xlock                              0x00390850
#define kdlsym_addr__sx_xunlock                            0x003909E0
#define kdlsym_addr__thread_lock_flags                     0x0030FF70
#define kdlsym_addr__vm_map_lock_read                      0x00392ED0
#define kdlsym_addr__vm_map_unlock_read                    0x00392F20
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x00179950
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x00179720
#define kdlsym_addr_allproc                                0x01ADF718
#define kdlsym_addr_allproc_lock                           0x01ADF6B8
#define kdlsym_addr_avcontrol_sleep                        0x006C8560
#define kdlsym_addr_cloneuio                               0x0003FA00
#define kdlsym_addr_console_cdev                           0x01A74B08
#define kdlsym_addr_console_write                          0x0002FC10
#define kdlsym_addr_contigfree                             0x00252AA0
#define kdlsym_addr_contigmalloc                           0x00252740
#define kdlsym_addr_copyin                                 0x00149F20
#define kdlsym_addr_copyinstr                              0x0014A390
#define kdlsym_addr_copyout                                0x00149E40
#define kdlsym_addr_critical_enter                         0x0023F9E0
#define kdlsym_addr_critical_exit                          0x0023F9F0
#define kdlsym_addr_deci_tty_write                         0x00475CD0
#define kdlsym_addr_destroy_dev                            0x0036F8F0
//#define kdlsym_addr_dmem_start_app_process                 0x0
#define kdlsym_addr_dynlib_do_dlsym                        0x00066000
#define kdlsym_addr_dynlib_find_obj_by_handle              0x000670B0
#define kdlsym_addr_eventhandler_deregister                0x003CAA10
#define kdlsym_addr_eventhandler_find_list                 0x003CAC00
#define kdlsym_addr_eventhandler_register                  0x003CA6A0
#define kdlsym_addr_exec_new_vmspace                       0x002EAA50
#define kdlsym_addr_faultin                                0x00311010
#define kdlsym_addr_fget_unlocked                          0x0042DFD0
#define kdlsym_addr_fpu_kern_ctx                           0x02549700
#define kdlsym_addr_fpu_kern_enter                         0x00058B60
#define kdlsym_addr_fpu_kern_leave                         0x00058C60
#define kdlsym_addr_free                                   0x003F87A0
#define kdlsym_addr_gdt                                    0x01B65AD0
#define kdlsym_addr_gpu_va_page_list                       0x02525DD0
#define kdlsym_addr_icc_nvs_read                           0x0001B850
#define kdlsym_addr_kern_close                             0x0042BA80
#define kdlsym_addr_kern_ioctl                             0x0005F000
#define kdlsym_addr_kern_mkdirat                           0x00445CD0
#define kdlsym_addr_kern_open                              0x00440B70
#define kdlsym_addr_kern_openat                            0x00440BD0
#define kdlsym_addr_kern_readv                             0x0005E310
#define kdlsym_addr_kern_reboot                            0x00098EE0
#define kdlsym_addr_kern_sysents                           0x01034790
#define kdlsym_addr_kern_thr_create                        0x002EEED0
#define kdlsym_addr_kernel_map                             0x01B39218
#define kdlsym_addr_kernel_mount                           0x000DC820
#define kdlsym_addr_killproc                               0x00025810
#define kdlsym_addr_kmem_alloc                             0x0016DF30
#define kdlsym_addr_kmem_free                              0x0016E100
#define kdlsym_addr_kproc_create                           0x00465590
#define kdlsym_addr_kproc_exit                             0x00465810
#define kdlsym_addr_kthread_add                            0x00465B20
#define kdlsym_addr_kthread_exit                           0x00465DF0
#define kdlsym_addr_M_IOV                                  0x0144C7F0
#define kdlsym_addr_M_LINKER                               0x01452320
#define kdlsym_addr_M_MOUNT                                0x014572A0
#define kdlsym_addr_M_TEMP                                 0x0199BB80
#define kdlsym_addr_make_dev_p                             0x0036F3C0
#define kdlsym_addr_malloc                                 0x003F85C0
#define kdlsym_addr_memcmp                                 0x00244EE0
#define kdlsym_addr_memcpy                                 0x00149D40
#define kdlsym_addr_memmove                                0x002F0940
#define kdlsym_addr_memset                                 0x00304DD0
#define kdlsym_addr_mini_syscore_self_binary               0x01479558
#define kdlsym_addr_mount_arg                              0x000DC5A0
#define kdlsym_addr_mount_argb                             0x000DAB40
#define kdlsym_addr_mount_argf                             0x000DC680
#define kdlsym_addr_mtx_destroy                            0x00310330
#define kdlsym_addr_mtx_init                               0x003102C0
#define kdlsym_addr_mtx_lock_sleep                         0x0030F910
#define kdlsym_addr_mtx_unlock_sleep                       0x0030FC10
#define kdlsym_addr_name_to_nids                           0x00068D10
#define kdlsym_addr_pause                                  0x002635A0
#define kdlsym_addr_pfind                                  0x00078DC0
#define kdlsym_addr_pmap_activate                          0x004283A0
#define kdlsym_addr_printf                                 0x00017F30
#define kdlsym_addr_prison0                                0x01042AB0
#define kdlsym_addr_proc0                                  0x01B37C00
#define kdlsym_addr_proc_reparent                          0x0015BA50
#define kdlsym_addr_proc_rwmem                             0x0017BDD0
#define kdlsym_addr_realloc                                0x003F88D0
#define kdlsym_addr_rootvnode                              0x021B89E0
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x003F0070
#define kdlsym_addr_sbl_eap_internal_partition_key         0x0259CCD0
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x02548800
#define kdlsym_addr_sbl_keymgr_buf_va                      0x02548000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x02544DE0
#define kdlsym_addr_sbl_keymgr_key_slots                   0x02544DD0
#define kdlsym_addr_sbl_pfs_sx                             0x02529310
#define kdlsym_addr_sbl_drv_msg_mtx                        0x02525DD8
#define kdlsym_addr_sceSblACMgrGetPathId                   0x00169840
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x00629040
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x00626640
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x006290A0
#define kdlsym_addr_sceSblDriverSendMsg                    0x00603CA0
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x0060C6E0
#define kdlsym_addr_sceSblKeymgrClearKey                   0x00610D80
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x006109E0
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x006093D0
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x00611530
#define kdlsym_addr_sceSblPfsSetKeys                       0x006095E0
#define kdlsym_addr_sceSblRngGetRandomNumber               0x0062CCB0
#define kdlsym_addr_sceSblServiceMailbox                   0x00617AB0
#define kdlsym_addr_self_orbis_sysvec                      0x01468700
#define kdlsym_addr_Sha256Hmac                             0x002D7E00
#define kdlsym_addr_snprintf                               0x00018230
#define kdlsym_addr_spinlock_exit                          0x00284A80
#define kdlsym_addr_sprintf                                0x00018160
#define kdlsym_addr_sscanf                                 0x00304300
#define kdlsym_addr_strcmp                                 0x001DD150
#define kdlsym_addr_strdup                                 0x004538A0
#define kdlsym_addr_strlen                                 0x00353720
#define kdlsym_addr_strncmp                                0x003DC520
#define kdlsym_addr_strstr                                 0x00263B90
#define kdlsym_addr_sys_accept                             0x003ECD30
#define kdlsym_addr_sys_bind                               0x003EC3C0
#define kdlsym_addr_sys_close                              0x0042BA70
#define kdlsym_addr_sys_dup2                               0x00429CC0
#define kdlsym_addr_sys_fstat                              0x0042C020
#define kdlsym_addr_sys_getdents                           0x00446470
#define kdlsym_addr_sys_kill                               0x000232A0
#define kdlsym_addr_sys_listen                             0x003EC5D0
#define kdlsym_addr_sys_lseek                              0x00442B90
#define kdlsym_addr_sys_mkdir                              0x00445C50
#define kdlsym_addr_sys_mlock                              0x001420D0
#define kdlsym_addr_sys_mlockall                           0x00142180
#define kdlsym_addr_sys_mmap                               0x00141080
#define kdlsym_addr_sys_munmap                             0x00141820
#define kdlsym_addr_sys_nmount                             0x000D91A0
#define kdlsym_addr_sys_open                               0x00440B50
#define kdlsym_addr_sys_ptrace                             0x0017C260
#define kdlsym_addr_sys_read                               0x0005E230
#define kdlsym_addr_sys_recvfrom                           0x003EDEF0
#define kdlsym_addr_sys_rmdir                              0x00445FD0
#define kdlsym_addr_sys_sendto                             0x003ED830
#define kdlsym_addr_sys_setuid                             0x00113AE0
#define kdlsym_addr_sys_shutdown                           0x003EE0C0
#define kdlsym_addr_sys_socket                             0x003EBA90
#define kdlsym_addr_sys_stat                               0x00443190
#define kdlsym_addr_sys_unlink                             0x004425A0
#define kdlsym_addr_sys_unmount                            0x000DAB60
#define kdlsym_addr_sys_wait4                              0x0015BB90
#define kdlsym_addr_sys_write                              0x0005E780
#define kdlsym_addr_trap_fatal                             0x003DCBD0
#define kdlsym_addr_utilUSleep                             0x006626A0
#define kdlsym_addr_vm_fault_disable_pagefaults            0x002A3BA0
#define kdlsym_addr_vm_fault_enable_pagefaults             0x002A3BD0
#define kdlsym_addr_vm_map_lookup_entry                    0x00393A90
#define kdlsym_addr_vmspace_acquire_ref                    0x00392D00
#define kdlsym_addr_vmspace_alloc                          0x00392890
#define kdlsym_addr_vmspace_free                           0x00392B30
#define kdlsym_addr_vn_fullpath                            0x002FD7B0
#define kdlsym_addr_vsnprintf                              0x000182D0
#define kdlsym_addr_wakeup                                 0x002635C0
#define kdlsym_addr_Xfast_syscall                          0x0030B7D0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x019A3E18

// FakeSelf hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x006224EC
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x0062263F
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x00626CAA
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x006278D1
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x00622D66
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x00623989

// FakePkg hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x00609475
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x00611C0D
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x006312F0
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x006320CE
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x0069AFE4
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x0069B214

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x004D9430
#define kdlsym_addr_sceRegMgrSetInt                        0x004D8580
#define kdlsym_addr_sceRegMgrGetBin                        0x004D9D90
#define kdlsym_addr_sceRegMgrSetBin                        0x004D9CC0
#define kdlsym_addr_sceRegMgrGetStr                        0x004D9BA0
#define kdlsym_addr_sceRegMgrSetStr                        0x004D97F0

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x0014BC6B
#define ssc_sceKernelIsGenuineCEX_patchB                   0x006F3C5B
#define ssc_sceKernelIsGenuineCEX_patchC                   0x007278D3
#define ssc_sceKernelIsGenuineCEX_patchD                   0x0086168B

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x0014BC97
#define ssc_nidf_libSceDipsw_patchB                        0x001FEAA8
#define ssc_nidf_libSceDipsw_patchC                        0x006F3C87
#define ssc_nidf_libSceDipsw_patchD                        0x008616B7

#define ssc_enable_fakepkg_patch                           0x00385032

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00D50208

// SceShellCore patches - enable remote pkg installer
#define ssc_enable_data_mount_patch                        0x002D055C

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr_patch                                0x00B3CDC0

// SceShellCore patches - enable official external HDD support (Support added in 4.50)
#define ssc_external_hdd_pkg_installer_patch               0x00853241
#define ssc_external_hdd_version_patchA                    0x0050951D
#define ssc_external_hdd_version_patchB                    0x001213A1

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001A130
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001A430

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x00197030
#define ssu_remote_play_menu_patch                         0x01299AF7

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003C882
#define srp_enabler_patchB                                 0x0003C89D

#endif


code:
#pragma once
#include <Boot/Config.hpp>

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_501
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x00401900
#define kdlsym_addr__mtx_lock_sleep                        0x004019A0
#define kdlsym_addr__mtx_lock_spin_flags                   0x00401D30
#define kdlsym_addr__mtx_unlock_flags                      0x00401BD0
#define kdlsym_addr__mtx_unlock_sleep                      0x00401CD0
#define kdlsym_addr__mtx_unlock_spin_flags                 0x00401EF0
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x0063C960
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x00641500
#define kdlsym_addr__sx_init_flags                         0x000F5AA0
#define kdlsym_addr__sx_slock                              0x000F5B20
#define kdlsym_addr__sx_sunlock                            0x000F5E00
#define kdlsym_addr__sx_xlock                              0x000F5D00
#define kdlsym_addr__sx_xunlock                            0x000F5EC0
#define kdlsym_addr__thread_lock_flags                     0x00402050
#define kdlsym_addr__vm_map_lock_read                      0x0019F030
#define kdlsym_addr__vm_map_unlock_read                    0x0019F080
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x003A2A30
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x003A2800
#define kdlsym_addr_allproc                                0x02382FF8
#define kdlsym_addr_allproc_lock                           0x02382F98
#define kdlsym_addr_avcontrol_sleep                        0x006EABD0
#define kdlsym_addr_cloneuio                               0x002A8010
#define kdlsym_addr_console_cdev                           0x01AC5158
#define kdlsym_addr_console_write                          0x000ECB40
#define kdlsym_addr_contigfree                             0x000F1EE0
#define kdlsym_addr_contigmalloc                           0x000F1B10
#define kdlsym_addr_copyin                                 0x001EA600
#define kdlsym_addr_copyinstr                              0x001EAA30
#define kdlsym_addr_copyout                                0x001EA520
#define kdlsym_addr_critical_enter                         0x0028E4D0
#define kdlsym_addr_critical_exit                          0x0028E4E0
#define kdlsym_addr_deci_tty_write                         0x0049CB20
#define kdlsym_addr_destroy_dev                            0x001B9C40
#define kdlsym_addr_dmem_start_app_process                 0x002468E0
#define kdlsym_addr_dynlib_do_dlsym                        0x002AF7B0
#define kdlsym_addr_dynlib_find_obj_by_handle              0x002B0B40
#define kdlsym_addr_eventhandler_deregister                0x001EC680
#define kdlsym_addr_eventhandler_find_list                 0x001EC870
#define kdlsym_addr_eventhandler_register                  0x001EC2F0
#define kdlsym_addr_exec_new_vmspace                       0x0038A940
#define kdlsym_addr_faultin                                0x00006DD0
#define kdlsym_addr_fget_unlocked                          0x000C3530
#define kdlsym_addr_fpu_kern_ctx                           0x0274C040
#define kdlsym_addr_fpu_kern_enter                         0x001BFE80
#define kdlsym_addr_fpu_kern_leave                         0x001BFF80
#define kdlsym_addr_free                                   0x0010E350
#define kdlsym_addr_gdt                                    0x01CB90F0
#define kdlsym_addr_gpu_va_page_list                       0x0271E208
#define kdlsym_addr_icc_nvs_read                           0x00395460
#define kdlsym_addr_kern_close                             0x000C0F40
#define kdlsym_addr_kern_ioctl                             0x00153880
#define kdlsym_addr_kern_mkdirat                           0x00340800
#define kdlsym_addr_kern_open                              0x0072AB50
#define kdlsym_addr_kern_openat                            0x0033B640
#define kdlsym_addr_kern_readv                             0x00152A10
#define kdlsym_addr_kern_reboot                            0x0010D280
#define kdlsym_addr_kern_sysents                           0x0107C610
#define kdlsym_addr_kern_thr_create                        0x001BE0E0
#define kdlsym_addr_kernel_map                             0x01AC60E0
#define kdlsym_addr_kernel_mount                           0x001E1810
#define kdlsym_addr_killproc                               0x000D4240
#define kdlsym_addr_kmem_alloc                             0x000FCB70
#define kdlsym_addr_kmem_free                              0x000FCD40
#define kdlsym_addr_kproc_create                           0x00137CE0
#define kdlsym_addr_kproc_exit                             0x00137F50
#define kdlsym_addr_kthread_add                            0x00138250
#define kdlsym_addr_kthread_exit                           0x00138530
#define kdlsym_addr_M_IOV                                  0x014B5E80
#define kdlsym_addr_M_LINKER                               0x019F2E10
#define kdlsym_addr_M_MOUNT                                0x019BF300
#define kdlsym_addr_M_TEMP                                 0x014B4110
#define kdlsym_addr_make_dev_p                             0x001B9700
#define kdlsym_addr_malloc                                 0x0010E140
#define kdlsym_addr_memcmp                                 0x00050AC0
#define kdlsym_addr_memcpy                                 0x001EA420
#define kdlsym_addr_memmove                                0x00073BA0
#define kdlsym_addr_memset                                 0x003201F0
#define kdlsym_addr_mini_syscore_self_binary               0x014C9D48
#define kdlsym_addr_mount_arg                              0x001E1590
#define kdlsym_addr_mount_argb                             0x001DFB40
#define kdlsym_addr_mount_argf                             0x001E1670
#define kdlsym_addr_mtx_destroy                            0x00402420
#define kdlsym_addr_mtx_init                               0x004023B0
#define kdlsym_addr_mtx_lock_sleep                         0x004019a0
#define kdlsym_addr_mtx_unlock_sleep                       0x00401bd0
#define kdlsym_addr_name_to_nids                           0x002AFA90
#define kdlsym_addr_pause                                  0x003FB550
#define kdlsym_addr_pfind                                  0x00403110
#define kdlsym_addr_pmap_activate                          0x002EAC40
#define kdlsym_addr_printf                                 0x00435C70
#define kdlsym_addr_prison0                                0x010986A0
#define kdlsym_addr_proc0                                  0x01AA4600
#define kdlsym_addr_proc_reparent                          0x00035330
#define kdlsym_addr_proc_rwmem                             0x0030CDC0
#define kdlsym_addr_realloc                                0x0010E480
#define kdlsym_addr_rootvnode                              0x022C19F0
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x001FD6C0
#define kdlsym_addr_sbl_eap_internal_partition_key         0x02790C90
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x02748800
#define kdlsym_addr_sbl_keymgr_buf_va                      0x02748000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x02744558
#define kdlsym_addr_sbl_keymgr_key_slots                   0x02744548
#define kdlsym_addr_sbl_pfs_sx                             0x0271E5D8
#define kdlsym_addr_sbl_drv_msg_mtx                        0x0271E210
#define kdlsym_addr_sceSblACMgrGetPathId                   0x000117E0
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x0063C110
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x00642760
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x0063C170
#define kdlsym_addr_sceSblDriverSendMsg                    0x0061D410
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x00625300
#define kdlsym_addr_sceSblKeymgrClearKey                   0x0062D730
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x0062D3A0
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x00623BE0
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x0062DEC0
#define kdlsym_addr_sceSblPfsSetKeys                       0x0061EBC0
#define kdlsym_addr_sceSblRngGetRandomNumber               0x00647670
#define kdlsym_addr_sceSblServiceMailbox                   0x00632160
#define kdlsym_addr_self_orbis_sysvec                      0x019BBCD0
#define kdlsym_addr_Sha256Hmac                             0x002D52E0
#define kdlsym_addr_snprintf                               0x00435F80
#define kdlsym_addr_spinlock_exit                          0x002349A0
#define kdlsym_addr_sprintf                                0x00435EB0
#define kdlsym_addr_sscanf                                 0x001757F0
#define kdlsym_addr_strcmp                                 0x001D0EC0
#define kdlsym_addr_strdup                                 0x001C1B20
#define kdlsym_addr_strlen                                 0x003B6DD0
#define kdlsym_addr_strncmp                                0x001B8ED0
#define kdlsym_addr_strstr                                 0x0017DEA0
#define kdlsym_addr_sys_accept                             0x00319DA0
#define kdlsym_addr_sys_bind                               0x00319450
#define kdlsym_addr_sys_close                              0x000C0F30
#define kdlsym_addr_sys_dup2                               0x000BF0D0
#define kdlsym_addr_sys_fstat                              0x000C14B0
#define kdlsym_addr_sys_getdents                           0x00340FC0
#define kdlsym_addr_sys_kill                               0x000D1A50
#define kdlsym_addr_sys_listen                             0x00319690
#define kdlsym_addr_sys_lseek                              0x0033D620
#define kdlsym_addr_sys_mkdir                              0x00340780
#define kdlsym_addr_sys_mlock                              0x0013E140
#define kdlsym_addr_sys_mlockall                           0x0013E1F0
#define kdlsym_addr_sys_mmap                               0x0013D120
#define kdlsym_addr_sys_munmap                             0x0013D890
#define kdlsym_addr_sys_nmount                             0x001DE1D0
#define kdlsym_addr_sys_open                               0x0033B5C0
#define kdlsym_addr_sys_ptrace                             0x0030D250
#define kdlsym_addr_sys_read                               0x001529A0
#define kdlsym_addr_sys_recvfrom                           0x0031B090
#define kdlsym_addr_sys_rmdir                              0x00340B00
#define kdlsym_addr_sys_sendto                             0x0031A940
#define kdlsym_addr_sys_setuid                             0x00054950
#define kdlsym_addr_sys_shutdown                           0x0031B2D0
#define kdlsym_addr_sys_socket                             0x00318B10
#define kdlsym_addr_sys_stat                               0x0033DC10
#define kdlsym_addr_sys_unlink                             0x0033D000
#define kdlsym_addr_sys_unmount                            0x001DFB60
#define kdlsym_addr_sys_wait4                              0x00035470
#define kdlsym_addr_sys_write                              0x00152EB0
#define kdlsym_addr_trap_fatal                             0x00171470
#define kdlsym_addr_utilUSleep                             0x00658850
#define kdlsym_addr_vm_fault_disable_pagefaults            0x002A6950
#define kdlsym_addr_vm_fault_enable_pagefaults             0x002A6C50
#define kdlsym_addr_vm_map_lookup_entry                    0x0019F650
#define kdlsym_addr_vmspace_acquire_ref                    0x0019EE80
#define kdlsym_addr_vmspace_alloc                          0x0019EA10
#define kdlsym_addr_vmspace_free                           0x0019ECB0
#define kdlsym_addr_vn_fullpath                            0x000A1220
#define kdlsym_addr_vsnprintf                              0x00436020
#define kdlsym_addr_wakeup                                 0x003FB570
#define kdlsym_addr_Xfast_syscall                          0x000001C0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x019FC168

// FakeSelf hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x0063DE7D
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x0063DFC1
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x00642DAB
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x006439C2
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x0063E71C
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x0063F338

// FakePkg hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x00623C85
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x0062E58D
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x0064C340
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x0064D11F
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x006AA6F5
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x006AA924

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x004F9A80
#define kdlsym_addr_sceRegMgrSetInt                        0x004F8940
#define kdlsym_addr_sceRegMgrGetBin                        0x004FA300
#define kdlsym_addr_sceRegMgrSetBin                        0x004FA250
#define kdlsym_addr_sceRegMgrGetStr                        0x004FA180
#define kdlsym_addr_sceRegMgrSetStr                        0x004F9FC0

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x0016D05B
#define ssc_sceKernelIsGenuineCEX_patchB                   0x0079941B
#define ssc_sceKernelIsGenuineCEX_patchC                   0x007E5623
#define ssc_sceKernelIsGenuineCEX_patchD                   0x00946D5B

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x0016D087
#define ssc_nidf_libSceDipsw_patchB                        0x0023747B
#define ssc_nidf_libSceDipsw_patchC                        0x00799447
#define ssc_nidf_libSceDipsw_patchD                        0x00946D87

#define ssc_enable_fakepkg_patch                           0x003E0602

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00EA7A47

// SceShellCore patches - enable remote pkg installer
#define ssc_enable_data_mount_patch                        0x00319A53

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr_patch                                0x00C788D0

// SceShellCore patches - enable official external HDD support (Support added in 4.50)
#define ssc_external_hdd_pkg_installer_patch               0x00930D81
#define ssc_external_hdd_version_patchA                    0x005937DD
#define ssc_external_hdd_version_patchB                    0x00130A71

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001BD90
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001C090

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x001A8C50
#define ssu_remote_play_menu_patch                         0x00EE606E

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003C33F
#define srp_enabler_patchB                                 0x0003C35A

#endif

repo_name: veiledmerc/mira

license: mit


code:
#pragma once
#include <Boot/Config.hpp>

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_503
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x00401C90
#define kdlsym_addr__mtx_lock_sleep                        0x00401D30
#define kdlsym_addr__mtx_lock_spin_flags                   0x004020C0
#define kdlsym_addr__mtx_unlock_flags                      0x00401F60
#define kdlsym_addr__mtx_unlock_sleep                      0x00402060
#define kdlsym_addr__mtx_unlock_spin_flags                 0x00402280
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x0063CD00
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x006418A0
#define kdlsym_addr__sx_init_flags                         0x000F5BB0
#define kdlsym_addr__sx_slock                              0x000F5C30
#define kdlsym_addr__sx_sunlock                            0x000F5F10
#define kdlsym_addr__sx_xlock                              0x000F5E10
#define kdlsym_addr__sx_xunlock                            0x000F5FD0
#define kdlsym_addr__thread_lock_flags                     0x004023E0
#define kdlsym_addr__vm_map_lock_read                      0x0019F140
#define kdlsym_addr__vm_map_unlock_read                    0x0019F190
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x003A2DC0
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x003A2B90
#define kdlsym_addr_allproc                                0x02382FF8
#define kdlsym_addr_allproc_lock                           0x02382F98
#define kdlsym_addr_avcontrol_sleep                        0x006EAF70
#define kdlsym_addr_cloneuio                               0x002A82E0
#define kdlsym_addr_console_cdev                           0x01AC5158
#define kdlsym_addr_console_write                          0x000ECAC0
#define kdlsym_addr_contigfree                             0x000F1FF0
#define kdlsym_addr_contigmalloc                           0x000F1C20
#define kdlsym_addr_copyin                                 0x001EA710
#define kdlsym_addr_copyinstr                              0x001EAB40
#define kdlsym_addr_copyout                                0x001EA630
#define kdlsym_addr_critical_enter                         0x0028E7A0
#define kdlsym_addr_critical_exit                          0x0028E7B0
#define kdlsym_addr_deci_tty_write                         0x0049CEB0
#define kdlsym_addr_destroy_dev                            0x001B9D50
#define kdlsym_addr_dmem_start_app_process                 0x002469F0
#define kdlsym_addr_dynlib_do_dlsym                        0x002AFA80
#define kdlsym_addr_dynlib_find_obj_by_handle              0x002B0E10
#define kdlsym_addr_eventhandler_deregister                0x001EC790
#define kdlsym_addr_eventhandler_find_list                 0x001EC980
#define kdlsym_addr_eventhandler_register                  0x001EC400
#define kdlsym_addr_exec_new_vmspace                       0x0038ACD0
#define kdlsym_addr_faultin                                0x00006DD0
#define kdlsym_addr_fget_unlocked                          0x000C34B0
#define kdlsym_addr_fpu_kern_ctx                           0x0274C040
#define kdlsym_addr_fpu_kern_enter                         0x001BFF90
#define kdlsym_addr_fpu_kern_leave                         0x001C0090
#define kdlsym_addr_free                                   0x0010E460
#define kdlsym_addr_gdt                                    0x01CB90F0
#define kdlsym_addr_gpu_va_page_list                       0x0271E208
#define kdlsym_addr_icc_nvs_read                           0x003957F0
#define kdlsym_addr_kern_close                             0x000C0EC0
#define kdlsym_addr_kern_ioctl                             0x00153990
#define kdlsym_addr_kern_mkdirat                           0x00340B90
#define kdlsym_addr_kern_open                              0x0033B970
#define kdlsym_addr_kern_openat                            0x0033B9D0
#define kdlsym_addr_kern_readv                             0x00153248
#define kdlsym_addr_kern_reboot                            0x0010D390
#define kdlsym_addr_kern_sysents                           0x0107C610
#define kdlsym_addr_kern_thr_create                        0x001BE1F0
#define kdlsym_addr_kernel_map                             0x01AC60E0
#define kdlsym_addr_kernel_mount                           0x001E1920
#define kdlsym_addr_killproc                               0x000D41C0
#define kdlsym_addr_kmem_alloc                             0x000FCC80
#define kdlsym_addr_kmem_free                              0x000FCE50
#define kdlsym_addr_kproc_create                           0x00137DF0
#define kdlsym_addr_kproc_exit                             0x00138060
#define kdlsym_addr_kthread_add                            0x00138360
#define kdlsym_addr_kthread_exit                           0x00138640
#define kdlsym_addr_M_IOV                                  0x014B5E80
#define kdlsym_addr_M_LINKER                               0x019F2E10
#define kdlsym_addr_M_MOUNT                                0x019BF300
#define kdlsym_addr_M_TEMP                                 0x014B4110
#define kdlsym_addr_make_dev_p                             0x001B9810
#define kdlsym_addr_malloc                                 0x0010E250
#define kdlsym_addr_memcmp                                 0x00050AC0
#define kdlsym_addr_memcpy                                 0x001EA530
#define kdlsym_addr_memmove                                0x00073BA0
#define kdlsym_addr_memset                                 0x00320580
#define kdlsym_addr_mini_syscore_self_binary               0x014C9D48
#define kdlsym_addr_mount_arg                              0x001E16A0
#define kdlsym_addr_mount_argb                             0x001DFC50
#define kdlsym_addr_mount_argf                             0x001E1780
#define kdlsym_addr_mtx_destroy                            0x004027B0
#define kdlsym_addr_mtx_init                               0x00402740
#define kdlsym_addr_mtx_lock_sleep                         0x00401D30
#define kdlsym_addr_mtx_unlock_sleep                       0x00402060
#define kdlsym_addr_name_to_nids                           0x002AFD60
#define kdlsym_addr_pause                                  0x003FB8E0
#define kdlsym_addr_pfind                                  0x004034A0
#define kdlsym_addr_pmap_activate                          0x002EAFD0
#define kdlsym_addr_printf                                 0x00436000
#define kdlsym_addr_prison0                                0x010986A0
#define kdlsym_addr_proc0                                  0x01AA4600
#define kdlsym_addr_proc_reparent                          0x00035330
#define kdlsym_addr_proc_rwmem                             0x0030D150
#define kdlsym_addr_realloc                                0x0010E590
#define kdlsym_addr_rootvnode                              0x022C1A70
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x001FD7D0
#define kdlsym_addr_sbl_eap_internal_partition_key         0x02790C90
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x02748800
#define kdlsym_addr_sbl_keymgr_buf_va                      0x02748000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x02744558
#define kdlsym_addr_sbl_keymgr_key_slots                   0x02744548
#define kdlsym_addr_sbl_pfs_sx                             0x0271E5D8
#define kdlsym_addr_sbl_drv_msg_mtx                        0x0271E210
#define kdlsym_addr_sceSblACMgrGetPathId                   0x000117E0
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x0063C4B0
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x00642B00
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x0063C510
#define kdlsym_addr_sceSblDriverSendMsg                    0x0061D7B0
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x006256A0
#define kdlsym_addr_sceSblKeymgrClearKey                   0x0062DAD0
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x0062D740
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x00623F80
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x0062E260
#define kdlsym_addr_sceSblPfsSetKeys                       0x0061EF60
#define kdlsym_addr_sceSblRngGetRandomNumber               0x00647A10
#define kdlsym_addr_sceSblServiceMailbox                   0x00632500
#define kdlsym_addr_self_orbis_sysvec                      0x019BBCD0
#define kdlsym_addr_Sha256Hmac                             0x002D55B0
#define kdlsym_addr_snprintf                               0x00436310
#define kdlsym_addr_spinlock_exit                          0x00234AB0
#define kdlsym_addr_sprintf                                0x00436240
#define kdlsym_addr_sscanf                                 0x00175900
#define kdlsym_addr_strcmp                                 0x001D0FD0
#define kdlsym_addr_strdup                                 0x001C1C30
#define kdlsym_addr_strlen                                 0x003B7160
#define kdlsym_addr_strncmp                                0x001B8FE0
#define kdlsym_addr_strstr                                 0x0017DFB0
#define kdlsym_addr_sys_accept                             0x0031A130
#define kdlsym_addr_sys_bind                               0x003197E0
#define kdlsym_addr_sys_close                              0x000C0EB0
#define kdlsym_addr_sys_dup2                               0x000BF050
#define kdlsym_addr_sys_fstat                              0x000C1430
#define kdlsym_addr_sys_getdents                           0x00341350
#define kdlsym_addr_sys_kill                               0x000D19D0
#define kdlsym_addr_sys_listen                             0x00319A20
#define kdlsym_addr_sys_lseek                              0x0033D9B0
#define kdlsym_addr_sys_mkdir                              0x00340B10
#define kdlsym_addr_sys_mlock                              0x0013E250
#define kdlsym_addr_sys_mlockall                           0x0013E300
#define kdlsym_addr_sys_mmap                               0x0013D230
#define kdlsym_addr_sys_munmap                             0x0013D9A0
#define kdlsym_addr_sys_nmount                             0x001DE2E0
#define kdlsym_addr_sys_open                               0x0033B950
#define kdlsym_addr_sys_ptrace                             0x0030D5E0
#define kdlsym_addr_sys_read                               0x00152AB0
#define kdlsym_addr_sys_recvfrom                           0x0031B420
#define kdlsym_addr_sys_rmdir                              0x00340E90
#define kdlsym_addr_sys_sendto                             0x0031ACD0
#define kdlsym_addr_sys_setuid                             0x00054950
#define kdlsym_addr_sys_shutdown                           0x0031B660
#define kdlsym_addr_sys_socket                             0x00318EA0
#define kdlsym_addr_sys_stat                               0x0033DFA0
#define kdlsym_addr_sys_unlink                             0x0033D390
#define kdlsym_addr_sys_unmount                            0x001DFC70
#define kdlsym_addr_sys_wait4                              0x00035470
#define kdlsym_addr_sys_write                              0x00152FC0
#define kdlsym_addr_trap_fatal                             0x00171580
#define kdlsym_addr_utilUSleep                             0x00658BF0
#define kdlsym_addr_vm_fault_disable_pagefaults            0x002A6C20
#define kdlsym_addr_vm_fault_enable_pagefaults             0x002A6C50
#define kdlsym_addr_vm_map_lookup_entry                    0x0019F760
#define kdlsym_addr_vmspace_acquire_ref                    0x0019EF90
#define kdlsym_addr_vmspace_alloc                          0x0019EB20
#define kdlsym_addr_vmspace_free                           0x0019EDC0
#define kdlsym_addr_vn_fullpath                            0x000A11A0
#define kdlsym_addr_vsnprintf                              0x004363B0
#define kdlsym_addr_wakeup                                 0x003FB940
#define kdlsym_addr_Xfast_syscall                          0x000001C0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x019FC168

// FakeSelf hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x0063E21D
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x0063E361
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x0064314B
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x00643D62
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x0063EABC
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x0063F6D8

// FakePkg hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x00624025
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x0062E92D
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x0064C6E0
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x0064D4BF
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x006AAA95
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x006AACC4

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x004F9E10
#define kdlsym_addr_sceRegMgrSetInt                        0x004F8CD0
#define kdlsym_addr_sceRegMgrGetBin                        0x004FA690
#define kdlsym_addr_sceRegMgrSetBin                        0x004FA5E0
#define kdlsym_addr_sceRegMgrGetStr                        0x004FA510
#define kdlsym_addr_sceRegMgrSetStr                        0x004FA350

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x0016D05B
#define ssc_sceKernelIsGenuineCEX_patchB                   0x0079980B
#define ssc_sceKernelIsGenuineCEX_patchC                   0x007E5A13
#define ssc_sceKernelIsGenuineCEX_patchD                   0x0094715B

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x0016D087
#define ssc_nidf_libSceDipsw_patchB                        0x0023747B
#define ssc_nidf_libSceDipsw_patchC                        0x00799837
#define ssc_nidf_libSceDipsw_patchD                        0x00947187

#define ssc_enable_fakepkg_patch                           0x003E0602

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00EA9667

// SceShellCore patches - enable remote pkg installer
#define ssc_enable_data_mount_patch                        0x00319A53

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr_patch                                0x00C79170

// SceShellCore patches - enable official external HDD support (Support added in 4.50)
#define ssc_external_hdd_pkg_installer_patch               0x009312A1
#define ssc_external_hdd_version_patchA                    0x00593C7D
#define ssc_external_hdd_version_patchB                    0x00130A71

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001BD90
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001C090

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x001A8FA0
#define ssu_remote_play_menu_patch                         0x00EE638E

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003C33F
#define srp_enabler_patchB                                 0x0003C35A

#endif


code:
#pragma once
#include <Boot/Config.hpp>

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_505
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x00401CD0
#define kdlsym_addr__mtx_lock_sleep                        0x00401D70
#define kdlsym_addr__mtx_lock_spin_flags                   0x00402100
#define kdlsym_addr__mtx_unlock_flags                      0x00401FA0
#define kdlsym_addr__mtx_unlock_sleep                      0x004020A0
#define kdlsym_addr__mtx_unlock_spin_flags                 0x004022C0
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x0063CD40
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x006418E0
#define kdlsym_addr__sx_init_flags                         0x000F5BB0
#define kdlsym_addr__sx_slock                              0x000F5C30
#define kdlsym_addr__sx_sunlock                            0x000F5F10
#define kdlsym_addr__sx_xlock                              0x000F5E10
#define kdlsym_addr__sx_xunlock                            0x000F5FD0
#define kdlsym_addr__thread_lock_flags                     0x00402420
#define kdlsym_addr__vm_map_lock_read                      0x0019F140
#define kdlsym_addr__vm_map_unlock_read                    0x0019F190
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x003A2E00
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x003A2BD0
#define kdlsym_addr_allproc                                0x02382FF8
#define kdlsym_addr_allproc_lock                           0x02382F98
#define kdlsym_addr_avcontrol_sleep                        0x006EAFB0
#define kdlsym_addr_cloneuio                               0x002A82E0
#define kdlsym_addr_console_cdev                           0x01AC5158
#define kdlsym_addr_console_write                          0x000ECAC0
#define kdlsym_addr_contigfree                             0x000F1FF0
#define kdlsym_addr_contigmalloc                           0x000F1C20
#define kdlsym_addr_copyin                                 0x001EA710
#define kdlsym_addr_copyinstr                              0x001EAB40
#define kdlsym_addr_copyout                                0x001EA630
#define kdlsym_addr_critical_enter                         0x0028E7A0
#define kdlsym_addr_critical_exit                          0x0028E7B0
#define kdlsym_addr_deci_tty_write                         0x0049CEF0
#define kdlsym_addr_destroy_dev                            0x001B9D50
#define kdlsym_addr_dmem_start_app_process                 0x002469F0
#define kdlsym_addr_dynlib_do_dlsym                        0x002AFA80
#define kdlsym_addr_dynlib_find_obj_by_handle              0x002B0E10
#define kdlsym_addr_eventhandler_deregister                0x001EC790
#define kdlsym_addr_eventhandler_find_list                 0x001EC980
#define kdlsym_addr_eventhandler_register                  0x001EC400
#define kdlsym_addr_exec_new_vmspace                       0x0038AD10
#define kdlsym_addr_faultin                                0x00006DD0
#define kdlsym_addr_fget_unlocked                          0x000C34B0
#define kdlsym_addr_fpu_kern_ctx                           0x0274C040
#define kdlsym_addr_fpu_kern_enter                         0x001BFF90
#define kdlsym_addr_fpu_kern_leave                         0x001C0090
#define kdlsym_addr_free                                   0x0010E460
#define kdlsym_addr_gdt                                    0x01CB90F0
#define kdlsym_addr_gpu_va_page_list                       0x0271E208
#define kdlsym_addr_icc_nvs_read                           0x00395830
#define kdlsym_addr_kern_close                             0x000C0EC0
#define kdlsym_addr_kern_ioctl                             0x00153990
#define kdlsym_addr_kern_mkdirat                           0x00340BD0
#define kdlsym_addr_kern_open                              0x0033B9B0
#define kdlsym_addr_kern_openat                            0x0033BA10
#define kdlsym_addr_kern_readv                             0x00153248
#define kdlsym_addr_kern_reboot                            0x0010D390
#define kdlsym_addr_kern_sysents                           0x0107C610
#define kdlsym_addr_kern_thr_create                        0x001BE1F0
#define kdlsym_addr_kernel_map                             0x01AC60E0
#define kdlsym_addr_kernel_mount                           0x001E1920
#define kdlsym_addr_killproc                               0x000D41C0
#define kdlsym_addr_kmem_alloc                             0x000FCC80
#define kdlsym_addr_kmem_free                              0x000FCE50
#define kdlsym_addr_kproc_create                           0x00137DF0
#define kdlsym_addr_kproc_exit                             0x00138060
#define kdlsym_addr_kthread_add                            0x00138360
#define kdlsym_addr_kthread_exit                           0x00138640
#define kdlsym_addr_M_IOV                                  0x014B5E80
#define kdlsym_addr_M_LINKER                               0x019F2E10
#define kdlsym_addr_M_MOUNT                                0x019BF300
#define kdlsym_addr_M_TEMP                                 0x014B4110
#define kdlsym_addr_make_dev_p                             0x001B9810
#define kdlsym_addr_malloc                                 0x0010E250
#define kdlsym_addr_memcmp                                 0x00050AC0
#define kdlsym_addr_memcpy                                 0x001EA530
#define kdlsym_addr_memmove                                0x00073BA0
#define kdlsym_addr_memset                                 0x003205C0
#define kdlsym_addr_mini_syscore_self_binary               0x014C9D48
#define kdlsym_addr_mount_arg                              0x001E16A0
#define kdlsym_addr_mount_argb                             0x001DFC50
#define kdlsym_addr_mount_argf                             0x001E1780
#define kdlsym_addr_mtx_destroy                            0x004027F0
#define kdlsym_addr_mtx_init                               0x00402780
#define kdlsym_addr_mtx_lock_sleep                         0x00401D70
#define kdlsym_addr_mtx_unlock_sleep                       0x004020A0
#define kdlsym_addr_name_to_nids                           0x002AFD60
#define kdlsym_addr_pause                                  0x003FB920
#define kdlsym_addr_pfind                                  0x004034E0
#define kdlsym_addr_pmap_activate                          0x002EAFD0
#define kdlsym_addr_printf                                 0x00436040
#define kdlsym_addr_prison0                                0x010986A0
#define kdlsym_addr_proc0                                  0x01AA4600
#define kdlsym_addr_proc_reparent                          0x00035330
#define kdlsym_addr_proc_rwmem                             0x0030D150
#define kdlsym_addr_realloc                                0x0010E590
#define kdlsym_addr_rootvnode                              0x022C1A70
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x001FD7D0
#define kdlsym_addr_sbl_eap_internal_partition_key         0x02790C90
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x02748800
#define kdlsym_addr_sbl_keymgr_buf_va                      0x02748000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x02744558
#define kdlsym_addr_sbl_keymgr_key_slots                   0x02744548
#define kdlsym_addr_sbl_pfs_sx                             0x0271E5D8
#define kdlsym_addr_sbl_drv_msg_mtx                        0x0271E210
#define kdlsym_addr_sceSblACMgrGetPathId                   0x000117E0
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x0063C4F0
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x00642B40
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x0063C550
#define kdlsym_addr_sceSblDriverSendMsg                    0x0061D7F0
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x006256E0
#define kdlsym_addr_sceSblKeymgrClearKey                   0x0062DB10
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x0062D780
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x00623FC0
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x0062E2A0
#define kdlsym_addr_sceSblPfsSetKeys                       0x0061EFA0
#define kdlsym_addr_sceSblRngGetRandomNumber               0x00647A50
#define kdlsym_addr_sceSblServiceMailbox                   0x00632540
#define kdlsym_addr_sched_prio                             0x0031EE00
#define kdlsym_addr_self_orbis_sysvec                      0x019BBCD0
#define kdlsym_addr_Sha256Hmac                             0x002D55B0
#define kdlsym_addr_snprintf                               0x00436350
#define kdlsym_addr_spinlock_exit                          0x00234AB0
#define kdlsym_addr_sprintf                                0x00436280
#define kdlsym_addr_sscanf                                 0x00175900
#define kdlsym_addr_strcmp                                 0x001D0FD0
#define kdlsym_addr_strdup                                 0x001C1C30
#define kdlsym_addr_strlen                                 0x003B71A0
#define kdlsym_addr_strncmp                                0x001B8FE0
#define kdlsym_addr_strstr                                 0x0017DFB0
#define kdlsym_addr_sys_accept                             0x0031A170
#define kdlsym_addr_sys_bind                               0x00319820
#define kdlsym_addr_sys_close                              0x000C0EB0
#define kdlsym_addr_sys_dup2                               0x000BF050
#define kdlsym_addr_sys_fstat                              0x000C1430
#define kdlsym_addr_sys_getdents                           0x00341390
#define kdlsym_addr_sys_kill                               0x000D19D0
#define kdlsym_addr_sys_listen                             0x00319A60
#define kdlsym_addr_sys_lseek                              0x0033D9F0
#define kdlsym_addr_sys_mkdir                              0x00340B50
#define kdlsym_addr_sys_mlock                              0x0013E250
#define kdlsym_addr_sys_mlockall                           0x0013E300
#define kdlsym_addr_sys_mmap                               0x0013D230
#define kdlsym_addr_sys_munmap                             0x0013D9A0
#define kdlsym_addr_sys_nmount                             0x001DE2E0
#define kdlsym_addr_sys_open                               0x0033B990
#define kdlsym_addr_sys_ptrace                             0x0030D5E0
#define kdlsym_addr_sys_read                               0x00152AB0
#define kdlsym_addr_sys_recvfrom                           0x0031B460
#define kdlsym_addr_sys_rmdir                              0x00340ED0
#define kdlsym_addr_sys_sendto                             0x0031AD10
#define kdlsym_addr_sys_setuid                             0x00054950
#define kdlsym_addr_sys_shutdown                           0x0031B6A0
#define kdlsym_addr_sys_socket                             0x00318EE0
#define kdlsym_addr_sys_stat                               0x0033DFE0
#define kdlsym_addr_sys_unlink                             0x0033D3D0
#define kdlsym_addr_sys_unmount                            0x001DFC70
#define kdlsym_addr_sys_wait4                              0x00035470
#define kdlsym_addr_sys_write                              0x00152FC0
#define kdlsym_addr_trap_fatal                             0x00171580
#define kdlsym_addr_utilUSleep                             0x00658C30
#define kdlsym_addr_vm_fault_disable_pagefaults            0x002A6C20
#define kdlsym_addr_vm_fault_enable_pagefaults             0x002A6C50
#define kdlsym_addr_vm_map_lookup_entry                    0x0019F760
#define kdlsym_addr_vmspace_acquire_ref                    0x0019EF90
#define kdlsym_addr_vmspace_alloc                          0x0019EB20
#define kdlsym_addr_vmspace_free                           0x0019EDC0
#define kdlsym_addr_vn_fullpath                            0x000A11A0
#define kdlsym_addr_vsnprintf                              0x004363F0
#define kdlsym_addr_wakeup                                 0x003FB940
#define kdlsym_addr_Xfast_syscall                          0x000001C0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x019FC168

// FakeSelf hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x0063E25D
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x0063E3A1
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x0064318B
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x00643DA2
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x0063EAFC
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x0063F718

// FakePkg hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x00624065
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x0062E96D
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x0064C720
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x0064D4FF
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x006AAAD5
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x006AAD04

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x004F9E50
#define kdlsym_addr_sceRegMgrSetInt                        0x004F8D10
#define kdlsym_addr_sceRegMgrGetBin                        0x004FA6D0
#define kdlsym_addr_sceRegMgrSetBin                        0x004FA620
#define kdlsym_addr_sceRegMgrGetStr                        0x004FA550
#define kdlsym_addr_sceRegMgrSetStr                        0x004FA390

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x0016D05B
#define ssc_sceKernelIsGenuineCEX_patchB                   0x0079980B
#define ssc_sceKernelIsGenuineCEX_patchC                   0x007E5A13
#define ssc_sceKernelIsGenuineCEX_patchD                   0x0094715B

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x0016D087
#define ssc_nidf_libSceDipsw_patchB                        0x0023747B
#define ssc_nidf_libSceDipsw_patchC                        0x00799837
#define ssc_nidf_libSceDipsw_patchD                        0x00947187

#define ssc_enable_fakepkg_patch                           0x003E0602

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00EA96A7

// SceShellCore patches - enable remote pkg installer
#define ssc_enable_data_mount_patch                        0x00319A53

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr_patch                                0x00C791A0

// SceShellCore patches - enable official external HDD support (Support added in 4.50)
#define ssc_external_hdd_pkg_installer_patch               0x009312A1
#define ssc_external_hdd_version_patchA                    0x00593C7D
#define ssc_external_hdd_version_patchB                    0x00130A71

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001BD90
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001C090

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x001A8FA0
#define ssu_remote_play_menu_patch                         0x00EE638E

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003C33F
#define srp_enabler_patchB                                 0x0003C35A

// Debug (Not needed to port)
#define kdlsym_addr_g_obi_create                           0x00461EA0
#define kdlsym_addr_g_obi_destroy                          0x00461FA0
#define kdlsym_addr_g_obi_read                             0x00462000
#define kdlsym_addr_g_part_ox_get_bank                     0x000D4C80
#define kdlsym_addr_hexdump                                0x00437880

#endif


code:
#pragma once
#include <Boot/Config.hpp>

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_555
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x00123190
#define kdlsym_addr__mtx_lock_sleep                        0x00123230
#define kdlsym_addr__mtx_lock_spin_flags                   0x001235C0
#define kdlsym_addr__mtx_unlock_flags                      0x00123460
#define kdlsym_addr__mtx_unlock_sleep                      0x00123560
#define kdlsym_addr__mtx_unlock_spin_flags                 0x00123780
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x0065CD80
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x00657120
#define kdlsym_addr__sx_init_flags                         0x00482680
#define kdlsym_addr__sx_slock                              0x00482700
#define kdlsym_addr__sx_sunlock                            0x004829E0
#define kdlsym_addr__sx_xlock                              0x004828E0
#define kdlsym_addr__sx_xunlock                            0x00482AA0
#define kdlsym_addr__thread_lock_flags                     0x001238E0
#define kdlsym_addr__vm_map_lock_read                      0x00029E40
#define kdlsym_addr__vm_map_unlock_read                    0x00029E90
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x0045AF10
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x0045ACE0
#define kdlsym_addr_allproc                                0x021910E8
#define kdlsym_addr_allproc_lock                           0x02191088
#define kdlsym_addr_avcontrol_sleep                        0x00702350
#define kdlsym_addr_cloneuio                               0x0026DE80
#define kdlsym_addr_console_cdev                           0x022618E8
#define kdlsym_addr_console_write                          0x001C3990
#define kdlsym_addr_contigfree                             0x002CA800
#define kdlsym_addr_contigmalloc                           0x002CA430
#define kdlsym_addr_copyin                                 0x00405E70
#define kdlsym_addr_copyinstr                              0x00406320
#define kdlsym_addr_copyout                                0x00405D80
#define kdlsym_addr_critical_enter                         0x001EE530
#define kdlsym_addr_critical_exit                          0x001EE540
#define kdlsym_addr_deci_tty_write                         0x004AA3C0
#define kdlsym_addr_destroy_dev                            0x002077F0
#define kdlsym_addr_dmem_start_app_process                 0x000947C0
#define kdlsym_addr_dynlib_do_dlsym                        0x003FD840
#define kdlsym_addr_dynlib_find_obj_by_handle              0x003FEBE0
#define kdlsym_addr_eventhandler_deregister                0x0022DA40
#define kdlsym_addr_eventhandler_find_list                 0x0022DC50
#define kdlsym_addr_eventhandler_register                  0x0022D6A0
#define kdlsym_addr_exec_new_vmspace                       0x0020D3B0
#define kdlsym_addr_faultin                                0x0015DE80
#define kdlsym_addr_fget_unlocked                          0x00229240
#define kdlsym_addr_fpu_kern_ctx                           0x0265B040
#define kdlsym_addr_fpu_kern_enter                         0x0022CC00
#define kdlsym_addr_fpu_kern_leave                         0x0022CD00
#define kdlsym_addr_free                                   0x00466FA0
#define kdlsym_addr_gdt                                    0x022A89A0
#define kdlsym_addr_global_settings_base                   0x022BFF50
#define kdlsym_addr_gpu_va_page_list                       0x026536C8
#define kdlsym_addr_icc_nvs_read                           0x00421870
#define kdlsym_addr_kern_close                             0x00226B30
#define kdlsym_addr_kern_ioctl                             0x00139010
#define kdlsym_addr_kern_mkdirat                           0x0030E770
#define kdlsym_addr_kern_open                              0x003092F0
#define kdlsym_addr_kern_openat                            0x00309350
#define kdlsym_addr_kern_readv                             0x001388C8
#define kdlsym_addr_kern_reboot                            0x00288BF0
#define kdlsym_addr_kern_sysents                           0x0111ACC0
#define kdlsym_addr_kern_thr_create                        0x000D4FA0
#define kdlsym_addr_kernel_map                             0x0217FBB0
#define kdlsym_addr_kernel_mount                           0x0019f3A0
#define kdlsym_addr_killproc                               0x0017C390
#define kdlsym_addr_kmem_alloc                             0x001422E0
#define kdlsym_addr_kmem_free                              0x001424B0
#define kdlsym_addr_kproc_create                           0x0032DAA0
#define kdlsym_addr_kproc_exit                             0x0032DD20
#define kdlsym_addr_kthread_add                            0x0032E020
#define kdlsym_addr_kthread_exit                           0x0032E300
#define kdlsym_addr_M_IOV                                  0x0154D160
#define kdlsym_addr_M_LINKER                               0x01551A10
#define kdlsym_addr_M_MOUNT                                0x0155CCE0
#define kdlsym_addr_M_TEMP                                 0x01A92FF0
#define kdlsym_addr_make_dev_p                             0x002072B0
#define kdlsym_addr_malloc                                 0x00466DA0
#define kdlsym_addr_memcmp                                 0x0005E270
#define kdlsym_addr_memcpy                                 0x00405C80
#define kdlsym_addr_memmove                                0x0032D970
#define kdlsym_addr_memset                                 0x00108B50
#define kdlsym_addr_mini_syscore_self_binary               0x0156B618
#define kdlsym_addr_mount_arg                              0x0019F100
#define kdlsym_addr_mount_argb                             0x0019D6C0
#define kdlsym_addr_mount_argf                             0x0019F1F0
#define kdlsym_addr_mtx_destroy                            0x00123CB0
#define kdlsym_addr_mtx_init                               0x00123C40
#define kdlsym_addr_mtx_lock_sleep                         0x00123230
#define kdlsym_addr_mtx_unlock_sleep                       0x00123560
#define kdlsym_addr_name_to_nids                           0x003fDB20
#define kdlsym_addr_pause                                  0x00466650
#define kdlsym_addr_pfind                                  0x0015FDB0
#define kdlsym_addr_pmap_activate                          0x00305C30
#define kdlsym_addr_printf                                 0x0011B150
#define kdlsym_addr_prison0                                0x01139180
#define kdlsym_addr_proc0                                  0x0218FFB0
#define kdlsym_addr_proc_reparent                          0x0044F7E0
#define kdlsym_addr_proc_rwmem                             0x00393470
#define kdlsym_addr_realloc                                0x004670D0
#define kdlsym_addr_rootvnode                              0x022F3570
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x002EA6B0
#define kdlsym_addr_sbl_eap_internal_partition_key         0x026C4CF0
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x0265C808
#define kdlsym_addr_sbl_keymgr_buf_va                      0x0265C000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x0265B710
#define kdlsym_addr_sbl_keymgr_key_slots                   0x0265B700
#define kdlsym_addr_sbl_pfs_sx                             0x02668080
#define kdlsym_addr_sbl_drv_msg_mtx                        0x026536D0
#define kdlsym_addr_sceSblACMgrGetPathId                   0x001B4C30
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x0065C520
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x006586D0
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x0065C580
#define kdlsym_addr_sceSblDriverSendMsg                    0x00635EA0
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x00646F90
#define kdlsym_addr_sceSblKeymgrClearKey                   0x0063F080
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x0063ED00
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x0063C7C0
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x0063E8D0
#define kdlsym_addr_sceSblPfsSetKeys                       0x00641810
#define kdlsym_addr_sceSblRngGetRandomNumber               0x006607B0
#define kdlsym_addr_sceSblServiceMailbox                   0x0064A6A0
#define kdlsym_addr_sched_prio                             0x001F9F30
#define kdlsym_addr_self_orbis_sysvec						           0x015424E8
#define kdlsym_addr_Sha256Hmac                             0x0031D470
#define kdlsym_addr_snprintf                               0x0011B460
#define kdlsym_addr_spinlock_exit                          0x00381AE1
#define kdlsym_addr_sprintf                                0x0011B390
#define kdlsym_addr_sscanf                                 0x001DF530
#define kdlsym_addr_strcmp                                 0x001C0000
#define kdlsym_addr_strdup                                 0x0047FA60
#define kdlsym_addr_strlen                                 0x002A6F30
#define kdlsym_addr_strncmp                                0x002f2BC0
#define kdlsym_addr_strstr                                 0x000E4D90
#define kdlsym_addr_sys_accept                             0x00153A40
#define kdlsym_addr_sys_bind                               0x001530B0
#define kdlsym_addr_sys_close                              0x00226B20
#define kdlsym_addr_sys_dup2                               0x00224D00
#define kdlsym_addr_sys_fstat                              0x002270C0
#define kdlsym_addr_sys_getdents                           0x0030EF20
#define kdlsym_addr_sys_kill                               0x00179C40
#define kdlsym_addr_sys_listen                             0x001532F0
#define kdlsym_addr_sys_lseek                              0x0030B5E0
#define kdlsym_addr_sys_mkdir                              0x0030E6F0
#define kdlsym_addr_sys_mlock                              0x003C3500
#define kdlsym_addr_sys_mlockall                           0x003C35B0
#define kdlsym_addr_sys_mmap                               0x0032C4C0
#define kdlsym_addr_sys_munmap                             0x003C2C20
#define kdlsym_addr_sys_nmount                             0x0019BDD0
#define kdlsym_addr_sys_open				                       0x003092D0
#define kdlsym_addr_sys_ptrace                             0x00393B10
#define kdlsym_addr_sys_read                               0x00138130
#define kdlsym_addr_sys_recvfrom                           0x00154D10
#define kdlsym_addr_sys_rmdir                              0x0030EA70
#define kdlsym_addr_sys_sendto                             0x001545E0
#define kdlsym_addr_sys_setuid                             0x000106A0
#define kdlsym_addr_sys_shutdown                           0x00154F60
#define kdlsym_addr_sys_socket                             0x00152790
#define kdlsym_addr_sys_stat                               0x0030BBA0
#define kdlsym_addr_sys_unlink                             0x0030AE80
#define kdlsym_addr_sys_unmount                            0x0019D6E0
#define kdlsym_addr_sys_wait4                              0x0044F920
#define kdlsym_addr_sys_write                              0x00138640
#define kdlsym_addr_trap_fatal                             0x000A1780
#define kdlsym_addr_utilUSleep                             0x00694090
#define kdlsym_addr_vm_fault_disable_pagefaults            0x00218190
#define kdlsym_addr_vm_fault_enable_pagefaults             0x002181C0
#define kdlsym_addr_vm_map_lookup_entry                    0x0002A470
#define kdlsym_addr_vmspace_acquire_ref                    0x00029C90
#define kdlsym_addr_vmspace_alloc                          0x00029810
#define kdlsym_addr_vmspace_free                           0x00029AC0
#define kdlsym_addr_vn_fullpath                            0x00272810
#define kdlsym_addr_vsnprintf                              0x0011B500
#define kdlsym_addr_wakeup                                 0x00466650
#define kdlsym_addr_Xfast_syscall                          0x000001C0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x0019C288

// FakeSelf hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x0065588D
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x006559D1
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x00658D13
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x00659966
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x0065612C
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x00656DD8

// FakePkg hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x0063C865
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x0063FF2A
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x00664130
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x00664F13
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x006B1A68
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x006B1C97

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x00177AFB
#define ssc_sceKernelIsGenuineCEX_patchB                   0x007BA80B
#define ssc_sceKernelIsGenuineCEX_patchC                   0x008052A3
#define ssc_sceKernelIsGenuineCEX_patchD                   0x0099520B

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x00177B27
#define ssc_nidf_libSceDipsw_patchB                        0x0024A9DD
#define ssc_nidf_libSceDipsw_patchC                        0x007BA837
#define ssc_nidf_libSceDipsw_patchD                        0x00995237

#define ssc_enable_fakepkg_patch                           0x003DE982

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00F196B0

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr                                      0x00CE7790

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001D4D0
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001D830

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x001A3350
#define ssu_remote_play_menu_patch                         0x00E86151

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003C0B6
#define srp_enabler_patchB                                 0x0003C0D1

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x0050A830
#define kdlsym_addr_sceRegMgrSetInt                        0x00509520
#define kdlsym_addr_sceRegMgrGetBin                        0x0050B170
#define kdlsym_addr_sceRegMgrSetBin                        0x0050B0C0
#define kdlsym_addr_sceRegMgrGetStr                        0x0050AFF0
#define kdlsym_addr_sceRegMgrSetStr                        0x0050AE30

// Debug (Not needed to port)
#define kdlsym_addr_g_obi_create                           0x00473AD0
#define kdlsym_addr_g_obi_destroy                          0x00473BD0
#define kdlsym_addr_g_obi_read                             0x00473C30
#define kdlsym_addr_g_part_ox_get_bank                     0x002f0D20
#define kdlsym_addr_hexdump                                0x0011CA30

#endif


code:
#pragma once
#include <Boot/Config.hpp>

#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_620
/*
    These are the required functions in order for the Oni Framework to operate properly
    These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes

    The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
    for the platforms that do enable kernel ASLR (Address Space Layout Randomization?)
*/

#define kdlsym_addr__mtx_lock_flags                        0x00007470
#define kdlsym_addr__mtx_lock_sleep                        0x00007510
#define kdlsym_addr__mtx_lock_spin_flags                   0x000078A0
#define kdlsym_addr__mtx_unlock_flags                      0x00007740
#define kdlsym_addr__mtx_unlock_sleep                      0x00007840
#define kdlsym_addr__mtx_unlock_spin_flags                 0x00007A60
#define kdlsym_addr__sceSblAuthMgrGetSelfInfo              0x006575B0
#define kdlsym_addr__sceSblAuthMgrSmStart                  0x0065B070
#define kdlsym_addr__sx_init_flags                         0x00083CA0
#define kdlsym_addr__sx_slock                              0x00083D20
#define kdlsym_addr__sx_sunlock                            0x00084000
#define kdlsym_addr__sx_xlock                              0x00083F00
#define kdlsym_addr__sx_xunlock                            0x000840C0
#define kdlsym_addr__thread_lock_flags                     0x00007BC0
#define kdlsym_addr__vm_map_lock_read                      0x0034D260
#define kdlsym_addr__vm_map_unlock_read                    0x0034D2B0
#define kdlsym_addr_AesCbcCfb128Decrypt                    0x002D4320
#define kdlsym_addr_AesCbcCfb128Encrypt                    0x002D40F0
#define kdlsym_addr_allproc                                0x022FBCD0
#define kdlsym_addr_allproc_lock                           0x022FBC70
#define kdlsym_addr_avcontrol_sleep                        0x00704200
#define kdlsym_addr_cloneuio                               0x00396310
#define kdlsym_addr_console_cdev                           0x021413E8
#define kdlsym_addr_console_write                          0x0007F230
#define kdlsym_addr_contigfree                             0x0009EF50
#define kdlsym_addr_contigmalloc                           0x0009EB90
#define kdlsym_addr_copyin                                 0x001148F0
#define kdlsym_addr_copyinstr                              0x00114DA0
#define kdlsym_addr_copyout                                0x00114800
#define kdlsym_addr_critical_enter                         0x00157850
#define kdlsym_addr_critical_exit                          0x00157860
#define kdlsym_addr_deci_tty_write                         0x004A8DB0
#define kdlsym_addr_destroy_dev                            0x00207730
#define kdlsym_addr_dmem_start_app_process                 0x000B5A50
#define kdlsym_addr_dynlib_do_dlsym                        0x00017A20
#define kdlsym_addr_dynlib_find_obj_by_handle              0x00019020
#define kdlsym_addr_eventhandler_deregister                0x00181320
#define kdlsym_addr_eventhandler_find_list                 0x00181530
#define kdlsym_addr_eventhandler_register                  0x00180F80
#define kdlsym_addr_exec_new_vmspace                       0x003D8300
#define kdlsym_addr_faultin                                0x001B38D0
#define kdlsym_addr_fget_unlocked                          0x0024BAA0
#define kdlsym_addr_fpu_kern_ctx                           0x0263A6C0
#define kdlsym_addr_fpu_kern_enter                         0x001E3990
#define kdlsym_addr_fpu_kern_leave                         0x001E3A90
#define kdlsym_addr_free                                   0x001D9260
#define kdlsym_addr_gdt                                    0x021425F0
#define kdlsym_addr_gpu_va_page_list                       0x02659E58
#define kdlsym_addr_icc_nvs_read                           0x00462340
#define kdlsym_addr_kern_close                             0x00068AC0
#define kdlsym_addr_kern_ioctl                             0x0030BAD0
#define kdlsym_addr_kern_mkdirat                           0x00349C40
#define kdlsym_addr_kern_open                              0x003447F0
#define kdlsym_addr_kern_openat                            0x00344850
#define kdlsym_addr_kern_readv                             0x0030AC70
#define kdlsym_addr_kern_reboot                            0x001D45E0
#define kdlsym_addr_kern_sysents                           0x0111F540
#define kdlsym_addr_kern_thr_create                        0x00470D40
#define kdlsym_addr_kernel_map                             0x021CBD88
#define kdlsym_addr_kernel_mount                           0x00011C80
#define kdlsym_addr_killproc                               0x00229AF0
#define kdlsym_addr_kmem_alloc                             0x00270420
#define kdlsym_addr_kmem_free                              0x002705F0
#define kdlsym_addr_kproc_create                           0x00197A20
#define kdlsym_addr_kproc_exit                             0x00197C90
#define kdlsym_addr_kthread_add                            0x00197F90
#define kdlsym_addr_kthread_exit                           0x00198270
#define kdlsym_addr_M_IOV                                  0x01A7C2F0
#define kdlsym_addr_M_LINKER                               0x01A82950
#define kdlsym_addr_M_MOUNT                                0x00D41270
#define kdlsym_addr_M_TEMP                                 0x0155D070
#define kdlsym_addr_make_dev_p                             0x002071F0
#define kdlsym_addr_malloc                                 0x001D9060
#define kdlsym_addr_memcmp                                 0x004A1740
#define kdlsym_addr_memcpy                                 0x00114700
#define kdlsym_addr_memmove                                0x00032C50
#define kdlsym_addr_memset                                 0x00394C60
#define kdlsym_addr_mini_syscore_self_binary               0x0157F648
#define kdlsym_addr_mount_arg                              0x000119E0
#define kdlsym_addr_mount_argb                             0x0000FFB0
#define kdlsym_addr_mount_argf                             0x00011AD0
#define kdlsym_addr_mtx_destroy                            0x00007FA0
#define kdlsym_addr_mtx_init                               0x00007F30
#define kdlsym_addr_mtx_lock_sleep                         0x00007510
#define kdlsym_addr_mtx_unlock_sleep                       0x00007840
#define kdlsym_addr_name_to_nids                           0x00017D00
#define kdlsym_addr_pause                                  0x000973D0
#define kdlsym_addr_pfind                                  0x004A1F00
#define kdlsym_addr_pmap_activate                          0x002F4BC0
#define kdlsym_addr_printf                                 0x00307E10
#define kdlsym_addr_prison0                                0x0113D458
#define kdlsym_addr_proc0                                  0x021C6F90
#define kdlsym_addr_proc_reparent                          0x00076450
#define kdlsym_addr_proc_rwmem                             0x0013E7A0
#define kdlsym_addr_realloc                                0x001D9390
#define kdlsym_addr_rootvnode                              0x021C3AC0
#define kdlsym_addr_RsaesPkcs1v15Dec2048CRT                0x002209B0
#define kdlsym_addr_sbl_eap_internal_partition_key         0x026CCC60
#define kdlsym_addr_sbl_keymgr_buf_gva                     0x02688808
#define kdlsym_addr_sbl_keymgr_buf_va                      0x02688000
#define kdlsym_addr_sbl_keymgr_key_rbtree                  0x02684A88
#define kdlsym_addr_sbl_keymgr_key_slots                   0x02684A78
#define kdlsym_addr_sbl_pfs_sx                             0x02677290
#define kdlsym_addr_sbl_drv_msg_mtx                        0x02659E60
#define kdlsym_addr_sceSblACMgrGetPathId                   0x004594E0
#define kdlsym_addr_sceSblAuthMgrIsLoadable2               0x00656D20
#define kdlsym_addr_sceSblAuthMgrSmVerifyHeader            0x0065CBD0
#define kdlsym_addr_sceSblAuthMgrVerifyHeader              0x00656D80
#define kdlsym_addr_sceSblDriverSendMsg                    0x006378E0
#define kdlsym_addr_sceSblGetEAPInternalPartitionKey       0x0063C940
#define kdlsym_addr_sceSblKeymgrClearKey                   0x00649280
#define kdlsym_addr_sceSblKeymgrSetKeyForPfs               0x00648EF0
#define kdlsym_addr_sceSblKeymgrSetKeyStorage              0x00646050
#define kdlsym_addr_sceSblKeymgrSmCallfunc                 0x00648AC0
#define kdlsym_addr_sceSblPfsSetKeys                       0x00640C90
#define kdlsym_addr_sceSblRngGetRandomNumber               0x00663000
#define kdlsym_addr_sceSblServiceMailbox                   0x0064B480
#define kdlsym_addr_sched_prio                             0x0040C740
#define kdlsym_addr_self_orbis_sysvec                      0x01568AE8
#define kdlsym_addr_Sha256Hmac                             0x00165D80
#define kdlsym_addr_snprintf                               0x00308120
#define kdlsym_addr_spinlock_exit                          0x000879F0
#define kdlsym_addr_sprintf                                0x00308050
#define kdlsym_addr_sscanf                                 0x000FEA40
#define kdlsym_addr_strcmp                                 0x0015E8C0
#define kdlsym_addr_strdup                                 0x0034AA20
#define kdlsym_addr_strlen                                 0x000D5AA0
#define kdlsym_addr_strncmp                                0x001FE650
#define kdlsym_addr_strstr                                 0x004247F0
#define kdlsym_addr_sys_accept                             0x00300A10
#define kdlsym_addr_sys_bind                               0x00300080
#define kdlsym_addr_sys_close                              0x00068AB0
#define kdlsym_addr_sys_dup2                               0x00066C70
#define kdlsym_addr_sys_fstat                              0x00069050
#define kdlsym_addr_sys_getdents                           0x0034A3F0
#define kdlsym_addr_sys_kill                               0x00227430
#define kdlsym_addr_sys_listen                             0x003002C0
#define kdlsym_addr_sys_lseek                              0x00346AB0
#define kdlsym_addr_sys_mkdir                              0x00349BC0
#define kdlsym_addr_sys_mlock                              0x00240F20
#define kdlsym_addr_sys_mlockall                           0x00240FD0
#define kdlsym_addr_sys_mmap                               0x0023FE90
#define kdlsym_addr_sys_munmap                             0x00240600
#define kdlsym_addr_sys_nmount                             0x0000E6A0
#define kdlsym_addr_sys_open                               0x003447D0
#define kdlsym_addr_sys_ptrace                             0x0013EE50
#define kdlsym_addr_sys_read                               0x0030AC00
#define kdlsym_addr_sys_recvfrom                           0x00301CE0
#define kdlsym_addr_sys_rmdir                              0x00349F40
#define kdlsym_addr_sys_sendto                             0x003015B0
#define kdlsym_addr_sys_setuid                             0x00028FC0
#define kdlsym_addr_sys_shutdown                           0x00301F30
#define kdlsym_addr_sys_socket                             0x002FF750
#define kdlsym_addr_sys_stat                               0x00347090
#define kdlsym_addr_sys_unlink                             0x00346350
#define kdlsym_addr_sys_unmount                            0x0000FFD0
#define kdlsym_addr_sys_wait4                              0x00076590
#define kdlsym_addr_sys_write                              0x0030B1E0
#define kdlsym_addr_trap_fatal                             0x002E0DD0
#define kdlsym_addr_utilUSleep                             0x006864B0
#define kdlsym_addr_vm_fault_disable_pagefaults            0x003FEE40
#define kdlsym_addr_vm_fault_enable_pagefaults             0x003FEE70
#define kdlsym_addr_vm_map_lookup_entry                    0x0034D860
#define kdlsym_addr_vmspace_acquire_ref                    0x0034D0B0
#define kdlsym_addr_vmspace_alloc                          0x0034CC30
#define kdlsym_addr_vmspace_free                           0x0034CEE0
#define kdlsym_addr_vn_fullpath                            0x0024ABA0
#define kdlsym_addr_vsnprintf                              0x003081C0
#define kdlsym_addr_wakeup                                 0x000973F0
#define kdlsym_addr_Xfast_syscall                          0x000001C0

// PS4GDB
#define kdlsym_addr_bzero                                  0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_getpid                             0xDEADC0DEDEADBEEF
#define kdlsym_addr_sys_sysctl                             0xDEADC0DEDEADBEEF

// Kernel Hooks
#define kdlsym_addr_printf_hook                            0x01A9FD58

// FakeSelf Hooks
#define kdlsym_addr_sceSblAuthMgrIsLoadable__sceSblACMgrGetPathId_hook        0x00658D2C
#define kdlsym_addr_sceSblAuthMgrIsLoadable2_hook                             0x00658E7F
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfBlock__sceSblServiceMailbox_hook   0x0065DEE1
#define kdlsym_addr_sceSblAuthMgrSmLoadSelfSegment__sceSblServiceMailbox_hook 0x0065D29A
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookA                           0x00659636
#define kdlsym_addr_sceSblAuthMgrVerifyHeader_hookB                           0x0065A2D8

// FakePkg Hooks
#define kdlsym_addr_sceSblKeymgrSetKeyStorage__sceSblDriverSendMsg_hook       0x006460F5
#define kdlsym_addr_sceSblKeymgrInvalidateKey__sx_xlock_hook                  0x0064A11D
#define kdlsym_addr_npdrm_decrypt_isolated_rif__sceSblKeymgrSmCallfunc_hook   0x006685C0
#define kdlsym_addr_npdrm_decrypt_rif_new__sceSblKeymgrSmCallfunc_hook        0x006693D3
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookA                          0x0069FABA
#define kdlsym_addr_mountpfs__sceSblPfsSetKeys_hookB                          0x0069FCE6

// sceRegMgr
#define kdlsym_addr_sceRegMgrGetInt                        0x00503530
#define kdlsym_addr_sceRegMgrSetInt                        0x00502230
#define kdlsym_addr_sceRegMgrGetBin                        0x00503E70
#define kdlsym_addr_sceRegMgrSetBin                        0x00503DC0
#define kdlsym_addr_sceRegMgrGetStr                        0x00503CF0
#define kdlsym_addr_sceRegMgrSetStr                        0x00503B30

// SceShellCore patches - call sceKernelIsGenuineCEX
#define ssc_sceKernelIsGenuineCEX_patchA                   0x00186170
#define ssc_sceKernelIsGenuineCEX_patchB                   0x0081ED20
#define ssc_sceKernelIsGenuineCEX_patchC                   0x00869BA3
#define ssc_sceKernelIsGenuineCEX_patchD                   0x009F7550

// SceShellCore patches - call nidf_libSceDipsw
#define ssc_nidf_libSceDipsw_patchA                        0x0018619A
#define ssc_nidf_libSceDipsw_patchB                        0x0025C923
#define ssc_nidf_libSceDipsw_patchC                        0x0081ED4A
#define ssc_nidf_libSceDipsw_patchD                        0x009F757A

#define ssc_enable_fakepkg_patch                           0x003F7222

// SceShellCore patches - use free prefix instead fake
#define ssc_fake_to_free_patch                             0x00F9FB11

// SceShellCore patches - enable remote pkg installer
#define ssc_enable_data_mount_patch                        0x0033FF4C

// SceShellCore patches - enable VR without spoof
#define ssc_enable_vr_patch                                0x00DBABD0

// SceShellCore patches - enable official external HDD support (Support added in 4.50)
#define ssc_external_hdd_pkg_installer_patch               0x009E0031
#define ssc_external_hdd_version_patchA                    0x0060081D
#define ssc_external_hdd_version_patchB                    0x0014A731

// SceShellUI patches - debug patches
#define ssu_sceSblRcMgrIsAllowDebugMenuForSettings_patch   0x0001D6D0
#define ssu_sceSblRcMgrIsStoreMode_patch                   0x0001DA30

// SceShellUI - remote play related patching
#define ssu_CreateUserForIDU_patch                         0x001A0510
#define ssu_remote_play_menu_patch                         0x00E9F7B1

// SceRemotePlay - enabler patches
#define srp_enabler_patchA                                 0x0003CED6
#define srp_enabler_patchB                                 0x0003CEF1

#endif