Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Include/XPF/xpf.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdint.h>

#include <choma/Fat.h>
#include <choma/FAT.h>
#include <choma/Util.h>
#include <choma/PatchFinder.h>
#include <choma/PatchFinder_arm64.h>
Expand Down
2 changes: 1 addition & 1 deletion Include/choma/MachO.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <mach-o/fat.h>
#include <mach-o/loader.h>
#include "MemoryStream.h"
#include "Fat.h"
#include "FAT.h"
#include "DyldSharedCache.h"

typedef struct MachOSegment
Expand Down
7 changes: 7 additions & 0 deletions Plugins/IOKernelRW/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CC=clang
CFLAGS=-fPIC -shared
IPATH=-I../../Include
LDFLAGS=-L/Library/Extensions/IOKernelRW.kext/Contents/MacOS/ -lIOKernelRW

iokernelrw_krw_plugin.so: iokernelrw_krw_plugin.c
$(CC) $(CFLAGS) $(IPATH) $^ -o $@ $(LDFLAGS)
72 changes: 72 additions & 0 deletions Plugins/IOKernelRW/iokernelrw_krw_plugin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include <IOKit/IOKitLib.h>
#include <iokernelrw.h>
#include <mach/arm/kern_return.h>
#include <mach/kern_return.h>
#include <sys/errno.h>

#include "libkrw_plugin.h"

io_connect_t krw_client = IO_OBJECT_NULL;

int kread_wrapper(uint64_t from, void* to, size_t len)
{
kern_return_t result_read;
int result;

if (krw_client == IO_OBJECT_NULL)
{
krw_client = iokernelrw_open();
}

result_read = iokernelrw_read(krw_client, from, to, len);

if (result_read == KERN_SUCCESS)
{
result = 0;
}
else
{
result = EDEVERR;
}

return result;
}

int kwrite_wrapper(void* from, uint64_t to, size_t len)
{
kern_return_t result_write;
int result;

if (krw_client == IO_OBJECT_NULL)
{
krw_client = iokernelrw_open();
}

result_write = iokernelrw_write(krw_client, from, to, len);

if (result_write == KERN_SUCCESS)
{
result = 0;
}
else
{
result = EDEVERR;
}

return result;
}

int krw_plugin_initializer(krw_handlers_t handlers)
{
//handlers->version = TODO;
//handlers->kbase = TODO;
handlers->kread = kread_wrapper;
handlers->kwrite = kwrite_wrapper;
//handlers->kmalloc = TODO;
//handlers->kdealloc = TODO;
//handlers->kcall = TODO;
//handlers->physread = TODO;
//handlers->physwrite = TODO;

return 0;
}
3 changes: 3 additions & 0 deletions x8A4.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/

/* Include headers */
#include "Include/libkrw_plugin.h"
#include "Include/x8A4/Registry/registry.h"
#include "Include/x8A4/Services/services.h"
#include <x8A4/Logger/logger.h>
#include <x8A4/Kernel/osobject.h>
#include <x8A4/Kernel/nvram.h>
Expand Down