Author Topic: pExt Symbol  (Read 156 times)

Biterider

  • Member
  • ****
  • Posts: 607
  • ObjAsm Developer
    • ObjAsm
pExt Symbol
« on: December 31, 2020, 07:03:55 PM »
Hi
I encountered a strange behavior while compiling code that contains a local symbol called pExt.
UASM 2.49.0.2 throws a syntax error, but as soon as I change the name to something else, the error is gone.
Is there anything special about this symbol?

Attached the very reduced test case.

Biterider




jj2007

  • Member
  • *****
  • Posts: 11051
  • Assembler is fun ;-)
    • MasmBasic
Re: pExt Symbol
« Reply #1 on: December 31, 2020, 10:31:57 PM »
It's case-insensitivity: pext and PEXE also misbehave. So it's probably an internal or undocumented keyword.

nidud

  • Member
  • *****
  • Posts: 2032
    • https://github.com/nidud/asmc
Re: pExt Symbol
« Reply #2 on: December 31, 2020, 11:14:32 PM »

Vortex

  • Member
  • *****
  • Posts: 2475
Re: pExt Symbol
« Reply #3 on: December 31, 2020, 11:57:55 PM »
ml.exe V6.14 from the Masm32 package can assemble Biterider's source file. Disassembling the object module :

Code: [Select]
_text   SEGMENT PARA PUBLIC 'CODE'

_start@0 PROC NEAR
        push    ebp
        mov     ebp, esp
        add     esp, -4
        leave
        ret
_start@0 ENDP

_text   ENDS

jj2007

  • Member
  • *****
  • Posts: 11051
  • Assembler is fun ;-)
    • MasmBasic
Re: pExt Symbol
« Reply #4 on: January 01, 2021, 12:06:37 AM »
https://www.felixcloutier.com/x86/pext

Nice find :thumbsup:

Not to be confounded with PEXTRW:
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc
src OWORD 1234567890abcdef1234567890abcdefh
  Init
  movups xmm0, src
  pextrw eax, xmm0, 0
  pextrw ebx, xmm0, 1
  pextrw ecx, xmm0, 2
  pextrw edx, xmm0, 15
  deb 4, "using pextrw", x:xmm0, x:eax, x:ebx, x:ecx, x:edx
  xor ecx, ecx
  pext eax, ebx, ecx ; illegal instruction
EndOfCode
Code: [Select]
using pextrw
x:xmm0          12345678 90ABCDEF 12345678 90ABCDEF
x:eax           0000CDEF
x:ebx           000090AB
x:ecx           00005678
x:edx           00001234

ml.exe V6.14 from the Masm32 package can assemble Biterider's source file

Yes, because it's so old that ML 6.14 does not know about the instruction... ML 10.0 says syntax error, same for 14.x :sad:

Olly doesn't know about PEXT, while the old October 2017 version of X32Dbg deciphers pext eax, ebx, ecx correctly; but it's still an illegal instruction on my trusty old Core i5 :sad:

Biterider

  • Member
  • ****
  • Posts: 607
  • ObjAsm Developer
    • ObjAsm
Re: pExt Symbol
« Reply #5 on: January 01, 2021, 01:09:46 AM »
Thanks nidud for the clarification  :thumbsup:

Biterider