Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Nov 2010 00:58:03 -0600
From:      Alan Cox <alc@rice.edu>
To:        Bernhard Schmidt <bschmidt@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r215135 - head/sys/compat/ndis
Message-ID:  <4CDCE57B.3000602@rice.edu>
In-Reply-To: <201011111843.oABIhV9d080688@svn.freebsd.org>
References:  <201011111843.oABIhV9d080688@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Bernhard Schmidt wrote:
> Author: bschmidt
> Date: Thu Nov 11 18:43:31 2010
> New Revision: 215135
> URL: http://svn.freebsd.org/changeset/base/215135
>
> Log:
>   According to specs for MmAllocateContiguousMemorySpecifyCache() physically
>   contiguous memory with requested restrictions must be allocated.
>   
>   

It appears to me that these functions should be using 
kmem_alloc_contig() and kmem_free() instead of contigmalloc() and 
contigfree(). Then, the "cachetype" parameter could be correctly 
implemented rather than ignored.  It just requires mapping the cachetype 
values to their corresponding vm_memattr_t values.

Regards,
Alan

>   Submitted by:	Paul B Mahol <onemda at gmail.com>
>
> Modified:
>   head/sys/compat/ndis/subr_ntoskrnl.c
>
> Modified: head/sys/compat/ndis/subr_ntoskrnl.c
> ==============================================================================
> --- head/sys/compat/ndis/subr_ntoskrnl.c	Thu Nov 11 18:41:03 2010	(r215134)
> +++ head/sys/compat/ndis/subr_ntoskrnl.c	Thu Nov 11 18:43:31 2010	(r215135)
> @@ -2426,12 +2426,9 @@ MmAllocateContiguousMemorySpecifyCache(s
>  	uint64_t		boundary;
>  	uint32_t		cachetype;
>  {
> -	void *addr;
> -	size_t pagelength = roundup(size, PAGE_SIZE);
>  
> -	addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
> -
> -	return (addr);
> +	return (contigmalloc(size, M_DEVBUF, M_ZERO|M_NOWAIT, lowest,
> +	    highest, PAGE_SIZE, boundary));
>  }
>  
>  static void
> @@ -2447,7 +2444,7 @@ MmFreeContiguousMemorySpecifyCache(base,
>  	uint32_t		size;
>  	uint32_t		cachetype;
>  {
> -	ExFreePool(base);
> +	contigfree(base, size, M_DEVBUF);
>  }
>  
>  static uint32_t
>
>   




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CDCE57B.3000602>