add kernel patches for 4.1.0

This commit is contained in:
Traiver 2018-06-17 11:00:42 +02:00 committed by GitHub
parent f41b780c0a
commit b211a7cf05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
}
}