Skip to content

Commit 8eb0279

Browse files
committed
Add Intel FRED and LKGS instructions
1 parent 1450ae2 commit 8eb0279

File tree

81 files changed

+1033
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1033
-51
lines changed

Diff for: src/UnitTests/Intel/Decoder/Code.64Only.txt

+5
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,8 @@ Stui
448448
Senduipi_r64
449449
Ccs_hash_64
450450
Ccs_encrypt_64
451+
Lkgs_rm16
452+
Lkgs_r32m16
453+
Lkgs_r64m16
454+
Erets
455+
Eretu

Diff for: src/UnitTests/Intel/Decoder/DecoderTest64.txt

+25
Original file line numberDiff line numberDiff line change
@@ -32527,3 +32527,28 @@ F3 F2 0FA7 F0, INVALID, INVALID, 0, code=Ccs_encrypt_64
3252732527
0FA7 F0, INVALID, INVALID, 0, code=Ccs_encrypt_64 decopt=Xbts no_opt_disable_test
3252832528
0FA7 F0, INVALID, INVALID, 0, code=Ccs_encrypt_64 decopt=Cmpxchg486A no_opt_disable_test
3252932529
F3 4F 0FA7 F0, Ccs_encrypt_64, Ccs_encrypt, 0, rep enc=F30FA7F0
32530+
32531+
66 F2 0F00 F1, Lkgs_rm16, Lkgs, 1, op0=r;cx
32532+
F2 66 0F00 F1, Lkgs_rm16, Lkgs, 1, op0=r;cx enc=66F20F00F1
32533+
66 F2 41 0F00 F1, Lkgs_rm16, Lkgs, 1, op0=r;r9w
32534+
66 F2 0F00 30, Lkgs_rm16, Lkgs, 1, op0=m;ds;rax;;1;0;0;UInt16
32535+
F2 66 46 0F00 F1, Lkgs_rm16, Lkgs, 1, op0=r;cx enc=66F20F00F1
32536+
66 F2 0F00 F1, Lkgs_rm16, Lkgs, 1, op0=r;cx decopt=Jmpe no_opt_disable_test
32537+
32538+
F2 0F00 F1, Lkgs_r32m16, Lkgs, 1, op0=r;ecx
32539+
F2 41 0F00 F1, Lkgs_r32m16, Lkgs, 1, op0=r;r9d
32540+
F2 0F00 30, Lkgs_r32m16, Lkgs, 1, op0=m;ds;rax;;1;0;0;UInt16
32541+
F2 46 0F00 F1, Lkgs_r32m16, Lkgs, 1, op0=r;ecx enc=F20F00F1
32542+
F2 0F00 F1, Lkgs_r32m16, Lkgs, 1, op0=r;ecx decopt=Jmpe no_opt_disable_test
32543+
32544+
F2 48 0F00 F1, Lkgs_r64m16, Lkgs, 1, op0=r;rcx
32545+
F2 49 0F00 F1, Lkgs_r64m16, Lkgs, 1, op0=r;r9
32546+
F2 48 0F00 30, Lkgs_r64m16, Lkgs, 1, op0=m;ds;rax;;1;0;0;UInt16
32547+
F2 4E 0F00 F1, Lkgs_r64m16, Lkgs, 1, op0=r;rcx enc=F2480F00F1
32548+
F2 48 0F00 F1, Lkgs_r64m16, Lkgs, 1, op0=r;rcx decopt=Jmpe no_opt_disable_test
32549+
32550+
F3 0F 01 CA, Eretu, Eretu, 0,
32551+
F3 4F 0F 01 CA, Eretu, Eretu, 0, enc=F30F01CA
32552+
32553+
F2 0F 01 CA, Erets, Erets, 0,
32554+
F2 4F 0F 01 CA, Erets, Erets, 0, enc=F20F01CA

Diff for: src/UnitTests/Intel/Encoder/OpCodeInfos.txt

+5
Original file line numberDiff line numberDiff line change
@@ -4321,3 +4321,8 @@ Ccs_hash_64, Ccs_hash, Unknown, Unknown, legacy, F3, 0F, A6E8, a64 F3 0F A6 E8,
43214321
Ccs_encrypt_16, Ccs_encrypt, Unknown, Unknown, legacy, F3, 0F, A7F0, a16 F3 0F A7 F0, CCS_ENCRYPT, 16 32 cpl0 cpl1 cpl2 cpl3 a16 intel16 intel32 amd16 amd32 rm pm v86 cm outside-smm in-smm outside-sgx in-sgx1 in-sgx2 outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam
43224322
Ccs_encrypt_32, Ccs_encrypt, Unknown, Unknown, legacy, F3, 0F, A7F0, a32 F3 0F A7 F0, CCS_ENCRYPT, 16 32 64 cpl0 cpl1 cpl2 cpl3 a32 intel16 intel32 intel64 amd16 amd32 amd64 rm pm v86 cm lm outside-smm in-smm outside-sgx in-sgx1 in-sgx2 outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam
43234323
Ccs_encrypt_64, Ccs_encrypt, Unknown, Unknown, legacy, F3, 0F, A7F0, a64 F3 0F A7 F0, CCS_ENCRYPT, 64 cpl0 cpl1 cpl2 cpl3 a64 intel64 amd64 lm outside-smm in-smm outside-sgx in-sgx1 in-sgx2 outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam
4324+
Lkgs_rm16, Lkgs, UInt16, Unknown, legacy, F2, 0F, 00, o16 F2 0F 00 /6, LKGS r/m16, g=6 64 cpl0 o16 op=r16_or_mem intel64 amd64 lm outside-smm in-smm outside-sgx outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam priv
4325+
Lkgs_r32m16, Lkgs, UInt16, Unknown, legacy, F2, 0F, 00, o32 F2 0F 00 /6, LKGS r32/m16, g=6 64 cpl0 o32 op=r32_or_mem intel64 amd64 lm outside-smm in-smm outside-sgx outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam priv
4326+
Lkgs_r64m16, Lkgs, UInt16, Unknown, legacy, F2, 0F, 00, F2 o64 0F 00 /6, LKGS r64/m16, g=6 64 cpl0 o64 op=r64_or_mem intel64 amd64 lm outside-smm in-smm outside-sgx outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam priv
4327+
Erets, Erets, Unknown, Unknown, legacy, F2, 0F, 01CA, F2 0F 01 CA, ERETS, 64 cpl0 stack intel64 amd64 lm outside-smm in-smm outside-sgx outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam priv
4328+
Eretu, Eretu, Unknown, Unknown, legacy, F3, 0F, 01CA, F3 0F 01 CA, ERETU, 64 cpl0 stack intel64 amd64 lm outside-smm in-smm outside-sgx outside-vmx-op in-vmx-root-op in-vmx-non-root-op outside-seam in-seam priv

Diff for: src/UnitTests/Intel/Formatter/Fast/Test64_Default.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
rep ccs_hash
83878387
rep ccs_encrypt
83888388
rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs [rax]
8391+
lkgs ecx
8392+
lkgs [rax]
8393+
lkgs rcx
8394+
lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Fast/Test64_Inverted.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
rep ccs_hash
83878387
rep ccs_encrypt
83888388
rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs word ptr ds:[rax]
8391+
lkgs ecx
8392+
lkgs word ptr ds:[rax]
8393+
lkgs rcx
8394+
lkgs word ptr ds:[rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Gas/Test64_ForceSuffix.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
addr32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
addr32 rep ccs_encrypt
8389+
lkgsw cx
8390+
lkgsw (rax)
8391+
lkgsw cx
8392+
lkgsw (rax)
8393+
lkgsw cx
8394+
lkgsw (rax)
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Gas/Test64_NoSuffix.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
addr32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
addr32 rep ccs_encrypt
8389+
lkgs %cx
8390+
lkgs (%rax)
8391+
lkgs %cx
8392+
lkgs (%rax)
8393+
lkgs %cx
8394+
lkgs (%rax)
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/InstructionInfos64.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ F3 0FA6 E8, Ccs_hash_64
83868386
67 F3 0FA6 E8, Ccs_hash_32
83878387
F3 0FA7 F0, Ccs_encrypt_64
83888388
67 F3 0FA7 F0, Ccs_encrypt_32
8389+
F2 66 0F00 F1, Lkgs_rm16
8390+
F2 66 0F00 30, Lkgs_rm16
8391+
F2 0F00 F1, Lkgs_r32m16
8392+
F2 0F00 30, Lkgs_r32m16
8393+
F2 48 0F00 F1, Lkgs_r64m16
8394+
F2 48 0F00 30, Lkgs_r64m16
8395+
F3 0F 01 CA, Eretu
8396+
F2 0F 01 CA, Erets

Diff for: src/UnitTests/Intel/Formatter/Intel/Test64_MemAlways.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
addr32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
addr32 rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs word ptr [rax]
8391+
lkgs ecx
8392+
lkgs word ptr [rax]
8393+
lkgs rcx
8394+
lkgs word ptr [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Intel/Test64_MemDefault.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
addr32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
addr32 rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs [rax]
8391+
lkgs ecx
8392+
lkgs [rax]
8393+
lkgs rcx
8394+
lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Intel/Test64_MemMinimum.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
addr32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
addr32 rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs [rax]
8391+
lkgs ecx
8392+
lkgs [rax]
8393+
lkgs rcx
8394+
lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Masm/Test64_MemAlways.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
rep ccs_hash
83878387
rep ccs_encrypt
83888388
rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs word ptr [rax]
8391+
lkgs ecx
8392+
lkgs word ptr [rax]
8393+
lkgs rcx
8394+
lkgs word ptr [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Masm/Test64_MemDefault.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
rep ccs_hash
83878387
rep ccs_encrypt
83888388
rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs word ptr [rax]
8391+
lkgs ecx
8392+
lkgs word ptr [rax]
8393+
lkgs rcx
8394+
lkgs word ptr [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Masm/Test64_MemMinimum.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
rep ccs_hash
83878387
rep ccs_encrypt
83888388
rep ccs_encrypt
8389+
lkgs cx
8390+
lkgs [rax]
8391+
lkgs ecx
8392+
lkgs [rax]
8393+
lkgs rcx
8394+
lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Nasm/Test64_MemAlways.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
a32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
a32 rep ccs_encrypt
8389+
o16 lkgs cx
8390+
o16 lkgs word [rax]
8391+
lkgs cx
8392+
lkgs word [rax]
8393+
o64 lkgs cx
8394+
o64 lkgs word [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Nasm/Test64_MemDefault.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
a32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
a32 rep ccs_encrypt
8389+
o16 lkgs cx
8390+
o16 lkgs [rax]
8391+
lkgs cx
8392+
lkgs [rax]
8393+
o64 lkgs cx
8394+
o64 lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/Formatter/Nasm/Test64_MemMinimum.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8386,3 +8386,11 @@ rep ccs_hash
83868386
a32 rep ccs_hash
83878387
rep ccs_encrypt
83888388
a32 rep ccs_encrypt
8389+
o16 lkgs cx
8390+
o16 lkgs [rax]
8391+
lkgs cx
8392+
lkgs [rax]
8393+
o64 lkgs cx
8394+
o64 lkgs [rax]
8395+
eretu
8396+
erets

Diff for: src/UnitTests/Intel/InstructionInfo/InstructionInfoTest_64.txt

+16
Original file line numberDiff line numberDiff line change
@@ -19245,3 +19245,19 @@ F3 0FA6 E8, Ccs_hash_64, Legacy, PADLOCK_GMI, crm=es:rdi;Unknown cwm=es:rdi;Unkn
1924519245
67 F3 0FA7 F0, Ccs_encrypt_32, Legacy, PADLOCK_GMI, crm=es:ebx;Unknown crm=es:esi;Unknown cwm=es:edi;Unknown cr=ebx;esi;edi cw=rsi;rdi r=ecx cw=rcx cr=eax
1924619246
# rep ccs_encrypt
1924719247
F3 0FA7 F0, Ccs_encrypt_64, Legacy, PADLOCK_GMI, crm=es:rbx;Unknown crm=es:rsi;Unknown cwm=es:rdi;Unknown cr=rbx;rsi;rdi cw=rsi;rdi rcw=rcx cr=rax
19248+
# lkgs cx
19249+
F2 66 0F00 F1, Lkgs_rm16, Legacy, LKGS, priv op0=r r=cx w=gs
19250+
# lkgs word ptr [rax]
19251+
F2 66 0F00 30, Lkgs_rm16, Legacy, LKGS, priv op0=r r=rax w=gs rm=ds:rax;UInt16
19252+
# lkgs cx
19253+
F2 0F00 F1, Lkgs_r32m16, Legacy, LKGS, priv op0=r r=cx w=gs
19254+
# lkgs word ptr [rax]
19255+
F2 0F00 30, Lkgs_r32m16, Legacy, LKGS, priv op0=r r=rax w=gs rm=ds:rax;UInt16
19256+
# lkgs cx
19257+
F2 48 0F00 F1, Lkgs_r64m16, Legacy, LKGS, priv op0=r r=cx w=gs
19258+
# lkgs word ptr [rax]
19259+
F2 48 0F00 30, Lkgs_r64m16, Legacy, LKGS, priv op0=r r=rax w=gs rm=ds:rax;UInt16
19260+
# eretu
19261+
F3 0F 01 CA, Eretu, Legacy, FRED, priv flow=Return fw=acopszidA w=cs;ss;rsp rw=xsp rm=ss:xsp;UInt64 rm=ss:xsp+8;UInt64 rm=ss:xsp+0x10;UInt64 rm=ss:xsp+0x18;UInt64 rm=ss:xsp+0x20;UInt64 stack=40
19262+
# erets
19263+
F2 0F 01 CA, Erets, Legacy, FRED, priv flow=Return fw=acopszidA w=rsp rw=xsp rm=ss:xsp;UInt64 rm=ss:xsp+8;UInt64 rm=ss:xsp+0x10;UInt64 rm=ss:xsp+0x18;UInt64 rm=ss:xsp+0x20;UInt64 stack=40

Diff for: src/csharp/Intel/Generator/Decoder/DecoderTable_Legacy.cs

+26-4
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,26 @@ public static (string name, object?[] handlers)[] CreateHandlers(GenTypes genTyp
880880
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Ew)], codeEnum[nameof(Code.Verr_rm16)], codeEnum[nameof(Code.Verr_r32m16)], codeEnum[nameof(Code.Verr_r64m16)] },
881881
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Ew)], codeEnum[nameof(Code.Verw_rm16)], codeEnum[nameof(Code.Verw_r32m16)], codeEnum[nameof(Code.Verw_r64m16)] },
882882
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Options_DontReadModRM)],
883-
invalid,
883+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.MandatoryPrefix)],
884+
invalid,
885+
invalid,
886+
invalid,
887+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Bitness_DontReadModRM)],
888+
invalid,
889+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Evw)], codeEnum[nameof(Code.Lkgs_rm16)], codeEnum[nameof(Code.Lkgs_r32m16)], codeEnum[nameof(Code.Lkgs_r64m16)] },
890+
},
891+
},
884892
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Bitness_DontReadModRM)],
885893
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Ev_3b)], codeEnum[nameof(Code.Jmpe_rm16)], codeEnum[nameof(Code.Jmpe_rm32)] },
886-
invalid,
894+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.MandatoryPrefix)],
895+
invalid,
896+
invalid,
897+
invalid,
898+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Bitness_DontReadModRM)],
899+
invalid,
900+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Evw)], codeEnum[nameof(Code.Lkgs_rm16)], codeEnum[nameof(Code.Lkgs_r32m16)], codeEnum[nameof(Code.Lkgs_r64m16)] },
901+
},
902+
},
887903
}, decoderOptionsEnum[nameof(DecoderOptions.Jmpe)]
888904
},
889905
invalid,
@@ -976,8 +992,14 @@ public static (string name, object?[] handlers)[] CreateHandlers(GenTypes genTyp
976992
new object[] { legacyEnum[nameof(OpCodeHandlerKind.MandatoryPrefix_NoModRM)],
977993
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Simple)], codeEnum[nameof(Code.Clac)] },
978994
invalid_NoModRM,
979-
invalid_NoModRM,
980-
invalid_NoModRM,
995+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Bitness)],
996+
invalid_NoModRM,
997+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Simple)], codeEnum[nameof(Code.Eretu)] },
998+
},
999+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Bitness)],
1000+
invalid_NoModRM,
1001+
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Simple)], codeEnum[nameof(Code.Erets)] },
1002+
},
9811003
},
9821004
new object[] { legacyEnum[nameof(OpCodeHandlerKind.MandatoryPrefix_NoModRM)],
9831005
new object[] { legacyEnum[nameof(OpCodeHandlerKind.Simple)], codeEnum[nameof(Code.Stac)] },

Diff for: src/csharp/Intel/Generator/Enums/Code.cs

+5
Original file line numberDiff line numberDiff line change
@@ -4329,6 +4329,11 @@ enum Code {
43294329
Ccs_encrypt_16,
43304330
Ccs_encrypt_32,
43314331
Ccs_encrypt_64,
4332+
Lkgs_rm16,
4333+
Lkgs_r32m16,
4334+
Lkgs_r64m16,
4335+
Erets,
4336+
Eretu,
43324337
}
43334338

43344339
[TypeGen(TypeGenOrders.CreatedInstructions)]

Diff for: src/csharp/Intel/Generator/Enums/InstructionInfo/CpuidFeature.cs

+4
Original file line numberDiff line numberDiff line change
@@ -316,5 +316,9 @@ enum CpuidFeature {
316316
AVX_VNNI,
317317
[Comment("CPUID.0C0000000H:EAX >= 0C0000001H AND CPUID.0C0000001H:EDX.GMI[Bits 5:4] = 11B ([4] = exists, [5] = enabled)")]
318318
PADLOCK_GMI,
319+
[Comment("CPUID.(EAX=07H, ECX=01H):EAX.FRED[bit 17]")]
320+
FRED,
321+
[Comment("CPUID.(EAX=07H, ECX=01H):EAX.LKGS[bit 18]")]
322+
LKGS,
319323
}
320324
}

Diff for: src/csharp/Intel/Generator/Enums/Mnemonic.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1633,5 +1633,8 @@ enum Mnemonic {
16331633
Hreset,
16341634
Ccs_hash,
16351635
Ccs_encrypt,
1636+
Lkgs,
1637+
Erets,
1638+
Eretu,
16361639
}
16371640
}

0 commit comments

Comments
 (0)