Skip to content

Commit

Permalink
added option pages for new CPUID flags
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Jun 10, 2018
1 parent 9fdfaf9 commit 8642e0a
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 40 deletions.
6 changes: 1 addition & 5 deletions VS/CSHARP/asm-dude-vsix/HighlightWord/HighlightWordTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,13 @@ private void UpdateAtCaretPosition(CaretPosition caretPosition)
// we don't need to check it.
if (newWordExtend.HasValue)
{
string newWord = newWordExtend.Value.Span.GetText();
string newWord = newWordExtend.Value.Span.GetText().Trim();
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:Update_Word_Adornments. caretPoisition={1}; point={2}; newWordExtend={3}", this.ToString(), caretPosition, point, newWordExtend));

if ((this.CurrentWord != null) && newWord.Equals(this.CurrentWord))
{
return;
}
else if (newWord == " ") // test for some words that one may not want to highlight.
{
return;
}
else
{
this.RequestedPoint = point.Value;
Expand Down
6 changes: 6 additions & 0 deletions VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@
<CheckBox x:Name="UseArch_SMX_UI" Content="SMX - Safer Mode Extensions" Width="Auto" />
<CheckBox x:Name="UseArch_SGX1_UI" Content="SGX1 - Software Guard Extensions 1" Width="Auto" />
<CheckBox x:Name="UseArch_SGX2_UI" Content="SGX2 - Software Guard Extensions 2" Width="Auto" />

<CheckBox x:Name="UseArch_CLDEMOTE_UI" Content="CLDEMOTE - Cache Line DEMOTE" Width="Auto" />
<CheckBox x:Name="UseArch_MOVDIR64B_UI" Content="MOVDIR64B - Direct store instructions" Width="Auto" />
<CheckBox x:Name="UseArch_MOVDIRI_UI" Content="MOVDIRI - Direct store instructions" Width="Auto" />
<CheckBox x:Name="UseArch_PCONFIG_UI" Content="PCONFIG" Width="Auto" />
<CheckBox x:Name="UseArch_WAITPKG_UI" Content="User Wait" Width="Auto" />
</StackPanel>
</GroupBox>
<GroupBox Header="Misc" >
Expand Down
28 changes: 28 additions & 0 deletions VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,34 @@ public bool UseArch_SGX2
get { return this.UseArch_SGX2_UI.IsChecked ?? false; }
set { this.UseArch_SGX2_UI.IsChecked = value; }
}

public bool UseArch_CLDEMOTE
{
get { return this.UseArch_CLDEMOTE_UI.IsChecked ?? false; }
set { this.UseArch_CLDEMOTE_UI.IsChecked = value; }
}
public bool UseArch_MOVDIR64B
{
get { return this.UseArch_MOVDIR64B_UI.IsChecked ?? false; }
set { this.UseArch_MOVDIR64B_UI.IsChecked = value; }
}
public bool UseArch_MOVDIRI
{
get { return this.UseArch_MOVDIRI_UI.IsChecked ?? false; }
set { this.UseArch_MOVDIRI_UI.IsChecked = value; }
}
public bool UseArch_PCONFIG
{
get { return this.UseArch_PCONFIG_UI.IsChecked ?? false; }
set { this.UseArch_PCONFIG_UI.IsChecked = value; }
}
public bool UseArch_WAITPKG
{
get { return this.UseArch_WAITPKG_UI.IsChecked ?? false; }
set { this.UseArch_WAITPKG_UI.IsChecked = value; }
}


#endregion

#region Intellisense
Expand Down
76 changes: 75 additions & 1 deletion VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,17 @@ protected override void OnActivate(CancelEventArgs e)
this._asmDudeOptionsPageUI.UseArch_SGX1_UI.ToolTip = MakeToolTip(Arch.SGX1);
this._asmDudeOptionsPageUI.UseArch_SGX2 = Settings.Default.ARCH_SGX2;
this._asmDudeOptionsPageUI.UseArch_SGX2_UI.ToolTip = MakeToolTip(Arch.SGX2);

this._asmDudeOptionsPageUI.UseArch_CLDEMOTE = Settings.Default.ARCH_CLDEMOTE;
this._asmDudeOptionsPageUI.UseArch_CLDEMOTE_UI.ToolTip = MakeToolTip(Arch.CLDEMOTE);
this._asmDudeOptionsPageUI.UseArch_MOVDIR64B = Settings.Default.ARCH_MOVDIR64B;
this._asmDudeOptionsPageUI.UseArch_MOVDIR64B_UI.ToolTip = MakeToolTip(Arch.MOVDIR64B);
this._asmDudeOptionsPageUI.UseArch_MOVDIRI = Settings.Default.ARCH_MOVDIRI;
this._asmDudeOptionsPageUI.UseArch_MOVDIRI_UI.ToolTip = MakeToolTip(Arch.MOVDIRI);
this._asmDudeOptionsPageUI.UseArch_PCONFIG = Settings.Default.ARCH_PCONFIG;
this._asmDudeOptionsPageUI.UseArch_PCONFIG_UI.ToolTip = MakeToolTip(Arch.PCONFIG);
this._asmDudeOptionsPageUI.UseArch_WAITPKG = Settings.Default.ARCH_WAITPKG;
this._asmDudeOptionsPageUI.UseArch_WAITPKG_UI.ToolTip = MakeToolTip(Arch.WAITPKG);
#endregion

#region Intellisense
Expand Down Expand Up @@ -610,7 +621,9 @@ protected override void OnDeactivate(CancelEventArgs e)
sb.AppendLine("UseSignatureHelp=" + this._asmDudeOptionsPageUI.UseSignatureHelp);
changed = true;
}
#endregion

#region ARCH
if (Settings.Default.ARCH_8086 != this._asmDudeOptionsPageUI.UseArch_8086)
{
sb.AppendLine("UseArch_8086=" + this._asmDudeOptionsPageUI.UseArch_8086);
Expand Down Expand Up @@ -955,6 +968,33 @@ protected override void OnDeactivate(CancelEventArgs e)
sb.AppendLine("UseArch_SGX2=" + this._asmDudeOptionsPageUI.UseArch_SGX2);
changed = true;
}

if (Settings.Default.ARCH_CLDEMOTE != this._asmDudeOptionsPageUI.UseArch_CLDEMOTE)
{
sb.AppendLine("UseArch_CLDEMOTE=" + this._asmDudeOptionsPageUI.UseArch_CLDEMOTE);
changed = true;
}
if (Settings.Default.ARCH_MOVDIR64B != this._asmDudeOptionsPageUI.UseArch_MOVDIR64B)
{
sb.AppendLine("UseArch_MOVDIR64B=" + this._asmDudeOptionsPageUI.UseArch_MOVDIR64B);
changed = true;
}
if (Settings.Default.ARCH_MOVDIRI != this._asmDudeOptionsPageUI.UseArch_MOVDIRI)
{
sb.AppendLine("UseArch_MOVDIRI=" + this._asmDudeOptionsPageUI.UseArch_MOVDIRI);
changed = true;
}
if (Settings.Default.ARCH_PCONFIG != this._asmDudeOptionsPageUI.UseArch_PCONFIG)
{
sb.AppendLine("UseArch_PCONFIG=" + this._asmDudeOptionsPageUI.UseArch_PCONFIG);
changed = true;
}
if (Settings.Default.ARCH_WAITPKG != this._asmDudeOptionsPageUI.UseArch_WAITPKG)
{
sb.AppendLine("UseArch_WAITPKG=" + this._asmDudeOptionsPageUI.UseArch_WAITPKG);
changed = true;
}

#endregion

#region Intellisense
Expand Down Expand Up @@ -1274,7 +1314,6 @@ private void Save()
{
bool refreshRegistry = false;


if (Settings.Default.SyntaxHighlighting_On != this._asmDudeOptionsPageUI.SyntaxHighlighting_On)
{
Settings.Default.SyntaxHighlighting_On = this._asmDudeOptionsPageUI.SyntaxHighlighting_On;
Expand Down Expand Up @@ -1533,6 +1572,9 @@ private void Save()
Settings.Default.SignatureHelp_On = this._asmDudeOptionsPageUI.UseSignatureHelp;
changed = true;
}
#endregion

#region ARCH
if (Settings.Default.ARCH_8086 != this._asmDudeOptionsPageUI.UseArch_8086)
{
Settings.Default.ARCH_8086 = this._asmDudeOptionsPageUI.UseArch_8086;
Expand Down Expand Up @@ -1945,6 +1987,38 @@ private void Save()
changed = true;
archChanged = true;
}

if (Settings.Default.ARCH_CLDEMOTE != this._asmDudeOptionsPageUI.UseArch_CLDEMOTE)
{
Settings.Default.ARCH_CLDEMOTE = this._asmDudeOptionsPageUI.UseArch_CLDEMOTE;
changed = true;
archChanged = true;
}
if (Settings.Default.ARCH_MOVDIR64B != this._asmDudeOptionsPageUI.UseArch_MOVDIR64B)
{
Settings.Default.ARCH_MOVDIR64B = this._asmDudeOptionsPageUI.UseArch_MOVDIR64B;
changed = true;
archChanged = true;
}
if (Settings.Default.ARCH_MOVDIRI != this._asmDudeOptionsPageUI.UseArch_MOVDIRI)
{
Settings.Default.ARCH_MOVDIRI = this._asmDudeOptionsPageUI.UseArch_MOVDIRI;
changed = true;
archChanged = true;
}
if (Settings.Default.ARCH_PCONFIG != this._asmDudeOptionsPageUI.UseArch_PCONFIG)
{
Settings.Default.ARCH_PCONFIG = this._asmDudeOptionsPageUI.UseArch_PCONFIG;
changed = true;
archChanged = true;
}
if (Settings.Default.ARCH_WAITPKG != this._asmDudeOptionsPageUI.UseArch_WAITPKG)
{
Settings.Default.ARCH_WAITPKG = this._asmDudeOptionsPageUI.UseArch_WAITPKG;
changed = true;
archChanged = true;
}

#endregion

#region Intellisense
Expand Down
21 changes: 16 additions & 5 deletions VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,42 @@ private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
int pos = point.Value.Position;
int pos2 = Get_Keyword_Span_At_Point(point.Value).Start;

AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: CreateQuickInfoSession for triggerPoint " + pos + "; pos2=" + pos2);
//AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: CreateQuickInfoSession for triggerPoint " + pos + "; pos2=" + pos2);
//ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(pos, PointTrackingMode.Positive);
ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(pos2, PointTrackingMode.Positive);

if (this._session == null)
{
AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: A: session was null, create a new session for triggerPoint " + pos + "; pos2=" + pos2);
this._session = this._quickInfoBroker.TriggerQuickInfo(this._textView, triggerPoint, false);
if (this._session != null) this._session.Dismissed += this._session_Dismissed;
if (this._session != null)
{
this._session.Dismissed += this._session_Dismissed;
//this._session.ApplicableToSpanChanged += (o, i) => { AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:ApplicableToSpanChanged Event"); };
//this._session.PresenterChanged += (o, i) => { AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:PresenterChanged Event"); };
//this._session.Recalculated += (o, i) => { AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:Recalculated Event"); };
}
}
else
{
if (this._session.IsDismissed)
{
AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: B: session was not null but was dismissed, create a new session for triggerPoint " + pos + "; pos2=" + pos2);

this._session = this._quickInfoBroker.TriggerQuickInfo(this._textView, triggerPoint, false);
if (this._session != null) this._session.Dismissed += this._session_Dismissed;
}
else
{
if (this._session.ApplicableToSpan.GetSpan(this._textView.TextSnapshot).IntersectsWith(new Span(point.Value.Position, 0)))
{
AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: intersects!");
AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: C: session was not dismissed: intersects!");
}
else
{
if (this._session != null) this._session.Dismiss();
AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:OnTextViewMouseHover: D: session was not dismissed but we need a new session for triggerPoint " + pos + "; pos2=" + pos2);

//if (this._session != null) this._session.Dismiss();
this._session = this._quickInfoBroker.TriggerQuickInfo(this._textView, triggerPoint, false);
if (this._session != null) this._session.Dismissed += this._session_Dismissed;
}
Expand Down Expand Up @@ -160,7 +171,7 @@ private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)

private void _session_Dismissed(object sender, EventArgs e)
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:_session_Dismissed", ToString()));
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:_session_Dismissed: e={1}", ToString(), e));
this._session = null;
}

Expand Down
6 changes: 6 additions & 0 deletions VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public AsmQuickInfoSource(
this._asmDudeTools = AsmDudeTools.Instance;
}

//public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
//{
// AugmentQuickInfoSession_OK(session, quickInfoContent, out applicableToSpan);
//AugmentQuickInfoSession_Bug(session, quickInfoContent, out applicableToSpan);
//}

public void AugmentQuickInfoSession_Bug(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
var snapshot = this._sourceBuffer.CurrentSnapshot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,33 @@ public InstructionTooltipWindow(Brush foreground)
{
this._foreground = foreground;
InitializeComponent();
/*
this.MainWindow.MouseLeftButtonDown += (o, i) => {
AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:MouseLeftButtonDown Event");
i.Handled = true; // dont let the mouse event from inside this window bubble up to VS
};
this.MainWindow.PreviewMouseLeftButtonDown += (o, i) =>
{
//i.Handled = true; // if true then no event is able to bubble to the gui
AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:PreviewMouseLeftButtonDown Event");
};
*/
this.AsmSimGridExpander.Collapsed += (o, i) => { this.AsmSimGridExpanderNumeration.Visibility = Visibility.Collapsed; };
this.AsmSimGridExpander.Expanded += (o, i) => { this.AsmSimGridExpanderNumeration.Visibility = Visibility.Visible; };
}

/*
private void GotMouseCapture_Click(object sender, RoutedEventArgs e)
{
AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:PerformanceExpander_Click");
e.Handled = true;
}
*/

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
//AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:CloseButton_Click");
AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:CloseButton_Click");
if (this.Owner != null) this.Owner.CloseToolTip();
if (this.Session != null) this.Session.Dismiss();
AsmDudeToolsStatic.Output_INFO("InstructionTooltipWindow:CloseButton_Click: owner and session are null");
Expand Down
20 changes: 0 additions & 20 deletions VS/CSHARP/asm-dude-vsix/Tools/AsmDudeToolsStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,26 +442,6 @@ public static string Get_Keyword_Str(SnapshotPoint? bufferPosition)
return null;
}

// TODO: THIS CODE MAY NOT WORK.
public static TextExtent? Get_Keyword_OLD(SnapshotPoint? bufferPosition)
{
if (bufferPosition != null)
{
string line = bufferPosition.Value.GetContainingLine().GetText();
int startLine = bufferPosition.Value.GetContainingLine().Start;
int currentPos = bufferPosition.Value.Position;

var (beginPos, endPos) = AsmTools.AsmSourceTools.GetKeywordPos(currentPos - startLine, line);
//AsmDudeToolsStatic.Output_INFO(string.Format("getKeywordPos: beginPos={0}; endPos={1}.", t.Item1, t.Item2));
int length = endPos - beginPos;

SnapshotSpan span = new SnapshotSpan(bufferPosition.Value.Snapshot, beginPos, length);
//AsmDudeToolsStatic.Output_INFO("getKeyword: \"" + span.GetText() + "\".");
return new TextExtent(span, true);
}
return null;
}

/// <summary>
/// Find the previous keyword (if any) that exists BEFORE the provided triggerPoint, and the provided start.
/// Eg. qqqq xxxxxx yyyyyyy zzzzzz
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/asm-dude-vsix/source.extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static class Vsix
public const string Name = "AsmDude";
public const string Description = "Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window ";
public const string Language = "en-US";
public const string Version = "1.9.5.1";
public const string Version = "1.9.5.2";
public const string Author = "Henk-Jan Lebbink";
public const string Tags = "Assembly, Assembler, ASM, Syntax Highlighting, Code Completion, Disassembly Window, Code Analysis, x86_64, SSE, AVX, AVX2, AVX512";
}
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="c729d6b2-f412-49ed-893d-a8f61f25db98" Version="1.9.5.1" Language="en-US" Publisher="Henk-Jan Lebbink" />
<Identity Id="c729d6b2-f412-49ed-893d-a8f61f25db98" Version="1.9.5.2" Language="en-US" Publisher="Henk-Jan Lebbink" />
<DisplayName>AsmDude</DisplayName>
<Description xml:space="preserve">Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window </Description>
<MoreInfo>https://github.com/HJLebbink/asm-dude</MoreInfo>
Expand Down
8 changes: 8 additions & 0 deletions VS/CSHARP/asm-sim-main/ProgramZ3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static void Main(string[] args)
System.Version ver = thisAssemName.Version;
Console.WriteLine(string.Format("Loaded AsmSim version {0}.", ver));

ExpressionTest();
//TestMem2();
//TestExecutionTree();
//TestGraph();
Expand All @@ -62,6 +63,13 @@ static void Main(string[] args)
Console.ReadKey();
}


static void ExpressionTest()
{
var (Valid, Value, NBits) = ExpressionEvaluator.Evaluate_Constant("01b", false);
Console.WriteLine("valid = " + Value + "; value = " + Value, "; nBits = " + NBits);
}

static void TestExecutionTree()
{
string programStr =
Expand Down
Loading

0 comments on commit 8642e0a

Please sign in to comment.