Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #33 from intel/pagewalker-gva2gpa
Browse files Browse the repository at this point in the history
page_walker: Fix 32-bit GVA-GPA translation bug
  • Loading branch information
raphaelning committed Mar 16, 2018
2 parents dabddba + 57590d2 commit 2048835
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/page_walker.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ static uint64 pw_retrieve_phys_addr(PW_PAGE_ENTRY *entry, bool is_pae)
return ((uint64)addr_high << PW_HIGH_ADDRESS_SHIFT) | addr_low;
}

return entry->non_pae_entry.bits.addr_base << PW_TABLE_SHIFT;
// Must convert the uint32 bit-field to uint64 before the shift. Otherwise,
// on Mac the shift result will be sign-extended to 64 bits (Clang bug?),
// yielding invalid GPAs such as 0xffffffff801c8000.
return (uint64)entry->non_pae_entry.bits.addr_base << PW_TABLE_SHIFT;
}

static uint64 pw_retrieve_big_page_phys_addr(PW_PAGE_ENTRY *entry, bool is_pae,
Expand Down

0 comments on commit 2048835

Please sign in to comment.