/*static char *SCCSID = "@(#)protmode.h 6.1 90/11/17";*/
/*      SCCSID = @(#)protmode.h 13.10 89/12/04
 *
 *      IBM/Microsoft Confidential
 *
 *      Copyright (c) IBM Corporation 1987, 1989
 *      Copyright (c) Microsoft Corporation 1987, 1989
 *
 *      All Rights Reserved
 *
 *      Protected mode definitions
 */

/*
 * Definitions of arguments to SetGPFHandler
 */

#define GPF_NORM        0       /* kmode GPF -> internal error */
#define GPF_USER        1       /* kmode GPF -> blame & kill user proc. */


/*
 * Definitions for the possible values of CpuType
 * !!IMPORTANT!! These flags should be mirrored to \h\dskinit.h
 */

#define CPU_286         0 /* processor is a 286         */
#define CPU_386         1 /* processor is a 386         */
#define CPU_486         2 /* processor is a 486         */
#define CPU_PENTIUM     3 /* Processor is a pentium     */
#define CPU_PENTIUM_PRO 4 /* Processor is a pentium pro */ /* 158244 */

/*
 * Definitions for the possible values of CpuStepping
 */

#define CPU_386B1          ((0x386 << 16) | 0xb1)
#define CPU_386D1          ((0x386 << 16) | 0xd1)
#define CPU_486B4          ((0x486 << 16) | 0xb4)
#define CPU_PENTIUMXXX     ((0x586 << 16) | 0x00)
#define CPU_PENTIUMPROXXX  ((0x686 << 16) | 0x00)

/*
 * Definitions for the possible Cpu Vendors
 */
#define CPU_INTEL          0 /* Processor Conforms to Intel Standards */
#define CPU_CYRIX          1 /* Processor is Cyrix */
#define CPU_CYRIX_MASK     8 /* Cyrix Processor mask for CpuType */


/*
 * Definitions for error code pushed by exceptions
 */

#define E_EXT           0x0001                  /* error was external */
#define E_IDT           0x0002                  /* error was IDT based */
/* XLATOFF */
#define E_SELMASK       (~(E_IDT | E_EXT))      /* selector and table bits */
/* XLATON */
/* ASM
E_SELMASK       equ     0fffch                  ; masm bug workaround


GSEL            equ     offset DOSGDTDATA:      ; GDT Selector Generator


;***    whatmode - set carry flag to indicate what mode we're in
;
;       Whatmode simply tests the low bit of the machine status word
;       to determine whether we're in protected or real mode.
;
;       WARNING This macro uses 286 specific instructions, it will generate
;               an illegal instruction on an 8088.
;
;       INVOKE  whatmode
;
;       EXIT    CF = 0 - we're in real mode
;               CF = 1 - we're in protected mode
;

whatmode macro  reg
ifnb <reg>
        smsw    reg                     ; (reg:0) = protected mode bit
        shr     reg,1                   ; CF = protected mode bit
else
        push    ax                      ; save invoker's ax
        smsw    ax                      ; (ax:0) = protected mode bit
        shr     al,1                    ; CF = protected mode bit
        pop     ax                      ; restore invoker's ax
endif
        endm


;***    dd_whatmode - an in-line whatmode for device drivers
;
;       ENTRY:  none
;
;       EXIT:   Use following conditional jumps to test state:
;               JC  foo     ; PROT mode
;               JNC foo     ; Not PROT mode (must be V86 mode)
;
;       USES:   flags
;

dd_whatmode macro   reg
        whatmode    reg
        endm
*/
