Skip to content

Commit

Permalink
Change types to fix errors-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Nikula committed Jan 31, 2020
1 parent 9b0fc4d commit 9ee6c42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pifm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ struct GPCTL {


void getRealMemPage(void** vAddr, void** pAddr) {
void* a = valloc(4096);
int* a = (int*)valloc(4096);

((int*)a)[0] = 1; // use page to force allocation.
a[0] = 1; // use page to force allocation.

mlock(a, 4096); // lock into ram.
mlock((void*)a, 4096); // lock into ram.

*vAddr = a; // yay - we know the virtual address

unsigned long long frameinfo;

int fp = open("/proc/self/pagemap", O_RDONLY);
lseek(fp, ((int)a)/4096*8, SEEK_SET);
lseek(fp, a/4096*8, SEEK_SET);
read(fp, &frameinfo, sizeof(frameinfo));

*pAddr = (void*)((int)(frameinfo*4096));
Expand Down

0 comments on commit 9ee6c42

Please sign in to comment.