diff --git a/VS/CSHARP/asm-dude-vsix/HighlightWord/HighlightWordTagger.cs b/VS/CSHARP/asm-dude-vsix/HighlightWord/HighlightWordTagger.cs index 759fc714..fcd7d625 100644 --- a/VS/CSHARP/asm-dude-vsix/HighlightWord/HighlightWordTagger.cs +++ b/VS/CSHARP/asm-dude-vsix/HighlightWord/HighlightWordTagger.cs @@ -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; diff --git a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml index 96aba4e8..0cfaae1f 100644 --- a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml +++ b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml @@ -453,6 +453,12 @@ + + + + + + diff --git a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml.cs b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml.cs index 00e4ddc1..ec4ccad1 100644 --- a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml.cs +++ b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionPageUI.xaml.cs @@ -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 diff --git a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionsPage.cs b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionsPage.cs index 860ec87d..8b808607 100644 --- a/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionsPage.cs +++ b/VS/CSHARP/asm-dude-vsix/OptionsPage/AsmDudeOptionsPage.cs @@ -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 @@ -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); @@ -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 @@ -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; @@ -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; @@ -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 diff --git a/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoController.cs b/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoController.cs index 88b5dc32..187f2c85 100644 --- a/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoController.cs +++ b/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoController.cs @@ -105,19 +105,28 @@ 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; } @@ -125,11 +134,13 @@ private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e) { 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; } @@ -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; } diff --git a/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSource.cs b/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSource.cs index 3f360afb..2689876d 100644 --- a/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSource.cs +++ b/VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSource.cs @@ -65,6 +65,12 @@ public AsmQuickInfoSource( this._asmDudeTools = AsmDudeTools.Instance; } + //public void AugmentQuickInfoSession(IQuickInfoSession session, IList quickInfoContent, out ITrackingSpan applicableToSpan) + //{ + // AugmentQuickInfoSession_OK(session, quickInfoContent, out applicableToSpan); + //AugmentQuickInfoSession_Bug(session, quickInfoContent, out applicableToSpan); + //} + public void AugmentQuickInfoSession_Bug(IQuickInfoSession session, IList quickInfoContent, out ITrackingSpan applicableToSpan) { var snapshot = this._sourceBuffer.CurrentSnapshot; diff --git a/VS/CSHARP/asm-dude-vsix/QuickInfo/InstructionTooltipWindow.xaml.cs b/VS/CSHARP/asm-dude-vsix/QuickInfo/InstructionTooltipWindow.xaml.cs index 3ce75349..d94e94cd 100644 --- a/VS/CSHARP/asm-dude-vsix/QuickInfo/InstructionTooltipWindow.xaml.cs +++ b/VS/CSHARP/asm-dude-vsix/QuickInfo/InstructionTooltipWindow.xaml.cs @@ -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"); diff --git a/VS/CSHARP/asm-dude-vsix/Tools/AsmDudeToolsStatic.cs b/VS/CSHARP/asm-dude-vsix/Tools/AsmDudeToolsStatic.cs index b1d2943c..5f9f8e5d 100644 --- a/VS/CSHARP/asm-dude-vsix/Tools/AsmDudeToolsStatic.cs +++ b/VS/CSHARP/asm-dude-vsix/Tools/AsmDudeToolsStatic.cs @@ -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; - } - /// /// Find the previous keyword (if any) that exists BEFORE the provided triggerPoint, and the provided start. /// Eg. qqqq xxxxxx yyyyyyy zzzzzz diff --git a/VS/CSHARP/asm-dude-vsix/source.extension.cs b/VS/CSHARP/asm-dude-vsix/source.extension.cs index db5431bc..273ba076 100644 --- a/VS/CSHARP/asm-dude-vsix/source.extension.cs +++ b/VS/CSHARP/asm-dude-vsix/source.extension.cs @@ -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"; } diff --git a/VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest b/VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest index 626eb2d4..1e9db2f0 100644 --- a/VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest +++ b/VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + AsmDude Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window https://github.com/HJLebbink/asm-dude diff --git a/VS/CSHARP/asm-sim-main/ProgramZ3.cs b/VS/CSHARP/asm-sim-main/ProgramZ3.cs index a26cb334..a2cefb1c 100644 --- a/VS/CSHARP/asm-sim-main/ProgramZ3.cs +++ b/VS/CSHARP/asm-sim-main/ProgramZ3.cs @@ -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(); @@ -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 = diff --git a/VS/CSHARP/asm-tools-lib/Arch.cs b/VS/CSHARP/asm-tools-lib/Arch.cs index f58fa16f..fe46f51b 100644 --- a/VS/CSHARP/asm-tools-lib/Arch.cs +++ b/VS/CSHARP/asm-tools-lib/Arch.cs @@ -181,24 +181,28 @@ public enum Arch { XSAVEOPT, #endregion - //Software Guard Extensions + /// Software Guard Extensions 1 SGX1, - - //Software Guard Extensions + + /// Software Guard Extensions 2 SGX2, /// SAFER MODE EXTENSIONS SMX, - + /// Cache Line DEMOTE (CPUID.(EAX=0x7, ECX=0):ECX[bit25]) CLDEMOTE, + /// Direct store instructions – Direct store using write combining (WC) for 64B (CPUID.(EAX=?, ECX=?):ECX[bit?]) MOVDIR64B, + /// Direct store instructions – Direct store using write combining (WC) for doublewords (CPUID.(EAX=?, ECX=?):ECX[bit?]) MOVDIRI, + /// (CPUID.(EAX=0x?, ECX=?):ECX[bit?]) PCONFIG, + /// User wait – TPAUSE, UMONITOR, UMWAIT (CPUID.(EAX=0x?, ECX=?):ECX[bit?]) WAITPKG, diff --git a/VS/CSHARP/asm-tools-lib/ExpressionEvaluator.cs b/VS/CSHARP/asm-tools-lib/ExpressionEvaluator.cs index faa6ef72..397ee31f 100644 --- a/VS/CSHARP/asm-tools-lib/ExpressionEvaluator.cs +++ b/VS/CSHARP/asm-tools-lib/ExpressionEvaluator.cs @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2017 Henk-Jan Lebbink +// Copyright (c) 2018 Henk-Jan Lebbink // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/VS/CSHARP/unit-tests-asm-tools/Properties/AssemblyInfo.cs b/VS/CSHARP/unit-tests-asm-tools/Properties/AssemblyInfo.cs index 5be38478..1a641ef4 100644 --- a/VS/CSHARP/unit-tests-asm-tools/Properties/AssemblyInfo.cs +++ b/VS/CSHARP/unit-tests-asm-tools/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("unit-tests-asm-tools")] -[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]