From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH for-xen-4.5 v3 05/16] x86/efi: Add place_string_u32() function Date: Thu, 9 Oct 2014 11:30:57 +0100 Message-ID: <543663E1.4040304@citrix.com> References: <1412790736-28915-1-git-send-email-daniel.kiper@oracle.com> <1412790736-28915-6-git-send-email-daniel.kiper@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XcAzx-0000hf-9j for xen-devel@lists.xenproject.org; Thu, 09 Oct 2014 10:31:05 +0000 In-Reply-To: <1412790736-28915-6-git-send-email-daniel.kiper@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Daniel Kiper , xen-devel@lists.xenproject.org Cc: jgross@suse.com, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, roy.franz@linaro.org, ning.sun@intel.com, jbeulich@suse.com, ross.philipson@citrix.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org List-Id: xen-devel@lists.xenproject.org On 08/10/14 18:52, Daniel Kiper wrote: > Add place_string_u32() function and rename place_string() > to place_string_char(). Why? You need some description of their intended purpose. ~Andrew > > Signed-off-by: Daniel Kiper > --- > xen/arch/x86/efi/efi-boot.h | 29 +++++++++++++++++++---------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h > index 4348cfe..71030b0 100644 > --- a/xen/arch/x86/efi/efi-boot.h > +++ b/xen/arch/x86/efi/efi-boot.h > @@ -103,14 +103,14 @@ static void __init relocate_trampoline(unsigned long phys) > *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4; > } > > -static void __init place_string(u32 *addr, const char *s) > +static void __init place_string_char(char **addr, const char *s) > { > static char *__initdata alloc = start; > > if ( s && *s ) > { > size_t len1 = strlen(s) + 1; > - const char *old = (char *)(long)*addr; > + const char *old = *addr; > size_t len2 = *addr ? strlen(old) + 1 : 0; > > alloc -= len1 + len2; > @@ -126,7 +126,16 @@ static void __init place_string(u32 *addr, const char *s) > memcpy(alloc + len1, old, len2); > } > } > - *addr = (long)alloc; > + *addr = alloc; > +} > + > +static void __init place_string_u32(u32 *addr, const char *s) > +{ > + char *s_new = (char *)(long)*addr; > + > + place_string_char(&s_new, s); > + > + *addr = (long)s_new; > } > > static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, > @@ -192,7 +201,7 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, > > static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size) > { > - place_string(&mbi.mem_upper, NULL); > + place_string_u32(&mbi.mem_upper, NULL); > mbi.mem_upper -= map_size; > mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR); > if ( mbi.mem_upper < xen_phys_start ) > @@ -280,10 +289,10 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, > { > name.w = cmdline_options; > w2s(&name); > - place_string(&mbi.cmdline, name.s); > + place_string_u32(&mbi.cmdline, name.s); > } > if ( cfgfile_options ) > - place_string(&mbi.cmdline, cfgfile_options); > + place_string_u32(&mbi.cmdline, cfgfile_options); > /* Insert image name last, as it gets prefixed to the other options. */ > if ( image_name ) > { > @@ -292,7 +301,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, > } > else > name.s = "xen"; > - place_string(&mbi.cmdline, name.s); > + place_string_u32(&mbi.cmdline, name.s); > > if ( mbi.cmdline ) > mbi.flags |= MBI_CMDLINE; > @@ -587,12 +596,12 @@ static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name, > /* > * If options are provided, put them in > * mb_modules[mbi.mods_count].string after the filename, with a space > - * separating them. place_string() prepends strings and adds separating > + * separating them. place_string_u32() prepends strings and adds separating > * spaces, so the call order is reversed. > */ > if ( options ) > - place_string(&mb_modules[mbi.mods_count].string, options); > - place_string(&mb_modules[mbi.mods_count].string, local_name.s); > + place_string_u32(&mb_modules[mbi.mods_count].string, options); > + place_string_u32(&mb_modules[mbi.mods_count].string, local_name.s); > mb_modules[mbi.mods_count].mod_start = file->addr >> PAGE_SHIFT; > mb_modules[mbi.mods_count].mod_end = file->size; > ++mbi.mods_count;