Adding members to struct cpu_functions

Mark Tinguely tinguely at casselton.net
Mon Oct 12 21:29:25 UTC 2009


>  As a result, extending the struct cpu_functions is not a good thing
>  either, for the same reason. The compiler can not inline a call
>  through a function pointer.
>
>  In which case, why not create a bunch of headers files with the
>  pattern cpufunc_myarch.h, in which all functions would be declared
>  inline? Something like:
>
>  static inline l2_l_entry(vm_addr_t pa, int prot, int cache);
>  static inline l2_s_entry(vm_addr_t pa, int prot, int cache);
>  ...
>  which would then be included by pmap.c and friends.

I think they need to be regular function calls because assembly routines
call the per-cpu functions. A few simple macros would save the branch to NOP
functions.

>  One problem is that such a change affects all platforms at the same
>  time, and therefore requires all portmeisters to implement the
>  functions that are needed. That should not be too difficult, though,
>  because so far it was the same macros that were used by all platforms.
>  Another problem is that it requires some build script magic to make
>  sure the correct header is included depending on the arch. I wonder if
>  this is easy?


--Mark Tinguely


More information about the freebsd-arm mailing list