qemu/0028-XXX-merge-with-segmentation-fault-p.patch

56 lines
1.7 KiB
Diff

From 62ae064e6bb8028b2d3f91b8c2e9b44a84d5f3cd Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 11 Jul 2012 23:15:47 +0200
Subject: [PATCH] XXX merge with segmentation fault passing patch
---
user-exec.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/user-exec.c b/user-exec.c
index 83d2d44..3710c08 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -97,24 +97,28 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
pc, address, is_write, *(unsigned long *)old_set);
#endif
+ if (RESERVED_VA) {
+ /* Convert to guest address space */
+ address = address - GUEST_BASE;
+ }
+
/* Maybe we're still holding the TB fiddling lock? */
spin_unlock_safe(&tb_lock);
- if (h2g_valid(address)) {
- /* XXX: locking issue */
- if (is_write && page_unprotect(h2g(address), pc, puc)) {
- return 1;
- }
+ /* XXX: locking issue */
+ if (is_write && page_unprotect(address, pc, puc)) {
+ return 1;
+ }
- /* see if it is an MMU fault */
- ret = cpu_handle_mmu_fault(env, h2g(address), is_write, MMU_USER_IDX);
- if (ret < 0) {
- return 0; /* not an MMU fault */
- }
- if (ret == 0) {
- return 1; /* the MMU fault was handled without causing real CPU fault */
- }
+ /* see if it is an MMU fault */
+ ret = cpu_handle_mmu_fault(env, address, is_write, MMU_USER_IDX);
+ if (ret < 0) {
+ return 0; /* not an MMU fault */
}
+ if (ret == 0) {
+ return 1; /* the MMU fault was handled without causing real CPU fault */
+ }
+
/* now we have a real cpu fault */
tb = tb_find_pc(pc);
if (tb) {