Determining Processor architecture

R

reachcv

Hi,

How can the processor architecture/capabilities [like 16 bit/32 bit] be
determined using a c program? I wanted to know how an OS
installer/loader determines this while installing the OS on a fresh
system.

Thanks
cv
 
T

Thomas Matthews

Hi,

How can the processor architecture/capabilities [like 16 bit/32 bit] be
determined using a c program? I wanted to know how an OS
installer/loader determines this while installing the OS on a fresh
system.

Thanks
cv

I do believe that this information must be provided
during installation or creation of the operating system.

If processors are very friendly, you can interrogate them.
Otherwise you have to consult their data sheets.

All of which does not concern the C programming language
as there is no standard method for interrogating processors.
Try

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 
R

Richard Bos

How can the processor architecture/capabilities [like 16 bit/32 bit] be
determined using a c program?

Not. The very act of determining which kind of system you use depends on
which kind of system you use.
I wanted to know how an OS installer/loader determines this while
installing the OS on a fresh system.

Not in C, most likely.

Richard
 
O

osmium

How can the processor architecture/capabilities [like 16 bit/32 bit] be
determined using a c program? I wanted to know how an OS
installer/loader determines this while installing the OS on a fresh
system.

I think one human told another human, "Hey, write a compiler on machine X
for machine Y. He then described machine Y.
 
W

Walter Roberson

:If processors are very friendly, you can interrogate them.
:Otherwise you have to consult their data sheets.

If the processors are very friendly, invite them down to
the pub and have them buy you a round while you listen to their
life history.

It's the unfriendly processors that you have to play
"Good cop / Bad cop" with.

;-)
 
T

Tor Rustad

Thomas Matthews said:
Hi,

How can the processor architecture/capabilities [like 16 bit/32 bit]
be determined using a c program? I wanted to know how an OS
installer/loader determines this while installing the OS on a fresh
system.

ISO C uses an abstract machine, and provide no way of
telling you what the underlying HW is. Your question is
off-topic in c.l.c.


I do believe that this information must be provided
during installation or creation of the operating system.

Why answer an off-topic request, if you don't know? :)

Hosted and freestanding programs are built for different
targets.. e.g. you can't use an OS kernel built for MIPS,
on x86 architecture. Hence, unless there exists a
CPU-independent opcode format, different CPU
architectures need different images.

The abstract C machine, doesn't provide interface like the
Java VM environment do. Therefore, C programs need to
be installed by selecting the correct CPU-architecture
manually.

Of course, an OS installer can be hosted, just put it on a
bootable floppy or CD-ROM!

If processors are very friendly, you can interrogate them.
Otherwise you have to consult their data sheets.

Well, detecting the model of a modern Intel CPU, is a
one-liner from C programs (with the use of inline asm).
AMD and other x86 clones provide another CPU vendor
string than "Genuine Intel":

http://www.paradicesoftware.com/specs/cpuid/index.htm


Detecting older Intel CPU's however, is more of a
challenge:

http://www.ddj.com/documents/s=957/ddj9609o/
</OT mode= off>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top