/* module SWIS_ROUTINES.H "X-15" * ***************************************************************************** * * * HP CONFIDENTIAL. This software is confidential proprietary software * * licensed by Hewlett-Packard Development Company, L.P., and is not * * authorized to be used, duplicated OR disclosed to anyone without the * * prior written permission of HP. * * (c) 2017 Copyright Hewlett-Packard Development Company, L.P. * * * * VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * * proprietary software licensed by VMS Software, Inc., and is not * * authorized to be used, duplicated or disclosed to anyone without * * the prior written permission of VMS Software, Inc. * * (c) 2019 Copyright VMS Software, Inc. * * * ***************************************************************************** *++ * * FACILITY: * * VMS Executive (LIB_H) * * ABSTRACT: * * This module contains the C function prototypes for the VMS (IPF) * SoftWare Interrupt Services (SWIS) routines which begin with * SWIS$ and thus are not direct replacements for Alpha PAL calls. * (The latter are in [STARLET_H]PAL_SERVICES). * * NOTE: * * The conventions used in these function prototypes are: * * 1. Case * This header file supports invoking the routines by either using all * lowercase or all uppercase names for the system routines. Either * naming convention works even in the presence of the /NAME=AS_IS * compiler switch. * * 2. Integer size * The generic "int" type is used where it doesn't matter whether the * integer is 32 or 64 bits wide. Thus "int" is the returned value of * most functions and is the type for most integers passed by value. * However, an unambiguous integer type, e.g. int32, is used for any * integer that is passed by reference. Also, int64 is used for any * integer that is expected to be 64 bits wide even if it is passed by * value. * * 3. Types * The function prototypes use the types defined in [SYSLIB]SYS$LIB_C.TLB. * The definitions of all types used are included below. * * 4. Parameter names * Parameter names are used in the prototypes. Although they are ignored * by the compiler they do provide useful documentation. For example: * * void ioc_std$reqcom (int iost1, int iost2, UCB *ucb); * * is used instead of the functionally equivalent: * * void ioc_std$reqcom (int, int, UCB *); * * 5. Parameters passed by reference * The parameter name includes the "_p" suffix if the parameter is passed * by reference unless the parameter type implies that it is always passed * by reference. For example, there is no "_p" suffix in: * * UCB *ucb; * int32 iosb[2]; * * since structures and arrays are always passed by reference. However: * * int32 *outlen_p; * UCB **new_ucb_p; * * include the suffix to denote that outlen_p is a pointer to a 32 bit * integer, and to denote that new_ucb_p is a pointer to a pointer to a * UCB structure. * * 6. Mixed pointer sizes within one argument * If a 64-bit pointer is being passed by reference, the reference to * the pointer should also be 64 bits wide to avoid confusion. * For example: * * PTE_PPQ va_pte_p; * VOID_PPQ start_va_p; * * should be used instead of: * * PTE_PQ *va_pte_p; * VOID_PQ *start_va_p; * * * AUTHOR: * * Copied from SYS_ROUTINES by Leonard S. Szubowicz * Burns Fisher * * CREATION DATE: 10-Jul-2002 * * MODIFICATION HISTORY: * * X-15 RAB Richard A. Bishop 10-May-2019 * Add SWIS_STD$SWPCTX_V() * * X-14 CV-0225 Camiel Vanderhoeven 7-Aug-2018 * swis$swpctx_v only takes a single argument. * * X-13 CV-0124 Camiel Vanderhoeven 20-Feb-2018 * Include for use of KTB type. * * X-12 CV-0123 Camiel Vanderhoeven 19-Feb-2018 * Use long pointers for xsave/xrstor * * X-11 CV-0121 Camiel Vanderhoeven 16-Feb-2018 * Provide x86 version of swpctx_v, add xsave and xrstor. * * X-10 CV-0018 Camiel Vanderhoeven 13-Jun-2017 * Provide x86 versions, update copyright to VSI. * * X-9 WBF Burns Fisher 12-Mar-2004 * Promote PFN to quadword * * X-8 CMOS Christian Moser 04-SEP-2003 * Add prototype for SWIS$SET_PSR and SWIS$CLEAR_PSR. * * X-7 KLN3235 Karen L. Noel 28-Feb-2003 * Fix proto for swis$get_bsp. * * X-6 KLN3189 Karen L. Noel 14-Jan-2003 * Add swis$get_rid. * * X-4 WBF Burns Fisher 03-Dec-2002 * Move declarations with pointers to the long pointer * section * * X-3 WBF Burns Fisher 25-Nov-2002 * Add definition of NEXT_AST_MODE data table * * X-3 WBF Burns Fisher 10-Jul-2002 * Add SWIS$GET_HWPCB * * X-1,2 WBF Burns Fisher 10-Jul-2002 * Initial version * *-- */ #if !defined(__SWIS_ROUTINES_LOADED) && !defined(__alpha) /* Verified for IA64 port WBF; x86 port - Camiel Vanderhoeven */ #define __SWIS_ROUTINES_LOADED 1 #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif /* * Define all types that are used in the following function prototypes. */ #include #include #include #include #include #if defined(__ia64) // Verified for x86 port - Camiel Vanderhoeven #include #endif #if defined(__x86_64) // Verified for x86 port - Camiel Vanderhoeven #include #endif /* VMS system routine entry points are defined externally using uppercase names. The following macros allow the usage of the lowercase versions of these names even in the presence of the /NAME=AS_IS compiler switch. */ #define swis$set_idt SWIS$SET_IDT #define swis$get_idt SWIS$GET_IDT #define swis$get_astsr_asten SWIS$GET_ASTSR_ASTEN #define swis$raise_ipl SWIS$RAISE_IPL #define swis$lower_ipl SWIS$LOWER_IPL #define swis$get_current_kt_id SWIS$GET_CURRENT_KT_ID #define swis$set_current_kt_id SWIS$SET_CURRENT_KT_ID #define swis$get_current_hwpcb SWIS$GET_CURRENT_HWPCB #if defined(__x86_64) // Verified for x86 port - Camiel Vanderhoeven #define swis$get_ptbase SWIS$GET_PTBASE #define swis$set_ptbase SWIS$SET_PTBASE #endif #if defined(__ia64) // Verified for x86 port - Camiel Vanderhoeven #define swis$get_rid SWIS$GET_RID #define swis$set_ptbr SWIS$SET_PTBR #define swis$get_ptbr SWIS$GET_PTBR #define swis$set_bsp SWIS$SET_BSP #define swis$get_bsp SWIS$GET_BSP #define swis$set_psr SWIS$SET_PSR #define swis$get_psr SWIS$GET_PSR #endif /* Set current hwpcb is called swpctx ! */ /* Function prototypes for system routines with the SWIS$ prefix. */ int swis$get_astsr_asten(void); int swis$raise_ipl(int targetIPL); int swis$lower_ipl(int targetIPL); int swis$get_current_kt_id(void); void swis$set_current_kt_id(int ktid); #if defined(__ia64) // Verified for x86 port - Camiel Vanderhoeven int swis$get_rid (int virtual_region); uint64 swis$get_ptbr (int virtual_regionx); void swis$set_ptbr (uint64 pfn,int virtual_regionx); VOID_PQ swis$get_bsp (int mode); int swis$set_bsp (int mode, VOID_PQ new_bsp); uint64 swis$set_psr (PSR psr); uint64 swis$clear_psr (PSR psr); #endif #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __long /* And set ptr size default to 64-bit pointers */ #endif HWPCB *swis$get_current_hwpcb(void); #if defined(__x86_64) // Verified for x86 port - Camiel Vanderhoeven uint64 swis$get_ptbase (int mode); void swis$set_ptbase (uint64 ptbase, int mode); void swis$xsave(char* area); void swis$xrstor(char* area); #endif #if defined(__x86_64) // Verified for x86 port - Camiel Vanderhoeven KTB* swis$swpctx_v(KTB* newktb); KTB* swis_std$swpctx_v(KTB* newktb, void *); #elif defined(__ia64) int swis$swpctx_v(HWPCB *newhwpcb); #else #error Needs architectural work #endif INTERRUPTION_HANDLER_PQ *swis$get_idt(void); INTERRUPTION_HANDLER_PQ *swis$set_idt(INTERRUPTION_HANDLER_PQ *table); #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif /* The following data can be used as the initial value of a 256-long array which, when indexed by the value gotten with swis$get_astasr_asten will tell you the mode of the next AST that will be delivered (4 means none). */ #define NEXT_AST_MODE_DATA \ {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4\ ,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0\ ,4,4,1,1,4,4,1,1,4,4,1,1,4,4,1,1\ ,4,0,1,0,4,0,1,0,4,0,1,0,4,0,1,0\ ,4,4,4,4,2,2,2,2,4,4,4,4,2,2,2,2\ ,4,0,4,0,2,0,2,0,4,0,4,0,2,0,2,0\ ,4,4,1,1,2,2,1,1,4,4,1,1,2,2,1,1\ ,4,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0\ ,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3\ ,4,0,4,0,4,0,4,0,3,0,3,0,3,0,3,0\ ,4,4,1,1,4,4,1,1,3,3,1,1,3,3,1,1\ ,4,0,1,0,4,0,1,0,3,0,1,0,3,0,1,0\ ,4,4,4,4,2,2,2,2,3,3,3,3,2,2,2,2\ ,4,0,4,0,2,0,2,0,3,0,3,0,2,0,2,0\ ,4,4,1,1,2,2,1,1,3,3,1,1,2,2,1,1\ ,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0} #endif /* __SWIS_ROUTINES_LOADED */