Skip to content

Commit

Permalink
Updating with upstream pongoOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
woachk committed Mar 21, 2020
1 parent bdf39bc commit 4ebe9c5
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 482 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -6,7 +6,7 @@ ifndef $(HOST_OS)
endif
endif

PONGO_VERSION := 1.0.3-$(shell git log -1 --pretty=format:"%H" | cut -c1-8)
PONGO_VERSION := 1.1.0-$(shell git log -1 --pretty=format:"%H" | cut -c1-8)
ROOT := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
SRC := $(ROOT)/src
INC := $(ROOT)/include
Expand Down
510 changes: 328 additions & 182 deletions src/drivers/xnu/xnu.c

Large diffs are not rendered by default.

291 changes: 16 additions & 275 deletions src/drivers/xnu/xnu.s
Expand Up @@ -92,7 +92,7 @@ pf_jit_iter_loop_iter_load8_start:
mov w26, w27
ldrb w27, [x19], #1
cmp x19, x28
b.hi Lnext162
b.hi Lnext82
pf_jit_iter_loop_iter_load8_end:
nop
Lnext82:
Expand Down Expand Up @@ -243,290 +243,31 @@ pf_jit_ptr_comparison_slowpath:
pf_jit_ptr_comparison_next:


.globl pf_jit_mask_comparison_1_start
.globl pf_jit_mask_comparison_1_end

.align 3
pf_jit_mask_comparison_1_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_1_next
ldr x0, pf_jit_mask_comparison_1_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_1_slowpath
blr x4
b pf_jit_mask_comparison_1_next
.align 3
pf_jit_mask_comparison_1_end:

pf_jit_mask_comparison_1_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_1_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_1_next:


.globl pf_jit_mask_comparison_2_start
.globl pf_jit_mask_comparison_2_end

.align 3
pf_jit_mask_comparison_2_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_2_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_2_next
ldr x0, pf_jit_mask_comparison_2_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_2_slowpath
blr x4
b pf_jit_mask_comparison_2_next
pf_jit_mask_comparison_2_end:

pf_jit_mask_comparison_2_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_2_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_2_next:

.globl pf_jit_mask_comparison_3_start
.globl pf_jit_mask_comparison_3_end
.globl pf_jit_slowpath_start
.globl pf_jit_slowpath_end
.globl pf_jit_slowpath_next

.align 3
pf_jit_mask_comparison_3_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_3_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_3_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_3_next
ldr x0, pf_jit_mask_comparison_3_patch
pf_jit_slowpath_start:
ldr x0, pf_jit_slowpath_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_3_slowpath
ldr x4, pf_jit_slowpath_slowpath
blr x4
b pf_jit_mask_comparison_3_next
pf_jit_mask_comparison_3_end:

pf_jit_mask_comparison_3_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_3_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_3_next:

.globl pf_jit_mask_comparison_4_start
.globl pf_jit_mask_comparison_4_end

.align 3
pf_jit_mask_comparison_4_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_4_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_4_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_4_next
and x8, x23, x7
cmp x8, x6
b.ne pf_jit_mask_comparison_4_next
ldr x0, pf_jit_mask_comparison_4_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_4_slowpath
blr x4
b pf_jit_mask_comparison_4_next
.align 3
pf_jit_mask_comparison_4_end:

pf_jit_mask_comparison_4_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_4_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_4_next:

.globl pf_jit_mask_comparison_5_start
.globl pf_jit_mask_comparison_5_end

.align 3
pf_jit_mask_comparison_5_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_5_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_5_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_5_next
and x8, x23, x7
cmp x8, x6
b.ne pf_jit_mask_comparison_5_next
and x8, x24, x10
cmp x8, x9
b.ne pf_jit_mask_comparison_5_next
ldr x0, pf_jit_mask_comparison_5_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_5_slowpath
blr x4
b pf_jit_mask_comparison_5_next
.align 3
pf_jit_mask_comparison_5_end:

pf_jit_mask_comparison_5_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_5_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_5_next:


.globl pf_jit_mask_comparison_6_start
.globl pf_jit_mask_comparison_6_end

.align 3
pf_jit_mask_comparison_6_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_6_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_6_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_6_next
and x8, x23, x7
cmp x8, x6
b.ne pf_jit_mask_comparison_6_next
and x8, x24, x10
cmp x8, x9
b.ne pf_jit_mask_comparison_6_next
and x8, x25, x12
cmp x8, x11
b.ne pf_jit_mask_comparison_6_next
ldr x0, pf_jit_mask_comparison_6_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_6_slowpath
blr x4
b pf_jit_mask_comparison_6_next
.align 3
pf_jit_mask_comparison_6_end:

pf_jit_mask_comparison_6_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_6_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_6_next:


.globl pf_jit_mask_comparison_7_start
.globl pf_jit_mask_comparison_7_end

.align 3
pf_jit_mask_comparison_7_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_7_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_7_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_7_next
and x8, x23, x7
cmp x8, x6
b.ne pf_jit_mask_comparison_7_next
and x8, x24, x10
cmp x8, x9
b.ne pf_jit_mask_comparison_7_next
and x8, x25, x12
cmp x8, x11
b.ne pf_jit_mask_comparison_7_next
and x8, x26, x14
cmp x8, x13
b.ne pf_jit_mask_comparison_7_next
ldr x0, pf_jit_mask_comparison_7_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_7_slowpath
blr x4
b pf_jit_mask_comparison_7_next
nop
nop
nop
nop
b pf_jit_slowpath_next
.align 3
pf_jit_mask_comparison_7_end:
pf_jit_slowpath_end:

pf_jit_mask_comparison_7_patch:
pf_jit_slowpath_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_7_slowpath:
pf_jit_slowpath_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_7_next:

pf_jit_slowpath_next:

.globl pf_jit_mask_comparison_8_start
.globl pf_jit_mask_comparison_8_end

.align 3
pf_jit_mask_comparison_8_start:
and x8, x20, x1
cmp x8, x0
b.ne pf_jit_mask_comparison_8_next
and x8, x21, x3
cmp x8, x2
b.ne pf_jit_mask_comparison_8_next
and x8, x22, x5
cmp x8, x4
b.ne pf_jit_mask_comparison_8_next
and x8, x23, x7
cmp x8, x6
b.ne pf_jit_mask_comparison_8_next
and x8, x24, x10
cmp x8, x9
b.ne pf_jit_mask_comparison_8_next
and x8, x25, x12
cmp x8, x11
b.ne pf_jit_mask_comparison_8_next
and x8, x26, x14
cmp x8, x13
b.ne pf_jit_mask_comparison_8_next
and x8, x27, x16
cmp x8, x15
b.ne pf_jit_mask_comparison_8_next
ldr x0, pf_jit_mask_comparison_8_patch
mov w1, w29
sub x2, x19, x29
mov x3, x2
ldr x4, pf_jit_mask_comparison_8_slowpath
blr x4
b pf_jit_mask_comparison_8_next
.align 3
pf_jit_mask_comparison_8_end:

pf_jit_mask_comparison_8_patch:
.quad 0x4141414142424200
pf_jit_mask_comparison_8_slowpath:
.quad 0x4141414142424201
pf_jit_mask_comparison_8_next:

.globl pf_jit_mask_comparison_8_next
.globl pf_jit_mask_comparison_7_next
.globl pf_jit_mask_comparison_6_next
.globl pf_jit_mask_comparison_5_next
.globl pf_jit_mask_comparison_4_next
.globl pf_jit_mask_comparison_3_next
.globl pf_jit_mask_comparison_2_next
.globl pf_jit_mask_comparison_1_next
.globl pf_jit_ptr_comparison_next
6 changes: 6 additions & 0 deletions src/dynamic/modload.c
Expand Up @@ -44,7 +44,11 @@ void *__memcpy_chk (void *dest, const void * src, size_t n, size_t dest_len) {
void printf32(const char* str, uint32_t val) {
iprintf(str,val);
}

struct pongo_exports public_api[] = {
EXPORT_SYMBOL(xnu_pf_apply_each_kext),
EXPORT_SYMBOL(xnu_pf_get_first_kext),
EXPORT_SYMBOL(xnu_pf_get_kext_header),
EXPORT_SYMBOL(xnu_pf_disable_patch),
EXPORT_SYMBOL(xnu_pf_enable_patch),
EXPORT_SYMBOL(xnu_pf_ptr_to_data),
Expand All @@ -63,6 +67,8 @@ struct pongo_exports public_api[] = {
EXPORT_SYMBOL(xnu_pf_maskmatch),
EXPORT_SYMBOL(xnu_pf_emit),
EXPORT_SYMBOL(xnu_pf_apply),
EXPORT_SYMBOL(macho_get_segment),
EXPORT_SYMBOL(macho_get_section),
EXPORT_SYMBOL(dt_check),
EXPORT_SYMBOL(dt_parse),
EXPORT_SYMBOL(dt_find),
Expand Down
4 changes: 2 additions & 2 deletions src/kernel/lowlevel.c
Expand Up @@ -583,10 +583,10 @@ OBFUSCATE_C_FUNC(void lowlevel_setup(uint64_t phys_off, uint64_t phys_size))

if (get_el() == 1) {
set_vbar_el1((uint64_t)&exception_vector);
enable_mmu_el1((uint64_t)ttbr0, 0x130802a00 | (tg0 << 14) | t0sz, 0xff04, 5);
enable_mmu_el1((uint64_t)ttbr0, 0x130802a00 | (tg0 << 14) | t0sz, 0xbb04, 5);
} else {
set_vbar_el3((uint64_t)&exception_vector);
enable_mmu_el3((uint64_t)ttbr0, 0x12a00 | (tg0 << 14) | t0sz, 0xff04);
enable_mmu_el3((uint64_t)ttbr0, 0x12a00 | (tg0 << 14) | t0sz, 0xbb04);
}
}

Expand Down

0 comments on commit 4ebe9c5

Please sign in to comment.