Michael Devore <[EMAIL PROTECTED]> writes: > Yes, reversion to original A20 test is going to be the final mod > tried before I declare the BIOS rogue, or possibly a subtle-bugged > application.
Yuck. > Although the new A20 test code should work, as it does fine in many > machines and the logic is sound. I still think instruction reordering is a potential issue. I also think the memdisk code for testing A20 is worth thinking about (apologies if the syntax is backwards from what you are used to): a20_test: push es push cx push ax mov cx,0FFFFh ; HMA = segment 0FFFFh mov es,cx mov cx,32 ; Loop count mov ax,[A20Test] .a20_wait: inc ax mov [A20Test],ax io_delay ; Serialize, and fix delay cmp ax,[es:A20Test+CS_BASE+10h] loopz .a20_wait .a20_done: pop ax pop cx pop es ret That "Serialize" line is the key. Its purpose is to ensure that the processor does not reorder the read from [es:A20Test+CS_BASE+10h] to happen earlier than the write to [A20Test]. (There is nothing stopping the processor from doing such a reordering; as far as it can tell, the instructions touch different addresses in memory.) io_delay is defined as "call _io_delay", which is just this subroutine: _io_delay: out 80h,al out 80h,al ret ...where 80h is assumed to be an invalid port. This code also loops 32 times just in case the gate is in the process of opening. That part looks like a hack to me, but there are rumors that some systems have A20 gates which are EXTREMELY slow to respond. (Although I would expect them to be slow both to open and to close...) For what it is worth, the Linux kernel uses similar code on startup. Which is not surprising, since the same person wrote it. Just some food for thought. - Pat ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Freedos-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-devel