Commit Graph

356 Commits

Author SHA1 Message Date
mio
b8e19b6eef CI(release): Bump 2.1.2 2025-02-10 22:11:12 +08:00
Daniel Roethlisberger
e166cd93bb arm64 python: Avoid nested class in insn hook for 10x hook and 10% overall speedup (#2095)
* arm64 python: Avoid nested class in insn hook for 10x hook speedup

Promote CpReg to a module-level class to address unnecessary performance
reduction.  In a real-world use case tracing the emulation of real-world
machine code, this change reduces time spent in CpReg namedtuple
construction from 10% of overall time to below 1%, for a 10x speedup of
the insn hook itself, or a 10% overall speedup.  Measured using
cProfile, python 3.13.

* upgrade distro to 22.04

* revert to 22.04 for now

* also revert for wheels

---------

Co-authored-by: mio <mio@lazym.io>
2025-02-10 14:56:34 +08:00
@Antelox
9cfd5cfac3 - Improved the GitHub python binding workflow: (#2072)
- Added fullMode input in workflow_dispatch
    - Take decision whether to build either in debug or release mode and if to build for all python versions according to the commit message patterns
    - Set proper artifact names
    - Removed not needed steps
    - Compacted some steps in order to leverage more the matrix feature
    - Bumped cibuildwheel action to 2.22.0
    - Run actual regress tests in place of sample scripts
- Specify optional test install in pyproject.toml with proper requirements
- Derive package version from git tags
- Add GENERATORS env var support in setup.py to specify cmake generator and minor refactoring
- Minor cleanup/refactoring for the regress test suite
- Marked some regress tests with skipIf to skip them in case of old python versions
- Marked some failing regress tests to be checked with skipIf
2024-12-29 22:24:48 +08:00
Pedro Tôrres
2899088844 Allow Statically Linking in Go (#2067)
* unset -L and -rpath from CGO_LDFLAGS

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>

* allow go statically linking

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>

* fix setup.py

---------

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>
Co-authored-by: mio <mio@lazym.io>
2024-12-21 11:02:28 +08:00
9750d6e2fc QoL changes 2024-12-07 15:57:51 +08:00
@Antelox
f78a3f2f59 Python bindings: Fix editable install + Execute Python2.7 workflow tests (#2044)
* Python binding:
- Added missing `license` field in pyproject.toml file
- Fixed editable mode install and some more code cleanup in setup.py
- Refreshed README.md
- Replaced f-string formatter in tests with `format` method in order to be py2-compatible
- Fixed typos
- PEP8 fixes

* GitHub Action: Install Python2.7 and run tests for re-tagged wheels on native arch runners only

* Python bindings:
- Use #x formatter to format hex values
2024-12-07 14:52:21 +08:00
Martin Atkins
7d8fe2ab11 riscv: Expose privilege level as pseudo-register PRIV (#1989)
Unlike some other architectures, RISC-V does not expose the current
privilege mode in any architecturally-defined register. That is intentional
to make it easier to implement virtualization in software, but a Unicorn
caller operates outside of the emulated hart and so it can and should be
able to observe and change the current privilege mode in order to properly
emulate certain behaviors of a real CPU.

The current privilege level is therefore now exposed as a new
pseudo-register using the name "priv", which matches the name of the
virtual register used by RISC-V's debug extension to allow the debugger
to read and change the privilege mode while the hart is halted. Unicorn's
use of it is conceptually similar to a debugger.

The bit encoding of this register is the same as specified in RISC-V Debug
Specification v1.0-rc3 Section 4.10.1. It's defined as a "virtual"
register exposing a subset of fields from the dcsr register, although here
it's implemented directly inside the Unicorn code because QEMU doesn't
currently have explicit support for the CSRs from the debug specification.
If it supports "dcsr" in a future release then this implementation could
change to wrap reading and writing that CSR and then projecting the "prv"
and "v" bitfields into the correct locations for the virtual register.
2024-11-11 21:09:45 +08:00
Eli
957df0ec3a Fix TLB fill hook (#2042)
* Fix the TLB fill hook

* Add missing annotations
2024-10-25 20:22:53 +08:00
16916b2f1e Fix small typo 2024-10-19 16:32:43 +08:00
Eli
28ff8d8627 Hook tlb fill (#2037)
* Support TLB fill hooks

* Improve consistency among structure names
2024-10-18 23:22:04 +08:00
@Antelox
6fbbf3089a Python binding setup refactoring + cibuildwheel workflow (#2026)
* Python bindings: Make the test scripts handy for pytest

* Python bindings: Update MANIFEST.in with new paths

* Update .gitignore to exclude PyCharm-related files/folders

* Python bindings: Update CMakeLists.txt in order to set CMAKE_OSX_ARCHITECTURES var

* Python bindings:
- Moved project package settings to the new TOML format
- Refactored setup.py to cleanup/improve the code and make it ready for cibuildwheel
- Updated README.md with the package long description part
- Removed setup.cfg since universal wheel building will be deprecated soon

* Python bindings:
- Replaced old PyPI-publishing.yml workflow with brand-new one based on cibuildwheel
- Removed old building scripts

* Replaced macos-12 runner with macos-13 since it will be removed soon

* Python bindings: Specify SYSTEM_VERSION_COMPAT=0 env var for macos-13 x86_64 runner as per cibuildwheel warning message

* Python bindings: Enable i686 for debugging

* Python bindings: Enable DEBUG flag according to the presence of tag release

* Python bindings: Added matrix to cover i686 manylinux/musllinux builds

* Python bindings:
- Replaced macos-14 runner with macos-latest
- Bumped cibuildwheel GitHub action to 2.21.3 version

* Python bindings:
- Adapt test_uc_ctl_tb_cache test to the recent changes
- Fixed typos
- PEP8 fixes

* GitHub Action Workflow: Introduce BUILD_TYPE env var to select build type according to the presence of tag release

---------

Co-authored-by: mio <mio@lazym.io>
2024-10-17 19:35:42 +08:00
mio
7e32864774 Also include cmake directory in sdist 2024-10-13 16:34:25 +08:00
Eli
78580ca8f9 Python3 bindings improvements (#2024)
* Allow Uc subclasses to use additional constructor args

* Add missing conext reg write batch prorotype

* Sort uc prototypes for better readability

* Redefine internal C API structures

* Add ctypes alises to improve readability

* Added documentation for ctl methods

* Added ctl tcg buffer size accessors

* Fix tcg buffer size return type
2024-10-09 14:13:42 +08:00
Daniel Roethlisberger
26268e69af python: Fix assertion failure on ctl_flush_tb() (#2023) 2024-10-08 12:48:05 +08:00
Eli
ac4872be4c Support additional API on Python 3 bindings (#2016)
* Styling and commets fixes

* Add errno API support

* Improve OOP approach by adjusting the way reg types are selected

* Leverage new approach to deduplicate reg_read and reg_write code

* Adjust reg_read_batch

* Add support for reg_write_batch

* Adjust x86 MSR accessors

* Turn asserts into descriptive exceptions

* Improve comments and styling

* Fix ARM memcpy neon regression test

* Modify canonicals import

* Introduce ARM CP reg accessors
2024-10-06 23:14:03 +08:00
mio
07e67c6570 Remove gdb history 2024-10-02 16:03:57 +08:00
mio
91122b6a68 Fix compatibility of 3.8 2024-09-26 23:02:03 +08:00
mio
d568885d64 Re-add muls_wheel.sh
Thanks to @Antelox

Co-authored-by: @Antelox <anteloxrce@gmail.com>
2024-09-26 19:15:03 +08:00
mio
050f2fbcaf temp remove 2024-09-26 19:13:57 +08:00
mio
9e0addd682 Still add plat-name for Linux 2024-09-26 19:11:53 +08:00
mio
2ccdc08237 Fix musl build script 2024-09-26 18:47:20 +08:00
mio
867770c7ef Tag and release 2.1.1 2024-09-26 18:44:51 +08:00
mio
869968a96f Only publish when tagging 2024-09-26 18:13:43 +08:00
mio
08e14abf70 Remove hacks for bdist_wheel 2024-09-26 17:18:36 +08:00
mio
1e04dbf83b Remove pkg-packages 2024-09-26 17:15:53 +08:00
mio
67f08b1c27 Bump version and generate bindings 2024-09-21 23:00:57 +08:00
6c4a3fd84b Merge pull request #2005 from omer54463/dev
Add py.typed to the Python binding package
2024-09-21 23:00:41 +08:00
mio
78cb4affda Fix uccallback 2024-09-21 22:48:32 +08:00
Omer Lubin
5c7fa35b43 ADD py.typed 2024-09-21 00:05:48 +03:00
elicn
386e0ed575 Include networking auditing sample in script 2024-09-19 17:17:04 +03:00
elicn
5cc2d80916 Adjust import path to new path 2024-09-19 17:16:21 +03:00
elicn
f573356a8b Add initial support for batch operations 2024-09-19 17:15:24 +03:00
elicn
4471377b77 Styling fixes 2024-09-19 17:13:36 +03:00
elicn
754194c7e8 Improve documentation 2024-09-19 17:04:21 +03:00
elicn
2da154721b Remove repr surplus method 2024-09-19 17:00:33 +03:00
elicn
7deb613a3c Reduce namespace clutter 2024-09-19 16:58:03 +03:00
Bet4
abefcb2f89 Remove using of distutils (#1964)
* Remove using of distutils

* Upgrade setuptools to fix CI

* Use Python 3.7 in build_wheel.sh
2024-06-12 14:45:23 +08:00
mio
85b289d074 Use correct lib path 2024-04-30 18:06:30 +08:00
Nguyễn Anh Khoa
38091b3046 Add unicorn_py3 folder to setup.py (#1942)
* Add unicorn_py3 folder to setup.py

* Run sample in CI

* Fix pip install & py2 breakage

---------

Co-authored-by: mio <mio@lazym.io>
2024-04-28 00:11:05 +08:00
mio
4c4d582fcb Also add _repr_ for UcReg 2024-03-08 17:07:08 +08:00
mio
13f17e5b3f Apply repr for C structs 2024-03-08 16:48:31 +08:00
mio
dae2391bb0 Apply fix for linux2 2024-03-08 16:19:53 +08:00
mio
399f204787 Merge elicn's work 2024-03-08 16:16:12 +08:00
ba92f79c9e Merge pull request #1823 from unicorn-engine/restore-py2
[RFC] Restore py2 compatibility by using 2 files
2024-03-08 15:12:24 +08:00
d1da4de080 Merge pull request #1929 from xclusivor/master
Remove semicolons in python files
2024-03-08 15:10:58 +08:00
xclusivor
4a694d8a30 remove semicolons 2024-03-06 02:15:02 -05:00
3c89d0c3ce Fix ctl_remove_cache for python2 2023-08-09 14:11:21 +08:00
Matheus C. França
4fb4b3e4b0 Zig binding
* zig binding - sample added
* zig build CI
* split mingw (shared/static) CI/CD
* unicorn log added
* build C/C++ samples
2023-08-04 11:24:00 -03:00
elicn
0a876d30ea Allow setting CPU model on Uc initialization 2023-07-14 00:44:58 +03:00
elicn
cef2b3394d Fix MMIO hooks prototypes 2023-07-14 00:43:42 +03:00