typedef struct Hevent Hevent;
typedef struct Hwait Hwait;
typedef struct Mach Mach;

#include "../port/sysnum.h"
#include "../port/portdat.h"

struct Mach
{
	int	machno;
	int	spl;
	Proc	*proc;
	Proc	*_up;
	Label	sched;			/* scheduler wakeup */
	int	nrdy;
	ulong	fairness;		/* for runproc */
	ulong	lastcyclecount;
	uvlong	fastclock;
	int	pfault;
	int	cs;
	int	syscall;
	int	load;
	int	intr;
	int	ledval;			/* value last written to LED */
	int	ticks;	/* milliseconds */

	int	stack[1];
};

#define	KSTACK		8192
#define	BLOCKALIGN	8
#define	ROUND(s, sz)	(((s)+((sz)-1))&~((sz)-1))

struct Hevent
{
	void		*h;
	Hwait	*w;
};

struct Hwait
{
	Hevent*	e;
	int		ne;
	int		alt;

	int		removed;
	int		first;
	Rendez	r;
	Hwait*	nextadd;
	Hwait*	nextremove;
};

extern Mach	nomach;
