Skip to content

Commit

Permalink
Bochs now uses same device layout as vmware (ATA wise)
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Jun 2, 2015
1 parent dfc3a33 commit 959732f
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 264 deletions.
15 changes: 8 additions & 7 deletions Users/Sentinel/SentinelKernel/SentinelKernelBoot.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
<ProjectGuid>{40c3f1e6-2880-4af4-91fd-dfd41484719d}</ProjectGuid>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<Name>SentinelKernelBoot</Name>
<BinFormat>elf</BinFormat>
<BinFormat>Bin</BinFormat>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>VMware</Profile>
<Profile>Bochs</Profile>
<!-- Looks like this was a mispelled attribute. Replaced by DebugEnabled below.
<DebugEnable>true</DebugEnable>
-->
<DebugEnabled>True</DebugEnabled>
<DebugMode>Source</DebugMode>
<TraceMode>User</TraceMode>
<EnableGDB>False</EnableGDB>
<StartCosmosGDB>False</StartCosmosGDB>
<VMWareEdition>Workstation</VMWareEdition>
<StartCosmosGDB>false</StartCosmosGDB>
<VMWareEdition>Player</VMWareEdition>
<OutputPath>bin\Debug\</OutputPath>
<Name>SentinelKernelBoot</Name>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<Launch>Bochs</Launch>
<VisualStudioDebugPort>Pipe: Cosmos\Serial</VisualStudioDebugPort>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<VMware_Name>SentinelKernelBoot</VMware_Name>
<VMware_Description>Use VMware Player or Workstation to deploy and debug.</VMware_Description>
<VMware_Deployment>ISO</VMware_Deployment>
Expand Down Expand Up @@ -102,6 +102,7 @@
<USB_EnableGDB>True</USB_EnableGDB>
<USB_StartCosmosGDB>True</USB_StartCosmosGDB>
<USB_EnableBochsDebug>True</USB_EnableBochsDebug>
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\source\Cosmos.Core.Plugs\Cosmos.Core.Plugs.csproj">
Expand Down
2 changes: 1 addition & 1 deletion Users/Sentinel/SentinelKernel/bin/Debug/bochsrc.bxrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=cdrom, path="SentinelKernelBoot.iso", status=inserted, model="Generic 1234", biosdetect=auto
ata0-slave: type=none
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-master: type=disk, path="C:\Data\Sources\OpenSource\Cosmos\Build\VMWare\Workstation\Filesystem.vmdk", mode=vmware4, cylinders=0, heads=0, spt=0, model="Generic 1234", biosdetect=auto, translation=auto
ata1-slave: type=none
ata2: enabled=0
ata3: enabled=0
Expand Down
3 changes: 3 additions & 0 deletions source/Cosmos.Debug.VSDebugEngine/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[*.cs]
indent_size=4
indent_style=space

[Host/*.cs]
indent_size=2
182 changes: 96 additions & 86 deletions source/Cosmos.Debug.VSDebugEngine/Host/Bochs.Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,96 +13,106 @@

namespace Cosmos.Debug.VSDebugEngine.Host
{
public partial class Bochs
public partial class Bochs
{
private NameValueCollection defaultConfigs = new NameValueCollection();

private void InitializeKeyValues()
{
private NameValueCollection defaultConfigs = new NameValueCollection();
private void InitializeKeyValues() {
string BochsDirectory = Path.GetDirectoryName(BochsSupport.BochsExe.FullName);
string default_configuration =
"# configuration file generated by Bochs\n" +
"plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1\n" +
"config_interface: win32config\n" +
"display_library: win32\n" +
"memory: host=128, guest=128\n" +
"romimage: file=\""+BochsDirectory+"/BIOS-bochs-latest\"\n" +
"vgaromimage: file=\""+BochsDirectory+"/VGABIOS-lgpl-latest\"\n" +
"boot: cdrom\n" +
"floppy_bootsig_check: disabled=0\n" +
"# no floppya\n" +
"# no floppyb\n" +
"ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14\n" +
"ata0-master: type=cdrom, path=\"%CDROMBOOTPATH%\", status=inserted, model=\"Generic 1234\", biosdetect=auto\n" +
"ata0-slave: type=none\n" +
"ata1: enabled=0\n" +
"ata2: enabled=0\n" +
"ata3: enabled=0\n" +
"pci: enabled=1, chipset=i440fx\n" +
"vga: extension=vbe, update_freq=5, realtime=1\n" +
"cpu: count=1, ips=4000000, model=corei5_lynnfield_750, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0\n" +
"print_timestamps: enabled=0\n" +
"port_e9_hack: enabled=0\n" +
"private_colormap: enabled=0\n" +
"clock: sync=none, time0=local, rtc_sync=0\n" +
"# no cmosimage\n" +
"# no loader\n" +
"log: -\n" +
"logprefix: %t%e%d\n" +
"debug: action=ignore\n" +
"info: action=report\n" +
"error: action=report\n" +
"panic: action=ask\n" +
"keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none\n" +
"mouse: type=ps2, enabled=0, toggle=ctrl+mbutton\n" +
"sound: waveoutdrv=win, waveout=none, waveindrv=win, wavein=none, midioutdrv=win, midiout=none\n" +
"speaker: enabled=1, mode=sound\n" +
"parport1: enabled=1, file=none\n" +
"parport2: enabled=0\n" +
"com1: enabled=1, mode=pipe-client, dev=\"" + @"\\.\pipe\" + "%PIPESERVERNAME%\"\n" +
"com2: enabled=0\n" +
"com3: enabled=0\n" +
"com4: enabled=0";
string[] Keys = default_configuration.Split(new char[] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
for(int i = 0; i < Keys.Length; i++) {
string comboItem = Keys[i];
int KeyValueIndex = comboItem.IndexOf(":");
if (KeyValueIndex > -1)
{
string Key = comboItem.Substring(0, KeyValueIndex);
string Value = comboItem.Substring(KeyValueIndex + 1, comboItem.Length - KeyValueIndex - 1);
defaultConfigs.Add(Key, Value);
}
else
{
defaultConfigs.Add(comboItem, "");
}
}
string xPort = mParams["VisualStudioDebugPort"];
string[] xParts = xPort.Split(new char[] {' '});
defaultConfigs.Set("com1", defaultConfigs.Get("com1").Replace("%PIPESERVERNAME%", xParts[1].ToLower()));
defaultConfigs.Set("ata0-master", defaultConfigs.Get("ata0-master").Replace("%CDROMBOOTPATH%", mParams["ISOFile"]));
string BochsDirectory = Path.GetDirectoryName(BochsSupport.BochsExe.FullName);
string default_configuration =
"# configuration file generated by Bochs\n" +
"plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1\n" +
"config_interface: win32config\n" +
"display_library: win32\n" +
"memory: host=128, guest=128\n" +
"romimage: file=\"" + BochsDirectory + "/BIOS-bochs-latest\"\n" +
"vgaromimage: file=\"" + BochsDirectory + "/VGABIOS-lgpl-latest\"\n" +
"boot: cdrom\n" +
"floppy_bootsig_check: disabled=0\n" +
"# no floppya\n" +
"# no floppyb\n" +
"ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14\n" +
"ata0-master: type=disk, path=\"%HARDDISKPATH%\", mode=vmware4, cylinders=0, heads=0, spt=0, model=\"Generic 1234\", biosdetect=auto, translation=auto\n" +
"ata0-slave: type=none\n" +
"ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15\n" +
"ata1-master: type=cdrom, path=\"%CDROMBOOTPATH%\", status=inserted, model=\"Generic 1234\", biosdetect=auto\n" +
"ata2: enabled=0\n" +
"ata3: enabled=0\n" +
"pci: enabled=1, chipset=i440fx\n" +
"vga: extension=vbe, update_freq=5, realtime=1\n" +
"cpu: count=1, ips=4000000, model=corei5_lynnfield_750, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0\n" +
"print_timestamps: enabled=0\n" +
"port_e9_hack: enabled=0\n" +
"private_colormap: enabled=0\n" +
"clock: sync=none, time0=local, rtc_sync=0\n" +
"# no cmosimage\n" +
"# no loader\n" +
"log: -\n" +
"logprefix: %t%e%d\n" +
"debug: action=ignore\n" +
"info: action=report\n" +
"error: action=report\n" +
"panic: action=ask\n" +
"keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none\n" +
"mouse: type=ps2, enabled=0, toggle=ctrl+mbutton\n" +
"sound: waveoutdrv=win, waveout=none, waveindrv=win, wavein=none, midioutdrv=win, midiout=none\n" +
"speaker: enabled=1, mode=sound\n" +
"parport1: enabled=1, file=none\n" +
"parport2: enabled=0\n" +
"com1: enabled=1, mode=pipe-client, dev=\"" + @"\\.\pipe\" + "%PIPESERVERNAME%\"\n" +
"com2: enabled=0\n" +
"com3: enabled=0\n" +
"com4: enabled=0";
string[] Keys = default_configuration.Split(new char[] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < Keys.Length; i++)
{
string comboItem = Keys[i];
int KeyValueIndex = comboItem.IndexOf(":");
if (KeyValueIndex > -1)
{
string Key = comboItem.Substring(0, KeyValueIndex);
string Value = comboItem.Substring(KeyValueIndex + 1, comboItem.Length - KeyValueIndex - 1);
defaultConfigs.Add(Key, Value);
}
else
{
defaultConfigs.Add(comboItem, "");
}
}
string xPort = mParams["VisualStudioDebugPort"];
string[] xParts = xPort.Split(new char[] {' '});

defaultConfigs.Set("com1", defaultConfigs.Get("com1").Replace("%PIPESERVERNAME%", xParts[1].ToLower()));
var xHarddiskFile = Path.Combine(CosmosPaths.Build, @"VMWare\Workstation\Filesystem.vmdk");
defaultConfigs.Set("ata0-master", defaultConfigs.Get("ata0-master").Replace("%HARDDISKPATH%", xHarddiskFile));

defaultConfigs.Set("ata1-master", defaultConfigs.Get("ata1-master").Replace("%CDROMBOOTPATH%", mParams["ISOFile"]));

private void GenerateConfiguration(string filePath)

}

private void GenerateConfiguration(string filePath)
{
FileStream configFileHandler = File.Create(filePath);
for (int i = 0; i < defaultConfigs.AllKeys.Length; i++)
{
string value = defaultConfigs.Get(i);
string key = defaultConfigs.GetKey(i);
if (value.Length < 1)
{
byte[] lineData = Encoding.ASCII.GetBytes(key + Environment.NewLine);
configFileHandler.Write(lineData, 0, lineData.Length);
}
else
{
FileStream configFileHandler = File.Create(filePath);
for (int i = 0; i < defaultConfigs.AllKeys.Length; i++)
{
string value = defaultConfigs.Get(i);
string key = defaultConfigs.GetKey(i);
if (value.Length < 1)
{
byte[] lineData = ASCIIEncoding.ASCII.GetBytes(key + Environment.NewLine);
configFileHandler.Write(lineData, 0, lineData.Length);
}
else
{
string configItem = key + ":" + value;
byte[] lineData = ASCIIEncoding.ASCII.GetBytes(configItem + Environment.NewLine);
configFileHandler.Write(lineData, 0, lineData.Length);
}
}
configFileHandler.Flush();
configFileHandler.Close();
string configItem = key + ":" + value;
byte[] lineData = Encoding.ASCII.GetBytes(configItem + Environment.NewLine);
configFileHandler.Write(lineData, 0, lineData.Length);
}
}
configFileHandler.Flush();
configFileHandler.Close();
}
}
}

This file was deleted.

Loading

0 comments on commit 959732f

Please sign in to comment.