Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ksco
Copy link
Collaborator

@ksco ksco commented Jun 6, 2023

  1. We cannot use xRAX as a return value register when using call_c, it will be "restored" after the c function returns.
  2. div64 and div32 sets xRDX, so even if xRDX is a callee-saved register, we still need to save & restore it.

@ksco
Copy link
Collaborator Author

ksco commented Jun 6, 2023

I think the restore of RAX and RDX in the case of function call is a bad idea, as they are the return registers. I'm fine with the current workaround, but it should be note that we have an small optimisation oportunity here.

But we need to sync RAX and RDX from xEmu to Dynarec after the call, is there a better way to do it?

@ksco ksco changed the title [DYNAREC] Fixed call_c issues and small optims to DIV opcode [DYNAREC] Fixed call_c issues Jun 6, 2023
@ptitSeb
Copy link
Owner

ptitSeb commented Jun 6, 2023

I think the restore of RAX and RDX in the case of function call is a bad idea, as they are the return registers. I'm fine with the current workaround, but it should be note that we have an small optimisation oportunity here.

But we need to sync RAX and RDX from xEmu to Dynarec after the call, is there a better way to do it?

I'm still unsure. Will need to study some dump to see how (in)efficient calls are.

@ptitSeb ptitSeb merged commit 2b0ceaf into ptitSeb:main Jun 6, 2023
@ksco ksco deleted the callc branch June 6, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants