[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does kernel know the type of processor?
On Thu, Jul 12, 2001 at 02:55:37PM -0700, ece lca wrote:
> Hi, I have a newbie question.
> My kernel is compiled for i386, but when I use
> "uname -a", it correctly tells the type of processor
> in my machine, which is an i686.
> Could someone give an idea how the kernel does this?
> Thank you.
It uses some assembly routines to roughly find what sort of processor it is, and
then there are higher-level detection routines in C. This is, of course only
x86, I don't know about the other CPU's, but I'd imagine that they had a saner
method...
See arch/i386/kernel/head.S, line 172+ 'checkCPUtype' function on linux 2.4, or
i386/kern/cpu.c, line 131+ in zealos for a sane one coded mostly in C (asm
macros in cpu.h).
--
Mark Zealey (aka JALH on irc.openprojects.net: #zealos and many more)
mark@itsolve.co.uk
UL++++>$ G!>(GCM/GCS/GS/GM) dpu? s:-@ a16! C++++>$ P++++>+++++$ L+++>+++++$
!E---? W+++>$ N- !o? !w--- O? !M? !V? !PS !PE--@ PGP+? r++ !t---?@ !X---?
!R- b+ !tv b+ DI+ D+? G+++ e>+++++ !h++* r!-- y--
(www.geekcode.com)
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/