I am trying to reset the program-counter (AKA instruction-pointer) to 0.
I had expected the following C code to work (but it didn't):
typedef void(*func)();
func reset = NULL;
reset();
Here is the dis-assembly when using VS2013 compiler:
mov dword ptr[reset],0
mov esi,esp
call dword ptr[reset]
I realize that this issue is not dictated by the C-language standard, but is rather a matter of specific compiler implementation. Nevertheless, I would expect it to work pretty much on every decent compiler.
What could a function-call be compiled into, besides setting the PC/IP to the address of that function?
Thanks