NO

Author Topic: We have been stolen  (Read 771 times)

HellOfMice

  • Guest
We have been stolen
« on: January 24, 2025, 09:37:22 AM »
Going to 64 bits we loose 4/2 registers


Look at:


MOV CH,127 ; No error
MOV DIL,254 ; No Error


MOV AL,CH ; No Error
MOV DL,DIL ; No Error


MOV CH,DIL ; Forbidden !
In this instruction we suppose that REX = 0 so the use of DIL is forbidden


Idem for  AH/SPL CH/BPL DH/SIL & BH/DIL


SPL, BPL, SIL and DIL have a 40h prefix (REX)


AH & SPL have the same opcode except that SPL has a REX prefix


The REX prefix allows to use 64 bits properties


I thought it was funny


A+


Philippe


Offline Vortex

  • Member
  • *
  • Posts: 990
    • http://www.vortex.masmcode.com
Re: We have been stolen
« Reply #1 on: January 24, 2025, 11:29:09 AM »
Maybe using a third register as a helper?

Code: [Select]
MOV DL,DIL
MOV CH,DL
Code it... That's all...

HellOfMice

  • Guest
Re: We have been stolen
« Reply #2 on: January 24, 2025, 11:30:33 AM »
Yes in 64 bit mode, we have no choice

Offline WiiLF23

  • Member
  • *
  • Posts: 90
Re: We have been stolen
« Reply #3 on: February 08, 2025, 11:19:58 PM »
Going to 64 bits we loose 4/2 registers


Look at:


MOV CH,127 ; No error
MOV DIL,254 ; No Error


MOV AL,CH ; No Error
MOV DL,DIL ; No Error


MOV CH,DIL ; Forbidden !
In this instruction we suppose that REX = 0 so the use of DIL is forbidden


Idem for  AH/SPL CH/BPL DH/SIL & BH/DIL


SPL, BPL, SIL and DIL have a 40h prefix (REX)


AH & SPL have the same opcode except that SPL has a REX prefix


The REX prefix allows to use 64 bits properties


I thought it was funny


A+


Philippe

This is one of those quirks introduced in x86-64 due to backward compatibility while expanding the register set.