summaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2014-01-17 15:28:18 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2014-01-17 15:28:18 +0000
commit0193c62c94643a837832f2b5ccc133434ee740cb (patch)
treec859a3aa0b8ff27169c8fa34c9fceadea5cd4f37 /hw/display
parent1cf892ca2689c84960b4ce4d2723b6bee453711c (diff)
downloadqemu-0193c62c94643a837832f2b5ccc133434ee740cb.tar.gz
xenfb: map framebuffer read-only and handle unmap errors
The framebuffer is needlessly mapped (PROT_READ | PROT_WRITE), map it PROT_READ instead. The framebuffer is unmapped by replacing the framebuffer pages with anonymous shared memory, calling mmap. Check for return errors and print a warning. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/xenfb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index f0333a0cad..cb9d456814 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -495,7 +495,7 @@ static int xenfb_map_fb(struct XenFB *xenfb)
munmap(map, n_fbdirs * XC_PAGE_SIZE);
xenfb->pixels = xc_map_foreign_pages(xen_xc, xenfb->c.xendev.dom,
- PROT_READ | PROT_WRITE, fbmfns, xenfb->fbpages);
+ PROT_READ, fbmfns, xenfb->fbpages);
if (xenfb->pixels == NULL)
goto out;
@@ -903,6 +903,11 @@ static void fb_disconnect(struct XenDevice *xendev)
fb->pixels = mmap(fb->pixels, fb->fbpages * XC_PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON,
-1, 0);
+ if (fb->pixels == MAP_FAILED) {
+ xen_be_printf(xendev, 0,
+ "Couldn't replace the framebuffer with anonymous memory errno=%d\n",
+ errno);
+ }
common_unbind(&fb->c);
fb->feature_update = 0;
fb->bug_trigger = 0;