48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
|
From 8dc126f05ef5f8d0105d5d1b77493a27df8b4e30 Mon Sep 17 00:00:00 2001
|
||
|
From: Ulrich Hecht <uli@suse.de>
|
||
|
Date: Tue, 14 Apr 2009 16:24:15 +0200
|
||
|
Subject: [PATCH 05/16] qemu-cvs-alsa_mmap
|
||
|
|
||
|
Hack to prevent ALSA from using mmap() interface to simplify emulation.
|
||
|
|
||
|
Signed-off-by: Ulrich Hecht <uli@suse.de>
|
||
|
---
|
||
|
linux-user/mmap.c | 14 ++++++++++++++
|
||
|
1 files changed, 14 insertions(+), 0 deletions(-)
|
||
|
|
||
|
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
|
||
|
index 144fb7c..1ea202b 100644
|
||
|
--- a/linux-user/mmap.c
|
||
|
+++ b/linux-user/mmap.c
|
||
|
@@ -328,6 +328,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
|
||
|
return h2g(ptr);
|
||
|
}
|
||
|
|
||
|
+#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
|
||
|
+#define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000
|
||
|
+
|
||
|
/* NOTE: all the constants are the HOST ones */
|
||
|
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
||
|
int flags, int fd, abi_ulong offset)
|
||
|
@@ -363,6 +366,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
+ /* Alsa tries to communcate with the kernel via mmap. This usually
|
||
|
+ * is a good idea when user- and kernelspace are running on the
|
||
|
+ * same architecture but does not work out when not. To make alsa
|
||
|
+ * not to use mmap, we can just have it fail on the mmap calls that
|
||
|
+ * would initiate this.
|
||
|
+ */
|
||
|
+ if(offset == SNDRV_PCM_MMAP_OFFSET_STATUS || offset == SNDRV_PCM_MMAP_OFFSET_CONTROL) {
|
||
|
+ errno = EINVAL;
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
if (offset & ~TARGET_PAGE_MASK) {
|
||
|
errno = EINVAL;
|
||
|
goto fail;
|
||
|
--
|
||
|
1.6.4.2
|
||
|
|