NKGLOBAL

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/27/2008

This structure defines functions and variables that the kernel exports. The OAL can only access kernel functions using this global structure.

Syntax

typedef struct _NKGLOBAL {
        DWORD dwVersion;
        PFN_WriteDebugString pfnWriteDebugString;
        void (*pfnNKvDbgPrintfW)                (LPCWSTR lpszFmt, va_list lpParms);
        int (*pfnNKwvsprintfW)                (LPWSTR lpOut, LPCWSTR lpFmt, va_list lpParms,                 int maxchars);
        void (*pfnSetLastError) (DWORD dwErr);
        DWORD (*pfnGetLastError) (void);
        void (WINAPI *pfnInitializeCS) (LPCRITICAL_SECTION lpcs);
        void (WINAPI *pfnDeleteCS) (LPCRITICAL_SECTION lpcs);
        void (WINAPI *pfnEnterCS) (LPCRITICAL_SECTION lpcs);
        void (WINAPI *pfnLeaveCS) (LPCRITICAL_SECTION lpcs);
        void (*pfnINT_OFF) (void);
        void (*pfnINT_ON) (void);
        BOOL (*pfnINT_ENABLE) (BOOL fEnable);
        BOOL (*pfnHookInterrupt)                (int hwInterruptNumber, FARPROC pfnHandler);
        BOOL (*pfnUnhookInterrupt)                (int hwInterruptNumber, FARPROC pfnHandler);
        DWORD (*pfnNKCallIntChain) (BYTE irq);
        BOOL (*pfnNKIsSysIntrValid) (DWORD idInt);
        BOOL (*pfnNKSetInterruptEvent) (DWORD idInt);
        void (*pfnSleep) (DWORD cmsec);
        BOOL (*pfnVMSetAttrib)                 (LPVOID lpvAddress, DWORD cbSize, DWORD dwNewFlags,                  DWORD dwMask, LPDWORD lpdwOldFlags);
        LPVOID (*pfnCreateStaticMapping)                 (DWORD dwPhysBase, DWORD dwSize);
        LONG (*pfnRegCreateKeyExW)                 (HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved,                  LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired,                  LPSECURITY_ATTRIBUTES lpsa, PHKEY phkResult,                  LPDWORD lpdwDisp);
        LONG (*pfnRegCloseKey) (HKEY hKey);
        LONG (*pfnRegQueryValueExW)                 (HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved,                 LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
        LONG (*pfnRegSetValueExW)                 (HKEY hKey, LPCWSTR lpValueName, DWORD dwReserved,                 DWORD dwType, LPBYTE lpData, DWORD cbData);
        void (*pfnNKForceCleanBoot) (void);
        BOOL (*pfnNKReboot) (BOOL fClean);
        LPVOID (*pfnPhysToVirt) (DWORD dwShiftedPhysAddr, BOOL fCached);
        LPVOID (*pfnVirtToPhys) (DWORD dwVirtAddr);
        PFN_Ioctl pfnKITLIoctl;
        DWORD (*pfnNKwcslen) (const wchar_t * wcs);
        int (*pfnNKwcscmp) (const wchar_t * pwc1, const wchar_t * pwc2);
        int (*pfnNKwcsicmp) (LPCWSTR str1, LPCWSTR str2);
        int (*pfnNKwcsnicmp) (LPCWSTR str1, LPCWSTR str2, int cchLen);
        void (*pfnNKwcscpy) (LPWSTR p1, LPCWSTR p2);
        DWORD (*pfnNKwcsncpy) (LPWSTR pDst, LPCWSTR pSrc, DWORD cchLen);
        int (*pfnNKstrcmpiAandW) (LPCSTR lpa, LPCWSTR lpu);
        void (*pfnNKUnicodeToAscii)                 (LPSTR chptr, LPCWSTR wchptr, int maxlen);
        void (*pfnNKAsciiToUnicode)                 (LPWSTR wchptr, LPCSTR chptr, int maxlen);
        BOOL (*pfnSystemTimeToFileTime)                 (const SYSTEMTIME *pst, LPFILETIME pft);
        BOOL (*pfnFileTimeToSystemTime)                 (const FILETIME *pft, LPSYSTEMTIME pst);
        LONG (*pfnCompareFileTime) (const FILETIME *, const FILETIME *);
        void (*pfnProfilerHit) (UINT addr);
        DWORD (*pfnGetEPC) (void);
        DWORD dwStartupAddr;
        volatile DWORD dwNextReschedTime;
        volatile DWORD dwCurMSec;
        volatile LARGE_INTEGER liIdle;
        DWORD dwIdleConv;
        DWORD dwMaxThreadPerProc;
        DWORD dwProcessorType;
        WORD  wProcessorLevel;
        WORD  wProcessorRevision;
        DWORD dwInstructionSet;
        DBGPARAM *pKITLDbgZOne;
#ifdef x86
        FARPROC pfn_except_handler3;
        FARPROC pfn__abnormal_termination;
        BOOL (*pfnX86wrmsr)                 (DWORD dwAddr, DWORD dwValHigh, DWORD dwValLow);
        BOOL (*pfnX86rdmsr)                 (DWORD dwAddr, DWORD *lpdwValHigh, DWORD *lpdwValLow);
#else
        FARPROC pfn__C_specific_handler;
#endif
#ifdef SH4
        BYTE *IntrPrio;
        DWORD *InterruptTable;
#endif
#ifdef ARM
        const DWORD *pdwOrigVectors;
        LPDWORD pdwCurrVectors;
#endif
} NKGLOBAL, *PNKGLOBAL;

Members

  • dwVersion
    Version of Windows Embedded CE.
  • pfnWriteDebugString
    Pointer to the function NKOutputDebugString.
  • pfnNKvDbgPrintfW
    Pointer to the function NKvDbgPrintfW.
  • pfnNKwvsprintfW
    Pointer to the function NKwvsprintfW.
  • pfnSetLastError
    Pointer to the function NKSetLastError.
  • pfnGetLastError
    Pointer to the function NKGetLastError.
  • pfnNKSetInterruptEvent
    Pointer to the function NKSetInterruptEvent.
  • pfnSleep
    Pointer to the function NKSleep.
  • pfnRegCreateKeyExW
    Pointer to the function NKRegCreateKeyExW.
  • pfnRegOpenKeyExW
    Pointer to the function NKRegOpenKeyExW.
  • pfnRegQueryValueExW
    Pointer to the function NKRegQueryValueExW.
  • pfnRegSetValueExW
    Pointer to the function NKRegSetValueExW.
  • pfnNKReboot
    Pointer to the function NKReboot.
  • pfnPhysToVirt
    Pointer to the function NKPhysToVirt, which translates physical addresses to virtual addresses. Up to 40 bits of physical addresses are supported.
  • pfnVirtToPhys
    Pointer to the function NKVirtToPhys, which translates virtual addresses to physical addresses.
  • pfnKITLIoctl
    Pointer to a function that provides the only entry point to the KITL. This function is not currently supported.
  • pfnNKwcslen
    Pointer to the function NKwcslen.
  • pfnNKwcscmp
    Pointer to the function NKwcscmp.
  • pfnNKwcsicmp
    Pointer to the function NKwcsicmp.
  • pfnNKwcsnicmp
    Pointer to the function NKwcsnicmp.
  • pfnNKwcscpy
    Pointer to the function NKwcscpy.
  • pfnNKwcsncpy
    Pointer to the function NKwcsncpy.
  • pfnNKstrcmpiAandW
    Pointer to the function NKstrcmpiAandW.
  • pfnNKUnicodeToAscii
    Pointer to the function NKUnicodeToAscii.
  • pfnNKAsciiToUnicode
    Pointer to the function NKAsciiToUnicode.
  • pfnSystemTimeToFileTime
    Pointer to the function NKSystemTimeToFileTime.
  • pfnFileTimeToSystemTime
    Pointer to the function NKFileTimeToSystemTime.
  • pfnCompareFileTime
    Pointer to the function NKCompareFileTime.
  • pfnGetEPC
    Pointer to the function GetEPC.
  • dwStartupAddr
    Stores a reference to dwStartupAddr.
  • dwNextReschedTime
    Stores a reference to dwReschedTime.
  • dwCurMSec
    Stores a reference to CurMSec.
  • liIdle
    Stores references to curridlehigh and curridlelow. liIdle.HighPart corresponds to curridlehigh, and liIdle.LowPart corresponds to curridlelow. This variable is initialized by the OAL.
  • dwIdleConv
    Stores a reference to idleconv. This variable is initialized by the OAL.
  • dwMaxThreadPerProc
    Specifies the maximum number of threads per process. By default, this value is set to DEFAULT_MAX_THREADS_PER_PROC.
  • dwProcessorType
    Stores a reference to CEProcessorType in the OAL. This variable is initialized during the boot phase.
  • wProcessorLevel
    Stores a reference to CEProcessorLevel. This variable is initialized during the boot phase.
  • wProcessorRevision
    Stores a reference to CEProcessorRevision. This variable is initialized during the boot phase.
  • dwInstructionSet
    Stores a reference to CEInstructionSet. This variable is initialized during the boot phase.
  • pKITLDbgZOne
    Specifies the KITL debug zone. This is not implemented by default.
  • pfn_except_handler3
    Pointer to the function _except_handler3. This function is used for x86 support.
  • pfn__abnormal_termination
    Pointer to the function __abnormal_termination. This function is used for x86 support.
  • pfnX86wrmsr
    Pointer to the function NKwrmsr. This function is specific to x86 only.
  • pfnX86rdmsr
    Pointer to the function NKrdmsr. This function is specific to x86 only.
  • pfn__C_specific_handler
    Pointer to the function __C_specific_handler.
  • IntrPrio
    Pointer to the function IntrPrio. This applies only to SH4 platforms.
  • InterruptTable
    Not implemented by default. This applies only to SH4 platforms.
  • pdwOrigVectors
    Pointer to the function GetOriginalDAbortHandlerAddress. This function is used for ARM support.

Remarks

The NKGLOBAL structure provides the ability to control the functions that the OAL can access inside the kernel. This structure is defined in Public\Common\Oak\Inc\Nkglobal.h.

The structure is initialized in Nkglobal.c and linked directly with the kernel.

Requirements

Header nkglobal.h
Library Nkmain.lib
Windows Embedded CE Windows Embedded CE 6.0

See Also

Reference

BSP Data Structures

Other Resources

BSP Migration Reference