Re: use of FAR pointers with gcc

From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: 05/31/04


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-----



Relevant Pages

  • Re: RH9 Poor performance, stability
    ... how much memory do most people recommend for XP? ... Minimum ram and "completely unacceptable performance" are just as nebulous ... Linux users who've experienced the same performance problems as I have ... >>or even Windows, rather than extremely bloated down like Linux. ...
    (comp.os.linux.setup)
  • Re: RH9 Poor performance, stability
    ... how much memory do most people recommend for XP? ... Minimum ram and "completely unacceptable performance" are just as nebulous ... Linux users who've experienced the same performance problems as I have ... >>or even Windows, rather than extremely bloated down like Linux. ...
    (comp.os.linux.misc)
  • Re: RH9 Poor performance, stability
    ... how much memory do most people recommend for XP? ... they are exactly the same "less round". ... >some other Linux users in this thread. ... >or even Windows, rather than extremely bloated down like Linux. ...
    (comp.os.linux.setup)
  • Re: RH9 Poor performance, stability
    ... how much memory do most people recommend for XP? ... they are exactly the same "less round". ... >some other Linux users in this thread. ... >or even Windows, rather than extremely bloated down like Linux. ...
    (comp.os.linux.misc)
  • Naive Windows VM paging algorithm - is Linux better?
    ... I am becoming increasingly frustrated with the somewhat naive paging ... dedicated application whose memory footprint is quite large - around ... of physical memory - say 512M, Windows has no mechanism for allowing ... can I be smarter in Linux?. ...
    (comp.os.linux.misc)