guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 202/437: Ensure the end argument of __clear_cache is pag


From: Andy Wingo
Subject: [Guile-commits] 202/437: Ensure the end argument of __clear_cache is page aligned.
Date: Mon, 2 Jul 2018 05:14:18 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit 066db584c9e3d0b367ea94401373072735335fa2
Author: pcpa <address@hidden>
Date:   Mon Apr 8 18:00:36 2013 -0300

    Ensure the end argument of __clear_cache is page aligned.
    
        * lib/jit_arm.c, lib/jit_ppc.c: Do not rely on __clear_cache
        aligning to the next page boundary the end argument. It may
        actually truncate it.
---
 ChangeLog     | 6 ++++++
 lib/jit_arm.c | 3 ++-
 lib/jit_ppc.c | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a174e64..fe265f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-04-08 Paulo Andrade <address@hidden>
+
+       * lib/jit_arm.c, lib/jit_ppc.c: Do not rely on __clear_cache
+       aligning to the next page boundary the end argument. It may
+       actually truncate it.
+
 2013-03-29 Paulo Andrade <address@hidden>
 
        * include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_memory.c,
diff --git a/lib/jit_arm.c b/lib/jit_arm.c
index c4fe59e..07223e5 100644
--- a/lib/jit_arm.c
+++ b/lib/jit_arm.c
@@ -1563,7 +1563,8 @@ _emit_code(jit_state_t *_jit)
        patch_at(_jitc->patches.ptr[offset].kind & ~arm_patch_node, word, 
value);
     }
 
-    __clear_cache(_jit->code.ptr, _jit->pc.uc);
+    word = sysconf(_SC_PAGE_SIZE);
+    __clear_cache(_jit->code.ptr, (void *)((_jit->pc.w + word) & -word));
 
     return (_jit->code.ptr);
 }
diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c
index a09b24f..1f1c6b4 100644
--- a/lib/jit_ppc.c
+++ b/lib/jit_ppc.c
@@ -1346,7 +1346,8 @@ _emit_code(jit_state_t *_jit)
        patch_at(_jitc->patches.ptr[offset].inst, word);
     }
 
-    __clear_cache(_jit->code.ptr, _jit->pc.uc);
+    word = sysconf(_SC_PAGE_SIZE);
+    __clear_cache(_jit->code.ptr, (void *)((_jit->pc.w + word) & -word));
 
     return (_jit->code.ptr);
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]