473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Determining Processor architecture

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

Nov 14 '05 #1
5 2971
re*****@yahoo.com wrote:
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 news:comp.arch.embedded
--
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

Nov 14 '05 #2
re*****@yahoo.com wrote:
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
Nov 14 '05 #3
<re*****@yahoo.com> wrote:
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.
Nov 14 '05 #4
In article <42**************@sbcglobal.net>,
Thomas Matthews <Th*************************@sbcglobal.net> wrote:
: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.

;-)
--
'ignorandus (Latin): "deserving not to be known"'
-- Journal of Self-Referentialism
Nov 14 '05 #5
"Thomas Matthews" <Th*************************@sbcglobal.net>
re*****@yahoo.com wrote:
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.
<OT mode = on>
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>

--
Tor <torust AT online DOT no>
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hugh Cowan | last post by:
Hello, I am currently running PHP 4.3.2 on Windows NT 4.0. Is there anyway (I am sure there is but I just can't find it) that you can determine the path of the current script that is running?...
3
by: Guhanath | last post by:
hai everybody, I have planned to buy 64 bit processor for my own use.I would like to confirm that the processor doesnt have any pb regarding any software i installs(ie oracle,VS 2005 beta,java...
12
by: johny smith | last post by:
I am trying to figure out a way to print the address of what called a certain function once inside the function. I am assuming that this information is on the stack somewhere. But can someone...
6
by: James | last post by:
Hi Folks, I plan to implement some report generation using Formatting objects on the ..NET platform. Does Microsoft have a built in version? .Or What are my options? are there any free ones which...
5
by: Subrahmanyam Arya | last post by:
Hi Folks , I am trying to solve the problem of reading the numbers correctly from a serial line into an intel pentium processor machine . I am reading 1 byte and 2byte data both positive...
24
by: junky_fellow | last post by:
Hi, I am using a gcc compiler for a 32 bit powerpc processor. When I look at the size of unsigned long long, it displays 8 bytes. I was wondering, how we can have a data type of 64 bits on a 32...
168
by: broeisi | last post by:
Hello, Is there a way in C to get information at runtime if a processor is 32 or 64 bit? Cheers, Broeisi
5
by: Paul Brauner | last post by:
Hi, I'm working on a project that outputs several languages including (hopefully) python. My problem is that the generic backend architecture has not been designed to output correctly indented...
3
by: aha | last post by:
Dose anyone know of a cross-platform method for determining the vendor of a processor? Under linux I can check /proc/cpuinfo. What I'd like to be able to do is determine if a processor is AMD or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.