Compartir a través de


NKGLOBAL (Compact 2013)

10/16/2014

This structure defines functions and variables that the kernel exports. The OEM adaptation layer (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 (*pfnRegOpenKeyExW) 
                                  (HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, 
                                    REGSAM samDesired, PHKEY phkResult);
        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);
        LONG (*pfnRegFlushKey) (HKEY hKey);
        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);
        void (*pfn__report_gsfailure) (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;
        void (*pfnNKSendIPI) 
                                (DWORD dwType, DWORD dwTarget, DWORD dwCommand, 
                                  DWORD dwDate);
        void (*pfnAcquireOalSpinLock) (void);
        void (*pfnReleaseOalSpinLock) (void);
        void (*pfnCeLogData) 
                                (BOOL, DWORD, VOID*, DWORD, DWORD, DWORD, DWORD, 
                                  BOOL);
        DWORD unused[32];
#ifdef x86
        BOOL (*pfnX86wrmsr) 
                                (DWORD dwAddr, DWORD dwValHigh, DWORD dwValLow);
        BOOL (*pfnX86rdmsr) 
                                (DWORD dwAddr, DWORD *lpdwValHigh, DWORD *lpdwValLow);
        int (*pfnCallRing0Function) (FARPROC pfn, DWORD arg0, DWORD arg1, DWORD arg2);
        DWORD dwKnownUncachedAddress;
#endif
#ifdef SH4
        BYTE *IntrPrio;
        DWORD *InterruptTable;
#endif
#ifdef ARM
        const DWORD *pdwOrigVectors;
        LPDWORD pdwCurrVectors;
#endif
} NKGLOBAL, *PNKGLOBAL;

Members

  • dwVersion
    Version of Windows Embedded Compact.
  • pfnWriteDebugString
    Pointer to the function NKOutputDebugString, which writes a string to the debug monitor port.
  • pfnNKvDbgPrintfW
    Pointer to the function NKvDbgPrintfW, which formats a string using the function NKwvsprintfW and prints it using NKOutputDebugString.
  • pfnNKwvsprintfW
    Pointer to the function NKwvsprintfW, which writes formatted data to a Unicode string.
  • pfnSetLastError
    Pointer to the function NKSetLastError, which sets the last error from the current thread.
  • pfnGetLastError
    Pointer to the function NKGetLastError, which returns the last error from the current thread.
  • pfnDeleteCS
    Pointer to the function DeleteCriticalSection, which releases all resources used by a critical section object that is not owned.
  • pfnEnterCS
    Pointer to the function EnterCriticalSection, which waits for ownership of the specified critical section object.
  • pfnLeaveCS
    Pointer to the function LeaveCriticalSection, which releases ownership of the specified critical section object.
  • pfnINT_OFF
    Pointer to the function INTERRUPTS_OFF, which disables all interrupts.
  • pfnINT_ON
    Pointer to the function INTERRUPTS_ON, which enables all interrupts.
  • pfnINT_ENABLE
    Pointer to the function INTERRUPTS_ENABLE, which enables or disables all interrupts and returns the current state.
  • pfnHookInterrupt
    Pointer to the function HookInterrupt, which registers an interrupt service routine (ISR) with the kernel, specifying a particular hardware interrupt indicated by its interrupt request (IRQ) line value.
  • pfnUnhookInterrupt
    Pointer to the function UnhookInterrupt, which deregisters an ISR with a specific hardware interrupt.
  • pfnNKCallIntChain
    Pointer to the function NKCallIntChain, which determines which chained, or shared, interrupt device triggered an interrupt request (IRQ) event.
  • pfnNKIsSysIntrValid
    Pointer to the function NKIsSysIntrValid, which determines whether an interrupt identifier or SYSINTR value is valid.
  • pfnNKSetInterruptEvent
    Pointer to the function NKSetInterruptEvent, which causes an artificial interrupt event.
  • pfnSleep
    Pointer to the function NKSleep, which suspends the execution of the current thread for a specified interval.
  • pfnVMSetAttrib
    Pointer to the function VirtualSetAttrib, which enables OEMs to change the per-page attributes for a range of virtual memory.
  • pfnCreateStaticMapping
    Pointer to the function NKCreateStaticMapping, which creates a static virtual memory address that maps to a physical address.
  • pfnRegCreateKeyExW
    Pointer to the function NKRegCreateKeyExW, which creates a specified registry key.
  • pfnRegOpenKeyExW
    Pointer to the function NKRegOpenKeyExW, which opens the specified registry key.
  • pfnRegCloseKey
    Pointer to the function NKRegCloseKey, which releases the handle of the specified registry key.
  • pfnRegQueryValueExW
    Pointer to the function NKRegQueryValueExW, which retrieves the type and data for a specified value name associated with an open registry key.
  • pfnRegSetValueExW
    Pointer to the function NKRegSetValueExW, which stores data in the value field of an open registry key.
  • pfnRegFlushKey
    Pointer to the function NKRegFlushKey, which writes all the attributes of the specified open registry key into the registry.
  • pfnNKForceCleanBoot
    Pointer to the function NKForceCleanBoot, which forces the OS to boot from a clean object store file system.
  • pfnNKReboot
    Pointer to the function NKReboot, which reboots the OS.
  • pfnPhysToVirt
    Pointer to the function NKPhysToVirt, which translates physical addresses to virtual addresses.
  • 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 kernel independent transport layer (KITL). This function is not currently supported.
  • pfnNKwcslen
    Pointer to the function NKwcslen, which returns the length of a Unicode string.
  • pfnNKwcscmp
    Pointer to the function NKwcscmp, which compares two Unicode strings.
  • pfnNKwcsicmp
    Pointer to the function NKwcsicmp, which compares two Unicode strings while ignoring case.
  • pfnNKwcsnicmp
    Pointer to the function NKwcsnicmp, which compares up to a specified number of characters of two Unicode strings while ignoring case.
  • pfnNKwcscpy
    Pointer to the function NKwcscpy, which copies one Unicode string into another.
  • pfnNKwcsncpy
    Pointer to the function NKwcsncpy, which copies a specified number of characters from one Unicode string to another.
  • pfnNKstrcmpiAandW
    Pointer to the function NKstrcmpiAandW, which compares an ASCII string to a Unicode string.
  • pfnNKUnicodeToAscii
    Pointer to the function NKUnicodeToAscii, which converts a Unicode string to an ASCII string.
  • pfnNKAsciiToUnicode
    Pointer to the function NKAsciiToUnicode, which converts an ASCII string to a Unicode string.
  • pfnSystemTimeToFileTime
    Pointer to the function NKSystemTimeToFileTime, which converts system time to file time format.
  • pfnFileTimeToSystemTime
    Pointer to the function NKFileTimeToSystemTime, which converts file time to system time format.
  • pfnCompareFileTime
    Pointer to a function that compares two file times and returns a Boolean value.
  • pfnProfilerHit
    Pointer to the function ProfilerHit, which records a profiling sample.
  • pfnGetEPC
    Pointer to the function GetEPC, which returns the exception program counter (EPC).
  • pfn__report_gsfailure
    Pointer to the function __report_gsfailure, which reports a security error and reboots or halts the system.
  • dwStartupAddr
    Stores a reference to dwStartupAddr, which is the startup address that the soft reset handler uses*.*
  • dwCurMSec
    Stores a reference to CurMSec, which indicates the number of milliseconds since the device was started.
  • liIdle
    Stores references to curridlehigh and curridlelow, which are the high and low DWORDs of the 64-bit idle time. liIdle.HighPart corresponds to curridlehigh, and liIdle.LowPart corresponds to curridlelow. The OAL initializes this variable.
  • dwIdleConv
    Stores a reference to idleconv, which is a translation constant that specifies the number of units per millisecond. The OAL initializes this variable.
  • 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.
  • pfnNKSendIPI
    Pointer to the function NKSendInterProcessorInterrupt. For maximum forward compatibility, we recommend that the OEM call NKSendInterProcessorInterrupt directly, instead of using this function pointer.
  • pfnCeLogData
    Pointer to the function NKCeLogData, which logs an event.
  • unused[32]
    Reserved for future use.
  • pfnX86wrmsr
    Pointer to the function NKwrmsr, which is a C wrapper function for the x86 WRMSR instruction. This function is specific to x86 only.
  • pfnX86rdmsr
    Pointer to the function NKrdmsr, which is a C wrapper function for the x86 RDMSR instruction. This function is specific to x86 only.
  • pfnCallRing0Function
    Calls an OEM adaptation layer function that must be run in ring zero.
  • dwKnownUncachedAddress
    The virtual address of an uncached page. This variable is specific to x86 only. The OAL uses it to perform cache flushing, because the OEMAddressTable structure does not contain static uncached mapping.
  • IntrPrio
    Pointer to the function IntrPrio. This function is not supported in Windows Embedded Compact 2013 because SH4 platforms are not supported.
  • InterruptTable
    Not implemented by default. This variable is not supported in Windows Embedded Compact 2013 because SH4 platforms are not supported.
  • pdwOrigVectors
    Pointer to the interrupt vector table, which is created when an ARM processor starts.
  • pdwCurrVectors
    Pointer to the function NKSetDataAbortHandler, which allows an OEM to replace the default abort handler on an ARM platform.

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 to the kernel.

Requirements

Header

nkglobal.h

Library

Nkmain.lib

See Also

Reference

BSP Data Structures