c++.dos.32-bits - Pointers under Linux
- Imran Haider (6/6) Mar 18 2002 HI
- Laurentiu Pancescu (25/31) Mar 20 2002 Errr... you can't do that. Period. Memory protection doesn't let you d...
HI Can any one tell me how to map 32-bit pointers under linux? I know that in DOSX, you can write *((char *) (_x386_zero_base_address + 0x000a0000)) = 3; In linux, I need to know how to map absolute memory to linear memory so I can use it in my program. I'm using a small compiler "CC" and it seems to not to have a help file.
Mar 18 2002
Errr... you can't do that. Period. Memory protection doesn't let you do that (I think you might also have some problems under NT with this scheme), unless you use low-level kernel calls to map the video memory into your address space. You can use SVGALIB for this, it's easier. The drawback is that either way, your program will have to be run suid root, which many people consider as a security risk, and don't run such programs (search for exploits in ZGV if you're curious). You could do similar stuff with X Window System, there X Shared Memory extension (used by xquake, for instance), and, even better, DGA (but this also requires suid root programs). However, DGA and SVGALIB programs *might* be a little safer, if you give up the root priviledges ASAP. Other alternative is GGI (http://www.ggi-project.org). IMHO, the best way (and portable amongst various Unices, MacOS and Win32/DirectX) is SDL (http://www.libsdl.org). In either case, it's better to use the mentioned libraries than your own low-level code: it's safer, and faster, since they support hardware acceleration. YMMV... What's CC? Is it a cross-compiler from Win to Linux, or what? What does "CC -v" say? I thought it's some gcc version, but the fact that you have no help files amazes me... Good luck! Laurentiu "Imran Haider" <absolute1008 hotmail.com> wrote in message news:B8BC0EFF.104%absolute1008 hotmail.com...HI Can any one tell me how to map 32-bit pointers under linux? I know thatinDOSX, you can write *((char *) (_x386_zero_base_address + 0x000a0000)) =3;In linux, I need to know how to map absolute memory to linear memory so I can use it in my program. I'm using a small compiler "CC" and it seems to not to have a help file.
Mar 20 2002