Preboot debug info.

This commit is contained in:
kudzu_cp 2012-06-27 00:22:34 +00:00
parent 879d070614
commit 0d3fbc1d21
2 changed files with 24 additions and 11 deletions

View file

@ -177,6 +177,9 @@ namespace Cosmos.IL2CPU.X86 {
} }
public void WriteDebugVideo(string aText) { public void WriteDebugVideo(string aText) {
// TODO: Add an option on the debug project properties to turn this off.
var xPreBootLogging = true;
if (xPreBootLogging) {
UInt32 xVideo = 0xB8000; UInt32 xVideo = 0xB8000;
for (UInt32 i = xVideo; i < xVideo + 80 * 2; i = i + 2) { for (UInt32 i = xVideo; i < xVideo + 80 * 2; i = i + 2) {
new LiteralAssemblerCode("mov byte [0x" + i.ToString("X") + "], 0"); new LiteralAssemblerCode("mov byte [0x" + i.ToString("X") + "], 0");
@ -188,6 +191,7 @@ namespace Cosmos.IL2CPU.X86 {
xVideo = xVideo + 2; xVideo = xVideo + 2;
} }
} }
}
public override void Initialize() { public override void Initialize() {
base.Initialize(); base.Initialize();
@ -235,14 +239,16 @@ namespace Cosmos.IL2CPU.X86 {
// ie bootloader debugging. This must be the FIRST code, even before setup so we know // ie bootloader debugging. This must be the FIRST code, even before setup so we know
// we are being called properly by the bootloader and that if there are problems its // we are being called properly by the bootloader and that if there are problems its
// somwhere in our code, not the bootloader. // somwhere in our code, not the bootloader.
WriteDebugVideo("Cosmos pre boot..."); WriteDebugVideo("Cosmos pre boot");
// For when using Bochs, causes a break ASAP on entry after initial Cosmos display. // For when using Bochs, causes a break ASAP on entry after initial Cosmos display.
new LiteralAssemblerCode("xchg bx, bx"); new LiteralAssemblerCode("xchg bx, bx");
// CLI ASAP // CLI ASAP
WriteDebugVideo("Clearing interrupts.");
new ClrInterruptFlag(); new ClrInterruptFlag();
WriteDebugVideo("Begin multiboot info.");
new Comment(this, "MultiBoot compliant loader provides info in registers: "); new Comment(this, "MultiBoot compliant loader provides info in registers: ");
new Comment(this, "EBX=multiboot_info "); new Comment(this, "EBX=multiboot_info ");
new Comment(this, "EAX=0x2BADB002 - check if it's really Multiboot loader "); new Comment(this, "EAX=0x2BADB002 - check if it's really Multiboot loader ");
@ -265,7 +271,10 @@ namespace Cosmos.IL2CPU.X86 {
}; };
new Comment(this, "END - Multiboot Info"); new Comment(this, "END - Multiboot Info");
WriteDebugVideo("Creating GDT.");
CreateGDT(); CreateGDT();
WriteDebugVideo("Creating IDT.");
CreateIDT(); CreateIDT();
#if LFB_1024_8 #if LFB_1024_8
@ -279,6 +288,7 @@ namespace Cosmos.IL2CPU.X86 {
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.");
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 };
@ -298,10 +308,12 @@ namespace Cosmos.IL2CPU.X86 {
new Comment(this, "END - SSE Init"); new Comment(this, "END - SSE Init");
if (mComNumber > 0) { if (mComNumber > 0) {
WriteDebugVideo("Initializing DebugStub.");
new Call { DestinationLabel = "DebugStub_Init" }; new Call { DestinationLabel = "DebugStub_Init" };
} }
// Jump to Kernel entry point // Jump to Kernel entry point
WriteDebugVideo("Jumping to kernel.");
new Call { DestinationLabel = EntryPointName }; new Call { DestinationLabel = EntryPointName };
new Comment(this, "Kernel done - loop till next IRQ"); new Comment(this, "Kernel done - loop till next IRQ");

View file

@ -31,11 +31,12 @@
<ul> <ul>
<li>Guess doesnt boot on USB or PXE</li> <li>Guess doesnt boot on USB or PXE</li>
<li>.iso has a users dir in it</li> <li>.iso has a users dir in it</li>
</ul> <li>Proj props - Disable pre boot logging</ul>
<h3> <h3>
Kudzu</h3> Kudzu</h3>
<ul> <ul>
<li>PXE<li>you switched the data and text segments, right? before text was first <li>Auto disable debug stub instead of hanging<li>PXE<li>Wait for debug - or
press ESC<li>Proj props - disable debug stub<li>you switched the data and text segments, right? before text was first
data after, and now that&#39;s data-text? if so, we need to fix our &quot;EndOfKernel&quot; data after, and now that&#39;s data-text? if so, we need to fix our &quot;EndOfKernel&quot;
code..<li>Press stop with vmwarwe code..<li>Press stop with vmwarwe
workstation<li>X# <ul> workstation<li>X# <ul>