Add debug output patch for 1.0.0

This commit is contained in:
roblabla 2019-02-05 02:07:37 +00:00
parent e105634b0d
commit c630a5f3b0
3 changed files with 16 additions and 2 deletions

View file

@ -479,9 +479,11 @@ int hos_launch(ini_sec_t *cfg)
{
if ((ctxt.svcperm && kernel_patchset[i].id == SVC_VERIFY_DS)
|| (ctxt.debugmode && kernel_patchset[i].id == DEBUG_MODE_EN && !(ctxt.atmosphere && ctxt.secmon))
|| (ctxt.atmosphere && kernel_patchset[i].id == ATM_GEN_PATCH))
|| (ctxt.atmosphere && kernel_patchset[i].id == ATM_GEN_PATCH)
|| (ctxt.debugmode && kernel_patchset[i].id == DEBUG_OUTPUT_GEN))
*(vu32 *)(ctxt.kernel + kernel_patchset[i].off) = kernel_patchset[i].val;
else if (ctxt.atmosphere && kernel_patchset[i].id == ATM_ARR_PATCH)
else if ((ctxt.atmosphere && kernel_patchset[i].id == ATM_ARR_PATCH)
|| ctxt.debugmode && kernel_patchset[i].id == DEBUG_OUTPUT_ARR)
{
temp = (u32 *)kernel_patchset[i].ptr;
for (u32 j = 0; j < kernel_patchset[i].val; j++)

View file

@ -61,6 +61,8 @@ extern gfx_con_t gfx_con;
#define ID_RCV_OFF_500 0x28DAC
#define ID_RCV_OFF_600 0x29B6C
#define OUTPUT_DEBUG_OFF_100 0x2AD64
static u32 PRC_ID_SND_100[] =
{
0xA9BF2FEA, 0x2A0E03EB, 0xD37EF56B, 0xF86B6B8B, 0x92FFFFE9, 0x8A090168, 0xD2FFFFE9, 0x8A09016B,
@ -72,6 +74,12 @@ static u32 PRC_ID_RCV_100[] =
0xA9BF2FEA, 0x2A1C03EA, 0xD37EF54A, 0xF86A69AA, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A09014A,
0xD2FFFFC9, 0xEB09015F, 0x54000040, 0xF9412968, 0xA8C12FEA
};
#define FREE_CODE_OFF_3RD_100 (FREE_CODE_OFF_2ND_100 + sizeof(PRC_ID_RCV_100) + 4)
static u32 DEBUG_OUTPUT_TRAMPOLINE_100[] =
{
0xE20300AA, 0xE0FFFFD2, 0xE0FFDFF2, 0x80F8B7F2, 0x802F8BF2, 0xFD7BBFA9, 0x86F0FE97, 0x000080D2,
0xFD7BC1A8, 0xC0035FD6
};
static u32 PRC_ID_SND_200[] =
{
@ -151,6 +159,8 @@ static u32 PRC_ID_RCV_600[] =
KERNEL_PATCHSET_DEF(_kernel_1_patchset,
{ SVC_VERIFY_DS, 0x3764C, _NOP(), NULL }, // Disable SVC verifications
{ DEBUG_MODE_EN, 0x44074, _MOVZX(8, 1, 0), NULL }, // Enable Debug Patch
{ DEBUG_OUTPUT_GEN, OUTPUT_DEBUG_OFF_100, _B(OUTPUT_DEBUG_OFF_100, FREE_CODE_OFF_3RD_100), NULL }, // Branch to the printk trampoline
{ DEBUG_OUTPUT_ARR, FREE_CODE_OFF_3RD_100, sizeof(DEBUG_OUTPUT_TRAMPOLINE_100) >> 2, DEBUG_OUTPUT_TRAMPOLINE_100 }, // Call printk with the right arguments.
// Atmosphère kernel patches.
{ ATM_GEN_PATCH, ID_SND_OFF_100, _B(ID_SND_OFF_100, FREE_CODE_OFF_1ST_100), NULL}, // Send process id branch.
{ ATM_ARR_PATCH, FREE_CODE_OFF_1ST_100, sizeof(PRC_ID_SND_100) >> 2, PRC_ID_SND_100}, // Send process id code.

View file

@ -50,6 +50,8 @@ enum
ATM_GEN_PATCH,
// >4 bytes patches. Value is a pointer of a u32 array.
ATM_ARR_PATCH,
DEBUG_OUTPUT_GEN,
DEBUG_OUTPUT_ARR,
};
typedef struct _pkg2_hdr_t