DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦c75d90fd5⟧ TextFile

    Length: 4962 (0x1362)
    Types: TextFile
    Notes: UNIX file
    Names: »seg.h«

Derivation

└─⟦a6ab2eb36⟧ Bits:30004042/kconfig3.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦a6ab2eb36⟧ UNIX Filesystem
    └─⟦this⟧ »kc/new/usr/include/sys/seg.h« 

TextFile

/*	Copyright (c) 1987 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident "@(#)seg.h	1.10 - 87/07/31"

/*
 * The segment structure is prototype and place holder for segment descriptors
 * s_base contains the 32 bit base field of the descriptor.
 * s_limacc contains 20 limit bits and 12 accbits in this order
 *
 * 0                      19  20  21      22   23   24  25,26 27-31
 * _____________________________________________________________________________
 * |                                                                           |
 * |   20 bit limit field   | G | B or D | 0 | AVL | P | DPL | Other Attributes|
 * |___________________________________________________________________________|
 * 
 *	The structure gets fixed up at run time to look like a descriptor
 *
 */

/* segment */
struct seg_desc {
	unsigned long s_base;	/* segment base */
	unsigned long s_limacc;	/* 4 limit and access bytes */
};

/* descriptor */
struct dscr {
	unsigned int	a_lim0015:16,
		 	a_base0015:16,
		  	a_base1623:8,
			a_acc0007:8,
			a_lim1619:4,
			a_acc0811:4,
			a_base2431:8;
};

/* access rights for data segments */ 
#define UDATA_ACC1	0xF2 	/* present dpl=3 writable */
#define KDATA_ACC1	0x92	/* present dpl=0 writable */
#define DATA_ACC2	0xC	/* 1byte gran. 4Gb limit avl=0 */
#define UTEXT_ACC1	0xFA 	/* present dpl=3 readable */
#define KTEXT_ACC1	0x9A 	/* present dpl=0 readable */
#define TEXT_ACC2	0xC	/* 1byte gran., 32 bit operands avl=0 */
#define LDT_UACC1	0xE2	/* present dpl=3 type=ldt */
#define LDT_KACC1	0x82	/* present dpl=0 type=ldt */
#define LDT_ACC2	0x0	/* G=0 avl=0*/
#define TSS3_KACC1	0x89 	/* present dpl=0 type=available 386 TSS */
#define TSS3_KBACC1     0x8B    /* present dpl=0 type=busy 386 TSS      */
#define	TSS2_KACC1	0x81 	/* present dpl=0 type=available 286 TSS */
#define TSS3_UACC1	0xE9 	/* present dpl=3 type=available 386 TSS */
#define TGATE_UACC1     0xE5    /* present dpl=3 type=task gate         */
#define	TSS2_UACC1	0xE1 	/* present dpl=3 type=available 286 TSS */
#define TSS_ACC2	0x0	/* g=0 avl=0 */

#define MKDSCR(base, limit, acc1, acc2) {(long)base, ((long)limit|(acc2<<20)|(acc1<<24))}

/* selector definitions */
/*#define LDTSEL		0x58	/* LDT for the current process */
#define LDTSEL		0x140	/* LDT for the current process */
/*#define UTSSSEL		0x60	/* TSS for the current process */
#define UTSSSEL		0x148	/* TSS for the current process */
/*#define KTSSSEL 	0x68	/* TSS for the scheduler */
#define KTSSSEL 	0x150	/* TSS for the scheduler */
/*#define KCSSEL		0x70	/* kernel code segment selector */
#define KCSSEL		0x158	/* kernel code segment selector */
/*#define KDSSEL		0x78	/* kernel data segment selector */
#define KDSSEL		0x160	/* kernel data segment selector */
/*#define DFTSSSEL	0x80	/* TSS for double fault handler */
#define DFTSSSEL	0x168	/* TSS for double fault handler */
/*#define JTSSSEL		0x88	/* Junk TSS to jump thru */
#define JTSSSEL		0x170
#define MON1SEL		0x178	/* Selector to get to monitor int 1 handler */
#define MON3SEL		0x180	/* Selector to get to monitor int 3 handler */
#ifdef VPIX
#define XTSSSEL         0x188   /* XTSS for dual-mode processes */
#endif

/* user selectors */
#define	USER_CS		0x17	/* user's code segment */
#define	USER_DS		0x1F	/* user's data segment */
#define	USER_SCALL	0x07	/* call gate for system calls */
#define	USER_SIGCALL	0x0F	/* call gate for sigreturn */

#define IDTSZ		256
#define MONIDTSZ	16
#define LDTSZ           256
#define GDTSZ           90

#define KTBASE          0xC0008000
#define KDBASE          0xC0068000

/*
 *  Call/Interrupt/Trap Gate table descriptions
 *
 *	This is the structure used for declaration of Gates.
 *	If this is changed in any way, the code in uprt.s
 *	must be changed to match.  It is especially important
 *	that the type byte be in the last position so that the
 *	real mode start up code can determine if the gate is
 *	intended to be a gate or segment descriptor.
 */

struct gate_desc {
	unsigned long  g_off;		/* offset */
	unsigned short g_sel;		/* selector */
	unsigned char  g_wcount;	/* word count */
	unsigned char  g_type;		/* type of gate and access rights */
};
 
/* access rights field for gates */

#define GATE_UACC	0xE0		/* present and dpl = 3 */
#define GATE_KACC	0x80		/* present and dpl = 0 */
#define GATE_386CALL	0xC		/* 386 call gate */
#define GATE_386INT	0xE		/* 386 int gate */
#define GATE_386TRP	0xF		/* 386 trap gate */
#define GATE_TSS	0x5		/* Task gate */

/* make an interrupt gate */
#define MKINTG(rtn) {(long)rtn,(short)KCSSEL,(char)0,(char)(GATE_KACC|GATE_386INT)} 
#define MKKTRPG(rtn) {(long)rtn,(short)KCSSEL,(char)0,(char)(GATE_KACC|GATE_386TRP)} 
#define MKUTRPG(rtn) {(long)rtn,(short)KCSSEL,(char)0,(char)(GATE_UACC|GATE_386TRP)} 

#define	seltoi(sel)		((unsigned short)(sel) >> 3)