Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
aquynh committed Nov 1, 2022
2 parents 896416b + e6da816 commit 3c53a64
Show file tree
Hide file tree
Showing 71 changed files with 1,349 additions and 667 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/PyPI-publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ jobs:
python-ver: '3.8',
name: 'manylinux2014_i686'
}
- {
os: ubuntu-latest,
arch: aarch64,
python-ver: '3.8',
name: 'manylinux2014_aarch64'
}
- {
os: ubuntu-latest,
arch: x64,
Expand Down Expand Up @@ -104,6 +110,10 @@ jobs:
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-x86 > ./dockcross
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh
elif [ ${{ matrix.config.name }} == 'manylinux2014_aarch64' ]; then
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-aarch64 > ./dockcross
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh --plat-name manylinux2014_aarch64
elif [ ${{ matrix.config.name }} == 'manylinux2014_x86_64' ]; then
docker run --rm -v `pwd`/:/work dockcross/manylinux2014-x64 > ./dockcross
chmod +x ./dockcross
Expand Down
62 changes: 31 additions & 31 deletions .github/workflows/build-uc2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,34 @@ jobs:
archiver: '7z a',
generators: 'Ninja'
}
- {
os: windows-2019,
arch: x64,
python-arch: x64,
python-ver: '3.8',
name: 'windows-x64 MINGW32 shared',
shared: "yes",
mingw: MINGW32,
mingw-arch: i686,
artifact: 'windows_mingw32.7z',
build_type: 'Debug',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: windows-2019,
arch: x64,
python-arch: x64,
python-ver: '3.8',
name: 'windows-x64 MINGW32 static',
shared: "no",
mingw: MINGW32,
mingw-arch: i686,
artifact: 'windows_mingw32.7z',
build_type: 'Debug',
archiver: '7z a',
generators: 'Ninja'
}
# - { # This fails randomly which can't be reproduced.
# os: windows-2019,
# arch: x64,
# python-arch: x64,
# python-ver: '3.8',
# name: 'windows-x64 MINGW32 shared',
# shared: "yes",
# mingw: MINGW32,
# mingw-arch: i686,
# artifact: 'windows_mingw32.7z',
# build_type: 'Debug',
# archiver: '7z a',
# generators: 'Ninja'
# }
# - { # This fails randomly which can't be reproduced.
# os: windows-2019,
# arch: x64,
# python-arch: x64,
# python-ver: '3.8',
# name: 'windows-x64 MINGW32 static',
# shared: "no",
# mingw: MINGW32,
# mingw-arch: i686,
# artifact: 'windows_mingw32.7z',
# build_type: 'Debug',
# archiver: '7z a',
# generators: 'Ninja'
# }
- {
os: windows-2019,
arch: x64,
Expand All @@ -95,7 +95,7 @@ jobs:
archiver: '7z a',
generators: 'Visual Studio 16 2019'
}
- {
- {
os: windows-2019,
arch: x86,
python-arch: x86,
Expand Down Expand Up @@ -328,9 +328,9 @@ jobs:
brew install p7zip cmake ninja
mkdir build
mkdir instdir
cmake . -DCMAKE_TOOLCHAIN_FILE="$ANDROID_HOME/ndk/21.4.7075529/build/cmake/android.toolchain.cmake" \
cmake . -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
-DANDROID_PLATFORM=android-28 \
-DANDROID_NDK="$ANDROID_HOME/ndk/21.4.7075529" \
-DANDROID_NDK="$ANDROID_NDK" \
-DANDROID_ABI=${{ matrix.config.arch }} \
-DOLP_SDK_ENABLE_TESTING=NO \
-DOLP_SDK_BUILD_EXAMPLES=ON \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
days-before-stale: 60
days-before-close: 15
exempt-all-milestones: true
exempt-issue-labels: 'pinned'
exempt-issue-labels: 'pinned,help wanted'
exempt-pr-labels: 'pinned'
35 changes: 25 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

cmake_minimum_required(VERSION 3.1)

if(MSVC)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
# set all policies to max supported by actual running cmake version
# mainly want the following:
# CMP0091: prevent msvcrt flags being added to default CMAKE_<LANG>_FLAGS_<CONFIG>
# CMP0092: prevent warning flags being added to default CMAKE_<LANG>_FLAGS
cmake_policy(VERSION ${CMAKE_VERSION})
else()
message(FATAL_ERROR "please update cmake")
endif()
# Only required for MSVC, but we can't know the compiler at this point because we haven't
# called enable_language() or project(), and if we did that it would lock in the old
# policy. Setting these policies is harmless for non-MSVC though, so just enable them
# always.
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
# Set explicitly the policies we want rather than raising the base to the current
# version. This prevents unintended behavior changes as CMake evolves and provides a
# consistent experience across different CMake versions.
# CMP0091: prevent msvcrt flags being added to default CMAKE_<LANG>_FLAGS_<CONFIG>
cmake_policy(SET CMP0091 NEW)
# CMP0092: prevent warning flags being added to default CMAKE_<LANG>_FLAGS for MSVC
cmake_policy(SET CMP0092 NEW)
endif()

# Workaround to fix wrong compiler on macos.
Expand All @@ -31,6 +33,13 @@ endif()

project(unicorn C)

# We depend on the availability of the CMAKE_MSVC_RUNTIME_LIBRARY, which is only
# available in CMake 3.15 and above (see also the comments above in regards to policy
# CMP0091).
if(MSVC AND CMAKE_VERSION VERSION_LESS "3.15")
message(FATAL_ERROR "Please update CMake to 3.15 or greater.")
endif()

# mainline qemu mostly just uses compiler default
set(CMAKE_C_STANDARD 11)

Expand Down Expand Up @@ -1403,6 +1412,9 @@ if(UNICORN_BUILD_TESTS)
add_executable(${TEST_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
)
target_compile_options(${TEST_FILE} PRIVATE
${UNICORN_COMPILE_OPTIONS}
)
target_link_libraries(${TEST_FILE} PRIVATE
${SAMPLES_LIB}
)
Expand All @@ -1412,6 +1424,9 @@ if(UNICORN_BUILD_TESTS)
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \"chmod +x /data/local/tmp/build/${TEST_FILE}\"\n")
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \'LD_LIBRARY_PATH=/data/local/tmp/build:$LD_LIBRARY_PATH /data/local/tmp/build/${TEST_FILE}\' || exit -1\n")
endif()
if (UNICORN_TARGET_ARCH STREQUAL "aarch64" OR UNICORN_TARGET_ARCH STREQUAL "ppc")
target_compile_definitions(${TEST_FILE} PRIVATE TARGET_READ_INLINED)
endif()
endforeach()
endif()

Expand Down
38 changes: 38 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
This file details the changelog of Unicorn Engine.

-------------------------------
[Version 2.0.1]: Nov 1st, 2022

Unicorn2 makes the first step to [Debian packages](https://tracker.debian.org/pkg/unicorn-engine) and [vcpkg](https://github.com/microsoft/vcpkg/pull/26101)! Thanks @roehling and @LilyWangL !

Features:

- Support building & running on BE hosts. #1710
- Fix and support `clang-cl` on Windows. #1687
- Fix python `sdist` and add aarch64 Linux wheels. Note `pip` can build Unicorn2 on M1 now!
- C# binding is refined and upgraded to .Net 6. #1723

Fix/Improvements:

- Various bindings improvements. #1723
- Improvements for tests. #1684 #1683 #1691 #1711
- Fail explicitly when VEX.L is set. #1658
- Fix endianness when writing PPC32 CR register. #1659
- Fix a bug in `uc_ctl_set_cpu_model` check.
- Fix Tricore PC not updating. #1668
- Fix the mapping not updated if users modify the mappings in the hooks.
- Handle pathological cases consistently. #1651
- Fix memory leaks in PPC target. #1680
- Fix memory leaks in Tricore target. #1681
- Fix MSVC handling in cmake. #1693
- Fix PC sync-ing problems for `UC_HOOK_BLOCK` hooks.
- Fix PC sync-ed twice when users request a soft restart.
- Prevent overflow with pre-allocated RAM blocks. #1712
- Add FPCR and FPSR registers #1722
- Fix ARM CPU state not deep copied.
- Fix PC not sync-ed for memory operation on aarch64.
- Exit invalid store operations early to avoid the target registers being overwritten.
- Improve the support for ARM BE32.

Thanks:

@roehling @LilyWangL @mrexodia @zachriggle @Yu3H0 @rhelmot @relapids @sh4w1 @TSRBerry

-------------------------------
[Version 2.0.0]: July 7th, 2022

Expand Down
22 changes: 13 additions & 9 deletions bindings/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ from source.

1. Compile the code

[Windows]
To compile the code open the UnicornSln.sln with Microsoft Visual
Studio 12 or with a newer version and just press Ctrl+Shift+B to build
the solution.

You need to have installed at least version 4.5 of the .NET framework.

[Linux]
TODO
You need to have at least version 5.0 of .NET installed.

1. Windows

To compile the code open the UnicornSln.sln with Microsoft Visual
Studio 12 or with a newer version and just press Ctrl+Shift+B to build
the solution.

2. Linux

To compile the code open a terminal in this directory
and enter the following command to build the solution:
`dotnet build`

2. Usage

Expand Down
41 changes: 0 additions & 41 deletions bindings/dotnet/UnicornManaged/AssemblyInfo.fs

This file was deleted.

4 changes: 1 addition & 3 deletions bindings/dotnet/UnicornManaged/Binding/BindingFactory.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
namespace UnicornManaged.Binding

open System

module BindingFactory =
let mutable _instance = NativeBinding.instance

let setDefaultBinding(binding: IBinding) =
_instance <- binding

let getDefault() =
_instance

6 changes: 5 additions & 1 deletion bindings/dotnet/UnicornManaged/Const/Arm64.fs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ module Arm64 =
let UC_ARM64_REG_VBAR_EL2 = 288
let UC_ARM64_REG_VBAR_EL3 = 289
let UC_ARM64_REG_CP_REG = 290
let UC_ARM64_REG_ENDING = 291

// floating point control and status registers
let UC_ARM64_REG_FPCR = 291
let UC_ARM64_REG_FPSR = 292
let UC_ARM64_REG_ENDING = 293

// alias registers
let UC_ARM64_REG_IP0 = 215
Expand Down
Loading

0 comments on commit 3c53a64

Please sign in to comment.