Skip to content

Commit

Permalink
recursive page table walker
Browse files Browse the repository at this point in the history
  • Loading branch information
handong32 committed Nov 4, 2019
1 parent c80dd47 commit 68caa40
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/native/VMemAllocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ ebbrt::VMemAllocator::Alloc(size_t npages, size_t pages_align,
npages);
}

// Recursive page table walker
struct Frame {
struct Frame *next;
uint64_t rip;
};

void dumpFrames(int n, struct Frame *s)
{
struct Frame *f;
int i;
for (i=0,f=s; i<n; f=f->next,i++) {
ebbrt::kprintf("FRAME[%d]: %p RIP: 0x%llx next:%p\n", -1*i, f,
f->rip, f->next);
}
}

void ebbrt::VMemAllocator::HandlePageFault(idt::ExceptionFrame* ef) {
std::lock_guard<SpinLock> lock(lock_);
auto fault_addr = ReadCr2();
Expand Down

0 comments on commit 68caa40

Please sign in to comment.