Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memcpy issues #554

Closed
ahezard opened this issue Mar 3, 2019 · 6 comments
Closed

Memcpy issues #554

ahezard opened this issue Mar 3, 2019 · 6 comments

Comments

@ahezard
Copy link
Collaborator

ahezard commented Mar 3, 2019

The usage of memcpy in cardengine_arm9 to copy data from the cache to the card_read destination can create corruption of the memory in some specific cases :
// Copy directly
memcpy(dst, (u8*)buffer+(src-sector), len2);
The usage of readCached (only used for few roms) should solves this but in some cases it seems that it does not.

@ahezard
Copy link
Collaborator Author

ahezard commented Mar 3, 2019

Example of issue created by memcpy and solved by adding readCached reference : #261

@ahezard ahezard added this to the 1.0 Release milestone Mar 3, 2019
@ahezard ahezard pinned this issue Mar 3, 2019
@ahezard
Copy link
Collaborator Author

ahezard commented Mar 4, 2019

Another related issue that may be present in some games : the icache may need to be invalidated even if the data is moved by CPU.
The code is manipulated as data by the CPU and not as instruction when moved from the rom to the memory so if the dst region is in the instruction cache already it creates an issue.
The dst region should be dflushed and then iinvalidated.

@ahezard
Copy link
Collaborator Author

ahezard commented Mar 4, 2019

ahezard added a commit that referenced this issue Mar 4, 2019
@ahezard
Copy link
Collaborator Author

ahezard commented Mar 4, 2019

fixed by using tonccpy

@ahezard
Copy link
Collaborator Author

ahezard commented Mar 5, 2019

On DSi, some pixels are missing on the Lan/Megaman sprite in the opening of MMBN5.
as well as the title screen of Anno 1701.
With tonccpy

@ahezard
Copy link
Collaborator Author

ahezard commented Mar 5, 2019

Could be linked to the cardReadNormal code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant