Skip to content

Commit

Permalink
Merge pull request CosmosOS#2129 from CosmosOS/removewarnings
Browse files Browse the repository at this point in the history
Remove compiler warnings
  • Loading branch information
MishaTy authored Mar 7, 2022
2 parents 27b6217 + 7ec56f6 commit aa7b582
Show file tree
Hide file tree
Showing 31 changed files with 557 additions and 196 deletions.
10 changes: 5 additions & 5 deletions Resources/Dependencies/DapperExtensions.StrongName/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ public void RunInTransaction(Action action)
action();
Commit();
}
catch (Exception ex)
catch
{
if (HasActiveTransaction)
{
Rollback();
}

throw ex;
throw;
}
}

Expand All @@ -130,14 +130,14 @@ public T RunInTransaction<T>(Func<T> func)
Commit();
return result;
}
catch (Exception ex)
catch
{
if (HasActiveTransaction)
{
Rollback();
}

throw ex;
throw;
}
}

Expand Down Expand Up @@ -266,4 +266,4 @@ public IClassMapper GetMap<T>() where T : class
return _dapper.SqlGenerator.Configuration.GetMap<T>();
}
}
}
}
35 changes: 29 additions & 6 deletions source/Cosmos.Core/ACPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ public unsafe struct RSDPtr
/// </summary>
private static short SLP_EN;
/// <summary>
/// SCI EN.
/// </summary>
private static short SCI_EN;
/// <summary>
/// PM1 CNT LEN1
/// </summary>
private static byte PM1_CNT_LEN;
Expand Down Expand Up @@ -194,7 +190,9 @@ static bool Check_RSD(uint address)
byte* check = (byte*)address;

for (int i = 0; i < 20; i++)
{
sum += *(check++);
}

return (sum == 0);
}
Expand All @@ -207,10 +205,14 @@ static bool Check_RSD(uint address)
public static void Start(bool initialize = true, bool enable = true)
{
if (initialize)
{
Init();
}

if (enable)
{
Enable();
}
}

/// <summary>
Expand All @@ -221,12 +223,16 @@ public static void Shutdown()
{
Console.Clear();
if (PM1a_CNT == null)
{
Init();
}

pm1aIO.Word = (ushort)(SLP_TYPa | SLP_EN);

if (PM1b_CNT != null)
{
pm1bIO.Word = (ushort)(SLP_TYPb | SLP_EN);
}

CPU.Halt();
}
Expand Down Expand Up @@ -295,7 +301,9 @@ private static bool Init()
while (0 < dsdtLength--)
{
if (Compare("_S5_", S5Addr) == 0)
{
break;
}
S5Addr++;
}

Expand All @@ -306,11 +314,15 @@ private static bool Init()
S5Addr += 5;
S5Addr += ((*S5Addr & 0xC0) >> 6) + 2;
if (*S5Addr == 0x0A)
{
S5Addr++;
}
SLP_TYPa = (short)(*(S5Addr) << 10);
S5Addr++;
if (*S5Addr == 0x0A)
{
S5Addr++;
}
SLP_TYPb = (short)(*(S5Addr) << 10);
SMI_CMD = facpget(1);
ACPI_ENABLE = facpbget(0);
Expand All @@ -319,7 +331,6 @@ private static bool Init()
PM1b_CNT = facpget(3);
PM1_CNT_LEN = facpbget(3);
SLP_EN = 1 << 13;
SCI_EN = 1;

smiIO = new IOPort((ushort)SMI_CMD);
pm1aIO = new IOPort((ushort)PM1a_CNT);
Expand Down Expand Up @@ -359,16 +370,26 @@ public static void Disable()
private static unsafe uint RSDPAddress()
{
for (uint addr = 0xE0000; addr < 0x100000; addr += 4)
{
if (Compare("RSD PTR ", (byte*)addr) == 0)
{
if (Check_RSD(addr))
{
return addr;
}
}
}

uint ebda_address = *((uint*)0x040E);
ebda_address = (ebda_address * 0x10) & 0x000fffff;

for (uint addr = ebda_address; addr < ebda_address + 1024; addr += 4)
{
if (Compare("RSD PTR ", (byte*)addr) == 0)
{
return addr;
}
}

return 0;
}
Expand All @@ -381,7 +402,7 @@ private static unsafe uint RSDPAddress()
private static uint* acpiCheckRSDPtr(uint* ptr)
{
string sig = "RSD PTR ";
RSDPtr* rsdp = (RSDPtr*)ptr;
var rsdp = (RSDPtr*)ptr;

byte* bptr;
byte check = 0;
Expand All @@ -402,7 +423,9 @@ private static unsafe uint RSDPAddress()
Compare("RSDT", (byte*)rsdp->RsdtAddress);

if (rsdp->RsdtAddress != 0)
{
return (uint*)rsdp->RsdtAddress;
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions source/Cosmos.Core/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ public unsafe static class Bootstrap
/// </summary>
static public PIC PIC;

// Has to be static for now, ZeroFill gets called before the Init.
/// <summary>
/// CPU.
/// </summary>
//static public readonly CPU CPU = new CPU();

// Bootstrap is a class designed only to get the essentials done.
// ie the stuff needed to "pre boot". Do only the very minimal here.
// IDT, PIC, and Float
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core/CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Cosmos.Core
/// </summary>
public static class CPU
{
static ulong totalRam;
// Amount of RAM in MB's.
// needs to be static, as Heap needs it before we can instantiate objects
/// <summary>
Expand Down Expand Up @@ -354,6 +353,7 @@ public static string GetCPUBrandString()
/// <exception cref="NotImplementedException">Thrown on fatal error, contact support.</exception>
internal static ulong ReadFromModelSpecificRegister() => throw new NotImplementedException();

/// <summary>
/// Get the Memory Map Information from Multiboot
/// </summary>
/// <returns>Returns an array of MemoryMaps containing the Multiboot Memory Map information. The array may have empty values at the end.</returns>
Expand Down
1 change: 0 additions & 1 deletion source/Cosmos.Core/GCImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public static unsafe uint GetSafePointer(object aObj)
}

/// <summary>

/// Get cosmos internal type from object
/// </summary>
/// <param name="aObj"></param>
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core/INTs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public struct IRQContext {
/// Last known address.
/// </summary>
[AsmMarker(AsmMarker.Type.Int_LastKnownAddress)]
private static uint mLastKnownAddress;
private static uint mLastKnownAddress = 0;

/// <summary>
/// IRQ handlers.
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core_Asm/Delegate/DelegateCtorAsm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
// method signature: $this, object @object, IntPtr method
var xAssembler = aAssembler;
var xMethodInfo = (_MethodInfo)aMethodInfo;
var xMethodInfo = (Il2cpuMethodInfo)aMethodInfo;
XS.Comment("Save target ($this) to field");
XS.Comment("-- ldarg 0");
Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Core_Asm/Delegate/DelegateInvokeAsm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DelegateInvokeAsm : AssemblerMethod
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
var xAssembler = aAssembler;
var xMethodInfo = (_MethodInfo) aMethodInfo;
var xMethodInfo = (Il2cpuMethodInfo) aMethodInfo;
var xMethodBaseAsInfo = xMethodInfo.MethodBase as global::System.Reflection.MethodInfo;
if (xMethodBaseAsInfo.ReturnType != typeof(void))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public static void cctor()
{
}

#pragma warning disable CS0108
public static bool Equals(object aO1, object aO2)
#pragma warning restore CS0108
{
return aO1 == aO2; //we cant use object.Equals since it just calls this
}
Expand Down
8 changes: 3 additions & 5 deletions source/Cosmos.Debug.DebugConnectors/DebugConnectorEdison.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ private bool WaitForBootPrompt(byte[] aPacket)

private FileStream mKernelFileStream;

private bool mKernelSent = false;

private bool HandleFileSending(byte[] aPacket)
{

Expand Down Expand Up @@ -213,9 +211,9 @@ private bool HandleFileSending(byte[] aPacket)
}

// weird character, just retransmit for now
SendTextToConsole("Character value " + aPacket[0] + " found!\r\n");
SendRawData(new[] { YModem_EOT });
return false;
//SendTextToConsole("Character value " + aPacket[0] + " found!\r\n");
//SendRawData(new[] { YModem_EOT });
//return false;
}
}

Expand Down
Loading

0 comments on commit aa7b582

Please sign in to comment.