mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
Ongoing edison work
This commit is contained in:
parent
2c7c580b9f
commit
07cdafbedd
8 changed files with 82 additions and 87 deletions
|
|
@ -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.");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 > "
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue