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:
parent
f0471947fc
commit
060f84e07d
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user