Skip to content

Commit

Permalink
Verify smm/sgx/vmx/seam flags
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Oct 18, 2020
1 parent aa78af0 commit 6e9f598
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/csharp/Intel/Generator/Tables/InstructionDefsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,22 @@ static string UppercaseFirstLetter(string s) =>
Error(state.LineIndex, "amd-vm-exit and amd-may-vm-exit can't both be used. Remove one of them.");
return false;
}
if ((state.Flags2 & (InstructionDefFlags2.UseOutsideSmm | InstructionDefFlags2.UseInSmm)) == 0) {
Error(state.LineIndex, "Invalid SMM flags");
return false;
}
if ((state.Flags2 & (InstructionDefFlags2.UseOutsideEnclaveSgx | AllEnclaves)) == 0) {
Error(state.LineIndex, "Invalid SGX flags");
return false;
}
if ((state.Flags2 & (InstructionDefFlags2.UseOutsideVmxOp | InstructionDefFlags2.UseInVmxRootOp | InstructionDefFlags2.UseInVmxNonRootOp)) == 0) {
Error(state.LineIndex, "Invalid VMX flags");
return false;
}
if ((state.Flags2 & (InstructionDefFlags2.UseOutsideSeam | InstructionDefFlags2.UseInSeam)) == 0) {
Error(state.LineIndex, "Invalid SEAM flags");
return false;
}

var codeFormatter = new CodeFormatter(sb, memSizeTbl, state.CodeMnemonic, state.CodeSuffix, state.CodeMemorySize,
state.CodeMemorySizeSuffix, state.MemorySize, state.MemorySize_Broadcast, state.Flags1, parsedOpCode.Encoding, state.OpKinds);
Expand Down

0 comments on commit 6e9f598

Please sign in to comment.