Ongoing edison work

This commit is contained in:
Matthijs ter Woord 2015-02-03 19:46:10 +01:00
parent 2c7c580b9f
commit 07cdafbedd
8 changed files with 82 additions and 87 deletions

View file

@ -218,7 +218,7 @@ namespace Cosmos.Assembler {
aOutput.WriteLine("%ifndef ELF_COMPILATION"); aOutput.WriteLine("%ifndef ELF_COMPILATION");
aOutput.WriteLine("use32"); aOutput.WriteLine("use32");
aOutput.WriteLine("org 0x200000"); aOutput.WriteLine("org 0x1000000");
aOutput.WriteLine("[map all main.map]"); aOutput.WriteLine("[map all main.map]");
aOutput.WriteLine("%endif"); aOutput.WriteLine("%endif");
@ -451,7 +451,6 @@ namespace Cosmos.Assembler {
WriteDebugVideo("Creating IDT."); WriteDebugVideo("Creating IDT.");
CreateIDT(); CreateIDT();
#if LFB_1024_8 #if LFB_1024_8
new Comment("Set graphics fields"); new Comment("Set graphics fields");
new Move { DestinationReg = Registers.EBX, SourceRef = Cosmos.Assembler.ElementReference.New("MultiBootInfo_Structure"), SourceIsIndirect = true }; new Move { DestinationReg = Registers.EBX, SourceRef = Cosmos.Assembler.ElementReference.New("MultiBootInfo_Structure"), SourceIsIndirect = true };
@ -463,24 +462,24 @@ namespace Cosmos.Assembler {
new Move { DestinationRef = Cosmos.Assembler.ElementReference.New("MultibootGraphicsRuntime_VbeMode"), DestinationIsIndirect = true, SourceReg = Registers.EAX }; new Move { DestinationRef = Cosmos.Assembler.ElementReference.New("MultibootGraphicsRuntime_VbeMode"), DestinationIsIndirect = true, SourceReg = Registers.EAX };
#endif #endif
WriteDebugVideo("Initializing SSE."); //WriteDebugVideo("Initializing SSE.");
new Comment(this, "BEGIN - SSE Init"); //new Comment(this, "BEGIN - SSE Init");
// CR4[bit 9]=1, CR4[bit 10]=1, CR0[bit 2]=0, CR0[bit 1]=1 //// CR4[bit 9]=1, CR4[bit 10]=1, CR0[bit 2]=0, CR0[bit 1]=1
new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 }; //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 };
new Or { DestinationReg = Registers.EAX, SourceValue = 0x100 }; //new Or { DestinationReg = Registers.EAX, SourceValue = 0x100 };
new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; //new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX };
new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 }; //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 };
new Or { DestinationReg = Registers.EAX, SourceValue = 0x200 }; //new Or { DestinationReg = Registers.EAX, SourceValue = 0x200 };
new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; //new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX };
new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 };
new And { DestinationReg = Registers.EAX, SourceValue = 0xfffffffd }; //new And { DestinationReg = Registers.EAX, SourceValue = 0xfffffffd };
new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; //new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX };
new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 };
new And { DestinationReg = Registers.EAX, SourceValue = 1 }; //new And { DestinationReg = Registers.EAX, SourceValue = 1 };
new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; //new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX };
new Comment(this, "END - SSE Init"); //new Comment(this, "END - SSE Init");
if (mComPort > 0) { if (mComPort > 0) {
WriteDebugVideo("Initializing DebugStub."); WriteDebugVideo("Initializing DebugStub.");

View file

@ -129,7 +129,7 @@ namespace Cosmos.Core
mEndOfRam = aEndOfRam; mEndOfRam = aEndOfRam;
mStartAddress = (mStartAddress / 4) * 4; mStartAddress = (mStartAddress / 4) * 4;
mLength -= 1024; mLength -= 1024;
UpdateDebugDisplay(); //UpdateDebugDisplay();
} }
private static bool mInitialized = false; private static bool mInitialized = false;
@ -138,7 +138,8 @@ namespace Cosmos.Core
if (!mInitialized) if (!mInitialized)
{ {
mInitialized = true; mInitialized = true;
DoInitialize(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() - 1) * 1024 * 1024); //DoInitialize(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() - 1) * 1024 * 1024);
DoInitialize(0x8000000, 0x20000000);
} }
} }

View file

@ -60,7 +60,7 @@ namespace Cosmos.Debug.Common
{ {
SendTextToConsole("Sending kernel now\r\n"); SendTextToConsole("Sending kernel now\r\n");
SendTextToConsole("Filename = '" + mKernelFile + "'\r\n"); SendTextToConsole("Filename = '" + mKernelFile + "'\r\n");
SendRawData("\0loady 0x200000\r\n"); SendRawData("\0loady 0x1000000\r\n");
mBootStage = 2; mBootStage = 2;
} }
break; break;
@ -68,17 +68,17 @@ namespace Cosmos.Debug.Common
if (HandleFileSending(aPacket)) if (HandleFileSending(aPacket))
{ {
SendTextToConsole("Done sending kernel file\r\n"); SendTextToConsole("Done sending kernel file\r\n");
mBootStage = 3;
}
break;
case 3:
if (WaitForBootPrompt(aPacket))
{
SendTextToConsole("mw.l 0xFF009000 0x11F8 1\r\n");
SendRawData("mw.l 0xFF009000 0x11F8 1\r\n");
mBootStage = 4; mBootStage = 4;
} }
break; break;
//case 3:
// if (WaitForBootPrompt(aPacket))
// {
// SendTextToConsole("mw.l 0xFF009000 0x11F8 1\r\n");
// SendRawData("mw.l 0xFF009000 0x11F8 1\r\n");
// mBootStage = 4;
// }
// break;
case 4: case 4:
if (WaitForBootPrompt(aPacket)) if (WaitForBootPrompt(aPacket))
{ {
@ -111,12 +111,6 @@ namespace Cosmos.Debug.Common
Next(1, WaitForSignature); Next(1, WaitForSignature);
} }
protected override void DoDebugMsg(string aMsg)
{
base.DoDebugMsg(aMsg);
}
private bool WaitForBootPrompt(byte[] aPacket) private bool WaitForBootPrompt(byte[] aPacket)
{ {
// wait for "boot > " // wait for "boot > "

View file

@ -1,4 +1,4 @@
; Generated at 31-12-2014 17:48:28 ; Generated at 3-2-2015 19:33:21
@ -149,6 +149,7 @@ mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_SendTrac
Ret Ret
DebugStub_SendText: DebugStub_SendText:
Pushad
Mov AL, DebugStub_Const_Ds2Vs_Message Mov AL, DebugStub_Const_Ds2Vs_Message
Call DebugStub_ComWriteAL Call DebugStub_ComWriteAL
@ -166,11 +167,8 @@ Dec ECX
Inc ESI Inc ESI
Jmp DebugStub_SendText_WriteChar Jmp DebugStub_SendText_WriteChar
Mov ESI, EBP
Add ESI, 12
Mov ECX, [ESI + 0]
Mov ESI, [EBP + 8] Popad
DebugStub_SendText_Exit: DebugStub_SendText_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_SendText_Exit mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_SendText_Exit
Ret Ret

View file

@ -157,6 +157,7 @@ function SendTrace {
// Output: None // Output: None
// Modifies: EAX, ECX, EDX, ESI // Modifies: EAX, ECX, EDX, ESI
function SendText { function SendText {
+All
// Write the type // Write the type
AL = #Ds2Vs_Message AL = #Ds2Vs_Message
ComWriteAL() ComWriteAL()
@ -180,12 +181,13 @@ WriteChar:
////test ////test
// Write Length // Write Length
ESI = EBP //ESI = EBP
ESI + 12 //ESI + 12
ECX = ESI[0] //ECX = ESI[0]
//
// Address of string //// Address of string
ESI = EBP[8] //ESI = EBP[8]
-All
} }
// Input: Stack // Input: Stack

View file

@ -1,3 +1,5 @@
; Generated at 3-2-2015 19:17:42
@ -27,7 +29,6 @@ Mov EAX, EBX
Mov [DebugStub_CallerEIP], EAX Mov [DebugStub_CallerEIP], EAX
Call DebugStub_Executing
Popad Popad

View file

@ -53,7 +53,7 @@ Interrupt TracerEntry {
// Store it for later use. // Store it for later use.
.CallerEIP = EAX .CallerEIP = EAX
Executing() // Executing()
-All -All

View file

@ -123,7 +123,7 @@ namespace Cosmos.IL2CPU
xMethodLabel = LabelName.Get(aMethod.MethodBase); xMethodLabel = LabelName.Get(aMethod.MethodBase);
} }
new Cosmos.Assembler.Label(xMethodLabel); new Cosmos.Assembler.Label(xMethodLabel);
//Assembler.WriteDebugVideo("Method " + xMethodLabel); Assembler.WriteDebugVideo("Method " + aMethod.UID);
// We could use same GUID as MethodLabelStart, but its better to keep GUIDs unique globaly for items // We could use same GUID as MethodLabelStart, but its better to keep GUIDs unique globaly for items
// so during debugging they can never be confused as to what they point to. // so during debugging they can never be confused as to what they point to.
@ -1373,7 +1373,7 @@ namespace Cosmos.IL2CPU
Assembler.EmitAsmLabels = false; Assembler.EmitAsmLabels = false;
try try
{ {
Assembler.WriteDebugVideo(String.Format("Method {0}:{1}.", aMethod.UID, aOpCode.Position)); Assembler.WriteDebugVideo(String.Format("Method {0}:{1}.", aMethod.UID, aOpCode.Position.ToString("X")));
//Assembler.WriteDebugVideo(xLabel); //Assembler.WriteDebugVideo(xLabel);
} }
finally finally