[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 1/7] lib: Add a generic implementation of current_text_addr()
>>> On 06.05.16 at 17:48, <ross.lagerwall@xxxxxxxxxx> wrote: > --- a/xen/common/lib.c > +++ b/xen/common/lib.c > @@ -499,6 +499,18 @@ void __init init_constructors(void) > } > > /* > + * The GCC docs state that the function must be marked noinline to have the > + * expected result: > + * "When inlining the expected behavior is that the function returns the > + * address of the function that is returned to. To work around this behavior > + * use the noinline function attribute." > + */ > +noinline void *current_text_addr(void) > +{ > + return __builtin_return_address(0); > +} If this is to become common code (which I'm fine with), I think you should wrap it with __builtin_extract_return_addr() as per the gcc documentation. And considering the return value points into text (i.e. generally read-only memory) please make the return type const void * unless there are strong reasons against doing so. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |