Skip to content

Commit

Permalink
Various Bug Fixes and Updated Documentation (#1058)
Browse files Browse the repository at this point in the history
* - Fixes

* - Fixes

* - Fixes

* - Fixes

* - Fixes
  • Loading branch information
tgiphil committed May 27, 2023
1 parent 142fab6 commit 050be28
Show file tree
Hide file tree
Showing 63 changed files with 665 additions and 513 deletions.
18 changes: 8 additions & 10 deletions Source/Docs/command-line-arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ Below are the command line arguments available:
-display,Emulator.Display,on
-display-off,Emulator.Display,off
-memory,Emulator.Memory,
-qemu-gdb,Emulator.GDB,false
-gdb,Emulator.GDB,true

Launcher - Emulator - VMWare:
Launcher - Emulator - Qemu & VMWare:
-vmware-svga,Emulator.SVGA,vmware
-virtio-vga,Emulator.SVGA,virtio

Launcher - Image:
-image,Image.ImageFile,{value}
Expand Down Expand Up @@ -139,19 +140,16 @@ Below are the command line arguments available:
-video-depth,Multiboot.Video.Depth,{value}

Launcher - GDB:
-launch-gdb-debugger,Launcher.LaunchDebugger,true

Launcher - Advance:
-hunt-corlib,Launcher.HuntForCorLib,true
-plug-korlib,Launcher.PlugKorlib,true

Launcher - GDB
-gdb,Launcher.LaunchDebugger,true
-launch-debugger,Launcher.GDB,true
-launch-gdb,Launcher.Debugger,true

Launcher & Debugger - GDB
-gdb-port,GDB.Port,{value}
-gdb-host,GDB.Host,{value}

Launcher - Advance:
-plug-korlib,Launcher.PlugKorlib,true

Operating System:
-osname,OS.Name,{value}

Expand Down
Binary file modified Source/Docs/images/mosa-optimization-options.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions Source/Docs/settings-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ Launcher Settings
Launcher.Launch,"If true, launch a virtual machine after compiling the application and generating the virtual machine image"
Launcher.Exit,"If true, exit immediately after launch"
Launcher.PlugKorlib,"If true, automatically include the plugs for CoreLib"
Launcher.HuntForCorLib,"If true, search for CoreLib in various directories"
Launcher.LaunchGDB,"If true, launch the GNU GDB application after VM launch"
Launcher.LaunchDebugger,"If true, launch the MOSA debugger application after VM launch"
Launcher.GDB,"If true, launch the GNU GDB application after VM launch"
Launcher.Debugger,"If true, launch the MOSA debugger application after VM launch"
Launcher.Test,"If true, monitors VM serial for success or failure messages"

Image Settings
Expand All @@ -149,7 +148,7 @@ Emulator Settings
Emulator,"Type of Emulator QEMU, VMware, Bochs"
Emulator.Memory,Amount of memory for the virtual machine in MB
Emulator.Display,"If true, show the video display"
Emulator.SVGA,"SVGA mode: std, cirrus, vbe or vmware"
Emulator.SVGA,"SVGA mode: std, cirrus, vbe, virtio or vmware"
Emulator.GDB,"If true, enables GDB within emulator"
Emulator.Serial,"Serial Emulation type None, Pipe, TCPServer, TCPClient"
Emulator.Serial.Host,Serial Host Name or IP address
Expand Down Expand Up @@ -205,7 +204,7 @@ Application Location Settings
AppLocation.VmwarePlayer,Location of the VMPlayer application
AppLocation.Ndisasm,Location of the Ndisasm application
AppLocation.Mkisofs,Location of the Mkisofs application
AppLocation.GDB,Location of the QEMU application
AppLocation.GDB,Location of the GDB application

OS Settings
-----------------------------
Expand Down
5 changes: 0 additions & 5 deletions Source/Mosa.Compiler.Framework/BaseMethodCompilerStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,6 @@ public static void UpdatePhi(InstructionNode node)
Debug.Assert(node.OperandCount == node.Block.PreviousBlocks.Count);
}

public static void UpdatePhi(Context context)
{
UpdatePhi(context.Node);
}

public static void RemoveBlockFromPhi(BasicBlock removedBlock, BasicBlock phiBlock)
{
for (var node = phiBlock.AfterFirst; !node.IsBlockEndInstruction; node = node.Next)
Expand Down
4 changes: 0 additions & 4 deletions Source/Mosa.Compiler.Framework/TransformContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,6 @@ public static void UpdatePhi(InstructionNode node)
BaseMethodCompilerStage.UpdatePhi(node);
}

public static void UpdatePhi(Context context)
{
BaseMethodCompilerStage.UpdatePhi(context);
}

#endregion Phi Helpers

Expand Down
4 changes: 2 additions & 2 deletions Source/Mosa.Compiler.Framework/Transforms/Exception/TryEnd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void Transform(Context context, TransformContext transform)

var next = FindNextEnclosingFinallyHandler(transform, immediate);

if (next != null && next.FilterStart < immediate.HandlerEnd)
if (next != null && next.HandlerEnd > immediate.HandlerEnd)
{
context.SetInstruction(IRInstruction.MoveObject, transform.LeaveTargetRegister, Operand.CreateConstant32(target.Label));
context.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, Operand.NullObject);
Expand All @@ -44,4 +44,4 @@ public override void Transform(Context context, TransformContext transform)

context.SetInstruction(IRInstruction.Jmp, target);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public override bool Match(Context context, TransformContext transform)

public override void Transform(Context context, TransformContext transform)
{
TransformContext.UpdatePhi(context);
TransformContext.UpdatePhi(context.Node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public override bool Match(Context context, TransformContext transform)

public override void Transform(Context context, TransformContext transform)
{
TransformContext.UpdatePhi(context);
TransformContext.UpdatePhi(context.Node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public override bool Match(Context context, TransformContext transform)

public override void Transform(Context context, TransformContext transform)
{
TransformContext.UpdatePhi(context);
TransformContext.UpdatePhi(context.Node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public override bool Match(Context context, TransformContext transform)

public override void Transform(Context context, TransformContext transform)
{
TransformContext.UpdatePhi(context);
TransformContext.UpdatePhi(context.Node);
}
}
15 changes: 8 additions & 7 deletions Source/Mosa.Demo.TestWorld.x86/Boot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Mosa.Runtime.Plug;
using Mosa.Runtime.x86;
using Mosa.UnitTests.Other;
using Mosa.UnitTests.Primitive;

namespace Mosa.Demo.TestWorld.x86;

Expand Down Expand Up @@ -73,12 +74,12 @@ public static void Main()

//Screen.Write("FindTypeOfTest: ");

//Test1();
var r = Test1();

//if (value3)
// Screen.WriteLine("Ok");
//else
// Screen.WriteLine("Failed");
if (r)
Screen.WriteLine("Ok");
else
Screen.WriteLine("Failed");

//UnitTest();

Expand Down Expand Up @@ -311,13 +312,13 @@ public static int CallReturn10()
[MethodImpl(MethodImplOptions.NoInlining)]
public static bool Test1()
{
return UnitTests.Primitive.CheckedTests.MulI8I8(0, 0) == 0;
return !DoubleTests.CeqR8R8(0, 1);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static bool Test2()
{
return UnitTests.Primitive.CheckedTests.MulI8I8(-2147483646, -2) == 4294967292;
return CheckedTests.MulI8I8(-2147483646, -2) == 4294967292;
}

[MethodImpl(MethodImplOptions.NoInlining)]
Expand Down
1 change: 0 additions & 1 deletion Source/Mosa.Tool.Compiler/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ private void SetDefaultSettings()
Settings.SetValue("Launcher.Start", false);
Settings.SetValue("Launcher.Launch", false);
Settings.SetValue("Launcher.Exit", false);
Settings.SetValue("Launcher.HuntForCorLib", true);
Settings.SetValue("OS.Name", "MOSA");
}

Expand Down
14 changes: 4 additions & 10 deletions Source/Mosa.Tool.Compiler/CompilerToolSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ public int GDBPort
set => Settings.SetValue("GDB.Port", value);
}

public bool HuntForCorLib
{
get => Settings.GetValue("Launcher.HuntForCorLib", false);
set => Settings.SetValue("Launcher.HuntForCorLib", value);
}

public string DefaultFolder
{
get => Settings.GetValue("DefaultFolder", null);
Expand Down Expand Up @@ -180,14 +174,14 @@ public bool LauncherStart

public bool LaunchGDB
{
get => Settings.GetValue("Launcher.LaunchGDB", false);
set => Settings.SetValue("Launcher.LaunchGDB", value);
get => Settings.GetValue("Launcher.GDB", false);
set => Settings.SetValue("Launcher.GDB", value);
}

public bool LaunchDebugger
{
get => Settings.GetValue("Launcher.LaunchDebugger", false);
set => Settings.SetValue("Launcher.LaunchDebugger", value);
get => Settings.GetValue("Launcher.Debugger", false);
set => Settings.SetValue("Launcher.Debugger", value);
}

public string LinkerFormat => Settings.GetValue("Linker.Format", "elf32");
Expand Down
2 changes: 1 addition & 1 deletion Source/Mosa.Tool.Debugger/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public MainForm()
Settings.SetValue("Emulator.GDB", true);
Settings.SetValue("Emulator.Serial", "TCPServer");
Settings.SetValue("Emulator.Serial.Port", 1250);
Settings.SetValue("Emulator.Display", false);
Settings.SetValue("Emulator.Display", true);

GDBPort = 1234;

Expand Down
1 change: 0 additions & 1 deletion Source/Mosa.Tool.Explorer/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ private void SetDefaultSettings()
Settings.SetValue("Launcher.Start", false);
Settings.SetValue("Launcher.Launch", false);
Settings.SetValue("Launcher.Exit", false);
Settings.SetValue("Launcher.HuntForCorLib", true);
Settings.SetValue("OS.Name", "MOSA");
}

Expand Down
1 change: 0 additions & 1 deletion Source/Mosa.Tool.Launcher.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ private static void SetDefaultSettings()
Settings.SetValue("Launcher.Launch", true);
Settings.SetValue("Launcher.Exit", true);
Settings.SetValue("Launcher.PlugKorlib", true);
Settings.SetValue("Launcher.HuntForCorLib", true);
Settings.SetValue("Linker.Dwarf", false);
}

Expand Down
9 changes: 4 additions & 5 deletions Source/Mosa.Tool.Launcher/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ private void UpdateGuiSettings()
ExitOnLaunch.IsChecked = settings.GetValue("Launcher.Exit", ExitOnLaunch.IsChecked!.Value);

QemuGdb.IsChecked = settings.GetValue("Emulator.GDB", QemuGdb.IsChecked!.Value);
LaunchGdb.IsChecked = settings.GetValue("Launcher.LaunchGDB", LaunchGdb.IsChecked!.Value);
MosaDbger.IsChecked = settings.GetValue("Launcher.LaunchDebugger", MosaDbger.IsChecked!.Value);
LaunchGdb.IsChecked = settings.GetValue("Launcher.GDB", LaunchGdb.IsChecked!.Value);
MosaDbger.IsChecked = settings.GetValue("Launcher.Debugger", MosaDbger.IsChecked!.Value);

MultiThreading.IsChecked = settings.GetValue("Compiler.Multithreading", MultiThreading.IsChecked!.Value);
MethodScanner.IsChecked = settings.GetValue("Compiler.MethodScanner", MethodScanner.IsChecked!.Value);
Expand Down Expand Up @@ -315,8 +315,8 @@ private void UpdateSettings()
settings.SetValue("Launcher.Exit", ExitOnLaunch.IsChecked!.Value);

settings.SetValue("Emulator.GDB", QemuGdb.IsChecked!.Value);
settings.SetValue("Launcher.LaunchGDB", LaunchGdb.IsChecked!.Value);
settings.SetValue("Launcher.LaunchDebugger", MosaDbger.IsChecked!.Value);
settings.SetValue("Launcher.GDB", LaunchGdb.IsChecked!.Value);
settings.SetValue("Launcher.Debugger", MosaDbger.IsChecked!.Value);

settings.SetValue("Compiler.Multithreading", MultiThreading.IsChecked!.Value);
settings.SetValue("Compiler.Multithreading.MaxThreads", 0);
Expand Down Expand Up @@ -449,7 +449,6 @@ private void SetDefaultSettings()
settings.SetValue("Launcher.Launch", true);
settings.SetValue("Launcher.Exit", true);
settings.SetValue("Launcher.PlugKorlib", true);
settings.SetValue("Launcher.HuntForCorLib", true);
settings.SetValue("Linker.Dwarf", false);
settings.SetValue("OS.Name", OsNameTxt.Text);
}
Expand Down
1 change: 0 additions & 1 deletion Source/Mosa.UnitTests/Primitive/DoubleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Mosa.UnitTests.Primitive;

public static class DoubleTests

{
[MosaUnitTest(Series = "R8R8")]
public static double AddR8R8(double first, double second)
Expand Down
9 changes: 4 additions & 5 deletions Source/Mosa.Utility.Configuration/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static List<Argument> GetMap()
new Argument { Name = "-display-off", Setting = "Emulator.Display", Value = "off"},
new Argument { Name = "-memory", Setting = "Emulator.Memory"},
new Argument { Name = "-cores", Setting = "Emulator.Cores"},
new Argument { Name = "-qemu-gdb", Setting = "Emulator.GDB", Value="false"},
new Argument { Name = "-gdb", Setting = "Emulator.GDB", Value="true"},

// Launcher - Image:
new Argument { Name = "-vhd", Setting = "Image.Format", Value="vhd"},
Expand Down Expand Up @@ -151,13 +151,13 @@ private static List<Argument> GetMap()
new Argument { Name = "-vmware-svga", Setting = "Emulator.SVGA", Value="vmware"},
new Argument { Name = "-virtio-vga", Setting = "Emulator.SVGA", Value="virtio"},

new Argument { Name = "-gdb", Setting = "Launcher.LaunchDebugger", Value="true"},
new Argument { Name = "-gdb-port", Setting = "GDB.Port"},
new Argument { Name = "-gdb-host", Setting = "GDB.Host"},

new Argument { Name = "-osname", Setting = "OS.Name"},

new Argument { Name = "-launch-gdb-debugger", Setting = "Launcher.LaunchDebugger", Value="true"},
new Argument { Name = "-launch-gdb", Setting = "Launcher.GDB", Value="true"},
new Argument { Name = "-launch-debugger", Setting = "Launcher.Debugger", Value="true"},

// Base directory is the output directory
new Argument { Name = "-include", Setting = "Image.FileSystem.RootInclude" },
Expand All @@ -167,7 +167,6 @@ private static List<Argument> GetMap()
new Argument { Name = "-firmware", Setting = "Image.Firmware"},

// Advance:
new Argument { Name = "-hunt-corlib", Setting = "Launcher.HuntForCorLib", Value = "true"},
new Argument { Name = "-plug-korlib", Setting = "Launcher.PlugKorlib", Value = "true"},
new Argument { Name = "-test", Setting = "Launcher.Test", Value = "true"},

Expand Down Expand Up @@ -307,7 +306,7 @@ private static List<Argument> GetMap()
new Argument { Name = "-o8", Setting = "Optimizations.Inline.Explicit", Value = "true"},
new Argument { Name = "-o8", Setting = "Optimizations.LoopInvariantCodeMotion", Value = "true"},
new Argument { Name = "-o8", Setting = "Optimizations.BitTracker", Value = "true"},
new Argument { Name = "-o8", Setting = "Optimizations.TwoPass", Value = "true"},
new Argument { Name = "-o8", Setting = "Optimizations.TwoPass", Value = "false"},
new Argument { Name = "-o8", Setting = "Optimizations.Inline.Maximum", Value = "10"},
new Argument { Name = "-o8", Setting = "Optimizations.Basic.Window", Value = "5"},

Expand Down
2 changes: 1 addition & 1 deletion Source/Mosa.Utility.Disassembler/Disassembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private string ChangeHex(string s)
var value = uint.Parse(hex, System.Globalization.NumberStyles.HexNumber);
var hex2 = Convert.ToString(value, 16);

sb.Append("0x");
sb.Append("x");
sb.Append(hex2);

i += 8;
Expand Down
1 change: 0 additions & 1 deletion Source/Mosa.Utility.Launcher/BaseLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private void SetDefaultSettings(Settings settings)
settings.SetValue("Emulator.Serial.Port", 9999);
settings.SetValue("Emulator.Serial.Pipe", "MOSA");
settings.SetValue("Launcher.PlugKorlib", true);
settings.SetValue("Launcher.HuntForCorLib", true);
}

protected void NormalizeSettings()
Expand Down
2 changes: 1 addition & 1 deletion Source/Mosa.Utility.Launcher/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void Compile()
}
}

Output($"Compling: {LauncherSettings.SourceFiles[0]}");
Output($"Compiling: {LauncherSettings.SourceFiles[0]}");

var compiler = new MosaCompiler(Settings, CompilerHooks, new ClrModuleLoader(), new ClrTypeResolver());

Expand Down
8 changes: 4 additions & 4 deletions Source/Mosa.Utility.Launcher/LauncherSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ public bool LauncherStart

public bool LaunchGDB
{
get => Settings.GetValue("Launcher.LaunchGDB", false);
set => Settings.SetValue("Launcher.LaunchGDB", value);
get => Settings.GetValue("Launcher.GDB", false);
set => Settings.SetValue("Launcher.GDB", value);
}

public bool LaunchDebugger
{
get => Settings.GetValue("Launcher.LaunchDebugger", false);
set => Settings.SetValue("Launcher.LaunchDebugger", value);
get => Settings.GetValue("Launcher.Debugger", false);
set => Settings.SetValue("Launcher.Debugger", value);
}

public string LinkerFormat => Settings.GetValue("Linker.Format", "elf32");
Expand Down

0 comments on commit 050be28

Please sign in to comment.