Skip to content

Commit 7c0520f

Browse files
Remove the size limit for memory read and write
Eliminate the maximum size restriction for uc_mem_read and uc_mem_write. This change is required to support applications, such as LLVM CFI, that map or unmap memory blocks with sizes equal to or greater than INT_MAX.
1 parent 7b8c63d commit 7c0520f

35 files changed

+317
-248
lines changed

bindings/dotnet/UnicornManaged/Binding/NativeBinding.fs renamed to bindings/dotnet/UnicornEngine/Binding/NativeBinding.fs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
namespace UnicornManaged.Binding
1+
namespace UnicornEngine.Binding
22

33
open System
44
open System.Runtime.InteropServices
55

66
module NativeBinding =
77

88
[<AutoOpen>]
9-
module private Imported =
9+
module private Imported =
1010

1111
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
1212
extern Int32 uc_version(UIntPtr major, UIntPtr minor)
1313

1414
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
15-
extern Int32 uc_open(UInt32 arch, UInt32 mode, UIntPtr[] engine)
15+
extern Int32 uc_open(UInt32 arch, UInt32 mode, UIntPtr[] engine)
1616

1717
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
18-
extern Int32 uc_close(UIntPtr eng)
18+
extern Int32 uc_close(UIntPtr eng)
1919

2020
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
21-
extern Int32 uc_mem_map(UIntPtr eng, UInt64 address, UIntPtr size, UInt32 perm)
21+
extern Int32 uc_mem_map(UIntPtr eng, UInt64 address, UInt64 size, UInt32 perm)
2222

2323
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
24-
extern Int32 uc_mem_map_ptr(UIntPtr eng, UInt64 address, UIntPtr size, UInt32 perm, UIntPtr ptr)
24+
extern Int32 uc_mem_map_ptr(UIntPtr eng, UInt64 address, UInt64 size, UInt32 perm, UIntPtr ptr)
2525

2626
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
27-
extern Int32 uc_mem_unmap(UIntPtr eng, UInt64 address, UIntPtr size)
27+
extern Int32 uc_mem_unmap(UIntPtr eng, UInt64 address, UInt64 size)
2828

2929
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
30-
extern Int32 uc_mem_protect(UIntPtr eng, UInt64 address, UIntPtr size, UInt32 perms)
31-
30+
extern Int32 uc_mem_protect(UIntPtr eng, UInt64 address, UInt64 size, UInt32 perms)
31+
3232
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
33-
extern Int32 uc_mem_write(UIntPtr eng, UInt64 address, Byte[] value, UIntPtr size)
33+
extern Int32 uc_mem_write(UIntPtr eng, UInt64 address, Byte[] value, UInt64 size)
3434

3535
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
36-
extern Int32 uc_mem_read(UIntPtr eng, UInt64 address, Byte[] value, UIntPtr size)
36+
extern Int32 uc_mem_read(UIntPtr eng, UInt64 address, Byte[] value, UInt64 size)
3737

3838
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)>]
3939
extern Int32 uc_reg_write(UIntPtr eng, Int32 regId, Byte[] value)
@@ -67,7 +67,7 @@ module NativeBinding =
6767

6868
[<DllImport("unicorn", CallingConvention = CallingConvention.Cdecl, EntryPoint = "uc_hook_add")>]
6969
extern Int32 uc_hook_add_arg0_arg1(UIntPtr eng, UIntPtr hh, Int32 callbackType, UIntPtr callback, IntPtr userData, UInt64 hookbegin, UInt64 hookend, UInt64 arg0, UInt64 arg1)
70-
70+
7171
let instance =
7272
{new IBinding with
7373
member thi.Version(major, minor) = uc_version(major, minor)
@@ -90,4 +90,4 @@ module NativeBinding =
9090
member thi.HookAddNoarg(eng, hh, callbackType, callback, userData, hookBegin, hookEnd) = uc_hook_add_noarg(eng, hh, callbackType, callback, userData, hookBegin, hookEnd)
9191
member thi.HookAddArg0(eng, hh, callbackType, callback, userData, hookBegin, hookEnd, arg0) = uc_hook_add_arg0(eng, hh, callbackType, callback, userData, hookBegin, hookEnd, arg0)
9292
member thi.HookAddArg0Arg1(eng, hh, callbackType, callback, userData, hookBegin, hookEnd, arg0, arg1) = uc_hook_add_arg0_arg1(eng, hh, callbackType, callback, userData, hookBegin, hookEnd, arg0, arg1)
93-
}
93+
}

0 commit comments

Comments
 (0)