mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 05:48:37 +00:00
This commit is contained in:
parent
93b9f3d80a
commit
dc76654709
15 changed files with 0 additions and 308 deletions
|
|
@ -1,20 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
using CPUAll = Cosmos.Compiler.Assembler;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public class ClearInterruptsTable: AssemblerMethod {
|
||||
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
new CPUx86.ClrInterruptFlag();
|
||||
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("_NATIVE_IDT_Pointer"), DestinationIsIndirect = true, Size = 16, SourceValue = 0 };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceRef = CPUAll.ElementReference.New("_NATIVE_IDT_Pointer") };
|
||||
new CPUx86.Lidt { DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
|
||||
new CPUx86.Sti();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
using System;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUAll = Cosmos.Compiler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public class CreateGDT: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
string xFieldName = "_NATIVE_GDT_Contents";
|
||||
string xFieldData // Null Segment
|
||||
= "0,0,0,0,0,0,0,0" // Code Segment
|
||||
+ ", 0xFF, 0xFF, 0, 0, 0, 0x99, 0xCF, 0" // Data Segment
|
||||
+ ", 0xFF,0xFF,0,0,0,0x93,0xCF,0";
|
||||
//aAssembler.DataMembers.Add(new KeyValuePair<string, DataMember> (aAssembler.CurrentGroup,new DataMember(xFieldName, "db", xFieldData)));
|
||||
//xFieldName = "_NATIVE_GDT_Pointer";
|
||||
////xFieldData = "0x17, (_NATIVE_GDT_Contents and 0xFFFF), (_NATIVE_GDT_Contents shr 16)";
|
||||
//aAssembler.DataMembers.Add(new KeyValuePair<string, DataMember> (aAssembler.CurrentGroup,new DataMember(xFieldName, "dw", "0x37,0,0")));
|
||||
var xAssembler = (Assembler)aAssembler;
|
||||
xAssembler.DataMembers.Add(new CPUAll.DataMember(xFieldName, new byte[] {0,0,0,0,0,0,0,0 // Code Segment
|
||||
, 0xFF, 0xFF, 0, 0, 0, 0x99, 0xCF, 0 // Data Segment
|
||||
, 0xFF,0xFF,0,0,0,0x93,0xCF,0}));
|
||||
xAssembler.DataMembers.Add(new CPUAll.DataMember("_NATIVE_GDT_Pointer", new ushort[] { 0x17, 0, 0 }));
|
||||
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceRef = CPUAll.ElementReference.New("_NATIVE_GDT_Pointer") };
|
||||
new CPUx86.Move { DestinationRef = CPUAll.ElementReference.New("_NATIVE_GDT_Pointer"), DestinationIsIndirect = true, DestinationDisplacement = 2, SourceRef = CPUAll.ElementReference.New("_NATIVE_GDT_Contents") };
|
||||
|
||||
new CPUAll.Label(".RegisterGDT");
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceRef = CPUAll.ElementReference.New("_NATIVE_GDT_Pointer") };
|
||||
new CPUx86.Lgdt { DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.AX, SourceValue = 0x10 };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.DS, SourceReg = CPUx86.Registers.AX };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.ES, SourceReg = CPUx86.Registers.AX };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.FS, SourceReg = CPUx86.Registers.AX };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.GS, SourceReg = CPUx86.Registers.AX };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.SS, SourceReg = CPUx86.Registers.AX };
|
||||
// Force reload of code segement
|
||||
new CPUx86.JumpToSegment { Segment = 8, DestinationLabel = "flush__GDT__table" };
|
||||
new CPUAll.Label("flush__GDT__table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUAll = Cosmos.Compiler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
using HW = Cosmos.Hardware2;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public class GetEndOfKernel: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
new CPUx86.Push { DestinationRef = CPUAll.ElementReference.New("_end_code") };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
using Cosmos.Compiler.Assembler;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers
|
||||
{
|
||||
public class GetEndOfStack : AssemblerMethod
|
||||
{
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo)
|
||||
{
|
||||
new CPUx86.Push
|
||||
{
|
||||
DestinationRef = ElementReference.New("Kernel_Stack")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
|
||||
public class Halt: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
new CPUx86.Halt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IORead16: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to read a port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
//TODO: Also make an attribute that forces normal inlining fo a method
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 };
|
||||
//TODO: Do we need to clear rest of EAX first?
|
||||
// MTW: technically not, as in other places, it _should_ be working with AL too..
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
|
||||
new CPUx86.In { DestinationReg = CPUx86.Registers.AX };
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IORead32: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to read a port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
//TODO: Also make an attribute that forces normal inlining fo a method
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 };
|
||||
new CPUx86.In { DestinationReg = CPUx86.Registers.EAX };
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IORead8: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to read a port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
//TODO: Also make an attribute that forces normal inlining fo a method
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 };
|
||||
//TODO: Do we need to clear rest of EAX first?
|
||||
// MTW: technically not, as in other places, it _should_ be working with AL too..
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
|
||||
new CPUx86.In { DestinationReg = CPUx86.Registers.AL };
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IOWrite16: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to write to a single port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 };
|
||||
new CPUx86.Out { DestinationReg = CPUx86.Registers.AX };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IOWrite32: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to write to a single port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 };
|
||||
new CPUx86.Out { DestinationReg = CPUx86.Registers.EAX };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public sealed class IOWrite8: AssemblerMethod {
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||
//TODO: This is a lot of work to write to a single port. We need to have some kind of inline ASM option that can emit a single out instruction
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceDisplacement = 0xC, SourceIsIndirect = true };
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceDisplacement = 0x8, SourceIsIndirect = true };
|
||||
new CPUx86.Out { DestinationReg = CPUx86.Registers.AL };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
using System;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using Assembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CPUAll = Cosmos.Compiler.Assembler;
|
||||
using CPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
using CosAssembler = Cosmos.Compiler.Assembler.Assembler;
|
||||
using CosCPUAll = Cosmos.Compiler.Assembler;
|
||||
using CosCPUx86 = Cosmos.Compiler.Assembler.X86;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Assemblers {
|
||||
public class ZeroFill: AssemblerMethod {
|
||||
|
||||
// public static void ZeroFill(uint aStartAddress, uint aLength) {}
|
||||
public override void AssembleNew(object aAssembler, object aMethodInfo)
|
||||
{
|
||||
new CPUx86.ClrDirFlag();
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC }; //address
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x8 }; //length
|
||||
new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
|
||||
new CPUx86.ShiftRight { DestinationReg = CPUx86.Registers.ECX, SourceValue = 1 };
|
||||
new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Below, DestinationLabel = ".step2" };
|
||||
new CPUx86.StoreByteInString();
|
||||
new CPUAll.Label(".step2");
|
||||
new CPUx86.ShiftRight { DestinationReg = CPUx86.Registers.ECX, SourceValue = 1 };
|
||||
new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Below, DestinationLabel = ".step3" };
|
||||
new CPUx86.StoreWordInString();
|
||||
new CPUAll.Label(".step3");
|
||||
new CPUx86.Stos { Size = 32, Prefixes = CPUx86.InstructionPrefixes.Repeat };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,6 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assemblers\ClearInterruptsTable.cs" />
|
||||
<Compile Include="Assemblers\CPUID.cs" />
|
||||
<Compile Include="Assemblers\DisableInterrupts.cs" />
|
||||
<Compile Include="Assemblers\DisablePaging.cs" />
|
||||
|
|
@ -78,32 +77,19 @@
|
|||
<Compile Include="Assemblers\EnablePSE.cs" />
|
||||
<Compile Include="Assemblers\GetAmountOfRAM.cs" />
|
||||
<Compile Include="Assemblers\GetCurrentESP.cs" />
|
||||
<Compile Include="Assemblers\GetEndOfKernel.cs" />
|
||||
<Compile Include="Assemblers\GetEndOfStack.cs" />
|
||||
<Compile Include="Assemblers\GetMBIAddress.cs" />
|
||||
<Compile Include="Assemblers\Halt.cs" />
|
||||
<Compile Include="Assemblers\InitFloat.cs" />
|
||||
<Compile Include="Assemblers\Interrupt30.cs" />
|
||||
<Compile Include="Assemblers\InvalidatePage.cs" />
|
||||
<Compile Include="Assemblers\IORead16.cs" />
|
||||
<Compile Include="Assemblers\IORead32.cs" />
|
||||
<Compile Include="Assemblers\IOWrite16.cs" />
|
||||
<Compile Include="Assemblers\CreateGDT.cs" />
|
||||
<Compile Include="Assemblers\IORead8.cs" />
|
||||
<Compile Include="Assemblers\IOWrite32.cs" />
|
||||
<Compile Include="Assemblers\IOWrite8.cs" />
|
||||
<Compile Include="Assemblers\SetPageDirectory.cs" />
|
||||
<Compile Include="Assemblers\ZeroFill.cs" />
|
||||
<Compile Include="GCImplementationImpl.cs" />
|
||||
<Compile Include="HeapImpl.cs" />
|
||||
<Compile Include="Interlocked.cs" />
|
||||
<Compile Include="PagingUtilityImpl.cs" />
|
||||
<Compile Include="String.cs" />
|
||||
<Compile Include="Hardware.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ThreadImpl.cs" />
|
||||
<Compile Include="Type.cs" />
|
||||
<Compile Include="ValueTypeImpl.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\source2\Compiler\Cosmos.Compiler.Assembler.X86\Cosmos.Compiler.Assembler.X86.csproj">
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
using HW = Cosmos.Hardware2;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs.Other {
|
||||
[Plug(Target = typeof(HW.Hardware))]
|
||||
public static class Hardware {
|
||||
[PlugMethod(Assembler = typeof(Assemblers.IOWrite8))]
|
||||
public static void IOWriteByte(ushort aPort, byte aData) {
|
||||
}
|
||||
[PlugMethod(Assembler = typeof(Assemblers.IORead8))]
|
||||
public static byte IOReadByte(ushort aPort) {
|
||||
return 0;
|
||||
}
|
||||
[PlugMethod(Assembler = typeof(Assemblers.IOWrite16))]
|
||||
public static void IOWriteWord(ushort aPort, ushort aData) {
|
||||
}
|
||||
[PlugMethod(Assembler = typeof(Assemblers.IORead16))]
|
||||
public static ushort IOReadWord(ushort aPort) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
|
||||
namespace Cosmos.Kernel.Plugs {
|
||||
[Plug(Target=typeof(ValueType))]
|
||||
public class ValueTypeImpl {
|
||||
public static bool Equals(ValueType aThis, object aObject) {
|
||||
throw new NotImplementedException("ValueType.Equals Not Implemented!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue