From owner-freebsd-questions Tue Jul 30 17:18:36 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A4F6437B400 for ; Tue, 30 Jul 2002 17:18:31 -0700 (PDT) Received: from mail.liwing.de (mail.liwing.de [213.70.188.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 89B5E43E42 for ; Tue, 30 Jul 2002 17:18:30 -0700 (PDT) (envelope-from rehsack@liwing.de) Received: (qmail 20942 invoked from network); 31 Jul 2002 00:29:53 -0000 Received: from stingray.liwing.de (HELO liwing.de) ([213.70.188.164]) (envelope-sender ) by mail.liwing.de (qmail-ldap-1.03) with SMTP for ; 31 Jul 2002 00:29:53 -0000 Message-ID: <3D472D13.BE63F5D9@liwing.de> Date: Wed, 31 Jul 2002 02:19:31 +0200 From: Jens Rehsack Organization: LiWing IT-Services X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: hal@telefonica.net Cc: questions@freebsd.org Subject: Re: Accessing memory below 1 MB References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 > 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: 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