PMM -- Convert between virtual and physical address
This commit is contained in:
parent
1daf8ed47b
commit
82fbafc38e
@ -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;
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
// vim: ft=c
|
||||
#include <ttest.h>
|
||||
|
||||
#include <memory.h>
|
||||
#undef P2V
|
||||
#define P2V(addr) (void *)((uintptr_t)(addr))
|
||||
#undef V2P
|
||||
#define V2P(addr) (void *)((uintptr_t)(addr))
|
||||
#include "pmm.c"
|
||||
|
||||
struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user