Sanity check on reading SCAT registers.

This commit is contained in:
Miran Grča
2024-04-16 19:40:21 +02:00
committed by GitHub
parent b92995b039
commit 8756a70e38

View File

@@ -66,14 +66,16 @@ typedef struct ems_page_t {
} ems_page_t; } ems_page_t;
typedef struct scat_t { typedef struct scat_t {
int type; uint8_t max_reg;
int indx;
uint8_t regs[256];
uint8_t reg_2xA; uint8_t reg_2xA;
uint8_t regs[256];
uint32_t xms_bound; uint32_t xms_bound;
int type;
int indx;
int external_is_RAS; int external_is_RAS;
ems_page_t null_page; ems_page_t null_page;
@@ -1233,6 +1235,7 @@ scat_in(uint16_t port, void *priv)
break; break;
default: default:
if (dev->index <= dev->max_reg)
ret = dev->regs[dev->indx]; ret = dev->regs[dev->indx];
break; break;
} }
@@ -1393,6 +1396,8 @@ scat_init(const device_t *info)
sx = (dev->type == 32) ? 1 : 0; sx = (dev->type == 32) ? 1 : 0;
dev->max_reg = sx ? 0x64 : 0x4f;
for (uint32_t i = 0; i < sizeof(dev->regs); i++) for (uint32_t i = 0; i < sizeof(dev->regs); i++)
dev->regs[i] = 0xff; dev->regs[i] = 0xff;