Hi,

Le Sat, 3 Nov 2007 13:33:12 +0000,
ninjaboy <[EMAIL PROTECTED]> a écrit :

> I've seen that there are two section (.altinstructions and
> .altinstr_replacement), there are some "polimorphic" code that is
> replaced at runtime, now in arch/x86_64/lib/copy_user.S there are
> copy_user_generic_unrolled and copy_user_generic_string, that replaces
> the function that is used, my question is: where and how the decision
> on what code is used (in this case
> copy_user_generic_unrolled or copy_user_generic_string) for replace
> code?

Here:
http://lxr.free-electrons.com/source/arch/x86_64/lib/copy_user.S#046

with the following line:
ALTERNATIVE_JUMP
X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string

with the ALTERNATIVE_JUMP macro being defined at the top of the
copy_user.S file. It adds:

 * code to the normal text section to call the "default" function, the
   unrolled version ;

 * code to the altinstr_replacement section to call the
   copy_user_generic_string function ;

 * informations to the altinstructions section, which is processed at
   boot time by arch/i386/kernel/alternative.c in order to know if an
   alternative must be applied or not, depending on the presence/absence
   on some processor features (here X86_FEATURE_REP_GOOD)

Sincerly,

Thomas
-- 
Thomas Petazzoni - [EMAIL PROTECTED]
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to