| | |
32-bit Pointer in C
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 19
Reputation:
Solved Threads: 0
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.
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.
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?.
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?.
•
•
Join Date: Jan 2008
Posts: 19
Reputation:
Solved Threads: 0
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....
Are you the same person as this one? Not very often we get two people working on the same problem.
I told Santa what I wanted for Christmas and he washed my mouth out with soap.
![]() |
Similar Threads
- C pointer malloc question sizeof(int) vs sizeof(int *) (C)
- A multilingual coded Hello World! thread (Legacy and Other Languages)
- Why this C code is returning Null Pointer Assignment as output (C)
- Pointer to a data member (C++)
- simpe pointer arithmetic (C)
- pointer conversion issue (C++)
- Pointer logic advice (C)
- CArray of pointer question (C)
Other Threads in the C Forum
Views: 1400 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C
#include .net ansi array arrays asterisks binarysearch calculate centimeter changingto char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework functions getlasterror givemetehcodez grade graphics hacking hardware histogram homework inches include incrementoperators input iso kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard mysql number opendocumentformat opensource owf pattern pdf performance pointer pointers posix problem probleminc process program programming radix recursion recv research reversing scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding standard string strings structures student systemcall testing threads turboc unix user variable voidmain() wab windowsapi





