Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2002 02:19:31 +0200
From:      Jens Rehsack <rehsack@liwing.de>
To:        hal@telefonica.net
Cc:        questions@freebsd.org
Subject:   Re: Accessing memory below 1 MB
Message-ID:  <3D472D13.BE63F5D9@liwing.de>
References:  <E17ZUer-0000LF-00@ash.drims.net>

next in thread | previous in thread | raw e-mail | index | archive | help


hal@telefonica.net wrote:
> 
> Hello,
> 
> I'm writing some graphics code (just for fun) and I need "legal" access to
> the memory addresses below 1 mb.
> 
> The thing is, I know how to access those addresses (open /dev/mem, mmap, and
> that's it), but I'd like to be able to alloc some pages so that my accesses
> are correct and don't make the kernel panic...
> 
> Does anyone know how I could do that?

Puh - I do not know if it's really make sense, because I think there should be
another way, f.e. framebuffer, ...
You may take a look into ghostscript, it's able to use X and a standard VGA card.

The way I know is writing a kernel module which gives you direct access to the
video memory (I assume you mean this by accessing memory below 1MB).

In any other case I strongly recommend find another way.

Matt Dillon writes in a mail before:
0xFFFFFFFF      +-----------------------+-----
                |                       |
                |       KERNEL          | (1G)
                |                       |
0xC0000000      +-----------------------+-----
                |                       |
                |       USER STACK      |
                |           |           |
                |           V           |
                |                       |
                +-----------------------+
                |                       |
                |                       |
                |  AVAILABLE FOR MMAP   |
                |                       |  (stack, mmap, user data, program) = 3G
MAXDSIZ         +-----------------------+
                |                       |
                |   USER DATA (NON-MMAP)|
                |                       |
                +-----------------------+
                |                       |
                |     PROGRAM BINARY    |
                |                       |
0x00000000      +-----------------------+-----

    Any C program which uses shared libraries uses mmap().  Many library
    functions and libraries also use mmap(), including portions of our 
    malloc() implementation (though the main area used by mmap is the
    user data area).  If you increase MAXDSIZ to the point where there
    is not enough VM for the mmap()'s programs make then you will run
    into the problems you are having.

    I'm not sure why you are trying to have squid use all 4G of the
    machine directly in its user data area.  Squid caches a lot of
    things in memory, sure, but it also caches things in files and
    FreeBSD will use free physical memory to cache those files
    regardless of how you configure the machine.  So you should be
    getting good utilization of your 4G of memory even if Squid cannot
    use all 4G in its user data area directly.   Setting MAXDSIZ to
    2.9GB out of the 3G of user VM available puts a huge squeeze on
    how much the program can mmap() before it runs out of VM.

                                        -Matt
                                        Matthew Dillon 
                                        <dillon@backplane.com>

> Thank you in advance.
> 
> Alex
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
L     i  W     W     W  i                 Jens Rehsack
L        W     W     W
L     i   W   W W   W   i  nnn    gggg    LiWing IT-Services
L     i    W W   W W    i  n  n  g   g
LLLL  i     W     W     i  n  n  g   g    Friesenstraße 2
                                  gggg    06112 Halle
                                     g
                                 g   g
Tel.:  +49 - 3 45 - 5 17 05 91    ggg     e-Mail: <rehsack@liwing.de>
Fax:   +49 - 3 45 - 5 17 05 92            http://www.liwing.de/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D472D13.BE63F5D9>