Mercurial > hg > CbC > CbC_examples
changeset 25:6324b8df04f1
lj_as2: fix segmentation fault
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 21:44:55 +0900 |
parents | 19160c497905 |
children | 1db97badc4e0 |
files | ljtes/ljtes_as2.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ljtes/ljtes_as2.c Sun Jan 31 19:37:36 2016 +0900 +++ b/ljtes/ljtes_as2.c Sun Jan 31 21:44:55 2016 +0900 @@ -11,7 +11,6 @@ }; int save_env(void *env); - __code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),void*), void *exit1env) { if (n<0) { @@ -58,6 +57,7 @@ } int save_env(void *env){ + volatile int retval = 0; asm volatile( "movq %%rbp,(%%rdi);" // env.env[1] = %rbp; frame pointer "movq (%%rsp), %%rax;" // get return addres @@ -67,7 +67,7 @@ "movl $0, %%eax;" // set return value "jmpq *0x8(%%rdi);" // return :"+D"(env)::"rax"); - return 0; + return retval; } __code return_cs(int val, void* env){