[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 4/5] target-s390x: function to adjust the length
From: |
Aurelien Jarno |
Subject: |
[Qemu-devel] [PATCH RFC 4/5] target-s390x: function to adjust the length wrt page boundary |
Date: |
Tue, 2 Jun 2015 13:26:50 +0200 |
This patch adds a function to adjust the length of a transfer so that
it doesn't cross a page boundary.
Cc: Alexander Graf <address@hidden>
Cc: Richard Henderson <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>
---
target-s390x/mem_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
index 9fe9ed7..f34f2e1 100644
--- a/target-s390x/mem_helper.c
+++ b/target-s390x/mem_helper.c
@@ -55,6 +55,17 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
int mmu_idx,
#endif
#ifndef CONFIG_USER_ONLY
+
+/* Reduce the length so that addr + len doesn't cross a page boundary. */
+static inline uint64_t adj_len_to_page(uint64_t len, uint64_t addr)
+{
+ if ((addr & TARGET_PAGE_MASK) != ((addr + len - 1) & TARGET_PAGE_MASK)) {
+ return -addr & ~TARGET_PAGE_MASK;
+ } else {
+ return len;
+ }
+}
+
static void mvc_fast_memset(CPUS390XState *env, uint32_t l, uint64_t dest,
uint8_t byte)
{
--
2.1.4
- [Qemu-devel] [PATCH RFC 0/5] softmmu and s390x memory helper improvements, Aurelien Jarno, 2015/06/02
- [Qemu-devel] [PATCH RFC 4/5] target-s390x: function to adjust the length wrt page boundary,
Aurelien Jarno <=
- [Qemu-devel] [PATCH RFC 1/5] target-s390x: add a cpu_mmu_idx_to_asc function., Aurelien Jarno, 2015/06/02
- [Qemu-devel] [PATCH RFC 2/5] target-390x: support non current ASC in s390_cpu_handle_mmu_fault, Aurelien Jarno, 2015/06/02
- [Qemu-devel] [PATCH RFC 5/5] target-s390x: use softmmu host addr function for mvcp/mvcs, Aurelien Jarno, 2015/06/02
- [Qemu-devel] [PATCH RFC 3/5] softmmu: add a tlb_vaddr_to_host_fill function, Aurelien Jarno, 2015/06/02
- Re: [Qemu-devel] [PATCH RFC 3/5] softmmu: add a tlb_vaddr_to_host_fill function, Richard Henderson, 2015/06/02