13 February 2019, 21:43 | #1 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Task exit: Forbid() without Permit()
Hi,
actually I try to run some old OCS demos on an AGA machine. After these demos return to the WB, the system is frozen. I found out, that most of them use Forbid(), but returned without calling Permit(). Is there a way to detect, if a task exits, that it has not called Permit() after calling a Forbid() ? |
13 February 2019, 21:57 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Forbid state should automatically go away when task that executed Forbid() is removed or if something forces task switch (like use of Wait()). Forbid (and Disable) is per-task state.
|
13 February 2019, 22:01 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Forbid()
ReplyMsg(wbmsg) return is the normal ending of a program started from Workbench. Forbid just sets a flag in the task structure. When the task ends, its Forbid status vanishes along with the task structure. The above sequence of commands assures that the replied message can be received by Workbench only after the task has already ended. This is not the cause of your freezes. Of course this part of the program should never be executed if it is run from the Shell. But even if you manage to call this from the Shell, it does not freeze the machine. |
13 February 2019, 22:05 | #4 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Yes, on pre OS2.0 systems, the Forbid state seems automatically to go away. But on OS 3.0, the WB doesn't freeze, if a Permit() is called right after the demo returned from its execution.
|
13 February 2019, 22:10 | #5 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
|
|
13 February 2019, 22:16 | #6 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
|
14 February 2019, 09:26 | #7 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
14 February 2019, 10:36 | #8 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
There must be another reason for the freeze, I just tried returning to the system without calling Permit() on my 3.1 machine and it worked without any problem. Many old OCS demos trash memory and/or don't restore interrupt/hardware vectors correctly which can lead to problems such as system freezes. |
|
14 February 2019, 13:12 | #9 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Many thanks, meynaf. That's exactly what I need. I could check the counter value, and if it's not NULL, then there are one or more Permits missing. I guess Forbid() increments and Permit() decrements the counter by 1.
|
14 February 2019, 13:19 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Why do you still think permit have anything to do with this problem? It does not. It can't!
|
14 February 2019, 13:23 | #11 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
The demo is this one: http://www.pouet.net/prod.php?which=13856 |
|
14 February 2019, 13:36 | #12 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Was task structure or execbase also in stored/restored part of chip ram?
|
14 February 2019, 13:37 | #13 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
Code:
move.l d0,-(sp) tst.l returnMsg ; Is there a message? beq.s exitToDOS ; if not, skip... move.l 4.w,a6 jsr _LVOForbid(a6) ; note! No Permit needed! move.l returnMsg(pc),a1 jsr _LVOReplyMsg(a6) exitToDOS move.l (sp)+,d0 ; exit code rts |
|
14 February 2019, 13:41 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Thats standard official startup code. Every program that runs from WB uses it (like was already mentioned above).
You sure there was not some memory corruption or some other random problem that made task exit to hang? (=Forbid state didn't go away) |
14 February 2019, 13:53 | #15 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
If i'm not wrong it's mandatory to do the ReplyMsg() in Forbid() state and exit w/o a Permit() to prevent WB prematurely unloadseg the exe. |
|
14 February 2019, 14:00 | #16 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
But does the task really exit ? If run from WB directly, it does. If run from some cli, then the cli is the current task and it does not get deleted after the program exits. Besides, the demo might leave the forbid/permit counter in any state...
|
14 February 2019, 16:30 | #17 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
I have checked, the intro lacks blitter waits which are most likely the reason for the system freeze upon exit! Just saving hardware registers etc. is not enough to let the intro run properly on anything else than a plain 7 MHz Amiga, you need to add the blitter waits! |
|
14 February 2019, 18:29 | #18 | ||
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
Quote:
|
||
14 February 2019, 18:34 | #19 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
|
14 February 2019, 19:00 | #20 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
When WB gets the message back, it will UnloadSeg() and free all memory. If task switching is enabled, program may get unloaded before following instruction(s) are executed. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pc task 4.4:) | 8bitbob | support.Apps | 42 | 25 August 2023 19:29 |
Exit winuae? | magoomba | New to Emulation or Amiga scene | 7 | 26 October 2018 22:50 |
Startup Code (from Icon ) - Forbid function | Asman | Coders. System | 2 | 04 January 2014 10:45 |
Cannot exit from Some games | @UAE | project.WHDLoad | 13 | 19 November 2008 13:28 |
OS 3.9 can't exit and some more problems | Tea | support.WinUAE | 1 | 09 July 2003 12:51 |
|
|