Skip to content

Commit

Permalink
WIP - Sync (#1125)
Browse files Browse the repository at this point in the history
* - WIP

* - Updated QEMU (8.1.0-rc3) + Add ARM64

* - Adding ARM launch codes

* - Adding ARM launch codes

* - WIP - ARM32

* - WIP - ARM32

* - WIP - ARM32

* - WIP - ARM64

* - WIP - ARM64

* - WIP - ARM64

* - WIP - ARM64

* - WIP

* - WIP - ARM32

* - WIP
  • Loading branch information
tgiphil committed Aug 17, 2023
1 parent 8d4b270 commit 824be43
Show file tree
Hide file tree
Showing 48 changed files with 482 additions and 134 deletions.
84 changes: 74 additions & 10 deletions Source/Data/ARM32-Instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,74 @@

"[arm-fp-data-processing]= conditional|1110|[opcode]|[e]|[fn]|0|[fd]|0001|[f]|[gh]|0|[i]|[fm]",
"[arm-fp-register-transfer]= conditional|1110|[opcode]|[e]|[fn]|[rd]|0001|[f]|[gh]|1|[i]|[fm]",
"[arm-fp-comparision]= conditional|1110|[opcode]|1|[e]|[fn]|1111|0001|[f]|[gh]|1|[i]|[fm]",
"[arm-fp-data-transfer-register]= conditional|110|[p]|[ud]|[t1]|[wb]||[ls]|[rn]|[t0]|[fd]|0001|[offset]"
"[arm-fp-comparison]= conditional|1110|[opcode]|1|[e]|[fn]|1111|0001|[f]|[gh]|1|[i]|[fm]",
"[arm-fp-data-transfer-register]= conditional|110|[p]|[ud]|[t1]|[wb]||[ls]|[rn]|[t0]|[fd]|0001|[offset]",

"[arm-coprocessor-transfer]= conditional|1110|[opcode]|[l]|[crn]|[rd]|[cpn]|[cp]|1|[crm]"
],
"Instructions": [
{
"Name": "Mrc",
"Commutative": "true",
"FamilyName": "ARM32",
"FlagsCleared": "",
"FlagsModified": "",
"FlagsSet": "",
"FlagsUnchanged": "",
"FlagsUndefined": "",
"FlagsUsed": "",
"OperandCount": 5,
"ResultCount": 1,
"Description": "Move from processor register to coprocessor",
"OperandDescriptions": [
{
"Result": "ARM source/destination register",
"Operand1": "Coprocessor source/destination register",
"Operand2": "Coprocessor operand register",
"Operand3": "Coprocessor number",
"Operand4": "Coprocessor operation mode",
"Operand5": "Coprocessor information"
}
],
"OpcodeEncodingAppend": "",
"OpcodeEncoding": [
{
"Condition": "[register][register][constant][constant][constant]",
"Encoding": "[arm-coprocessor-transfer],s=status:status,l=1,rd=reg4:r,crn=reg4:o1,crm=reg4:o2,cpn=imm4:o3,opcode=imm4:o4,cp=imm4:o5"
}
]
},
{
"Name": "Mcr",
"Commutative": "true",
"FamilyName": "ARM32",
"FlagsCleared": "",
"FlagsModified": "",
"FlagsSet": "",
"FlagsUnchanged": "",
"FlagsUndefined": "",
"FlagsUsed": "",
"OperandCount": 5,
"ResultCount": 1,
"Description": "Move from coprocessor to processor register",
"OperandDescriptions": [
{
"Result": "ARM source/destination register",
"Operand1": "Coprocessor source/destination register",
"Operand2": "Coprocessor operand register",
"Operand3": "Coprocessor number",
"Operand4": "Coprocessor operation mode",
"Operand5": "Coprocessor information"
}
],
"OpcodeEncodingAppend": "",
"OpcodeEncoding": [
{
"Condition": "[register][register][constant][constant][constant]",
"Encoding": "[arm-coprocessor-transfer],s=status:status,l=0,rd=reg4:r,crn=reg4:o1,crm=reg4:o2,cpn=imm4:o3,opcode=imm4:o4,cp=imm4:o5"
}
]
},
{
"Name": "Adc",
"Commutative": "true",
Expand Down Expand Up @@ -2340,11 +2404,11 @@
"OpcodeEncoding": [
{
"Condition": "[register][register]",
"Encoding": "[arm-fp-comparision],opcode=100,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
"Encoding": "[arm-fp-comparison],opcode=100,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
},
{
"Condition": "[register][constant]",
"Encoding": "[arm-fp-comparision],opcode=100,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
"Encoding": "[arm-fp-comparison],opcode=100,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
}
]
},
Expand All @@ -2365,11 +2429,11 @@
"OpcodeEncoding": [
{
"Condition": "[register][register]",
"Encoding": "[arm-fp-comparision],opcode=101,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
"Encoding": "[arm-fp-comparison],opcode=101,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
},
{
"Condition": "[register][constant]",
"Encoding": "[arm-fp-comparision],opcode=101,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
"Encoding": "[arm-fp-comparison],opcode=101,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
}
]
},
Expand All @@ -2391,11 +2455,11 @@
"OpcodeEncoding": [
{
"Condition": "[register]",
"Encoding": "[arm-fp-comparision],opcode=110,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
"Encoding": "[arm-fp-comparison],opcode=110,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
},
{
"Condition": "[register][constant]",
"Encoding": "[arm-fp-comparision],opcode=110,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
"Encoding": "[arm-fp-comparison],opcode=110,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
}
]
},
Expand All @@ -2416,11 +2480,11 @@
"OpcodeEncoding": [
{
"Condition": "[register]",
"Encoding": "[arm-fp-comparision],opcode=111,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
"Encoding": "[arm-fp-comparison],opcode=111,e=0,f=fp:o1,gh=00,i=0,fn=reg3:o1,fm=reg3:o2"
},
{
"Condition": "[register][constant]",
"Encoding": "[arm-fp-comparision],opcode=111,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
"Encoding": "[arm-fp-comparison],opcode=111,e=0,f=fp:o1,gh=00,i=1,fn=reg3:o1,fm=imm4:o2"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion Source/Docs/command-line-arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Command Line Arguments

The command line arguments serve as shortcuts to the common set of :doc:`settings-options` used by the MOSA tools.

.. tip:: Specific settings may also be specified on the command line using the ``-setting`` or ``-s`` arguments. For example to set the ``Compiler.OutputFile`` settings with ``Mosa.Demo.HelloWorld.x86.bin``, pass the following two arguments ``-setting Compiler.OutputFile=Mosa.Demo.HelloWorld.x86.bin`` on the command line.
.. tip:: Specific settings may also be specified on the command line using the ``-setting`` argument (or using the shorthand version ``-s`` ). For example to set the ``Compiler.OutputFile`` setting with ``Mosa.Demo.HelloWorld.x86.bin``, pass the following two arguments ``-setting Compiler.OutputFile=Mosa.Demo.HelloWorld.x86.bin`` on the command line.

Below are the command line arguments available:

Expand Down
38 changes: 29 additions & 9 deletions Source/Mosa.Compiler.Framework/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ public Operand Operand2
public Operand Operand3
{ get => Node.Operand3; set => Node.Operand3 = value; }

/// <summary>
/// Gets or sets the fourth operand.
/// </summary>
/// <value>The third operand.</value>
public Operand Operand4
{ get => Node.Operand4; set => Node.Operand4 = value; }

/// <summary>
/// Gets or sets the fifth operand.
/// </summary>
/// <value>The third operand.</value>
public Operand Operand5
{ get => Node.Operand5; set => Node.Operand5 = value; }

/// <summary>
/// Gets all operands.
/// </summary>
Expand Down Expand Up @@ -322,15 +336,6 @@ public Operand GetResult(int index)
return Node.GetResult(index);
}

/// <summary>
/// Adds the operand.
/// </summary>
/// <param name="operand">The operand.</param>
public void AddOperand(Operand operand)
{
Node.AddOperand(operand);
}

/// <summary>
/// Sets the operand by index.
/// </summary>
Expand Down Expand Up @@ -718,6 +723,21 @@ public void SetInstruction(BaseInstruction instruction, Operand result, Operand
Node.SetInstruction(instruction, result, operand1, operand2, operand3, operand4);
}

/// <summary>
/// Sets the instruction.
/// </summary>
/// <param name="instruction">The instruction.</param>
/// <param name="result">The result.</param>
/// <param name="operand1">The operand1.</param>
/// <param name="operand2">The operand2.</param>
/// <param name="operand3">The operand3.</param>
/// <param name="operand4">The operand4.</param>
/// <param name="operand5">The operand4.</param>
public void SetInstruction(BaseInstruction instruction, Operand result, Operand operand1, Operand operand2, Operand operand3, Operand operand4, Operand operand5)
{
Node.SetInstruction(instruction, result, operand1, operand2, operand3, operand4, operand5);
}

#endregion Set Instruction Methods

#region Append Instruction Methods
Expand Down
80 changes: 69 additions & 11 deletions Source/Mosa.Compiler.Framework/InstructionNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,32 @@ public Operand Operand3
}
}

/// <summary>
/// Gets or sets the fourth operand.
/// </summary>
/// <value>The third operand.</value>
public Operand Operand4
{
get => GetOperand(3);
set
{
SetOperand(3, value);
}
}

/// <summary>
/// Gets or sets the fifth operand.
/// </summary>
/// <value>The third operand.</value>
public Operand Operand5
{
get => GetOperand(4);
set
{
SetOperand(4, value);
}
}

/// <summary>
/// Gets all operands.
/// </summary>
Expand Down Expand Up @@ -627,16 +653,6 @@ public Operand GetResult(int index)
};
}

/// <summary>
/// Adds the operand.
/// </summary>
/// <param name="operand">The operand.</param>
public void AddOperand(Operand operand)
{
SetOperand(OperandCount, operand);
OperandCount++;
}

/// <summary>
/// Sets the result by index.
/// </summary>
Expand Down Expand Up @@ -1358,7 +1374,28 @@ public void SetInstruction(BaseInstruction instruction, Operand result, Operand
Operand1 = operand1;
Operand2 = operand2;
Operand3 = operand3;
SetOperand(3, operand4);
Operand4 = operand4;
}

/// <summary>
/// Sets the instruction.
/// </summary>
/// <param name="instruction">The instruction.</param>
/// <param name="result">The result.</param>
/// <param name="operand1">The operand1.</param>
/// <param name="operand2">The operand2.</param>
/// <param name="operand3">The operand3.</param>
/// <param name="operand4">The operand4.</param>
/// <param name="operand5">The operand4.</param>
public void SetInstruction(BaseInstruction instruction, Operand result, Operand operand1, Operand operand2, Operand operand3, Operand operand4, Operand operand5)
{
SetInstruction(instruction, 4, (byte)(result == null ? 0 : 1));
Result = result;
Operand1 = operand1;
Operand2 = operand2;
Operand3 = operand3;
Operand4 = operand4;
Operand5 = operand5;
}

public void SetInstruction(BaseInstruction instruction, ConditionCode conditionCode, Operand result, Operand operand1, Operand operand2, Operand operand3, Operand operand4)
Expand Down Expand Up @@ -1528,5 +1565,26 @@ public void SetInstruction(BaseInstruction instruction, StatusRegister statusReg
StatusRegister = statusRegister;
}

/// <summary>
/// Sets the instruction.
/// </summary>
/// <param name="instruction">The instruction.</param>
/// <param name="condition">The condition.</param>
/// <param name="updateStatus">if set to <c>true</c> [update status].</param>
/// <param name="result">The result.</param>
/// <param name="operand1">The operand1.</param>
/// <param name="operand2">The operand2.</param>
/// <param name="operand3">The operand3.</param>
public void SetInstruction(BaseInstruction instruction, StatusRegister statusRegister, Operand result, Operand operand1, Operand operand2, Operand operand3, Operand operand4)
{
SetInstruction(instruction, 3, (byte)(result == null ? 0 : 1));
Result = result;
Operand1 = operand1;
Operand2 = operand2;
Operand3 = operand3;
Operand4 = operand4;
StatusRegister = statusRegister;
}

#endregion SetInstructions
}
3 changes: 2 additions & 1 deletion Source/Mosa.DeviceDriver/ISA/ACPI/ACPIDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public override void Initialize()

for (var k = 0; k < dsdtLength; k++)
{
if (S5Addr.Load32() == 0x5f35535f) break; //_S5_
if (S5Addr.Load32() == 0x5f35535f)
break; //_S5_

S5Addr++;
}
Expand Down
3 changes: 0 additions & 3 deletions Source/Mosa.DeviceSystem/BaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public virtual void PostEvent(ServiceEvent serviceEvent)
if (service == null)
return null;

//HAL.DebugWriteLine("BaseService:MatchEvent()-Z");
//HAL.Pause();

return device;
}
}
7 changes: 2 additions & 5 deletions Source/Mosa.DeviceSystem/IAudioDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ namespace Mosa.DeviceSystem;

public interface IAudioDevice
{
// Format is WAV (unsigned PCM)
byte[] TestSound { get; }

/// <summary>
/// Plays a sound from a constrained pointer.
/// Plays a sound.
/// </summary>
/// <param name="data"></param>
void Play(ConstrainedPointer data);
void Play(byte[] data);

/// <summary>
/// Sets the output sound volume.
Expand Down
14 changes: 14 additions & 0 deletions Source/Mosa.DeviceSystem/IMultibootSpecification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Runtime;

namespace Mosa.DeviceSystem;

public interface IMultibootSpecification
{
string CommandLinePointer { get; }

string BootloaderNamePointer { get; }

Pointer ACPI_RSDP { get; }
}
4 changes: 2 additions & 2 deletions Source/Mosa.DeviceSystem/Service/DeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public sealed class DeviceService : BaseService
/// <summary>
/// The pending on change
/// </summary>
private readonly List<Device> pendingOnChange;
private readonly List<Device> PendingOnChange;

private readonly object sync = new object();

Expand All @@ -43,7 +43,7 @@ public DeviceService()
{
Registry = new List<DeviceDriverRegistryEntry>();
Devices = new List<Device>();
pendingOnChange = new List<Device>();
PendingOnChange = new List<Device>();

IRQDispatch = new List<Device>[MaxInterrupts];

Expand Down
2 changes: 1 addition & 1 deletion Source/Mosa.DeviceSystem/Service/PCIDeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Mosa.DeviceSystem.Service;

/// <summary>
/// PCI Controller Service
/// PCI Device Service
/// </summary>
public class PCIDeviceService : BaseService
{
Expand Down
3 changes: 2 additions & 1 deletion Source/Mosa.DeviceSystem/Service/PCService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ namespace Mosa.DeviceSystem.Service;
/// <summary>
/// PC Service
/// </summary>
// TODO: Fix
public class PCService : BaseService
{
// TODO: Fix

/// <summary>
/// The device service
/// </summary>
Expand Down

0 comments on commit 824be43

Please sign in to comment.