--- Philip S Tellis philip.tellis@iname.com wrote:
On Wed, 3 Oct 2001, Trevor Warren wrote:
i am using a i810 board with Award Bios. Part of
the
project on Linux is that i have to make direct
acess
to a memory location f000:cdcd part of the flash
bios
and grep fpr a string in the bios.
First off, that address is a real mode address (segment:offset). In protected mode, addresses are more than that, 32 or 64 bits (or 20 if you use an 8088).
You will have to convert the segment:offset address into a real linear address. Microsoft compilers used a macro called MK_FP (for Make Far Pointer), whose job is to convert 16 bit segment:offset addresses to a linear address. This would work quite well under real mode, but would fail under protected mode, for all the reasons listed below.
Incidentally, a protected mode address can also be 16 bit, (though not on Linux except if you're running legacy Win16 apps under Wine), if you're using Win16 or similar code (maybe ELKS for Linux users?). This was the way Windows 3.x worked (and ELKS too, I think). <End history>:-)
Right now, however, you will be looking at a 32 bit pointer which can address a flat linear space of 4 GB (2^32).
However, you cannot directly address physical memory under Linux, or for that matter any modern multitasking OS that supports virtual memory (such as the Unices and Win NT, etc. You *can* do it under Win9x, I believe, if you're willing to use some trickery, but that is not relevant here). Your code will be running in its own process, which has its own virtual memory space which is mapped by the memory manager to the actual physical memory. This memory is mapped using page tables. Each process thus runs in its own memory arena, which effectively precludes you from accessing actual physical addresses. In any case, do remember that protected mode does not even use segment memory addresses, but instead uses selectors, which are very different creatures.
The second thing is that you are seeking to access the system BIOS area, which is actually not part of the user memory arena at all. It is part of the system area, and as such I am not sure whether a user space process will be allowed to access it at all (it is not allowed under Windows NT).
Thus, I believe that the only way you will be able to access physical addresses at all will be through a kernel construct, in this case a device driver. You will have to write a small device driver that accesses the required area for you, and returns a string with the result. You could use printk() if you just want to print the results out to the console.
Also, I think that you have to set up a special device in your proc file system to access your flash ram. Check in make menuconfig.
Don't know about this; why don't you check it out? If you can access the flash through the BIOS, it will save a whole lot of trouble writing drivers.
BTW, Philip, the 8088 does (did?) not have protected mode.
Rgds,
Krishnan
__________________________________________________ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com