random changes. some dont work :)

This commit is contained in:
mterwoord_cp 2007-11-27 13:57:13 +00:00
parent 70519d3153
commit 90a9edda7c
9 changed files with 32 additions and 30 deletions

View file

@ -92,7 +92,7 @@ namespace Cosmos.Hardware {
public static unsafe void LogInterruptOccurred(Interrupts.InterruptContext* aContext) {
StartLogging();
WriteSerialString("<InterruptOccurred Interrupt=\"");
WriteNumber(aContext->Interrupt, 8);
WriteNumber(aContext->Interrupt, 32);
WriteSerialString("\" SS=\"");
WriteNumber(aContext->SS, 32);
WriteSerialString("\" GS=\"");
@ -103,6 +103,8 @@ namespace Cosmos.Hardware {
WriteNumber(aContext->ES, 32);
WriteSerialString("\" DS=\"");
WriteNumber(aContext->DS, 32);
WriteSerialString("\" CS=\"");
WriteNumber(aContext->CS, 32);
WriteSerialString("\" ESI=\"");
WriteNumber(aContext->ESI, 32);
WriteSerialString("\" EBP=\"");
@ -121,8 +123,6 @@ namespace Cosmos.Hardware {
WriteNumber(aContext->Param, 32);
WriteSerialString("\" EIP=\"");
WriteNumber(aContext->EIP, 32);
WriteSerialString("\" CS=\"");
WriteNumber(aContext->CS, 32);
WriteSerialString("\" EFlags=\"");
WriteNumber(aContext->EFlags, 32);
WriteSerialString("\" UserESP=\"");

View file

@ -7,7 +7,6 @@ namespace Cosmos.Hardware {
public class Interrupts: Hardware {
[StructLayout(LayoutKind.Sequential)]
public struct InterruptContext {
public uint SS;
public uint GS;
public uint FS;
public uint ES;
@ -20,12 +19,13 @@ namespace Cosmos.Hardware {
public uint EDX;
public uint ECX;
public uint EAX;
public byte Interrupt;
public uint Interrupt;
public uint Param;
public uint EIP;
public uint UserESP;
public uint CS;
public uint EFlags;
public uint UserESP;
public uint SS;
public uint EIP;
}
public unsafe static void HandleInterrupt_Default(InterruptContext* aContext) {

View file

@ -59,7 +59,7 @@ namespace Cosmos.Kernel.Plugs.Assemblers {
int[] xInterruptsWithParam = new int[] { 8, 10, 11, 12, 13, 14 };
for (int j = 0; j < 256; j++) {
new Label("__ISR_Handler_" + j.ToString("X2"));
if (j < 0x20 || j > 0x2F) {
if (j < 0x20 || j > 0x2F || true) {
new CPUNative.Cli();
}
new CPUNative.Break();
@ -72,14 +72,13 @@ namespace Cosmos.Kernel.Plugs.Assemblers {
new CPUx86.Pushd("es");
new CPUx86.Pushd("fs");
new CPUx86.Pushd("gs");
new CPUx86.Pushd("ss");
new CPUx86.Pushd("esp");
new CPUx86.Move("eax", "esp");
new CPUx86.Pushd("eax");
MethodDefinition xHandler = GetInterruptHandler((byte)j);
if (xHandler == null) {
xHandler = GetMethodDef(typeof(HW.Interrupts).Assembly, typeof(HW.Interrupts).FullName, "HandleInterrupt_Default", true);
}
new CPUx86.Call(Label.GenerateLabelName(xHandler));
new CPUx86.Popd("ss");
new CPUx86.Popd("gs");
new CPUx86.Popd("fs");
new CPUx86.Popd("es");
@ -93,7 +92,7 @@ namespace Cosmos.Kernel.Plugs.Assemblers {
new CPUNative.IRet();
}
new Label("__AFTER__ALL__ISR__HANDLER__STUBS__");
new CPUNative.Sti();
//new CPUNative.Sti();
}
}
}

View file

@ -5,13 +5,16 @@ using System.Text;
namespace Cosmos.Kernel {
public class CPU {
public static void Init() {
Hardware.CPU.CreateGDT();
Hardware.PIC.Init();
Hardware.Serial.InitSerial(0);
Hardware.DebugUtil.Initialize();
Hardware.DebugUtil.SendMessage("Logging", "Initialized!");
Hardware.PIT.SetSlowest();
Hardware.CPU.CreateIDT();
//Hardware.CPU.CreateGDT();
// Hardware.PIC.Init();
// Hardware.Serial.InitSerial(0);
// Hardware.DebugUtil.Initialize();
// System.Diagnostics.Debugger.Break();
// Hardware.DebugUtil.SendMessage("Logging", "Initialized!");
// System.Diagnostics.Debugger.Break();
// Hardware.PIT.SetSlowest();
// System.Diagnostics.Debugger.Break();
//Hardware.CPU.CreateIDT();
}
}
}

View file

@ -5,10 +5,9 @@ using System.Text;
namespace Cosmos.Shell.Console {
class Program {
static void Main() {
Kernel.CPU.Init();
//Kernel.CPU.Init();
System.Console.WriteLine("Cosmos creation complete");
Kernel.Interrupts.DoTest();
//Kernel.Interrupts.DoTest();
}
}
}

View file

@ -23,16 +23,13 @@ namespace Indy.IL2CPU.Assembler.X86.Native {
protected override void EmitIDataSectionHeader() {
}
public override void Flush() {
base.Flush();
}
protected override void EmitFooter() {
mOutputWriter.WriteLine("_end_data: ; -- end of CODE+DATA ");
mOutputWriter.WriteLine("");
mOutputWriter.WriteLine(";--- bss --- place r*, d* ? directives here, so that you'll have a BSS. ");
mOutputWriter.WriteLine("");
mOutputWriter.WriteLine("");
mOutputWriter.WriteLine("org 0xA00000");
mOutputWriter.WriteLine("rb 50000 ; our own stack ");
mOutputWriter.WriteLine("Kernel_Stack: ");
mOutputWriter.WriteLine("");
@ -105,6 +102,7 @@ namespace Indy.IL2CPU.Assembler.X86.Native {
mOutputWriter.WriteLine("; some more startups todo");
mOutputWriter.WriteLine(" cli");
mOutputWriter.WriteLine(" push ebx");
mOutputWriter.WriteLine(" xchg bx, bx");
mOutputWriter.WriteLine(" call " + EntryPointName);
mOutputWriter.WriteLine(" .loop:");
mOutputWriter.WriteLine(" hlt");
@ -112,4 +110,4 @@ namespace Indy.IL2CPU.Assembler.X86.Native {
mOutputWriter.WriteLine(" ");
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Indy.IL2CPU.Assembler.X86 {
Address = aAddress;
}
public override string ToString() {
return "je " + Address;
return "je near " + Address;
}
}
}

View file

@ -67,7 +67,10 @@ namespace Indy.IL2CPU.IL.X86 {
}
Assembler.StackSizes.Push(mSize);
if (mNeedsGC) {
new CPUx86.Push("[" + mDataName + "]");
new Dup(null, null) {
Assembler = this.Assembler
}.
Assemble();
Engine.QueueMethodRef(GCImplementationRefs.IncRefCountRef);
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.IncRefCountRef));
}

View file

@ -234,7 +234,7 @@ namespace Indy.IL2CPU {
foreach (TypeDefinition xType in mTypes) {
foreach (MethodDefinition xMethod in xType.Constructors) {
if (xMethod.IsStatic) {
xEntryPointOp.Call(xMethod);
//xEntryPointOp.Call(xMethod);
}
}
}