[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] target/arm: Allow loading elf from aliased ROM regions
From: |
Richard Henderson |
Subject: |
Re: [PATCH] target/arm: Allow loading elf from aliased ROM regions |
Date: |
Sun, 1 Dec 2019 12:13:05 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 11/25/19 12:41 PM, Jean-Hugues DeschĂȘnes wrote:
> initial_msp = ldl_p(rom);
> initial_pc = ldl_p(rom + 4);
> } else {
> - /* Address zero not covered by a ROM blob, or the ROM blob
> - * is in non-modifiable memory and this is a second reset after
> - * it got copied into memory. In the latter case, rom_ptr
> - * will return a NULL pointer and we should use ldl_phys instead.
> - */
> - initial_msp = ldl_phys(s->as, vecbase);
> - initial_pc = ldl_phys(s->as, vecbase + 4);
> + /* See if the ROM blob is aliased somewhere */
> + hwaddr len = 0, xlat = 0;
> + MemoryRegion *mr = address_space_translate(s->as, vecbase, &xlat,
> + &len, false, MEMTXATTRS_UNSPECIFIED);
> +
> + if (mr) {
> + rom = rom_ptr(mr->addr + xlat, 8);
> + } else {
> + rom = NULL;
> + }
> +
> + if (rom) {
> + initial_msp = ldl_p(rom);
> + initial_pc = ldl_p(rom + 4);
> + } else {
> +
> + /*
> + * Address zero not covered by a ROM blob, or the ROM blob
> + * is in non-modifiable memory and this is a second reset
> after
> + * it got copied into memory. In the latter case, rom_ptr
> + * will return a NULL pointer and we should use ldl_phys
> + * instead.
> + */
> + initial_msp = ldl_phys(s->as, vecbase);
> + initial_pc = ldl_phys(s->as, vecbase + 4);
> + }
> }
Can this entire section, including the rom_ptr thing just above, be replaced
with two address_space_read()?
r~
- Re: [PATCH] target/arm: Allow loading elf from aliased ROM regions,
Richard Henderson <=