[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/13] sparc/ldst_helper: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 08/13] sparc/ldst_helper: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:37 -0400 |
use ranges_overlap() instead of open-coding the overlap check to improve
the readability of the code.
Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
---
target/sparc/ldst_helper.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 2d48e98bf468..d92c9f15934e 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
+#include "qemu/range.h"
#include "cpu.h"
#include "tcg/tcg.h"
#include "exec/helper-proto.h"
@@ -240,9 +241,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
if (new_ctx == ctx) {
uint64_t vaddr = tlb[i].tag & ~0x1fffULL;
uint64_t size = 8192ULL << 3 * TTE_PGSIZE(tlb[i].tte);
- if (new_vaddr == vaddr
- || (new_vaddr < vaddr + size
- && vaddr < new_vaddr + new_size)) {
+ if (ranges_overlap(new_vaddr, new_size, vaddr, size)) {
DPRINTF_MMU("auto demap entry [%d] %lx->%lx\n", i, vaddr,
new_vaddr);
replace_tlb_entry(&tlb[i], tlb_tag, tlb_tte, env1);
--
2.41.0
- Re: [PATCH 01/13] range: Make ranges_overlap() return bool, (continued)
- [PATCH 02/13] arm/boot: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 04/13] cxl/mailbox: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 13/13] block/qcow2-cluster: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 05/13] display/sm501: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 10/13] block/vhdx: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 06/13] aspeed_smc: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 08/13] sparc/ldst_helper: make range overlap check more readable,
Yao Xingtao <=
- [PATCH 11/13] crypto/block-luks: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 09/13] system/memory_mapping: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 07/13] qtest/fuzz: make range overlap check more readable, Yao Xingtao, 2024/07/22