initial support for PPC
diff --git a/cs.c b/cs.c
index 58de52f..47fa14b 100644
--- a/cs.c
+++ b/cs.c
@@ -13,7 +13,7 @@
 
 #include "utils.h"
 
-void (*arch_init[MAX_ARCH])(cs_struct *) = { NULL };
+cs_err (*arch_init[MAX_ARCH])(cs_struct *) = { NULL };
 cs_err (*arch_option[MAX_ARCH]) (cs_struct*, cs_opt_type, size_t value);
 
 unsigned int all_arch = 0;
@@ -33,7 +33,8 @@
 {
 	if (arch == CS_ARCH_ALL)
 		return all_arch == ((1 << CS_ARCH_ARM) | (1 << CS_ARCH_ARM64) |
-				(1 << CS_ARCH_MIPS) | (1 << CS_ARCH_X86));
+				(1 << CS_ARCH_MIPS) | (1 << CS_ARCH_X86) |
+				(1 << CS_ARCH_PPC));
 
 	return all_arch & (1 << arch);
 }
@@ -90,6 +91,7 @@
 		case CS_ARCH_ARM:
 		case CS_ARCH_MIPS:
 		case CS_ARCH_ARM64:
+		case CS_ARCH_PPC:
 			free(ud->printer_info);
 			break;
 		default:	// unsupported architecture
@@ -197,8 +199,7 @@
 
 	while (size > 0) {
 		MCInst_Init(&mci);
-		mci.detail = handle->detail;
-		mci.mode = handle->mode;
+		mci.csh = handle;
 
 		bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info);
 		if (r) {
@@ -397,6 +398,11 @@
 				if (insn->detail->mips.operands[i].type == op_type)
 					count++;
 			break;
+		case CS_ARCH_PPC:
+			for (i = 0; i < insn->detail->ppc.op_count; i++)
+				if (insn->detail->ppc.operands[i].type == op_type)
+					count++;
+			break;
 	}
 
 	return count;
@@ -449,6 +455,14 @@
 					return i;
 			}
 			break;
+		case CS_ARCH_PPC:
+			for (i = 0; i < insn->detail->ppc.op_count; i++) {
+				if (insn->detail->ppc.operands[i].type == op_type)
+					count++;
+				if (count == post)
+					return i;
+			}
+			break;
 	}
 
 	return -1;