svn commit: r215135 - head/sys/compat/ndis

Alan Cox alc at rice.edu
Fri Nov 12 06:58:05 UTC 2010


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
>
>   



More information about the svn-src-head mailing list