assembly - Caller save registers in recursion -


in recursion, need save both caller save , callee save registers? following recursion save calle-save register ebx:

int rfact(int x) {   int result;   if (x <= 1)     result = 1;   else     result = n* rfact(x-1);   return result; } 

assembly:

rfact:         pushl   %ebp  .l3: movl    %esp, %ebp pushl   %ebx subl    $4, %esp movl    8(%ebp), %ebx movl    $1, %eax cmpl    $1, %ebx jle     .l3 leal    -1(%ebx), %eax movl    %eax, (%esp) call    rfact imull   %ebx, %eax addl    $4, %esp popl    %ebx popl    %ebp ret 

is there example of recursion save caller-save register?


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -