From owner-freebsd-hackers Thu Dec 26 6:55:35 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 21DEB37B401 for ; Thu, 26 Dec 2002 06:55:34 -0800 (PST) Received: from antonz-hpvl400.mcd.ru (antonz-hpvl400.mcd.ru [195.151.199.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id DCA7443EA9 for ; Thu, 26 Dec 2002 06:55:32 -0800 (PST) (envelope-from fbsd@antonz-hpvl400.mcd.ru) Received: from 195.168.0.1 ([195.168.0.1]) by antonz-hpvl400.mcd.ru ([195.151.199.95]) with SMTP (MDaemon.PRO.v6.0.7.R) for ; Thu, 26 Dec 2002 17:54:20 +0300 Date: Thu, 26 Dec 2002 17:54:20 +0300 From: Tony Zelenoff X-Mailer: The Bat! (v1.60m) Personal Reply-To: Tony Zelenoff X-Priority: 3 (Normal) Message-ID: <47163800993.20021226175420@antonz-hpvl400.mcd.ru> To: freebsd-hackers@freebsd.org Subject: How to lock kernel malloc'ed memory ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-MDRemoteIP: 195.168.0.1 X-Return-Path: fbsd@antonz-hpvl400.mcd.ru X-MDaemon-Deliver-To: freebsd-hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello freebsd-hackers, So, I have FreeBSD 4.5 and write a driver for special software, that needs a lot of kernel memory. First of all i set VM_KMEM_SIZE (i386/include/vmparam.h) to a biggest value (~200 Mb) and recompile the kernel ( also i disabled PSE ). Then in driver i malloc memory ( lot of memory.. ~50-60 Mb ), but not in one piece. Mmap some of malloc'ed memory to user space (mmap works successfully ) and get pages indexes to the pages arrays. I do it like this - page_arr[i] = kvtop(vaddr+i*PAGE_SIZE)>>12. After it i create my own address space (without kernel help) with my own GDT, IDT, LDT, TSS, PDE, PTE and so on ( i need phys pages addresses from filled page arrays for this ). After i try to enter into my own address space i have an interesting thing - some of the pages is not present (i think). When i try to read smth from them in kernel space with disabled ints i have "kernel trap 9 with disabled ints". And in my address space when i try to read smth i have a double fault. (PageFault and second PageFault, because IDT page not present too). I try to print addresses of physical pages and see, that kernel allocates already allocate phys pages (i.e. this pages swapped out from physical address space), but i read that kernel malloc return non pageable and not swappable memory. So, question is how to lock physical pages in memory or how to allocate non-swappable memory ? -- Best regards, Tony mailto:fbsd@antonz-hpvl400.mcd.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message