From: Alexander Graf Date: Mon, 18 Jun 2018 17:00:25 +0200 Subject: [U-Boot] [PATCH v8 22/30] efi: sandbox: Tidy up copy_fdt() to work with sandbox In-Reply-To: <20180618140835.195901-23-sjg@chromium.org> References: <20180618140835.195901-1-sjg@chromium.org> <20180618140835.195901-23-sjg@chromium.org> Message-ID: <6c051da7-bd3e-3c27-c6c3-e490a1b21546@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de On 06/18/2018 04:08 PM, Simon Glass wrote: > At present this function takes a pointer as its argument, then passes this > to efi_allocate_pages(), which actually takes an address. It uses casts, > which are not supported on sandbox. I think this is the big API misunderstanding that caused our=20 disagreements: efi_allocate_pages(uint64_t *memory) gets a uint64_t=20 *address as input parameter, but uses the same field to actually return=20 a void * pointer. This is the function that really converts between=20 virtual and physical address space. This is the explicit wording of the spec[1] page 168: =C2=A0 The AllocatePages() function allocates the requested number of page= s=20 and returns a pointer to the base address of the page range in the=20 location referenced by Memory. So yes, we have to cast. There is no other way around it without=20 completely creating a trainwreck of the API. Alex [1]=20 http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sep= t%206.pdf