Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomOS_cp authored and AtomOS_cp committed Mar 3, 2013
1 parent 0268213 commit 2985078
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 41 deletions.
Binary file added Build/VMWare/Workstation/Filesystem(OLD).vmdk
Binary file not shown.
Binary file modified Build/VMWare/Workstation/Filesystem.vmdk
Binary file not shown.
43 changes: 22 additions & 21 deletions source/Cosmos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "35549"
VWDPort = "14481"
EndProjectSection
EndProject
Project("{471EC4BB-E47E-4229-A789-D1F5F83B52D4}") = "Kudzu.Breakpoints", "..\source2\Users\Kudzu\Breakpoints\Kudzu.Breakpoints.Cosmos", "{E5647BFD-1507-4F02-A7D5-E0F9D6AECE3A}"
ProjectSection(ProjectDependencies) = postProject
{3370FC04-B669-46A4-A4AA-A89540318F8D} = {3370FC04-B669-46A4-A4AA-A89540318F8D}
{91CBD640-C07D-4556-B4CB-6F8CD88C67C9} = {91CBD640-C07D-4556-B4CB-6F8CD88C67C9}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.DebugStub", "..\source2\Compiler\Cosmos.Compiler.DebugStub\Cosmos.Debug.DebugStub.csproj", "{A7F3F078-CF99-4018-9A35-2D6DC9517ADB}"
Expand Down Expand Up @@ -454,35 +455,35 @@ Global
SccProjectTopLevelParentUniqueName53 = Cosmos.sln
SccProjectName53 = ../source2/Users/Kudzu/Breakpoints
SccLocalPath53 = ..\\source2\\Users\\Kudzu\\Breakpoints
SccWebProject54 = true
SccProjectUniqueName54 = ..\\Docs
SccProjectName54 = ../Docs
SccLocalPath54 = ..\\Docs
SccProjectEnlistmentChoice54 = 2
SccProjectUniqueName55 = ..\\source2\\Users\\Kudzu\\Breakpoints\\Kudzu.BreakpointsKernel.csproj
SccProjectUniqueName54 = ..\\source2\\Users\\Kudzu\\Breakpoints\\Kudzu.BreakpointsKernel.csproj
SccProjectTopLevelParentUniqueName54 = Cosmos.sln
SccProjectName54 = ../source2/Users/Kudzu/Breakpoints
SccLocalPath54 = ..\\source2\\Users\\Kudzu\\Breakpoints
SccProjectUniqueName55 = ..\\source2\\Users\\BlueSkeye\\GuessForBochs\\GuessForBochs.Cosmos
SccProjectTopLevelParentUniqueName55 = Cosmos.sln
SccProjectName55 = ../source2/Users/Kudzu/Breakpoints
SccLocalPath55 = ..\\source2\\Users\\Kudzu\\Breakpoints
SccProjectUniqueName56 = ..\\source2\\Users\\BlueSkeye\\GuessForBochs\\GuessForBochs.Cosmos
SccProjectName55 = ../source2/Users/BlueSkeye/GuessForBochs
SccLocalPath55 = ..\\source2\\Users\\BlueSkeye\\GuessForBochs
SccProjectUniqueName56 = ..\\source2\\Users\\GeramyLovelessTest\\GeramyLovelessTest.csproj
SccProjectTopLevelParentUniqueName56 = Cosmos.sln
SccProjectName56 = ../source2/Users/BlueSkeye/GuessForBochs
SccLocalPath56 = ..\\source2\\Users\\BlueSkeye\\GuessForBochs
SccProjectUniqueName57 = ..\\source2\\Users\\GeramyLovelessTest\\GeramyLovelessTest.csproj
SccProjectName56 = ../source2/Users/GeramyLovelessTest
SccLocalPath56 = ..\\source2\\Users\\GeramyLovelessTest
SccProjectUniqueName57 = ..\\source2\\Users\\GeramyLovelessTest\\GeramyLovelessTestBoot.Cosmos
SccProjectTopLevelParentUniqueName57 = Cosmos.sln
SccProjectName57 = ../source2/Users/GeramyLovelessTest
SccLocalPath57 = ..\\source2\\Users\\GeramyLovelessTest
SccProjectUniqueName58 = ..\\source2\\Users\\GeramyLovelessTest\\GeramyLovelessTestBoot.Cosmos
SccProjectUniqueName58 = GeramysTest\\GeramysTest.csproj
SccProjectTopLevelParentUniqueName58 = Cosmos.sln
SccProjectName58 = ../source2/Users/GeramyLovelessTest
SccLocalPath58 = ..\\source2\\Users\\GeramyLovelessTest
SccProjectUniqueName59 = GeramysTest\\GeramysTest.csproj
SccProjectName58 = GeramysTest
SccLocalPath58 = GeramysTest
SccProjectUniqueName59 = GeramysTest\\GeramysTestBoot.Cosmos
SccProjectTopLevelParentUniqueName59 = Cosmos.sln
SccProjectName59 = GeramysTest
SccLocalPath59 = GeramysTest
SccProjectUniqueName60 = GeramysTest\\GeramysTestBoot.Cosmos
SccProjectTopLevelParentUniqueName60 = Cosmos.sln
SccProjectName60 = GeramysTest
SccLocalPath60 = GeramysTest
SccWebProject60 = true
SccProjectUniqueName60 = ..\\Docs
SccProjectName60 = ../Docs
SccLocalPath60 = ..\\Docs
SccProjectEnlistmentChoice60 = 2
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
25 changes: 13 additions & 12 deletions source2/Kernel/System/Hardware/Cosmos.Hardware/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ static void InitAta(BlockDevice.Ata.ControllerIdEnum aControllerID, BlockDevice.
var xIO = aControllerID == BlockDevice.Ata.ControllerIdEnum.Primary ? Cosmos.Core.Global.BaseIOGroups.ATA1 : Cosmos.Core.Global.BaseIOGroups.ATA2;
var xATA = new BlockDevice.AtaPio(xIO, aControllerID, aBusPosition);
if (xATA.DriveType != BlockDevice.AtaPio.SpecLevel.Null) {
BlockDevice.BlockDevice.Devices.Add(xATA);
var xMbrData = new byte[512];
xATA.ReadBlock(0, 1, xMbrData);
var xMBR = new BlockDevice.MBR(xMbrData);
// TODO Change this to foreach when foreach is supported
for (int i = 0; i < xMBR.Partitions.Count; i++) {
var xPart = xMBR.Partitions[i];
var xPartDevice = new BlockDevice.Partition(xATA, xPart.StartSector, xPart.SectorCount);
BlockDevice.BlockDevice.Devices.Add(xPartDevice);
}
BlockDevice.BlockDevice.Devices.Add(xATA);
var xMbrData = new byte[512];
xATA.ReadBlock(0, 1, xMbrData);
var xMBR = new BlockDevice.MBR(xMbrData);
// TODO Change this to foreach when foreach is supported
for (int i = 0; i < xMBR.Partitions.Count; i++) {
var xPart = xMBR.Partitions[i];
var xPartDevice = new BlockDevice.Partition(xATA, xPart.StartSector, xPart.SectorCount);
BlockDevice.BlockDevice.Devices.Add(xPartDevice);
}
}
}

Expand All @@ -43,9 +43,10 @@ static internal void InitStaticDevices() {

// Find hardcoded ATA controllers
Global.Dbg.Send("ATA Master");
//InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Master);
InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Slave);

Global.Dbg.Send("ATA Slave");
//InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Slave);
InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Master);

//TODO Need to change code to detect if ATA controllers are present or not. How to do this? via PCI enum?
// They do show up in PCI space as well as the fixed space.
Expand Down
163 changes: 162 additions & 1 deletion source2/Users/Kudzu/Breakpoints/BreakpointsOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,27 @@ void TestStringCtor() {
Console.WriteLine(xString.Length);
}

public void Format(Partition p)
{
byte[] aData = p.NewBlockArray(1);
p.ReadBlock(0, 1U, aData);

aData[510] = 0xAA; aData[511] = 0x55;

//The number of Bytes per sector (remember, all numbers are in the little-endian format).
aData[11] = 0x01; aData[12] = 0xCA;
aData[13] = 0x08; //Number of sectors per cluster.
aData[14] = 0x01; aData[15] = 0xFF;//Number of reserved sectors. The boot record sectors are included in this value
aData[16] = 0x02;//Number of File Allocation Tables (FAT's) on the storage media. Often this value is 2.
aData[17] = 0x00; aData[18] = 0x0f;//Number of directory entries (must be set so that the root directory occupies entire sectors).
aData[19] = 0xFF; aData[20] = 0xFF;//The total sectors in the logical volume. If this value is 0, it means there are more than 65535 sectors in the volume, and the actual count is stored in "Large Sectors (bytes 32-35).
aData[22] = 0x0F; aData[23] = 0xFF;//Number of sectors per FAT. FAT12/FAT16 only.
p.WriteBlock(0, 1U, aData);
}
protected void TestATA()
{
#region Comment(OLD)
/*
try
{
Console.WriteLine();
Expand Down Expand Up @@ -231,7 +250,149 @@ protected void TestATA()
{
Console.WriteLine("Exception: " + e.Message);
Stop();
}
}*/
#endregion
try
{

Console.WriteLine();
Console.WriteLine("Block devices found: " + BlockDevice.Devices.Count);

AtaPio xATA = null;
for (int i = 0; i < BlockDevice.Devices.Count; i++)
{
var xDevice = BlockDevice.Devices[i];
if (xDevice is AtaPio)
{
xATA = (AtaPio)xDevice;
Console.WriteLine("Device: " + i);
//break;
}
}

//Info
Console.WriteLine("--------------------------");
Console.WriteLine("Type: " + (xATA.DriveType == AtaPio.SpecLevel.ATA ? "ATA" : "ATAPI"));
Console.WriteLine("Serial No: " + xATA.SerialNo);
Console.WriteLine("Firmware Rev: " + xATA.FirmwareRev);
Console.WriteLine("Model No: " + xATA.ModelNo);
Console.WriteLine("Block Size: " + xATA.BlockSize + " bytes");
Console.WriteLine("Size: " + xATA.BlockCount * xATA.BlockSize / 1024 / 1024 + " MB");

//Partition Detecting
Partition xPartition = null;
if (BlockDevice.Devices.Count > 0)
{
for (int i = 0; i < BlockDevice.Devices.Count; i++)
{
var xDevice = BlockDevice.Devices[i];
if (xDevice is Partition)
{
xPartition = (Partition)xDevice;
}
}

Console.WriteLine("FAT FS");
var xFS = new FAT.FatFileSystem(xPartition);

Console.WriteLine("Mapping...");
Sys.Filesystem.FileSystem.AddMapping("C", xFS);


Console.WriteLine();
Console.WriteLine("Root directory");

var xListing = xFS.GetRoot();
FAT.Listing.FatFile xRootFile = null;
FAT.Listing.FatFile xKudzuFile = null;

for (int i = 0; i < xListing.Count; i++)
{
var xItem = xListing[i];
if (xItem is Sys.Filesystem.Listing.Directory)
{
//Detecting Dir in HDD
Console.WriteLine("<DIR> " + xListing[i].Name);
}
else if (xItem is Sys.Filesystem.Listing.File)
{
//Detecting File in HDD
Console.WriteLine("<FILE> " + xListing[i].Name + " (" + xListing[i].Size + ")");
if (xListing[i].Name == "Root.txt")
{
xRootFile = (FAT.Listing.FatFile)xListing[i];
}
else if (xListing[i].Name == "Kudzu.txt")
{
xKudzuFile = (FAT.Listing.FatFile)xListing[i];
}
}
}


try
{
var xStream = new Sys.Filesystem.FAT.FatStream(xRootFile);
var xData = new byte[xRootFile.Size];
xStream.Read(xData, 0, (int)xRootFile.Size);
var xText = Encoding.ASCII.GetString(xData);
Console.WriteLine(xText);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}


try
{
Console.WriteLine();
Console.WriteLine("StreamReader");
//var xStream = new Sys.Filesystem.FAT.FatStream(xRootFile);
//var xReader = new System.IO.StreamReader(xStream);
//string xText = xReader.ReadToEnd();
//Console.WriteLine(xText);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}


var xKudzuStream = new Sys.Filesystem.FAT.FatStream(xKudzuFile);
var xKudzuData = new byte[xKudzuFile.Size];
xKudzuStream.Read(xKudzuData, 0, (int)xKudzuFile.Size);

var xFile = new System.IO.FileStream(@"c:\Root.txt", System.IO.FileMode.Open);

//int dummy = 42;

var xWrite = new byte[512];
for (int i = 0; i < 512; i++)
{
xWrite[i] = (byte)i;
}
xATA.WriteBlock(0, 1U, xWrite);

var xRead = xATA.NewBlockArray(1);
xATA.ReadBlock(0, 1, xRead);
string xDisplay = "";
for (int i = 0; i < 512; i++)
{
xDisplay = xDisplay + xRead[i].ToHex();
}
Console.WriteLine(xDisplay);

}
else
{
Console.WriteLine("No Block Device Found! ");
}
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}
}

protected override void AfterRun() {
Expand Down
23 changes: 17 additions & 6 deletions source2/Users/Kudzu/Breakpoints/Kudzu.Breakpoints.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<EnableGDB>True</EnableGDB>
<EnableGDB>False</EnableGDB>
<DebugMode>Source</DebugMode>
<TraceMode>User</TraceMode>
<BuildTarget>PXE</BuildTarget>
Expand Down Expand Up @@ -52,7 +52,7 @@
<USB_OutputPath>bin\Debug\</USB_OutputPath>
<USB_Framework>MicrosoftNET</USB_Framework>
<USB_UseInternalAssembler>False</USB_UseInternalAssembler>
<USB_TraceAssemblies />
<USB_TraceAssemblies>All</USB_TraceAssemblies>
<USB_EnableGDB>False</USB_EnableGDB>
<USB_StartCosmosGDB>false</USB_StartCosmosGDB>
<VMware_Deployment>ISO</VMware_Deployment>
Expand All @@ -65,7 +65,7 @@
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
<ISO_Launch>None</ISO_Launch>
Expand All @@ -76,7 +76,7 @@
<ISO_OutputPath>bin\Debug\</ISO_OutputPath>
<ISO_Framework>MicrosoftNET</ISO_Framework>
<ISO_UseInternalAssembler>False</ISO_UseInternalAssembler>
<ISO_TraceAssemblies />
<ISO_TraceAssemblies>All</ISO_TraceAssemblies>
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
Expand Down Expand Up @@ -123,6 +123,8 @@
<User001_ShowLaunchConsole>False</User001_ShowLaunchConsole>
<USB_ShowLaunchConsole>False</USB_ShowLaunchConsole>
<VMware_ShowLaunchConsole>False</VMware_ShowLaunchConsole>
<ISO_ShowLaunchConsole>False</ISO_ShowLaunchConsole>
<ISO_VisualStudioDebugPort>Pipe: Cosmos\Serial</ISO_VisualStudioDebugPort>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -131,7 +133,7 @@
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<DebugMode>Source</DebugMode>
<EnableGDB>True</EnableGDB>
<EnableGDB>False</EnableGDB>
<TraceMode>
</TraceMode>
<VMWareFlavor>Workstation</VMWareFlavor>
Expand Down Expand Up @@ -207,7 +209,7 @@
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<User001_Name>PXE with Slave (Kudzu)</User001_Name>
<User001_Description>Creates a PXE setup and hosts a DCHP and TFTP server to deploy directly to physical hardware. Allows debugging with a serial cable.</User001_Description>
Expand All @@ -226,13 +228,22 @@
<User001_EnableGDB>False</User001_EnableGDB>
<User001_StartCosmosGDB>false</User001_StartCosmosGDB>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<ISO_ShowLaunchConsole>False</ISO_ShowLaunchConsole>
<ISO_VisualStudioDebugPort>Pipe: Cosmos\Serial</ISO_VisualStudioDebugPort>
<ISO_TraceAssemblies>All</ISO_TraceAssemblies>
<USB_TraceAssemblies>All</USB_TraceAssemblies>
</PropertyGroup>
<ItemGroup>
<None Include="Compile last with NASM.bat">
<SubType>Content</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\source\Cosmos\Cosmos.Hardware\Cosmos.Hardware2.csproj">
<Name>Cosmos.Hardware2</Name>
<Project>{ce50fe98-9ac4-4b4d-adc7-31f6dcd28755}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Kernel\System\Cosmos.System.Plugs.System\Cosmos.System.Plugs.System.csproj">
<Name>Cosmos.System.Plugs.System</Name>
<Project>{7c64b97f-516d-4a6d-b9e1-3fe48f561409}</Project>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down

0 comments on commit 2985078

Please sign in to comment.