來源

https://stackoverflow.com/questions/8158007/how-to-jump-the-program-execution-to-a-specific-address-in-c

 

Inline assembly might be the easiest and most "elegant" solution, although doing this is highly unusual, unless you are writing a debugger or some specialized introspective system.

Another option might be to declare a pointer to a void function (void (*foo)(void)), then set the pointer to contain your address, and then invoke it:

void (*foo)(void) = 0x12345678;
foo();

There will be things pushed on the stack since the compiler thinks you are doing a subroutine call, but since you don't care about returning, this might work.

shareimprove this answer
arrow
arrow
    全站熱搜

    mybeauty 發表在 痞客邦 留言(0) 人氣()