⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portdat.h

📁 在x86平台上运行不可信任代码的sandbox。
💻 H
📖 第 1 页 / 共 2 页
字号:
{	ulong base;	ulong npage;};struct Palloc{	Lock lk;	Pallocmem	mem[4];	Page	*head;			/* most recently used */	Page	*tail;			/* least recently used */	ulong	freecount;		/* how many pages on free list now */	Page	*pages;			/* array of all pages */	ulong	user;			/* how many user pages */	Page	*hash[PGHSIZE];	Lock	hashlock;	Rendez	r;			/* Sleep for free mem */	QLock	pwait;			/* Queue of procs waiting for memory */};struct Waitq{	Waitmsg	w;	Waitq	*next;};/* * fasttick timer interrupts */enum {	/* Mode */	Trelative,	/* timer programmed in ns from now */	Tperiodic,	/* periodic timer, period in ns */};struct Timer{	/* Public interface */	int	tmode;		/* See above */	vlong	tns;		/* meaning defined by mode */	void	(*tf)(Ureg*, Timer*);	void	*ta;	/* Internal */	Lock lk;	Timers	*tt;		/* Timers queue this timer runs on */	Tval	tticks;		/* tns converted to ticks */	Tval	twhen;		/* ns represented in fastticks */	Timer	*tnext;};// Plan 9 VX added for help with FreeBSD#undef RFNAMEG#undef RFENVG#undef RFFDG#undef RFPROC#undef RFMEM#undef RFNOWAIT#undef RFCNAMEG#undef RFCENVG#undef RFCFDG#undef RFREND#undef RFNOMNT#undef RFNOTEGenum{	RFNAMEG		= (1<<0),	RFENVG		= (1<<1),	RFFDG		= (1<<2),	RFNOTEG		= (1<<3),	RFPROC		= (1<<4),	RFMEM		= (1<<5),	RFNOWAIT	= (1<<6),	RFCNAMEG	= (1<<10),	RFCENVG		= (1<<11),	RFCFDG		= (1<<12),	RFREND		= (1<<13),	RFNOMNT		= (1<<14),};/* *  process memory segments - NSEG always last ! */enum{	SSEG, TSEG, DSEG, BSEG, ESEG, LSEG, SEG1, SEG2, SEG3, SEG4, NSEG};enum{	Dead = 0,		/* Process states */	Moribund,	Ready,	Scheding,	Running,	Queueing,	QueueingR,	QueueingW,	Wakeme,	Broken,	Stopped,	Rendezvous,	Waitrelease,	Proc_stopme = 1, 	/* devproc requests */	Proc_exitme,	Proc_traceme,	Proc_exitbig,	Proc_tracesyscall,	TUser = 0, 		/* Proc.time */	TSys,	TReal,	TCUser,	TCSys,	TCReal,	NERR = 64,	NNOTE = 5,	Npriq		= 20,		/* number of scheduler priority levels */	Nrq		= Npriq+2,	/* number of priority levels including real time */	PriRelease	= Npriq,	/* released edf processes */	PriEdf		= Npriq+1,	/* active edf processes */	PriNormal	= 10,		/* base priority for normal processes */	PriExtra	= Npriq-1,	/* edf processes at high best-effort pri */	PriKproc	= 13,		/* base priority for kernel processes */	PriRoot		= 13,		/* base priority for root processes */};struct Schedq{	Lock lk;	Proc*	head;	Proc*	tail;	int	n;};struct Proc{	Label	sched;		/* known to l.s */	char	*kstack;	/* known to l.s */	Mach	*mach;		/* machine running this proc */	char	*text;	char	*user;	char	*args;	int	nargs;		/* number of bytes of args */	Proc	*rnext;		/* next process in run queue */	Proc	*qnext;		/* next process on queue for a QLock */	QLock	*qlock;		/* addr of qlock being queued for DEBUG */	int	state;	char	*psstate;	/* What /proc/#/status reports */	Segment	*seg[NSEG];	QLock	seglock;	/* locked whenever seg[] changes */	ulong	pid;	ulong	noteid;		/* Equivalent of note group */	Proc	*pidhash;	/* next proc in pid hash */	Lock	exl;		/* Lock count and waitq */	Waitq	*waitq;		/* Exited processes wait children */	int	nchild;		/* Number of living children */	int	nwait;		/* Number of uncollected wait records */	QLock	qwaitr;	Rendez	waitr;		/* Place to hang out in wait */	Proc	*parent;	Pgrp	*pgrp;		/* Process group for namespace */	Egrp 	*egrp;		/* Environment group */	Fgrp	*fgrp;		/* File descriptor group */	Rgrp	*rgrp;		/* Rendez group */	Fgrp	*closingfgrp;	/* used during teardown */	ulong	parentpid;	ulong	time[6];	/* User, Sys, Real; child U, S, R */	uvlong	kentry;		/* Kernel entry time stamp (for profiling) */	/*	 * pcycles: cycles spent in this process (updated on procsave/restore)	 * when this is the current proc and we're in the kernel	 * (procrestores outnumber procsaves by one)	 * the number of cycles spent in the proc is pcycles + cycles()	 * when this is not the current process or we're in user mode	 * (procrestores and procsaves balance), it is pcycles.	 */	vlong	pcycles;	int	insyscall;	int	fpstate;	QLock	debug;		/* to access debugging elements of User */	Proc	*pdbg;		/* the debugging process */	ulong	procmode;	/* proc device file mode */	ulong	privatemem;	/* proc does not let anyone read mem */	int	hang;		/* hang at next exec for debug */	int	procctl;	/* Control for /proc debugging */	ulong	pc;		/* DEBUG only */	Lock	rlock;		/* sync sleep/wakeup with postnote */	Rendez	*r;		/* rendezvous point slept on */	Rendez	sleep;		/* place for syssleep/debug */	int	notepending;	/* note issued but not acted on */	int	kp;		/* true if a kernel process */	Proc	*palarm;	/* Next alarm time */	ulong	alarm;		/* Time of call */	int	newtlb;		/* Pager has changed my pte's, I must flush */	int	noswap;		/* process is not swappable */	uintptr	rendtag;	/* Tag for rendezvous */	uintptr	rendval;	/* Value for rendezvous */	Proc	*rendhash;	/* Hash list for tag values */	Timer timer;			/* For tsleep and real-time */	Rendez	*trend;	int	(*tfn)(void*);	void	(*kpfun)(void*);	void	*kparg;	FPsave	fpsave;		/* address of this is known by db */	int	scallnr;	/* sys call number - known by db */	Sargs	s;		/* address of this is known by db */	int	nerrlab;	Label	errlab[NERR];	char	*syserrstr;	/* last error from a system call, errbuf0 or 1 */	char	*errstr;	/* reason we're unwinding the error stack, errbuf1 or 0 */	char	errbuf0[ERRMAX];	char	errbuf1[ERRMAX];	char	genbuf[128];	/* buffer used e.g. for last name element from namec */	Chan	*slash;	Chan	*dot;	Note	note[NNOTE];	short	nnote;	short	notified;	/* sysnoted is due */	Note	lastnote;	ulong	notify;	Lock	*lockwait;	Lock	*lastlock;	/* debugging */	Lock	*lastilock;	/* debugging */	Mach	*wired;	Mach	*mp;		/* machine this process last ran on */	Ref	nlocks;		/* number of locks held by proc */	ulong	delaysched;	ulong	priority;	/* priority level */	ulong	basepri;	/* base priority level */	uchar	fixedpri;	/* priority level deson't change */	ulong	cpu;		/* cpu average */	ulong	lastupdate;	uchar	yield;		/* non-zero if the process just did a sleep(0) */	ulong	readytime;	/* time process came ready */	ulong	movetime;	/* last time process switched processors */	int	preempted;	/* true if this process hasn't finished the interrupt				 *  that last preempted it				 */	Edf	*edf;		/* if non-null, real-time proc, edf contains scheduling params */	int	trace;		/* process being traced? */	ulong	qpc;		/* pc calling last blocking qlock */	int	setargs;	ulong ureg;		/* User registers for notes */	void	*dbgreg;	/* User registers for devproc */	Notsave notsave;	/*	 *  machine specific MMU	 */	PMMU pmmu;};enum{	PRINTSIZE =	256,	MAXCRYPT = 	127,	NUMSIZE	=	12,		/* size of formatted number */	MB =		(1024*1024),	READSTR =	1000,		/* temporary buffer size for device reads */};extern	Conf	conf;extern	char*	conffile;extern	int	cpuserver;extern	Dev*	devtab[];extern	char*	eve;extern	char	hostdomain[];extern	uchar	initcode[];extern	int	kbdbuttons;extern	Queue*	kbdq;extern	Queue*	kprintoq;extern 	Ref	noteidalloc;extern	int	nsyscall;extern	Palloc	palloc;extern	Queue*	serialoq;extern	char*	statename[];extern	Image	swapimage;extern	char*	sysname;extern	uint	qiomaxatomic;enum{	LRESPROF	= 3,};/* *  action log */struct Log {	Lock lk;	int	opens;	char*	buf;	char	*end;	char	*rptr;	int	len;	int	nlog;	int	minread;	int	logmask;	/* mask of things to debug */	QLock	readq;	Rendez	readr;};struct Logflag {	char*	name;	int	mask;};enum{	NCMDFIELD = 128};struct Cmdbuf{	char	*buf;	char	**f;	int	nf;};struct Cmdtab{	int	index;	/* used by client to switch on result */	char	*cmd;	/* command name */	int	narg;	/* expected #args; 0 ==> variadic */};/* *  routines to access UART hardware */struct PhysUart{	char*	name;	Uart*	(*pnp)(void);	void	(*enable)(Uart*, int);	void	(*disable)(Uart*);	void	(*kick)(Uart*);	void	(*dobreak)(Uart*, int);	int	(*baud)(Uart*, int);	int	(*bits)(Uart*, int);	int	(*stop)(Uart*, int);	int	(*parity)(Uart*, int);	void	(*modemctl)(Uart*, int);	void	(*rts)(Uart*, int);	void	(*dtr)(Uart*, int);	long	(*status)(Uart*, void*, long, long);	void	(*fifo)(Uart*, int);	void	(*power)(Uart*, int);	int	(*getc)(Uart*);	/* polling versions, for iprint, rdb */	void	(*putc)(Uart*, int);};enum {	Stagesize=	2048};/* *  software UART */struct Uart{	void*	regs;			/* hardware stuff */	void*	saveregs;		/* place to put registers on power down */	char*	name;			/* internal name */	ulong	freq;			/* clock frequency */	int	bits;			/* bits per character */	int	stop;			/* stop bits */	int	parity;			/* even, odd or no parity */	int	baud;			/* baud rate */	PhysUart*phys;	int	console;		/* used as a serial console */	int	special;		/* internal kernel device */	Uart*	next;			/* list of allocated uarts */	QLock lk;	int	type;			/* ?? */	int	dev;	int	opens;	int	enabled;	Uart	*elist;			/* next enabled interface */	int	perr;			/* parity errors */	int	ferr;			/* framing errors */	int	oerr;			/* rcvr overruns */	int	berr;			/* no input buffers */	int	serr;			/* input queue overflow */	/* buffers */	int	(*putc)(Queue*, int);	Queue	*iq;	Queue	*oq;	Lock	rlock;	uchar	istage[Stagesize];	uchar	*iw;	uchar	*ir;	uchar	*ie;	Lock	tlock;			/* transmit */	uchar	ostage[Stagesize];	uchar	*op;	uchar	*oe;	int	drain;	int	modem;			/* hardware flow control on */	int	xonoff;			/* software flow control on */	int	blocked;	int	cts, dsr, dcd;	/* keep track of modem status */ 	int	ctsbackoff;	int	hup_dsr, hup_dcd;	/* send hangup upstream? */	int	dohup;	Rendez	r;};extern	Uart*	consuart;/* *  performance timers, all units in perfticks */struct Perf{	ulong	intrts;		/* time of last interrupt */	ulong	inintr;		/* time since last clock tick in interrupt handlers */	ulong	avg_inintr;	/* avg time per clock tick in interrupt handlers */	ulong	inidle;		/* time since last clock tick in idle loop */	ulong	avg_inidle;	/* avg time per clock tick in idle loop */	ulong	last;		/* value of perfticks() at last clock tick */	ulong	period;		/* perfticks() per clock tick */};struct Watchdog{	void	(*enable)(void);	/* watchdog enable */	void	(*disable)(void);	/* watchdog disable */	void	(*restart)(void);	/* watchdog restart */	void	(*stat)(char*, char*);	/* watchdog statistics */};/* queue state bits,  Qmsg, Qcoalesce, and Qkick can be set in qopen */enum{	/* Queue.state */	Qstarve		= (1<<0),	/* consumer starved */	Qmsg		= (1<<1),	/* message stream */	Qclosed		= (1<<2),	/* queue has been closed/hungup */	Qflow		= (1<<3),	/* producer flow controlled */	Qcoalesce	= (1<<4),	/* coallesce packets on read */	Qkick		= (1<<5),	/* always call the kick routine after qwrite */};#define DEVDOTDOT -1void	printmap(void);	// Plan 9 VX

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -