1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Fail if mapping exceeding the bus size

This commit is contained in:
Radosław Kujawa 2018-06-13 10:29:26 +02:00
parent f0471947fc
commit 060f84e07d
No known key found for this signature in database
GPG Key ID: 18A71CD0FD7270D7

View File

@ -27,10 +27,16 @@ bus_device_add(bus_t *b, device_t *d, uint16_t addr)
{ {
device_mapping_t *dm; device_mapping_t *dm;
if ((addr + d->size) > RK65C02_BUS_SIZE) {
rk65c02_log(LOG_ERROR,
"Bus mapping for %s at %x, size %x exceeding bus size.",
d->name, addr, d->size);
return;
}
dm = (device_mapping_t *) GC_MALLOC(sizeof(device_mapping_t)); dm = (device_mapping_t *) GC_MALLOC(sizeof(device_mapping_t));
dm->dev = d; dm->dev = d;
/* TODO: check if addr + size is not bigger than RK65C02_BUS_SIZE */
dm->addr = addr; dm->addr = addr;
LL_APPEND((b->dm_head), dm); LL_APPEND((b->dm_head), dm);