bios/a20: Improve a20_check(). Could fix #386

This commit is contained in:
mintsuki 2024-07-20 19:30:06 +02:00
parent d1ad6d6285
commit b6da3ed850

View File

@ -8,15 +8,26 @@
#include <lib/real.h>
bool a20_check(void) {
if (mminw(0x7dfe) != mminw(0x7dfe + 0x100000))
return true;
bool ret = false;
uint16_t orig = mminw(0x7dfe);
mmoutw(0x7dfe, 0x1234);
if (mminw(0x7dfe) != mminw(0x7dfe + 0x100000)) {
ret = true;
goto out;
}
mmoutw(0x7dfe, ~mminw(0x7dfe));
if (mminw(0x7dfe) != mminw(0x7dfe + 0x100000))
return true;
if (mminw(0x7dfe) != mminw(0x7dfe + 0x100000)) {
ret = true;
goto out;
}
return false;
out:
mmoutw(0x7dfe, orig);
return ret;
}
// Keyboard controller method code below taken from: