RetroFed Forum
Your home away from modern life.
Fizzbuzz by hand-crafting AMD64 instructions at runtime in OCaml
Post Reply
AuthorMessage
Serpent7776 programming.dev Serpent7776@programming.dev
Joined: 2024-01-20
Quote

This allocates required number of pages using mmap, fills it with AMD64 instructions, changes the memory protections and execute the memory as code.

This works fine on my machine, but I'm not sure if it's guaranteed to work in all cases. I assume it's safe to execute arbitrary asm code from OCaml. I'm not sure if the conversions I do are valid.

1   Original
Post Reply
Back to top