Skip to content

Commit

Permalink
Bug fixes (#1045)
Browse files Browse the repository at this point in the history
Co-authored-by: AnErrupTion <anerruption@disroot.org>
  • Loading branch information
AnErrupTion and AnErrupTion committed May 10, 2023
1 parent 880607b commit d31ac3a
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 56 deletions.
3 changes: 0 additions & 3 deletions Source/Mosa.DeviceDriver/PCI/VMware/VMwareSVGA2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ public override void Start()
if (HasFifoCapability(SvgaCapability.ExtendedFifo) && ReadRegister(FifoRegister.Min) > FifoRegister.GuestHw3DVersion << 2)
WriteFifoRegister(FifoRegister.GuestHw3DVersion, (2 << 16) | (1 & 0xFF));

Enable();
WriteRegister(SvgaRegister.ConfigDone, 1);

Device.Status = DeviceStatus.Online;
}

Expand Down
10 changes: 0 additions & 10 deletions Source/Mosa.Kernel.BareMetal.ARMv8A32/PlatformPlug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ public static void EntryPoint()
{
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetPlatformReservedMemory")]
public static AddressRange GetPlatformReservedMemory(int slot)
{
return slot switch
{
0 => new AddressRange(new Pointer(0), 1024 * 1024),
_ => new AddressRange(new Pointer(0), 0)
};
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetBootReservedRegion")]
public static AddressRange GetBootReservedRegion()
{
Expand Down
10 changes: 0 additions & 10 deletions Source/Mosa.Kernel.BareMetal.x64/PlatformPlug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ public static void EntryPoint()
//SSE.Setup();
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetPlatformReservedMemory")]
public static AddressRange GetPlatformReservedMemory(int slot)
{
return slot switch
{
0 => new AddressRange(new Pointer(0), 1024 * 1024),
_ => new AddressRange(new Pointer(0), 0)
};
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetBootReservedRegion")]
public static AddressRange GetBootReservedRegion()
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Mosa.Kernel.BareMetal.x86/GDTTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void Enable()
[MethodImpl(MethodImplOptions.NoInlining)]
private void SetLgdt(Pointer address)
{
Native.Lgdt((uint)address.ToInt32());
Native.Lgdt(address.ToUInt32());
Native.SetSegments(0x10, 0x10, 0x10, 0x10, 0x10);
Native.FarJump();
}
Expand Down
10 changes: 5 additions & 5 deletions Source/Mosa.Kernel.BareMetal.x86/PageTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Setup()
//Console.WriteLine("Mosa.Kernel.BareMetal.x86.PageTable.Setup:Enter");
GDTTable = new GDTTable(PhysicalPageAllocator.ReservePage());

PageDirectory = PhysicalPageAllocator.ReservePage();
PageDirectory = PhysicalPageAllocator.ReservePages(1024);
PageTables = PhysicalPageAllocator.ReservePages(1024);

//Console.WriteLine("Mosa.Kernel.BareMetal.x86.PageTable.Setup:Exit");
Expand All @@ -36,7 +36,7 @@ public static void Initialize()
// Setup Page Directory
for (uint index = 0; index < 1024; index++)
{
PageDirectory.Store32(index << 2, (uint)(PageTables.ToInt32() + index * 4096 | 0x04 | 0x02 | 0x01));
PageDirectory.Store32(index << 2, (PageTables.ToUInt32() + index * Page.Size) | 0x04 | 0x02 | 0x01);
}

Console.WriteLine("Mosa.Kernel.BareMetal.x86.PageTable.Initialize:2");
Expand All @@ -46,7 +46,7 @@ public static void Initialize()
{
Console.WriteValue(index);

Page.ClearPage(PageTables + index * Page.Size);
PageTables.Store32(index << 2, (index * Page.Size) | 0x04 | 0x02 | 0x01);

Console.Write(' ');
}
Expand All @@ -60,7 +60,7 @@ public static void Enable()
GDTTable.Enable();

// Set CR3 register on processor - sets page directory
Native.SetCR3((uint)PageDirectory.ToInt32());
Native.SetCR3(PageDirectory.ToUInt32());

// Set CR0 register on processor - turns on virtual memory
Native.SetCR0(Native.GetCR0() | 0x80000000);
Expand All @@ -77,7 +77,7 @@ public static Pointer GetPhysicalAddressFromVirtual(Pointer virtualAddress)
{
//FUTURE: traverse page directory from CR3 --- do not assume page table is linearly allocated

var address = (uint)virtualAddress.ToInt32();
var address = virtualAddress.ToUInt32();
var offset = ((address & 0xFFFFF000u) >> 10) + (address & 0xFFFu);

return PageTables.LoadPointer(offset);
Expand Down
10 changes: 0 additions & 10 deletions Source/Mosa.Kernel.BareMetal.x86/PlatformPlug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ public static void EntryPoint()
SSE.Setup();
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetPlatformReservedMemory")]
public static AddressRange GetPlatformReservedMemory(int slot)
{
return slot switch
{
0 => new AddressRange(new Pointer(0), 1024 * 1024),
_ => new AddressRange(new Pointer(0), 0)
};
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetBootReservedRegion")]
public static AddressRange GetBootReservedRegion()
{
Expand Down
10 changes: 0 additions & 10 deletions Source/Mosa.Kernel.BareMetal/BootMemory/BootMemoryMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ public static void ImportPlatformMemoryMap()
{
SetMemoryMap(Platform.GetBootReservedRegion(), BootMemoryType.Kernel);
SetMemoryMap(Platform.GetInitialGCMemoryPool(), BootMemoryType.Kernel);

for (int slot = 0; ; slot++)
{
var region = Platform.GetPlatformReservedMemory(slot);

if (region.Size == 0)
break;

SetMemoryMap(region, BootMemoryType.Kernel);
}
}

public static BootMemoryMapEntry SetMemoryMap(AddressRange range, BootMemoryType type)
Expand Down
5 changes: 0 additions & 5 deletions Source/Mosa.Kernel.BareMetal/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ public static void EntryPoint()
{
}

public static AddressRange GetPlatformReservedMemory(int slot)
{
return new AddressRange(0, 0);
}

public static AddressRange GetBootReservedRegion()
{
return new AddressRange(0, 0);
Expand Down
4 changes: 2 additions & 2 deletions Source/Mosa.Utility.Launcher/AppLocationsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static string FindVmwarePlayer()
private static string FindVmwareWorkstation()
{
return TryFind(
new string[] { "vmware.exe", "vmworkstation", "vmware" },
new string[] { "vmware.exe", "vmware" },
new string[] {
@"%ProgramFiles%\VMware\VMware Workstation",
@"%ProgramFiles(x86)%\VMware\VMware Workstation",
Expand All @@ -141,7 +141,7 @@ private static string FindVmwareWorkstation()
private static string FindVirtualBox()
{
return TryFind(
new string[] { "VBoxManage.exe", "vboxmanage" },
new string[] { "VBoxManage.exe", "VBoxManage" },
new string[] {
@"%ProgramFiles%\Oracle",
@"%ProgramFiles(x86)%\Oracle",
Expand Down

0 comments on commit d31ac3a

Please sign in to comment.