Hacker News new | ask | show | jobs
by vedantk 5106 days ago
I think the callee expects the return address in %rbp, and by System V convention will pull certain arguments from above %ebp on the stack.

This might not help, but it's an interesting article on stack frames for all interested: http://eli.thegreenplace.net/2011/09/06/stack-frame-layout-o...

1 comments

Looks like fastcall, or any convention on x86_64.

I think you can do bound functions if you do callee-cleanup, then your intermediate bound trampolines can just jmp and you don't end up with (too many) weird problems. But it means that the final return address ends up at the bottom of the stack, rather than at the top, like it would with a conventional push/call system.

In any case it looks like cdecl is out of the question.

Some further discussion in a slightly different context, if you're interested: http://stackoverflow.com/questions/11271848/implementing-bou...