I\'d like to write a very small proof-of-concept JIT compiler for a toy language processor I\'ve written (purely academic), but I\'m having some trouble in the middle-altitu
The Android Dalvik JIT compiler might also be worth looking at. It is supposed to be fairly small and lean (not sure if this helps understanding it or makes things more complicated). It targets Linux as well.
If things are getting more serious, looking at LLVM might be a good choice as well.
The function pointer approach suggested by Jeremiah sounds good. You may want to use the caller's stack anyway and there will probably only be a few registers left (on x86) which you need to preserve or not touch. In this case, it is probably easiest if your compiled code (or the entry stub) saves them on the stack before proceeding. In the end, it all boils down to writing an assembler function and interfacing to it from C.