aboutsummaryrefslogtreecommitdiff
path: root/py/asmthumb.c
diff options
context:
space:
mode:
authorFabian Vogt <fabian@ritter-vogt.de>2014-09-03 16:59:33 +0200
committerFabian Vogt <fabian@ritter-vogt.de>2014-09-03 23:07:42 +0200
commitb7235b8412a7511c94b31c0391eaf5c1b35ed3a8 (patch)
tree2112ee4a17967fe8bf1cedcc59d1934434bad309 /py/asmthumb.c
parentfc54250d3158bcd897d43187b822765fb97f369f (diff)
Add cache flush in py/asmarm.c and add new MP_PLAT_ALLOC_EXEC and MP_PLAT_FREE_EXEC macros
Fixes issue #840
Diffstat (limited to 'py/asmthumb.c')
-rw-r--r--py/asmthumb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 1102bb74a..95f87783a 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -67,7 +67,7 @@ asm_thumb_t *asm_thumb_new(uint max_num_labels) {
void asm_thumb_free(asm_thumb_t *as, bool free_code) {
if (free_code) {
- m_del(byte, as->code_base, as->code_size);
+ MP_PLAT_FREE_EXEC(as->code_base, as->code_size);
}
/*
if (as->label != NULL) {
@@ -94,9 +94,10 @@ void asm_thumb_start_pass(asm_thumb_t *as, uint pass) {
void asm_thumb_end_pass(asm_thumb_t *as) {
if (as->pass == ASM_THUMB_PASS_COMPUTE) {
- // calculate size of code in bytes
- as->code_size = as->code_offset;
- as->code_base = m_new(byte, as->code_size);
+ MP_PLAT_ALLOC_EXEC(as->code_offset, (void**) &as->code_base, &as->code_size);
+ if(as->code_base == NULL) {
+ assert(0);
+ }
//printf("code_size: %u\n", as->code_size);
}