#79 ✓resolved
Peter Johnson

About ticket #80, there is no problem with 0x90

Reported by Peter Johnson | June 25th, 2011 @ 07:49 PM

Originally posted on Trac by Yvan AMILIN
Original Trac Ticket

  Description

Unable to reproduce #80, with the following code, yasm-1606 and Intel Core 2 Duo:

foo:
  mov rax , -1
  db 90h
  ret

the upper 32 bits of rax are NOT cleared. About nop (0x90), AMD64 Architecture Programmer’s Manual, Volume 3, p226:

The NOP instruction is an alias for XCHG rAX,rAX

and not eax. Tomasz Gryztar should read documentations before stating false claims.

You are free to revert #1638.

Trac Attachments

h3. Trac Comments
comment:1

              Changed 5 years ago by peter@tortall.net


Actually, I believe Tomasz (and #80) is correct.

Yes, the 0x90 opcode should not clear the upper bits of RAX (if it did, it wouldn't be a NOP); however, Yasm was generating 0x90 for "xchg eax, eax" (and "xchg ax, ax") in 64-bit mode, which for consistency should generate code that *does* clear the upper bits of RAX (which 0x90 does not), just like any other operation on 32-bit registers in 64-bit mode (for example: "xchg eax, ebx" clears the upper 32 bits of both eax and ebx).

Yasm continues to generate 0x90 for xchg rax, rax (naturally).

      comment:1

                  Changed 5 years ago by peter@tortall.net

      Status
        changed from new to closed
    
      Resolution
        set to worksforme

Actually, I believe Tomasz (and #80) is correct.

Yes, the 0x90 opcode should not clear the upper bits of RAX (if it did, it wouldn't be a NOP); however, Yasm was generating 0x90 for "xchg eax, eax" (and "xchg ax, ax") in 64-bit mode, which for consistency should generate code that *does* clear the upper bits of RAX (which 0x90 does not), just like any other operation on 32-bit registers in 64-bit mode (for example: "xchg eax, ebx" clears the upper 32 bits of both eax and ebx).

Yasm continues to generate 0x90 for xchg rax, rax (naturally).

      Status
        changed from new to closed
    
      Resolution
        set to worksforme

Comments and changes to this ticket

  • Hard Work

    Hard Work November 19th, 2018 @ 05:11 AM

    Hey, Here you will be glad to know that we are going to share one of the best portal which will help you to play Freecell free online solitaire games as these games are of cards games and will also help you to sharp your matching skills.

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

Pages