Why not use a CMOV in a i686-specific crt0.c?
Then programs compiled for i686 but run on i586 will SIGILL
deterministically at program start-up. It seems to me that
the major problem with SIGILL is that it occurs depending
upon the program execution flow, and thus appears indeterministic
to the user.
This doesn't solve the problem of a i386 executable calling
a i686 library, but solving that problem deterministically
requires a lot of baggage:
- compiler to produce an object file header stating CPU
features used.
- run time linker to take union of all CPU features in
object file headers and check against CPU features
returned by CPUID.
Even this isn't perfect, consider multi-processor machines
with differing CPU feature sets or applications which attempt
to implement their own run-time checking:
get_cpu_features(&feature);
if (feature.cmov && feature.somethingelse && ...)
mytask_i686();
else
mytask_i386();
This leads inevitably more flags in the object file header
to instruct the run-time linker to skip particular CPU feature
checks
gcc -c -mdisable_cpu_feature_check=cmov -o mytask.o mytask.c
SIGILL starts to look lightweight :-)
-- Glen Turner (08) 8303 3936 or +61 8 8303 3936 Australian Academic and Research Network www.aarnet.edu.au- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/