Subject: Re: using > 1GB kernel memory on i386
To: Paul Burton <p_burton@hotmail.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 04/29/2001 21:10:26
On Mon, Apr 30, 2001 at 02:36:26AM -0000, Paul Burton wrote:

 > 	I am writing a memory based database for a routing appliance. I hope to 
 > keep this database completely in the kernel memory space. I wanted to know 
 > if and how i can use > 1GB memory within the kernel (I have 3GB physmem). 
 > Various attempts to tweak 
 > KERNBASE/VM_MIN_KERNEL_ADDRESS/VM_MAX_KERNEL_ADDRESS resulted in hangs 
 > and/or panics.

You need to tweak several things in <machine/pte.h>, as well (to
e.g. change where the PTE recursive mapping is done).

Probably the easiest thing for you would be to have a process keep the
data -- since the kernel and userspace share the same address space in
NetBSD/i386, the kernel will be able to simply "reach inside" (this is
how copyin/copyout work on 486 and higher processors; just accesses the
user address space) to get the data...  Maybe have the process mmap an
anonymous memory area, mlock(2) the area, and preform an ioctl on some
device (or maybe the routing socket -- I presume you have some custom
routing code in the kernel) to tell it the address.

Yah, it's kinda ugly, but it's easy.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>