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

Clear Cache before VBR call in default demo. #256

Open
terriblefire opened this issue Mar 21, 2024 · 1 comment · May be fixed by #267
Open

Clear Cache before VBR call in default demo. #256

terriblefire opened this issue Mar 21, 2024 · 1 comment · May be fixed by #267

Comments

@terriblefire
Copy link

terriblefire commented Mar 21, 2024

In your awesome example code, the code to get the VBR will crash on an 060 with Caches enabled because the data you specify as the instructions to execute in supervisor mode will never actually be written to ram. Its held purely on the stack (and in cache)

Please add...

CacheClearU();

immediately before

vbr = (APTR)Supervisor((ULONG (*)())getvbr);

and code will run even with 060 MMU+Caches enabled.

@terriblefire
Copy link
Author

I guess another way to do it would be to declare it globally rather than as a local variable.

yupferris added a commit to yupferris/vscode-amiga-debug that referenced this issue Dec 17, 2024
Previously, the supervisor portion of `GetVBR` would be copied to the stack, but without then clearing caches, there would be no guarantee that the instruction cache would contain this data (it's most likely dirty in the data cache and not yet committed to memory). On my setup (060 fpu+mmu), this would consistently crash.

So, let's rewrite this code as inline asm in a function, which is cleaner (no more raw data words), avoids the unnecessary copy (to initialize a local variable which isn't actually required), and avoids an unnecessary cache clear (which would also work around the issue, but in an expensive way).

Fixes BartmanAbyss#256.
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 a pull request may close this issue.

1 participant