aboutsummaryrefslogtreecommitdiff
path: root/py/asmthumb.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-06-04 01:17:09 +1000
committerDamien George <damien@micropython.org>2021-06-05 11:03:04 +1000
commita70a4e6688c6b29797b1e314ce2841e8e4fecb7b (patch)
treee80ecb4c5ded463235da813735ac2a75ec0f324e /py/asmthumb.c
parentfad0efdcf277dcc5698d59445074f4ee806d7976 (diff)
py/emitglue: Always flush caches when assigning native ARM code.
Prior to this commit, cache flushing for ARM native code was done only in the assembler code asm_thumb_end_pass()/asm_arm_end_pass(), at the last pass of the assembler. But this misses flushing the cache when loading native code from an .mpy file, ie in persistentcode.c. The change here makes sure the cache is always flushed/cleaned/invalidated when assigning native code on ARM architectures. This problem was found running tests/micropython/import_mpy_native_gc.py on the mimxrt port. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/asmthumb.c')
-rw-r--r--py/asmthumb.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index f7ac87fa0..db4520ce1 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -35,7 +35,6 @@
#include "py/mpstate.h"
#include "py/persistentcode.h"
-#include "py/mphal.h"
#include "py/asmthumb.h"
#define UNSIGNED_FIT5(x) ((uint32_t)(x) < 32)
@@ -62,20 +61,6 @@ static inline byte *asm_thumb_get_cur_to_write_bytes(asm_thumb_t *as, int n) {
return mp_asm_base_get_cur_to_write_bytes(&as->base, n);
}
-void asm_thumb_end_pass(asm_thumb_t *as) {
- (void)as;
- // could check labels are resolved...
-
- #if __ICACHE_PRESENT == 1
- if (as->base.pass == MP_ASM_PASS_EMIT) {
- // flush D-cache, so the code emitted is stored in memory
- MP_HAL_CLEAN_DCACHE(as->base.code_base, as->base.code_size);
- // invalidate I-cache
- SCB_InvalidateICache();
- }
- #endif
-}
-
/*
STATIC void asm_thumb_write_byte_1(asm_thumb_t *as, byte b1) {
byte *c = asm_thumb_get_cur_to_write_bytes(as, 1);