From b211a7cf05de1a36de53c21fb90097c1d0580478 Mon Sep 17 00:00:00 2001 From: Traiver Date: Sun, 17 Jun 2018 11:00:42 +0200 Subject: [PATCH 1/4] add kernel patches for 4.1.0 --- fusee/fusee-secondary/src/kernel_patches.c | 53 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/fusee/fusee-secondary/src/kernel_patches.c b/fusee/fusee-secondary/src/kernel_patches.c index 6503b67dc..2e9eec119 100644 --- a/fusee/fusee-secondary/src/kernel_patches.c +++ b/fusee/fusee-secondary/src/kernel_patches.c @@ -30,6 +30,40 @@ typedef struct { /* mov w10, w23 lsl x10, x10, #2 + ldr x10, [x22, x10] + mov x9, #0x0000ffffffffffff + and x8, x10, x9 + mov x9, #0xffff000000000000 + and x10, x10, x9 + mov x9, #0xfffe000000000000 + cmp x10, x9 + beq #12 + ldr x10, [sp,#0x80] + ldr x8, [x10,#0x2b0] + ldr x10, [sp,#0xa0] +*/ +static const uint8_t MAKE_KERNEL_PATTERN_NAME(400, proc_id_send)[] = {0xEA, 0x53, 0x40, 0xF9, 0x48, 0x59, 0x41, 0xF9, 0xE9, 0x03, 0x17, 0x2A, 0x29, 0xF5, 0x7E, 0xD3}; +static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_send)[] = {0x2A1703EA, 0xD37EF54A, 0xF86A6ACA, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A09014A, 0xD2FFFFC9, 0xEB09015F, 0x54000060, 0xF94043EA, 0xF9415948, 0xF94053EA}; +/* + mov x13, #0 + mov w13, w14 + lsl x13, x13, #2 + ldr x13, [x26,x13] + mov x9, #0x0000ffffffffffff + and x8, x13, x9 + mov x9, #0xffff000000000000 + and x13, x13, x9 + mov x9, #0xfffe000000000000 + cmp x13, x9 + beq #8 + ldr x8, [x25,#0x2b0] + nop //needed for the jump +*/ +static const uint8_t MAKE_KERNEL_PATTERN_NAME(400, proc_id_recv)[] = {0x28, 0x5B, 0x41, 0xF9, 0xE9, 0x03, 0x0E, 0x2A, 0xCE, 0x09, 0x00, 0x11, 0x29, 0xF5, 0x7E, 0xD3}; +static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_recv)[] = {0xD280000D, 0x2A0E03ED, 0xD37EF5AD, 0xF86D6B4D, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A0901AD, 0xD2FFFFC9, 0xEB09015F, 0x54000040, 0xF9415B28, 0xD503201F}; +/* + mov w10, w23 + lsl x10, x10, #2 ldr x10, [x27, x10] mov x9, #0x0000ffffffffffff and x8, x10, x9 @@ -76,7 +110,22 @@ static const kernel_hook_t g_kernel_hooks_302[] = { /* TODO */ }; static const kernel_hook_t g_kernel_hooks_400[] = { - /* TODO */ + { /* Send Message Process ID Patch. */ + .pattern_size = 0x10, + .pattern = MAKE_KERNEL_PATTERN_NAME(400, proc_id_send), + .pattern_hook_offset = 0x0, + .payload_num_instructions = 13, + .branch_back_offset = 0x8, + .payload = MAKE_KERNEL_HOOK_NAME(400, proc_id_send) + }, + { /* Receive Message Process ID Patch. */ + .pattern_size = 0x10, + .pattern = MAKE_KERNEL_PATTERN_NAME(400, proc_id_recv), + .pattern_hook_offset = 0x0, + .payload_num_instructions = 13, + .branch_back_offset = 0x4, + .payload = MAKE_KERNEL_HOOK_NAME(400, proc_id_recv) + } }; static const kernel_hook_t g_kernel_hooks_500[] = { { /* Send Message Process ID Patch. */ @@ -206,4 +255,4 @@ void package2_patch_kernel(void *_kernel, size_t size) { free_space_offset += hook_size; free_space_size -= hook_size; } -} \ No newline at end of file +} From 0295c8a51d4e3d86804d51d8a224b1f3284a3976 Mon Sep 17 00:00:00 2001 From: Traiver Date: Sun, 17 Jun 2018 12:38:57 +0200 Subject: [PATCH 2/4] Update kernel_patches.c --- fusee/fusee-secondary/src/kernel_patches.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fusee/fusee-secondary/src/kernel_patches.c b/fusee/fusee-secondary/src/kernel_patches.c index 2e9eec119..b2be44ac1 100644 --- a/fusee/fusee-secondary/src/kernel_patches.c +++ b/fusee/fusee-secondary/src/kernel_patches.c @@ -38,7 +38,7 @@ typedef struct { mov x9, #0xfffe000000000000 cmp x10, x9 beq #12 - ldr x10, [sp,#0x80] + ldr x10, [sp,#0xa0] ldr x8, [x10,#0x2b0] ldr x10, [sp,#0xa0] */ From 57819fa345722d491c4847af6575bb04cf288b1c Mon Sep 17 00:00:00 2001 From: Traiver Date: Sun, 17 Jun 2018 14:02:08 +0200 Subject: [PATCH 3/4] Update kernel_patches.c --- fusee/fusee-secondary/src/kernel_patches.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/fusee/fusee-secondary/src/kernel_patches.c b/fusee/fusee-secondary/src/kernel_patches.c index b2be44ac1..f4fd18979 100644 --- a/fusee/fusee-secondary/src/kernel_patches.c +++ b/fusee/fusee-secondary/src/kernel_patches.c @@ -30,7 +30,7 @@ typedef struct { /* mov w10, w23 lsl x10, x10, #2 - ldr x10, [x22, x10] + ldr x10, [x28, x10] mov x9, #0x0000ffffffffffff and x8, x10, x9 mov x9, #0xffff000000000000 @@ -45,24 +45,24 @@ typedef struct { static const uint8_t MAKE_KERNEL_PATTERN_NAME(400, proc_id_send)[] = {0xEA, 0x53, 0x40, 0xF9, 0x48, 0x59, 0x41, 0xF9, 0xE9, 0x03, 0x17, 0x2A, 0x29, 0xF5, 0x7E, 0xD3}; static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_send)[] = {0x2A1703EA, 0xD37EF54A, 0xF86A6ACA, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A09014A, 0xD2FFFFC9, 0xEB09015F, 0x54000060, 0xF94043EA, 0xF9415948, 0xF94053EA}; /* - mov x13, #0 - mov w13, w14 - lsl x13, x13, #2 - ldr x13, [x26,x13] - mov x9, #0x0000ffffffffffff - and x8, x13, x9 - mov x9, #0xffff000000000000 - and x13, x13, x9 - mov x9, #0xfffe000000000000 - cmp x13, x9 - beq #8 - ldr x8, [x25,#0x2b0] - nop //needed for the jump + ldr x13, [sp,#0x70] + mov w10, w14 + lsl x10, x10, #2 + ldr x10, [x13, x10] + mov x9, #0x0000ffffffffffff + and x8, x10, x9 + mov x9, #0xffff000000000000 + and x10, x10, x9 + mov x9, #0xfffe000000000000 + cmp x10, x9 + beq #8 + ldr x8, [x25,#0x2b0] + nop */ static const uint8_t MAKE_KERNEL_PATTERN_NAME(400, proc_id_recv)[] = {0x28, 0x5B, 0x41, 0xF9, 0xE9, 0x03, 0x0E, 0x2A, 0xCE, 0x09, 0x00, 0x11, 0x29, 0xF5, 0x7E, 0xD3}; static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_recv)[] = {0xD280000D, 0x2A0E03ED, 0xD37EF5AD, 0xF86D6B4D, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A0901AD, 0xD2FFFFC9, 0xEB09015F, 0x54000040, 0xF9415B28, 0xD503201F}; /* - mov w10, w23 + mov w10, w23 lsl x10, x10, #2 ldr x10, [x27, x10] mov x9, #0x0000ffffffffffff From 33af704ee28a8a8b028a0f939bbcda154419fc7c Mon Sep 17 00:00:00 2001 From: Traiver Date: Sun, 17 Jun 2018 15:54:06 +0200 Subject: [PATCH 4/4] Update kernel_patches.c --- fusee/fusee-secondary/src/kernel_patches.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fusee/fusee-secondary/src/kernel_patches.c b/fusee/fusee-secondary/src/kernel_patches.c index f4fd18979..5a9636f99 100644 --- a/fusee/fusee-secondary/src/kernel_patches.c +++ b/fusee/fusee-secondary/src/kernel_patches.c @@ -43,7 +43,7 @@ typedef struct { ldr x10, [sp,#0xa0] */ static const uint8_t MAKE_KERNEL_PATTERN_NAME(400, proc_id_send)[] = {0xEA, 0x53, 0x40, 0xF9, 0x48, 0x59, 0x41, 0xF9, 0xE9, 0x03, 0x17, 0x2A, 0x29, 0xF5, 0x7E, 0xD3}; -static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_send)[] = {0x2A1703EA, 0xD37EF54A, 0xF86A6ACA, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A09014A, 0xD2FFFFC9, 0xEB09015F, 0x54000060, 0xF94043EA, 0xF9415948, 0xF94053EA}; +static const instruction_t MAKE_KERNEL_HOOK_NAME(400, proc_id_send)[] = {0xF9403BED, 0x2A0E03EA, 0xD37EF54A, 0xF86A69AA, 0x92FFFFE9, 0x8A090148, 0xD2FFFFE9, 0x8A09014A, 0xD2FFFFC9, 0xEB09015F, 0x54000040, 0xF9415B28, 0xD503201F}; /* ldr x13, [sp,#0x70] mov w10, w14