| | |
32-bit Pointer in C
![]() |
•
•
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.
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.
![]() |
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
| Thread Tools | Search this Thread |
#include * ansi array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop initialization input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pdf pointer pointers posix power probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi





