Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
memory_utils.h
Go to the documentation of this file.
1
#ifndef __MEMORY__MEMORY_UTILS_H__
2
#define __MEMORY__MEMORY_UTILS_H__
3
4
#include <
type.h
>
5
6
#define ALIGN_UP(x, align) \
7
(((x) + ((uintptr_t) (align) - 1)) & ~((uintptr_t) (align) - 1))
8
9
#define ALIGN_DOWN(x, align) ((x) & ~((uintptr_t) (align) - 1))
10
11
#define PHYS2VIRT(x) (uint64_t)((uint64_t) x + 0xffff800000000000UL)
12
#define VIRT2PHYS(x) (uint64_t)((uint64_t) x - 0xffff800000000000UL)
13
14
#define PTR_ADD(ptr, off) ((void*) (((uint8_t*) (ptr)) + (off)))
15
16
#define ASSUME_ALIGNED(ptr, align) __builtin_assume_aligned((ptr), (align))
17
18
#endif
// __MEMORY__MEMORY_UTILS_H__
type.h
include
memory
memory_utils.h
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2