2011-03-31 10:21:32 +00:00
|
|
|
#ifndef __CPAGEDIRECTORY_H__
|
|
|
|
#define __CPAGEDIRECTORY_H__
|
|
|
|
|
|
|
|
#include "types.h"
|
2011-04-01 13:21:31 +00:00
|
|
|
extern "C" {
|
|
|
|
#include "Tier0/paging.h"
|
|
|
|
};
|
2011-03-31 10:21:32 +00:00
|
|
|
|
2012-10-30 11:08:11 +00:00
|
|
|
// This is more-or less just a C++ wrapper for T_PAGING_ML4. For use for pure-kernel processes only
|
2011-03-31 10:21:32 +00:00
|
|
|
namespace cb {
|
2012-10-30 11:00:52 +00:00
|
|
|
class CKernelML4 {
|
2012-10-30 11:08:11 +00:00
|
|
|
private:
|
2011-04-01 13:21:31 +00:00
|
|
|
// The paging direcotry structure
|
2012-10-30 11:00:52 +00:00
|
|
|
T_PAGING_ML4 *m_Directory;
|
2012-10-30 11:08:11 +00:00
|
|
|
|
|
|
|
// allocator and destructor for segments
|
|
|
|
void *(*m_SegmentAllocator)(u64);
|
|
|
|
void (*m_SegmentDestructor)(void *);
|
2011-03-31 10:21:32 +00:00
|
|
|
public:
|
2012-10-30 11:08:11 +00:00
|
|
|
// Creates a new page directory for a kernel task, with new stack and other private segments
|
|
|
|
// Allocator is a function pointer to an allocator to use, Destructor is the same but for
|
|
|
|
// deallocation
|
|
|
|
CKernelML4(void *(*Allocator)(u64), void (*Destructor)(void *));
|
|
|
|
// Creates a new page directory for a kernel task, with existing stack
|
|
|
|
// This constructor also makes the destructor not free anything.
|
|
|
|
CKernelML4(void *StackStart, u64 StackSize);
|
|
|
|
|
|
|
|
// Destroys the structures and frees the segments, if needed
|
|
|
|
~CKernelML4(void);
|
2011-03-31 10:21:32 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|