diff mbox

[2/2] translate-all: add missing munmap of the code_gen guard page for MIPS

Message ID 1461283314-2353-2-git-send-email-cota@braap.org
State New
Headers show

Commit Message

Emilio Cota April 22, 2016, 12:01 a.m. UTC
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 translate-all.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Henderson April 24, 2016, 10:56 p.m. UTC | #1
On 04/21/2016 05:01 PM, Emilio G. Cota wrote:
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>   translate-all.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)


Applied to tcg-next. Thanks.


r~
diff mbox

Patch

diff --git a/translate-all.c b/translate-all.c
index e700399..bba9b62 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -668,39 +668,39 @@  static inline void *alloc_code_gen_buffer(void)
     buf = mmap((void *)start, size + qemu_real_host_page_size,
                PROT_NONE, flags, -1, 0);
     if (buf == MAP_FAILED) {
         return NULL;
     }
 
 #ifdef __mips__
     if (cross_256mb(buf, size)) {
         /* Try again, with the original still mapped, to avoid re-acquiring
            that 256mb crossing.  This time don't specify an address.  */
         size_t size2;
         void *buf2 = mmap(NULL, size + qemu_real_host_page_size,
                           PROT_NONE, flags, -1, 0);
         switch (buf2 != MAP_FAILED) {
         case 1:
             if (!cross_256mb(buf2, size)) {
                 /* Success!  Use the new buffer.  */
-                munmap(buf, size);
+                munmap(buf, size + qemu_real_host_page_size);
                 break;
             }
             /* Failure.  Work with what we had.  */
-            munmap(buf2, size);
+            munmap(buf2, size + qemu_real_host_page_size);
             /* fallthru */
         default:
             /* Split the original buffer.  Free the smaller half.  */
             buf2 = split_cross_256mb(buf, size);
             size2 = tcg_ctx.code_gen_buffer_size;
             if (buf == buf2) {
                 munmap(buf + size2 + qemu_real_host_page_size, size - size2);
             } else {
                 munmap(buf, size - size2);
             }
             size = size2;
             break;
         }
         buf = buf2;
     }
 #endif