English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 30 January 2019, 09:06   #1
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Supervisor stack size?

So if I understand correctly, when you have an interrupt server it will be run in supervisor mode using the supervisor stack.

How big is the supervisor stack ? Is this documented anywhere ?
alpine9000 is offline  
Old 30 January 2019, 09:21   #2
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
You will find this info in SysStkUpper/SysStkLower fields in ExecBase.
meynaf is offline  
Old 30 January 2019, 09:49   #3
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
You will find this info in SysStkUpper/SysStkLower fields in ExecBase.
Great thanks, is this configurable in a system friendly way?

Or would use switch to your own stack if you needed a bigger stack in a server?
alpine9000 is offline  
Old 30 January 2019, 10:39   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by alpine9000 View Post
Great thanks, is this configurable in a system friendly way?
Moving the supervisor stack is possible, i even have code for doing it, but i wouldn't recommend doing that all the time...


Quote:
Originally Posted by alpine9000 View Post
Or would use switch to your own stack if you needed a bigger stack in a server?
Never did this, but it's in theory possible to use your own allocated stack.

However, normally the supervisor stack should be big enough. If you're doing heavy duty work it might be better to create a new task and send it some signal from the interrupt server.
meynaf is offline  
Old 30 January 2019, 14:00   #5
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by alpine9000 View Post
Great thanks, is this configurable in a system friendly way?
You can allocate a new supervisor stack - all provided you insert this information into execbase as otherwise graphics below v45 gets a hickup. However - what for? The supervisor stack is only needed for interrupt processing, and its default size of 6K is really large enough.
Quote:
Originally Posted by alpine9000 View Post
Or would use switch to your own stack if you needed a bigger stack in a server?
There is no "own supervisor stack", there is only "one supervisor stack". So I wonder - why do you think that the default size is not large enough? Note well, the supervisor stack is completely separate from the user stack which is separate for each task, and which has a size that is task-dependent and configurable individually, for example with the magic $STACK: cookie in the code hunk.
Thomas Richter is offline  
Old 30 January 2019, 14:33   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by Thomas Richter View Post
... for example with the magic $STACK: cookie in the code hunk.
What's the exact format, and what versions of Kickstart support this?

I always felt that the managing the stack via the c:stack command and the program icon was a terrible solution.
Leffmann is offline  
Old 30 January 2019, 16:13   #7
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Leffmann View Post
What's the exact format, and what versions of Kickstart support this?

I'd like to know, too.. Sounds interesting, don't think I ever heard that mentioned before..
hooverphonique is offline  
Old 30 January 2019, 17:05   #8
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
From what i know setting stack size this way requires at least kick 3.1.
I prefer using a pair of StackSwap() calls.
meynaf is offline  
Old 30 January 2019, 23:18   #9
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by Thomas Richter View Post
You can allocate a new supervisor stack - all provided you insert this information into execbase as otherwise graphics below v45 gets a hickup. However - what for? The supervisor stack is only needed for interrupt processing, and its default size of 6K is really large enough.

There is no "own supervisor stack", there is only "one supervisor stack". So I wonder - why do you think that the default size is not large enough? Note well, the supervisor stack is completely separate from the user stack which is separate for each task, and which has a size that is task-dependent and configurable individually, for example with the magic $STACK: cookie in the code hunk.
Well I don't have an immediate specific need for something > 6k in mind, but games programmers are always pushing the boundaries of everything, so it's nice to know where the boundary is. As for "6K is really large enough", sounds a bit like another famous quote about ram size that also started with a 6 and ended with a K

I could imagine for example if you wanted to do a quick and dirty conversion of a non system friendly game, to make it system friendly that had it's main loop running out of the VBL and it used a lot of stack. Obviously there are other ways around it, but the OS provides a way of adding these interrupt servers, yet there are (unwritten?) rules about what you can do in them.

Last edited by alpine9000; 31 January 2019 at 06:10.
alpine9000 is offline  
Old 13 February 2019, 07:41   #10
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,546
Quote:
Originally Posted by Thomas Richter View Post
the user stack which is separate for each task, and which has a size that is task-dependent and configurable individually, for example with the magic $STACK: cookie in the code hunk.
I have not found this cookie in any executable. Is it an OS4 feature?
Bruce Abbott is offline  
Old 19 February 2019, 17:42   #11
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
AFAIK this is OS4 only.
Wepl is offline  
Old 02 June 2019, 20:59   #12
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by Bruce Abbott View Post
I have not found this cookie in any executable. Is it an OS4 feature?
No. Everything from 3.9 onwards, including 3.1.4, supports it. This feature is part of the shell, and part of the workbench. It made its way into the shell first, workbench came later.
Thomas Richter is offline  
Old 03 June 2019, 19:58   #13
nogginthenog
Amigan
 
Join Date: Feb 2012
Location: London
Posts: 1,309
Quote:
Originally Posted by Leffmann View Post
What's the exact format
It appears to be this:
https://wiki.amigaos.net/wiki/Contro...lication_Stack

Code:
static const char USED min_stack[] = "$STACK:102400";
I never knew about this feature either.
nogginthenog is offline  
Old 03 June 2019, 20:46   #14
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by nogginthenog View Post
It appears to be this:
https://wiki.amigaos.net/wiki/Contro...lication_Stack

Code:
static const char USED min_stack[] = "$STACK:102400";
I never knew about this feature either.
A newline at the end of the string is missing.
Thomas Richter is offline  
Old 03 June 2019, 21:50   #15
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Thomas Richter View Post
A newline at the end of the string is missing.
is a classic terminating zero char required also?
hooverphonique is offline  
Old 03 June 2019, 22:27   #16
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
Still unclear to me what logic applies if CLI or WB-icon specifies a larger stack than the cookie.
In my tests it didn't work in 3.9.
Wepl is offline  
Old 04 June 2019, 07:26   #17
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by Wepl View Post
Still unclear to me what logic applies if CLI or WB-icon specifies a larger stack than the cookie.
In my tests it didn't work in 3.9.
You can only increase the stack size, not decrease it. And sure, it does work. The feature came in with the updated shell in one of the BoingBags, the cookie must be in the first hunk, and it requires a line feed and a \0 beyond the number. The workbench does not honor it before 3.1.4.
Thomas Richter is offline  
Old 04 June 2019, 12:37   #18
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
So to summarize, it's
$STACK:1234\n\0
inserted into the first hunk, and it only works correctly in AmigaOS 3.1.4 (both in the shell and on the Workbench) and the stack size will be set to the largest of the three indicators?
Leffmann is offline  
Old 04 June 2019, 13:15   #19
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by Leffmann View Post
So to summarize, it's
$STACK:1234\n\0
inserted into the first hunk, and it only works correctly in AmigaOS 3.1.4 (both in the shell and on the Workbench) and the stack size will be set to the largest of the three indicators?
It already works with the V45 shell which was first delivered with one of the boingbags, I forgot which. The shell was not updated in the original 3.9 release IIRC.
Thomas Richter is offline  
Old 05 June 2019, 04:42   #20
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,546
Quote:
Originally Posted by Thomas Richter View Post
It already works with the V45 shell which was first delivered with one of the boingbags, I forgot which. The shell was not updated in the original 3.9 release IIRC.
So not very useful then - and also a disgusting kludge. Though I guess it's better than expecting users to type a 'stack' command before running programs from the CLI, and then unceremoniously crashing when they don't.
Bruce Abbott 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
Moving supervisor stack roondar Coders. Asm / Hardware 6 18 July 2017 17:13
Stack available mritter0 Coders. General 4 03 August 2014 18:31
TCP/IP Stack redneon Amiga scene 18 24 July 2005 16:01
Stack Up Galaxy request.Old Rare Games 5 08 September 2004 03:06
Who wants a stack of originals? FromWithin Games images which need to be WHDified 41 31 July 2003 09:31

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 07:22.

Top

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