From 4871727ac307337bc1d9178c1f106973697067bf Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Fri, 21 Jun 2024 23:29:49 +0200 Subject: [PATCH] Update icicle-emu to the latest version --- .github/workflows/CI.yml | 2 +- Cargo.lock | 419 ++++++++++++++++++++++++-------------- Cargo.toml | 6 +- icicle-emu | 2 +- python/icicle/__init__.py | 7 +- python/icicle/icicle.pyi | 9 +- src/lib.rs | 56 ++--- tests/example.py | 6 +- 8 files changed, 312 insertions(+), 195 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d7d543e..b1787c2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -76,7 +76,7 @@ jobs: DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer MACOSX_DEPLOYMENT_TARGET: '10.9' ARCHFLAGS: -arch x86_64 -arch arm64 - PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib + PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib run: | pip install -r requirements.txt python setup.py bdist_wheel --py-limited-api=cp37 diff --git a/Cargo.lock b/Cargo.lock index 4b80d95..a86521a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "cpp_demangle", "fallible-iterator", @@ -25,26 +25,33 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" [[package]] name = "autocfg" @@ -60,15 +67,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bstr" -version = "1.6.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -82,15 +89,15 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" @@ -109,9 +116,9 @@ dependencies = [ [[package]] name = "cranelift" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2cadd7dd6dea80b783985c0f18f0eb611c71940a517d7b179f83cc8814674fc" +checksum = "c31bcc3beea0c0bd94c3281ad625ed5a320380078014d15cb046c7bdd563dfb4" dependencies = [ "cranelift-codegen", "cranelift-frontend", @@ -119,18 +126,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1380172556902242d32f78ed08c98aac4f5952aef22d3684aed5c66a5db0a6fc" +checksum = "ebf72ceaf38f7d41194d0cf6748214d8ef7389167fe09aad80f87646dbfa325b" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037cca234e1ad0766fdfe43b527ec14e100414b4ccf4bb614977aa9754958f57" +checksum = "9ee7fde5cd9173f00ce02c491ee9e306d64740f4b1a697946e0474f389999e13" dependencies = [ "bumpalo", "cranelift-bforest", @@ -140,7 +147,7 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.13.2", + "hashbrown 0.14.5", "log", "regalloc2", "smallvec", @@ -149,39 +156,39 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d375e6afa8b9a304999ea8cf58424414b8e55e004571265a4f0826eba8b74f18" +checksum = "b49bec6a517e78d4067500dc16acb558e772491a2bcb37301127448adfb8413c" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca590e72ccb8da963def6e36460cce4412032b1f03c31d1a601838d305abdc39" +checksum = "ead4ea497b2dc2ac31fcabd6d5d0d5dc25b3964814122e343724bdf65a53c843" [[package]] name = "cranelift-control" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2d38eea4373639f4b6236a40f69820fed16c5511093cd3783bf8491a93d9cf" +checksum = "f81e8028c8d711ea7592648e70221f2e54acb8665f7ecd49545f021ec14c3341" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3173c1434af23c00e4964722cf93ca8f0e6287289bf5d52110597c3ba2ea09" +checksum = "32acd0632ba65c2566e75f64af9ef094bb8d90e58a9fbd33d920977a9d85c054" [[package]] name = "cranelift-frontend" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec4a3a33825062eccf6eec73e852c8773220f6e4798925e19696562948beb1f" +checksum = "a395a704934aa944ba8939cac9001174b9ae5236f48bc091f89e33bb968336f6" dependencies = [ "cranelift-codegen", "log", @@ -191,15 +198,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5146b5cea4b21095a021d964b0174cf6ff5530f83e8d0a822683c7559e360b66" +checksum = "b325ce81c4ee7082dc894537eb342c37898e14230fe7c02ea945691db3e2dd01" [[package]] name = "cranelift-jit" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c780229af3fd7e9bce9f71db15165835b979bdb97b844f16adb9c5645ca7ebcf" +checksum = "5840f54fc4b65854222339c834f3e01c329488cd12901c0dda8f69f82df6dcb2" dependencies = [ "anyhow", "cranelift-codegen", @@ -212,14 +219,14 @@ dependencies = [ "region", "target-lexicon", "wasmtime-jit-icache-coherence", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "cranelift-module" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bb4aef44ff8979eccc7196b0af67fd8d51e9e0ac80e5b9046b7750215edbeb" +checksum = "0a86ed143dc1ba89a513fa8d9fb443c3e36fa9a2e5f64d7431765ea8f9e6f5c1" dependencies = [ "anyhow", "cranelift-codegen", @@ -228,9 +235,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.98.1" +version = "0.107.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cec3717ce554d3936b2101aa8eae1a2a410bd6da0f4df698a4b008fe9cf1e9" +checksum = "ea11f5ac85996fa093075d66397922d4f56085d5d84ec13043d0cd4f159c6818" dependencies = [ "cranelift-codegen", "libc", @@ -252,11 +259,38 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "flate2" @@ -270,9 +304,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", "indexmap", @@ -281,9 +315,9 @@ dependencies = [ [[package]] name = "half" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ "cfg-if", "crunchy", @@ -291,28 +325,38 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", + "allocator-api2", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "icicle-cpu" version = "0.1.0" dependencies = [ "addr2line", - "bitflags 2.4.0", + "bitflags 2.5.0", "bytemuck", "half", - "hashbrown 0.13.2", + "hashbrown 0.14.5", "icicle-mem", "object", "pcode", @@ -335,13 +379,14 @@ dependencies = [ "pcode", "target-lexicon", "tracing", + "wasmtime-jit-debug", ] [[package]] name = "icicle-linux" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.5.0", "bstr", "bytemuck", "icicle-cpu", @@ -395,19 +440,19 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "equivalent", + "hashbrown 0.14.5", ] [[package]] name = "indoc" -version = "1.0.9" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "lazy_static" @@ -417,9 +462,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -451,9 +502,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" @@ -466,9 +517,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -494,13 +545,13 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "crc32fast", "flate2", - "hashbrown 0.13.2", + "hashbrown 0.14.5", "indexmap", "memchr", "ruzstd", @@ -508,9 +559,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "overload" @@ -551,20 +602,26 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.19.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38" +checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" dependencies = [ "cfg-if", "indexmap", @@ -572,6 +629,7 @@ dependencies = [ "libc", "memoffset", "parking_lot", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -580,9 +638,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.19.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5" +checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" dependencies = [ "once_cell", "target-lexicon", @@ -590,9 +648,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.19.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9" +checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" dependencies = [ "libc", "pyo3-build-config", @@ -600,32 +658,34 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.19.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1" +checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "pyo3-macros-backend" -version = "0.19.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536" +checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" dependencies = [ + "heck", "proc-macro2", + "pyo3-build-config", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -641,9 +701,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b4dcbd3a2ae7fb94b5813fa0e957c6ab51bf5d0a8ee1b69e0c2d0f1e6eb8485" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ "hashbrown 0.13.2", "log", @@ -676,14 +736,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "ruzstd" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a15e661f0f9dac21f3494fe5d23a6338c0ac116a2d22c2b63010acd89467ffe" +checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" dependencies = [ "byteorder", - "thiserror", + "derive_more", "twox-hash", ] @@ -695,9 +768,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -716,13 +789,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn", ] [[package]] @@ -739,6 +812,9 @@ name = "sleigh-compile" version = "0.3.0" dependencies = [ "pcode", + "serde", + "serde-xml-rs", + "serde_derive", "sleigh-parse", "sleigh-runtime", ] @@ -781,20 +857,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" dependencies = [ "proc-macro2", "quote", @@ -803,9 +868,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "thiserror" @@ -824,7 +889,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn", ] [[package]] @@ -839,11 +904,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -851,20 +915,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -913,9 +977,9 @@ checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unindent" -version = "0.1.11" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "valuable" @@ -929,15 +993,37 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wasmtime-jit-debug" +version = "19.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92de34217bf7f0464262adf391a9950eba440f9dfc7d3b0e3209302875c6f65f" +dependencies = [ + "object", + "rustix", + "wasmtime-versioned-export-macros", +] + [[package]] name = "wasmtime-jit-icache-coherence" -version = "11.0.1" +version = "20.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cf02fedda287a409cff80ad40a7c6c0f0771e99b0cd5e2b79d9cb7ecdc1b2f4" +checksum = "ede45379f3b4d395d8947006de8043801806099a240a26db553919b68e96ab15" dependencies = [ "cfg-if", "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "19.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffaafa5c12355b1a9ee068e9295d50c4ca0a400c721950cdae4f5b54391a2da5" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -973,11 +1059,11 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.52.5", ] [[package]] @@ -997,17 +1083,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1018,9 +1105,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -1030,9 +1117,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -1042,9 +1129,15 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -1054,9 +1147,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -1066,9 +1159,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -1078,9 +1171,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -1090,12 +1183,32 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "xml-rs" version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 432e7bd..20350b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,11 @@ icicle-cpu = { path = "icicle-emu/icicle-cpu" } icicle-vm = { path = "icicle-emu/icicle-vm" } pcode = { path = "icicle-emu/sleigh/pcode" } sleigh-runtime = { path = "icicle-emu/sleigh/sleigh-runtime" } -indexmap = "1.9.3" -pyo3 = { version = "0.19.2", features = ["extension-module", "indexmap", "abi3-py37"] } +indexmap = "2.2.6" +pyo3 = { version = "0.21.2", features = ["extension-module", "indexmap", "abi3-py37"] } target-lexicon = "0.12.7" tracing = "*" tracing-subscriber = "0.3.17" [build-dependencies] -pyo3-build-config = "0.19.2" +pyo3-build-config = "0.21.2" diff --git a/icicle-emu b/icicle-emu index 4dcd48c..0acbf76 160000 --- a/icicle-emu +++ b/icicle-emu @@ -1 +1 @@ -Subproject commit 4dcd48ca698204d1864440b015b13b135d9d7bab +Subproject commit 0acbf76a49d01c14bb10eef66a8661ae1d9d70d7 diff --git a/python/icicle/__init__.py b/python/icicle/__init__.py index 8e7dbe1..5fb47c3 100644 --- a/python/icicle/__init__.py +++ b/python/icicle/__init__.py @@ -1,16 +1,17 @@ from .icicle import * -class MemoryError(Exception): - def __init__(self, message, code): +class MemoryException(Exception): + def __init__(self, message: str, code: MemoryExceptionCode): super().__init__(message) self.code = code + def __str__(self): return f"{super().__str__()}: {self.code}" def __ghidra_init(): import os for path in __path__ + [os.getenv("GHIDRA_SRC", ".")]: - processors_dir = os.path.join(path, "Ghidra/Processors") + processors_dir = os.path.join(path, "Ghidra", "Processors") if os.path.isdir(processors_dir): os.putenv("GHIDRA_SRC", path) os.environ["GHIDRA_SRC"] = path diff --git a/python/icicle/icicle.pyi b/python/icicle/icicle.pyi index 2446f4c..fbb3900 100644 --- a/python/icicle/icicle.pyi +++ b/python/icicle/icicle.pyi @@ -9,9 +9,10 @@ class MemoryProtection(Enum): ExecuteRead = ... ExecuteReadWrite = ... -class MemoryErrorCode(Enum): +class MemoryExceptionCode(Enum): Unallocated = ... Unmapped = ... + UnmappedRegisters = ... Uninitialized = ... ReadViolation = ... WriteViolation = ... @@ -43,7 +44,7 @@ class ExceptionCode(Enum): Sleep = ... Syscall = ... CpuStateChanged = ... - DivideByZero = ... + DivisionException = ... ReadUnmapped = ... ReadPerm = ... ReadUnaligned = ... @@ -71,11 +72,9 @@ class ExceptionCode(Enum): Environment = ... JitError = ... InternalError = ... + UnmappedRegister = ... UnknownError = ... -class MemoryError(Exception): - code: MemoryErrorCode - class Icicle: def __init__(self, architecture: str, *, jit = True, diff --git a/src/lib.rs b/src/lib.rs index df22802..2e892c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,9 +60,10 @@ enum RunStatus { } #[pyclass(module = "icicle")] -enum MemoryErrorCode { +enum MemoryExceptionCode { Unallocated, Unmapped, + UnmappedRegister, Uninitialized, ReadViolation, WriteViolation, @@ -76,22 +77,23 @@ enum MemoryErrorCode { Unknown, } -impl From for MemoryErrorCode { +impl From for MemoryExceptionCode { fn from(value: MemError) -> Self { match value { - MemError::Unallocated => MemoryErrorCode::Unallocated, - MemError::Unmapped => MemoryErrorCode::Unmapped, - MemError::Uninitalized => MemoryErrorCode::Uninitialized, - MemError::ReadViolation => MemoryErrorCode::ReadViolation, - MemError::WriteViolation => MemoryErrorCode::WriteViolation, - MemError::ExecViolation => MemoryErrorCode::ExecViolation, - MemError::ReadWatch => MemoryErrorCode::ReadWatch, - MemError::WriteWatch => MemoryErrorCode::WriteWatch, - MemError::Unaligned => MemoryErrorCode::Unaligned, - MemError::OutOfMemory => MemoryErrorCode::OutOfMemory, - MemError::SelfModifyingCode => MemoryErrorCode::SelfModifyingCode, - MemError::AddressOverflow => MemoryErrorCode::AddressOverflow, - MemError::Unknown => MemoryErrorCode::Unknown, + MemError::Unallocated => MemoryExceptionCode::Unallocated, + MemError::Unmapped => MemoryExceptionCode::Unmapped, + MemError::UnmappedRegister => MemoryExceptionCode::UnmappedRegister, + MemError::Uninitalized => MemoryExceptionCode::Uninitialized, + MemError::ReadViolation => MemoryExceptionCode::ReadViolation, + MemError::WriteViolation => MemoryExceptionCode::WriteViolation, + MemError::ExecViolation => MemoryExceptionCode::ExecViolation, + MemError::ReadWatch => MemoryExceptionCode::ReadWatch, + MemError::WriteWatch => MemoryExceptionCode::WriteWatch, + MemError::Unaligned => MemoryExceptionCode::Unaligned, + MemError::OutOfMemory => MemoryExceptionCode::OutOfMemory, + MemError::SelfModifyingCode => MemoryExceptionCode::SelfModifyingCode, + MemError::AddressOverflow => MemoryExceptionCode::AddressOverflow, + MemError::Unknown => MemoryExceptionCode::Unknown, } } } @@ -108,7 +110,7 @@ enum ExceptionCodePy { Syscall = 0x0101, CpuStateChanged = 0x0102, - DivideByZero = 0x0103, + DivisionException = 0x0103, ReadUnmapped = 0x0201, ReadPerm = 0x0202, @@ -144,6 +146,7 @@ enum ExceptionCodePy { JitError = 0x3001, InternalError = 0x3002, + UnmappedRegister = 0x3003, UnknownError, } @@ -158,7 +161,7 @@ impl From for ExceptionCodePy { ExceptionCode::SoftwareBreakpoint => ExceptionCodePy::SoftwareBreakpoint, ExceptionCode::Syscall => ExceptionCodePy::Syscall, ExceptionCode::CpuStateChanged => ExceptionCodePy::CpuStateChanged, - ExceptionCode::DivideByZero => ExceptionCodePy::DivideByZero, + ExceptionCode::DivisionException => ExceptionCodePy::DivisionException, ExceptionCode::ReadUnmapped => ExceptionCodePy::ReadUnmapped, ExceptionCode::ReadPerm => ExceptionCodePy::ReadPerm, ExceptionCode::ReadUnaligned => ExceptionCodePy::ReadUnaligned, @@ -187,17 +190,18 @@ impl From for ExceptionCodePy { ExceptionCode::Environment => ExceptionCodePy::Environment, ExceptionCode::JitError => ExceptionCodePy::JitError, ExceptionCode::InternalError => ExceptionCodePy::InternalError, + ExceptionCode::UnmappedRegister => ExceptionCodePy::UnmappedRegister, ExceptionCode::UnknownError => ExceptionCodePy::UnknownError, } } } #[allow(non_snake_case)] -fn raise_MemoryError(message: String, e: MemError) -> PyErr { +fn raise_MemoryException(message: String, e: MemError) -> PyErr { Python::with_gil(|py| { let icicle = py.import("icicle").unwrap(); - let exception = icicle.getattr("MemoryError").unwrap(); - let args = (message, MemoryErrorCode::from(e)); + let exception = icicle.getattr("MemoryException").unwrap(); + let args = (message, MemoryExceptionCode::from(e)); let inst = exception.call1(args).unwrap(); PyErr::from_value(inst) }) @@ -361,7 +365,7 @@ impl Icicle { Ok(()) } else { Err( - raise_MemoryError( + raise_MemoryException( format!("Failed to map memory {address:X}[{size:X}]"), MemError::Unknown, ) @@ -374,7 +378,7 @@ impl Icicle { Ok(()) } else { Err( - raise_MemoryError( + raise_MemoryException( format!("Failed to unmap memory {address:X}[{size:X}]"), MemError::Unknown, ) @@ -385,7 +389,7 @@ impl Icicle { fn mem_protect(&mut self, address: u64, size: usize, protection: MemoryProtection) -> PyResult<()> { self.vm.cpu.mem.update_perm(address, size as u64, convert_protection(protection)) .map_err(|e| { - raise_MemoryError( + raise_MemoryException( format!("Failed to protect memory {address:X}[{size:X}]"), e, ) @@ -401,7 +405,7 @@ impl Icicle { // Read the memory self.vm.cpu.mem.read_bytes(address, &mut buffer[..], perm::NONE) .map_err(|e| { - raise_MemoryError( + raise_MemoryException( format!("Failed to read memory {address:X}[{size:X}]"), e, ) @@ -413,7 +417,7 @@ impl Icicle { let size = data.len(); self.vm.cpu.mem.write_bytes(address, &data[..], perm::NONE) .map_err(|e| { - raise_MemoryError( + raise_MemoryException( format!("Failed to write memory {address:X}[{size:X}]"), e, ) @@ -508,7 +512,7 @@ fn icicle(_: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(architectures, m)?)?; m.add_class::()?; m.add_class::()?; - m.add_class::()?; + m.add_class::()?; m.add_class::()?; m.add_class::()?; Ok(()) diff --git a/tests/example.py b/tests/example.py index eaaf3ad..69d366a 100644 --- a/tests/example.py +++ b/tests/example.py @@ -49,12 +49,12 @@ def old_test(): vm.mem_map(addr, 0x1000, icicle.MemoryProtection.NoAccess) try: vm.mem_protect(addr, 0x2000, icicle.MemoryProtection.ExecuteRead) - except icicle.MemoryError as x: - print("MemoryError working!") + except icicle.MemoryException as x: + print("MemoryException working!") message = x.args[0] print(message, x.code) except Exception as x: - print(x, type(x), isinstance(x, icicle.MemoryError)) + print(x, type(x), isinstance(x, icicle.MemoryException)) vm.mem_protect(addr, 0x1000, icicle.MemoryProtection.ExecuteRead) vm.mem_write(addr, b"\x90\x90\x90") data = vm.mem_read(addr, 4)