diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/4a8579ad8629b57a43daa62e46cc7af6e1078116.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/4a8579ad8629b57a43daa62e46cc7af6e1078116.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/4a8579ad8629b57a43daa62e46cc7af6e1078116.patch b/meta/recipes-devtools/qemu/qemu/4a8579ad8629b57a43daa62e46cc7af6e1078116.patch new file mode 100644 index 0000000000..5ad859ebe6 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/4a8579ad8629b57a43daa62e46cc7af6e1078116.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 4a8579ad8629b57a43daa62e46cc7af6e1078116 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Henderson <richard.henderson@linaro.org> | ||
3 | Date: Tue, 13 Feb 2024 10:20:27 -1000 | ||
4 | Subject: [PATCH] linux-user: Split out do_munmap | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Upstream-Status: Submitted [https://gitlab.com/rth7680/qemu/-/commit/4a8579ad8629b57a43daa62e46cc7af6e1078116] | ||
10 | |||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | --- | ||
14 | linux-user/mmap.c | 23 ++++++++++++++++------- | ||
15 | 1 file changed, 16 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/linux-user/mmap.c b/linux-user/mmap.c | ||
18 | index 1bbfeb25b14..8ebcca44444 100644 | ||
19 | --- a/linux-user/mmap.c | ||
20 | +++ b/linux-user/mmap.c | ||
21 | @@ -267,6 +267,21 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) | ||
22 | return ret; | ||
23 | } | ||
24 | |||
25 | +/* | ||
26 | + * Perform munmap on behalf of the target, with host parameters. | ||
27 | + * If reserved_va, we must replace the memory reservation. | ||
28 | + */ | ||
29 | +static int do_munmap(void *addr, size_t len) | ||
30 | +{ | ||
31 | + if (reserved_va) { | ||
32 | + void *ptr = mmap(addr, len, PROT_NONE, | ||
33 | + MAP_FIXED | MAP_ANONYMOUS | ||
34 | + | MAP_PRIVATE | MAP_NORESERVE, -1, 0); | ||
35 | + return ptr == addr ? 0 : -1; | ||
36 | + } | ||
37 | + return munmap(addr, len); | ||
38 | +} | ||
39 | + | ||
40 | /* map an incomplete host page */ | ||
41 | static bool mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong last, | ||
42 | int prot, int flags, int fd, off_t offset) | ||
43 | @@ -854,13 +869,7 @@ static int mmap_reserve_or_unmap(abi_ulong start, abi_ulong len) | ||
44 | real_len = real_last - real_start + 1; | ||
45 | host_start = g2h_untagged(real_start); | ||
46 | |||
47 | - if (reserved_va) { | ||
48 | - void *ptr = mmap(host_start, real_len, PROT_NONE, | ||
49 | - MAP_FIXED | MAP_ANONYMOUS | ||
50 | - | MAP_PRIVATE | MAP_NORESERVE, -1, 0); | ||
51 | - return ptr == host_start ? 0 : -1; | ||
52 | - } | ||
53 | - return munmap(host_start, real_len); | ||
54 | + return do_munmap(host_start, real_len); | ||
55 | } | ||
56 | |||
57 | int target_munmap(abi_ulong start, abi_ulong len) | ||
58 | -- | ||
59 | GitLab | ||
60 | |||