hi Jan, On 8/6/05, Jan Hudec <bulb@xxxxxx> wrote: > 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. > No, my question is a little different: I want to know how to determine the hardware architecture of the machine (x86_32 or x86_64?) from kernel code. Is this possible to do that? Thank you a lot, Jan NAH -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/