10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3446Smrj * Common Development and Distribution License (the "License"). 6*3446Smrj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 220Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 230Sstevel@tonic-gate /* All Rights Reserved */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate /* 26*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 270Sstevel@tonic-gate * Use is subject to license terms. 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _IA32_SYS_PSW_H 310Sstevel@tonic-gate #define _IA32_SYS_PSW_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #ifndef _ASM 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* Flags Register */ 420Sstevel@tonic-gate 430Sstevel@tonic-gate typedef struct flags { 440Sstevel@tonic-gate uint_t fl_cf : 1, /* carry/borrow */ 450Sstevel@tonic-gate : 1, /* reserved */ 460Sstevel@tonic-gate fl_pf : 1, /* parity */ 470Sstevel@tonic-gate : 1, /* reserved */ 480Sstevel@tonic-gate fl_af : 1, /* carry/borrow */ 490Sstevel@tonic-gate : 1, /* reserved */ 500Sstevel@tonic-gate fl_zf : 1, /* zero */ 510Sstevel@tonic-gate fl_sf : 1, /* sign */ 520Sstevel@tonic-gate fl_tf : 1, /* trace */ 530Sstevel@tonic-gate fl_if : 1, /* interrupt enable */ 540Sstevel@tonic-gate fl_df : 1, /* direction */ 550Sstevel@tonic-gate fl_of : 1, /* overflow */ 560Sstevel@tonic-gate fl_iopl : 2, /* I/O privilege level */ 570Sstevel@tonic-gate fl_nt : 1, /* nested task */ 580Sstevel@tonic-gate : 1, /* reserved */ 590Sstevel@tonic-gate fl_rf : 1, /* reset */ 600Sstevel@tonic-gate fl_vm : 1, /* virtual 86 mode */ 610Sstevel@tonic-gate fl_res : 14; /* reserved */ 620Sstevel@tonic-gate } flags_t; 630Sstevel@tonic-gate 640Sstevel@tonic-gate #endif /* !_ASM */ 650Sstevel@tonic-gate 660Sstevel@tonic-gate #define PS_C 0x0001 /* carry bit */ 671363Sfvdl #define PS_MB1 0x0002 /* unused; must be 1. */ 680Sstevel@tonic-gate #define PS_P 0x0004 /* parity bit */ 690Sstevel@tonic-gate #define PS_AC 0x0010 /* auxiliary carry bit */ 700Sstevel@tonic-gate #define PS_Z 0x0040 /* zero bit */ 710Sstevel@tonic-gate #define PS_N 0x0080 /* negative bit */ 720Sstevel@tonic-gate #define PS_T 0x0100 /* trace enable bit */ 730Sstevel@tonic-gate #define PS_IE 0x0200 /* interrupt enable bit */ 740Sstevel@tonic-gate #define PS_D 0x0400 /* direction bit */ 750Sstevel@tonic-gate #define PS_V 0x0800 /* overflow bit */ 760Sstevel@tonic-gate #define PS_IOPL 0x3000 /* I/O privilege level */ 770Sstevel@tonic-gate #define PS_NT 0x4000 /* nested task flag */ 780Sstevel@tonic-gate #define PS_RF 0x10000 /* restore flag */ 790Sstevel@tonic-gate #define PS_VM 0x20000 /* virtual 86 mode flag */ 800Sstevel@tonic-gate #define PS_ACHK 0x40000 /* alignment check enable (486) */ 810Sstevel@tonic-gate #define PS_VINT 0x80000 /* virtual interrupt flag */ 820Sstevel@tonic-gate #define PS_VINTP 0x100000 /* virtual interrupt pending */ 830Sstevel@tonic-gate #define PS_ID 0x200000 /* ID flag */ 840Sstevel@tonic-gate 850Sstevel@tonic-gate #define PS_ICC (PS_C|PS_AC|PS_Z|PS_N) /* integer condition codes */ 860Sstevel@tonic-gate 870Sstevel@tonic-gate #define FMT_FLAGS_REG \ 880Sstevel@tonic-gate "\20\26id\25vip\24vif\23ac\22vm\21rf" \ 890Sstevel@tonic-gate "\17nt\14of\13df\12if\11tf\10sf\7zf\5af\3pf\1cf" 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define PSL_USER 0x202 /* initial user FLAGS */ 920Sstevel@tonic-gate 930Sstevel@tonic-gate /* user variable PS bits */ 940Sstevel@tonic-gate #define PSL_USERMASK (PS_ICC|PS_D|PS_T|PS_V|PS_P|PS_ACHK|PS_NT) 950Sstevel@tonic-gate 961363Sfvdl /* PS bits changeable by the sahf instruction */ 971363Sfvdl #define PSL_LSAHFMASK (PS_ICC|PS_P) 981363Sfvdl 990Sstevel@tonic-gate /* 1000Sstevel@tonic-gate * kernel flags settings 1010Sstevel@tonic-gate */ 1020Sstevel@tonic-gate #define F_OFF 0x2 /* interrupts off */ 1030Sstevel@tonic-gate #define F_ON 0x202 /* interrupts on */ 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #ifndef _ASM 1060Sstevel@tonic-gate typedef int psw_t; 1070Sstevel@tonic-gate #endif 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #include <sys/tss.h> 1100Sstevel@tonic-gate #include <sys/segments.h> /* selector definitions */ 1110Sstevel@tonic-gate 112*3446Smrj #define USERMODE(cs) ((uint16_t)(cs) != KCS_SEL) 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate #include <sys/spl.h> 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate #ifdef __cplusplus 1170Sstevel@tonic-gate } 1180Sstevel@tonic-gate #endif 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate #endif /* _IA32_SYS_PSW_H */ 121