Skip to content

Commit

Permalink
Merge pull request #388 from ved-rivos/0726
Browse files Browse the repository at this point in the history
Fix G accumulation
  • Loading branch information
ved-rivos authored Jul 26, 2024
2 parents 6fc5fe9 + 1224115 commit 6ad7e87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iommu_ref_model/libiommu/src/iommu_two_stage_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ two_stage_address_translation(
uint16_t ppn[5];
pte_t amo_pte;
gpte_t gpte;
uint8_t NL_G = 1;
uint8_t NL_G = 0;
uint8_t PTESIZE, LEVELS, status, pte_changed, gst_fault;
int8_t i;
uint64_t a, masked_upper_bits, mask;
Expand Down Expand Up @@ -178,7 +178,7 @@ two_stage_address_translation(
// The G bit designates a global mapping. Global mappings are those that exist
// in all address spaces. For non-leaf PTEs, the global setting implies that
// all mappings in the subsequent levels of the page table are global.
NL_G = NL_G & pte->G;
NL_G = NL_G | pte->G;

// For non-leaf PTEs, bits 62–61 are reserved for future standard use. Until
// their use is defined by a standard extension, they must be cleared by
Expand Down Expand Up @@ -341,7 +341,7 @@ two_stage_address_translation(
// The G bit designates a global mapping. Global mappings are those that exist
// in all address spaces. For non-leaf PTEs, the global setting implies that
// all mappings in the subsequent levels of the page table are global.
pte->G = NL_G & pte->G;
pte->G = NL_G | pte->G;

// The translated physical address is given as follows:
// pa.pgoff = va.pgoff.
Expand Down

0 comments on commit 6ad7e87

Please sign in to comment.