386_common: Handle IOPB segment limit corner case more like the old code

This commit is contained in:
RichardG867
2023-04-22 22:28:18 -03:00
parent 9f55afc7a1
commit 4253c7bae7

View File

@@ -1429,26 +1429,29 @@ x86illegal(void)
int
checkio(uint32_t port, int mask)
{
uint16_t t;
uint32_t t;
cpl_override = 1;
t = readmemw(tr.base, 0x66);
if (cpu_state.abrt) {
if (UNLIKELY(cpu_state.abrt)) {
cpl_override = 0;
return 0;
}
if ((t + (port >> 3UL) + 1) > tr.limit) {
t += (port >> 3UL);
mask <<= (port & 7);
if (UNLIKELY(mask & 0xff00)) {
if (LIKELY(t < tr.limit))
mask &= readmemwl(tr.base + t);
} else {
if (LIKELY(t <= tr.limit))
mask &= readmembl(tr.base + t);
}
cpl_override = 0;
return mask;
}
t = readmemwl(tr.base + t + (port >> 3));
cpl_override = 0;
return (t >> (port & 7)) & mask;
}
#ifdef OLD_DIVEXCP
# define divexcp() \
{ \