m68k: do not use ram_size global

Use the machine properties instead.

Cc: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-10-28 06:15:40 -04:00
parent 86378b29fa
commit 5601d24164
3 changed files with 8 additions and 4 deletions

View File

@ -10,6 +10,7 @@
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "cpu.h"
#include "hw/boards.h"
#include "hw/irq.h"
#include "hw/m68k/mcf.h"
#include "qemu/timer.h"
@ -312,8 +313,9 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s,
/* FIXME: currently hardcoded to 128Mb. */
{
uint32_t mask = ~0;
while (mask > ram_size)
while (mask > current_machine->ram_size) {
mask >>= 1;
}
return mask & 0x0ffe0000;
}
case 0x5c: return 1; /* DRAM bank 1 empty. */

View File

@ -157,8 +157,9 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
{
int n;
for (n = 0; n < 32; n++) {
if (ram_size < (2u << n))
if (current_machine->ram_size < (2u << n)) {
break;
}
}
return (n - 1) | 0x40000000;
}

View File

@ -26,6 +26,7 @@
#else
#include "exec/gdbstub.h"
#include "exec/softmmu-semi.h"
#include "hw/boards.h"
#endif
#include "qemu/log.h"
@ -455,8 +456,8 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
* FIXME: This is wrong for boards where RAM does not start at
* address zero.
*/
env->dregs[1] = ram_size;
env->aregs[7] = ram_size;
env->dregs[1] = current_machine->ram_size;
env->aregs[7] = current_machine->ram_size;
#endif
return;
default: