[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Added on-chip ram, but can't load program there..
From: |
ckim |
Subject: |
RE: Added on-chip ram, but can't load program there.. |
Date: |
Fri, 26 Mar 2021 11:29:01 +0900 |
Hi, Peter Meydell,
Thank you so much as always.
As you said, I moved the iram from secure-sysmem to sysmem.
This is for others' reference.. I added this to machab21q_init function.(ab21q
is the machine name used in hw/arm/ab21q.c)
Allocate a new memory region.
MemoryRegion *tram = g_new(MemoryRegion, 1);
After the
memory_region_add_subregion(sysmem, vms->memmap[AB21Q_MEM].base,
machine->ram);
added these two lines.
memory_region_init_ram(tram, NULL, "ab21q.tram",
vms->memmap[AB21Q_TMEM].size, &error_fatal);
memory_region_add_subregion(sysmem, vms->memmap[AB21Q_TMEM].base, tram);
now the program #1 image is in the iram and compare-sections shows all matches.
Thanks a lot!
Chan Kim
> -----Original Message-----
> From: Peter Maydell <peter.maydell@linaro.org>
> Sent: Thursday, March 25, 2021 8:01 PM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: qemu-discuss <qemu-discuss@nongnu.org>
> Subject: Re: Added on-chip ram, but can't load program there..
>
> On Thu, 25 Mar 2021 at 10:19, <ckim@etri.re.kr> wrote:
> > I have added iram (on-chip ram) to our machine (copy of ‘virt’) and
> intended the program #1 (containing .data, .bss and other read-write data
> sections) to be loaded on that memory.
> >
> > The iram range is from 0x04000000 with size 0x80000 (it’s big enough).
> >
> > But the program #1 is not loaded on iram. Using the gdb, when I examine
> the memory, (using compare-sections, and ‘x’ command) I can see that range
> (0x04000000 - ) has mismatch from the program start..
>
> You've made the memory visible only to the Secure world. The usual ELF
> loader (-kernel, etc) loads the guest image as if it were being written by
> the CPU in NonSecure (roughly speaking).
> So the ELF loader doesn't see Secure-only RAM.
>
> I don't think there's a way to load a file to secure-only memory, unless
> the board code has provided a mechanism for eg putting the -bios image
> there, as the virt board does with the first flash device.
>
> (If you didn't mean this memory to be Secure only, put it in the sysmem
> MemoryRegion rather than the secure_sysmem MR.)
>
> thanks
> -- PMM