32-bit Pointer in C

Closed Thread

Join Date: Jan 2008
Posts: 19
Reputation: missileh is an unknown quantity at this point 
Solved Threads: 0
missileh missileh is offline Offline
Newbie Poster

32-bit Pointer in C

 
0
  #1
Jan 25th, 2008
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.
Quick reply to this message  
Join Date: Jan 2008
Posts: 31
Reputation: Passmark is an unknown quantity at this point 
Solved Threads: 0
Passmark's Avatar
Passmark Passmark is offline Offline
Light Poster

Re: 32-bit Pointer in C

 
0
  #2
Jan 25th, 2008
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?.
Quick reply to this message  
Join Date: Jan 2008
Posts: 19
Reputation: missileh is an unknown quantity at this point 
Solved Threads: 0
missileh missileh is offline Offline
Newbie Poster

Re: 32-bit Pointer in C

 
0
  #3
Jan 25th, 2008
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....
Quick reply to this message  
Join Date: Aug 2005
Posts: 15,407
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: 32-bit Pointer in C

 
0
  #4
Jan 25th, 2008
Are you the same person as this one? Not very often we get two people working on the same problem.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Quick reply to this message  
Join Date: Jan 2008
Posts: 19
Reputation: missileh is an unknown quantity at this point 
Solved Threads: 0
missileh missileh is offline Offline
Newbie Poster

Re: 32-bit Pointer in C

 
0
  #5
Jan 25th, 2008
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.
Quick reply to this message  
Join Date: Aug 2005
Posts: 15,407
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: 32-bit Pointer in C

 
0
  #6
Jan 25th, 2008
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC