review remark

This commit is contained in:
RadWolfie 2022-04-05 17:45:36 -05:00
parent 6d395bf2ee
commit 351c9a7c86
3 changed files with 10 additions and 7 deletions

View File

@ -145,7 +145,15 @@ inline constexpr uint32_t FLASH_DEVICE4_END = (FLASH_DEVICE4_BASE - 1 + FLA
#define PAGE_SHIFT 12 // 2^12 = 4 KiB
#define PAGE_SIZE (1 << PAGE_SHIFT) // = 0x00001000 = KiB(4)
#define PAGE_MASK (PAGE_SIZE - 1)
#define PAGE_ALIGN(address) (PVOID) ((ulong_ptr_xt)(address) & ~PAGE_MASK))
// Common page calculations
#define ROUND_UP_4K(size) (((size) + PAGE_MASK) & (~PAGE_MASK))
#define ROUND_UP(size, alignment) (((size) + (alignment - 1)) & (~(alignment - 1)))
#define ROUND_DOWN_4K(size) ((size) & (~PAGE_MASK))
#define ROUND_DOWN(size, alignment) ((size) & (~(alignment - 1)))
#define CHECK_ALIGNMENT(size, alignment) (((size) % (alignment)) == 0)
#define PAGE_ALIGN(address) ROUND_DOWN_4K(address)
#define LARGE_PAGE_SHIFT 22 // 2^22 = 4 MiB
#define LARGE_PAGE_SIZE (1 << LARGE_PAGE_SHIFT) // = 0x00400000 = 4 MiB

View File

@ -82,7 +82,7 @@ xbox::boolean_xt RtlpCaptureStackLimits(
else {
/* We're somewhere else entirely... use EBP for safety */
*StackBegin = Ebp;
*StackEnd = reinterpret_cast<ulong_ptr_xt>(PAGE_ALIGN((*StackBegin));
*StackEnd = PAGE_ALIGN(*StackBegin);
}
/* Return success */

View File

@ -126,11 +126,6 @@ typedef enum _MmLayout
/* Common page calculations */
#define ROUND_UP_4K(size) (((size) + PAGE_MASK) & (~PAGE_MASK))
#define ROUND_UP(size, alignment) (((size) + (alignment - 1)) & (~(alignment - 1)))
#define ROUND_DOWN_4K(size) ((size) & (~PAGE_MASK))
#define ROUND_DOWN(size, alignment) ((size) & (~(alignment - 1)))
#define CHECK_ALIGNMENT(size, alignment) (((size) % (alignment)) == 0)
#define PAGES_SPANNED(Va, Size) ((ULONG)((((VAddr)(Va) & (PAGE_SIZE - 1)) + (Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
#define PAGES_SPANNED_LARGE(Va, Size) ((ULONG)((((VAddr)(Va) & (LARGE_PAGE_SIZE - 1)) + (Size) + (LARGE_PAGE_SIZE - 1)) >> LARGE_PAGE_SHIFT))
#define BYTE_OFFSET(Va) ((ULONG)((VAddr)(Va) & (PAGE_SIZE - 1)))