Re: x86_32 or x86_64?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 09, 2005 at 14:56:37 +0900, NAHieu wrote:
> 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?

Um, you mean "how do I find whether this i386 kernel runs on x86_32 or
x86_64" -- Have a look at how /proc/cpuinfo is generated.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux