prepare for source release, relicense
[ginge.git] / loader / patches.c
index 7d8cf97..4b1735e 100644 (file)
@@ -1,4 +1,9 @@
-// vim:shiftwidth=2:expandtab
+/*
+ * GINGE - GINGE Is Not Gp2x Emulator
+ * (C) notaz, 2010-2011
+ *
+ * This work is licensed under the MAME license, see COPYING file for details.
+ */
 #include <stdio.h>
 
 #include "header.h"
@@ -45,8 +50,25 @@ static const unsigned int sig_mask_sigaction[] = {
   0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000
 };
 
+static const unsigned int sig_execve[] = {
+  0xef90000b, 0xe1a04000, 0xe3700a01
+};
+#define sig_mask_execve sig_mask_all
+
+static const unsigned int sig_execve2[] = {
+  0xef90000b, 0xe3700a01, 0xe1a04000
+};
+#define sig_mask_execve2 sig_mask_all
+
+static const unsigned int sig_chdir[] = {
+  0xef90000c, 0xe3700a01, 0x312fff1e, 0xea0004bb
+};
+static const unsigned int sig_mask_chdir[] = {
+  0xffffffff, 0xffffffff, 0xffffffff, 0xff000000
+};
 
-#define PATCH(f) { sig_##f, sig_mask_##f, ARRAY_SIZE(sig_##f), w_##f }
+#define PATCH_(f,p) { sig_##p, sig_mask_##p, ARRAY_SIZE(sig_##p), w_##f }
+#define PATCH(f) PATCH_(f,f)
 
 static const struct {
   const unsigned int *sig;
@@ -60,6 +82,8 @@ static const struct {
   PATCH(read),
   PATCH(ioctl),
   PATCH(sigaction),
+//  PATCH_(execve, execve2), // hangs
+  PATCH(chdir),
 };
 
 void do_patches(void *ptr, unsigned int size)
@@ -96,3 +120,4 @@ found:
   sys_cacheflush(ptr, (char *)ptr + size);
 }
 
+// vim:shiftwidth=2:expandtab