Nathan Fellman
Nathan Fellman

Reputation: 127428

Are there any instructions in x86 assembly that exist only in 64-bit mode?

Some old x86 instructions are undefined in 64-bit mode. For instance LDS, LES and LSS, or short opcodes of the INC r16 (40 + rw) and INC r32 (40 + rd) instructions.

Are there any instructions that are defined only in 64-bit mode, and not in 32-bit protected mode?

Edit: The context is development of an x86 processor. I want to make sure I'm compatible to the spec.

Upvotes: 3

Views: 1912

Answers (6)

Igor Skochinsky
Igor Skochinsky

Reputation: 25268

From Intel's Architectures Software Developer's Manual, Volume 2C Appendix A (Opcode Map):

Table A-1. Superscripts Utilized in Opcode Tables

...

o64 Instruction is only available when in 64-bit mode

...

Searching the tables, the following instructions appear with that superscript:

  1. REX prefixes (not really an instruction but still)
  2. MOVSXD
  3. SYSCALL, SYSRET
  4. SWAPGS

A few additional instructions which are variants of existing ones are listed in section 5.16 (64-BIT MODE INSTRUCTIONS):

  1. CDQE Convert doubleword to quadword
  2. CMPSQ Compare string operands
  3. CMPXCHG16B Compare RDX:RAX with m128
  4. LODSQ Load qword at address (R)SI into RAX
  5. MOVSQ Move qword from address (R)SI to (R)DI
  6. MOVZX (64-bits) Move doubleword to quadword, zero-extension
  7. STOSQ Store RAX at address RDI

Upvotes: 5

appusajeev
appusajeev

Reputation: 2299

PUSHA exists only in 32 bit mode. It doesnot exist in 64 bit mode

Upvotes: -1

Gunther Piez
Gunther Piez

Reputation: 30419

There is an addressing mode, which has no counterpart in 32 bit: Instruction pointer relative addressing. In 32 bit mode, this is only available with branches (aka branch offset), in 64 bit mode you can form effective addresses for any memory operand relative to the (r)ip.

So, the instruction

mov rbx,$100[rip]

does exist in x86-64, while

mov ebx,$100[eip]

does not in x86.

Upvotes: 5

Mehrdad Afshari
Mehrdad Afshari

Reputation: 421968

Setting aside old instructions that now operate on 64 bit registers (they are really new instructions as they use a distinct binary representation), I can think of at least two instructions that are 64-bit only: syscall and sysret instructions.

Upvotes: 3

Peeter Joot
Peeter Joot

Reputation: 8260

the opposite is much easier to come up with;) like cmpxchg8b .... you'd never use that one in 64-bit mode.

Upvotes: -1

Filip P.
Filip P.

Reputation:

You can always look into the different manuals at http://www.intel.com/products/processor/index.htm?iid=dev_center+tech_hw_design+prods+processors to find such instructions. Will be a lot of work tough ;)

Upvotes: -1

Related Questions