[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
#ifdef __cplusplus
extern "C"
{
#endif
/* GLOBAL VARIABLES *********************************************************/
extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
@ -1513,3 +1518,7 @@ XIPInit(
#define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand) \
(ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand))
#ifdef __cplusplus
} // extern "C"
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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