Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/pc/mem.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname pc/mem.h 1991/0613
## diff -e /dev/null /n/bootesdump/1991/0613/sys/src/9/safari/mem.h
0a
#define SELGDT	(0<<3)	/* selector is in gdt */
#define	SELLDT	(1<<3)	/* selector is in ldt */

#define SELECTOR(i, t, p)	(((i)<<4) | (t) | (p))

/*
 *  segment descriptor/gate
 */
typedef struct Segdesc	Segdesc;
struct Segdesc
{
	ulong	d0;
	ulong	d1;
};
#define SEGDATA	(0x10<<8)	/* data/stack segment */
#define SEGEXEC	(0x18<<8)	/* executable segment */
#define SEGCG	(0x0C<<8)	/* call gate */
#define	SEGIG	(0x0E<<8)	/* interrupt gate */
#define SEGTG	(0x0F<<8)	/* task gate */

#define SEGP	(1<<15)		/* segment present */
#define SEGPL(x) ((x)<<13)	/* priority level */
#define SEGB	(1<<22)		/* granularity 1==4k (for expand-down) */
#define SEGG	(1<<23)		/* granularity 1==4k (for other) */
#define SEGE	(1<<10)		/* expand down */
#define SEGW	(1<<9)		/* writable (for data/stack) */
#define	SEGR	(1<<9)		/* readable (for code) */
#define SEGD	(1<<22)		/* default 1==32bit (for code) */

/*
 *  gate initializers
 */
#define TRAPGATE(s,o,p)	{ (o)&0xFFFF0000|SEGP|SEGPL(p)|SEGTG, (o)&0xFFFF|((s)<<16) }
#define INTRGATE(s,o,p)	{ (o)&0xFFFF0000|SEGP|SEGPL(p)|SEGIG, (o)&0xFFFF|((s)<<16) }
#define CALLGATE(s,o,p)	{ (o)&0xFFFF0000|SEGP|SEGPL(p)|SEGCG, (o)&0xFFFF|((s)<<16) }

/*
 *  segment descriptor initializers
 */
#define	DATASEG(p) 	{ SEGG|(0xF<<16)|SEGP|SEGPL(p)|SEGDATA|SEGW, 0xFFFF }
#define	EXECSEG(p) 	{ SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(p)|SEGEXEC|SEGR, 0xFFFF }

/*
 *  known segments (in GDT) and their selectors
 */
enum
{
	NULLSEG=0,	/* null segment */
	KESEG=	1,	/* kernel executable */	
	KDSEG=	2,	/* kernel data/stack */
	UESEG=	3,	/* user executable */
	UDSEG=	4,	/* user data/stack */
	SYSGATE=5,	/* system call gate */
};
#define NULLSEL	SELECTOR(NULLSEG, SELGDT, 0)
#define KESEL	SELECTOR(KESEG, SELGDT, 0)
#define KDSEL	SELECTOR(KDSEG, SELGDT, 0)
#define KSSEL	SELECTOR(KDSEG, SELGDT, 0)
#define UESEL	SELECTOR(UESEG, SELGDT, 3)
#define UDSEL	SELECTOR(UDSEG, SELGDT, 3)
#define USSEL	SELECTOR(UDSEG, SELGDT, 3)

/*
 *  task state segment.  Plan 9 ignores all the task switching goo and just
 *  uses the tss for esp0 and ss0 on gate's into the kernel, interrupts,
 *  and exceptions.  The rest is completely ignored.
 *
 *  This means that we only need one tss in the whole system.
 */
typedef struct Tss	Tss;
struct Tss
{
	ulong	backlink;	/* unused */
	ulong	esp0;		/* pl0 stack pointer */
	ulong	ss0;		/* pl0 stack selector */
	ulong	esp1;		/* pl1 stack pointer */
	ulong	ss1;		/* pl1 stack selector */
	ulong	esp2;		/* pl2 stack pointer */
	ulong	ss2;		/* pl2 stack selector */
	ulong	cr3;		/* page table descriptor */
	ulong	eip;		/* instruction pointer */
	ulong	eflags;		/* processor flags */
	ulong	eax;		/* general (hah?) registers */
	ulong 	ecx;
	ulong	edx;
	ulong	ebx;
	ulong	esp;
	ulong	ebp;
	ulong	esi;
	ulong	edi;
	ulong	es;		/* segment selectors */
	ulong	cs;
	ulong	ss;
	ulong	ds;
	ulong	fs;
	ulong	gs;
	ulong	ldt;		/* local descriptor table */
	ulong	iomap;		/* io map base */
};
.
## diffname pc/mem.h 1991/0614
## diff -e /n/bootesdump/1991/0613/sys/src/9/safari/mem.h /n/bootesdump/1991/0614/sys/src/9/safari/mem.h
40c
#define	DATASEG(p) 	{ SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(p)|SEGDATA|SEGW, 0xFFFF }
.
## diffname pc/mem.h 1991/0625
## diff -e /n/bootesdump/1991/0614/sys/src/9/safari/mem.h /n/bootesdump/1991/0625/sys/src/9/safari/mem.h
63,99d
46,54c

#define	NULLSEG	0	/* null segment */
#define	KESEG	1	/* kernel executable */	
#define	KDSEG	2	/* kernel data/stack */
#define	UESEG	3	/* user executable */
#define	UDSEG	4	/* user data/stack */
#define	SYSGATE	5	/* system call gate */

#define SELGDT	(0<<3)	/* selector is in gdt */
#define	SELLDT	(1<<3)	/* selector is in ldt */

#define SELECTOR(i, t, p)	(((i)<<4) | (t) | (p))

.
42a
#define	UZERO	0			/* base of user address space */
#define	UTZERO	(UZERO+BY2PG)		/* first address in user text */
#define	TSTKTOP	USERADDR		/* end of new stack in sysexec */
#define TSTKSIZ 10
#define	USTKTOP	(TSTKTOP-TSTKSIZ*BY2PG)	/* byte just beyond user stack */
#define	KZERO	0x80000000		/* base of kernel address space */
#define	KTZERO	KZERO			/* first address in kernel text */
#define	USTKSIZE	(4*1024*1024)	/* size of user stack */

#define	MACHSIZE	4096

#define isphys(x) ((x)&KZERO)

.
40,41d
38c
 * Address spaces
 *
 * User is at 0-2GB
 * Kernel is at 2GB-4GB
.
36a
#define	USERADDR	0xC0000000
#define	UREGADDR	(USERADDR+BY2PG-4*16)

.
33,35d
31c
 * Fundamental addresses
.
21,28c
#define	HZ		(68)			/* clock frequency */
#define	MS2HZ		(1000/HZ)		/* millisec per clock tick */
#define	TK2SEC(t)	((t)*100/6839)		/* ticks to seconds */
#define	TK2MS(t)	((((ulong)(t))*100000)/6839)	/* ticks to milliseconds */
#define	MS2TK(t)	((((ulong)(t))*6839)/100000)	/* milliseconds to ticks */
.
9,19d
7c
 * Time (???)
 * Clock frequency is 68.3900 HZ
.
5a
#define	BI2BY		8			/* bits per byte */
#define BI2WD		32			/* bits per word */
#define	BY2WD		4			/* bytes per word */
#define	BY2PG		4096			/* bytes per page */
#define	WD2PG		(BY2PG/BY2WD)		/* words per page */
#define	PGSHIFT		13			/* log(BY2PG) */
#define PGROUND(s)	(((s)+(BY2PG-1))&~(BY2PG-1))

#define	MAXMACH		1			/* max # cpus system can run */

.
4c
/*
 * Sizes
 */
.
1,2c
/*
 * Memory and machine-specific definitions.  Used in C and assembler.
 */
.
## diffname pc/mem.h 1991/0627
## diff -e /n/bootesdump/1991/0625/sys/src/9/safari/mem.h /n/bootesdump/1991/0627/sys/src/9/safari/mem.h
80a
/*
 *  fields in segment descriptors
 */
#define SEGDATA	(0x10<<8)	/* data/stack segment */
#define SEGEXEC	(0x18<<8)	/* executable segment */
#define SEGCG	(0x0C<<8)	/* call gate */
#define	SEGIG	(0x0E<<8)	/* interrupt gate */
#define SEGTG	(0x0F<<8)	/* task gate */

#define SEGP	(1<<15)		/* segment present */
#define SEGPL(x) ((x)<<13)	/* priority level */
#define SEGB	(1<<22)		/* granularity 1==4k (for expand-down) */
#define SEGG	(1<<23)		/* granularity 1==4k (for other) */
#define SEGE	(1<<10)		/* expand down */
#define SEGW	(1<<9)		/* writable (for data/stack) */
#define	SEGR	(1<<9)		/* readable (for code) */
#define SEGD	(1<<22)		/* default 1==32bit (for code) */
.
## diffname pc/mem.h 1991/0629
## diff -e /n/bootesdump/1991/0627/sys/src/9/safari/mem.h /n/bootesdump/1991/0629/sys/src/9/safari/mem.h
71c
#define SELECTOR(i, t, p)	(((i)<<3) | (t) | (p))
.
## diffname pc/mem.h 1991/0703
## diff -e /n/bootesdump/1991/0629/sys/src/9/safari/mem.h /n/bootesdump/1991/0703/sys/src/9/safari/mem.h
88a
#define SEGTYPE	(0x1F<<8)
.
62,65c
#define	KDSEG	1	/* kernel data/stack */
#define	KESEG	2	/* kernel executable */	
#define	UDSEG	3	/* user data/stack */
#define	UESEG	4	/* user executable */
.
## diffname pc/mem.h 1991/0705
## diff -e /n/bootesdump/1991/0703/sys/src/9/safari/mem.h /n/bootesdump/1991/0705/sys/src/9/safari/mem.h
24,28c
#define	HZ		(18)			/* clock frequency */
#define	MS2HZ		(54)			/* millisec per clock tick */
#define	TK2SEC(t)	((t)*10/185)		/* ticks to seconds */
#define	TK2MS(t)	((((ulong)(t))*10000)/185)	/* ticks to milliseconds */
#define	MS2TK(t)	((((ulong)(t))*185)/10000)	/* milliseconds to ticks */
.
20,21c
 * Time
 * Clock frequency is ??? HZ
.
## diffname pc/mem.h 1991/0706
## diff -e /n/bootesdump/1991/0705/sys/src/9/safari/mem.h /n/bootesdump/1991/0706/sys/src/9/safari/mem.h
98a

/*
 *  virtual MMU entries
 */
#define PTEMAPMEM	(1024*1024)	/* ??? */	
#define SEGMAPSIZE	16		/* ??? */
#define	PTEPERTAB	(PTEMAPMEM/BY2PG)	/* ??? */
.
79a
#define RDSEL	SELECTOR(RDSEG, SELGDT, 0)
#define RESEL	SELECTOR(RESEG, SELGDT, 0)
.
66a
#define	RDSEG	6	/* reboot data/stack */
#define	RESEG	7	/* reboot executable */	
.
60d
58c
 *  known 80386 segments (in GDT) and their selectors
.
43d
33d
23d
8d
## diffname pc/mem.h 1991/0709
## diff -e /n/bootesdump/1991/0706/sys/src/9/safari/mem.h /n/bootesdump/1991/0709/sys/src/9/safari/mem.h
22,26c
#define	HZ		(20)			/* clock frequency */
#define	MS2HZ		(1000/HZ)		/* millisec per clock tick */
#define	TK2SEC(t)	((t)/HZ)		/* ticks to seconds */
#define	TK2MS(t)	((((ulong)(t))*1000)/HZ)	/* ticks to milliseconds */
#define	MS2TK(t)	((((ulong)(t))*HZ)/1000)	/* milliseconds to ticks */
.
20d
## diffname pc/mem.h 1991/0710
## diff -e /n/bootesdump/1991/0709/sys/src/9/safari/mem.h /n/bootesdump/1991/0710/sys/src/9/safari/mem.h
103a

/*
 *  physical MMU
 */
#define PPN(x)		((x)&~(BY2PG-1))
#define	PTEVALID	(1<<0)
#define	PTEUNCACHED	0		/* everything is uncached */
#define PTEWRITE	(1<<1)
#define	PTERONLY	(0<<1)
#define	PTEKERNEL	(0<<2)
#define	PTEUSER		(1<<2)
.
99c
 *  virtual MMU
.
## diffname pc/mem.h 1991/0711
## diff -e /n/bootesdump/1991/0710/sys/src/9/safari/mem.h /n/bootesdump/1991/0711/sys/src/9/safari/mem.h
108d
103a
#define PPN(x)		((x)&~(BY2PG-1))
.
50c
#define isphys(x) (((ulong)x)&KZERO)
.
13c
#define	PGSHIFT		12			/* log(BY2PG) */
.
## diffname pc/mem.h 1991/0716
## diff -e /n/bootesdump/1991/0711/sys/src/9/safari/mem.h /n/bootesdump/1991/0716/sys/src/9/safari/mem.h
114a

/*
 *  flag register bits that we care about
 */
#define IFLAG	0x200
.
75d
72d
## diffname pc/mem.h 1991/0717
## diff -e /n/bootesdump/1991/0716/sys/src/9/safari/mem.h /n/bootesdump/1991/0717/sys/src/9/safari/mem.h
81a
#define	SEGTSS	(0x9<<8)	/* TSS segment */
.
75a
#define TSSSEL	SELECTOR(TSSSEG, SELGDT, 0)
.
62c
#define	RESEG	7	/* reboot executable */
#define TSSSEG	8	/* task segment */
.
## diffname pc/mem.h 1991/0718
## diff -e /n/bootesdump/1991/0717/sys/src/9/safari/mem.h /n/bootesdump/1991/0718/sys/src/9/safari/mem.h
43,46c
#define	USTKTOP		(TSTKTOP-TSTKSIZ*BY2PG)	/* byte just beyond user stack */
#define	USTKSIZE	(4*1024*1024 - TSTKSIZ*BY2PG)	/* size of user stack */
#define USTKBTM		USTKTOP - USTKSIZE
.
39,41c
#define	UZERO		0			/* base of user address space */
#define	UTZERO		(UZERO+BY2PG)		/* first address in user text */
#define	KZERO		0x80000000		/* base of kernel address space */
#define	KTZERO		KZERO			/* first address in kernel text */
#define	USERADDR	0xC0000000		/* struct User */
#define	UREGADDR	(USERADDR+BY2PG-4*16)	
#define	TSTKTOP		USERADDR		/* end of new stack in sysexec */
.
36,37c
 *  User is at 0-2GB
 *  Kernel is at 2GB-4GB
 *
 *  To avoid an extra page map, both the user stack (USTKTOP) and
 *  the temporary user stack (TSTKTOP) should be in the the same
 *  4 meg.
.
34c
 *  Address spaces
.
30,31d
## diffname pc/mem.h 1991/0719
## diff -e /n/bootesdump/1991/0718/sys/src/9/safari/mem.h /n/bootesdump/1991/0719/sys/src/9/safari/mem.h
80,81d
66,68c
#define TSSSEG	6	/* task segment */
.
51c
#define USTKBTM		(USTKTOP - USTKSIZE)
.
## diffname pc/mem.h 1991/0807
## diff -e /n/bootesdump/1991/0719/sys/src/9/safari/mem.h /n/bootesdump/1991/0807/sys/src/9/safari/mem.h
46c
#define	UREGADDR	(USERADDR+BY2PG-4*17)	
.
21c
#define	HZ		(1000)			/* clock frequency */
.
## diffname pc/mem.h 1991/0808
## diff -e /n/bootesdump/1991/0807/sys/src/9/safari/mem.h /n/bootesdump/1991/0808/sys/src/9/safari/mem.h
21c
#define	HZ		(20)			/* clock frequency */
.
## diffname pc/mem.h 1991/1004
## diff -e /n/bootesdump/1991/0808/sys/src/9/safari/mem.h /n/bootesdump/1991/1004/sys/src/9/safari/mem.h
50,51c
#define	USTKSIZE	(16*1024*1024 - TSTKSIZ*BY2PG)	/* size of user stack */
.
## diffname pc/mem.h 1991/1210
## diff -e /n/bootesdump/1991/1004/sys/src/9/safari/mem.h /n/bootesdump/1991/1210/sys/src/9/safari/mem.h
50a
#define ROMBIOS		(KZERO|0xF0000)
.
## diffname pc/mem.h 1991/1214
## diff -e /n/bootesdump/1991/1210/sys/src/9/safari/mem.h /n/bootesdump/1991/1214/sys/src/9/safari/mem.h
65,66c
#define TSSSEG	5	/* task segment */
.
46c
#define	UREGADDR	(USERADDR+BY2PG-4*19)	
.
## diffname pc/mem.h 1992/0625
## diff -e /n/bootesdump/1991/1214/sys/src/9/safari/mem.h /n/bootesdump/1992/0625/sys/src/9/safari/mem.h
14a
#define MB		(1024*1024)
.
## diffname pc/mem.h 1992/0726
## diff -e /n/bootesdump/1992/0625/sys/src/9/safari/mem.h /n/bootesdump/1992/0726/sys/src/9/safari/mem.h
15d
## diffname pc/mem.h 1992/0804
## diff -e /n/bootesdump/1992/0726/sys/src/9/safari/mem.h /n/bootesdump/1992/0804/sys/src/9/safari/mem.h
111c
#define	PTEUNCACHED	(1<<4)	
.
## diffname pc/mem.h 1992/0805
## diff -e /n/bootesdump/1992/0804/sys/src/9/safari/mem.h /n/bootesdump/1992/0805/sys/src/9/safari/mem.h
102,104c
#define PTEMAPMEM	(1024*1024)	
#define SEGMAPSIZE	64
#define	PTEPERTAB	(PTEMAPMEM/BY2PG)
.
## diffname pc/mem.h 1992/0930
## diff -e /n/bootesdump/1992/0808/sys/src/9/safari/mem.h /n/bootesdump/1992/0930/sys/src/9/pc/mem.h
51a
#define	ISAMEMSIZE	(4*MB)			/* mem space reserved for ISA */
.
## diffname pc/mem.h 1992/1013
## diff -e /n/bootesdump/1992/0930/sys/src/9/pc/mem.h /n/bootesdump/1992/1013/sys/src/9/pc/mem.h
56d
## diffname pc/mem.h 1992/1211
## diff -e /n/bootesdump/1992/1013/sys/src/9/pc/mem.h /n/bootesdump/1992/1211/sys/src/9/pc/mem.h
103c
#define SEGMAPSIZE	16
.
## diffname pc/mem.h 1993/0915
## diff -e /n/bootesdump/1992/1211/sys/src/9/pc/mem.h /n/fornaxdump/1993/0915/sys/src/brazil/pc/mem.h
50a
#define KSTACK		4096			/* Size of kernel stack */
.
45,47c
#define	TSTKTOP		0xC0000000		/* end of new stack in sysexec */
.
## diffname pc/mem.h 1993/1013
## diff -e /n/fornaxdump/1993/0915/sys/src/brazil/pc/mem.h /n/fornaxdump/1993/1013/sys/src/brazil/pc/mem.h
119a

#define getpgcolor(a)	0
.
## diffname pc/mem.h 1993/1230
## diff -e /n/fornaxdump/1993/1013/sys/src/brazil/pc/mem.h /n/fornaxdump/1993/1230/sys/src/brazil/pc/mem.h
51a
#define globalmem(x)	(((ulong)x)&KZERO)	/* addresses valid in all contexts */
.
## diffname pc/mem.h 1994/0101
## diff -e /n/fornaxdump/1993/1230/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/0101/sys/src/brazil/pc/mem.h
52c
#define globalmem(x)	((((ulong)x)&0xF0000000)==KZERO)	/* addresses valid in all contexts */
.
## diffname pc/mem.h 1994/0311
## diff -e /n/fornaxdump/1994/0101/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/0311/sys/src/brazil/pc/mem.h
10a
#define	BY2V		8			/* bytes per double word */
.
## diffname pc/mem.h 1994/0322
## diff -e /n/fornaxdump/1994/0311/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/0322/sys/src/brazil/pc/mem.h
15c
#define ROUND(s, sz)	(((s)+(sz-1))&~(sz-1))
#define PGROUND(s)	ROUND(s, BY2PG)
.
## diffname pc/mem.h 1994/0813
## diff -e /n/fornaxdump/1994/0322/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/0813/sys/src/brazil/pc/mem.h
57a
/*
 *  an area for storing crash info to be picked up later
 */
#define CRASHSIZE	(KSTACK+BY2PG)
.
## diffname pc/mem.h 1994/0817
## diff -e /n/fornaxdump/1994/0813/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/0817/sys/src/brazil/pc/mem.h
59,63d
## diffname pc/mem.h 1994/1122
## diff -e /n/fornaxdump/1994/0817/sys/src/brazil/pc/mem.h /n/fornaxdump/1994/1122/sys/src/brazil/pc/mem.h
23c
#define	HZ		(50)			/* clock frequency */
.
## diffname pc/mem.h 1995/0105
## diff -e /n/fornaxdump/1994/1122/sys/src/brazil/pc/mem.h /n/fornaxdump/1995/0105/sys/src/brazil/pc/mem.h
121a
#define IE	0x200
.
## diffname pc/mem.h 1995/0418
## diff -e /n/fornaxdump/1995/0105/sys/src/brazil/pc/mem.h /n/fornaxdump/1995/0418/sys/src/brazil/pc/mem.h
112c
#define	PTEWT		(1<<3)
#define	PTEUNCACHED	(1<<4)
.
## diffname pc/mem.h 1995/0725
## diff -e /n/fornaxdump/1995/0418/sys/src/brazil/pc/mem.h /n/fornaxdump/1995/0725/sys/src/brazil/pc/mem.h
23c
#define	HZ		(100)			/* clock frequency */
.
## diffname pc/mem.h 1995/0726
## diff -e /n/fornaxdump/1995/0725/sys/src/brazil/pc/mem.h /n/fornaxdump/1995/0726/sys/src/brazil/pc/mem.h
46c
#define	KTZERO		0x80100000		/* first address in kernel text */
.
## diffname pc/mem.h 1997/0327
## diff -e /n/fornaxdump/1995/0726/sys/src/brazil/pc/mem.h /n/emeliedump/1997/0327/sys/src/brazil/pc/mem.h
118,123c
#define PTESIZE		(1<<7)
.
105a
#define SEGMAPSIZE	512
.
104d
56,57d
32a
#define MACHADDR	0xFEF00000		/* as seen by current processor */
#define	MACHSIZE	4096

.
31a
#define IDTADDR		0x80000800		/* idt */
#define APBOOTSTRAP	0x80001000		/* AP bootstrap code */
#define CONFADDR	0x80001200		/* info passed from boot loader */
#define CPU0PDB		0x80002000		/* bootstrap processor PDB */
#define CPU0PTE		0x80003000		/* bootstrap processor PTE's for 0-2MB */
#define CPU0MACHPTE	0x80004000		/* bootstrap processor PTE for MACHADDR */
#define CPU0MACH	0x80005000		/* Mach for bootstrap processor */
.
18c
#define	MAXMACH		8			/* max # cpus system can run */
.
## diffname pc/mem.h 1997/0520
## diff -e /n/emeliedump/1997/0327/sys/src/brazil/pc/mem.h /n/emeliedump/1997/0520/sys/src/brazil/pc/mem.h
76,77c
#define SELGDT	(0<<2)	/* selector is in gdt */
#define	SELLDT	(1<<2)	/* selector is in ldt */
.
## diffname pc/mem.h 1997/0810
## diff -e /n/emeliedump/1997/0520/sys/src/brazil/pc/mem.h /n/emeliedump/1997/0810/sys/src/brazil/pc/mem.h
96c
#define SEGTG	(0x0F<<8)	/* trap gate */
.
67c
 *  known x86 segments (in GDT) and their selectors
.
57,64c
#define	USTKTOP		(KZERO-BY2PG)		/* byte just beyond user stack */
#define	USTKSIZE	(4*1024*1024)		/* size of user stack */
#define	TSTKTOP		(USTKTOP-USTKSIZE)	/* end of new stack in sysexec */
#define TSTKSIZ 	100
.
48,51d
26,27c
#define	TK2MS(t)	((t)*MS2HZ)		/* ticks to milliseconds */
#define	MS2TK(t)	((t)/MS2HZ)		/* milliseconds to ticks */
.
18a
#define KSTACK		4096			/* Size of kernel stack */
.
## diffname pc/mem.h 1997/0920
## diff -e /n/emeliedump/1997/0810/sys/src/brazil/pc/mem.h /n/emeliedump/1997/0920/sys/src/brazil/pc/mem.h
19c
#define KSTACK		4096-16			/* Size of kernel stack */
						/* the -16 is room for the 2n allocator header */
.
## diffname pc/mem.h 1997/1101
## diff -e /n/emeliedump/1997/0920/sys/src/brazil/pc/mem.h /n/emeliedump/1997/1101/sys/src/brazil/pc/mem.h
41,43c
#define	MACHSIZE	BY2PG
.
38,39c
#define CPU0PTE		0x80003000		/* bootstrap processor PTE's for 0-4MB */
#define MACHADDR	0x80004000		/* as seen by current processor */
.
19,20c
#define KSTACK		4096			/* Size of kernel stack */
.
## diffname pc/mem.h 1998/0916
## diff -e /n/emeliedump/1997/1101/sys/src/brazil/pc/mem.h /n/emeliedump/1998/0916/sys/src/brazil/pc/mem.h
104c
#define SEGMAPSIZE	1984
#define SSEGMAPSIZE	16
.
53c
#define	USTKSIZE	(16*1024*1024)		/* size of user stack */
.
## diffname pc/mem.h 1999/0101
## diff -e /n/emeliedump/1998/0916/sys/src/brazil/pc/mem.h /n/emeliedump/1999/0101/sys/src/brazil/pc/mem.h
15c
#define ROUND(s, sz)	(((s)+((sz)-1))&~((sz)-1))
.
## diffname pc/mem.h 1999/0205
## diff -e /n/emeliedump/1999/0101/sys/src/brazil/pc/mem.h /n/emeliedump/1999/0205/sys/src/brazil/pc/mem.h
27,28c
#define	MS2TK(t)	(((t)*HZ)/1000)		/* milliseconds to ticks */
.
## diffname pc/mem.h 1999/0207
## diff -e /n/emeliedump/1999/0205/sys/src/brazil/pc/mem.h /n/emeliedump/1999/0207/sys/src/brazil/pc/mem.h
24c
#define	HZ		(82)			/* clock frequency */
.
## diffname pc/mem.h 1999/0522
## diff -e /n/emeliedump/1999/0207/sys/src/brazil/pc/mem.h /n/emeliedump/1999/0522/sys/src/brazil/pc/mem.h
16a
#define BLOCKALIGN	8
.
## diffname pc/mem.h 1999/1022
## diff -e /n/emeliedump/1999/0522/sys/src/brazil/pc/mem.h /n/emeliedump/1999/1022/sys/src/brazil/pc/mem.h
118c
#define	PTESIZE		(1<<7)
.
114c
#define 	PTEWRITE	(1<<1)
.
## diffname pc/mem.h 2000/0705
## diff -e /n/emeliedump/1999/1022/sys/src/brazil/pc/mem.h /n/emeliedump/2000/0705/sys/src/9/pc/mem.h
28c
#define	MS2TK(t)	(((t)*HZ+500)/1000)	/* milliseconds to closest tick */
.
## diffname pc/mem.h 2000/1018
## diff -e /n/emeliedump/2000/0705/sys/src/9/pc/mem.h /n/emeliedump/2000/1018/sys/src/9/pc/mem.h
77a
#define APMCSEL 	SELECTOR(APMCSEG, SELGDT, 0)
#define APMCSEL16	SELECTOR(APMCSEG16, SELGDT, 0)
#define APMDSEL		SELECTOR(APMDSEG, SELGDT, 0)
/* #define APM40SEL	SELECTOR(APM40SEG, SELGDT, 0) */
.
65a
#define	APMCSEG		6	/* APM code segment */
#define	APMCSEG16	7	/* APM 16-bit code segment */
#define	APMDSEG		8	/* APM data segment */
#define NGDT		10	/* number of GDT entries required */
/* #define	APM40SEG	8	/* APM segment 0x40 */
.
## diffname pc/mem.h 2002/0109
## diff -e /n/emeliedump/2000/1018/sys/src/9/pc/mem.h /n/emeliedump/2002/0109/sys/src/9/pc/mem.h
127a

/*
 * Macros for calculating offsets within the page directory base
 * and page tables. 
 */
#define PDX(va)		((((ulong)(va))>>22) & 0x03FF)
#define PTX(va)		((((ulong)(va))>>12) & 0x03FF)
.
79a
#define KESEL	SELECTOR(KESEG, SELGDT, 0)
.
78d
33a
#define	REBOOTADDR	0x00001000		/* reboot code - physical address */
.
## diffname pc/mem.h 2002/0228
## diff -e /n/emeliedump/2002/0109/sys/src/9/pc/mem.h /n/emeliedump/2002/0228/sys/src/9/pc/mem.h
25c
#define	HZ		(100)			/* clock frequency */
.
## diffname pc/mem.h 2002/0326
## diff -e /n/emeliedump/2002/0228/sys/src/9/pc/mem.h /n/emeliedump/2002/0326/sys/src/9/pc/mem.h
28d
## diffname pc/mem.h 2002/0410
## diff -e /n/emeliedump/2002/0326/sys/src/9/pc/mem.h /n/emeliedump/2002/0410/sys/src/9/pc/mem.h
127a
#define	PTEGLOBAL	(1<<8)
.
## diffname pc/mem.h 2002/0412
## diff -e /n/emeliedump/2002/0410/sys/src/9/pc/mem.h /n/emeliedump/2002/0412/sys/src/9/pc/mem.h
137c
#define	getpgcolor(a)	0
.
134,135c
#define	PDX(va)		((((ulong)(va))>>22) & 0x03FF)
#define	PTX(va)		((((ulong)(va))>>12) & 0x03FF)
.
123c
#define	PTEWRITE	(1<<1)
.
113,115c
#define	SEGMAPSIZE	1984
#define	SSEGMAPSIZE	16
#define	PPN(x)		((x)&~(BY2PG-1))
.
111c
#define	PTEMAPMEM	(1024*1024)	
.
106c
#define	SEGD	(1<<22)		/* default 1==32bit (for code) */
.
99,104c
#define	SEGP	(1<<15)		/* segment present */
#define	SEGPL(x) ((x)<<13)	/* priority level */
#define	SEGB	(1<<22)		/* granularity 1==4k (for expand-down) */
#define	SEGG	(1<<23)		/* granularity 1==4k (for other) */
#define	SEGE	(1<<10)		/* expand down */
#define	SEGW	(1<<9)		/* writable (for data/stack) */
.
96,97c
#define	SEGTG	(0x0F<<8)	/* trap gate */
#define	SEGTYPE	(0x1F<<8)
.
94c
#define	SEGCG	(0x0C<<8)	/* call gate */
.
91,92c
#define	SEGDATA	(0x10<<8)	/* data/stack segment */
#define	SEGEXEC	(0x18<<8)	/* executable segment */
.
77,86c
#define	NULLSEL	SELECTOR(NULLSEG, SELGDT, 0)
#define	KDSEL	SELECTOR(KDSEG, SELGDT, 0)
#define	KESEL	SELECTOR(KESEG, SELGDT, 0)
#define	UESEL	SELECTOR(UESEG, SELGDT, 3)
#define	UDSEL	SELECTOR(UDSEG, SELGDT, 3)
#define	TSSSEL	SELECTOR(TSSSEG, SELGDT, 0)
#define	APMCSEL 	SELECTOR(APMCSEG, SELGDT, 0)
#define	APMCSEL16	SELECTOR(APMCSEG16, SELGDT, 0)
#define	APMDSEL		SELECTOR(APMDSEG, SELGDT, 0)
/* #define	APM40SEL	SELECTOR(APM40SEG, SELGDT, 0) */
.
75c
#define	SELECTOR(i, t, p)	(((i)<<3) | (t) | (p))
.
72c
#define	SELGDT	(0<<2)	/* selector is in gdt */
.
69c
#define	NGDT		10	/* number of GDT entries required */
.
65c
#define	TSSSEG	5	/* task segment */
.
55c
#define	TSTKSIZ 	100
.
40a
/*
 * N.B.  ramscan knows that CPU0MACH+BY2PG is the end of reserved data
 * N.B.  _start0x00100020 knows that CPU0PDB is the first reserved page
 * and that there are 5 of them.
 */
.
34,39c
#define	APBOOTSTRAP	0x80001000		/* AP bootstrap code */
#define	CONFADDR	0x80001200		/* info passed from boot loader */
#define	CPU0PDB		0x80002000		/* bootstrap processor PDB */
#define	CPU0PTE		0x80003000		/* bootstrap processor PTE's for 0-4MB */
#define	CPU0GDT		0x80004000		/* bootstrap processor GDT */
#define	MACHADDR	0x80005000		/* as seen by current processor */
#define	CPU0MACH	0x80006000		/* Mach for bootstrap processor */
.
32c
#define	IDTADDR		0x80000800		/* idt */
.
20c
#define	KSTACK		4096			/* Size of kernel stack */
.
15,17c
#define	ROUND(s, sz)	(((s)+((sz)-1))&~((sz)-1))
#define	PGROUND(s)	ROUND(s, BY2PG)
#define	BLOCKALIGN	8
.
9c
#define	BI2WD		32			/* bits per word */
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].