On 6 January 2012 16:58, Mark Langsdorf <mark.langsd...@calxeda.com> wrote: > On 01/06/2012 10:29 AM, Peter Maydell wrote: >>> + /* Override default RAM size */ >>> + if (ram_size == 0x8000000) { >>> + if (sizeof(long) == 8) { >>> + ram_size = 0xff900000; >>> + } else { >>> + ram_size = 0x80000000; >>> + } >> >> Yuck. Model behaviour shouldn't depend on properties of >> the host system like sizeof(long). > > The board is populated with 4G of DRAM, which we'd like > to support if the host can. Is there a better way to do > that?
Don't mess with the default, have the user specify a RAM size that makes sense for their host machine. It's not fantastic but it's what QEMU has at the moment. I once tried to suggest a patchset which would allow boards to specify their min/max/default RAM sizes but it got shot down. >>> + sysmem = get_system_memory(); >>> + dram = g_new(MemoryRegion, 1); >>> + memory_region_init_ram(dram, "highbank.dram", ram_size); >>> + /* SDRAM at address zero. */ >>> + memory_region_add_subregion(sysmem, 0, dram); >>> + >>> + sysram = g_new(MemoryRegion, 1); >>> + memory_region_init_ram(sysram, "highbank.sysram", 0x8000); >>> + memory_region_add_subregion(sysmem, 0xfff88000, sysram); >>> + if (load_image_targphys("sysram.bin", 0xfff88000, 0x8000) < 0) { >>> + fprintf(stderr, "Unable to load sysram.bin\n"); >>> + } >> >> Is this for some sort of BIOS-image equivalent? > > Yes, uboot and the like. It isn't necessary to boot the system, > but it models the actual board a bit better. If it's not necessary, should we be failing if there isn't an image file present? -- PMM