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,11 +157,12 @@ 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()
// Write Length // Write Length
ESI = EBP ESI = EBP
ESI + 12 ESI + 12
ECX = ESI[0] ECX = ESI[0]
@ -176,16 +177,17 @@ WriteChar:
// We are storing as 16 bits, but for now I will transmit 8 bits // We are storing as 16 bits, but for now I will transmit 8 bits
// So we inc again to skip the 0 // So we inc again to skip the 0
ESI++ ESI++
goto WriteChar goto 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

@ -17,46 +17,46 @@
namespace DebugStub namespace DebugStub
Interrupt TracerEntry { Interrupt TracerEntry {
// This code is temporarily disabled as IRQs are not enabled right now. // This code is temporarily disabled as IRQs are not enabled right now.
// LockOrExit // LockOrExit
+All +All
// Save current ESP so we can look at the results of PushAll later // Save current ESP so we can look at the results of PushAll later
.PushAllPtr = ESP .PushAllPtr = ESP
.CallerEBP = EBP .CallerEBP = EBP
// Get current ESP and add 32. This will skip over the PushAll and point // Get current ESP and add 32. This will skip over the PushAll and point
// us at the call data from Int3. // us at the call data from Int3.
EBP = ESP EBP = ESP
EBP + 32 EBP + 32
// Caller EIP // Caller EIP
EAX = EBP[0] EAX = EBP[0]
// 12 bytes for EFLAGS, CS, EIP // 12 bytes for EFLAGS, CS, EIP
EBP + 12 EBP + 12
.CallerESP = EBP .CallerESP = EBP
// EIP is pointer to op after our call. Int3 is 1 byte so we subtract 1. // EIP is pointer to op after our call. Int3 is 1 byte so we subtract 1.
// Note - when we used call it was 5 (size of our call + address) // Note - when we used call it was 5 (size of our call + address)
// so we get the EIP as IL2CPU records it. Its also useful for when we // so we get the EIP as IL2CPU records it. Its also useful for when we
// wil be changing ops that call this stub. // wil be changing ops that call this stub.
//Check whether this call is result of (i.e. after) INT1. If so, don't subtract 1! //Check whether this call is result of (i.e. after) INT1. If so, don't subtract 1!
EBX = EAX EBX = EAX
! MOV EAX, DR6 ! MOV EAX, DR6
EAX & $4000 EAX & $4000
if EAX != $4000 { if EAX != $4000 {
EBX-- EBX--
} }
EAX = EBX EAX = EBX
// Store it for later use. // Store it for later use.
.CallerEIP = EAX .CallerEIP = EAX
Executing() // Executing()
-All -All
// Temp disabled, see comment on LockOrExit above // Temp disabled, see comment on LockOrExit above
// Unlock // Unlock
} }

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