English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 23 October 2021, 12:03   #1
Blueberry
Registered User
 
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
CacheClearU during Forbid

Is is safe to call CacheClearU() inside a Forbid() / Permit() pair? Can I be sure that the CacheClearU() call will not break the Forbid state? I know it doesn't for the ROM version of CacheClearU() (which just runs appropriate CPU instructions to clear the cache), but is this also the case for any turboboard / emulator environment which might patch CacheClearU()?

Context: In the default Shrinkler decrunch header, the decrunch code and crunched data are deallocated after decrunching is completed. Since the code doing this resides in the memory that is deallocated and A0/D0 need to be restored to make commandline arguments work, I push the entry point on the stack and wrap the deallocation in Forbid() / Permit() like this:
Code:
	jsr	Forbid(a6)
	lea.l	Header2-8(pc),a1
	move.l	(a1),d0
	jsr	FreeMem(a6)
	movem.l	(a7)+,d0/a0
	jmp	Permit(a6)
Now, I am changing some things in the code where it would be convenient for the CacheClearU() call (which currently happens right before this code) to happen after the FreeMem() call. Therefore I want to be sure that the Forbid state is not broken by the call.
Blueberry is offline  
Old 23 October 2021, 13:59   #2
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
I don't see a single reason why a patched CacheClearU() should break a Forbid().
If it did it would simply be broken.
ross is offline  
Old 23 October 2021, 14:08   #3
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,214
Quote:
Originally Posted by Blueberry View Post
Is is safe to call CacheClearU() inside a Forbid() / Permit() pair?
That's a low-level function that should be callable from almost any CPU state, including from interrupt, and I would call an implementation that breaks the "forbid" quite defect. All the implementations I know (and I made) do not break this, neither Disable().
Thomas Richter is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Task exit: Forbid() without Permit() dissident Coders. System 27 27 February 2019 10:46
Startup Code (from Icon ) - Forbid function Asman Coders. System 2 04 January 2014 10:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:58.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06675 seconds with 15 queries