Re: [PATCH 06/13] x86/efi: Build our own EFI services pointer table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Much better indeed.

On February 28, 2014 6:12:06 AM PST, Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote:
>On Thu, 27 Feb, at 12:09:21PM, H. Peter Anvin wrote:
>> 
>> That being said, is there a reason we can't simply write this as:
>> 
>> 	efi_system_table_##bits##_t table;
>> 
>> 	/* ... */
>> 
>> 	func = (typeof(func))(unsigned long)table->con_out;
>> 	c->text_output = *func;
>
>Oh, yeah that's much better. I was being overly cautious with trying to
>not dereference the pointers in the regular efi_system_table_t, and
>what
>you've written is much more compact both in terms of C and generated
>object code. Things end up looking like this,
>
>---
>
>#define BOOT_SERVICES(bits)						\
>static void setup_boot_services##bits(struct efi_config *c)		\
>{									\
>	efi_system_table_##bits##_t *table;				\
>	efi_boot_services_##bits##_t *bt;				\
>									\
>	table = (typeof(table))sys_table;				\
>									\
>	c->text_output = table->con_out;				\
>									\
>	bt = (typeof(bt))(unsigned long)(table->boottime);		\
>									\
>	c->allocate_pool = bt->allocate_pool;				\
>	c->allocate_pages = bt->allocate_pages;				\
>	c->get_memory_map = bt->get_memory_map;				\
>	c->free_pool = bt->free_pool;					\
>	c->free_pages = bt->free_pages;					\
>	c->locate_handle = bt->locate_handle;				\
>	c->handle_protocol = bt->handle_protocol;			\
>	c->exit_boot_services = bt->exit_boot_services;			\
>}
>BOOT_SERVICES(32);
>BOOT_SERVICES(64);

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux