I want to make a simple just-in-time compiler with c on Linux.
How can I allocate memory such that I can write out raw x86 code to it and execute it as any other function?
See mprotect(). Once you have filled a (n-)page-sized memory region (allocated with mmap()) with code, change its permissions to disallow writes and allow execution.
2.1m questions
2.1m answers
60 comments
56.7k users