Add pages related macros and definitions
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Rafal Kupiec 2023-02-13 23:01:20 +01:00
parent 050f24f877
commit 2e790bd9b2
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 20 additions and 1 deletions

View File

@ -12,6 +12,11 @@
#include <xtbase.h>
/* Pages related definitions */
#define MM_PAGE_MASK 0xFFF
#define MM_PAGE_SHIFT 12
#define MM_PAGE_SIZE 4096
/* Page Table entry structure definition */
typedef struct _HARDWARE_PTE
{

View File

@ -12,6 +12,11 @@
#include <xtbase.h>
/* Pages related definitions */
#define MM_PAGE_MASK 0xFFF
#define MM_PAGE_SHIFT 12
#define MM_PAGE_SIZE 4096
/* Page Table entry structure definition (with PAE support) */
typedef struct _HARDWARE_PTE
{

View File

@ -52,8 +52,14 @@
/* Macro that yields field type in the structure */
#define FIELD_TYPE(Structure, Field) (((Structure*)0)->Field)
/* Macro that page-aligns a virtual address */
#define PAGE_ALIGN(VirtualAddress) ((PVOID)((ULONG_PTR)VirtualAddress & ~MM_PAGE_MASK))
/* Macro that returns offset of the virtual address */
#define PAGE_OFFSET(VirtualAddress) ((ULONG)((ULONG_PTR)VirtualAddress & MM_PAGE_MASK))
/* Macro for rounding down */
#define ROUND_DOWN(X, Alignment) ((X) & ~((Alignment) - 1l))
#define ROUND_DOWN(X, Alignment) ((X) & ~((Alignment) - 1))
/* Macro for rounding up */
#define ROUND_UP(X, Alignment) ROUND_DOWN((X) + (Alignment - 1), Alignment)
@ -63,6 +69,9 @@
#define SIGNATURE32(A, B, C, D) (SIGNATURE16(A, B) | (SIGNATURE16(C, D) << 16))
#define SIGNATURE64(A, B, C, D, E, F, G, H) (SIGNATURE32(A, B, C, D) | ((UINT64)(SIGNATURE32(E, F, G, H)) << 32))
/* XT size to pages conversion macro */
#define SIZE_TO_PAGES(Size) (((Size) >> MM_PAGE_SHIFT) + (((Size) & (MM_PAGE_MASK)) ? 1 : 0))
/* Variadic ABI functions */
typedef __builtin_va_list VA_LIST;
#define VA_ARG(Marker, Type) ((sizeof (Type) < sizeof(UINT_PTR)) ? \