bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: providing memory objects to users


From: Marcus Brinkmann
Subject: Re: providing memory objects to users
Date: Fri, 14 Jun 2002 01:21:44 +0200
User-agent: Mutt/1.3.28i

On Wed, Jun 12, 2002 at 04:47:08PM +0200, Neal H. Walfield wrote:
> You can use the default pager as your backing store.

Ah, that's cool, thanks for the tip how to do it.  I don't mind the delay in
page out performance right now.

I can try the default pager approach again later, but it's only a couple of
lines of code either way, and I have more pressing issues to solve.

Can you please verify with me that the following code matches what you
described here:

> You do not even have to do this.  Just hold a reference to the regions
> returned by pager_write_page; it is up to you to vm_deallocate them.

error_t
pager_write_page (struct user_pager_info *upi, vm_offset_t page,
                  vm_address_t buf)
{
  assert (upi->memobj_pages[page / vm_page_size] == (vm_address_t) NULL);
  upi->memobj_pages[page / vm_page_size] = buf;
  return 0;
}

/* Implement the pager_clear_user_data callback from the pager library. */
void
pager_clear_user_data (struct user_pager_info *upi)
{
  int idx;

  for (idx = 0; idx < upi->memobj_npages; idx++)
    if (upi->memobj_pages[idx])
      vm_deallocate (mach_task_self (), upi->memobj_pages[idx], vm_page_size);
  free (upi);
}

Thanks,
Marcus
 

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]