From 80124c6810166e46fed8d1fce82e05022540ae75 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Wed, 26 Aug 2026 13:53:56 -0600 Subject: [PATCH] =?UTF-8?q?feat(decomp):=20main=20=E2=80=94=20=C2=A7295=20?= =?UTF-8?q?kernel-trap=20template=20sweep:=20ResetEntryInt,=20HookEntryInt?= =?UTF-8?q?,=20read,=20SysEnqIntRP=20banked=20(4=20fns,=2016=20ins)=20via?= =?UTF-8?q?=20gate=5Fmain=20clean=20rebuild,=20main=20SHA=20143dbb89=20byt?= =?UTF-8?q?e-identical=20(P31=20T1,=20frontier-s61=20addendum)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/800c3.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/800c3.c b/src/800c3.c index 900ae7730..e726233ae 100644 --- a/src/800c3.c +++ b/src/800c3.c @@ -133,9 +133,27 @@ __asm__( "nop\n" ); -INCLUDE_ASM("asm/nonmatchings/800c3", ResetEntryInt); +/* §295 kernel-trap trampoline: A/B/C dispatch vector in $t2, syscall # in the jr delay slot; + * unreachable from C (§179-C) -> file-scope verbatim asm (§265 form 1). Pad nop is load-bearing (stride 0x10). */ +__asm__(".text\n.align 2\n.globl ResetEntryInt\n.ent\tResetEntryInt\n" + "ResetEntryInt:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n" + ".set\tnoreorder\n" + "addiu $t2, $zero, 176\n" + "jr $t2\n" + "addiu $t1, $zero, 24\n" + "nop\n" + ".set\treorder\n.end\tResetEntryInt\n"); -INCLUDE_ASM("asm/nonmatchings/800c3", HookEntryInt); +/* §295 kernel-trap trampoline: A/B/C dispatch vector in $t2, syscall # in the jr delay slot; + * unreachable from C (§179-C) -> file-scope verbatim asm (§265 form 1). Pad nop is load-bearing (stride 0x10). */ +__asm__(".text\n.align 2\n.globl HookEntryInt\n.ent\tHookEntryInt\n" + "HookEntryInt:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n" + ".set\tnoreorder\n" + "addiu $t2, $zero, 176\n" + "jr $t2\n" + "addiu $t1, $zero, 25\n" + "nop\n" + ".set\treorder\n.end\tHookEntryInt\n"); void func_8005CF08(void) { __asm__ volatile( @@ -153,7 +171,16 @@ void func_8005CF18() { ); } -INCLUDE_ASM("asm/nonmatchings/800c3", read); +/* §295 kernel-trap trampoline: A/B/C dispatch vector in $t2, syscall # in the jr delay slot; + * unreachable from C (§179-C) -> file-scope verbatim asm (§265 form 1). Pad nop is load-bearing (stride 0x10). */ +__asm__(".text\n.align 2\n.globl read\n.ent\tread\n" + "read:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n" + ".set\tnoreorder\n" + "addiu $t2, $zero, 176\n" + "jr $t2\n" + "addiu $t1, $zero, 52\n" + "nop\n" + ".set\treorder\n.end\tread\n"); __asm__(".text\n.align 2\n.globl write\n.ent\twrite\n" "write:\n.frame $sp,0,$31\n" @@ -836,7 +863,16 @@ __asm__( "nop\n" ); -INCLUDE_ASM("asm/nonmatchings/800c3", SysEnqIntRP); +/* §295 kernel-trap trampoline: A/B/C dispatch vector in $t2, syscall # in the jr delay slot; + * unreachable from C (§179-C) -> file-scope verbatim asm (§265 form 1). Pad nop is load-bearing (stride 0x10). */ +__asm__(".text\n.align 2\n.globl SysEnqIntRP\n.ent\tSysEnqIntRP\n" + "SysEnqIntRP:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n" + ".set\tnoreorder\n" + "addiu $t2, $zero, 192\n" + "jr $t2\n" + "addiu $t1, $zero, 2\n" + "nop\n" + ".set\treorder\n.end\tSysEnqIntRP\n"); __asm__( ".text\n"