#295 new

xbegin offset off by 6

Reported by Daniel | January 27th, 2016 @ 08:12 AM

No matter how and where I put the fallback label, yasm is always 6 less than masm. To temporarily fix it in my code, adding 6 always makes it match masm64. So xbegin must need the offset from after the instruction's 6 bytes, not the offset from before the instruction starts.

x64 code follows

from yasm-1.3.0-win64.exe
1804 fallback: 1805 000041A2 C7F8FAFFFFFF XBEGIN dword near 6 + fallback

from Microsoft (R) Macro Assembler (x64) Version 14.00.23506.0
00000038 fallback: 00000038 C7 F8 FFFFFFFA XBEGIN fallback

Comments and changes to this ticket

  • Daniel

    Daniel January 27th, 2016 @ 08:15 AM

    From http://www.intel.com/content/dam/www/public/us/en/documents/manuals... page 1708

    fallbackRIP ← RIP + SignExtend64(IMM)
    (* RIP is instruction following XBEGIN instruction *)

    So the in 64 bit mode, the instruction being 6 bytes, needs the offset changed by 6 bytes

  • Daniel

    Daniel January 27th, 2016 @ 08:51 AM

    The list file generated by yasm doesn't match the ndisasm file from nasm.

    current yasm

    1799 fallback: 1800
    1801 000041BC C7F8F4FFFFFF XBEGIN dword near fallback

    current ndisasm

    0000C1BC C7F8FAFFFFFF xbegin qword 0xc1bc

    so yasm's list file actually lies about the real bytes

    even at the beginning


    10 00000000 EBFE                   jmp GetStarted



    00008000 EB00 jmp short 0x8002

    So, the real bytes in the assembled binary file are ok, but the bytes in yasm's list file are a lie, and wrong.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket