[U-Boot] [PATCH v4 03/16] efi: sandbox: Adjust memory usage for sandbox

Simon Glass sjg at chromium.org
Fri May 25 02:42:37 UTC 2018


Hi Heinrick,

On 24 May 2018 at 13:16, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> On 05/16/2018 07:15 PM, Heinrich Schuchardt wrote:
>> On 05/16/2018 05:42 PM, Simon Glass wrote:
>>> With sandbox the U-Boot code is not mapped into the sandbox memory range
>>> so does not need to be excluded when allocating EFI memory. Update the EFI
>>> memory init code to take account of that.
>>>
>>> Also use mapmem instead of a cast to convert a memory address to a
>>> pointer.
>>>
>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>
>> running ./u-boot
>>
>> bootefi selftest
>> Found 0 disks
>> WARNING: booting without device tree
>>
>> Testing EFI API implementation
>>
>> Number of tests to execute: 17
>>
>> Setting up 'block device'
>> Setting up 'block device' succeeded
>>
>> Executing 'block device'
>> lib/efi_selftest/efi_selftest_block_device.c(378):
>> TODO: Wrong volume label 'xxa1', expected 'U-BOOT TEST'
>> FAT: Misaligned buffer address (00007ff70aafe658)
>> Segmentation fault
>>
>> Please, fix the alignment fault. You have to ensure that the memory that
>> Sandbox has retrieved via malloc is reduced to 4k aligned pages before
>> being published to the EFI implementation in lib/efi_loader/efi_memory.c
>
> Hello Simon,
>
> couldn't we use mmap() instead of malloc() to allocate the memory used
> by the Sandbox? This would guarantee page aligned memory. mmap() with
> MAP_ANON is available both on POSIX and BSD systems.

We do use mmap() to allocate U-Boot's memory. I wonder why it is not
page-aligned?

See os_malloc() for the implementation. Perhaps it needs another arg added?

Regards,
Simon


More information about the U-Boot mailing list