diff --git a/src/kernel/memory/pmm.c b/src/kernel/memory/pmm.c index cfaf7c1..717abcc 100644 --- a/src/kernel/memory/pmm.c +++ b/src/kernel/memory/pmm.c @@ -4,6 +4,7 @@ uintptr_t *first = 0; void pmm_free(void *c) { + c = (uintptr_t *)P2V(c); *(uintptr_t *)c = (uintptr_t)first; first = c; } @@ -12,5 +13,6 @@ void *pmm_alloc() { void *c = first; first = (uintptr_t *)(c?*(uintptr_t *)c:0); + c = (uintptr_t *)V2P(c); return c; } diff --git a/src/kernel/memory/pmm.tt b/src/kernel/memory/pmm.tt index d724e7e..71732d6 100644 --- a/src/kernel/memory/pmm.tt +++ b/src/kernel/memory/pmm.tt @@ -1,6 +1,11 @@ // vim: ft=c #include +#include +#undef P2V +#define P2V(addr) (void *)((uintptr_t)(addr)) +#undef V2P +#define V2P(addr) (void *)((uintptr_t)(addr)) #include "pmm.c" struct {