summaryrefslogtreecommitdiffstatshomepage
path: root/py/asmx86.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-06 23:24:32 +0000
committerDamien George <damien.p.george@gmail.com>2014-09-06 23:24:32 +0000
commit25d904105c61ba09de8460c0bf031c77b3faf51f (patch)
tree1b720285e81a26960f71f864a0646d21de0dec3b /py/asmx86.c
parent91fe0d4880b2abde25050d2b626320003f130e83 (diff)
downloadmicropython-25d904105c61ba09de8460c0bf031c77b3faf51f.tar.gz
micropython-25d904105c61ba09de8460c0bf031c77b3faf51f.zip
py: Adjust regs for x86 so that 1 more local can live in a reg.
Diffstat (limited to 'py/asmx86.c')
-rw-r--r--py/asmx86.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/asmx86.c b/py/asmx86.c
index 70d2bfe79d..1946973bad 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -413,7 +413,9 @@ void asm_x86_jcc_label(asm_x86_t *as, mp_uint_t jcc_type, mp_uint_t label) {
void asm_x86_entry(asm_x86_t *as, mp_uint_t num_locals) {
asm_x86_push_r32(as, REG_EBP);
asm_x86_mov_r32_to_r32(as, REG_ESP, REG_EBP);
- asm_x86_sub_i32_from_r32(as, num_locals * WORD_SIZE, REG_ESP);
+ if (num_locals > 0) {
+ asm_x86_sub_i32_from_r32(as, num_locals * WORD_SIZE, REG_ESP);
+ }
asm_x86_push_r32(as, REG_EBX);
asm_x86_push_r32(as, REG_ESI);
asm_x86_push_r32(as, REG_EDI);