{"id":13578127,"url":"https://github.com/CensoredUsername/dynasm-rs","last_synced_at":"2025-04-05T16:31:54.569Z","repository":{"id":9690948,"uuid":"62591577","full_name":"CensoredUsername/dynasm-rs","owner":"CensoredUsername","description":"A dynasm-like tool for rust.","archived":false,"fork":false,"pushed_at":"2024-10-29T01:31:13.000Z","size":12222,"stargazers_count":720,"open_issues_count":12,"forks_count":54,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-29T15:47:48.191Z","etag":null,"topics":["assembly","dynasm","jit","rust"],"latest_commit_sha":null,"homepage":"https://censoredusername.github.io/dynasm-rs/language/index.html","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CensoredUsername.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-04T22:49:22.000Z","updated_at":"2024-10-29T01:31:17.000Z","dependencies_parsed_at":"2024-01-15T19:16:57.995Z","dependency_job_id":"0abd5da6-563e-4fe5-ba73-4edbf012a7ef","html_url":"https://github.com/CensoredUsername/dynasm-rs","commit_stats":{"total_commits":334,"total_committers":18,"mean_commits":"18.555555555555557","dds":"0.11976047904191611","last_synced_commit":"cd35e34800ea801e510c627b7d72f45c7c0d7b35"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CensoredUsername%2Fdynasm-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CensoredUsername%2Fdynasm-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CensoredUsername%2Fdynasm-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CensoredUsername%2Fdynasm-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CensoredUsername","download_url":"https://codeload.github.com/CensoredUsername/dynasm-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741100,"owners_count":20826066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","dynasm","jit","rust"],"created_at":"2024-08-01T15:01:27.746Z","updated_at":"2025-04-05T16:31:54.564Z","avatar_url":"https://github.com/CensoredUsername.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# A Dynamic assembler written in Rust for Rust.\n\nThe purpose of this tool is to ease the creation of programs that require run-time assembling.\n\nIt is compatible with stable `rustc` 1.77 and higher.\n\n[![Build status](https://github.com/CensoredUsername/dynasm-rs/actions/workflows/Build_and_test.yml/badge.svg?branch=master)](https://github.com/CensoredUsername/dynasm-rs/actions/workflows/Build_and_test.yml)\n[![](https://img.shields.io/crates/v/dynasm.svg)](https://crates.io/crates/dynasm)\n\n`##dynasm-rs` on irc.libera.chat\n\n## Features\n\n- Fully integrated in the Rust toolchain, no other tools necessary.\n- The assembly is optimized into a series of `Vec.push` and `Vec.extend` statements.\n- Errors are almost all diagnosed at compile time in a clear fashion.\n- Write the to be generated assembly inline in nasm-like syntax using a simple macro.\n\n## Documentation\n\n[Documentation](https://CensoredUsername.github.io/dynasm-rs/language/index.html).\n[Release notes](https://github.com/CensoredUsername/dynasm-rs/blob/master/doc/releasenotes.md).\n\n## Architecture support\n\n- Supports the x64/x86 instruction sets in long and protected mode with every AMD/Intel/VIA extension except for AVX-512.\n- Supports the aarch64 instruction set up to ARMv8.4 except for SVE instructions. The development of this assembler backend has been generously sponsored by the awesome folks at [Wasmer](https://github.com/wasmerio/wasmer)!\n- Supports the riscv32 and riscv64 instruction sets, with many extensions. The development of these assembler backends was sponsored by [Wasmer](https://github.com/wasmerio/wasmer) as well!\n\n## Example\n\n```rust\nuse dynasmrt::{dynasm, DynasmApi, DynasmLabelApi};\n\nuse std::{io, slice, mem};\nuse std::io::Write;\n\nfn main() {\n    let mut ops = dynasmrt::x64::Assembler::new().unwrap();\n    let string = \"Hello World!\";\n\n    dynasm!(ops\n        ; .arch x64\n        ; -\u003ehello:\n        ; .bytes string.as_bytes()\n    );\n\n    let hello = ops.offset();\n    dynasm!(ops\n        ; .arch x64\n        ; lea rcx, [-\u003ehello]\n        ; xor edx, edx\n        ; mov dl, BYTE string.len() as _\n        ; mov rax, QWORD print as _\n        ; sub rsp, BYTE 0x28\n        ; call rax\n        ; add rsp, BYTE 0x28\n        ; ret\n    );\n\n    let buf = ops.finalize().unwrap();\n\n    let hello_fn: extern \"win64\" fn() -\u003e bool = unsafe { mem::transmute(buf.ptr(hello)) };\n\n    assert!(hello_fn());\n}\n\npub extern \"win64\" fn print(buffer: *const u8, length: u64) -\u003e bool {\n    io::stdout()\n        .write_all(unsafe { slice::from_raw_parts(buffer, length as usize) })\n        .is_ok()\n}\n```\n\n## Background\n\nThis project is heavily inspired by [Dynasm](http://luajit.org/dynasm.html)\n\n## Sponsorship\n\nThe development of the Aarch64 assembler backend has been sponsored by [Wasmer](https://github.com/wasmerio/wasmer).\n\n## License\n\nMozilla Public License, v. 2.0, see LICENSE\n\nCopyright 2016 CensoredUsername\n\n## Guaranteed to be working compiler versions\n\nThis project used to be a compiler plugin, so for old compilers, here's a list of which version of dynasm was guaranteed to work with which compiler.\nAs the project has since transitioned to be a proc macro, this is not relevant for modern versions of the compiler.\n\n- `v0.2.0`: `rustc 1.27.0-nightly (ac3c2288f 2018-04-18)`\n- `v0.2.1`: `rustc 1.28.0-nightly (a1d4a9503 2018-05-20)`\n- `v0.2.3`: `rustc 1.31.0-nightly (96cafc53c 2018-10-09)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCensoredUsername%2Fdynasm-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCensoredUsername%2Fdynasm-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCensoredUsername%2Fdynasm-rs/lists"}