plan 9 kernel history: overview | file list | diff list

1991/0523/gnot/mem.h (diff list | history)

gnot/mem.h on 1990/03091
1990/03091    
/* 
 * Memory and machine-specific definitions.  Used in C and assembler. 
 */ 
 
/* 
 * Sizes 
 */ 
 
#define	BI2BY		8			/* bits per byte */ 
#define BI2WD		32			/* bits per word */ 
#define	BY2WD		4			/* bytes per word */ 
#define	BY2PG		8192			/* bytes per page */ 
#define	WD2PG		(BY2PG/BY2WD)		/* words per page */ 
#define	PGSHIFT		13			/* log(BY2PG) */ 
 
#define	MAXMACH		1			/* max # cpus system can run */ 
1990/06111    
 
/* 
 * Time 
 */ 
1990/08101    
#define	HZ		(60)			/* clock frequency */ 
#define	MS2HZ		(1000/HZ)		/* millisec per clock tick */ 
#define	TK2SEC(t)	((t)/HZ)		/* ticks to seconds */ 
1990/1012    
#define	TK2MS(t)	((((ulong)(t))*1000)/HZ)	/* ticks to milliseconds */ 
#define	MS2TK(t)	((((ulong)(t))*HZ)/1000)	/* milliseconds to ticks */ 
1990/03091    
 
/* 
 * SR bits 
 */ 
#define SUPER		0x2000 
#define SPL(n)		(n<<8) 
 
/* 
 * CACR 
 */ 
#define	CCLEAR		0x08 
#define	CENABLE		0x01 
 
/* 
1990/1223    
 * Magic registers (unused in current system) 
1990/03091    
 */ 
 
#define	MACH		A5		/* A5 is m-> */ 
#define	USER		A4		/* A4 is u-> */ 
 
/* 
 * Fundamental addresses 
 */ 
 
#define	USERADDR	0x80000000 
1991/0319    
#define	UREGADDR	(USERADDR+BY2PG-(2+4+2+(8+8+1+1)*BY2WD)) 
1990/03091    
 
/* 
 * Devices poked during bootstrap 
 */ 
#define	TACADDR		0x40600000 
#define	MOUSE		0x40200000 
 
/* 
 * MMU 
 */ 
 
1990/08101    
#define	VAMASK	0xCFFFFFFF	/* clear balu bits in address */ 
1990/03091    
#define	KUSEG	0x00000000 
#define KSEG	0x80000000 
 
/* 
 * MMU entries 
 */ 
#define	PTEVALID	(1<<13) 
1990/1212    
#define PTEWRITE	0 
1990/03091    
#define	PTERONLY	(1<<14) 
#define	PTEKERNEL	(1<<15) 
#define	INVALIDPTE	0 
#define	PPN(pa)		((pa>>13)&0x1FFF) 
 
#define	KMAP	((unsigned long *)0xD0000000) 
#define	UMAP	((unsigned long *)0x50000000) 
 
/* 
 * Virtual addresses 
 */ 
#define	VTAG(va)	((va>>22)&0x03F) 
#define	VPN(va)		((va>>13)&0x1FF) 
 
#define	PARAM		((char*)0x40500000) 
#define	TLBFLUSH_	0x01 
 
/* 
 * Address spaces 
 */ 
 
#define	UZERO	KUSEG			/* base of user address space */ 
#define	UTZERO	(UZERO+BY2PG)		/* first address in user text */ 
#define	TSTKTOP	0x10000000		/* end of new stack in sysexec */ 
1991/0523    
#define TSTKSIZ 100 
#define	USTKTOP	(TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */ 
1990/03091    
#define	KZERO	KSEG			/* base of kernel address space */ 
#define	KTZERO	(KZERO+BY2PG)		/* first address in kernel text */ 
1990/0821    
#define	USTACKSIZE	(4*1024*1024)	/* size of user stack */ 
1990/03091    
 
#define	NSEG		5 
#define	MACHSIZE	4096 
1991/0411    
 
 
#define isphys(p) ((((ulong)(p))&0xF0000000) == KSEG) 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)