/*
 * $Header: /smsa/bsd:include/sys/newvm.h:bsd  1.3  $
 * $Source: /smsa/bsd:include/sys/newvm.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 * $Desc$
 * $Log:	newvm.h,v $
 * Revision 1.3  88/06/17  20:20:06  beta
 * Acorn Unix initial beta version
 * 
 */
/* terminal types */

typedef	char	*va_t;



/* page table and entries therein */

#define	FSBLKSIZE	8192
#define	DBLKC		(NBPG/FSBLKSIZE)

/* page states */

#define	PS_INVALID	0	/* page is not defined (default state after allocation		*/
#define	PS_FROMPROTO	1	/* should be paged-in from ptototype inode copy			*/
#define	PS_FROMPAGE	2	/* should be paged-in from paging inode copy			*/
#define	PS_VALID	3	/* page is paged-in						*/

/* pages */

typedef struct page
{
	char	last;		/* last entry in table flag					*/
	char	valid;		/* page validity flag						*/
	char	ppn;		/* physical page number when valid				*/
	char	state;		/* page state							*/
	int	pdblks[DBLKC];	/* disk block numbers of prototype inode copy			*/
	int	sdblks[DBLKC];	/* disk block numbers of paging inode copy			*/
} pg, *pg_ref;



/* segment descriptors and their states */

/* segment states */

#define	SS_PRIVATE	0	/* segment is private to this process				*/
#define	SS_SHARED	1	/* segment is shared with other processes			*/
#define	SS_COW		2	/* segment is copy on write					*/

/* segments */

typedef struct segd
{
	va_t	base;		/* base virtual address of segment				*/
	int	size;		/* size of segment (in pages)					*/
	int	prot;		/* protextion of segment					*/
	int	usec;		/* usage count							*/
	int	state;		/* state of segment						*/
	pg_ref	pages;		/* page table for segment					*/
} segd, *segd_ref;



/* 'proc' structure extensions */

typedef struct proc_ext
{
	struct inode
		*proto_ip,	/* prototyping inode						*/
		*page_ip;	/* paging inode							*/
	segd_ref
		text_seg,	/* read-only code segment reference				*/
		data_seg,	/* read-write initialised data segment				*/
		bss_seg,	/* read-write uninitialised data segment			*/
		stack_seg,	/* read-write control/data stack segment			*/
		uarea_seg,	/* read-only (user) / read-write (kernel) u-area segment	*/
		lib_segs,	/* read-only library code segments				*/
		region_segs;	/* read-write SVID region segments				*/
} proc_ext, *proc_ext_ref;



/*** EOF ***/

