Migrate EX subsystem to C++
This commit is contained in:
112
xtoskrnl/ex/exports.cc
Normal file
112
xtoskrnl/ex/exports.cc
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/ex/exports.cc
|
||||||
|
* DESCRIPTION: C-compatible API wrappers for exported kernel functions
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires the rundown protection for given descriptor.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the rundown block descriptor.
|
||||||
|
*
|
||||||
|
* @return This routine returns TRUE if protection acquired successfully, or FALSE otherwise.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
BOOLEAN
|
||||||
|
ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
return EX::Rundown::AcquireProtection(Descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the rundown descriptor as completed.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the descriptor to be completed.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
EX::Rundown::CompleteProtection(Descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the rundown protection descriptor.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the descriptor to be initialized.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
EX::Rundown::InitializeProtection(Descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reinitializes the rundown protection structure after it has been completed.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the descriptor to be reinitialized.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
EX::Rundown::ReInitializeProtection(Descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases the rundown protection for given descriptor.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the descriptor to be initialized.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
EX::Rundown::ReleaseProtection(Descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits until rundown protection calls are completed.
|
||||||
|
*
|
||||||
|
* @param Descriptor
|
||||||
|
* Supplies a pointer to the rundown block descriptor.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 5.1
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
ExWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
|
{
|
||||||
|
EX::Rundown::WaitForProtectionRelease(Descriptor);
|
||||||
|
}
|
@@ -1,14 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* PROJECT: ExectOS
|
* PROJECT: ExectOS
|
||||||
* COPYRIGHT: See COPYING.md in the top level directory
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
* FILE: xtoskrnl/ex/rundown.c
|
* FILE: xtoskrnl/ex/rundown.cc
|
||||||
* DESCRIPTION: Rundown protection mechanism
|
* DESCRIPTION: Rundown protection mechanism
|
||||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtos.h>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
namespace EX
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquires the rundown protection for given descriptor.
|
* Acquires the rundown protection for given descriptor.
|
||||||
*
|
*
|
||||||
@@ -21,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::AcquireProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
ULONG_PTR CurrentValue, NewValue;
|
ULONG_PTR CurrentValue, NewValue;
|
||||||
|
|
||||||
@@ -69,7 +72,7 @@ ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::CompleteProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
RtlAtomicExchangePointer(&Descriptor->Ptr, (PVOID)EX_RUNDOWN_ACTIVE);
|
RtlAtomicExchangePointer(&Descriptor->Ptr, (PVOID)EX_RUNDOWN_ACTIVE);
|
||||||
}
|
}
|
||||||
@@ -86,7 +89,7 @@ ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::InitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
/* Reset descriptor counter */
|
/* Reset descriptor counter */
|
||||||
Descriptor->Count = 0;
|
Descriptor->Count = 0;
|
||||||
@@ -104,7 +107,7 @@ ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::ReInitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
RtlAtomicExchangePointer(&Descriptor->Ptr, NULL);
|
RtlAtomicExchangePointer(&Descriptor->Ptr, NULL);
|
||||||
}
|
}
|
||||||
@@ -121,7 +124,7 @@ ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::ReleaseProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
ULONG_PTR CurrentValue, NewValue;
|
ULONG_PTR CurrentValue, NewValue;
|
||||||
PEX_RUNDOWN_WAIT_BLOCK WaitBlock;
|
PEX_RUNDOWN_WAIT_BLOCK WaitBlock;
|
||||||
@@ -172,7 +175,9 @@ ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
ExWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
Rundown::WaitForProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} /* namespace */
|
16
xtoskrnl/includes/ex.hh
Normal file
16
xtoskrnl/includes/ex.hh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/includes/ex.hh
|
||||||
|
* DESCRIPTION:
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTOSKRNL_EX_HH
|
||||||
|
#define __XTOSKRNL_EX_HH
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
#include <ex/rundown.hh>
|
||||||
|
|
||||||
|
#endif /* __XTOSKRNL_EX_HH */
|
30
xtoskrnl/includes/ex/rundown.hh
Normal file
30
xtoskrnl/includes/ex/rundown.hh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/includes/ex/rundown.hh
|
||||||
|
* DESCRIPTION: Rundown protection mechanism
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTOSKRNL_EX_RUNDOWN_HH
|
||||||
|
#define __XTOSKRNL_EX_RUNDOWN_HH
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* Architecture-specific Library */
|
||||||
|
namespace EX
|
||||||
|
{
|
||||||
|
class Rundown
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTFASTCALL BOOLEAN AcquireProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
STATIC XTFASTCALL VOID CompleteProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
STATIC XTFASTCALL VOID InitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
STATIC XTFASTCALL VOID ReInitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
STATIC XTFASTCALL VOID ReleaseProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
STATIC XTFASTCALL VOID WaitForProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __XTOSKRNL_EX_RUNDOWN_HH */
|
@@ -27,3 +27,4 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#include <ar.hh>
|
#include <ar.hh>
|
||||||
|
#include <ex.hh>
|
||||||
|
Reference in New Issue
Block a user