Author Topic: vpbroadcastb from HJWasm causes "illegal instruction" [HJWasm/VirtualBox]  (Read 2754 times)

dawnraider

  • Regular Member
  • *
  • Posts: 26
Hi,

I am having trouble with AVX2 instructions generated by HJWasm. The following code appears to assemble and execute fine:

Code: [Select]
00000000                        temp proc
00000000  C4E27918CA            vbroadcastss xmm1, xmm2
00000005                        temp endp

However, the following code causes an "illegal instruction" exception:

Code: [Select]
00000000                        temp proc
00000000  62F27D0878CA          vpbroadcastb xmm1, xmm2
00000006                        temp endp

Intel's Software Development Manual defines the two instructions as:

Code: [Select]
VEX.128.66.0F38.W0 18 /r        RM V/V AVX2
VBROADCASTSS xmm1, xmm2

VEX.128.66.0F38.W0 78 /r        RM V/V AVX2
VPBROADCASTB xmm1, xmm2/m8

The encoding for vpbroadcastb appears to be one byte too long. Can anybody confirm if both of the above generated encodings match Intel's definitions?

The execution environment is Windows 7 Ultimate SP1 inside a VirtualBox virtual machine. Specifically, v5.0.0.r101573 on Ubuntu 15.04 which has AVX/AVX2 enabled (see https://www.virtualbox.org/wiki/Changelog). Underlying CPU is Skylake.
Inside the virtual machine, CPUID reports:

Code: [Select]
CPUID[EAX=01h].ECX  == 018000000h (OSXSAVE and AVX enabled)
CPUID[EAX=07h].EBX  == 000000020h (AVX2 enabled)
XGETBV[ECX=00h].EAX == 000000006h (XMM and YMM state enabled)

Has anybody else checked running AVX2 instructions generated by HJWasm? Either on a real machine or inside a VirtualBox VM?

Thanks in advance.
« Last Edit: January 26, 2016, 06:26:29 AM by dawnraider »

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Hi dawnraider :biggrin:

You are doing a great yob :t
Can you please write the source to include all AVX2 instructions so that we can test at ones all of them
I have Intel AVX2 manual, however it takes time to write a source with all the instructions included

Cod-Father

dawnraider

  • Regular Member
  • *
  • Posts: 26
Ok,

Problem solved. This was a problem with HJWasm, not with VIrtualBox.

After receiving an update to the assembler everything appears to be executing fine within the virtual machine.

Cheers.