Add 7.5x AIO fix

This commit is contained in:
Al Azif
2025-08-26 00:47:35 -07:00
parent 6dd2d4de4d
commit 7a510c7d37
6 changed files with 81 additions and 22 deletions

View File

@@ -63,12 +63,76 @@ static inline void restore(void *kbase, struct kexec_args *uap) {
}
}
// TODO:
__attribute__((always_inline))
static inline void patch_aio(void *kbase) {
disable_cr0_wp();
const u64 aio_off = 0xb20f5;
disable_cr0_wp();
// patch = {0xeb, 0x03}
write16(kbase, aio_off, 0x03eb);
// offset = 0x10e
// patch = {0xe9, 0xf2, 0xfe, 0xff, 0xff}
write32(kbase, aio_off + 0x10e, 0xfffef2e9);
write8(kbase, aio_off + 0x112, 0xff);
// offset = 0x5
// patch = {0x41, 0x83, 0xbe, 0xa0, 0x04, 0x00, 0x00, 0x00}
write64(kbase, aio_off + 0x5, 0x00000004a0be8341);
// offset = 0x13
// patch = {0x49, 0x8b, 0x86, 0xd0, 0x04, 0x00, 0x00}
write32(kbase, aio_off + 0x13, 0xd0868b49);
write16(kbase, aio_off + 0x17, 0x0004);
write8(kbase, aio_off + 0x19, 0x00);
// offset = 0x20
// patch = {0x49, 0x8b, 0xb6, 0xb0, 0x04, 0x00, 0x00}
write32(kbase, aio_off + 0x20, 0xb0b68b49);
write16(kbase, aio_off + 0x24, 0x0004);
write8(kbase, aio_off + 0x26, 0x00);
// offset = 0x38
// patch = {0x49, 0x8b, 0x86, 0x40, 0x05, 0x00, 0x00}
write32(kbase, aio_off + 0x38, 0x40868b49);
write16(kbase, aio_off + 0x3c, 0x0005);
write8(kbase, aio_off + 0x3e, 0x00);
// offset = 0x45
// patch = {0x49, 0x8b, 0xb6, 0x20, 0x05, 0x00, 0x00}
write32(kbase, aio_off + 0x45, 0x20b68b49);
write16(kbase, aio_off + 0x49, 0x0005);
write8(kbase, aio_off + 0x4b, 0x00);
// offset = 0x5d
// patch = {0x49, 0x8d, 0xBe, 0xc0, 0x00, 0x00, 0x00}
write32(kbase, aio_off + 0x5d, 0xc0be8d49);
write16(kbase, aio_off + 0x61, 0x0000);
write8(kbase, aio_off + 0x63, 0x00);
// offset = 0x69
// patch = {0x49, 0x8d, 0xbe, 0xe0, 0x00, 0x00, 0x00}
write32(kbase, aio_off + 0x69, 0xe0be8d49);
write16(kbase, aio_off + 0x6d, 0x0000);
write8(kbase, aio_off + 0x6f, 0x00);
// offset = 0x7c
// patch = {0x49, 0x8d, 0xbe, 0x00, 0x01, 0x00, 0x00}
write32(kbase, aio_off + 0x7c, 0x00be8d49);
write16(kbase, aio_off + 0x80, 0x0001);
write8(kbase, aio_off + 0x82, 0x00);
// offset = 0x88
// patch = {0x49, 0x8d, 0xbe, 0x20, 0x01, 0x00, 0x00}
write32(kbase, aio_off + 0x88, 0x20be8d49);
write16(kbase, aio_off + 0x8c, 0x0001);
write8(kbase, aio_off + 0x8e, 0x00);
// offset = 0x99
// patch = {0x4c, 0x89, 0xf7}
write16(kbase, aio_off + 0x99, 0x894c);
write8(kbase, aio_off + 0x9b, 0xf7);
enable_cr0_wp();
}