Menu

2.04rc1 and 2.04rc2 - conditional jumps probl

2008-12-01
2013-06-04
  • Nobody/Anonymous

    Hi,

    The opcodes of conditional jump and call instructions have changed between those version. My question is: why? I couldn't find any answer for that question. The problem is that my bootsector code (16bit Real Mode), which runs perfectly when compiled with <=2.04rc1, crashes when compiled with >2.04rc1. I've found out with ndisasm that opcodes differ.

    Below I present sample output showing differences (on the left column: 2.04; on the right column: 2.04rc1):

    0F82F8FF    jc word 0x15    |    72FA    jc 0x15
    0F85E9FF    jnz word 0x4b    |    75ED    jnz 0x49

    Why those opcodes differ? Why those from 2.04 lead to crash?

    Regards,
    aidecoe

     
    • Frank Kotler

      Frank Kotler - 2008-12-01

      Short answer: "bug". Actually, just a change in the default behavior - it "shouldn't" crash. (but if it does, it does).

      Adding the "-O" switch "should" fix it, but your best bet is to dump that and get the latest version. 2.06rc1 has just been released - available at:

      http://www.nasm.us

      I'll have it up here... later today... or tomorrow... (remind me if I don't!).

      Sorry you had a problem, and thanks for the feedback!

      Best,
      Frank

       
    • Nobody/Anonymous

      "The opcodes of conditional jump and call instructions have changed between those version."

      Correction: just conditional jumps -- not calls.

      Thanks for solution. -O2 workaround makes code correct and my boot program runs fine.

      I don't fully understand your answer. In 2.06rc1 the bug was fixed or not? I've just tested it and 2.06rc1 still has this problem.

      Regards,
      aidecoe

       
    • H. Peter Anvin

      H. Peter Anvin - 2008-12-10

      Looks like the change to make the short forms the default again (0.98-style) didn't actually work when one hard-codes offsets.  aidecoe: could you post a bug report with your code?

       
    • Nobody/Anonymous

      Sorry for delay. :-)

      The problem seems to be more complicated, because I'm not sure now that it's only a matter of jumps. I've written simple boot program with conditional jumps and it works correctly. Moreover, my OS boot loader runs correctly on qemu without kqemu, but fails on real processor (and qemu with kqemu). With -O2 runs smoothly both on qemu and real. Maybe addresses are computed incorrectly without -O2 in some complicated situations? I'll try to find it out, when I'll get some time.

      Do you mean to post my all boot program nasm code?

       

Log in to post a comment.