diff --git a/source/Cosmos.Assembler/Assembler.cs b/source/Cosmos.Assembler/Assembler.cs index 215ab8a22..6d9a369ff 100644 --- a/source/Cosmos.Assembler/Assembler.cs +++ b/source/Cosmos.Assembler/Assembler.cs @@ -218,7 +218,7 @@ namespace Cosmos.Assembler { aOutput.WriteLine("%ifndef ELF_COMPILATION"); aOutput.WriteLine("use32"); - aOutput.WriteLine("org 0x200000"); + aOutput.WriteLine("org 0x1000000"); aOutput.WriteLine("[map all main.map]"); aOutput.WriteLine("%endif"); @@ -451,7 +451,6 @@ namespace Cosmos.Assembler { WriteDebugVideo("Creating IDT."); CreateIDT(); - #if LFB_1024_8 new Comment("Set graphics fields"); 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 }; #endif - WriteDebugVideo("Initializing SSE."); - new Comment(this, "BEGIN - SSE Init"); - // 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 Or { DestinationReg = Registers.EAX, SourceValue = 0x100 }; - new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; - new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 }; - new Or { DestinationReg = Registers.EAX, SourceValue = 0x200 }; - new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; - new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; + //WriteDebugVideo("Initializing SSE."); + //new Comment(this, "BEGIN - SSE Init"); + //// 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 Or { DestinationReg = Registers.EAX, SourceValue = 0x100 }; + //new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; + //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR4 }; + //new Or { DestinationReg = Registers.EAX, SourceValue = 0x200 }; + //new Mov { DestinationReg = Registers.CR4, SourceReg = Registers.EAX }; + //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; - new And { DestinationReg = Registers.EAX, SourceValue = 0xfffffffd }; - new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; - new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; + //new And { DestinationReg = Registers.EAX, SourceValue = 0xfffffffd }; + //new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; + //new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.CR0 }; - new And { DestinationReg = Registers.EAX, SourceValue = 1 }; - new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; - new Comment(this, "END - SSE Init"); + //new And { DestinationReg = Registers.EAX, SourceValue = 1 }; + //new Mov { DestinationReg = Registers.CR0, SourceReg = Registers.EAX }; + //new Comment(this, "END - SSE Init"); if (mComPort > 0) { WriteDebugVideo("Initializing DebugStub."); diff --git a/source/Cosmos.Core/Heap.cs b/source/Cosmos.Core/Heap.cs index bc28e89fe..562d35716 100644 --- a/source/Cosmos.Core/Heap.cs +++ b/source/Cosmos.Core/Heap.cs @@ -129,7 +129,7 @@ namespace Cosmos.Core mEndOfRam = aEndOfRam; mStartAddress = (mStartAddress / 4) * 4; mLength -= 1024; - UpdateDebugDisplay(); + //UpdateDebugDisplay(); } private static bool mInitialized = false; @@ -138,7 +138,8 @@ namespace Cosmos.Core if (!mInitialized) { mInitialized = true; - DoInitialize(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() - 1) * 1024 * 1024); + //DoInitialize(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() - 1) * 1024 * 1024); + DoInitialize(0x8000000, 0x20000000); } } diff --git a/source/Cosmos.Debug.Common/DebugConnectorEdison.cs b/source/Cosmos.Debug.Common/DebugConnectorEdison.cs index eee864882..7169f3477 100644 --- a/source/Cosmos.Debug.Common/DebugConnectorEdison.cs +++ b/source/Cosmos.Debug.Common/DebugConnectorEdison.cs @@ -60,7 +60,7 @@ namespace Cosmos.Debug.Common { SendTextToConsole("Sending kernel now\r\n"); SendTextToConsole("Filename = '" + mKernelFile + "'\r\n"); - SendRawData("\0loady 0x200000\r\n"); + SendRawData("\0loady 0x1000000\r\n"); mBootStage = 2; } break; @@ -68,17 +68,17 @@ namespace Cosmos.Debug.Common if (HandleFileSending(aPacket)) { 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; } 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: if (WaitForBootPrompt(aPacket)) { @@ -111,12 +111,6 @@ namespace Cosmos.Debug.Common Next(1, WaitForSignature); } - protected override void DoDebugMsg(string aMsg) - { - base.DoDebugMsg(aMsg); - - } - private bool WaitForBootPrompt(byte[] aPacket) { // wait for "boot > " diff --git a/source/Cosmos.Debug.DebugStub/CmdSend.asm b/source/Cosmos.Debug.DebugStub/CmdSend.asm index c1706abe7..1c06b94a8 100644 --- a/source/Cosmos.Debug.DebugStub/CmdSend.asm +++ b/source/Cosmos.Debug.DebugStub/CmdSend.asm @@ -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 DebugStub_SendText: +Pushad Mov AL, DebugStub_Const_Ds2Vs_Message Call DebugStub_ComWriteAL @@ -166,11 +167,8 @@ Dec ECX Inc ESI Jmp DebugStub_SendText_WriteChar -Mov ESI, EBP -Add ESI, 12 -Mov ECX, [ESI + 0] -Mov ESI, [EBP + 8] +Popad DebugStub_SendText_Exit: mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_SendText_Exit Ret diff --git a/source/Cosmos.Debug.DebugStub/CmdSend.xs b/source/Cosmos.Debug.DebugStub/CmdSend.xs index ad6d09f0f..2a6a0b5d6 100644 --- a/source/Cosmos.Debug.DebugStub/CmdSend.xs +++ b/source/Cosmos.Debug.DebugStub/CmdSend.xs @@ -157,11 +157,12 @@ function SendTrace { // Output: None // Modifies: EAX, ECX, EDX, ESI function SendText { + +All // Write the type AL = #Ds2Vs_Message ComWriteAL() - // Write Length + // Write Length ESI = EBP ESI + 12 ECX = ESI[0] @@ -176,16 +177,17 @@ WriteChar: // We are storing as 16 bits, but for now I will transmit 8 bits // So we inc again to skip the 0 ESI++ - goto WriteChar + goto WriteChar ////test // Write Length - ESI = EBP - ESI + 12 - ECX = ESI[0] - - // Address of string - ESI = EBP[8] + //ESI = EBP + //ESI + 12 + //ECX = ESI[0] + // + //// Address of string + //ESI = EBP[8] + -All } // Input: Stack diff --git a/source/Cosmos.Debug.DebugStub/TracerEntry.asm b/source/Cosmos.Debug.DebugStub/TracerEntry.asm index f8b77eb2c..68730b818 100644 --- a/source/Cosmos.Debug.DebugStub/TracerEntry.asm +++ b/source/Cosmos.Debug.DebugStub/TracerEntry.asm @@ -1,3 +1,5 @@ +; Generated at 3-2-2015 19:17:42 + @@ -27,7 +29,6 @@ Mov EAX, EBX Mov [DebugStub_CallerEIP], EAX -Call DebugStub_Executing Popad diff --git a/source/Cosmos.Debug.DebugStub/TracerEntry.xs b/source/Cosmos.Debug.DebugStub/TracerEntry.xs index c7b59fd1b..266659f00 100644 --- a/source/Cosmos.Debug.DebugStub/TracerEntry.xs +++ b/source/Cosmos.Debug.DebugStub/TracerEntry.xs @@ -17,46 +17,46 @@ namespace DebugStub Interrupt TracerEntry { - // This code is temporarily disabled as IRQs are not enabled right now. - // LockOrExit +// This code is temporarily disabled as IRQs are not enabled right now. +// LockOrExit +All - // Save current ESP so we can look at the results of PushAll later - .PushAllPtr = ESP - .CallerEBP = EBP +// Save current ESP so we can look at the results of PushAll later +.PushAllPtr = ESP +.CallerEBP = EBP - // Get current ESP and add 32. This will skip over the PushAll and point - // us at the call data from Int3. - EBP = ESP - EBP + 32 - // Caller EIP - EAX = EBP[0] +// Get current ESP and add 32. This will skip over the PushAll and point +// us at the call data from Int3. +EBP = ESP +EBP + 32 +// Caller EIP +EAX = EBP[0] - // 12 bytes for EFLAGS, CS, EIP - EBP + 12 - .CallerESP = EBP +// 12 bytes for EFLAGS, CS, EIP +EBP + 12 +.CallerESP = EBP - // 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) - // so we get the EIP as IL2CPU records it. Its also useful for when we - // 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! - EBX = EAX - ! MOV EAX, DR6 - EAX & $4000 - if EAX != $4000 { - EBX-- - } - EAX = EBX +// 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) +// so we get the EIP as IL2CPU records it. Its also useful for when we +// wil be changing ops that call this stub. - // Store it for later use. - .CallerEIP = EAX - - Executing() - - -All - - // Temp disabled, see comment on LockOrExit above - // Unlock +//Check whether this call is result of (i.e. after) INT1. If so, don't subtract 1! +EBX = EAX +! MOV EAX, DR6 +EAX & $4000 +if EAX != $4000 { + EBX-- +} +EAX = EBX + +// Store it for later use. +.CallerEIP = EAX + +// Executing() + +-All + +// Temp disabled, see comment on LockOrExit above +// Unlock } diff --git a/source/Cosmos.IL2CPU/AppAssembler.cs b/source/Cosmos.IL2CPU/AppAssembler.cs index bdf4e553e..52615b28c 100644 --- a/source/Cosmos.IL2CPU/AppAssembler.cs +++ b/source/Cosmos.IL2CPU/AppAssembler.cs @@ -123,7 +123,7 @@ namespace Cosmos.IL2CPU xMethodLabel = LabelName.Get(aMethod.MethodBase); } 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 // so during debugging they can never be confused as to what they point to. @@ -1373,7 +1373,7 @@ namespace Cosmos.IL2CPU Assembler.EmitAsmLabels = false; 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); } finally