aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/apos/utils.h8
-rw-r--r--include/apos/vmem.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/include/apos/utils.h b/include/apos/utils.h
index 318ba0a..b973d49 100644
--- a/include/apos/utils.h
+++ b/include/apos/utils.h
@@ -54,6 +54,14 @@ static inline size_t align_down(size_t val, size_t a)
return val - (val % a);
}
+static inline bool aligned(size_t val, size_t a)
+{
+ if (!a)
+ return true;
+
+ return val % a == 0;
+}
+
static inline size_t asciinum(char c)
{
if(c >= '0' && c <= '9')
diff --git a/include/apos/vmem.h b/include/apos/vmem.h
index fd1a165..4cc4895 100644
--- a/include/apos/vmem.h
+++ b/include/apos/vmem.h
@@ -30,6 +30,8 @@ struct sp_mem {
#define __pa(x) (((char *)(x)) + RAM_BASE - VM_DMAP)
#define __page(x) ((x) / BASE_PAGE_SIZE)
#define __addr(x) ((x) * BASE_PAGE_SIZE)
+#define __pages(x) (__page(x))
+#define __bytes(x) (__addr(x))
/* general overview of the different functions:
* internally they all work with pages, but they are called and return usable