[NTOS] Make some internal headers C++ aware

This commit is contained in:
Jérôme Gardou 2021-03-26 09:32:34 +01:00 committed by Jérôme Gardou
parent 8df48f9876
commit 31afbf1054
7 changed files with 68 additions and 21 deletions

View file

@ -1,5 +1,10 @@
#pragma once #pragma once
#ifdef __cplusplus
extern "C"
{
#endif
/* GLOBAL VARIABLES *********************************************************/ /* GLOBAL VARIABLES *********************************************************/
extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo; extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
@ -1513,3 +1518,7 @@ XIPInit(
#define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand) \ #define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand) \
(ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand)) (ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand))
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -1,12 +1,17 @@
#pragma once #pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#if defined(__GNUC__) #if defined(__GNUC__)
FORCEINLINE FORCEINLINE
VOID VOID
__lgdt(_Out_ PVOID Descriptor) __lgdt(_Out_ PVOID Descriptor)
{ {
PVOID* desc = Descriptor; PVOID* desc = (PVOID*)Descriptor;
__asm__ __volatile__( __asm__ __volatile__(
"lgdt %0" "lgdt %0"
: "=m" (*desc) : "=m" (*desc)
@ -18,7 +23,7 @@ FORCEINLINE
VOID VOID
__sgdt(_Out_ PVOID Descriptor) __sgdt(_Out_ PVOID Descriptor)
{ {
PVOID* desc = Descriptor; PVOID* desc = (PVOID*)Descriptor;
__asm__ __volatile__( __asm__ __volatile__(
"sgdt %0" "sgdt %0"
: "=m" (*desc) : "=m" (*desc)
@ -301,11 +306,11 @@ Ke386SaveFpuState(IN PVOID SaveArea)
{ {
if (KeI386FxsrPresent) if (KeI386FxsrPresent)
{ {
__fxsave(SaveArea); __fxsave((PFX_SAVE_AREA)SaveArea);
} }
else else
{ {
__fnsave(SaveArea); __fnsave((PFLOATING_SAVE_AREA)SaveArea);
} }
} }
@ -319,8 +324,14 @@ Ke386SaveFpuState(IN PVOID SaveArea)
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif
#define Ke386GetGlobalDescriptorTable __sgdt #define Ke386GetGlobalDescriptorTable __sgdt
#define Ke386SetGlobalDescriptorTable __lgdt #define Ke386SetGlobalDescriptorTable __lgdt
#define Ke386GetLocalDescriptorTable __sldt #define Ke386GetLocalDescriptorTable __sldt
#ifdef __cplusplus
} // extern "C"
#endif
/* EOF */ /* EOF */

View file

@ -4,6 +4,11 @@
#include "intrin_i.h" #include "intrin_i.h"
#ifdef __cplusplus
extern "C"
{
#endif
// //
// Thread Dispatcher Header DebugActive Mask // Thread Dispatcher Header DebugActive Mask
// //
@ -887,4 +892,8 @@ KiGetUserModeStackAddress(void)
return &(KeGetCurrentThread()->TrapFrame->HardwareEsp); return &(KeGetCurrentThread()->TrapFrame->HardwareEsp);
} }
#ifdef __cplusplus
} // extern "C"
#endif
#endif #endif

View file

@ -4,6 +4,11 @@
#include "arch/ke.h" #include "arch/ke.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* INTERNAL KERNEL TYPES ****************************************************/ /* INTERNAL KERNEL TYPES ****************************************************/
typedef struct _WOW64_PROCESS typedef struct _WOW64_PROCESS
@ -1049,4 +1054,8 @@ KeBugCheckUnicodeToAnsi(
IN ULONG Length IN ULONG Length
); );
#ifdef __cplusplus
} // extern "C"
#endif
#include "ke_x.h" #include "ke_x.h"

View file

@ -6,6 +6,11 @@
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/ */
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef _M_ARM #ifndef _M_ARM
FORCEINLINE FORCEINLINE
KPROCESSOR_MODE KPROCESSOR_MODE
@ -1701,3 +1706,7 @@ KiCpuIdEx(
__cpuidex((INT*)CpuInfo->AsUINT32, Function, SubFunction); __cpuidex((INT*)CpuInfo->AsUINT32, Function, SubFunction);
} }
#endif /* _M_IX86 || _M_AMD64 */ #endif /* _M_IX86 || _M_AMD64 */
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -2,6 +2,10 @@
#include <internal/arch/mm.h> #include <internal/arch/mm.h>
#ifdef __cplusplus
extern "C" {
#endif
/* TYPES *********************************************************************/ /* TYPES *********************************************************************/
struct _EPROCESS; struct _EPROCESS;
@ -1641,3 +1645,6 @@ MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
IN KPROCESSOR_MODE PreviousMode, IN KPROCESSOR_MODE PreviousMode,
OUT PSIZE_T ReturnSize); OUT PSIZE_T ReturnSize);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -8,6 +8,10 @@
#pragma once #pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define MI_LOWEST_VAD_ADDRESS (PVOID)MM_LOWEST_USER_ADDRESS #define MI_LOWEST_VAD_ADDRESS (PVOID)MM_LOWEST_USER_ADDRESS
/* Make the code cleaner with some definitions for size multiples */ /* Make the code cleaner with some definitions for size multiples */
@ -575,7 +579,6 @@ extern PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor;
extern MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; extern MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor;
extern ULONG_PTR MxPfnAllocation; extern ULONG_PTR MxPfnAllocation;
extern MM_PAGED_POOL_INFO MmPagedPoolInfo; extern MM_PAGED_POOL_INFO MmPagedPoolInfo;
extern RTL_BITMAP MiPfnBitMap;
extern KGUARDED_MUTEX MmPagedPoolMutex; extern KGUARDED_MUTEX MmPagedPoolMutex;
extern KGUARDED_MUTEX MmSectionCommitMutex; extern KGUARDED_MUTEX MmSectionCommitMutex;
extern PVOID MmPagedPoolStart; extern PVOID MmPagedPoolStart;
@ -627,7 +630,6 @@ extern PFN_NUMBER MmMinimumFreePages;
extern PFN_NUMBER MmPlentyFreePages; extern PFN_NUMBER MmPlentyFreePages;
extern SIZE_T MmMinimumStackCommitInBytes; extern SIZE_T MmMinimumStackCommitInBytes;
extern PFN_COUNT MiExpansionPoolPagesInitialCharge; extern PFN_COUNT MiExpansionPoolPagesInitialCharge;
extern PFN_NUMBER MmResidentAvailablePages;
extern PFN_NUMBER MmResidentAvailableAtInit; extern PFN_NUMBER MmResidentAvailableAtInit;
extern ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes]; extern ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes];
extern PFN_NUMBER MmTotalSystemDriverPages; extern PFN_NUMBER MmTotalSystemDriverPages;
@ -1076,10 +1078,9 @@ MI_WS_OWNER(IN PEPROCESS Process)
// //
FORCEINLINE FORCEINLINE
BOOLEAN BOOLEAN
MiIsRosSectionObject(IN PVOID Section) MiIsRosSectionObject(IN PSECTION Section)
{ {
PSECTION RosSection = Section; return Section->u.Flags.filler;
return RosSection->u.Flags.filler;
} }
#define MI_IS_ROS_PFN(x) ((x)->u4.AweAllocation == TRUE) #define MI_IS_ROS_PFN(x) ((x)->u4.AweAllocation == TRUE)
@ -1941,12 +1942,6 @@ MiCheckPdeForPagedPool(
IN PVOID Address IN PVOID Address
); );
VOID
NTAPI
MiInitializeNonPagedPool(
VOID
);
VOID VOID
NTAPI NTAPI
MiInitializeNonPagedPoolThresholds( MiInitializeNonPagedPoolThresholds(
@ -2393,12 +2388,6 @@ MiRosUnmapViewInSystemSpace(
IN PVOID MappedBase IN PVOID MappedBase
); );
POOL_TYPE
NTAPI
MmDeterminePoolType(
IN PVOID PoolAddress
);
VOID VOID
NTAPI NTAPI
MiMakePdeExistAndMakeValid( MiMakePdeExistAndMakeValid(
@ -2450,4 +2439,8 @@ MiSynchronizeSystemPde(PMMPDE PointerPde)
} }
#endif #endif
#ifdef __cplusplus
} // extern "C"
#endif
/* EOF */ /* EOF */