[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] linux-user: Fix h2g usage in page_find_alloc
From: |
Kirill A. Shutemov |
Subject: |
[Qemu-devel] [PATCH] linux-user: Fix h2g usage in page_find_alloc |
Date: |
Wed, 3 Dec 2008 13:29:41 +0200 |
From: Jan Kiszka <address@hidden>
Paul's comment on my first approach to fix the h2g usage in
page_find_alloc finally open my eyes about what the code is actually
supposed to do:
With the help of h2g_valid we can no cleanly check if a freshly allocate
page (for host usage) is guest-reachable and, in case it is, mark it
reserved in the guest's address range.
Signed-off-by: Jan Kiszka <address@hidden>
Signed-off-by: Kirill A. Shutemov <address@hidden>
---
exec.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/exec.c b/exec.c
index 58a0cff..105812f 100644
--- a/exec.c
+++ b/exec.c
@@ -305,14 +305,13 @@ static inline PageDesc *page_find_alloc(target_ulong
index)
if (!p) {
/* allocate if not found */
#if defined(CONFIG_USER_ONLY)
- unsigned long addr;
size_t len = sizeof(PageDesc) * L2_SIZE;
/* Don't use qemu_malloc because it may recurse. */
p = mmap(0, len, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
*lp = p;
- addr = h2g(p);
- if (addr == (target_ulong)addr) {
+ if (h2g_valid(p)) {
+ unsigned long addr = h2g(p);
page_set_flags(addr & TARGET_PAGE_MASK,
TARGET_PAGE_ALIGN(addr + len),
PAGE_RESERVED);
--
1.6.0.2.GIT
- [Qemu-devel] [PATCH] Introduce --enable-binfmt-misc configure option, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix fstatat64()/newfstatat() syscall implementation, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Move abi_* typedefs into qemu-types.h, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Safety belt for h2g, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Introduce h2g_valid, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] linux-user: Fix h2g usage in page_find_alloc,
Kirill A. Shutemov <=
- [Qemu-devel] [PATCH] Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix and cleanup IPCOP_sem* ipc calls handling, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Implement sem* syscalls, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Fix and cleanup IPCOP_shm* ipc calls handling, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] Implement shm* syscalls, Kirill A. Shutemov, 2008/12/03
- [Qemu-devel] [PATCH] shmat(): use mmap_find_vma to find free memory area, Kirill A. Shutemov, 2008/12/03
- Re: [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Edgar E. Iglesias, 2008/12/06
- Re: [Qemu-devel] [PATCH] mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly, Kirill A. Shutemov, 2008/12/06