Actually I have a simple library I wrote for executing machine code off an executable page.
The basis of it all for single page without a pointer(to arguments pushed on the stack) is simply:
-
typedef int (*fp)();
-
fp *code = new fp [original.size()];
-
memmove((void*)code, original.data(), original.size());
- In a wrapper function,
return ((fp)code)();
-
delete [] code;
Argument support is mind-numbingly easy.
I was working on an experimental metamophic engine, and assembler for it around the begining of summer, but sort of gave up when a bug with literals had me grinding my teeth.
Last edited by MosaicFuneral; Aug 30th, 2009 at 3:55 pm.
Reputation Points: 888
Solved Threads: 114
Nearly a Posting Virtuoso
Offline 1,270 posts
since Nov 2008