Merge remote-tracking branch 'refs/remotes/CosmosOS/master' into crypto

This commit is contained in:
MichaelTheShifter 2016-06-14 13:43:48 -04:00
commit cc62959dec
20 changed files with 119 additions and 158 deletions

View file

@ -17,7 +17,7 @@ namespace DebugCompiler
var xEngine = new Engine();
// Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
// that kernel will be marked as a failiure and terminated
xEngine.AllowedSecondsInKernel = 600;
xEngine.AllowedSecondsInKernel = 30;
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
xEngine.RunTargets.Add(RunTargetEnum.Bochs);

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM
DebugStub_AsmBreakEIP dd 0
DebugStub_AsmOrigByte dd 0

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM
DebugStub_Const_Signature equ 427034631

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM
DebugStub_CallerEBP dd 0
DebugStub_CallerEIP dd 0

View file

@ -1,66 +1,2 @@
; Generated at 6/12/2016 3:34:04 PM
DebugStub_MaxBPId dd 0
DebugStub_DebugBPs: TIMES 256 dd 0
DebugStub_Init:
Call DebugStub_Cls
Call DebugStub_DisplayWaitMsg
Call DebugStub_InitSerial
Call DebugStub_WaitForDbgHandshake
Call DebugStub_Cls
DebugStub_Init_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Init_Exit
Ret
DebugStub_WaitForSignature:
mov dword EBX, 0x0
DebugStub_WaitForSignature_Block1_Begin:
cmp dword EBX, DebugStub_Const_Signature
JE near DebugStub_WaitForSignature_Block1_End
Call DebugStub_ComReadAL
mov byte BL, AL
ror dword EBX, 0x8
Jmp DebugStub_WaitForSignature_Block1_Begin
DebugStub_WaitForSignature_Block1_End:
DebugStub_WaitForSignature_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForSignature_Exit
Ret
DebugStub_WaitForDbgHandshake:
mov byte AL, 0x0
Call DebugStub_ComWriteAL
mov byte AL, 0x0
Call DebugStub_ComWriteAL
mov byte AL, 0x0
Call DebugStub_ComWriteAL
push dword DebugStub_Const_Signature
mov dword ESI, ESP
Call DebugStub_ComWrite32
pop dword EAX
mov byte AL, DebugStub_Const_Ds2Vs_Started
Call DebugStub_ComWriteAL
Call DebugStub_WaitForSignature
Call DebugStub_ProcessCommandBatch
Call DebugStub_Hook_OnHandshakeCompleted
DebugStub_WaitForDbgHandshake_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForDbgHandshake_Exit
Ret
%ifndef Exclude_Dummy_Hooks
DebugStub_Hook_OnHandshakeCompleted:
DebugStub_Hook_OnHandshakeCompleted_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Hook_OnHandshakeCompleted_Exit
Ret
%endif
Object reference not set to an instance of an object.

View file

@ -1,47 +1,49 @@
; Generated at 6/12/2016 3:34:04 PM
DebugWaitMsg db 96, 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 100, 101, 98, 117, 103, 103, 101, 114, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 46, 46, 46, 96, 0
%ifndef Exclude_Memory_Based_Console
DebugStub_Const_VidBase equ 753664
DebugStub_Cls:
mov dword ESI, DebugStub_Const_VidBase
DebugStub_Cls_Block1_Begin:
cmp dword ESI, 0xB8FA0
JNB near DebugStub_Cls_Block1_End
mov dword [ESI], 0x0
inc dword ESI
mov dword [ESI], 0xA
inc dword ESI
Jmp DebugStub_Cls_Block1_Begin
DebugStub_Cls_Block1_End:
DebugStub_Cls_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Cls_Exit
Ret
; Generated at 14-6-2016 12:37:38
DebugStub_DisplayWaitMsg:
mov dword ESI, DebugWaitMsg
mov dword EDI, DebugStub_Const_VidBase
add dword EDI, 0x668
DebugWaitMsg db 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 100, 101, 98, 117, 103, 103, 101, 114, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 46, 46, 46, 0
DebugStub_DisplayWaitMsg_Block1_Begin:
cmp dword [ESI], 0x0
JE near DebugStub_DisplayWaitMsg_Block1_End
mov byte AL, [ESI]
mov byte [EDI], AL
inc dword ESI
add dword EDI, 0x2
Jmp DebugStub_DisplayWaitMsg_Block1_Begin
%ifndef Exclude_Memory_Based_Console
DebugStub_Const_VidBase equ 753664
DebugStub_DisplayWaitMsg_Block1_End:
DebugStub_Cls:
mov dword ESI, DebugStub_Const_VidBase
DebugStub_DisplayWaitMsg_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_DisplayWaitMsg_Exit
Ret
DebugStub_Cls_Block1_Begin:
cmp dword ESI, 0xB8FA0
JNB near DebugStub_Cls_Block1_End
mov dword [ESI], 0x0
inc dword ESI
mov dword [ESI], 0xA
inc dword ESI
Jmp DebugStub_Cls_Block1_Begin
DebugStub_Cls_Block1_End:
DebugStub_Cls_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Cls_Exit
Ret
DebugStub_DisplayWaitMsg:
mov dword ESI, DebugWaitMsg
mov dword EDI, DebugStub_Const_VidBase
add dword EDI, 0x668
DebugStub_DisplayWaitMsg_Block1_Begin:
cmp byte [ESI], 0x0
JE near DebugStub_DisplayWaitMsg_Block1_End
mov byte AL, [ESI]
mov byte [EDI], AL
inc dword ESI
add dword EDI, 0x2
Jmp DebugStub_DisplayWaitMsg_Block1_Begin
DebugStub_DisplayWaitMsg_Block1_End:
DebugStub_DisplayWaitMsg_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_DisplayWaitMsg_Exit
Ret
%endif
%endif

View file

@ -8,7 +8,7 @@ const VidBase = $B8000
function Cls {
ESI = #VidBase
// End of Video Area
// VidBase + 25 * 80 * 2 = B8FA0
while ESI < $B8FA0 {
@ -38,4 +38,4 @@ function DisplayWaitMsg {
}
}
! %endif
! %endif

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM
%ifndef Exclude_IOPort_Based_SerialInit

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM
DebugStub_ComAddr dd 1016

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -1,4 +1,4 @@
; Generated at 6/12/2016 3:34:04 PM
; Generated at 6/14/2016 12:11:29 PM

View file

@ -13,28 +13,27 @@ namespace XSharp.Compiler {
var xGenerator = new AsmGenerator();
string[] xFiles;
if (Directory.Exists(xSrc))
{
xFiles = Directory.GetFiles(xSrc, "*.xs");
}
else
{
xFiles = new string[] { xSrc };
}
foreach (var xFile in xFiles)
{
xGenerator.GenerateToFiles(xFile);
}
// var xAsm = new Assembler();
// var xStreamReader = new StringReader(@"namespace Test
// var CallerEBP
// while ESI != .CallerEBP {
// ! nop
//string[] xFiles;
//if (Directory.Exists(xSrc))
//{
// xFiles = Directory.GetFiles(xSrc, "*.xs");
//}
// ");
// var xResult = xGenerator.Generate(xStreamReader);
//else
//{
// xFiles = new string[] { xSrc };
//}
//foreach (var xFile in xFiles)
//{
// xGenerator.GenerateToFiles(xFile);
//}
var xAsm = new Assembler();
var xStreamReader = new StringReader(@"namespace Test
while byte ESI[0] != 0 {
! nop
}
");
var xResult = xGenerator.Generate(xStreamReader);
Console.WriteLine("done");
} catch (Exception ex) {
Console.WriteLine(ex.ToString());

View file

@ -240,7 +240,7 @@ namespace XSharp.Compiler {
switch (value)
{
case "byte":
return RegisterSize.Int32;
return RegisterSize.Byte8;
case "word":
return RegisterSize.Short16;
case "dword":
@ -450,12 +450,6 @@ namespace XSharp.Compiler {
#region Handle all comparisons
foreach (var xSize in xSizes)
{
RegisterSize? xTypedSize = null;
if (xSize != "")
{
xTypedSize = GetSize(xSize);
}
foreach (var xComparison in mCompareOps)
{
var xComparisonToken = new Token(-1);
@ -467,8 +461,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, size: xTypedSize);
@ -478,8 +474,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].Register);
@ -533,8 +531,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 5].IntValue, destinationDisplacement: (int)tokenList[xOffset + 2].IntValue, size: xTypedSize);
@ -544,8 +544,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, destinationDisplacement: -(int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
@ -577,8 +579,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, sourceIsIndirect: true, size: xTypedSize);
@ -588,8 +592,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
@ -599,8 +605,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
if (tokenList[xOffset + 2].Type != TokenType.Register)
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(GetLabel(tokenList[xOffset + 0]), tokenList[xOffset + 2].IntValue, destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));
@ -621,8 +629,10 @@ namespace XSharp.Compiler {
(tokenOffset, tokenList) =>
{
var xOffset = tokenOffset;
if (tokenList[xOffset + 2].Type != TokenType.Register)
RegisterSize? xTypedSize = null;
if (tokenList[xOffset].Type != TokenType.Register)
{
xTypedSize = GetSize(tokenList[xOffset]);
xOffset += 1;
}
XS.Compare(GetSimpleRef(tokenList[xOffset + 0]), ConstLabel(tokenList[xOffset + 3]), destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));

View file

@ -379,7 +379,7 @@ namespace XSharp.Compiler
public static void DataMember(string name, string value)
{
Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, "`" + value + "`"));
Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, value));
}
public static void DataMember(string name, uint elementCount, string size, string value)

View file

@ -108,6 +108,10 @@
<None Include="source.extension.vsixmanifest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cosmos.Assembler\Cosmos.Assembler.csproj">
<Project>{1116130E-28E0-428A-A597-F4B3B676C0CA}</Project>
<Name>Cosmos.Assembler</Name>
</ProjectReference>
<ProjectReference Include="..\XSharp.Compiler\XSharp.Compiler.csproj">
<Project>{A281A1B1-C718-4BCB-A7BE-ED840A70449A}</Project>
<Name>XSharp.Compiler</Name>

View file

@ -6,6 +6,7 @@ using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio;
using System.Runtime.InteropServices;
using System.IO;
using Cosmos.Assembler;
namespace XSharp.VS {
// This class generates .asm files from .xs files.
@ -26,13 +27,22 @@ namespace XSharp.VS {
string xResult;
using (var xInput = new StringReader(aInputFileContents)) {
using (var xOut = new StringWriter()) {
try {
var xGen = new XSharp.Compiler.AsmGenerator();
xGen.Generate(xInput, xOut);
xResult =
"; Generated at " + DateTime.Now.ToString() + "\r\n"
+ "\r\n"
+ xOut.ToString() + "\r\n";
try
{
new Assembler();
try
{
var xGen = new XSharp.Compiler.AsmGenerator();
xGen.Generate(xInput, xOut);
xResult =
"; Generated at " + DateTime.Now.ToString() + "\r\n"
+ "\r\n"
+ xOut.ToString() + "\r\n";
}
finally
{
Assembler.ClearCurrentInstance();
}
} catch (Exception ex) {
var xSB = new StringBuilder();
xSB.Append(xOut);