NO

Author Topic: Prefix  (Read 221 times)

Offline HellOfMice

  • Member
  • *
  • Posts: 360
  • Never be pleased, always improve
Prefix
« on: January 26, 2025, 05:27:25 PM »
Hello,

I am writing my disassembler and ask many questions when meeting a prefix.

66h and 67h are not a problemm when used alone but when mixing with 40h or 41h it is harder.
I would like that someone explains that to me.

If 66h is used at the same time that 40h, 40h is stronger so the 40h is the only prefix to proceed.
It is like the 66h was not found.
But 41h prefix is present with 66h and/or 67h what does the opcode becomes.

One think, I beleive to have understood is that the 41h prefix can be there set à 0 or 1.
Even if it is equal to 0 it means something. For me it has three values: Present, 0 and 1.

I would say that if it is present with a 66h it selects the 16 bits registers.
If the 67h is found and the 41h is present it would select the 16 bits addresses but they are not used on the X64.

But if the 41h prefix is equal to 0 or 1 what happens if 66h or 67h prefixes are found.
I posted the same question on MASM32 forum.
Writing a disassembler and ignoring certain opcodes is not a good idea.
Thank You for your help.
--------------------------------
Kenavo

Offline Vortex

  • Member
  • *
  • Posts: 975
    • http://www.vortex.masmcode.com
Re: Prefix
« Reply #1 on: January 27, 2025, 08:24:25 PM »
Code it... That's all...

Offline HellOfMice

  • Member
  • *
  • Posts: 360
  • Never be pleased, always improve
Re: Prefix
« Reply #2 on: January 27, 2025, 08:26:22 PM »
Thank you Vortex because I discover other things taht made a big marmelade in my head


Merci
Philippe
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 360
  • Never be pleased, always improve
Re: Prefix
« Reply #3 on: January 27, 2025, 08:40:09 PM »
Hi Vortex,

I have discovered, again today, the following prefixes:

   qwEvex      ; 1 Byte   (0x62)
   qwREX      ; 1 Byte   (0x48...0x4F)
   qwREX2      ; 2 Bytes   (0xD5 + 1 other)
   qwVEX      ; 3 Bytes   (0x0F + 3 others (W0|1))
   qwVEX2      ; 2 Bytes   (0xC5 + 1 other)
   qwVEX3      ; 2 Bytes   (0xC4 + 2 others)
   qw66      ; 1 Byte   (0x66)
   qw67      ; 1 Byte   (0x67)

And in Intel and Amd pdf the set instructions that it is not possible to use in 64 bit mode.

In the following table I try to find the opcode that I can use in mode 64

10 1C 25 78 56 34 12                ADC     BYTE PTR [0000000012345678],BL          ;
10 D2                               ADC     DL,DL                                   ;
11 14 25 78 56 34 12                ADC     DWORD PTR [0000000012345678],EDX        ;
11 CA                               ADC     EDX,ECX                                 ;
12 04 25 78 56 34 12                ADC     AL,BYTE PTR [0000000012345678]          ;
13 14 25 78 56 34 12                ADC     EDX,DWORD PTR [0000000012345678]        ;
14 FF                               ADC     AL,FF                                   ; 14 ib
15 78 56 34 12                      ADC     EAX,12345678                            ; 15 id
15 FF FF                                                                            ; Not possible in 64 bit mode
48 15 78 56 34 12                   ADC     RAX,12345678                            ; REX.W + 15 id
48 81 14 25 78 56 34 12 FF FF FF FF ADC     QWORD PTR [0000000012345678],FFFFFFFF   ; REX.W + 81 /2 id
48 81 D2 FF FF FF FF                ADC     RDX,FFFFFFFF                            ;
48 83 D2 01                         ADC     RDX,1                                   ; REX.W + 83 + /2 ib
4C 11 34 25 78 56 34 12             ADC     QWORD PTR [0000000012345678],R14        ; REX.W + 11 /r
4C 13 3C 25 78 56 34 12             ADC     R15,QWORD PTR [0000000012345678]        ; REX.W + 13 /r
66 11 0C 25 78 56 34 12             ADC     WORD PTR [0000000012345678],CX          ;
66 11 CA                            ADC     DX,CX                                   ;
66 13 0C 25 78 56 34 12             ADC     CX,WORD PTR [0000000012345678]          ;
66 15 FF FF                         ADC     AX,65535                                ; 66h permet de choisir le registre 16 bits
66 67 81 12 34 12                   ADC     DWORD PTR [EDX],1234                    ;
66 81 14 25 78 56 34 12 FF FF       ADC     WORD PTR [0000000012345678],FFFF        ; 66h indique une opérande 16 bits
66 81 D2 FF FF                      ADC     DX,FFFFh                                ; 66h permet de choisir le registre 16 bits
66 83 D0 01                         ADC     AX,1                                    ;
67 48 81 12 56 34 12                ADC     QWORD PTR [edx],12345678                ;
67 81 12 78 56 34 12                ADC     DWORD PTR [EDX],12345678                ;
80 14 25 78 56 34 12 FF             ADC     BYTE PTR [0000000012345678],FF          ; le X64 ne gère pas les adresses 64 bits
80 D2 FF                            ADC     DL,FF                                   ;
81 14 25 78 56 34 12 78 56 34 12    ADC     DWORD PTR [0000000012345678],12345678   ; ADC r/m32, imm32
83 D0 D1                            ADC     EAX,1                                   ;


Nothing for ADC I found 29 different codings, and it is not finished. I want to get all the opcodes and after I make my tests wit4th ADC

Thank You again Vortex and Thank for me Mikl.

A+

Philippe
--------------------------------
Kenavo