jmp short $+2

I am trying to compile a C++ file with Boreland C++ 4.5

which has the following line in it


asm jmp short $+2


It can not compile because it says

undefined symobl short in function


Can Anyone let me know if there are any alternate commands

that I can use instead of the one above or a way to convert

it to a c/c++ command

Thanks

Mack


Comments

  • : asm jmp short $+2


    If I am not mistaken (my inline C++ asm is a bit rusty), this line does nothing but jumping 2 bytes.. in other words, it increases the instruction pointer by 2...


    First of all, I think that in C++ a jmp has the default short format, so the [short] part is totally omissable... a long jump would be jmp far $+2 though...


    but more importantly, it skips the first 2 bytes of the next command... so depending on what that next command might be, you can probably come up with a nice C workaround anyway.


    (That is, assuming I interpreted the $+2 part right... which I am not totally sure of).


    enjoy,

    The watcher


  • Well you misunderstood that part, i thought it was that way too.

    But the more correct is that it just jumps over itself.

    Often used to clear the cache, before going in or out of protected mode.

    Because $ == current ip(not literraly). And that points to the beginngin

    of the jmp instruction. And jump is 2 bytes long (assuming SHORT).

    Well i have never used it myself, but im quite sure that is the explanation

    to whatever question that i didnt read. =)


    URL:http://xlatb.cjb.net

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories