From f50d133b0f38e813ae7a2a8137d06b3c0f29a992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Wed, 27 Mar 2024 20:16:49 +0000 Subject: [PATCH] Fix ppc32 ptel creation in ppc32_map_page. ppc32_slow_lookup turns ptel into paddr. Therefore ppc32_map_page should turn paddr into ptel. --- stable/ppc32_mem.c | 6 +++--- unstable/ppc32_mem.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stable/ppc32_mem.c b/stable/ppc32_mem.c index fbb860338..0709073e6 100644 --- a/stable/ppc32_mem.c +++ b/stable/ppc32_mem.c @@ -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); diff --git a/unstable/ppc32_mem.c b/unstable/ppc32_mem.c index ab3c1f012..e686b9539 100644 --- a/unstable/ppc32_mem.c +++ b/unstable/ppc32_mem.c @@ -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);