Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 2004 19:06:10 -0700 (GMT-07:00)
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Alfred Perlstein <alfred@freebsd.org>, hackers@freebsd.org
Subject:   Re: api for sharing memory from kernel to userspace?
Message-ID:  <7860222.1085191570767.JavaMail.root@wamui06.slb.atl.earthlink.net>

next in thread | raw e-mail | index | archive | help
Alfred Perlstein <alfred@freebsd.org> writes:
> I need to share about 100megs of memory between kernel and userspace.
> 
> The memory can not be paged and should appear contig in the process's
> address space.  Any suggestions?
> 
> I need a way to either:
> map user memory into the kernel's address space.
> map kernel memory into the user's address space.
> 
> I was looking at pmap_qenter() but it didn't see attractive because
> it's for "short term mappings", this mapping will exist for quite a
> while.

Given your "non-paged" requirement, the allocation needs to take place
in the kernel.

Visible in a single process, or in all of them?

If all of them, set the PG_U bit; it will have the same address in user
space as it does in the kernel, and be visible to all processes.

If only one of them, the best general solution is to use a pseudo-device,
and support mmap() on it.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7860222.1085191570767.JavaMail.root>