Mail Archives: djgpp/1994/09/29/00:30:56
Hi all,
A posting was put on the list recently regarding a problem accessing
physical memory with DJGPP. Unfortunately I deleted that message
and now I can't remember the author's name. Anyway, the problem was
that the following code generated a "segmentation violation" during
compilation:
unsigned char *mem;
mem = 0x00400000;
*(mem) = 0x4F;
I've tried it and it seems to compile fine under GCC V2.6.0.
The problem is running this code portion, which indeed generates
a segmentation violation.
You have to remember that in protected mode you cannot simply
access any memory location at random. If you require access to a
particular physical memory location, you have to create a descriptor
for a 16- or 32-bit segment containing this address. The memory addr.
is then accessed by specifying SELECTOR:OFFSET.
The selector is a 16-bit quantity that enables the 80386 to access
the descriptor for the defined memory segment.
Regards, Ron.
********************************************************************
| Author.............. Ron Grunwald |
| Internet............ rgrunwal AT bluering DOT cowan DOT edu DOT au |
| Phone............... (09)273 8027 or (09)273 8468 |
|------------------------------------------------------------------|
| Department.......... Information Technology |
| Division/Faculty.... Operations and Systems Management |
| Institute........... Edith Cowan University, Churchlands |
| Location............ Perth, Western Australia |
********************************************************************
"I don't have any solution but I certainly admire the problem!"
- Raw text -