diff --git a/Demos/Guess/Guess.Cosmos b/Demos/Guess/Guess.Cosmos index d2a11c1f1..bb5371026 100644 --- a/Demos/Guess/Guess.Cosmos +++ b/Demos/Guess/Guess.Cosmos @@ -150,8 +150,8 @@ All False False - True - True + False + False Bochs @@ -295,8 +295,8 @@ All False False - True - True + False + False diff --git a/source/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs b/source/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs index 83b7d3edc..8fe434a9a 100644 --- a/source/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs +++ b/source/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs @@ -429,7 +429,7 @@ namespace Cosmos.Debug.VSDebugEngine // TODO : What if the configuration file doesn't exist ? This will throw a FileNotFoundException in // the Bochs class constructor. Is this appropriate behavior ? mHost = new Host.Bochs(mDebugInfo, xUseGDB, bochsConfigurationFile); - ((Host.Bochs)mHost).FixBochsConfiguration(new KeyValuePair[] { new KeyValuePair("IsoFileName", mISO) }); + //((Host.Bochs)mHost).FixBochsConfiguration(new KeyValuePair[] { new KeyValuePair("IsoFileName", mISO) }); break; case LaunchType.IntelEdison: mHost = new Host.IntelEdison(mDebugInfo, false); diff --git a/source/Cosmos.Debug.VSDebugEngine/Host/Bochs.Configuration.cs b/source/Cosmos.Debug.VSDebugEngine/Host/Bochs.Configuration.cs index f0aa8da71..eeb6fa369 100644 --- a/source/Cosmos.Debug.VSDebugEngine/Host/Bochs.Configuration.cs +++ b/source/Cosmos.Debug.VSDebugEngine/Host/Bochs.Configuration.cs @@ -17,49 +17,50 @@ namespace Cosmos.Debug.VSDebugEngine.Host { 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=1n" + - "config_interface: win32config\n" + - "display_library: win32\n" + - "memory: host=128, guest=128\n" + - "romimage: file=\"C:\\Program Files (x86)\\Bochs-2.6.8/BIOS-bochs-latest\"\n" + - "vgaromimage: file=\"C:\\Program Files (x86)\\Bochs-2.6.8/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=realtime, time0=local, rtc_sync=1\n" + - "# no cmosimage\n" + - "# no loader\n" + - "log: -\n" + - "logprefix: %t%e%d\n" + - "debug: action=report\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=null\n" + - "com2: enabled=0\n" + - "com3: enabled=0\n" + - "com4: enabled=0"; +"# 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=32, guest=32\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=null\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]; @@ -70,6 +71,10 @@ namespace Cosmos.Debug.VSDebugEngine.Host string Value = comboItem.Substring(KeyValueIndex + 1, comboItem.Length - KeyValueIndex - 1); defaultConfigs.Add(Key, Value); } + else + { + defaultConfigs.Add(comboItem, ""); + } } string iso_paramater = defaultConfigs.Get("ata0-master"); iso_paramater = iso_paramater.Replace("%CDROMBOOTPATH%", mParams["ISOFile"]); @@ -81,9 +86,19 @@ namespace Cosmos.Debug.VSDebugEngine.Host FileStream configFileHandler = File.Create(filePath); for (int i = 0; i < defaultConfigs.AllKeys.Length; i++) { - string configItem = defaultConfigs.GetKey(i) + ":" + defaultConfigs.Get(i); - byte[] lineData = ASCIIEncoding.Unicode.GetBytes(configItem + Environment.NewLine); - configFileHandler.Write(lineData, 0, lineData.Length); + 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();