flat assembler
Message board for the users of flat assembler.

Index > Main > opcode equivalency

Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 09 Feb 2012, 17:23
this is part of ADC instruction from intel manual:

Code:
;op1 op2     opcode
ax    imm16   15 iw
r/m16  imm16   81 /2 iw    


(case 1)

Code:
;           opcode
adc ax, 1     15 01 00
adc ax, 1   83 D0 01    


That means that these builds are equivalents and they will result in the same result?

(case 2)

Code:
ax     imm16   15 iw
eax    imm32   15 id    

How will the processor know that in the first line it will need to read a word, and in the second one a dword? (by the 66 prefix?)

_________________
Sorry if bad english.
Post 09 Feb 2012, 17:23
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 09 Feb 2012, 17:41
Teehee wrote:
Code:
ax      imm16   15 iw
eax    imm32   15 id    

How will the processor know that in the first line it will need to read a word, and in the second one a dword? (by the 66 prefix?)
Yes. And also the current processor mode will define which register size to use. Don't forget about RAX also.
Post 09 Feb 2012, 17:41
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 09 Feb 2012, 17:44
BTW: There are many functionally equivalent encodings in x86. An assembler is free to choose which one it wants to generate.
Post 09 Feb 2012, 17:44
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.