PERFORCE change 100724 for review

John Baldwin jhb at freebsd.org
Thu Jul 6 11:47:41 UTC 2006


On Thursday 06 July 2006 07:28, Wojciech A. Koszek wrote:
> http://perforce.freebsd.org/chv.cgi?CH=100724
> 
> Change 100724 by wkoszek at wkoszek_laptop on 2006/07/06 11:28:17
> 
> 	Use more ARM-like style of sf_buf.h.

But mips has a direct-map (either k0seg or k1seg).  We should be using that
for sfbuf's which is much more like the alpha or amd64 style.

> Affected files ...
> 
> .. //depot/projects/mips2/src/sys/mips/include/sf_buf.h#2 edit
> 
> Differences ...
> 
> ==== //depot/projects/mips2/src/sys/mips/include/sf_buf.h#2 (text+ko) ====
> 
> @@ -1,5 +1,5 @@
>  /*-
> - * Copyright (c) 2003, 2005 Alan L. Cox <alc at cs.rice.edu>
> + * Copyright (c) [year] [your name]
>   * All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -23,36 +23,35 @@
>   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>   * SUCH DAMAGE.
>   *
> - * $FreeBSD: src/sys/amd64/include/sf_buf.h,v 1.3 2005/02/28 23:38:15 peter Exp $
> + * $Id$
>   */
> -
>  #ifndef _MACHINE_SF_BUF_H_
>  #define _MACHINE_SF_BUF_H_
>  
> -#include <vm/vm.h>
> -#include <vm/vm_param.h>
> -#include <vm/vm_page.h>
> +#include <sys/queue.h>
> +
> +struct vm_page;
>  
> -/*
> - * On this machine, the only purpose for which sf_buf is used is to implement
> - * an opaque pointer required by the machine-independent parts of the kernel.
> - * That pointer references the vm_page that is "mapped" by the sf_buf.  The
> - * actual mapping is provided by the direct virtual-to-physical mapping.  
> - */
> -struct sf_buf;
> +struct sf_buf {
> +	LIST_ENTRY(sf_buf) list_entry;	/* list of buffers */
> +	TAILQ_ENTRY(sf_buf) free_entry;	/* list of buffers */
> +	struct		vm_page *m;	/* currently mapped page */
> +	vm_offset_t	kva;		/* va of mapping */
> +	int		ref_count;	/* usage of this mapping */
> +};
>  
>  static __inline vm_offset_t
>  sf_buf_kva(struct sf_buf *sf)
>  {
>  
> -	return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
> +	return (sf->kva);
>  }
>  
> -static __inline vm_page_t
> +static __inline struct vm_page *
>  sf_buf_page(struct sf_buf *sf)
>  {
>  
> -	return ((vm_page_t)sf);
> +	return (sf->m);
>  }
>  
>  #endif /* !_MACHINE_SF_BUF_H_ */
> 

-- 
John Baldwin


More information about the p4-projects mailing list