├── .github └── workflows │ └── rust.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── ChangeLog.md ├── LICENCE ├── README.md ├── cpu_rec_corpus ├── #6502#cc65.corpus ├── 6502.corpus ├── 68HC08.corpus ├── 68HC11.corpus ├── 8051.corpus ├── ARC32eb.corpus ├── ARC32el.corpus ├── ARM64.corpus ├── ARMeb.corpus ├── ARMel.corpus ├── ARMhf.corpus ├── ARcompact.corpus ├── AVR.corpus ├── Alpha.corpus ├── AxisCris.corpus ├── Blackfin.corpus ├── CLIPPER.corpus ├── CUDA.corpus ├── Cell-SPU.corpus ├── CompactRISC.corpus ├── Cray.corpus ├── Epiphany.corpus ├── FR-V.corpus ├── FR30.corpus ├── FT32.corpus ├── H8-300.corpus ├── H8S.corpus ├── HP-Focus.corpus ├── HP-PA.corpus ├── IA-64.corpus ├── IQ2000.corpus ├── M32C.corpus ├── M32R.corpus ├── M68k.corpus ├── M88k.corpus ├── MCore.corpus ├── MIPS16.corpus ├── MIPSeb.corpus ├── MIPSel.corpus ├── MMIX.corpus ├── MN10300.corpus ├── MSP430.corpus ├── Mico32.corpus ├── MicroBlaze.corpus ├── Moxie.corpus ├── NDS32.corpus ├── NIOS-II.corpus ├── OCaml.corpus ├── PDP-11.corpus ├── PIC10.corpus ├── PIC16.corpus ├── PIC18.corpus ├── PIC24.corpus ├── PPCeb.corpus ├── PPCel.corpus ├── RISC-V.corpus ├── RL78.corpus ├── ROMP.corpus ├── RX.corpus ├── S-390.corpus ├── SPARC.corpus ├── STM8.corpus ├── Stormy16.corpus ├── SuperH.corpus ├── TILEPro.corpus ├── TLCS-90.corpus ├── TMS320C2x.corpus ├── TMS320C6x.corpus ├── TriMedia.corpus ├── V850.corpus ├── VAX.corpus ├── Visium.corpus ├── WASM.corpus ├── WE32000.corpus ├── X86-64.corpus ├── X86.corpus ├── Xtensa.corpus ├── XtensaEB.corpus ├── Z80.corpus ├── _mask1.corpus ├── _ones.corpus ├── _words.corpus ├── _words_ucs2.corpus ├── _zero.corpus ├── i860.corpus └── xmos_xs2a.corpus └── src ├── corpus.rs └── main.rs /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Build 20 | run: cargo build --verbose 21 | - name: Run tests 22 | run: cargo test --verbose 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .vscode -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "anstream" 7 | version = "0.6.18" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" 10 | dependencies = [ 11 | "anstyle", 12 | "anstyle-parse", 13 | "anstyle-query", 14 | "anstyle-wincon", 15 | "colorchoice", 16 | "is_terminal_polyfill", 17 | "utf8parse", 18 | ] 19 | 20 | [[package]] 21 | name = "anstyle" 22 | version = "1.0.10" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" 25 | 26 | [[package]] 27 | name = "anstyle-parse" 28 | version = "0.2.6" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" 31 | dependencies = [ 32 | "utf8parse", 33 | ] 34 | 35 | [[package]] 36 | name = "anstyle-query" 37 | version = "1.1.2" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" 40 | dependencies = [ 41 | "windows-sys 0.59.0", 42 | ] 43 | 44 | [[package]] 45 | name = "anstyle-wincon" 46 | version = "3.0.7" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" 49 | dependencies = [ 50 | "anstyle", 51 | "once_cell", 52 | "windows-sys 0.59.0", 53 | ] 54 | 55 | [[package]] 56 | name = "anyhow" 57 | version = "1.0.97" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" 60 | 61 | [[package]] 62 | name = "assert_approx_eq" 63 | version = "1.1.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "3c07dab4369547dbe5114677b33fbbf724971019f3818172d59a97a61c774ffd" 66 | 67 | [[package]] 68 | name = "autocfg" 69 | version = "1.4.0" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 72 | 73 | [[package]] 74 | name = "bitflags" 75 | version = "2.9.0" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" 78 | 79 | [[package]] 80 | name = "byteorder" 81 | version = "1.5.0" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 84 | 85 | [[package]] 86 | name = "cfg-if" 87 | version = "1.0.0" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 90 | 91 | [[package]] 92 | name = "clap" 93 | version = "4.4.18" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" 96 | dependencies = [ 97 | "clap_builder", 98 | ] 99 | 100 | [[package]] 101 | name = "clap_builder" 102 | version = "4.4.18" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" 105 | dependencies = [ 106 | "anstream", 107 | "anstyle", 108 | "clap_lex", 109 | "strsim", 110 | ] 111 | 112 | [[package]] 113 | name = "clap_lex" 114 | version = "0.6.0" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" 117 | 118 | [[package]] 119 | name = "colorchoice" 120 | version = "1.0.3" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" 123 | 124 | [[package]] 125 | name = "colored" 126 | version = "2.2.0" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" 129 | dependencies = [ 130 | "lazy_static", 131 | "windows-sys 0.59.0", 132 | ] 133 | 134 | [[package]] 135 | name = "cpu_rec_rs" 136 | version = "1.0.1" 137 | dependencies = [ 138 | "anyhow", 139 | "assert_approx_eq", 140 | "clap", 141 | "glob", 142 | "log", 143 | "rand", 144 | "simple_logger", 145 | "tablestream", 146 | ] 147 | 148 | [[package]] 149 | name = "crossterm" 150 | version = "0.28.1" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" 153 | dependencies = [ 154 | "bitflags", 155 | "crossterm_winapi", 156 | "mio", 157 | "parking_lot", 158 | "rustix", 159 | "signal-hook", 160 | "signal-hook-mio", 161 | "winapi", 162 | ] 163 | 164 | [[package]] 165 | name = "crossterm_winapi" 166 | version = "0.9.1" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" 169 | dependencies = [ 170 | "winapi", 171 | ] 172 | 173 | [[package]] 174 | name = "deranged" 175 | version = "0.3.11" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" 178 | dependencies = [ 179 | "powerfmt", 180 | ] 181 | 182 | [[package]] 183 | name = "errno" 184 | version = "0.3.10" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 187 | dependencies = [ 188 | "libc", 189 | "windows-sys 0.59.0", 190 | ] 191 | 192 | [[package]] 193 | name = "getrandom" 194 | version = "0.2.15" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 197 | dependencies = [ 198 | "cfg-if", 199 | "libc", 200 | "wasi", 201 | ] 202 | 203 | [[package]] 204 | name = "glob" 205 | version = "0.3.2" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" 208 | 209 | [[package]] 210 | name = "is_terminal_polyfill" 211 | version = "1.70.1" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 214 | 215 | [[package]] 216 | name = "itoa" 217 | version = "1.0.15" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" 220 | 221 | [[package]] 222 | name = "lazy_static" 223 | version = "1.5.0" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 226 | 227 | [[package]] 228 | name = "libc" 229 | version = "0.2.170" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" 232 | 233 | [[package]] 234 | name = "linux-raw-sys" 235 | version = "0.4.15" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" 238 | 239 | [[package]] 240 | name = "lock_api" 241 | version = "0.4.12" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 244 | dependencies = [ 245 | "autocfg", 246 | "scopeguard", 247 | ] 248 | 249 | [[package]] 250 | name = "log" 251 | version = "0.4.26" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" 254 | 255 | [[package]] 256 | name = "mio" 257 | version = "1.0.3" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" 260 | dependencies = [ 261 | "libc", 262 | "log", 263 | "wasi", 264 | "windows-sys 0.52.0", 265 | ] 266 | 267 | [[package]] 268 | name = "num-conv" 269 | version = "0.1.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 272 | 273 | [[package]] 274 | name = "num_threads" 275 | version = "0.1.7" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" 278 | dependencies = [ 279 | "libc", 280 | ] 281 | 282 | [[package]] 283 | name = "once_cell" 284 | version = "1.20.3" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" 287 | 288 | [[package]] 289 | name = "parking_lot" 290 | version = "0.12.3" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 293 | dependencies = [ 294 | "lock_api", 295 | "parking_lot_core", 296 | ] 297 | 298 | [[package]] 299 | name = "parking_lot_core" 300 | version = "0.9.10" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 303 | dependencies = [ 304 | "cfg-if", 305 | "libc", 306 | "redox_syscall", 307 | "smallvec", 308 | "windows-targets 0.52.6", 309 | ] 310 | 311 | [[package]] 312 | name = "powerfmt" 313 | version = "0.2.0" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 316 | 317 | [[package]] 318 | name = "ppv-lite86" 319 | version = "0.2.20" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 322 | dependencies = [ 323 | "zerocopy", 324 | ] 325 | 326 | [[package]] 327 | name = "proc-macro2" 328 | version = "1.0.94" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" 331 | dependencies = [ 332 | "unicode-ident", 333 | ] 334 | 335 | [[package]] 336 | name = "quote" 337 | version = "1.0.39" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801" 340 | dependencies = [ 341 | "proc-macro2", 342 | ] 343 | 344 | [[package]] 345 | name = "rand" 346 | version = "0.8.5" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 349 | dependencies = [ 350 | "libc", 351 | "rand_chacha", 352 | "rand_core", 353 | ] 354 | 355 | [[package]] 356 | name = "rand_chacha" 357 | version = "0.3.1" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 360 | dependencies = [ 361 | "ppv-lite86", 362 | "rand_core", 363 | ] 364 | 365 | [[package]] 366 | name = "rand_core" 367 | version = "0.6.4" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 370 | dependencies = [ 371 | "getrandom", 372 | ] 373 | 374 | [[package]] 375 | name = "redox_syscall" 376 | version = "0.5.10" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" 379 | dependencies = [ 380 | "bitflags", 381 | ] 382 | 383 | [[package]] 384 | name = "rustix" 385 | version = "0.38.44" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" 388 | dependencies = [ 389 | "bitflags", 390 | "errno", 391 | "libc", 392 | "linux-raw-sys", 393 | "windows-sys 0.59.0", 394 | ] 395 | 396 | [[package]] 397 | name = "scopeguard" 398 | version = "1.2.0" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 401 | 402 | [[package]] 403 | name = "serde" 404 | version = "1.0.218" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" 407 | dependencies = [ 408 | "serde_derive", 409 | ] 410 | 411 | [[package]] 412 | name = "serde_derive" 413 | version = "1.0.218" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" 416 | dependencies = [ 417 | "proc-macro2", 418 | "quote", 419 | "syn", 420 | ] 421 | 422 | [[package]] 423 | name = "signal-hook" 424 | version = "0.3.17" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" 427 | dependencies = [ 428 | "libc", 429 | "signal-hook-registry", 430 | ] 431 | 432 | [[package]] 433 | name = "signal-hook-mio" 434 | version = "0.2.4" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" 437 | dependencies = [ 438 | "libc", 439 | "mio", 440 | "signal-hook", 441 | ] 442 | 443 | [[package]] 444 | name = "signal-hook-registry" 445 | version = "1.4.2" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 448 | dependencies = [ 449 | "libc", 450 | ] 451 | 452 | [[package]] 453 | name = "simple_logger" 454 | version = "4.3.3" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1" 457 | dependencies = [ 458 | "colored", 459 | "log", 460 | "time", 461 | "windows-sys 0.48.0", 462 | ] 463 | 464 | [[package]] 465 | name = "smallvec" 466 | version = "1.14.0" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" 469 | 470 | [[package]] 471 | name = "strsim" 472 | version = "0.10.0" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 475 | 476 | [[package]] 477 | name = "syn" 478 | version = "2.0.99" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2" 481 | dependencies = [ 482 | "proc-macro2", 483 | "quote", 484 | "unicode-ident", 485 | ] 486 | 487 | [[package]] 488 | name = "tablestream" 489 | version = "0.1.4" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "c8e352eabc3bef24a85c360ba6b8900bc04bafa83756d7fc418af0e31f8b390d" 492 | dependencies = [ 493 | "crossterm", 494 | "unicode-truncate", 495 | "unicode-width", 496 | ] 497 | 498 | [[package]] 499 | name = "time" 500 | version = "0.3.39" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" 503 | dependencies = [ 504 | "deranged", 505 | "itoa", 506 | "libc", 507 | "num-conv", 508 | "num_threads", 509 | "powerfmt", 510 | "serde", 511 | "time-core", 512 | "time-macros", 513 | ] 514 | 515 | [[package]] 516 | name = "time-core" 517 | version = "0.1.3" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" 520 | 521 | [[package]] 522 | name = "time-macros" 523 | version = "0.2.20" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" 526 | dependencies = [ 527 | "num-conv", 528 | "time-core", 529 | ] 530 | 531 | [[package]] 532 | name = "unicode-ident" 533 | version = "1.0.18" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 536 | 537 | [[package]] 538 | name = "unicode-truncate" 539 | version = "0.2.0" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "a04be5ca5f7a4a7270ffea82bc41c59b87c611ed04f20e77c338e8d3c2348e42" 542 | dependencies = [ 543 | "unicode-width", 544 | ] 545 | 546 | [[package]] 547 | name = "unicode-width" 548 | version = "0.1.14" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 551 | 552 | [[package]] 553 | name = "utf8parse" 554 | version = "0.2.2" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 557 | 558 | [[package]] 559 | name = "wasi" 560 | version = "0.11.0+wasi-snapshot-preview1" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 563 | 564 | [[package]] 565 | name = "winapi" 566 | version = "0.3.9" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 569 | dependencies = [ 570 | "winapi-i686-pc-windows-gnu", 571 | "winapi-x86_64-pc-windows-gnu", 572 | ] 573 | 574 | [[package]] 575 | name = "winapi-i686-pc-windows-gnu" 576 | version = "0.4.0" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 579 | 580 | [[package]] 581 | name = "winapi-x86_64-pc-windows-gnu" 582 | version = "0.4.0" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 585 | 586 | [[package]] 587 | name = "windows-sys" 588 | version = "0.48.0" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 591 | dependencies = [ 592 | "windows-targets 0.48.5", 593 | ] 594 | 595 | [[package]] 596 | name = "windows-sys" 597 | version = "0.52.0" 598 | source = "registry+https://github.com/rust-lang/crates.io-index" 599 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 600 | dependencies = [ 601 | "windows-targets 0.52.6", 602 | ] 603 | 604 | [[package]] 605 | name = "windows-sys" 606 | version = "0.59.0" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 609 | dependencies = [ 610 | "windows-targets 0.52.6", 611 | ] 612 | 613 | [[package]] 614 | name = "windows-targets" 615 | version = "0.48.5" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 618 | dependencies = [ 619 | "windows_aarch64_gnullvm 0.48.5", 620 | "windows_aarch64_msvc 0.48.5", 621 | "windows_i686_gnu 0.48.5", 622 | "windows_i686_msvc 0.48.5", 623 | "windows_x86_64_gnu 0.48.5", 624 | "windows_x86_64_gnullvm 0.48.5", 625 | "windows_x86_64_msvc 0.48.5", 626 | ] 627 | 628 | [[package]] 629 | name = "windows-targets" 630 | version = "0.52.6" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 633 | dependencies = [ 634 | "windows_aarch64_gnullvm 0.52.6", 635 | "windows_aarch64_msvc 0.52.6", 636 | "windows_i686_gnu 0.52.6", 637 | "windows_i686_gnullvm", 638 | "windows_i686_msvc 0.52.6", 639 | "windows_x86_64_gnu 0.52.6", 640 | "windows_x86_64_gnullvm 0.52.6", 641 | "windows_x86_64_msvc 0.52.6", 642 | ] 643 | 644 | [[package]] 645 | name = "windows_aarch64_gnullvm" 646 | version = "0.48.5" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 649 | 650 | [[package]] 651 | name = "windows_aarch64_gnullvm" 652 | version = "0.52.6" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 655 | 656 | [[package]] 657 | name = "windows_aarch64_msvc" 658 | version = "0.48.5" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 661 | 662 | [[package]] 663 | name = "windows_aarch64_msvc" 664 | version = "0.52.6" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 667 | 668 | [[package]] 669 | name = "windows_i686_gnu" 670 | version = "0.48.5" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 673 | 674 | [[package]] 675 | name = "windows_i686_gnu" 676 | version = "0.52.6" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 679 | 680 | [[package]] 681 | name = "windows_i686_gnullvm" 682 | version = "0.52.6" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 685 | 686 | [[package]] 687 | name = "windows_i686_msvc" 688 | version = "0.48.5" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 691 | 692 | [[package]] 693 | name = "windows_i686_msvc" 694 | version = "0.52.6" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 697 | 698 | [[package]] 699 | name = "windows_x86_64_gnu" 700 | version = "0.48.5" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 703 | 704 | [[package]] 705 | name = "windows_x86_64_gnu" 706 | version = "0.52.6" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 709 | 710 | [[package]] 711 | name = "windows_x86_64_gnullvm" 712 | version = "0.48.5" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 715 | 716 | [[package]] 717 | name = "windows_x86_64_gnullvm" 718 | version = "0.52.6" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 721 | 722 | [[package]] 723 | name = "windows_x86_64_msvc" 724 | version = "0.48.5" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 727 | 728 | [[package]] 729 | name = "windows_x86_64_msvc" 730 | version = "0.52.6" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 733 | 734 | [[package]] 735 | name = "zerocopy" 736 | version = "0.7.35" 737 | source = "registry+https://github.com/rust-lang/crates.io-index" 738 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 739 | dependencies = [ 740 | "byteorder", 741 | "zerocopy-derive", 742 | ] 743 | 744 | [[package]] 745 | name = "zerocopy-derive" 746 | version = "0.7.35" 747 | source = "registry+https://github.com/rust-lang/crates.io-index" 748 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 749 | dependencies = [ 750 | "proc-macro2", 751 | "quote", 752 | "syn", 753 | ] 754 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cpu_rec_rs" 3 | version = "1.0.1" 4 | edition = "2021" 5 | rust-version = "1.70" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow = "1.0.71" 11 | clap = "~4.4" 12 | glob = "0.3.1" 13 | log = "0.4.19" 14 | simple_logger = "4.1.0" 15 | tablestream = "0.1.3" 16 | 17 | [dev-dependencies] 18 | assert_approx_eq = "1.1.0" 19 | rand = "0.8.5" 20 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | * 2024-03-04: v1.0.1: add XtensaEB, try to load corpus from sane defaults. MSRV 1.70 2 | * 2023-06-22: v1.0: Initial release 3 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## cpu_rec_rs 2 | 3 | Determine which CPU architecture is used in a binary file. 4 | Example: 5 | 6 | ``` 7 | $ cpu_rec_rs /bin/bash /usr/lib/firmware/rtlwifi/rtl8821aefw* 8 | Loading corpus from cpu_rec_corpus/*.corpus 9 | ---------------------------------------------------------------------------------------- 10 | File | Range | Detected Architecture 11 | ---------------------------------------------------------------------------------------- 12 | /bin/bash | Whole file | X86-64 13 | /usr/lib/firmware/rtlwifi/rtl8821aefw_29.bin | 0x3200-0x4400 | 8051 14 | /usr/lib/firmware/rtlwifi/rtl8821aefw_29.bin | 0x4600-0x5000 | 8051 15 | /usr/lib/firmware/rtlwifi/rtl8821aefw_29.bin | 0x6000-0x6600 | 8051 16 | /usr/lib/firmware/rtlwifi/rtl8821aefw_29.bin | 0x6600-0x6c00 | 8051 17 | /usr/lib/firmware/rtlwifi/rtl8821aefw.bin | Whole file | 8051 18 | /usr/lib/firmware/rtlwifi/rtl8821aefw_wowlan.bin | Whole file | 8051 19 | ---------------------------------------------- 20 | ``` 21 | 22 | Note: as the approach is based on statistics, false positives are definitely 23 | possible. You should cross check with other sources and validate the results 24 | with a disassembler. 25 | 26 | In particular, small files are more prone to false positives, as well as smaller 27 | sliding windows. Common false positives include: 28 | 29 | * `xmos_xs2a` 30 | * `NDS32` 31 | 32 | ### About 33 | 34 | `cpu_rec_rs` is a Rust reimplementation of the original 35 | [`cpu_rec`](https://github.com/airbus-seclab/cpu_rec/). Why reimplement it? 36 | 37 | * Performance 38 | * Code simplification 39 | * Rust practice 40 | 41 | 42 | The original `cpu_rec` contains a lot of code necessary for experimenting and 43 | updating the corpus. If you want to play with various settings for prediction, 44 | please use `cpu_rec`. It also contains documentation and links to the theory 45 | behind it ([SSTIC presentation](https://github.com/airbus-seclab/cpu_rec/blob/master/doc/cpu_rec_slides_english.pdf)). 46 | -------------------------------------------------------------------------------- /cpu_rec_corpus/#6502#cc65.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/#6502#cc65.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/6502.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/6502.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/68HC08.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/68HC08.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/68HC11.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/68HC11.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/8051.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/8051.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARC32eb.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARC32eb.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARC32el.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARC32el.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARM64.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARM64.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARMeb.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARMeb.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARMel.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARMel.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARMhf.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARMhf.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ARcompact.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ARcompact.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/AVR.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/AVR.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Alpha.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Alpha.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/AxisCris.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/AxisCris.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Blackfin.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Blackfin.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/CLIPPER.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/CLIPPER.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/CUDA.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/CUDA.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Cell-SPU.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Cell-SPU.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/CompactRISC.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/CompactRISC.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Cray.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Cray.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Epiphany.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Epiphany.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/FR-V.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/FR-V.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/FR30.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/FR30.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/FT32.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/FT32.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/H8-300.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/H8-300.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/H8S.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/H8S.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/HP-Focus.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/HP-Focus.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/HP-PA.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/HP-PA.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/IA-64.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/IA-64.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/IQ2000.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/IQ2000.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/M32C.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/M32C.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/M32R.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/M32R.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/M68k.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/M68k.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/M88k.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/M88k.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MCore.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MCore.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MIPS16.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MIPS16.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MIPSeb.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MIPSeb.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MIPSel.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MIPSel.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MMIX.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MMIX.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MN10300.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MN10300.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MSP430.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MSP430.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Mico32.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Mico32.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/MicroBlaze.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/MicroBlaze.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Moxie.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Moxie.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/NDS32.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/NDS32.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/NIOS-II.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/NIOS-II.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/OCaml.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/OCaml.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PDP-11.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PDP-11.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PIC10.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PIC10.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PIC16.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PIC16.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PIC18.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PIC18.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PIC24.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PIC24.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PPCeb.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PPCeb.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/PPCel.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/PPCel.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/RISC-V.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/RISC-V.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/RL78.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/RL78.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/ROMP.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/ROMP.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/RX.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/RX.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/S-390.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/S-390.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/SPARC.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/SPARC.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/STM8.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/STM8.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Stormy16.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Stormy16.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/SuperH.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/SuperH.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/TILEPro.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/TILEPro.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/TLCS-90.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/TLCS-90.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/TMS320C2x.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/TMS320C2x.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/TMS320C6x.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/TMS320C6x.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/TriMedia.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/TriMedia.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/V850.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/V850.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/VAX.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/VAX.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Visium.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Visium.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/WASM.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/WASM.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/WE32000.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/WE32000.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/X86-64.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/X86-64.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/X86.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/X86.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Xtensa.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Xtensa.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/XtensaEB.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/XtensaEB.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/Z80.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/Z80.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/_mask1.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/_mask1.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/_ones.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/_ones.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/i860.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/i860.corpus -------------------------------------------------------------------------------- /cpu_rec_corpus/xmos_xs2a.corpus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trou/cpu_rec_rs/01a3a2d64371b4b9ccbb854a6d6a52f4de4ab4fe/cpu_rec_corpus/xmos_xs2a.corpus -------------------------------------------------------------------------------- /src/corpus.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 - Raphaël Rigo 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | use anyhow::{Context, Error, Ok, Result}; 17 | use glob::glob; 18 | use log::debug; 19 | use std::collections::HashMap; 20 | use std::fmt::Debug; 21 | use std::str::FromStr; 22 | use std::string::String; 23 | 24 | #[derive(Debug)] 25 | pub struct CorpusStats { 26 | pub arch: String, 27 | bigrams_freq: HashMap<(u8, u8), f32>, 28 | trigrams_freq: HashMap<(u8, u8, u8), f32>, 29 | bg_base_freq: f32, 30 | tg_base_freq: f32, 31 | } 32 | 33 | // Process all files in the given path, and return the statistics for ulterior 34 | // guessing 35 | pub fn load_corpus(path: &str) -> Result, Error> { 36 | let corpus_entries = glob(path) 37 | .with_context(|| "Could not find \"cpu_rec_corpus\" directory.")? 38 | .map(|p| p.unwrap()); 39 | 40 | let res: Result, _> = corpus_entries 41 | .map(|p| { 42 | let arch_name = 43 | String::from_str(p.file_name().unwrap().to_str().unwrap())?.replace(".corpus", ""); 44 | debug!("Loading {} for arch {}", p.display(), arch_name); 45 | let data = 46 | std::fs::read(&p).with_context(|| format!("Could not read {}", p.display()))?; 47 | 48 | // Corpus statistics are computed with a base count of 0.01 as 49 | // it will be used as divisor during guessing 50 | Ok(CorpusStats::new(arch_name, &data, 0.01)) 51 | }) 52 | .collect(); 53 | if let Result::Ok(res_v) = &res { 54 | if res_v.is_empty() { 55 | return Err(Error::msg("Could not find any file in corpus directory")); 56 | } 57 | } 58 | res 59 | } 60 | 61 | // Convenience struct for readability 62 | pub struct Divergences { 63 | pub bigrams: f32, 64 | pub trigrams: f32, 65 | } 66 | 67 | impl CorpusStats { 68 | pub fn new(arch: String, data: &Vec, base_count: f32) -> Self { 69 | let mut bg: HashMap<(u8, u8), f32> = HashMap::new(); 70 | let mut tg = HashMap::new(); 71 | 72 | /* 73 | Duplicate code to be able to use tuples, for optimization 74 | */ 75 | for w in data.windows(2) { 76 | let b = (w[0], w[1]); 77 | bg.entry(b) 78 | .and_modify(|count| *count += 1.0) 79 | .or_insert(1.0 + base_count); 80 | } 81 | for w in data.windows(3) { 82 | let b = (w[0], w[1], w[2]); 83 | tg.entry(b) 84 | .and_modify(|count| *count += 1.0) 85 | .or_insert(1.0 + base_count); 86 | } 87 | debug!( 88 | "{}: {} bytes, {} bigrams, {} trigrams", 89 | arch, 90 | data.len(), 91 | bg.len(), 92 | tg.len() 93 | ); 94 | 95 | let bi_qtotal: f32 = 96 | (base_count * ((u32::pow(256, 2) - bg.len() as u32) as f32)) + bg.values().sum::(); 97 | debug!("{} bigrams Qtotal: {}", arch, bi_qtotal); 98 | 99 | let tri_qtotal: f32 = 100 | (base_count * ((u32::pow(256, 3) - tg.len() as u32) as f32)) + tg.values().sum::(); 101 | debug!("{} trigrams Qtotal: {}", arch, tri_qtotal); 102 | 103 | // Update counts to frequencies 104 | let bg_freq = bg.into_iter().map(|(k, v)| (k, (v / bi_qtotal))).collect(); 105 | let tg_freq = tg.into_iter().map(|(k, v)| (k, (v / tri_qtotal))).collect(); 106 | 107 | CorpusStats { 108 | arch, 109 | bigrams_freq: bg_freq, 110 | trigrams_freq: tg_freq, 111 | bg_base_freq: base_count / bi_qtotal, 112 | tg_base_freq: base_count / tri_qtotal, 113 | } 114 | } 115 | 116 | // Compute the Kullback–Leibler divergence (cross entropy) of the 117 | // current file with the reference from corpus `q` 118 | pub fn compute_kl(&self, q: &Self) -> Divergences { 119 | let mut kld_bg = 0.0; 120 | for (bg, f) in &self.bigrams_freq { 121 | if *f != 0.0 { 122 | kld_bg += f * (f / q.bigrams_freq.get(bg).unwrap_or(&q.bg_base_freq)).ln(); 123 | } 124 | } 125 | let mut kld_tg = 0.0; 126 | for (tg, f) in &self.trigrams_freq { 127 | if *f != 0.0 { 128 | kld_tg += f * (f / q.trigrams_freq.get(tg).unwrap_or(&q.tg_base_freq)).ln(); 129 | } 130 | } 131 | Divergences { 132 | bigrams: kld_bg, 133 | trigrams: kld_tg, 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 - Raphaël Rigo 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | mod corpus; 17 | use crate::corpus::{load_corpus, CorpusStats}; 18 | use anyhow::{bail, Context, Error, Result}; 19 | use clap::{arg, Arg, ArgAction}; 20 | use log::{debug, info}; 21 | use std::cmp::min; 22 | use std::path::Path; 23 | use std::str::FromStr; 24 | use std::string::String; 25 | 26 | #[derive(Clone)] 27 | struct DetectionResult { 28 | file: String, 29 | arch: String, 30 | range: String, 31 | } 32 | 33 | // Apply final heuristics to guess the arch 34 | fn determine(r2: &KlRes, r3: &KlRes) -> Option { 35 | /* Bigrams and trigrams disagree or "special" invalid arch => no result */ 36 | if (r2.arch != r3.arch) || r2.arch.starts_with('_') { 37 | return None; 38 | } 39 | let res = &r2.arch; 40 | /* Special heuristics */ 41 | if (res == "OCaml" && r2.div > 1.0) 42 | || (res == "xmox_xs2a" && r2.div > 3.0) 43 | || (res == "IA-64" && r2.div > 3.0) 44 | { 45 | debug!("{}, probably a false positive", res); 46 | return None; 47 | } 48 | Some(res.clone()) 49 | /* TODO: 50 | elif res == 'PIC24': 51 | # PIC24 code has a 24-bit instruction set. In our corpus it is encoded in 32-bit words, 52 | # therefore every four byte is 0x00. 53 | zero = [True, True, True, True] 54 | for idx in range(len(d) // 4): 55 | zero = [zero[i] and d[4 * idx + i] == 0 for i in range(4)] 56 | if True not in zero: 57 | return None 58 | return res 59 | */ 60 | } 61 | 62 | #[derive(Debug)] 63 | struct KlRes { 64 | arch: String, 65 | div: f32, 66 | } 67 | 68 | fn predict(corpus_stats: &Vec, target: &CorpusStats) -> Result, Error> { 69 | let mut results_m2 = Vec::::with_capacity(corpus_stats.len()); 70 | let mut results_m3 = Vec::::with_capacity(corpus_stats.len()); 71 | 72 | // Build a vec of results for bigrams and trigrams, for easier processing 73 | for c in corpus_stats { 74 | let r = target.compute_kl(c); 75 | results_m2.push(KlRes { 76 | arch: c.arch.clone(), 77 | div: r.bigrams, 78 | }); 79 | results_m3.push(KlRes { 80 | arch: c.arch.clone(), 81 | div: r.trigrams, 82 | }); 83 | } 84 | 85 | // Sort 86 | results_m2.sort_unstable_by(|a, b| a.div.partial_cmp(&b.div).unwrap()); 87 | debug!("Results 2-gram: {:?}", &results_m2[0..2]); 88 | results_m3.sort_unstable_by(|a, b| a.div.partial_cmp(&b.div).unwrap()); 89 | debug!("Results 3-gram: {:?}", &results_m3[0..2]); 90 | 91 | // Guess 92 | let res = determine(&results_m2[0], &results_m3[0]); 93 | debug!("Result: {:?}", res); 94 | Ok(res) 95 | } 96 | 97 | /* Try to guess the architecture of `file_data`: 98 | * first by analyzing the whole buffer 99 | * then by applying a sliding window and analyzing it, making it smaller and smaller until a result is found 100 | The function returns a vec containing the results 101 | */ 102 | fn guess_with_windows( 103 | corpus_stats: &Vec, 104 | file_data: &Vec, 105 | filename: &str, 106 | ) -> Result, Error> { 107 | let mut res = Vec::::new(); 108 | 109 | let target = CorpusStats::new(String::from_str("target")?, file_data, 0.0); 110 | let res_full = predict(corpus_stats, &target)?; 111 | 112 | // If the whole file data gives a result, return it 113 | if let Some(r) = res_full { 114 | res.push(DetectionResult { 115 | arch: r, 116 | file: filename.to_string(), 117 | range: "Whole file".to_string(), 118 | }); 119 | return Ok(res); 120 | } 121 | 122 | // Heuristic depending on file size, the number is actually half the window 123 | // size 124 | let mut window = match file_data.len() { 125 | 0x20001..=0x100000 => 0x800, 126 | 0x8001..=0x20000 => 0x400, 127 | 0x1001..=0x8000 => 0x200, 128 | 0..=0x1000 => 0x100, 129 | _ => (file_data.len() / 100) & 0xFFFFF000, 130 | }; 131 | 132 | let mut ok = false; 133 | while window >= 0x40 && !ok { 134 | /* 135 | Store the current guess, in order to update the range while the arch is 136 | the same over the consecutive windows 137 | */ 138 | struct Guess { 139 | arch: Option, 140 | range: [usize; 2], 141 | } 142 | 143 | let mut cur_guess: Guess = Guess { 144 | arch: None, 145 | range: [0, 0], 146 | }; 147 | 148 | info!("{}: window_size : 0x{:x} ", filename, window * 2); 149 | for start in (0..file_data.len()).step_by(window) { 150 | let end = min(file_data.len(), start + window * 2); 151 | 152 | debug!("{}: range 0x{:x}-0x{:x}", filename, start, end); 153 | let win_stats = 154 | CorpusStats::new("target".to_string(), &file_data[start..end].to_vec(), 0.0); 155 | let win_res = predict(corpus_stats, &win_stats)?; 156 | 157 | // Should we add the previous guess to the result ? yes if it's 158 | // either unknown (None) or different from the new one 159 | let do_push = match &win_res { 160 | Some(wres) => match cur_guess.arch.as_ref() { 161 | Some(a) => a != wres, 162 | None => true, 163 | }, 164 | _ => true, 165 | }; 166 | if do_push { 167 | // push the detected arch to the results if it's known and 168 | // covers more than one window 169 | if cur_guess.arch.is_some() 170 | && (cur_guess.range[1] - cur_guess.range[0]) > window * 2 171 | { 172 | res.push(DetectionResult { 173 | file: filename.to_string(), 174 | arch: cur_guess.arch.unwrap(), 175 | range: format!("0x{:x}-0x{:x}", cur_guess.range[0], cur_guess.range[1]), 176 | }); 177 | } 178 | // Update the current guess 179 | cur_guess.arch = win_res; 180 | cur_guess.range[0] = start; 181 | cur_guess.range[1] = end; 182 | } else { 183 | // Same arch: update the end of the range 184 | cur_guess.range[1] = end; 185 | } 186 | } 187 | 188 | // No result: try a smaller window, else return 189 | if res.is_empty() { 190 | window /= 2; 191 | } else { 192 | ok = true; 193 | } 194 | } 195 | 196 | Ok(res) 197 | } 198 | 199 | fn main() -> Result<()> { 200 | let app = clap::Command::new("cpu_rec_rs") 201 | .version(env!("CARGO_PKG_VERSION")) 202 | .propagate_version(true) 203 | .author("Raphaël Rigo ") 204 | .about("Identifies CPU architectures in binaries") 205 | .arg(arg!(--corpus )) 206 | .arg(arg!(-d - -debug)) 207 | .arg(arg!(-v - -verbose)) 208 | .arg( 209 | Arg::new("files") 210 | .action(ArgAction::Append) 211 | .value_parser(clap::builder::NonEmptyStringValueParser::new()) 212 | .required(true), 213 | ); 214 | 215 | let args = app.get_matches(); 216 | 217 | let level = if args.get_flag("debug") { 218 | log::Level::Debug 219 | } else if args.get_flag("verbose") { 220 | log::Level::Info 221 | } else { 222 | log::Level::Warn 223 | }; 224 | simple_logger::init_with_level(level)?; 225 | 226 | let corpus_dir_res = args.get_one::("corpus"); 227 | 228 | /* Use the given path to load the corpus from, else try 229 | * to find it in the current directory or in the exec 230 | * folder */ 231 | let corpus_dir = match corpus_dir_res { 232 | Some(c) => c.to_owned(), 233 | None => if Path::new("cpu_rec_corpus").is_dir() { 234 | "cpu_rec_corpus".to_string() 235 | } else { 236 | let exe_path = std::env::current_exe().with_context(|| "Could not get exe filename")?; 237 | let parent_path = exe_path.parent().unwrap(); 238 | if parent_path.join("cpu_rec_corpus").is_dir() { 239 | // Found it in the exe path 240 | parent_path 241 | .join("cpu_rec_corpus") 242 | .to_str() 243 | .unwrap() 244 | .to_string() 245 | } else { 246 | bail!("Could not find \"cpu_rec_corpus\", please specify it using --corpus"); 247 | } 248 | } 249 | .to_owned(), 250 | }; 251 | 252 | if !Path::new(&corpus_dir).is_dir() { 253 | bail!("{} is not a valid directory", corpus_dir); 254 | } 255 | 256 | let corpus_files = Path::new(&corpus_dir).join("*.corpus"); 257 | println!("Loading corpus from {:?}", corpus_files); 258 | 259 | let corpus_stats = load_corpus(&corpus_files.to_str().unwrap())?; 260 | 261 | info!("Corpus size: {}", corpus_stats.len()); 262 | 263 | // Prepare output stream 264 | let mut out = std::io::stdout(); 265 | let mut tablestream = tablestream::Stream::new( 266 | &mut out, 267 | vec![ 268 | tablestream::col!(DetectionResult: .file).header("File"), 269 | tablestream::col!(DetectionResult: .range).header("Range"), 270 | tablestream::col!(DetectionResult: .arch).header("Detected Architecture"), 271 | ], 272 | ); 273 | 274 | for file in args.get_many::("files").unwrap() { 275 | let file_data = std::fs::read(file).with_context(|| format!("Could not open {}", file))?; 276 | 277 | for g in guess_with_windows(&corpus_stats, &file_data, file)? { 278 | tablestream.row(g)?; 279 | } 280 | } 281 | tablestream.finish()?; 282 | Ok(()) 283 | } 284 | 285 | #[cfg(test)] 286 | mod tests { 287 | use super::*; 288 | use assert_approx_eq::assert_approx_eq; 289 | use corpus::*; 290 | use rand::{RngCore, SeedableRng}; 291 | 292 | #[test] 293 | fn check_stats() { 294 | let mut rng = rand::rngs::StdRng::seed_from_u64(2); 295 | let mut rand_data: [u8; 1000] = [1; 1000]; 296 | rng.fill_bytes(&mut rand_data); 297 | 298 | let mut rand_target: [u8; 1000] = [1; 1000]; 299 | rng.fill_bytes(&mut rand_target); 300 | 301 | let rand_stats = CorpusStats::new("rand".to_string(), &rand_data.to_vec(), 0.01); 302 | let target_stats = CorpusStats::new("rand".to_string(), &rand_data.to_vec(), 0.0); 303 | 304 | let res = target_stats.compute_kl(&rand_stats); 305 | assert_approx_eq!(res.bigrams, 0.49450362); 306 | assert_approx_eq!(res.trigrams, 5.120544); 307 | } 308 | } 309 | --------------------------------------------------------------------------------