[LinuxBIOS] initram / xip issue

Stefan Reinauer stepan at coresystems.de
Tue Oct 9 19:26:41 CEST 2007


Jordan Crouse wrote:
> On 07/10/07 07:39 -0600, Jordan Crouse wrote:
>   
>> There has got to be a way that we can turn this into a general
>> purpose macro to make it easy for developers to mark new functions
>> as shared without understanding whats happening above
>>     
>
> Like maybe this (avert your eyes, children!):
>
> #if SHARED
> #define FUNC(func, ret, args...) \
> ret stage0##func(args)
> #define EXTERN(func,ret,args...) \
> ret (*func)(args) = stage0##func
> #else
> #define FUNC(func, ret, args...) \
> ret func(args)
> #define EXTERN(func,ret,args...)
> #endif
>
> /* Syntax:
>  * func - function name
>  * ret - return value
>  * args - function arguments
>  */
>
> #define _SHARED(func,ret,args...) \
> FUNC(func,ret,##args); \
> EXTERN(func,ret,##args)
>
> /* Example */
>
> _SHARED(printk, int, char *, ...);
>
> /* Resolves to:
>    int printk(char *, ...); ; (when !SHARED)
>
>    int stage0printk(char *, ...);
>    int (*printk)(char *, ...) = stage0printk;
>    (when SHARED)
> */
>
> Jordan
>   


It roughly seems we can't easily put our printk parameter checking in
there without complexing the interface by another parameter.
I'd say that is an acceptable price.

I like it. I think we should make the flag _SHARED and the macro SHARED
though ?

Any opinions? Ron?



Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866





More information about the coreboot mailing list