On Sat, Aug 06, 2005 at 04:57:46 -0500, NAHieu wrote: > Hello, > > I am writing a kernel module, and want to find if the cpu is x86_32 or > x86_64. I looked for everywhere, but still cannot figure out how to > determine that information. Anybody could please help me? Code in kernel is split into generic and architecture specific parts. The generic part is supposed to be generic and therefore must not want to know. The architecture specific parts are in arch/<platform> and include/asm-<platform> (which is then linked to include/asm for current platform). So place the code that needs to be used on x86_32 in arch/i386 and include/asm-i386 and place the code that needs to be used on x86_64 in arch/x86_64 and include/asm-x86_64. Than call it from the generic code elsewhere in the tree as appropriate. If you are building outside the tree, you should probably copy how ARCH is detected in kernel Makefile -- using uname -m for the default and letting user override when cross-compiling. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature