Skip to content

Commit

Permalink
Merge PR #700 (Use correct page pointer types) into max-next
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Feb 10, 2016
2 parents 5965197 + 080fba5 commit eae7da6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@

// Convert from virtual addresses in our own process address space to
// physical addresses in the RAM chips.
uint64_t virtual_to_physical(void *ptr)
uint64_t virtual_to_physical(uintptr_t *ptr)
{
uint64_t virt_page;
uintptr_t virt_page;
static int pagemap_fd;
virt_page = ((uint64_t)ptr) / 4096;
virt_page = ((uintptr_t)ptr) / 4096;
if (pagemap_fd == 0) {
if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY)) <= 0) {
perror("open pagemap");
return 0;
}
}
uint64_t data;
uintptr_t data;
int len;
len = pread(pagemap_fd, &data, sizeof(data), virt_page * sizeof(uint64_t));
if (len != sizeof(data)) {
Expand Down Expand Up @@ -80,7 +80,7 @@ uint64_t virtual_to_physical(void *ptr)
void *allocate_huge_page(int size)
{
int shmid = -1;
uint64_t physical_address, virtual_address;
uintptr_t physical_address, virtual_address;
void *tmpptr = MAP_FAILED; // initial kernel assigned virtual address
void *realptr = MAP_FAILED; // remapped virtual address
shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W);
Expand Down

0 comments on commit eae7da6

Please sign in to comment.