Generated constants file via python script

This commit is contained in:
Antonio Parata 2015-10-14 16:34:10 +02:00
parent a45bc0c8cd
commit 59c3f1b315
9 changed files with 2387 additions and 2504 deletions

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,7 +7,8 @@ open System
[<AutoOpen>] [<AutoOpen>]
module Arm = module Arm =
// ARM registers // ARM registers
let UC_ARM_REG_INVALID = 0 let UC_ARM_REG_INVALID = 0
let UC_ARM_REG_APSR = 1 let UC_ARM_REG_APSR = 1
let UC_ARM_REG_APSR_NZCV = 2 let UC_ARM_REG_APSR_NZCV = 2
@ -140,7 +122,7 @@ module Arm =
let UC_ARM_REG_S31 = 110 let UC_ARM_REG_S31 = 110
let UC_ARM_REG_ENDING = 111 let UC_ARM_REG_ENDING = 111
// alias registers // alias registers
let UC_ARM_REG_R13 = 12 let UC_ARM_REG_R13 = 12
let UC_ARM_REG_R14 = 10 let UC_ARM_REG_R14 = 10
let UC_ARM_REG_R15 = 11 let UC_ARM_REG_R15 = 11
@ -148,3 +130,4 @@ module Arm =
let UC_ARM_REG_SL = 76 let UC_ARM_REG_SL = 76
let UC_ARM_REG_FP = 77 let UC_ARM_REG_FP = 77
let UC_ARM_REG_IP = 78 let UC_ARM_REG_IP = 78

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,6 +7,8 @@ open System
[<AutoOpen>] [<AutoOpen>]
module Arm64 = module Arm64 =
// ARM64 registers
let UC_ARM64_REG_INVALID = 0 let UC_ARM64_REG_INVALID = 0
let UC_ARM64_REG_X29 = 1 let UC_ARM64_REG_X29 = 1
let UC_ARM64_REG_X30 = 2 let UC_ARM64_REG_X30 = 2
@ -287,12 +270,13 @@ module Arm64 =
let UC_ARM64_REG_V30 = 258 let UC_ARM64_REG_V30 = 258
let UC_ARM64_REG_V31 = 259 let UC_ARM64_REG_V31 = 259
// pseudo registers // pseudo registers
let UC_ARM64_REG_PC = 260 let UC_ARM64_REG_PC = 260
let UC_ARM64_REG_ENDING = 261 let UC_ARM64_REG_ENDING = 261
// alias registers // alias registers
let UC_ARM64_REG_IP1 = 215 let UC_ARM64_REG_IP1 = 215
let UC_ARM64_REG_IP0 = 216 let UC_ARM64_REG_IP0 = 216
let UC_ARM64_REG_FP = 1 let UC_ARM64_REG_FP = 1
let UC_ARM64_REG_LR = 2 let UC_ARM64_REG_LR = 2

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -25,6 +6,7 @@ open System
[<AutoOpen>] [<AutoOpen>]
module Common = module Common =
let UC_API_MAJOR = 0 let UC_API_MAJOR = 0
let UC_API_MINOR = 9 let UC_API_MINOR = 9
let UC_SECOND_SCALE = 1000000 let UC_SECOND_SCALE = 1000000
@ -110,3 +92,4 @@ module Common =
let UC_PROT_WRITE = 2 let UC_PROT_WRITE = 2
let UC_PROT_EXEC = 4 let UC_PROT_EXEC = 4
let UC_PROT_ALL = 7 let UC_PROT_ALL = 7

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,7 +7,8 @@ open System
[<AutoOpen>] [<AutoOpen>]
module M68k = module M68k =
// M68K registers // M68K registers
let UC_M68K_REG_INVALID = 0 let UC_M68K_REG_INVALID = 0
let UC_M68K_REG_A0 = 1 let UC_M68K_REG_A0 = 1
let UC_M68K_REG_A1 = 2 let UC_M68K_REG_A1 = 2
@ -47,3 +29,4 @@ module M68k =
let UC_M68K_REG_SR = 17 let UC_M68K_REG_SR = 17
let UC_M68K_REG_PC = 18 let UC_M68K_REG_PC = 18
let UC_M68K_REG_ENDING = 19 let UC_M68K_REG_ENDING = 19

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,10 +7,11 @@ open System
[<AutoOpen>] [<AutoOpen>]
module Mips = module Mips =
// MIPS registers // MIPS registers
let UC_MIPS_REG_INVALID = 0 let UC_MIPS_REG_INVALID = 0
// General purpose registers // General purpose registers
let UC_MIPS_REG_PC = 1 let UC_MIPS_REG_PC = 1
let UC_MIPS_REG_0 = 2 let UC_MIPS_REG_0 = 2
let UC_MIPS_REG_1 = 3 let UC_MIPS_REG_1 = 3
@ -64,7 +46,7 @@ module Mips =
let UC_MIPS_REG_30 = 32 let UC_MIPS_REG_30 = 32
let UC_MIPS_REG_31 = 33 let UC_MIPS_REG_31 = 33
// DSP registers // DSP registers
let UC_MIPS_REG_DSPCCOND = 34 let UC_MIPS_REG_DSPCCOND = 34
let UC_MIPS_REG_DSPCARRY = 35 let UC_MIPS_REG_DSPCARRY = 35
let UC_MIPS_REG_DSPEFI = 36 let UC_MIPS_REG_DSPEFI = 36
@ -77,13 +59,13 @@ module Mips =
let UC_MIPS_REG_DSPPOS = 43 let UC_MIPS_REG_DSPPOS = 43
let UC_MIPS_REG_DSPSCOUNT = 44 let UC_MIPS_REG_DSPSCOUNT = 44
// ACC registers // ACC registers
let UC_MIPS_REG_AC0 = 45 let UC_MIPS_REG_AC0 = 45
let UC_MIPS_REG_AC1 = 46 let UC_MIPS_REG_AC1 = 46
let UC_MIPS_REG_AC2 = 47 let UC_MIPS_REG_AC2 = 47
let UC_MIPS_REG_AC3 = 48 let UC_MIPS_REG_AC3 = 48
// COP registers // COP registers
let UC_MIPS_REG_CC0 = 49 let UC_MIPS_REG_CC0 = 49
let UC_MIPS_REG_CC1 = 50 let UC_MIPS_REG_CC1 = 50
let UC_MIPS_REG_CC2 = 51 let UC_MIPS_REG_CC2 = 51
@ -93,7 +75,7 @@ module Mips =
let UC_MIPS_REG_CC6 = 55 let UC_MIPS_REG_CC6 = 55
let UC_MIPS_REG_CC7 = 56 let UC_MIPS_REG_CC7 = 56
// FPU registers // FPU registers
let UC_MIPS_REG_F0 = 57 let UC_MIPS_REG_F0 = 57
let UC_MIPS_REG_F1 = 58 let UC_MIPS_REG_F1 = 58
let UC_MIPS_REG_F2 = 59 let UC_MIPS_REG_F2 = 59
@ -135,7 +117,7 @@ module Mips =
let UC_MIPS_REG_FCC6 = 95 let UC_MIPS_REG_FCC6 = 95
let UC_MIPS_REG_FCC7 = 96 let UC_MIPS_REG_FCC7 = 96
// AFPR128 // AFPR128
let UC_MIPS_REG_W0 = 97 let UC_MIPS_REG_W0 = 97
let UC_MIPS_REG_W1 = 98 let UC_MIPS_REG_W1 = 98
let UC_MIPS_REG_W2 = 99 let UC_MIPS_REG_W2 = 99
@ -218,3 +200,4 @@ module Mips =
let UC_MIPS_REG_LO1 = 46 let UC_MIPS_REG_LO1 = 46
let UC_MIPS_REG_LO2 = 47 let UC_MIPS_REG_LO2 = 47
let UC_MIPS_REG_LO3 = 48 let UC_MIPS_REG_LO3 = 48

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,7 +7,8 @@ open System
[<AutoOpen>] [<AutoOpen>]
module Sparc = module Sparc =
// SPARC registers // SPARC registers
let UC_SPARC_REG_INVALID = 0 let UC_SPARC_REG_INVALID = 0
let UC_SPARC_REG_F0 = 1 let UC_SPARC_REG_F0 = 1
let UC_SPARC_REG_F1 = 2 let UC_SPARC_REG_F1 = 2
@ -119,3 +101,4 @@ module Sparc =
let UC_SPARC_REG_ENDING = 89 let UC_SPARC_REG_ENDING = 89
let UC_SPARC_REG_O6 = 84 let UC_SPARC_REG_O6 = 84
let UC_SPARC_REG_I6 = 67 let UC_SPARC_REG_I6 = 67

View file

@ -1,23 +1,4 @@
(* // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT
.NET bindings for the UnicornEngine Emulator Engine
Copyright(c) 2015 Antonio Parata
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.
*)
namespace UnicornEngine.Const namespace UnicornEngine.Const
@ -26,7 +7,8 @@ open System
[<AutoOpen>] [<AutoOpen>]
module X86 = module X86 =
// X86 registers // X86 registers
let UC_X86_REG_INVALID = 0 let UC_X86_REG_INVALID = 0
let UC_X86_REG_AH = 1 let UC_X86_REG_AH = 1
let UC_X86_REG_AL = 2 let UC_X86_REG_AL = 2
@ -271,7 +253,8 @@ module X86 =
let UC_X86_REG_R15W = 241 let UC_X86_REG_R15W = 241
let UC_X86_REG_ENDING = 242 let UC_X86_REG_ENDING = 242
// X86 instructions // X86 instructions
let UC_X86_INS_INVALID = 0 let UC_X86_INS_INVALID = 0
let UC_X86_INS_AAA = 1 let UC_X86_INS_AAA = 1
let UC_X86_INS_AAD = 2 let UC_X86_INS_AAD = 2
@ -1611,3 +1594,4 @@ module X86 =
let UC_X86_INS_FDISI8087_NOP = 1336 let UC_X86_INS_FDISI8087_NOP = 1336
let UC_X86_INS_FENI8087_NOP = 1337 let UC_X86_INS_FENI8087_NOP = 1337
let UC_X86_INS_ENDING = 1338 let UC_X86_INS_ENDING = 1338

View file

@ -39,7 +39,7 @@ and OutHook = delegate of Unicorn * Int32 * Int32 * Int32 * Object -> unit
and SyscallHook = delegate of Unicorn * Object -> unit and SyscallHook = delegate of Unicorn * Object -> unit
// the managed unicorn engine // the managed unicorn engine
and Unicorn(arch: UInt32, mode: UInt32) = and Unicorn(arch: Int32, mode: Int32) =
// hook callback list // hook callback list
let _codeHooks = new Dictionary<IntPtr, (CodeHook * Object)>() let _codeHooks = new Dictionary<IntPtr, (CodeHook * Object)>()
@ -70,7 +70,7 @@ and Unicorn(arch: UInt32, mode: UInt32) =
do do
let mem = Marshal.AllocHGlobal(IntPtr.Size) let mem = Marshal.AllocHGlobal(IntPtr.Size)
_eng <- [|new UIntPtr(mem.ToPointer())|] _eng <- [|new UIntPtr(mem.ToPointer())|]
let err = NativeUnicornEngine.uc_open(arch, mode, _eng) let err = NativeUnicornEngine.uc_open(uint32 arch, uint32 mode, _eng)
checkResult(err, "Unable to open the Unicorn Engine") checkResult(err, "Unable to open the Unicorn Engine")
member this.MemMap(address: UInt64, size: UIntPtr, perm: Int32) = member this.MemMap(address: UInt64, size: UIntPtr, perm: Int32) =

View file

@ -29,7 +29,7 @@ namespace UnicornTests
{ {
class Program class Program
{ {
private const Int64 ADDRESS = 0x1000000; private const UInt64 ADDRESS = 0x1000000;
private static Byte[] X86_CODE32_SELF = private static Byte[] X86_CODE32_SELF =
{ {
@ -57,13 +57,13 @@ namespace UnicornTests
} }
} }
private static Byte[] Int64ToBytes(Int64 intVal) private static Byte[] Int64ToBytes(UInt64 intVal)
{ {
var res = new Byte[8]; var res = new Byte[8];
for (var i = 0; i < res.Length; i++) for (var i = 0; i < res.Length; i++)
{ {
res[i] = (Byte)(intVal & 0xff); res[i] = (Byte)(intVal & 0xff);
intVal = (Int64)((UInt64)intVal >> 8); intVal = intVal >> 8;
} }
return res; return res;
} }
@ -146,7 +146,7 @@ namespace UnicornTests
static void Main(String[] args) static void Main(String[] args)
{ {
var u = new Unicorn((UInt32)Common.UC_ARCH_X86, (UInt32)Common.UC_MODE_32); var u = new Unicorn(Common.UC_ARCH_X86, Common.UC_MODE_32);
Console.WriteLine("Unicorn version: {0}", u.Version()); Console.WriteLine("Unicorn version: {0}", u.Version());
// map 2MB of memory for this emulation // map 2MB of memory for this emulation
@ -168,7 +168,7 @@ namespace UnicornTests
Console.WriteLine(">>> Start tracing linux code"); Console.WriteLine(">>> Start tracing linux code");
// emulate machine code in infinite time // emulate machine code in infinite time
u.EmuStart(ADDRESS, (UInt64)(ADDRESS + X86_CODE32_SELF.Length), 0u, new UIntPtr(0)); u.EmuStart(ADDRESS, ADDRESS + (UInt64)X86_CODE32_SELF.Length, 0u, new UIntPtr(0));
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(">>> Emulation Done!"); Console.WriteLine(">>> Emulation Done!");