blob: 2f7556f16f82de0f72248a87839d60c721b33b32 [file] [log] [blame]
Fabian Vogtfe3d16e2014-08-16 22:55:53 +02001/*
2 * This file is part of the Micro Python project, http://micropython.org/
3 *
4 * The MIT License (MIT)
5 *
Fabian Vogt16ee30c2014-08-28 01:18:56 +02006 * Copyright (c) 2014 Fabian Vogt
7 * Copyright (c) 2013, 2014 Damien P. George
Fabian Vogtfe3d16e2014-08-16 22:55:53 +02008 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 */
27
28#include <stdio.h>
29#include <assert.h>
30#include <string.h>
31
Damien George51dfcb42015-01-01 20:27:54 +000032#include "py/mpconfig.h"
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020033
34// wrapper around everything in this file
35#if MICROPY_EMIT_ARM
36
Damien George51dfcb42015-01-01 20:27:54 +000037#include "py/asmarm.h"
38
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020039#define SIGNED_FIT24(x) (((x) & 0xff800000) == 0) || (((x) & 0xff000000) == 0xff000000)
40
41struct _asm_arm_t {
42 uint pass;
Fabian Vogtb7235b82014-09-03 16:59:33 +020043 mp_uint_t code_offset;
44 mp_uint_t code_size;
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020045 byte *code_base;
46 byte dummy_data[4];
47
Damien George0b610de2014-09-29 16:25:04 +010048 mp_uint_t max_num_labels;
49 mp_uint_t *label_offsets;
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020050 uint push_reglist;
51 uint stack_adjust;
52};
53
54asm_arm_t *asm_arm_new(uint max_num_labels) {
55 asm_arm_t *as;
56
57 as = m_new0(asm_arm_t, 1);
58 as->max_num_labels = max_num_labels;
Damien George0b610de2014-09-29 16:25:04 +010059 as->label_offsets = m_new(mp_uint_t, max_num_labels);
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020060
61 return as;
62}
63
64void asm_arm_free(asm_arm_t *as, bool free_code) {
65 if (free_code) {
Fabian Vogtb7235b82014-09-03 16:59:33 +020066 MP_PLAT_FREE_EXEC(as->code_base, as->code_size);
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020067 }
Damien George0b610de2014-09-29 16:25:04 +010068 m_del(mp_uint_t, as->label_offsets, as->max_num_labels);
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020069 m_del_obj(asm_arm_t, as);
70}
71
72void asm_arm_start_pass(asm_arm_t *as, uint pass) {
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020073 if (pass == ASM_ARM_PASS_COMPUTE) {
Damien George0b610de2014-09-29 16:25:04 +010074 memset(as->label_offsets, -1, as->max_num_labels * sizeof(mp_uint_t));
Damien Georged9dc6ff2015-01-14 00:38:33 +000075 } else if (pass == ASM_ARM_PASS_EMIT) {
76 MP_PLAT_ALLOC_EXEC(as->code_offset, (void**)&as->code_base, &as->code_size);
77 if (as->code_base == NULL) {
78 assert(0);
79 }
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020080 }
Damien Georged9dc6ff2015-01-14 00:38:33 +000081 as->pass = pass;
82 as->code_offset = 0;
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020083}
84
85void asm_arm_end_pass(asm_arm_t *as) {
Damien Georged9dc6ff2015-01-14 00:38:33 +000086 if (as->pass == ASM_ARM_PASS_EMIT) {
Fabian Vogtb7235b82014-09-03 16:59:33 +020087#ifdef __arm__
88 // flush I- and D-cache
Damien Georgedda46462014-09-03 22:47:23 +010089 asm volatile(
Fabian Vogtb7235b82014-09-03 16:59:33 +020090 "0:"
91 "mrc p15, 0, r15, c7, c10, 3\n"
92 "bne 0b\n"
93 "mov r0, #0\n"
Damien Georgedda46462014-09-03 22:47:23 +010094 "mcr p15, 0, r0, c7, c7, 0\n"
Fabian Vogtb7235b82014-09-03 16:59:33 +020095 : : : "r0", "cc");
96#endif
Fabian Vogtfe3d16e2014-08-16 22:55:53 +020097 }
98}
99
100// all functions must go through this one to emit bytes
101// if as->pass < ASM_ARM_PASS_EMIT, then this function only returns a buffer of 4 bytes length
102STATIC byte *asm_arm_get_cur_to_write_bytes(asm_arm_t *as, int num_bytes_to_write) {
103 if (as->pass < ASM_ARM_PASS_EMIT) {
104 as->code_offset += num_bytes_to_write;
105 return as->dummy_data;
106 } else {
107 assert(as->code_offset + num_bytes_to_write <= as->code_size);
108 byte *c = as->code_base + as->code_offset;
109 as->code_offset += num_bytes_to_write;
110 return c;
111 }
112}
113
Paul Sokolovsky351424e2015-05-07 23:08:09 +0300114uint asm_arm_get_code_pos(asm_arm_t *as) {
115 return as->code_offset;
116}
117
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200118uint asm_arm_get_code_size(asm_arm_t *as) {
119 return as->code_size;
120}
121
122void *asm_arm_get_code(asm_arm_t *as) {
123 return as->code_base;
124}
125
126// Insert word into instruction flow
127STATIC void emit(asm_arm_t *as, uint op) {
128 *(uint*)asm_arm_get_cur_to_write_bytes(as, 4) = op;
129}
130
131// Insert word into instruction flow, add "ALWAYS" condition code
132STATIC void emit_al(asm_arm_t *as, uint op) {
Damien George0b610de2014-09-29 16:25:04 +0100133 emit(as, op | ASM_ARM_CC_AL);
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200134}
135
136// Basic instructions without condition code
137STATIC uint asm_arm_op_push(uint reglist) {
138 // stmfd sp!, {reglist}
139 return 0x92d0000 | (reglist & 0xFFFF);
140}
141
142STATIC uint asm_arm_op_pop(uint reglist) {
143 // ldmfd sp!, {reglist}
144 return 0x8bd0000 | (reglist & 0xFFFF);
145}
146
147STATIC uint asm_arm_op_mov_reg(uint rd, uint rn) {
148 // mov rd, rn
149 return 0x1a00000 | (rd << 12) | rn;
150}
151
152STATIC uint asm_arm_op_mov_imm(uint rd, uint imm) {
153 // mov rd, #imm
154 return 0x3a00000 | (rd << 12) | imm;
155}
156
157STATIC uint asm_arm_op_mvn_imm(uint rd, uint imm) {
158 // mvn rd, #imm
159 return 0x3e00000 | (rd << 12) | imm;
160}
161
162STATIC uint asm_arm_op_add_imm(uint rd, uint rn, uint imm) {
163 // add rd, rn, #imm
164 return 0x2800000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
165}
166
167STATIC uint asm_arm_op_add_reg(uint rd, uint rn, uint rm) {
168 // add rd, rn, rm
169 return 0x0800000 | (rn << 16) | (rd << 12) | rm;
170}
171
172STATIC uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
173 // sub rd, rn, #imm
174 return 0x2400000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
175}
176
Damien George3112cde2014-09-29 18:45:42 +0100177STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
178 // sub rd, rn, rm
179 return 0x0400000 | (rn << 16) | (rd << 12) | rm;
180}
181
Damien George1ef23482014-10-12 14:21:06 +0100182STATIC uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
183 // and rd, rn, rm
184 return 0x0000000 | (rn << 16) | (rd << 12) | rm;
185}
186
187STATIC uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
188 // eor rd, rn, rm
189 return 0x0200000 | (rn << 16) | (rd << 12) | rm;
190}
191
192STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
193 // orr rd, rn, rm
194 return 0x1800000 | (rn << 16) | (rd << 12) | rm;
195}
196
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200197void asm_arm_bkpt(asm_arm_t *as) {
198 // bkpt #0
199 emit_al(as, 0x1200070);
200}
201
202// locals:
203// - stored on the stack in ascending order
Damien George0b610de2014-09-29 16:25:04 +0100204// - numbered 0 through num_locals-1
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200205// - SP points to first local
206//
207// | SP
208// v
209// l0 l1 l2 ... l(n-1)
210// ^ ^
211// | low address | high address in RAM
212
213void asm_arm_entry(asm_arm_t *as, int num_locals) {
214
215 if (num_locals < 0) {
216 num_locals = 0;
217 }
218
219 as->stack_adjust = 0;
Damien George0b610de2014-09-29 16:25:04 +0100220 as->push_reglist = 1 << ASM_ARM_REG_R1
221 | 1 << ASM_ARM_REG_R2
222 | 1 << ASM_ARM_REG_R3
223 | 1 << ASM_ARM_REG_R4
224 | 1 << ASM_ARM_REG_R5
225 | 1 << ASM_ARM_REG_R6
226 | 1 << ASM_ARM_REG_R7
227 | 1 << ASM_ARM_REG_R8;
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200228
229 // Only adjust the stack if there are more locals than usable registers
Damien George4dea9222015-04-09 15:29:54 +0000230 if (num_locals > 3) {
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200231 as->stack_adjust = num_locals * 4;
232 // Align stack to 8 bytes
Damien George0b610de2014-09-29 16:25:04 +0100233 if (num_locals & 1) {
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200234 as->stack_adjust += 4;
Damien George0b610de2014-09-29 16:25:04 +0100235 }
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200236 }
237
Damien George0b610de2014-09-29 16:25:04 +0100238 emit_al(as, asm_arm_op_push(as->push_reglist | 1 << ASM_ARM_REG_LR));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200239 if (as->stack_adjust > 0) {
Damien George0b610de2014-09-29 16:25:04 +0100240 emit_al(as, asm_arm_op_sub_imm(ASM_ARM_REG_SP, ASM_ARM_REG_SP, as->stack_adjust));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200241 }
242}
243
244void asm_arm_exit(asm_arm_t *as) {
245 if (as->stack_adjust > 0) {
Damien George0b610de2014-09-29 16:25:04 +0100246 emit_al(as, asm_arm_op_add_imm(ASM_ARM_REG_SP, ASM_ARM_REG_SP, as->stack_adjust));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200247 }
248
Damien George0b610de2014-09-29 16:25:04 +0100249 emit_al(as, asm_arm_op_pop(as->push_reglist | (1 << ASM_ARM_REG_PC)));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200250}
251
Paul Sokolovsky351424e2015-05-07 23:08:09 +0300252void asm_arm_push(asm_arm_t *as, uint reglist) {
253 emit_al(as, asm_arm_op_push(reglist));
254}
255
256void asm_arm_pop(asm_arm_t *as, uint reglist) {
257 emit_al(as, asm_arm_op_pop(reglist));
258}
259
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200260void asm_arm_label_assign(asm_arm_t *as, uint label) {
261 assert(label < as->max_num_labels);
262 if (as->pass < ASM_ARM_PASS_EMIT) {
263 // assign label offset
264 assert(as->label_offsets[label] == -1);
265 as->label_offsets[label] = as->code_offset;
266 } else {
267 // ensure label offset has not changed from PASS_COMPUTE to PASS_EMIT
268 assert(as->label_offsets[label] == as->code_offset);
269 }
270}
271
272void asm_arm_align(asm_arm_t* as, uint align) {
273 // TODO fill unused data with NOPs?
274 as->code_offset = (as->code_offset + align - 1) & (~(align - 1));
275}
276
277void asm_arm_data(asm_arm_t* as, uint bytesize, uint val) {
278 byte *c = asm_arm_get_cur_to_write_bytes(as, bytesize);
279 // only write to the buffer in the emit pass (otherwise we overflow dummy_data)
280 if (as->pass == ASM_ARM_PASS_EMIT) {
281 // little endian
282 for (uint i = 0; i < bytesize; i++) {
283 *c++ = val;
284 val >>= 8;
285 }
286 }
287}
288
289void asm_arm_mov_reg_reg(asm_arm_t *as, uint reg_dest, uint reg_src) {
290 emit_al(as, asm_arm_op_mov_reg(reg_dest, reg_src));
291}
292
293void asm_arm_mov_reg_i32(asm_arm_t *as, uint rd, int imm) {
294 // TODO: There are more variants of immediate values
295 if ((imm & 0xFF) == imm) {
296 emit_al(as, asm_arm_op_mov_imm(rd, imm));
Paul Sokolovskyc0bc3bd2014-12-14 03:24:17 +0200297 } else if (imm < 0 && imm >= -256) {
298 // mvn is "move not", not "move negative"
299 emit_al(as, asm_arm_op_mvn_imm(rd, ~imm));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200300 } else {
301 //Insert immediate into code and jump over it
302 emit_al(as, 0x59f0000 | (rd << 12)); // ldr rd, [pc]
303 emit_al(as, 0xa000000); // b pc
304 emit(as, imm);
305 }
306}
307
308void asm_arm_mov_local_reg(asm_arm_t *as, int local_num, uint rd) {
309 // str rd, [sp, #local_num*4]
310 emit_al(as, 0x58d0000 | (rd << 12) | (local_num << 2));
311}
312
313void asm_arm_mov_reg_local(asm_arm_t *as, uint rd, int local_num) {
314 // ldr rd, [sp, #local_num*4]
315 emit_al(as, 0x59d0000 | (rd << 12) | (local_num << 2));
316}
317
318void asm_arm_cmp_reg_i8(asm_arm_t *as, uint rd, int imm) {
319 // cmp rd, #imm
320 emit_al(as, 0x3500000 | (rd << 16) | (imm & 0xFF));
321}
322
323void asm_arm_cmp_reg_reg(asm_arm_t *as, uint rd, uint rn) {
324 // cmp rd, rn
325 emit_al(as, 0x1500000 | (rd << 16) | rn);
326}
327
Fabian Vogte5268962014-10-04 00:53:46 +0200328void asm_arm_setcc_reg(asm_arm_t *as, uint rd, uint cond) {
329 emit(as, asm_arm_op_mov_imm(rd, 1) | cond); // movCOND rd, #1
330 emit(as, asm_arm_op_mov_imm(rd, 0) | (cond ^ (1 << 28))); // mov!COND rd, #0
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200331}
332
Damien George3112cde2014-09-29 18:45:42 +0100333void asm_arm_add_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200334 // add rd, rn, rm
335 emit_al(as, asm_arm_op_add_reg(rd, rn, rm));
336}
337
Damien George3112cde2014-09-29 18:45:42 +0100338void asm_arm_sub_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
339 // sub rd, rn, rm
340 emit_al(as, asm_arm_op_sub_reg(rd, rn, rm));
341}
342
Damien George1ef23482014-10-12 14:21:06 +0100343void asm_arm_and_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
344 // and rd, rn, rm
345 emit_al(as, asm_arm_op_and_reg(rd, rn, rm));
346}
347
348void asm_arm_eor_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
349 // eor rd, rn, rm
350 emit_al(as, asm_arm_op_eor_reg(rd, rn, rm));
351}
352
353void asm_arm_orr_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
354 // orr rd, rn, rm
355 emit_al(as, asm_arm_op_orr_reg(rd, rn, rm));
356}
357
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200358void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num) {
359 // add rd, sp, #local_num*4
Damien George0b610de2014-09-29 16:25:04 +0100360 emit_al(as, asm_arm_op_add_imm(rd, ASM_ARM_REG_SP, local_num << 2));
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200361}
362
Fabian Vogte5268962014-10-04 00:53:46 +0200363void asm_arm_lsl_reg_reg(asm_arm_t *as, uint rd, uint rs) {
364 // mov rd, rd, lsl rs
365 emit_al(as, 0x1a00010 | (rd << 12) | (rs << 8) | rd);
366}
367
368void asm_arm_asr_reg_reg(asm_arm_t *as, uint rd, uint rs) {
369 // mov rd, rd, asr rs
370 emit_al(as, 0x1a00050 | (rd << 12) | (rs << 8) | rd);
371}
372
Paul Sokolovsky351424e2015-05-07 23:08:09 +0300373void asm_arm_ldr_reg_reg(asm_arm_t *as, uint rd, uint rn, uint byte_offset) {
374 // ldr rd, [rn, #off]
375 emit_al(as, 0x5900000 | (rn << 16) | (rd << 12) | byte_offset);
Damien George91cfd412014-10-12 16:59:29 +0100376}
377
378void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn) {
379 // ldrh rd, [rn]
380 emit_al(as, 0x1d000b0 | (rn << 16) | (rd << 12));
381}
382
383void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn) {
384 // ldrb rd, [rn]
385 emit_al(as, 0x5d00000 | (rn << 16) | (rd << 12));
386}
387
Paul Sokolovsky351424e2015-05-07 23:08:09 +0300388void asm_arm_str_reg_reg(asm_arm_t *as, uint rd, uint rm, uint byte_offset) {
389 // str rd, [rm, #off]
390 emit_al(as, 0x5800000 | (rm << 16) | (rd << 12) | byte_offset);
Fabian Vogte5268962014-10-04 00:53:46 +0200391}
392
393void asm_arm_strh_reg_reg(asm_arm_t *as, uint rd, uint rm) {
394 // strh rd, [rm]
395 emit_al(as, 0x1c000b0 | (rm << 16) | (rd << 12));
396}
397
398void asm_arm_strb_reg_reg(asm_arm_t *as, uint rd, uint rm) {
399 // strb rd, [rm]
400 emit_al(as, 0x5c00000 | (rm << 16) | (rd << 12));
401}
402
403void asm_arm_str_reg_reg_reg(asm_arm_t *as, uint rd, uint rm, uint rn) {
404 // str rd, [rm, rn, lsl #2]
405 emit_al(as, 0x7800100 | (rm << 16) | (rd << 12) | rn);
406}
407
408void asm_arm_strh_reg_reg_reg(asm_arm_t *as, uint rd, uint rm, uint rn) {
409 // strh doesn't support scaled register index
410 emit_al(as, 0x1a00080 | (ASM_ARM_REG_R8 << 12) | rn); // mov r8, rn, lsl #1
411 emit_al(as, 0x18000b0 | (rm << 16) | (rd << 12) | ASM_ARM_REG_R8); // strh rd, [rm, r8]
412}
413
414void asm_arm_strb_reg_reg_reg(asm_arm_t *as, uint rd, uint rm, uint rn) {
415 // strb rd, [rm, rn]
416 emit_al(as, 0x7c00000 | (rm << 16) | (rd << 12) | rn);
417}
418
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200419void asm_arm_bcc_label(asm_arm_t *as, int cond, uint label) {
420 assert(label < as->max_num_labels);
Damien George0b610de2014-09-29 16:25:04 +0100421 mp_uint_t dest = as->label_offsets[label];
422 mp_int_t rel = dest - as->code_offset;
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200423 rel -= 8; // account for instruction prefetch, PC is 8 bytes ahead of this instruction
424 rel >>= 2; // in ARM mode the branch target is 32-bit aligned, so the 2 LSB are omitted
425
426 if (SIGNED_FIT24(rel)) {
427 emit(as, cond | 0xa000000 | (rel & 0xffffff));
428 } else {
429 printf("asm_arm_bcc: branch does not fit in 24 bits\n");
430 }
431}
432
433void asm_arm_b_label(asm_arm_t *as, uint label) {
Damien George0b610de2014-09-29 16:25:04 +0100434 asm_arm_bcc_label(as, ASM_ARM_CC_AL, label);
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200435}
436
437void asm_arm_bl_ind(asm_arm_t *as, void *fun_ptr, uint fun_id, uint reg_temp) {
438 // If the table offset fits into the ldr instruction
Damien George4dea9222015-04-09 15:29:54 +0000439 if (fun_id < (0x1000 / 4)) {
Damien George0b610de2014-09-29 16:25:04 +0100440 emit_al(as, asm_arm_op_mov_reg(ASM_ARM_REG_LR, ASM_ARM_REG_PC)); // mov lr, pc
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200441 emit_al(as, 0x597f000 | (fun_id << 2)); // ldr pc, [r7, #fun_id*4]
442 return;
443 }
Damien George4dea9222015-04-09 15:29:54 +0000444
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200445 emit_al(as, 0x59f0004 | (reg_temp << 12)); // ldr rd, [pc, #4]
446 // Set lr after fun_ptr
Damien George0b610de2014-09-29 16:25:04 +0100447 emit_al(as, asm_arm_op_add_imm(ASM_ARM_REG_LR, ASM_ARM_REG_PC, 4)); // add lr, pc, #4
448 emit_al(as, asm_arm_op_mov_reg(ASM_ARM_REG_PC, reg_temp)); // mov pc, reg_temp
Fabian Vogtfe3d16e2014-08-16 22:55:53 +0200449 emit(as, (uint) fun_ptr);
450}
451
452#endif // MICROPY_EMIT_ARM