Skip to content

Commit

Permalink
Fix ppc32 ptel creation in ppc32_map_page.
Browse files Browse the repository at this point in the history
ppc32_slow_lookup turns ptel into paddr.
Therefore ppc32_map_page should turn paddr into ptel.
  • Loading branch information
flaviojs committed Mar 27, 2024
1 parent e1dfdd0 commit f50d133
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions stable/ppc32_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ int ppc32_map_page(cpu_ppc_t *cpu,u_int vsid,m_uint32_t vaddr,m_uint64_t paddr,
tmp |= (vaddr >> 22) & 0x3F;
*(m_uint32_t *)pte_haddr = htovm32(tmp);

tmp = vaddr & PPC32_PTEL_RPN_MASK;
tmp |= (vaddr >> (32 - PPC32_PTEL_X_SHIFT)) & PPC32_PTEL_X_MASK;
tmp |= (vaddr >> (33 - PPC32_PTEL_XPN_SHIFT)) & PPC32_PTEL_XPN_MASK;
tmp = ((m_uint32_t)paddr) & PPC32_PTEL_RPN_MASK;
tmp |= ((m_uint32_t)(paddr >> (32 - PPC32_PTEL_X_SHIFT))) & PPC32_PTEL_X_MASK;
tmp |= ((m_uint32_t)(paddr >> (33 - PPC32_PTEL_XPN_SHIFT))) & PPC32_PTEL_XPN_MASK;

tmp |= (wimg << PPC32_PTEL_WIMG_SHIFT) + pp;
*(m_uint32_t *)(pte_haddr+sizeof(m_uint32_t)) = htovm32(tmp);
Expand Down
6 changes: 3 additions & 3 deletions unstable/ppc32_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ int ppc32_map_page(cpu_ppc_t *cpu,u_int vsid,m_uint32_t vaddr,m_uint64_t paddr,
tmp |= (vaddr >> 22) & 0x3F;
*(m_uint32_t *)pte_haddr = htovm32(tmp);

tmp = vaddr & PPC32_PTEL_RPN_MASK;
tmp |= (vaddr >> (32 - PPC32_PTEL_X_SHIFT)) & PPC32_PTEL_X_MASK;
tmp |= (vaddr >> (33 - PPC32_PTEL_XPN_SHIFT)) & PPC32_PTEL_XPN_MASK;
tmp = ((m_uint32_t)vaddr) & PPC32_PTEL_RPN_MASK;
tmp |= ((m_uint32_t)(vaddr >> (32 - PPC32_PTEL_X_SHIFT))) & PPC32_PTEL_X_MASK;
tmp |= ((m_uint32_t)(vaddr >> (33 - PPC32_PTEL_XPN_SHIFT))) & PPC32_PTEL_XPN_MASK;

tmp |= (wimg << PPC32_PTEL_WIMG_SHIFT) + pp;
*(m_uint32_t *)(pte_haddr+sizeof(m_uint32_t)) = htovm32(tmp);
Expand Down

0 comments on commit f50d133

Please sign in to comment.