MochaLite/ios_mcp/source/main.c

36 lines
817 B
C
Raw Normal View History

2016-12-12 19:31:02 +01:00
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "wupserver.h"
#include "ipc.h"
2016-12-12 19:31:02 +01:00
#include "svc.h"
#include "text.h"
#include "../../common/kernel_commands.h"
2016-12-12 19:31:02 +01:00
static int threadsStarted = 0;
2016-12-12 19:31:02 +01:00
int _startMainThread(void)
2016-12-12 19:31:02 +01:00
{
if(threadsStarted == 0)
{
threadsStarted = 1;
wupserver_init();
ipc_init();
}
return 0;
2016-12-12 19:31:02 +01:00
}
void patch_SD_access_check(void) {
__asm__ volatile(
".thumb\n"
//clobbered instructions
"add r0, r7, r2\n"
//app.permissions.r2.mask seems to be 0xFFFFFFFFFFFFFFFF for every application
"ldr r1, =0x32\n"
"sub r3, r3, #7\n"
"strb r1, [r3]\n"
//this instruction was also clobbered but we use r1 so we do it after our patch stuff
"movs r1, #0\n"
"bx lr");
}