summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-06 01:01:01 +0100
committerDamien <damien.p.george@gmail.com>2013-10-06 01:01:01 +0100
commitdc83382903675c017f449285bf42a51d0e936e4e (patch)
tree535bcc550ee75e3d3e919c2d73380d14833449f3 /py/runtime.c
parent03d4124320fa2a6c987b86bbcd9afbd1563fdf40 (diff)
downloadmicropython-dc83382903675c017f449285bf42a51d0e936e4e.tar.gz
micropython-dc83382903675c017f449285bf42a51d0e936e4e.zip
Make runtime able to call inline asm with 1 argument.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 4ac680562c..b133b31e06 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -772,6 +772,17 @@ py_obj_t rt_call_function_1(py_obj_t fun, py_obj_t arg) {
assert(o->u_fun_bc.n_args == 1);
DEBUG_OP_printf("calling byte code %p with 1 arg\n", o->u_fun_bc.code);
return py_execute_byte_code(o->u_fun_bc.code, o->u_fun_bc.len, &arg, 1);
+ } else if (IS_O(fun, O_FUN_ASM)) {
+ py_obj_base_t *o = fun;
+ assert(o->u_fun_asm.n_args == 1);
+ DEBUG_OP_printf("calling inline asm %p with 1 arg\n", o->u_fun_asm.fun);
+ machine_int_t arg_val;
+ if (IS_SMALL_INT(arg)) {
+ arg_val = FROM_SMALL_INT(arg);
+ } else {
+ arg_val = arg;
+ }
+ return ((py_fun_1_t)o->u_fun_asm.fun)(arg_val);
} else if (IS_O(fun, O_BOUND_METH)) {
py_obj_base_t *o = fun;
return rt_call_function_2(o->u_bound_meth.meth, o->u_bound_meth.self, arg);