1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 28*0Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 29*0Sstevel@tonic-gate /* All Rights Reserved */ 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate #ifndef _SYS_SYSI86_H 32*0Sstevel@tonic-gate #define _SYS_SYSI86_H 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #ifdef __cplusplus 37*0Sstevel@tonic-gate extern "C" { 38*0Sstevel@tonic-gate #endif 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate #ifndef DIRSIZ 41*0Sstevel@tonic-gate #define DIRSIZ 14 42*0Sstevel@tonic-gate #endif 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate /* 45*0Sstevel@tonic-gate * Commands for sysi86 system call (1-?) 46*0Sstevel@tonic-gate */ 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate #define SI86SWPI 1 /* General swap interface. */ 49*0Sstevel@tonic-gate #define SI86SYM 2 /* acquire boot-built symbol table */ 50*0Sstevel@tonic-gate #define SI86CONF 4 /* acquire boot-built configuration table */ 51*0Sstevel@tonic-gate #define SI86BOOT 5 /* acquire timestamp and name of program */ 52*0Sstevel@tonic-gate /* booted */ 53*0Sstevel@tonic-gate #define SI86AUTO 9 /* was an auto-config boot done? */ 54*0Sstevel@tonic-gate #define SI86EDT 10 /* copy contents of EDT to user */ 55*0Sstevel@tonic-gate #define SI86SWAP 12 /* Declare swap space */ 56*0Sstevel@tonic-gate #define SI86FPHW 40 /* what (if any?) floating-point hardware */ 57*0Sstevel@tonic-gate #define SI86FPSTART 41 /* extended version of SI86FPHW */ 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate #define GRNON 52 /* set green light to solid on state */ 60*0Sstevel@tonic-gate #define GRNFLASH 53 /* start green light flashing */ 61*0Sstevel@tonic-gate #define STIME 54 /* set internal time */ 62*0Sstevel@tonic-gate #define SETNAME 56 /* rename the system */ 63*0Sstevel@tonic-gate #define RNVR 58 /* read NVRAM */ 64*0Sstevel@tonic-gate #define WNVR 59 /* write NVRAM */ 65*0Sstevel@tonic-gate #define RTODC 60 /* read time of day clock */ 66*0Sstevel@tonic-gate #define CHKSER 61 /* check soft serial number */ 67*0Sstevel@tonic-gate #define SI86NVPRT 62 /* print an xtra_nvr structure */ 68*0Sstevel@tonic-gate #define SANUPD 63 /* sanity update of kernel buffers */ 69*0Sstevel@tonic-gate #define SI86KSTR 64 /* make a copy of a kernel string */ 70*0Sstevel@tonic-gate #define SI86MEM 65 /* return the memory size of system */ 71*0Sstevel@tonic-gate #define SI86TODEMON 66 /* Transfer control to firmware. */ 72*0Sstevel@tonic-gate #define SI86CCDEMON 67 /* Control character access to demon. */ 73*0Sstevel@tonic-gate #define SI86CACHE 68 /* Turn cache on and off. */ 74*0Sstevel@tonic-gate #define SI86DELMEM 69 /* Delete available memory for testing. */ 75*0Sstevel@tonic-gate #define SI86ADDMEM 70 /* Add back deleted memory. */ 76*0Sstevel@tonic-gate /* 71 through 74 reserved for VPIX */ 77*0Sstevel@tonic-gate #define SI86V86 71 /* V86 system calls (see below) */ 78*0Sstevel@tonic-gate #define SI86SLTIME 72 /* Set local time correction */ 79*0Sstevel@tonic-gate #define SI86DSCR 75 /* Set a segment or gate descriptor */ 80*0Sstevel@tonic-gate #define RDUBLK 76 /* Read U Block */ 81*0Sstevel@tonic-gate /* NFA entry point */ 82*0Sstevel@tonic-gate #define SI86NFA 77 /* make nfa_sys system call */ 83*0Sstevel@tonic-gate #define SI86VM86 81 84*0Sstevel@tonic-gate #define SI86VMENABLE 82 85*0Sstevel@tonic-gate #define SI86LIMUSER 91 /* license interface */ 86*0Sstevel@tonic-gate #define SI86RDID 92 /* ROM BIOS Machid ID */ 87*0Sstevel@tonic-gate #define SI86RDBOOT 93 /* Bootable Non-SCSI Hard Disk */ 88*0Sstevel@tonic-gate /* XENIX Support */ 89*0Sstevel@tonic-gate #define SI86SHFIL 100 /* map a file into addr space of a proc */ 90*0Sstevel@tonic-gate #define SI86PCHRGN 101 /* make globally visible change to a region */ 91*0Sstevel@tonic-gate #define SI86BADVISE 102 /* badvise subcommand - see below for */ 92*0Sstevel@tonic-gate /* badvise subfunction definitions */ 93*0Sstevel@tonic-gate #define SI86SHRGN 103 /* enable/disable XENIX small model shared */ 94*0Sstevel@tonic-gate /* data context switching */ 95*0Sstevel@tonic-gate #define SI86CHIDT 104 /* set user level int 0xf0, ... 0xff handlers */ 96*0Sstevel@tonic-gate #define SI86EMULRDA 105 /* remove special emulator read access */ 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate /* 99*0Sstevel@tonic-gate * NOTE: Numbers 106 - 110 have been registered and are reserved 100*0Sstevel@tonic-gate * for future use for AT&T hardware. 101*0Sstevel@tonic-gate */ 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate /* 104*0Sstevel@tonic-gate * Commands for allowing the real time clock to keep local time. 105*0Sstevel@tonic-gate */ 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate #define WTODC 111 /* write tod clock */ 108*0Sstevel@tonic-gate #define SGMTL 112 /* set GMT lag */ 109*0Sstevel@tonic-gate #define GGMTL 113 /* get GMT lag */ 110*0Sstevel@tonic-gate #define RTCSYNC 114 /* set UNIX 'time' based on RTC and GMT lag */ 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #define V86SC_IOPL 4 /* The only supported V86 system call */ 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate /* 115*0Sstevel@tonic-gate * The SI86DSCR subcommand of the sysi86() system call 116*0Sstevel@tonic-gate * sets a segment or gate descriptor in the kernel. 117*0Sstevel@tonic-gate * The following descriptor types are accepted: 118*0Sstevel@tonic-gate * - executable and data segments in the LDT at DPL 3 119*0Sstevel@tonic-gate * - a call gate in the GDT at DPL 3 that points to a segment in the LDT 120*0Sstevel@tonic-gate * The request structure declared below is used to pass the values 121*0Sstevel@tonic-gate * to be placed in the descriptor. A pointer to the structure is 122*0Sstevel@tonic-gate * passed as the second argument of the system call. 123*0Sstevel@tonic-gate * If acc1 is zero, the descriptor is cleared. 124*0Sstevel@tonic-gate */ 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gate /* 127*0Sstevel@tonic-gate * XX64 Do we need to support this for 64-bit apps? 128*0Sstevel@tonic-gate * 129*0Sstevel@tonic-gate * request structure passed by user 130*0Sstevel@tonic-gate */ 131*0Sstevel@tonic-gate struct ssd { 132*0Sstevel@tonic-gate unsigned int sel; /* descriptor selector */ 133*0Sstevel@tonic-gate unsigned int bo; /* segment base or gate offset */ 134*0Sstevel@tonic-gate unsigned int ls; /* segment limit or gate selector */ 135*0Sstevel@tonic-gate unsigned int acc1; /* access byte 5 */ 136*0Sstevel@tonic-gate unsigned int acc2; /* access bits in byte 6 or gate count */ 137*0Sstevel@tonic-gate }; 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate #define SI86SSD_TYPE(ssd) ((ssd)->acc1 & 0x1F) 140*0Sstevel@tonic-gate #define SI86SSD_DPL(ssd) (((ssd)->acc1 >> 5) & 0x3) 141*0Sstevel@tonic-gate #define SI86SSD_PRES(ssd) (((ssd)->acc1 >> 7) & 1) 142*0Sstevel@tonic-gate #define SI86SSD_ISUSEG(ssd) (SI86SSD_TYPE(ssd) >= SDT_MEMRO) 143*0Sstevel@tonic-gate #define SI86SSD_ISLONG(ssd) ((ssd)->acc2 & 0x2) 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate #ifdef _KERNEL 146*0Sstevel@tonic-gate extern void usd_to_ssd(user_desc_t *, struct ssd *, selector_t); 147*0Sstevel@tonic-gate #endif /* _KERNEL */ 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate /* 150*0Sstevel@tonic-gate * The SI86SHFIL subcommand of the sysi86() system call 151*0Sstevel@tonic-gate * maps a file into a region in user address space. 152*0Sstevel@tonic-gate * The request structure declared below is used to pass the 153*0Sstevel@tonic-gate * system call parameters. A pointer to the structure is 154*0Sstevel@tonic-gate * passed as the second argument of the system call. 155*0Sstevel@tonic-gate */ 156*0Sstevel@tonic-gate struct mmf { 157*0Sstevel@tonic-gate char *mf_filename; /* path name of file */ 158*0Sstevel@tonic-gate long mf_filesz; /* Size in bytes of section of file */ 159*0Sstevel@tonic-gate /* from which this region is mapped. */ 160*0Sstevel@tonic-gate long mf_regsz; /* Size of region in bytes */ 161*0Sstevel@tonic-gate short mf_flags; /* Either 0 or RG_NOSHARE */ 162*0Sstevel@tonic-gate }; 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate /* 165*0Sstevel@tonic-gate * The SI86PCHRGN subcommand of the sysi86() system call 166*0Sstevel@tonic-gate * change the memory mapped image of a file. 167*0Sstevel@tonic-gate * The request structure declared below is used to pass the values 168*0Sstevel@tonic-gate * system call parameters. A pointer to the structure is 169*0Sstevel@tonic-gate * passed as the second argument of the system call. 170*0Sstevel@tonic-gate */ 171*0Sstevel@tonic-gate struct cmf { 172*0Sstevel@tonic-gate char *cf_srcva; /* modified image address */ 173*0Sstevel@tonic-gate char *cf_dstva; /* location to patch */ 174*0Sstevel@tonic-gate long cf_count; /* size of patch */ 175*0Sstevel@tonic-gate }; 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate /* 178*0Sstevel@tonic-gate * The SI86BADVISE subcommand of the sysi86() system call specifies 179*0Sstevel@tonic-gate * XENIX variant behavior for certain system calls and kernel routines. 180*0Sstevel@tonic-gate * The 'arg' argument of sysi86() for SI86BADVISE is an integer. Bits 181*0Sstevel@tonic-gate * 8..15 specify SI86B_SET or SI86B_GET. Bits 0..7 contain 182*0Sstevel@tonic-gate * SI86B_PRE_SV, SI86B_XOUT, or SI86B_XSDSWTCH. All these constants are 183*0Sstevel@tonic-gate * defined below. The 'arg' argument thus consists of either SI86B_SET 184*0Sstevel@tonic-gate * OR'ed with zero or more of SI86B_PRE_SV, SI86B_XOUT, and SI86B_XSDSWTCH, 185*0Sstevel@tonic-gate * or of SI86B_GET. 186*0Sstevel@tonic-gate */ 187*0Sstevel@tonic-gate #define SI86B_SET 0x0100 /* set badvise bits */ 188*0Sstevel@tonic-gate #define SI86B_GET 0x0200 /* retrieve badvise bits */ 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate #define SI86B_PRE_SV 0x0008 /* follow pre-System V x.out behavior */ 191*0Sstevel@tonic-gate #define SI86B_XOUT 0x0010 /* follow XENIX x.out behavior */ 192*0Sstevel@tonic-gate #define SI86B_XSDSWTCH 0x0080 /* XENIX small model shared data */ 193*0Sstevel@tonic-gate /* context switching enabled */ 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate /* 196*0Sstevel@tonic-gate * The request structure declared below is used by the XENIX 286 emulator 197*0Sstevel@tonic-gate * (/bin/x286emul) in conjunction with the SI86SHRGN subcommand of sysi86(). 198*0Sstevel@tonic-gate * The SI86SHRGN subcommand is used by the XENIX 286 emulator to support 199*0Sstevel@tonic-gate * XENIX shared data. The second argument passed to sysi86() is a 200*0Sstevel@tonic-gate * pointer to an xsdbuf struct. 201*0Sstevel@tonic-gate * 202*0Sstevel@tonic-gate * If the 'xsd_cmd' field of xsdbuf is SI86SHR_CP, the XENIX 286 emulator is 203*0Sstevel@tonic-gate * using the SI86SHRGN subcommand to set up XENIX small model shared data 204*0Sstevel@tonic-gate * context switching support for a given XENIX shared data segment. In this 205*0Sstevel@tonic-gate * case, the xsdbuf struct contains the start addr for the shared data in 206*0Sstevel@tonic-gate * 386 space, followed by the start addr for the shared data in the 286 207*0Sstevel@tonic-gate * executable's private data. 208*0Sstevel@tonic-gate * 209*0Sstevel@tonic-gate * If the 'xsd_cmd' field is SI86SHR_SZ, the XENIX 286 emulator is using the 210*0Sstevel@tonic-gate * SI86SHRGN subcommand to retrieve the size of an existing XENIX shared 211*0Sstevel@tonic-gate * data segment. In this case, the xsdbuf struct contains the start addr 212*0Sstevel@tonic-gate * for the shared data in 386 space. 213*0Sstevel@tonic-gate * The size of the shared data segment starting at 'xsd_386vaddr' will 214*0Sstevel@tonic-gate * be returned in the 'xsd_size' field by sysi86(). 215*0Sstevel@tonic-gate */ 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate #define SI86SHR_CP 0x1 /* SI86SHRGN used for XENIX sd context switch */ 218*0Sstevel@tonic-gate #define SI86SHR_SZ 0x2 /* SI86SHRGN used to get XENIX sd seg size */ 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate struct xsdbuf { 221*0Sstevel@tonic-gate unsigned xsd_cmd; /* SI86SHRGN subcommand, either SI86SHR_CP */ 222*0Sstevel@tonic-gate /* or SI86SHR_SZ. */ 223*0Sstevel@tonic-gate char *xsd_386vaddr; /* Addr of "real" XENIX shared data seg in */ 224*0Sstevel@tonic-gate /* the emulator. */ 225*0Sstevel@tonic-gate union { 226*0Sstevel@tonic-gate char *xsd_286vaddr; /* Addr of XENIX shared data seg */ 227*0Sstevel@tonic-gate /* in the 286 data portion of the */ 228*0Sstevel@tonic-gate /* emulator. */ 229*0Sstevel@tonic-gate unsigned long xsd_size; /* Size of XENIX shared data seg */ 230*0Sstevel@tonic-gate } xsd_un; 231*0Sstevel@tonic-gate }; 232*0Sstevel@tonic-gate /* End XENIX Support */ 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate /* 235*0Sstevel@tonic-gate * Cascade defines 236*0Sstevel@tonic-gate */ 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate #define C2 'E' 239*0Sstevel@tonic-gate #define C3 'F' 240*0Sstevel@tonic-gate #define C4 'G' 241*0Sstevel@tonic-gate #define C6 'K' 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate /* Enterprise IDNO defines */ 244*0Sstevel@tonic-gate #define E8R1 'R' 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate #ifndef _KERNEL 247*0Sstevel@tonic-gate #ifdef __STDC__ 248*0Sstevel@tonic-gate extern int sysi86(int, ...); 249*0Sstevel@tonic-gate #else 250*0Sstevel@tonic-gate extern int sysi86(); 251*0Sstevel@tonic-gate #endif /* __STDC__ */ 252*0Sstevel@tonic-gate #endif /* !_KERNEL */ 253*0Sstevel@tonic-gate 254*0Sstevel@tonic-gate #ifdef __cplusplus 255*0Sstevel@tonic-gate } 256*0Sstevel@tonic-gate #endif 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate #endif /* _SYS_SYSI86_H */ 259