mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 21:08:51 +00:00
Fixed Conv_I and stobj opcode handling..
This commit is contained in:
parent
50a75f6f1d
commit
5147a015dc
3 changed files with 64 additions and 22 deletions
|
|
@ -17,30 +17,34 @@ namespace Cosmos.Kernel.FileSystem {
|
|||
int xBlockSize = (int)(1024 << (byte)(xSuperBlock.LogBlockSize));
|
||||
int xGroupDescriptorPerBlock = xBlockSize / 32;// groupdescriptor size
|
||||
GroupDescriptor[] xGroupDescriptors = ReadGroupDescriptorsOfBlock(aController, aDrive, xSuperBlock.FirstDataBlock + 1, xSuperBlock, xBuffer);
|
||||
if (xGroupDescriptors != null) {
|
||||
Console.WriteLine("Successfully read GroupDescriptors");
|
||||
} else {
|
||||
Console.WriteLine("Error while reading GroupDescriptors");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static unsafe GroupDescriptor[] ReadGroupDescriptorsOfBlock(byte aController, byte aDrive, uint aBlock, SuperBlock aSuperBlock, ushort* aBuffer) {
|
||||
//GroupDescriptor[] xResult = new GroupDescriptor[32];
|
||||
GroupDescriptor[] xResult = new GroupDescriptor[32];
|
||||
int xBlockSize = (int)(1024 << aSuperBlock.LogBlockSize);
|
||||
int xGroupDescriptorPerBlock = xBlockSize / 32;// groupdescriptor size
|
||||
Hardware.Storage.ATA.ReadDataNew(aController, aDrive, aBlock, aBuffer);
|
||||
if (!true/*Hardware.Storage.ATA.ReadDataNew(aController, aDrive, aBlock, aBuffer)*/) {
|
||||
Console.WriteLine("[Ext2|GroupDescriptors] Error while reading GroupDescriptor data");
|
||||
return null;
|
||||
if (!Hardware.Storage.ATA.ReadDataNew(aController, aDrive, aBlock, aBuffer)) {
|
||||
Console.WriteLine("[Ext2|GroupDescriptors] Error while reading GroupDescriptor data");
|
||||
return null;
|
||||
} else {
|
||||
Console.WriteLine("[Ext2|GroupDescriptors] Block read");
|
||||
Console.WriteLine("[Ext2|GroupDescriptors] Block read");
|
||||
}
|
||||
GroupDescriptor* xDescriptorPtr = (GroupDescriptor*)aBuffer;
|
||||
//for (uint i = 0; i < 32; i++) {
|
||||
uint i = 0;
|
||||
Console.Write("Start Iteration ");
|
||||
Hardware.Storage.ATA.WriteNumber(i, 8);
|
||||
Console.WriteLine("");
|
||||
//xResult[i] = xDescriptorPtr[i];
|
||||
Console.WriteLine("End Iteration");
|
||||
////}
|
||||
return null;
|
||||
for (uint i = 0; i < 32; i++) {
|
||||
Console.Write("Start Iteration ");
|
||||
Hardware.Storage.ATA.WriteNumber(i, 8);
|
||||
Console.WriteLine("");
|
||||
xResult[i] = xDescriptorPtr[i];
|
||||
Console.WriteLine("End Iteration");
|
||||
}
|
||||
return xResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using CPU = Indy.IL2CPU.Assembler.X86;
|
||||
using CPUx86 = Indy.IL2CPU.Assembler.X86;
|
||||
|
||||
namespace Indy.IL2CPU.IL.X86 {
|
||||
[OpCode(Code.Conv_I)]
|
||||
|
|
@ -11,7 +9,24 @@ namespace Indy.IL2CPU.IL.X86 {
|
|||
: base(aInstruction, aMethodInfo) {
|
||||
}
|
||||
public override void DoAssemble() {
|
||||
// todo: implement correct conversion
|
||||
int xSource = Assembler.StackSizes.Pop();
|
||||
switch (xSource) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4: {
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
new CPUx86.Add("esp", "4");
|
||||
new CPUx86.Pushd(CPUx86.Registers.EAX);
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
throw new Exception("SourceSize " + xSource + " not supported!");
|
||||
}
|
||||
Assembler.StackSizes.Push(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,11 +9,34 @@ namespace Indy.IL2CPU.IL.X86 {
|
|||
: base(aInstruction, aMethodInfo) {
|
||||
}
|
||||
public override void DoAssemble() {
|
||||
new CPUx86.Pop(CPUx86.Registers.EDX);
|
||||
new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
new CPUx86.Move(CPUx86.Registers.AtEAX, CPUx86.Registers.EDX);
|
||||
Assembler.StackSizes.Pop();
|
||||
//new CPUx86.Pop(CPUx86.Registers.EDX);
|
||||
//new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
//new CPUx86.Move(CPUx86.Registers.AtEAX, CPUx86.Registers.EDX);
|
||||
int xFieldSize = Assembler.StackSizes.Pop();
|
||||
Assembler.StackSizes.Pop();
|
||||
new CPUx86.Pop("ecx");
|
||||
for (int i = 0; i < (xFieldSize / 4); i++) {
|
||||
new CPUx86.Pop("eax");
|
||||
new CPUx86.Move("dword [ecx + 0x" + (xFieldSize - (i * 4)).ToString("X") + "]", "eax");
|
||||
}
|
||||
switch (xFieldSize % 4) {
|
||||
case 1: {
|
||||
new CPUx86.Pop("eax");
|
||||
new CPUx86.Move("byte [ecx]", "al");
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
new CPUx86.Pop("eax");
|
||||
new CPUx86.Move("word [ecx]", "ax");
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Exception("Remainder size " + (xFieldSize % 4) + " not supported!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue