943,910 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2164
  • C RSS
Jan 25th, 2008
0

32-bit Pointer in C

Expand Post »
If i have 4 contiguos bytes (Example: 78h, F2h, 43h, A0h) in memory that refer to a 32-bit physical address. Then how can i form a 32-bit physical address out of these?

After forming the physical address how can i read contiguous data (1byte at a time) from that address and display each byte on screen?

If anyone knows about this then please reply. I am stuck in an application due to this.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
missileh is offline Offline
19 posts
since Jan 2008
Jan 25th, 2008
0

Re: 32-bit Pointer in C

You need to supply more information. What O/S and what CPU?

If you are writing a DOS application (with an x86 CPU running in real mode), then pointer values in RAM will be a physical addresses.

But if you are working in Linux or Windows with a x86 CPU then your CPU will be in Protected Mode. And addresses will not be physical addresses, but virtual addresses.

To translate from virtual addresses to physical addresses I think you need to write a device driver.

Then you need to worry about endianness, which can vary between CPU types and effect the byte ordering in pointers.

But I am guessing you might not really know what you are asking for when you refer to physical addresses and in fact just be refering to pointers in general, which are really virtual address pointers, for most O/S and most CPU types?.
Reputation Points: 36
Solved Threads: 0
Light Poster
Passmark is offline Offline
32 posts
since Jan 2008
Jan 25th, 2008
0

Re: 32-bit Pointer in C

Well, actually, i m trying to read SMBIOS information. SMBIOS is a region in BIOS that holds infomation about the Hardware of a system. information is stored Type-wise with each type holding info about a particular type of device. All these types are organized in blocks of memory known as Structure. Collection of all these structures is called SMBIOS Structure Table. Now the physical address of this table is read as f0h c2h 0fh 00h (a DWORD, describing 32-bit physical address where Structure table begins: as per SMBIOS specifications). So if These four bytes represent physical address, i guess i need to convert this physical address into virtual address in order to access the actual information. I dont know how to do this conversion. Can you help??? Thanks for the reply....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
missileh is offline Offline
19 posts
since Jan 2008
Jan 25th, 2008
0

Re: 32-bit Pointer in C

Are you the same person as this one? Not very often we get two people working on the same problem.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Jan 25th, 2008
0

Re: 32-bit Pointer in C

Oh! That's my Project partner. We both are working on this project. He has written a very long post. I have written it in short so that the reader hasnt got to spend much time reading that loooong post.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
missileh is offline Offline
19 posts
since Jan 2008
Jan 25th, 2008
0

Re: 32-bit Pointer in C

One of the two of you need to stop posting and have only one thread to discuss the issue. You can both post in the same thread, so I'm going to close this one.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in C Forum Timeline: tree 2
Next Thread in C Forum Timeline: tree 3





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC