ALi M6117-related memory and ROM fixes.
This commit is contained in:
@@ -1319,7 +1319,6 @@ writememll(uint32_t addr, uint32_t val)
|
|||||||
uint32_t
|
uint32_t
|
||||||
readmemll_no_mmut(uint32_t addr, uint32_t *a64)
|
readmemll_no_mmut(uint32_t addr, uint32_t *a64)
|
||||||
{
|
{
|
||||||
#ifndef NO_MMUT
|
|
||||||
mem_mapping_t *map;
|
mem_mapping_t *map;
|
||||||
|
|
||||||
GDBSTUB_MEM_ACCESS(addr, GDBSTUB_MEM_READ, 4);
|
GDBSTUB_MEM_ACCESS(addr, GDBSTUB_MEM_READ, 4);
|
||||||
@@ -1367,9 +1366,6 @@ readmemll_no_mmut(uint32_t addr, uint32_t *a64)
|
|||||||
((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
|
((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
|
||||||
|
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
#else
|
|
||||||
return readmemll(addr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1377,7 +1373,6 @@ readmemll_no_mmut(uint32_t addr, uint32_t *a64)
|
|||||||
void
|
void
|
||||||
writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val)
|
writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val)
|
||||||
{
|
{
|
||||||
#ifndef NO_MMUT
|
|
||||||
mem_mapping_t *map;
|
mem_mapping_t *map;
|
||||||
|
|
||||||
GDBSTUB_MEM_ACCESS(addr, GDBSTUB_MEM_WRITE, 4);
|
GDBSTUB_MEM_ACCESS(addr, GDBSTUB_MEM_WRITE, 4);
|
||||||
@@ -1435,9 +1430,6 @@ writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val)
|
|||||||
map->write_b(addr + 3, val >> 24, map->p);
|
map->write_b(addr + 3, val >> 24, map->p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
writememll(addr, val);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1668,7 +1660,7 @@ mem_readb_phys(uint32_t addr)
|
|||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
if (map->exec)
|
if (map->exec)
|
||||||
ret = map->exec[addr - map->base];
|
ret = map->exec[(addr - map->base) & map->mask];
|
||||||
else if (map->read_b)
|
else if (map->read_b)
|
||||||
ret = map->read_b(addr, map->p);
|
ret = map->read_b(addr, map->p);
|
||||||
}
|
}
|
||||||
@@ -1686,7 +1678,7 @@ mem_readw_phys(uint32_t addr)
|
|||||||
mem_logical_addr = 0xffffffff;
|
mem_logical_addr = 0xffffffff;
|
||||||
|
|
||||||
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->exec)) {
|
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->exec)) {
|
||||||
p = (uint16_t *) &(map->exec[addr - map->base]);
|
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||||
ret = *p;
|
ret = *p;
|
||||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->read_w))
|
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->read_w))
|
||||||
ret = map->read_w(addr, map->p);
|
ret = map->read_w(addr, map->p);
|
||||||
@@ -1708,7 +1700,7 @@ mem_readl_phys(uint32_t addr)
|
|||||||
mem_logical_addr = 0xffffffff;
|
mem_logical_addr = 0xffffffff;
|
||||||
|
|
||||||
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->exec)) {
|
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->exec)) {
|
||||||
p = (uint32_t *) &(map->exec[addr - map->base]);
|
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||||
ret = *p;
|
ret = *p;
|
||||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->read_l))
|
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->read_l))
|
||||||
ret = map->read_l(addr, map->p);
|
ret = map->read_l(addr, map->p);
|
||||||
@@ -1750,7 +1742,7 @@ mem_writeb_phys(uint32_t addr, uint8_t val)
|
|||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
if (map->exec)
|
if (map->exec)
|
||||||
map->exec[addr - map->base] = val;
|
map->exec[(addr - map->base) & map->mask] = val;
|
||||||
else if (map->write_b)
|
else if (map->write_b)
|
||||||
map->write_b(addr, val, map->p);
|
map->write_b(addr, val, map->p);
|
||||||
}
|
}
|
||||||
@@ -1766,7 +1758,7 @@ mem_writew_phys(uint32_t addr, uint16_t val)
|
|||||||
mem_logical_addr = 0xffffffff;
|
mem_logical_addr = 0xffffffff;
|
||||||
|
|
||||||
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->exec)) {
|
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->exec)) {
|
||||||
p = (uint16_t *) &(map->exec[addr - map->base]);
|
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||||
*p = val;
|
*p = val;
|
||||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->write_w))
|
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->write_w))
|
||||||
map->write_w(addr, val, map->p);
|
map->write_w(addr, val, map->p);
|
||||||
@@ -1786,7 +1778,7 @@ mem_writel_phys(uint32_t addr, uint32_t val)
|
|||||||
mem_logical_addr = 0xffffffff;
|
mem_logical_addr = 0xffffffff;
|
||||||
|
|
||||||
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->exec)) {
|
if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->exec)) {
|
||||||
p = (uint32_t *) &(map->exec[addr - map->base]);
|
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||||
*p = val;
|
*p = val;
|
||||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->write_l))
|
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->write_l))
|
||||||
map->write_l(addr, val, map->p);
|
map->write_l(addr, val, map->p);
|
||||||
@@ -2362,6 +2354,7 @@ mem_mapping_set(mem_mapping_t *map,
|
|||||||
map->enable = 0;
|
map->enable = 0;
|
||||||
map->base = base;
|
map->base = base;
|
||||||
map->size = size;
|
map->size = size;
|
||||||
|
map->mask = (map->size ? 0xffffffff : 0x00000000);
|
||||||
map->read_b = read_b;
|
map->read_b = read_b;
|
||||||
map->read_w = read_w;
|
map->read_w = read_w;
|
||||||
map->read_l = read_l;
|
map->read_l = read_l;
|
||||||
@@ -2479,6 +2472,15 @@ mem_mapping_set_exec(mem_mapping_t *map, uint8_t *exec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
mem_mapping_set_mask(mem_mapping_t *map, uint32_t mask)
|
||||||
|
{
|
||||||
|
map->mask = mask;
|
||||||
|
|
||||||
|
mem_mapping_recalc(map->base, map->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mem_mapping_set_p(mem_mapping_t *map, void *p)
|
mem_mapping_set_p(mem_mapping_t *map, void *p)
|
||||||
{
|
{
|
||||||
@@ -2560,6 +2562,8 @@ mem_a20_init(void)
|
|||||||
{
|
{
|
||||||
if (is286) {
|
if (is286) {
|
||||||
rammask = cpu_16bitbus ? 0xefffff : 0xffefffff;
|
rammask = cpu_16bitbus ? 0xefffff : 0xffefffff;
|
||||||
|
if (is6117)
|
||||||
|
rammask |= 0x03000000;
|
||||||
flushmmucache();
|
flushmmucache();
|
||||||
mem_a20_state = mem_a20_key | mem_a20_alt;
|
mem_a20_state = mem_a20_key | mem_a20_alt;
|
||||||
} else {
|
} else {
|
||||||
@@ -2690,6 +2694,9 @@ mem_reset(void)
|
|||||||
if (cpu_16bitbus) {
|
if (cpu_16bitbus) {
|
||||||
/* 80286/386SX; maximum address space is 16MB. */
|
/* 80286/386SX; maximum address space is 16MB. */
|
||||||
m = 4096;
|
m = 4096;
|
||||||
|
/* ALi M6117; maximum address space is 64MB. */
|
||||||
|
if (is6117)
|
||||||
|
m <<= 2;
|
||||||
} else {
|
} else {
|
||||||
/* 80386DX+; maximum address space is 4GB. */
|
/* 80386DX+; maximum address space is 4GB. */
|
||||||
m = 1048576;
|
m = 1048576;
|
||||||
@@ -2761,8 +2768,10 @@ mem_reset(void)
|
|||||||
mem_init_ram_mapping(&ram_low_mapping, 0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024);
|
mem_init_ram_mapping(&ram_low_mapping, 0x000000, (mem_size > 640) ? 0xa0000 : mem_size * 1024);
|
||||||
|
|
||||||
if (mem_size > 1024) {
|
if (mem_size > 1024) {
|
||||||
if (cpu_16bitbus && mem_size > 16256)
|
if (cpu_16bitbus && !is6117 && mem_size > 16256)
|
||||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (16256 - 1024) * 1024);
|
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (16256 - 1024) * 1024);
|
||||||
|
else if (cpu_16bitbus && is6117 && mem_size > 65408)
|
||||||
|
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (65408 - 1024) * 1024);
|
||||||
else {
|
else {
|
||||||
if (mem_size > 1048576) {
|
if (mem_size > 1048576) {
|
||||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (1048576 - 1024) * 1024);
|
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (1048576 - 1024) * 1024);
|
||||||
@@ -2904,9 +2913,13 @@ mem_a20_recalc(void)
|
|||||||
state = mem_a20_key | mem_a20_alt;
|
state = mem_a20_key | mem_a20_alt;
|
||||||
if (state && !mem_a20_state) {
|
if (state && !mem_a20_state) {
|
||||||
rammask = (cpu_16bitbus) ? 0xffffff : 0xffffffff;
|
rammask = (cpu_16bitbus) ? 0xffffff : 0xffffffff;
|
||||||
|
if (is6117)
|
||||||
|
rammask |= 0x03000000;
|
||||||
flushmmucache();
|
flushmmucache();
|
||||||
} else if (!state && mem_a20_state) {
|
} else if (!state && mem_a20_state) {
|
||||||
rammask = (cpu_16bitbus) ? 0xefffff : 0xffefffff;
|
rammask = (cpu_16bitbus) ? 0xefffff : 0xffefffff;
|
||||||
|
if (is6117)
|
||||||
|
rammask |= 0x03000000;
|
||||||
flushmmucache();
|
flushmmucache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -451,12 +451,13 @@ static void
|
|||||||
bios_add(void)
|
bios_add(void)
|
||||||
{
|
{
|
||||||
int temp_cpu_type, temp_cpu_16bitbus = 1;
|
int temp_cpu_type, temp_cpu_16bitbus = 1;
|
||||||
int temp_is286 = 0;
|
int temp_is286 = 0, temp_is6117 = 0;
|
||||||
|
|
||||||
if (/*AT && */cpu_s) {
|
if (/*AT && */cpu_s) {
|
||||||
temp_cpu_type = cpu_s->cpu_type;
|
temp_cpu_type = cpu_s->cpu_type;
|
||||||
temp_cpu_16bitbus = (temp_cpu_type == CPU_286 || temp_cpu_type == CPU_386SX || temp_cpu_type == CPU_486SLC || temp_cpu_type == CPU_IBM386SLC || temp_cpu_type == CPU_IBM486SLC );
|
temp_cpu_16bitbus = (temp_cpu_type == CPU_286 || temp_cpu_type == CPU_386SX || temp_cpu_type == CPU_486SLC || temp_cpu_type == CPU_IBM386SLC || temp_cpu_type == CPU_IBM486SLC );
|
||||||
temp_is286 = (temp_cpu_type >= CPU_286);
|
temp_is286 = (temp_cpu_type >= CPU_286);
|
||||||
|
temp_is6117 = !strcmp(cpu_f->manufacturer, "ALi");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (biosmask > 0x1ffff) {
|
if (biosmask > 0x1ffff) {
|
||||||
@@ -478,7 +479,15 @@ bios_add(void)
|
|||||||
MEM_READ_ROMCS | MEM_WRITE_ROMCS);
|
MEM_READ_ROMCS | MEM_WRITE_ROMCS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (temp_is286) {
|
if (temp_is6117) {
|
||||||
|
mem_mapping_add(&bios_high_mapping, biosaddr | 0x03f00000, biosmask + 1,
|
||||||
|
bios_read,bios_readw,bios_readl,
|
||||||
|
NULL,NULL,NULL,
|
||||||
|
rom, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, 0);
|
||||||
|
|
||||||
|
mem_set_mem_state_both(biosaddr | 0x03f00000, biosmask + 1,
|
||||||
|
MEM_READ_ROMCS | MEM_WRITE_ROMCS);
|
||||||
|
} else if (temp_is286) {
|
||||||
mem_mapping_add(&bios_high_mapping, biosaddr | (temp_cpu_16bitbus ? 0x00f00000 : 0xfff00000), biosmask + 1,
|
mem_mapping_add(&bios_high_mapping, biosaddr | (temp_cpu_16bitbus ? 0x00f00000 : 0xfff00000), biosmask + 1,
|
||||||
bios_read,bios_readw,bios_readl,
|
bios_read,bios_readw,bios_readl,
|
||||||
NULL,NULL,NULL,
|
NULL,NULL,NULL,
|
||||||
|
@@ -400,10 +400,17 @@ sst_add_mappings(sst_t *dev)
|
|||||||
sst_write, NULL, NULL,
|
sst_write, NULL, NULL,
|
||||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, (void *) dev);
|
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, (void *) dev);
|
||||||
}
|
}
|
||||||
mem_mapping_add(&(dev->mapping_h[i]), (base | (cpu_16bitbus ? 0xf00000 : 0xfff00000)), 0x10000,
|
if (is6117) {
|
||||||
sst_read, sst_readw, sst_readl,
|
mem_mapping_add(&(dev->mapping_h[i]), (base | 0x3f00000), 0x10000,
|
||||||
sst_write, NULL, NULL,
|
sst_read, sst_readw, sst_readl,
|
||||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, (void *) dev);
|
sst_write, NULL, NULL,
|
||||||
|
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, (void *) dev);
|
||||||
|
} else {
|
||||||
|
mem_mapping_add(&(dev->mapping_h[i]), (base | (cpu_16bitbus ? 0xf00000 : 0xfff00000)), 0x10000,
|
||||||
|
sst_read, sst_readw, sst_readl,
|
||||||
|
sst_write, NULL, NULL,
|
||||||
|
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROM|MEM_MAPPING_ROMCS, (void *) dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user