BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
316 stars 39 forks source link

Clear Cache before VBR call in default demo. #256

Open terriblefire opened 6 months ago

terriblefire commented 6 months ago

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 commented 6 months ago

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