tinyjit
tinyjit copied to clipboard
How would I create and pass a buffer for the generated assembly to scribble on?
Suppose I'm dynamically generating some assembly that will need a 4K buffer to do some scratch calculations in. It is not important what's left in it after it's done, but it has to be safe to scribble in for the generated assembly. I can pass an address in one of the registers to the generated assembly before calling it, but I'm not sure how to
- Allocate that buffer in Haskell-land; and
- Get its address as a pointer
What would you need to do for this? Is it ok just to allocate it as a Data.Vector Word
of the appropriate length, or is something more involved?