I am practicing interpreting assembly from my textbook and I'm currently stuck on this problem. Suppose I have the following function sun given in x86-64 assembly:
00000000004005f7 <sun>:
4005f7: 89 f8 mov %edi,%eax
4005f9: 83 ff 01 cmp $0x1,%edi
4005fc: 7f 02 jg 400600 <sun+0x9>
4005fe: f3 c3 repz retq
400600: 53 push %rbx
400601: 89 f3 mov %esi,%ebx
400603: c1 fe 02 sar $0x2,%esi
400606: 8d 7f ff lea -0x1(%rdi),%edi
400609: e8 e9 ff ff ff callq 4005f7 <sun>
40060e: 01 d8 add %ebx,%eax
400610: 5b pop %rbx
400611: c3 retq
What I am supposed to do is to list the callee-saved registers (if any) that are used and to list the caller-saved registers (if any) that are used. However, what I am having trouble with is how to distinguish between callee-saved and caller-saved registers within the assembly. I am aware of x86-64 register saving conventions, but I'm unsure if that applies to this assembly. For example, for callee-saved registers, I believe it would just be %rbx. For caller-saved registers, I think it would just be %rdi. Are there more callee-saved or caller-saved registers I am not seeing? Any feedback or suggestion would be greatly appreciated in helping me figure out how to distinguish between callee-saved and caller-saved registers.