mirror of
				https://github.com/yuzu-emu/unicorn.git
				synced 2025-11-04 15:34:56 +00:00 
			
		
		
		
	Initial changes to support use of const_generator.py
This commit is contained in:
		
							parent
							
								
									3f8370b4f8
								
							
						
					
					
						commit
						1a081c5ed8
					
				
							
								
								
									
										16
									
								
								bindings/const_generator.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										16
									
								
								bindings/const_generator.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| 
						 | 
					@ -36,6 +36,22 @@ template = {
 | 
				
			||||||
            'x86.h': 'x86',
 | 
					            'x86.h': 'x86',
 | 
				
			||||||
            'sparc.h': 'sparc',
 | 
					            'sparc.h': 'sparc',
 | 
				
			||||||
            'm68k.h': 'm68k',
 | 
					            'm68k.h': 'm68k',
 | 
				
			||||||
 | 
					            'unicorn.h': 'Unicorn',
 | 
				
			||||||
 | 
					            'comment_open': '//',
 | 
				
			||||||
 | 
					            'comment_close': '',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    'java': {
 | 
				
			||||||
 | 
					            'header': "// For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT\n\npackage unicorn;\n\npublic interface %sConst {\n",
 | 
				
			||||||
 | 
					            'footer': "\n}\n",
 | 
				
			||||||
 | 
					            'line_format': '   public static final int %s = %s;\n',
 | 
				
			||||||
 | 
					            'out_file': './java/unicorn/%sConst.java',
 | 
				
			||||||
 | 
					            # prefixes for constant filenames of all archs - case sensitive
 | 
				
			||||||
 | 
					            'arm.h': 'Arm',
 | 
				
			||||||
 | 
					            'arm64.h': 'Arm64',
 | 
				
			||||||
 | 
					            'mips.h': 'Mips',
 | 
				
			||||||
 | 
					            'x86.h': 'X86',
 | 
				
			||||||
 | 
					            'sparc.h': 'Sparc',
 | 
				
			||||||
 | 
					            'm68k.h': 'M68k',
 | 
				
			||||||
            'unicorn.h': 'unicorn',
 | 
					            'unicorn.h': 'unicorn',
 | 
				
			||||||
            'comment_open': '//',
 | 
					            'comment_open': '//',
 | 
				
			||||||
            'comment_close': '',
 | 
					            'comment_close': '',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								bindings/java/unicorn/Unicorn.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										3
									
								
								bindings/java/unicorn/Unicorn.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| 
						 | 
					@ -23,8 +23,7 @@ package unicorn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Unicorn implements UnicornArchs, UnicornModes, UnicornHooks,
 | 
					public class Unicorn implements UnicornConst, ArmConst, Arm64Const, M68kConst, SparcConst, MipsConst, X86Const { 
 | 
				
			||||||
                                ArmRegs, Arm64Regs, M68kRegs, SparcRegs, MipsRegs, X86Regs, X86Instructions { 
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // Scales to calculate timeout on microsecond unit
 | 
					   // Scales to calculate timeout on microsecond unit
 | 
				
			||||||
   // 1 second = 1000,000 microseconds
 | 
					   // 1 second = 1000,000 microseconds
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,34 +0,0 @@
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Java bindings for the Unicorn Emulator Engine
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright(c) 2015 Chris Eagle
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This program is free software; you can redistribute it and/or
 | 
					 | 
				
			||||||
modify it under the terms of the GNU General Public License
 | 
					 | 
				
			||||||
version 2 as published by the Free Software Foundation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This program is distributed in the hope that it will be useful,
 | 
					 | 
				
			||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					 | 
				
			||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					 | 
				
			||||||
GNU General Public License for more details.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You should have received a copy of the GNU General Public License
 | 
					 | 
				
			||||||
along with this program; if not, write to the Free Software
 | 
					 | 
				
			||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package unicorn;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface UnicornArchs {
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_ARM   = 1;      // ARM architecture (including Thumb, Thumb-2)
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_ARM64 = 2;      // ARM-64, also called AArch64
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_MIPS  = 3;      // Mips architecture
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_X86   = 4;      // X86 architecture (including x86 & x86-64)
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_PPC   = 5;      // PowerPC architecture
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_SPARC = 6;      // Sparc architecture
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_M68K  = 7;      // M68K architecture
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_MAX   = 8;
 | 
					 | 
				
			||||||
   public static final int UC_ARCH_ALL   = 0xFFFF; // All architectures - for uc_support()
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										71
									
								
								bindings/java/unicorn/UnicornConst.java
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										71
									
								
								bindings/java/unicorn/UnicornConst.java
									
									
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,71 @@
 | 
				
			||||||
 | 
					// For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unicorn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface UnicornConst {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   public static final int UC_API_MAJOR = 0;
 | 
				
			||||||
 | 
					   public static final int UC_API_MINOR = 9;
 | 
				
			||||||
 | 
					   public static final int UC_SECOND_SCALE = 1000000;
 | 
				
			||||||
 | 
					   public static final int UC_MILISECOND_SCALE = 1000;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_ARM = 1;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_ARM64 = 2;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_MIPS = 3;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_X86 = 4;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_PPC = 5;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_SPARC = 6;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_M68K = 7;
 | 
				
			||||||
 | 
					   public static final int UC_ARCH_MAX = 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   public static final int UC_MODE_LITTLE_ENDIAN = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   public static final int UC_MODE_ARM = 0;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_16 = 2;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_32 = 4;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_64 = 8;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_THUMB = 16;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MCLASS = 32;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_V8 = 64;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MICRO = 16;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MIPS3 = 32;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MIPS32R6 = 64;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_V9 = 16;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_QPX = 16;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_BIG_ENDIAN = 0x80000000;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MIPS32 = 4;
 | 
				
			||||||
 | 
					   public static final int UC_MODE_MIPS64 = 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   public static final int UC_ERR_OK = 0;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_OOM = 1;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_ARCH = 2;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_HANDLE = 3;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_UCH = 4;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MODE = 5;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_VERSION = 6;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MEM_READ = 7;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MEM_WRITE = 8;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_CODE_INVALID = 9;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_HOOK = 10;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_INSN_INVALID = 11;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MAP = 12;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MEM_WRITE_NW = 13;
 | 
				
			||||||
 | 
					   public static final int UC_ERR_MEM_READ_NR = 14;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_READ = 16;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_WRITE = 17;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_READ_WRITE = 18;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_WRITE_NW = 19;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_READ_NR = 20;
 | 
				
			||||||
 | 
					   public static final int UC_MEM_NX = 21;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_INTR = 32;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_INSN = 33;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_CODE = 34;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_BLOCK = 35;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_MEM_INVALID = 36;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_MEM_READ = 37;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_MEM_WRITE = 38;
 | 
				
			||||||
 | 
					   public static final int UC_HOOK_MEM_READ_WRITE = 39;
 | 
				
			||||||
 | 
					   public static final int UC_PROT_READ = 1;
 | 
				
			||||||
 | 
					   public static final int UC_PROT_WRITE = 2;
 | 
				
			||||||
 | 
					   public static final int UC_PROT_EXEC = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,20 +0,0 @@
 | 
				
			||||||
package unicorn;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface UnicornModes {
 | 
					 | 
				
			||||||
   public static final int UC_MODE_LITTLE_ENDIAN = 0;  // little-endian mode (default mode)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_ARM = 0;            // 32-bit ARM
 | 
					 | 
				
			||||||
   public static final int UC_MODE_16 = 1 << 1;        // 16-bit mode (X86)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_32 = 1 << 2;        // 32-bit mode (X86)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_64 = 1 << 3;        // 64-bit mode (X86; PPC)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_THUMB = 1 << 4;     // ARM's Thumb mode; including Thumb-2
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MCLASS = 1 << 5;    // ARM's Cortex-M series
 | 
					 | 
				
			||||||
   public static final int UC_MODE_V8 = 1 << 6;        // ARMv8 A32 encodings for ARM
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MICRO = 1 << 4;     // MicroMips mode (MIPS)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MIPS3 = 1 << 5;     // Mips III ISA
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MIPS32R6 = 1 << 6;  // Mips32r6 ISA
 | 
					 | 
				
			||||||
   public static final int UC_MODE_V9 = 1 << 4;        // SparcV9 mode (Sparc)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_QPX = 1 << 4;       // Quad Processing eXtensions mode (PPC)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_BIG_ENDIAN = 1 << 31;   // big-endian mode
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MIPS32 = UC_MODE_32;    // Mips32 ISA (Mips)
 | 
					 | 
				
			||||||
   public static final int UC_MODE_MIPS64 = UC_MODE_64;    // Mips64 ISA (Mips)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
		Reference in a new issue