/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

#ident	"$Header: systm.h 1.14 89/08/24 $"

#ifndef	_SYS_SYSTM_H_

/*
 * systm.h
 *	Random set of variables used by more than one routine.
 */

/* $Log:	systm.h,v $
 */

extern	char version[];		/* system version */

/*
 * bdevcnt is the number of entries
 * (rows) in the block switch. It is
 * set in conf.c by sizing the switch.
 * Used in bounds checking on major
 * device numbers.
 */
extern	int	bdevcnt;

/*
 * Number of character switch entries.
 * Set in conf.c by sizing the switch.
 */
extern	int	nswdev;		/* number of swap devices */
extern	int	mpid;		/* generic for unique process id's */

extern	sema_t	runout;		/* swap scheduling synchronization */

extern	int	maxmem;		/* actual max memory per process */

extern	int	nswap;		/* size of swap space */
extern	dev_t	rootdev;	/* device of the root */
extern	dev_t	swapdev;	/* swapping device */
extern	struct	vnode	*swapdev_vp;	/* vnode equivalent of swapdev */

extern	char	icode[];	/* user init code */
extern	int	szicode;	/* its size */

daddr_t	bmap();
caddr_t	calloc();
unsigned max();
unsigned min();
int	memall();
int	vmemall();
caddr_t	wmemall();
caddr_t	kmem_alloc();

/*
 * Structure of the system-entry table
 */
struct sysent {
	int	sy_narg;	/* total number of arguments */
	int	(*sy_call)();	/* handler */
};
extern struct sysent sysent1[];
extern struct sysent sysent2[];
extern int nsysent1, nsysent2;

/*
 * Structure of the syscall handler table
 */
struct syscallhandler {
	int		(*sys_hdlr)();	/* handler */
	struct sysent	*sysentp;	/* sysent table for this handler */
	int		*nsysentp;	/* no. of entries in sysent tbl */
	char		**syscallnamep;	/* syscall names, for debug */
};
extern struct syscallhandler syscall_handler[];
extern int syscall_nhandler;

extern	sema_t	unmount_mutex;

extern	uint	boothowto;	/* reboot flags, from power-up diagnostics */
extern	uint	sys_clock_rate;	/* # Mega Hz system runs at */

extern struct panic_data {
	struct engine *pd_engine;	/* Panicing engine */
	struct proc *pd_proc;		/* Panicing process, 0 if idle */
	caddr_t	pd_sp;			/* sp to saved regs in panic frame */
	caddr_t pd_dblsp;		/* sp to saved regs in dblpanic frame */
} panic_data; 


long	rmalloc();

extern	timeval_t boottime;
extern	timeval_t time;
int	realitexpire();
extern	int	hz;
extern	int	tick;
extern	sema_t	lbolt;				/* awoken once a second */

extern long	avenrun[3];			/* load average */

extern	struct	pte	zeropg[];		/* source of RO zeroes */

#define	_SYS_SYSTM_H_
#endif	/* _SYS_SYSTM_H_ */
