diff mbox

[1/3] target-arm: don't hardcode mask values in arm_cpu_handle_mmu_fault

Message ID 1406217175-30267-2-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée July 24, 2014, 3:52 p.m. UTC
Otherwise we break quickly when we change TARGET_PAGE_SIZE.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Comments

Peter Maydell July 24, 2014, 4:10 p.m. UTC | #1
On 24 July 2014 16:52, Alex Bennée <alex.bennee@linaro.org> wrote:
> Otherwise we break quickly when we change TARGET_PAGE_SIZE.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index a0e57cd..aa5d267 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -4029,8 +4029,8 @@ int arm_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
>                          &page_size);
>      if (ret == 0) {
>          /* Map a single [sub]page.  */
> -        phys_addr &= ~(hwaddr)0x3ff;
> -        address &= ~(target_ulong)0x3ff;
> +        phys_addr &= TARGET_PAGE_MASK;
> +        address &= TARGET_PAGE_MASK;
>          tlb_set_page(cs, address, phys_addr, prot, mmu_idx, page_size);
>          return 0;
>      }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index a0e57cd..aa5d267 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -4029,8 +4029,8 @@  int arm_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
                         &page_size);
     if (ret == 0) {
         /* Map a single [sub]page.  */
-        phys_addr &= ~(hwaddr)0x3ff;
-        address &= ~(target_ulong)0x3ff;
+        phys_addr &= TARGET_PAGE_MASK;
+        address &= TARGET_PAGE_MASK;
         tlb_set_page(cs, address, phys_addr, prot, mmu_idx, page_size);
         return 0;
     }