Re: use of FAR pointers with gcc
From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: 05/31/04
- Next message: Keith Thompson: "Re: C function overloading?"
- Previous message: E. Robert Tisdale: "Re: C function overloading?"
- In reply to: Nils O. Selåsdal: "Re: use of FAR pointers with gcc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 May 2004 13:49:52 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Nils O. Selåsdal wrote:
> On Mon, 31 May 2004 18:16:03 +0200, tanuki wrote:
>
>
>>well, i'm using gcc under windows on ia32 to point to video memory so that
>>i can write some stuff to that
>>
>>i suppose that this would work under linux too if the program was executed
>>as root
>>
>>if i just try something like long *ptr 0xb8000000
>>and write to it linux gives me a segfault and windows gives me a
>>"read/write" error
>
> Newer windows version, as well as linux uses virtual memory.
> the 0xb8000000 address your process sees, is probably not the
> physical adderess 0xb8000000 .
For that matter
a) that particular address is not guaranteed to be part of the program's memory
map, and 'direct' access to it can cause 'undefined' behaviour (SIGSEGV, memory
corruption, whatever the system deams appropriate).
b) even if the program has access to that address as part of it's memory map,
with virtual memory, that address probably doesn't belong to the same 'real
memory' location as the video memory.
> You have to use some sort of API
> these days to write to the screen, such as DirectX or OpenGL.
> Or even the win32/mfc api on windows or X/any gui toolkit on linux.
On newer versions of MSWindows (WinNT/2K/XP), application programs need special
permissions to access hardware services like video memory. In Linux,
restrictions are even more severe; you need root access /and/ a special API to
get at video memory.
- --
Lew Pitcher
IT Consultant, Enterprise Application Architecture,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFAu3A+agVFX4UWr64RApJTAJ4o0DV6AzQsnHCLO+HqDSujL3mfpwCeNxk2
sH44FBHmNDOWWx/ZmxFQcPw=
=ytug
-----END PGP SIGNATURE-----
- Next message: Keith Thompson: "Re: C function overloading?"
- Previous message: E. Robert Tisdale: "Re: C function overloading?"
- In reply to: Nils O. Selåsdal: "Re: use of FAR pointers with gcc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|