Reply 380 of 2421, by SA1988
when the menu is disabled, no errors are detected, so, there's something wrong in the gui menu.
when the menu is disabled, no errors are detected, so, there's something wrong in the gui menu.
Another update:
http://hackipedia.org/Projects/DOSBox-X/dosbo … 7c7a-src.tar.xz
commit fd2866c10b6f435c86ffa121b46fa3944c817c7aAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 15:09:42 2014 -0700add code (commented out by default) to show memory writes if they occurin protected mode post-killswitchcommit 2a164a5ad26d82ba7d3cbf30187e4e73ee22a955Author: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 14:58:03 2014 -0700BOOT command now shuts down on booting a guest OS:- EMM Expanded Memory Manager emulation- XMS Extended Memory Manager emulation- The DOS kernel object (INT 21h is not needed for guest OS)- SBLASTER and GUS environment variables (destructors forAutoexec objects were responsible for writing to memory andtriggering page faults from within 32-bit OSes on shutdown).These changes appear to have resolved the issue of Instant Page FaultBSODs with NT when you use DOSBox's kill switch.commit 9f8e05dc1518fc9020e2ede1d4cf024f225e4387Author: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 14:57:18 2014 -0700add functions to snap the CPU into and back from a temporary "realmode". intended for code that needs to operate in real-mode addressesregardless of the CPU state when the code was executed.commit 106c3608f5b96716bad20446c86610a8d4787f7cAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 14:54:13 2014 -0700whoops, forgot shell.hcommit eb65a29c7ba6f71a1721c6ac39dbb9f5b358e45fAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 14:53:38 2014 -0700Autoexec object: added Uninstall() function as a way to remove theenvironment variable without destroying the objectcommit e0125bebf007521b5968795e64e64b15cd70c480Author: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 13:57:37 2014 -0700Up until now, when running a guest OS like Windows NT, DOSBox has had astrange bug where pressing the "kill switch" (CTRL+F9) does not shutdownDOSBox but instead instantly causes a page fault. It turns out there isstill code in DOSBox trying to set/clear environment blocks and otherstructures despite the fact those structures are long gone andoverwritten by a guest OS! But more importantly, these memory writescause a page fault in NT because at the time they are executed, thatpart of linear memory is mapped out, thus, the Kill Switch waseffectively an Instant Page Fault and BSOD Windows NT switch instead. Asa temporary hack, I added code to the Kill Switch callback and to theCPU core that forces the CPU back into real mode before throwing theint(1) exception, which ensures that when DOSBox writes to memory on
shutdown, the page fault never happens and DOSBox shuts down properly.Stack trace of the DOSBox shutdown process that triggers a guest OS pagefault:#0 PAGING_NewPageFault (lin_addr=lin_addr@entry=300, page_addr=323584, faultcode=faultcode@entry=0, prepare_only=false) at paging.cpp:327#1 0x0807c2b8 in PAGING_NewPageFault (faultcode=0, prepare_only=false, page_addr=<optimized out>, lin_addr=300) at paging.cpp:277#2 InitPage (prepare_only=false, writing=false, lin_addr=300, this=0x98cf79c <init_page_handler>) at paging.cpp:733#3 NewInitPageHandler::readd (this=0x98cf79c <init_page_handler>, addr=300) at paging.cpp:653#4 0x08135013 in mem_readd_inline (address=300) at ../../include/paging.h:310#5 mem_readd (address=300) at memory.cpp:609 #6 0x08065f32 in RealGetVec (vec=<optimized out>) at ../../include/mem.h:219#7 CALLBACK_HandlerObject::Uninstall (this=0xa9f90dc) at callback.cpp:536#8 0x08290da9 in ~EMS (this=0xa9f90c8, __in_chrg=<optimized out>) at ems.cpp:1420#9 EMS::~EMS (this=0xa9f90c8, __in_chrg=<optimized out>) at ems.cpp:1456#10 0x082ae346 in Section::ExecuteDestroy (this=this@entry=0xa686640, destroyall=destroyall@entry=true) at setup.cpp:770#11 0x082ae383 in Section_prop::~Section_prop (this=0xa686640, __in_chrg=<optimized out>) at setup.cpp:729#12 0x082ae460 in Section_prop::~Section_prop (this=0xa686640, __in_chrg=<optimized out>) at setup.cpp:733#13 0x082ae490 in Config::~Config (this=0xbffffa54, __in_chrg=<optimized out>) at setup.cpp:779#14 0x08051ec6 in main (argc=1, argv=0xbffffc04) at sdlmain.cpp:3099Hm, the EMS (Expanded Memory Manager) is causing this? Why is the EMSstill active when the guest OS is running?!?So it looks like the next step is to modify the BOOT command to shutdownExpanded Memory and Extended Memory functions before running the guestOS.commit b8effd6af0e88b0302475044cc46418400f49a0dAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 13:03:25 2014 -0700comment out debug messages. add reminders to self about INT 15h mouseemulation and future changes to handle it's reliance on the AUX portverses the user's wishes that the guest OS not talk to the AUX port.commit da27ede399448241a861995e8b7afaf5b4772e8dAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 01:07:00 2014 -0700add INT 15h AX=0xC206 BH=0x00, which is apparently used by NT. addedmore keyboard debug printf's. Added commentary on what Windows NT doeswith the keyboard controller.commit 151a05bbbbfa7cb38dc133acb93d2ed9a924a88aAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Sun Apr 20 23:59:51 2014 -0700INT 15h mouse functions INIT and RESET now use SET DEFAULTS command forPS/2 mice to help get them initialized. PS/2 mouse emulation nowdefaults to streaming mode by default. See web sitehttp://www.computer-engineering.org/ps2mouse/ for more info. I waswrong to assume PS/2 mice started in remote mode. Also a win for WindowsNT which does not bother commanding the mouse to enter streaming mode,for this very reason, I assume. Removed "aux device reset streaming"option, the above fix makes it unnecessary. Added debug print to AUXemulation and INT 15h mouse calls for debugging.
There's a nmi dosbox patch: Post 178269
but it doesn't work too well yet, which may or may not be the fault of the patch.
pcem has nmi, sbos fares better than the above. If you want to hear better than OPL SBOS output, check out ultrabots/xenobots intro, pcem gets that far.
From your TODO
>The question to ask is: how does the NMI interrupt system work?
NMI has the highest interrupt priority, aka it trumps irq 0. It's not run through the PIC, CPUs have a separate pin for NMI. There are three ways to generate an NMI, illegal instruction sent to the FPU, memory parity check, and IO check line on the bus. Type can be determined between fpu and the others by checking .. I forget, ppi/8042 or pit, and I'm unsure if parity and io check are discernible.
I've been importing bits of your emulation code into dosbox-SVN. I believe I have your PS/2 emulation imported, but not the latest update which appears to be quite extensive (you wrote an incredible amount of code in two days!). I noted that the PS/2 mouse doesn't generate "page faults" in 95 as does the default mouse option in dosbox; it also appears very responsive where moving the cursor in the 95 shell. Your work on booting NT is also very extensive and I look forward to trying NT 3.1. Thank you for the additional emulations! 😀
wrote:I've been importing bits of your emulation code into dosbox-SVN. I believe I have your PS/2 emulation imported, but not the latest update which appears to be quite extensive (you wrote an incredible amount of code in two days!). I noted that the PS/2 mouse doesn't generate "page faults" in 95 as does the default mouse option in dosbox; it also appears very responsive where moving the cursor in the 95 shell. Your work on booting NT is also very extensive and I look forward to trying NT 3.1. Thank you for the additional emulations! 😀
There is a document I wrote in the NOTES section of the source tree describing why: The INT 33h emulation uses mem_readb() to read from the BIOS data area (specifically the byte the BIOS uses to remember the active video mode) which takes the same execution path as a CPU read or write, which means that if the guest OS has paging enabled, it is beholden to the same rules as paging including causing a page fault if the guest OS has that page marked as "not present".
Windows 3.1, 95, and 98 (and even Windows ME to some extent) leave pages 0x0000-0xFFFF mapped and accessible (Win 95 and earlier maps it read/write, Win 98 and later read only, and Windows ME maps it out not present for 32-bit code). So when INT 33h code used mem_readb() to read the BIOS area, nothing happened.
Windows ME and NT however, map pages 0x0000-0xFFFF as not present (Windows ME does it when executing 32-bit driver or Win32 code, Windows NT maps it out at all times). When the INT 33h emulation used mem_readb() in that case, mem_readb() caused a page fault exception, which caused DOSBox to recursively reenter itself to handle it (so that Windows NT could handle it and take the "Blue Screen of Death" route) or in extreme cases, crash DOSBox with the "PF queue full" error.
MS-DOS of course, does not use paging. Most DOS extenders like DOS4GW and DOS32A will run the 32-bit DOS program in 32-bit protected mode with paging turned off if possible, or if EMM386.EXE and VCPI is active, will use a limited form of paging that will usually map the lower 1MB region one-to-one with real mode anyway. Which is why the INT 33h mem_readb() was never an issue with DOS games either.
wrote:There's a nmi dosbox patch: Post 178269 but it doesn't work too well yet, which may or may not be the fault of the patch. pcem […]
There's a nmi dosbox patch: Post 178269
but it doesn't work too well yet, which may or may not be the fault of the patch.
pcem has nmi, sbos fares better than the above. If you want to hear better than OPL SBOS output, check out ultrabots/xenobots intro, pcem gets that far.From your TODO
>The question to ask is: how does the NMI interrupt system work?NMI has the highest interrupt priority, aka it trumps irq 0. It's not run through the PIC, CPUs have a separate pin for NMI. There are three ways to generate an NMI, illegal instruction sent to the FPU, memory parity check, and IO check line on the bus. Type can be determined between fpu and the others by checking .. I forget, ppi/8042 or pit, and I'm unsure if parity and io check are discernible.
I know that part. What I was asking (if I remember the note to myself correctly) was: How does the Gravis Ultrasound use the NMI interrupt to fake the MPU and Sound Blaster functions? What do you program into the chip's registers to enable that? What does the card expect you to do with the registers when that happens? If Gravis Ultrasound NMI emulation were implemented, DOSBox-X could accurately recreate for historical interest what it's like to use MEGA-EM and SBOS to try and play Sound Blaster based DOS games.
wrote:There's a nmi dosbox patch: Post 178269
but it doesn't work too well yet, which may or may not be the fault of the patch.
pcem has nmi, sbos fares better than the above. If you want to hear better than OPL SBOS output, check out ultrabots/xenobots intro, pcem gets that far.
Also, I can't seem to access that part of the forum. I'm not authorized, apparently.
Another minor update that fixes some crashiness with the mouse and Windows 3.1.
http://hackipedia.org/Projects/DOSBox-X/dosbo … 2d28-src.tar.xz
commit ba68b07d36867e80ebeb56b0a780a082807b2d28Author: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 16:51:03 2014 -0700PS/2 device callback: make sure seg != 0 and ofs != 0 before calling.INT 15h: Mouse reset function now turns off mouse. This resolves randomcrashes that can occur if you enter into Windows 3.1, then exit back toDOS, then move the mouse.commit 657351c2f5d79914af288b9376c4d6ead3b1fc2bAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 16:27:38 2014 -0700comment out read port 0x61
wrote:wrote:There's a nmi dosbox patch: Post 178269 but it doesn't work too well yet, which may or may not be the fault of the patch. pcem […]
There's a nmi dosbox patch: Post 178269
but it doesn't work too well yet, which may or may not be the fault of the patch.
pcem has nmi, sbos fares better than the above. If you want to hear better than OPL SBOS output, check out ultrabots/xenobots intro, pcem gets that far.From your TODO
>The question to ask is: how does the NMI interrupt system work?NMI has the highest interrupt priority, aka it trumps irq 0. It's not run through the PIC, CPUs have a separate pin for NMI. There are three ways to generate an NMI, illegal instruction sent to the FPU, memory parity check, and IO check line on the bus. Type can be determined between fpu and the others by checking .. I forget, ppi/8042 or pit, and I'm unsure if parity and io check are discernible.
I know that part. What I was asking (if I remember the note to myself correctly) was: How does the Gravis Ultrasound use the NMI interrupt to fake the MPU and Sound Blaster functions? What do you program into the chip's registers to enable that? What does the card expect you to do with the registers when that happens? If Gravis Ultrasound NMI emulation were implemented, DOSBox-X could accurately recreate for historical interest what it's like to use MEGA-EM and SBOS to try and play Sound Blaster based DOS games.
Ultrasound generates an NMI when Adlib/SB ports are accessed, SBOS listens for an NMI then does its emulation from/to the ports.
In case you don't know, SBOS source is available: http://alsa.cybermirror.org/datasheets/gus/amd960214.tar.gz. It's the interwave version(I believe iwsbos is sbos & megaem merged,) GUS DOS driver sources used to be available as well, http://toogam.com/software/archive/drivers/so … nd/gussound.htm, need to find someone who grabbed the code before that server went down. I've attached the dosbox nmi patch from the thread you can't access, but I'd definitely be looking at how Sarah did it in PCEM, she may have implemented whatever that's key to make it work better.
Thank you for the very interesting explanation of the INT 33h emulation where paging is active! I read your notes, but the additional descriptions have helped me to better appreciate the inner-workings. 😀
Also, thanks for the latest set of updates! I'm amazed at how much work you have put into the keyboard and mouse emulation to allow the Windows guest. I think it will take me longer to read your code then it took you to write and debug it. 😀
Grab amd960214 and look at setup_nmi in \960214.src\sbos\loader.c
I almost was able to install NT 3.1 by use of hints here: http://gunkies.org/wiki/Installing_Windows_NT_3.1_on_Qemu. Probably better to create a working image in another emulator and then boot it with dosbox-x. At the least, it appears that it has helped so far to debug the emulation.
The IDE/PS2/Paging updates are working very well in 95. 😀 The latest PS/2 emulation seems to increase the responsiveness and stability in Win95. Half-life ran nicely with CD audio where the updates were active; prior to these updates there was an infrequent page fault problem.
is it me or when pressing Ctrl-F4 when booting a guest OS it crashes dosbox completely with the latest source changes (April 21)?
wrote:is it me or when pressing Ctrl-F4 when booting a guest OS it crashes dosbox completely with the latest source changes (April 21)?
That's another bug I just recently fixed. It has to do with the stale pointers left behind in the Drives[] array after the DOS kernel is shut down during the BOOT command. The disk swapping routine then chokes on the stale pointers and DOSBox crashes.
I have another release up to fix that and a few other problems with INT33h vs Windows 3.1.
(coming up next..)
http://hackipedia.org/Projects/DOSBox-X/dosbo … 010f-src.tar.xz
commit 0db69db9b14d72a50002c56c0e44676753b3010fAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 05:23:27 2014 -0700separate INT 33h mouse coordinates from PS/2 mouse coordinates. Thisfixes a bug where a DOS program in Windows 3.1 DOS box couldpotentially have a cursor that, instead of being properly constrained tothe screen, was permitted to go WAY out of bounds off the edge of thescreen. This means for example that if you run the built-in EDITcommand, and then move the cursor to the left and up several times, thecursor "block" would eventually reach way past VRAM and into the UMB andROM area. Or worse, if the cursor goes beyond the edge of the screen,Microsoft CodeView will crash with a runtime error. Separating the twoallows the PS/2 mouse events to reflect relative motion while keepingINT 33h cursor movement confined properly.commit afb6643f9dac8cfb6df0ad5cd9b78f43b83acb13Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 05:13:04 2014 -0700move INT10_SetCurMode() call out to INT 10 video modesetting, AWAY fromthe SDL GUI mouse event function call. always compute mickeys movedusing the last known video mode. Move the INT 33h's cursor redrawfunction to within INT 74h callback, where on real hardware it is likelyto happen. These changes resolve crashiness issues with Windows 3.1because it moves the parts that access VRAM and the BIOS DATA AREA towithin IRQ 12 where Windows 3.1 expects real-mode code to do that,rather than "out of the blue" as DOSBox used to prior to the fix.Booting DOSBox-X with int33=true and biosps2=true and running Windows3.1 directly from DOSBox's native command interpreter no longer causeserratic crashes a) if you move the mouse during the bootup logo or b)move the mouse while running a DOS program fullscreen in a DOS box.commit 69b9ccbee65063e3bfc1415d5c3cb4e3e04849f6Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 05:04:41 2014 -0700remove unused function from mouse.cppcommit e5bca45c39a333ad6b2c5b44114730aba67eb0edAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 04:54:39 2014 -0700add notes about Microsoft Windows 3.11, including PS/2 mouse cursorproblems with DOS boxes, and serious conflicts between Windows 3.1 andDOSBox's INT 33h mouse emulation (when running Windows 3.1 directly fromDOSBox's DOS prompt).commit 446a79d47dffcafb7557c9c2f46dd923b91491f3Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 00:53:30 2014 -0700add INT 15h mouse diagnostic param that, if set, saves all CPU registerson the stack. If the guest OS or DOS program is acting erratically whenthe mouse is involved, setting this option can help to determine if thefault lies in the device callback failing to preserve CPU registers.commit c9056fac61c7a65e3dfef69bb5f7d327bb0f1147Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 00:06:39 2014 -0700
update NOTEScommit 7be6d5a7c738304fe4a3b15e4ad586f4c8d0aa7aAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 22:51:04 2014 -0700Add more notescommit 06808abbba1f920626514092806776cbd9025cfbAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 22:22:11 2014 -0700bugfix: When the DOS kernel shuts down, make sure the Drives[] array iszeroed as well. Prior to this fix, mounting drive c: then booting aguest OS would leave behind stale (invalid) pointers in the Drives[]array once the BOOT program shut the DOS kernel down. This wouldn'tcause any problems until you attempted to use the Disk Swap hotkey, atwhich point, DOSBox would crash.commit 4c6d5991f817cf5fd4b579f4943d6b2258d426c4Author: Jonathan Campbell <jonathan@castus.tv>Date: Mon Apr 21 22:21:45 2014 -0700serial mouse emulation: double the dy coordinate value so that whenusing Windows 1.0 with serial mouse the movement isn't so "squished" andseems more normal.
Ah... shit.
Alright. The fact that the DOS kernel is clearing Drives[] even if the CD-ROM emulation or floppy emulation intends to use it means that I've now created a use-after-free bug and DOSBox will eventually crash when you swap CDs. Zeroing the array on free resolved the possibility of stale pointers but didn't fix that issue.
I have to head into work now but I'll fix that as soon as I can. I'm really sorry.
If you need the functionality now you could try commenting out the for() loop in the ~DOS() destructor on line 1729 of src/dos/dos.cpp that frees the Drives[] array to see if that helps.
looks like for me your gui menu is quite buggy with NT since it still does that trap bsod when clicking to the menu or to the close button of DOSBox 🙁
Okay. another update.
I fixed the aforementioned use-after-free bug and then went ahead and went through the code with Valgrind to look for other memory leaks and patch them up.
The bad news: My Windows NT 3.1 installation bluescreens again 🙁 I'm reinstalling the image to see if that resolves it.
http://hackipedia.org/Projects/DOSBox-X/dosbo … 98fe-src.tar.xz
commit 49269ee06136b0fe73a2ccce93d6f30152bc98feAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 23:16:02 2014 -0700add to build script commentary about -g3 and -O0 flags and dynamic corecommit a50cb931a7fa391829e06156a16bc6a32473a772Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 22:24:02 2014 -0700Final comments on what was found during Valgrind hunting.commit 07c288ccdbd1116faa9b6561fafa13662fc0bbe0Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 22:04:54 2014 -0700Valgrind hunting: call GUI toolkit to free all fonts in it's registry onshutdown. one less memory leak reported by Valgrind.commit 51ca1f23e9c42ae4a8153ade62a85ce3b904a8fcAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 21:55:52 2014 -0700Valgrind hunting: free bindlist on shutdown in mapper, remove anothersource of memory leaks.commit 6534e27817723dfd1d4c41c11cb421d1de1e27daAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 21:38:57 2014 -0700more fiddling. there's this persistent memory leak from a std::string inthe Section_line object I'm trying to get rid of.commit 805f6ac6089cc57df4bbc0075397142a73d50cefAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 21:09:41 2014 -0700morecommit 596ddebb5d3e8c817cdd298d3c4604f9381cc61dAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 20:59:21 2014 -0700hm, make destructors virtualcommit 31985a8682a4f14f0248428a7fcb08ffb4641ff3Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 20:40:16 2014 -0700Valgrind hunting: Free ISAPNP objects on shutdowncommit 76a8c34f7f14509cd1e36b30b96aa0f0e8a8af25Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 20:33:51 2014 -0700morecommit d587f13df46adb53fa0a77414e792c4623b444f7Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 20:24:04 2014 -0700
hm... minor revisioncommit a9a8046bfd218f9774e39a933bbd29d0181abe08Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 19:19:14 2014 -0700Cleanup: make sure to clear properties list on destruct. Fix bug inconfig file parsing where unknown sections are treated as if continuingthe previous section, which is silly.commit 8289fc8c1c5367ac1d2931f2a3bc6397a7695064Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 18:59:11 2014 -0700add build script for maxiumum debuggingcommit 0848f5b98312dcbb054d0613906dd12fc743e07fAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 18:44:15 2014 -0700Valgrind hunting: CD-ROM emulation allocates a mixer channel object. Nowto avert memory leaks, it frees the object. One less memory leakreported.commit a3d3f7c4c9f2827935bb62f1e807f10ba9d668ddAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 18:33:21 2014 -0700Valgrind hunting: rewrite PROGRAMS code to better track their resources,including the tiny amount of memory used to generate the executable"stub". this eliminates the many tiny memory leaks reported by Valgrindhere.commit 67bd3d71cb18b168ec49a193287f26091117c192Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 18:10:44 2014 -0700Valgrind hunting: add shutdown function for virtual filesystem code, tofree the linked list it allocates when emulating a virtual drive (suchas the default drive Z:) on shutdown. This eliminates a whole bunch ofmemory leak messages from Valgrind.commit f4482911219f53bc132ff196921f0d7b049152c9Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 18:04:51 2014 -0700Valgrind hunting: cleanup sdl_mapper to release allocated bindings,events, etc. on shutdown. Changed destructors to virtual to ensurederived classes clean themselves and the base class up properly. Thiseliminates Valgrind complains about memory leaks in that part of thecode. Conversely, I see plenty of code using "new" to allocate an objectnot to assign a pointer from it but on the assumption the constructeradds itself to a list. I don't approve of that kind of C++ style and Iwill clean that up later.commit 13760a7094fbe892c9357b9758655bb021808c09Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 17:31:22 2014 -0700Valgrind hunting: add shutdown procedure for dynamic core, to free X86register "generators" (or whatever they are) and reduce the number ofthings not freed on shutdown.commit 50e1ac5cd8cfc67786f6365b25902fdfe2414ebbAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 17:20:48 2014 -0700Valgrind hunting: adjust vga_memory.cpp to memset from the baseallocation not the adjusted (aligned pointer). This resolves a complaintfrom Valgrind that the memset() is writing beyond the end of the char[]array.commit f149e86ca043c4708d7d67765b8563c74081c8d8Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 17:15:21 2014 -0700Valgrind hunting: CSerial destructor made virtual so classes derivedfrom it still clean up resources properly on destruction. Added code todelete device object as well as remove from DOS kernel. added code todelete the FIFO objects properly from the destructor. Serial portemulation no longer leaks memory.commit a90af711a291f6dce2c6b20637267e07100c14b3Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:59:56 2014 -0700Valgrind hunting: PIC tick handler cleanup, deallocate tick handlerlinked list at shutdown to resolve minor memory leak. Keyboard codeupdated to remove tick handler on shutdown.commit 0592dbb64b1569774b40de0d1d0688b0230c8605Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:44:17 2014 -0700Valgrind hunting: resolve memory leaks with callback string allocation,and make sure the callback array is initialized properly.commit c3028def408f29fec9fbf232daad936a8221f42bAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:33:52 2014 -0700Valgrind hunting: Add code to ensure Devices[] array is initialized toNULL on startup, and all Devices[] are freed on shutdown, to eliminatememory leak.commit 9f3419c92ef621798f437fb6528c6313ffa07b3aAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:28:35 2014 -0700Valgrind hunting: close memory leak caused by code that frees theFiles[] array but not the Files objects in the array.commit 60fb86ac66a63924b7a7603fc67e52a5912b880aAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:17:34 2014 -0700Valgrind hunting round: found mismatched new/free allocation of intarray (type int[]). Updated deletion of array to use delete[] instead ofdelete.commit f33d13a31d564bd3de6a6874954ed45c372947edAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:13:23 2014 -0700ne2000=true by default? No way.commit 65b10129ae210b0f379f15cd2302e31024f8ce18Author: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 16:02:02 2014 -0700src/ints/bios.cpp: Valgrind shows "use of uninitialized variable" whichat first looks spurious (it's pointing at a constant+(variable*2)expression passed to mem_readw), but at closer examination, comes as aresult of the function's declaration of int port; being overshadowedinside the for() loop by Bitu port, in a manner that assigns the valueof mem_readw(port) to port, like this:Bitu port = mem_readw(constant+(port*2));The guy who wrote this code, I think, thought that the compiler woulddeclare "port" for the inner scope, then use "port" from the outer scopeand multiply by 2 and add to the const expr and assign to the "port"variable on the inner scope. Instead, the "undefined" error happensbecause GCC interprets it as taking the (undefined) value of "port",multiply by 2, add to constexpr, and assign back. Thus, the undefinedvalue warning.commit df1b715ae276fe345121de87b2b6d8df2a3b25caAuthor: Jonathan Campbell <jonathan@castus.tv>Date: Tue Apr 22 15:38:28 2014 -0700Modified DOS kernel NOT to free the Drives[] array on DOS kernelshutdown. This fixes crashes when you use CTRL+F4 to swap CDs, andresolves what was obviously a use-after-free bug. sdlmain.cpp wasupdated to free Drives[] on shutdown instead.
Update: Reinstalling did in fact help. I guess that's what happens when you prematurely shut down Windows NT too often (either by CTRL+F9 or because it crashed too much)
wrote:looks like for me your gui menu is quite buggy with NT since it still does that trap bsod when clicking to the menu or to the close button of DOSBox 🙁
I'll look into that when I can. It's probably the same issue as DOSBox's "kill" switch triggering page faults in NT. Perhaps the popup menu reads state. I didn't write that code, it was added when I merged in code from Taewoong's branch.