xref: /titanic_44/usr/src/uts/intel/sys/sysi86.h (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*9acbbeafSnn35248  * Common Development and Distribution License (the "License").
6*9acbbeafSnn35248  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*9acbbeafSnn35248  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_SYSI86_H
317c478bd9Sstevel@tonic-gate #define	_SYS_SYSI86_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef DIRSIZ
407c478bd9Sstevel@tonic-gate #define	DIRSIZ	14
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Commands for sysi86 system call (1-?)
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define	SI86SWPI	1	/* General swap interface. */
487c478bd9Sstevel@tonic-gate #define	SI86SYM		2	/* acquire boot-built symbol table */
497c478bd9Sstevel@tonic-gate #define	SI86CONF	4	/* acquire boot-built configuration table */
507c478bd9Sstevel@tonic-gate #define	SI86BOOT	5	/* acquire timestamp and name of program */
517c478bd9Sstevel@tonic-gate 				/*	booted */
527c478bd9Sstevel@tonic-gate #define	SI86AUTO	9	/* was an auto-config boot done? */
537c478bd9Sstevel@tonic-gate #define	SI86EDT		10	/* copy contents of EDT to user */
547c478bd9Sstevel@tonic-gate #define	SI86SWAP	12	/* Declare swap space */
557c478bd9Sstevel@tonic-gate #define	SI86FPHW	40	/* what (if any?) floating-point hardware */
567c478bd9Sstevel@tonic-gate #define	SI86FPSTART	41	/* extended version of SI86FPHW */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	GRNON		52	/* set green light to solid on state */
597c478bd9Sstevel@tonic-gate #define	GRNFLASH	53	/* start green light flashing */
607c478bd9Sstevel@tonic-gate #define	STIME		54	/* set internal time */
617c478bd9Sstevel@tonic-gate #define	SETNAME		56	/* rename the system */
627c478bd9Sstevel@tonic-gate #define	RNVR		58	/* read NVRAM */
637c478bd9Sstevel@tonic-gate #define	WNVR		59	/* write NVRAM */
647c478bd9Sstevel@tonic-gate #define	RTODC		60	/* read time of day clock */
657c478bd9Sstevel@tonic-gate #define	CHKSER		61	/* check soft serial number */
667c478bd9Sstevel@tonic-gate #define	SI86NVPRT	62	/* print an xtra_nvr structure */
677c478bd9Sstevel@tonic-gate #define	SANUPD		63	/* sanity update of kernel buffers */
687c478bd9Sstevel@tonic-gate #define	SI86KSTR	64	/* make a copy of a kernel string */
697c478bd9Sstevel@tonic-gate #define	SI86MEM		65	/* return the memory size of system */
707c478bd9Sstevel@tonic-gate #define	SI86TODEMON	66	/* Transfer control to firmware. */
717c478bd9Sstevel@tonic-gate #define	SI86CCDEMON	67	/* Control character access to demon. */
727c478bd9Sstevel@tonic-gate #define	SI86CACHE	68	/* Turn cache on and off. */
737c478bd9Sstevel@tonic-gate #define	SI86DELMEM	69	/* Delete available memory for testing. */
747c478bd9Sstevel@tonic-gate #define	SI86ADDMEM	70	/* Add back deleted memory. */
757c478bd9Sstevel@tonic-gate /*	71 through 74 reserved for VPIX */
767c478bd9Sstevel@tonic-gate #define	SI86V86		71	/* V86 system calls (see below) */
777c478bd9Sstevel@tonic-gate #define	SI86SLTIME	72	/* Set local time correction */
787c478bd9Sstevel@tonic-gate #define	SI86DSCR	75	/* Set a segment or gate descriptor */
797c478bd9Sstevel@tonic-gate #define	RDUBLK		76	/* Read U Block */
807c478bd9Sstevel@tonic-gate /* NFA entry point */
817c478bd9Sstevel@tonic-gate #define	SI86NFA		77	/* make nfa_sys system call */
827c478bd9Sstevel@tonic-gate #define	SI86VM86	81
837c478bd9Sstevel@tonic-gate #define	SI86VMENABLE	82
847c478bd9Sstevel@tonic-gate #define	SI86LIMUSER	91	/* license interface */
857c478bd9Sstevel@tonic-gate #define	SI86RDID	92	/* ROM BIOS Machid ID */
867c478bd9Sstevel@tonic-gate #define	SI86RDBOOT	93	/* Bootable Non-SCSI Hard Disk */
877c478bd9Sstevel@tonic-gate /* XENIX Support */
887c478bd9Sstevel@tonic-gate #define	SI86SHFIL	100	/* map a file into addr space of a proc */
897c478bd9Sstevel@tonic-gate #define	SI86PCHRGN	101	/* make globally visible change to a region */
907c478bd9Sstevel@tonic-gate #define	SI86BADVISE	102	/* badvise subcommand - see below for */
917c478bd9Sstevel@tonic-gate 				/*	badvise subfunction definitions */
927c478bd9Sstevel@tonic-gate #define	SI86SHRGN	103	/* enable/disable XENIX small model shared */
937c478bd9Sstevel@tonic-gate 				/*	data context switching */
947c478bd9Sstevel@tonic-gate #define	SI86CHIDT	104	/* set user level int 0xf0, ... 0xff handlers */
957c478bd9Sstevel@tonic-gate #define	SI86EMULRDA	105	/* remove special emulator read access */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  *	NOTE: Numbers 106 - 110 have been registered and are reserved
997c478bd9Sstevel@tonic-gate  *	for future use for AT&T hardware.
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  *	Commands for allowing the real time clock to keep local time.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #define	WTODC		111	/* write tod clock */
1077c478bd9Sstevel@tonic-gate #define	SGMTL		112	/* set GMT lag */
1087c478bd9Sstevel@tonic-gate #define	GGMTL		113	/* get GMT lag */
1097c478bd9Sstevel@tonic-gate #define	RTCSYNC		114	/* set UNIX 'time' based on RTC and GMT lag */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #define	V86SC_IOPL	4	/* The only supported V86 system call */
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /*
1147c478bd9Sstevel@tonic-gate  *  The SI86DSCR subcommand of the sysi86() system call
1157c478bd9Sstevel@tonic-gate  *  sets a segment or gate descriptor in the kernel.
1167c478bd9Sstevel@tonic-gate  *  The following descriptor types are accepted:
1177c478bd9Sstevel@tonic-gate  *    - executable and data segments in the LDT at DPL 3
1187c478bd9Sstevel@tonic-gate  *    - a call gate in the GDT at DPL 3 that points to a segment in the LDT
1197c478bd9Sstevel@tonic-gate  *  The request structure declared below is used to pass the values
1207c478bd9Sstevel@tonic-gate  *  to be placed in the descriptor.  A pointer to the structure is
1217c478bd9Sstevel@tonic-gate  *  passed as the second argument of the system call.
1227c478bd9Sstevel@tonic-gate  *  If acc1 is zero, the descriptor is cleared.
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate /*
1267c478bd9Sstevel@tonic-gate  * XX64 Do we need to support this for 64-bit apps?
1277c478bd9Sstevel@tonic-gate  *
1287c478bd9Sstevel@tonic-gate  * request structure passed by user
1297c478bd9Sstevel@tonic-gate  */
1307c478bd9Sstevel@tonic-gate struct ssd {
1317c478bd9Sstevel@tonic-gate 	unsigned int	sel;   /* descriptor selector */
1327c478bd9Sstevel@tonic-gate 	unsigned int	bo;    /* segment base or gate offset */
1337c478bd9Sstevel@tonic-gate 	unsigned int	ls;    /* segment limit or gate selector */
1347c478bd9Sstevel@tonic-gate 	unsigned int	acc1;  /* access byte 5 */
1357c478bd9Sstevel@tonic-gate 	unsigned int	acc2;  /* access bits in byte 6 or gate count */
1367c478bd9Sstevel@tonic-gate };
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #define	SI86SSD_TYPE(ssd)	((ssd)->acc1 & 0x1F)
1397c478bd9Sstevel@tonic-gate #define	SI86SSD_DPL(ssd)	(((ssd)->acc1 >> 5) & 0x3)
1407c478bd9Sstevel@tonic-gate #define	SI86SSD_PRES(ssd)	(((ssd)->acc1 >> 7) & 1)
1417c478bd9Sstevel@tonic-gate #define	SI86SSD_ISUSEG(ssd)	(SI86SSD_TYPE(ssd) >= SDT_MEMRO)
1427c478bd9Sstevel@tonic-gate #define	SI86SSD_ISLONG(ssd)	((ssd)->acc2 & 0x2)
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #ifdef _KERNEL
1457c478bd9Sstevel@tonic-gate extern void usd_to_ssd(user_desc_t *, struct ssd *, selector_t);
146*9acbbeafSnn35248 extern int setdscr(struct ssd *);
1477c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate /*
1507c478bd9Sstevel@tonic-gate  *  The SI86SHFIL subcommand of the sysi86() system call
1517c478bd9Sstevel@tonic-gate  *  maps a file into a region in user address space.
1527c478bd9Sstevel@tonic-gate  *  The request structure declared below is used to pass the
1537c478bd9Sstevel@tonic-gate  *  system call parameters.  A pointer to the structure is
1547c478bd9Sstevel@tonic-gate  *  passed as the second argument of the system call.
1557c478bd9Sstevel@tonic-gate  */
1567c478bd9Sstevel@tonic-gate struct mmf {
1577c478bd9Sstevel@tonic-gate 	char	*mf_filename;	/* path name of file */
1587c478bd9Sstevel@tonic-gate 	long	mf_filesz;	/* Size in bytes of section of file */
1597c478bd9Sstevel@tonic-gate 				/* from which this region is mapped. */
1607c478bd9Sstevel@tonic-gate 	long	mf_regsz;	/* Size of region in bytes */
1617c478bd9Sstevel@tonic-gate 	short	mf_flags;	/* Either 0 or RG_NOSHARE */
1627c478bd9Sstevel@tonic-gate };
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate /*
1657c478bd9Sstevel@tonic-gate  *  The SI86PCHRGN subcommand of the sysi86() system call
1667c478bd9Sstevel@tonic-gate  *  change the memory mapped image of a file.
1677c478bd9Sstevel@tonic-gate  *  The request structure declared below is used to pass the values
1687c478bd9Sstevel@tonic-gate  *  system call parameters.  A pointer to the structure is
1697c478bd9Sstevel@tonic-gate  *  passed as the second argument of the system call.
1707c478bd9Sstevel@tonic-gate  */
1717c478bd9Sstevel@tonic-gate struct cmf {
1727c478bd9Sstevel@tonic-gate 	char	*cf_srcva;	/* modified image address */
1737c478bd9Sstevel@tonic-gate 	char	*cf_dstva;	/* location to patch */
1747c478bd9Sstevel@tonic-gate 	long	cf_count;	/* size of patch */
1757c478bd9Sstevel@tonic-gate };
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * The SI86BADVISE subcommand of the sysi86() system call specifies
1797c478bd9Sstevel@tonic-gate  * XENIX variant behavior for certain system calls and kernel routines.
1807c478bd9Sstevel@tonic-gate  * The 'arg' argument of sysi86() for SI86BADVISE is an integer.  Bits
1817c478bd9Sstevel@tonic-gate  * 8..15 specify SI86B_SET or SI86B_GET.  Bits 0..7 contain
1827c478bd9Sstevel@tonic-gate  * SI86B_PRE_SV, SI86B_XOUT, or SI86B_XSDSWTCH.  All these constants are
1837c478bd9Sstevel@tonic-gate  * defined below.  The 'arg' argument thus consists of either SI86B_SET
1847c478bd9Sstevel@tonic-gate  * OR'ed with zero or more of SI86B_PRE_SV, SI86B_XOUT, and SI86B_XSDSWTCH,
1857c478bd9Sstevel@tonic-gate  * or of SI86B_GET.
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate #define	SI86B_SET		0x0100	/* set badvise bits */
1887c478bd9Sstevel@tonic-gate #define	SI86B_GET		0x0200	/* retrieve badvise bits */
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate #define	SI86B_PRE_SV		0x0008	/* follow pre-System V x.out behavior */
1917c478bd9Sstevel@tonic-gate #define	SI86B_XOUT		0x0010 	/* follow XENIX x.out behavior */
1927c478bd9Sstevel@tonic-gate #define	SI86B_XSDSWTCH		0x0080	/* XENIX small model shared data */
1937c478bd9Sstevel@tonic-gate 					/*	context switching enabled */
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate /*
1967c478bd9Sstevel@tonic-gate  *   The request structure declared below is used by the XENIX 286 emulator
1977c478bd9Sstevel@tonic-gate  *   (/bin/x286emul) in conjunction with the SI86SHRGN subcommand of sysi86().
1987c478bd9Sstevel@tonic-gate  *   The SI86SHRGN subcommand is used by the XENIX 286 emulator to support
1997c478bd9Sstevel@tonic-gate  *   XENIX shared data.  The second argument passed to sysi86() is a
2007c478bd9Sstevel@tonic-gate  *   pointer to an xsdbuf struct.
2017c478bd9Sstevel@tonic-gate  *
2027c478bd9Sstevel@tonic-gate  *   If the 'xsd_cmd' field of xsdbuf is SI86SHR_CP, the XENIX 286 emulator is
2037c478bd9Sstevel@tonic-gate  *   using the SI86SHRGN subcommand to set up XENIX small model shared data
2047c478bd9Sstevel@tonic-gate  *   context switching support for a given XENIX shared data segment.  In this
2057c478bd9Sstevel@tonic-gate  *   case, the xsdbuf struct contains the start addr for the shared data in
2067c478bd9Sstevel@tonic-gate  *   386 space, followed by the start addr for the shared data in the 286
2077c478bd9Sstevel@tonic-gate  *   executable's private data.
2087c478bd9Sstevel@tonic-gate  *
2097c478bd9Sstevel@tonic-gate  *   If the 'xsd_cmd' field is SI86SHR_SZ, the XENIX 286 emulator is using the
2107c478bd9Sstevel@tonic-gate  *   SI86SHRGN subcommand to retrieve the size of an existing XENIX shared
2117c478bd9Sstevel@tonic-gate  *   data segment.  In this case, the xsdbuf struct contains the start addr
2127c478bd9Sstevel@tonic-gate  *   for the shared data in 386 space.
2137c478bd9Sstevel@tonic-gate  *   The size of the shared data segment starting at 'xsd_386vaddr' will
2147c478bd9Sstevel@tonic-gate  *   be returned in the 'xsd_size' field by sysi86().
2157c478bd9Sstevel@tonic-gate  */
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate #define	SI86SHR_CP	0x1	/* SI86SHRGN used for XENIX sd context switch */
2187c478bd9Sstevel@tonic-gate #define	SI86SHR_SZ	0x2	/* SI86SHRGN used to get XENIX sd seg size */
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate struct xsdbuf {
2217c478bd9Sstevel@tonic-gate 	unsigned xsd_cmd;	/* SI86SHRGN subcommand, either SI86SHR_CP */
2227c478bd9Sstevel@tonic-gate 				/* or SI86SHR_SZ. */
2237c478bd9Sstevel@tonic-gate 	char	*xsd_386vaddr;	/* Addr of "real" XENIX shared data seg in */
2247c478bd9Sstevel@tonic-gate 				/* the emulator. */
2257c478bd9Sstevel@tonic-gate 	union {
2267c478bd9Sstevel@tonic-gate 		char	*xsd_286vaddr;	/* Addr of XENIX shared data seg */
2277c478bd9Sstevel@tonic-gate 					/* in the 286 data portion of the */
2287c478bd9Sstevel@tonic-gate 					/* emulator. */
2297c478bd9Sstevel@tonic-gate 		unsigned long xsd_size;	/* Size of XENIX shared data seg */
2307c478bd9Sstevel@tonic-gate 	} xsd_un;
2317c478bd9Sstevel@tonic-gate };
2327c478bd9Sstevel@tonic-gate /* End XENIX Support */
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate /*
2357c478bd9Sstevel@tonic-gate  * Cascade defines
2367c478bd9Sstevel@tonic-gate  */
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate #define	C2	'E'
2397c478bd9Sstevel@tonic-gate #define	C3	'F'
2407c478bd9Sstevel@tonic-gate #define	C4	'G'
2417c478bd9Sstevel@tonic-gate #define	C6	'K'
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /* Enterprise IDNO defines */
2447c478bd9Sstevel@tonic-gate #define	E8R1	'R'
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate #ifndef _KERNEL
2477c478bd9Sstevel@tonic-gate #ifdef __STDC__
2487c478bd9Sstevel@tonic-gate extern	int	sysi86(int, ...);
2497c478bd9Sstevel@tonic-gate #else
2507c478bd9Sstevel@tonic-gate extern	int	sysi86();
2517c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
2527c478bd9Sstevel@tonic-gate #endif	/* !_KERNEL */
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2557c478bd9Sstevel@tonic-gate }
2567c478bd9Sstevel@tonic-gate #endif
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate #endif	/* _SYS_SYSI86_H */
259