/*static char *SCCSID = "@(#)rasgdt.c   6.6 91/11/08";*/

#define SCCSID  "@(#)rasgdt.c   6.6 91/11/08"

/*
 *      RAS - GDT InfoSeg access routines
 *
 *      IBM/Microsoft Confidential
 *
 *      Copyright (c) IBM Corporation 1987, 1989
 *      Copyright (c) Microsoft Corporation 1987, 1989
 *
 *      All Rights Reserved
 *
 *      This API call will return various parts of the GDT InfoSeg,
 *      according to the ordinal passed in.
 */

#define INCL_TYPES
#define INCL_ERROR_H
#define INCL_ERROR2_H
#define FNO_NUM   FNO_RASGDT_C

#include <fnotask.h>
#include <basemac.h>
#include <basedef.h>
#include <osmac.h>
#include <ostypes.h>
#include <infoseg.h>
#include <osconst.h>
#include <bseerr.h>
#include <dossymc.h>
#include <seldesc.h>
#include <sigdef.h>
#include <except.h>
#include <mi.h>
#include <pgexport.h>
#include <protmode.h>
#include <vmexport.h>
#include <vmowner.h>
#include <tkexport.h>
#include <sched.h>
#include <proc.h>
#include <sem.h>
#include <screen.h>
#include <curdir.h>
#include <dirent.h>
#include <find.h>
#include <tkptda.h>
#include <ldrxport.h>
#include <selxport.h>
#include <kmode.h>

#if RAS
/* Index definitions for DosQueryRASInfo */
#define INDEX_SIS_MMIOADDR    0
#define INDEX_SIS_MEC_TABLE   1
#define INDEX_SIS_SYS_LOG     2

extern  struct  InfoSegGDT SISData;
extern  ulong_t TranslateRAS(ulong_t indx);

#endif
/***EP  VRQueryRASInfo - Query RAS information (API entry)
 *
 *      This is the worker for the DosQueryRASInfo API
 *
 *      ENTRY
                sef          System Entry Frame
 *              index        Index for piece of RAS info
 *              Addr         Pointer for address into infoseg
 *
 *      RETURNS
 *              NO_ERROR        Success
 *              ERROR_INVALID_PARAMETER
 *              ERROR_DENIED_ACCESS
 */

int cdecl VRQueryRASInfo(sef, index, Addr)
THUNKSEF        sef;                    /* System Entry Frame */
ULONG           index;               /* Index into Sys Info */
PPVOID          Addr;                /* Pointer for address into Sys Info */
{

#if RAS

    ULONG rc = 0;                    /* return code for routine */

    sef;                             /* Reference made to remove compiler */
                                     /* warning messages during build     */

    switch (index) {
        case INDEX_SIS_MEC_TABLE:
            *Addr = (PVOID)(TranslateRAS(index));
            if (*Addr == NULL)
            {
             rc = ERROR_ACCESS_DENIED;
            }   /* end if () */
            break;
        case INDEX_SIS_MMIOADDR:
            *Addr = (PVOID)(TranslateRAS(index));
            if (*Addr == NULL)
            {
             rc = ERROR_ACCESS_DENIED;
            }   /* end if () */
            break;
        case INDEX_SIS_SYS_LOG:
            *Addr = (PVOID)(TranslateRAS(index));
            if (*Addr == NULL)
            {
             rc = ERROR_ACCESS_DENIED;
            }   /* end if () */
            break;
        default:
            *Addr = NULL;
            rc = ERROR_INVALID_PARAMETER;
    } /* endswitch */

    if (rc == 0)
       {return (0);}
    else
       {return (rc);}

#else
    return(ERROR_ACCESS_DENIED);
#endif /* RAS */
}
