English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 06 June 2019, 20:02   #61
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,979
Quote:
Originally Posted by Thomas Richter View Post
Which is precisely what your proposal doesn't. Let's boil it down to one sentence: You modify a well-documented file format without being able to update the tools that depend on it. That is really it. Nothing else to say.
You are very funny. You never heard about programs or OS updates? You dont tell me single example which program can be break. I can say noone program will be break. Seems you dont heard about updated documentation. Your dirty method is not well documented too. Which tools handled your stack method? Maybe Resource? Simple you think that you know better than others, but this is not TRUE.
Don_Adan is offline  
Old 06 June 2019, 21:07   #62
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
Quote:
Originally Posted by meynaf View Post
I think many compilers will setup the stack as part of their startup code. Or at least they should.
No - I hope not. Why should they? Some compilers have the option to extend the stack, though.

Quote:
A cookie at the right place. Perfectly detected, with stack perfecly allocated.
And then the startup code performs its regular stack swap...
Usually such a startup code should check if the stack size is already sufficient, before doing the StackSwap. At least vbcc's startup code does.
phx is offline  
Old 06 June 2019, 21:19   #63
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by phx View Post
No - I hope not. Why should they? Some compilers have the option to extend the stack, though.
There might be an option somewhere in the project settings that sets up the stack size. Hisoft C++ has this, for example. Default is 10k.


Quote:
Originally Posted by phx View Post
Usually such a startup code should check if the stack size is already sufficient, before doing the StackSwap. At least vbcc's startup code does.
Hopefully for vbcc it does.
But nobody will disassemble all startup code of every existing compiler to verify they actually do it this way...

Even if they do, we can still inadvertently end up in a situation where the stack size is smaller as given by the cookie, than what the startup code will set. Like the 10k above, if the programmer doesn't know and sets the cookie for 8k.
meynaf is offline  
Old 06 June 2019, 21:25   #64
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
Quote:
Originally Posted by meynaf View Post
Even if they do, we can still inadvertently end up in a situation where the stack size is smaller as given by the cookie, than what the startup code will set. Like the 10k above, if the programmer doesn't know and sets the cookie for 8k.
When you find out that your compiler is crap you can either remove the stack cookie again or write your own startup code.
phx is offline  
Old 06 June 2019, 21:31   #65
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by phx View Post
When you find out that your compiler is crap you can either remove the stack cookie again or write your own startup code.
In this situation it's not the compiler that's crap.
meynaf is offline  
Old 06 June 2019, 21:34   #66
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,236
Quote:
Originally Posted by Don_Adan View Post
You are very funny. You never heard about programs or OS updates?
Neither SLink, BLink nor SC or GenAm are part of the Os. Nobody has its sources, probably lost somewhere at the SAS Institute, or at HiSoft, somewhere. You cannot update these tools nowadays in any practicable way.
Quote:
Originally Posted by Don_Adan View Post
I can say noone program will be break.
Then you have very limited knowledge.
Quote:
Originally Posted by Don_Adan View Post
Your dirty method is not well documented too.
Documented since day 1. Get the shell.guide from the aminet. It's there. That is the best documentation you get for the shell and I keep it updated.
Quote:
Originally Posted by Don_Adan View Post
Which tools handled your stack method?
Any compiler or assembler can be used to create the stack cookie, any linker will be able to handle the cookie correctly. No hunk-processing tool I am aware of can accidentally remove it. That is quite unlike what you propose - which is a fragile method that only happens by chance and incomplete documentation.
Quote:
Originally Posted by Don_Adan View Post
Maybe Resource? Simple you think that you know better than others, but this is not TRUE.
It will keep the cookie intact, unless you manually mess around it. That is all it needs to get it supported. Actually, that is the full trick - creating a robust method. You do not need any particular tool to get it in, and it is visible for everyone.
Thomas Richter is offline  
Old 06 June 2019, 21:36   #67
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,236
Quote:
Originally Posted by meynaf View Post
And the right section name is ?
text
Quote:
Originally Posted by meynaf View Post
Are programmers supposed to know the section name of the startup code generated by their compiler ?
You do not need to put the cookie into the startup code. Putting it into the first translation unit is usually good enough. You can put it into the startup code. But there is no need to.
Thomas Richter is offline  
Old 06 June 2019, 22:38   #68
BastyCDGS
Registered User
 
Join Date: Nov 2015
Location: Freiburg / Germany
Age: 44
Posts: 200
Send a message via ICQ to BastyCDGS
The best way probably is having just small startup code in the program which checks if stack is large enough and if not, allocate large enough and then start with it. Works starting at OS1.x.

Also there are compilers which not only check if the stack is large enough, but expand it on the fly, as well.

I think the $STACK is a new nice addition which is esp. useful on modern AmigaOS invocations. If that's your audience, go for it! But if you also target 1.x/2.x/3.0/3.1 you should allocate the stack yourself or inform the user to use the stack cmd.

EDIT: Are the any precautions about ambigious usage of $STACK, e.g. if it's an unlucky coincidence of characters from older software?
BastyCDGS is offline  
Old 07 June 2019, 08:37   #69
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
The stack cookie would have been quite acceptable if it could replace stack swap in every case. But it can't. Even if your program *requires* OS v3.9 and you're sure it will be supported. Even if you are 100% sure it is located at the right place. The reason is that it may still fail to be seen (like in the case of crunched code) or, worse, not looked for at all (if your prg isn't run from cli or wb).

Here is real life example.

When i run HOMM2 in my debugger, it does LoadSeg and then hands its stack inherited from cli to the program.
Therefore to be able to debug a program using a big stack (HOMM2 uses 32k) i'd need to type "stack" command every time. I don't want to do that !
The stack cookie can't help me : it's gonna be ignored in this case. And we're not supposed to update existing tools to use it.
So even if i did run OS V3.9 it wouldn't be able to help me.
However my asm startup code can optionnally change the stack and this is what my HOMM2 port hopefully does.
I can now debug without any special care.
Problem solved, but stack cookie useless for it.

Do you like solutions that solve a problem only in a limited number of cases ? Personnally, i don't.
meynaf is offline  
Old 08 June 2019, 16:10   #70
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,979
Quote:
Originally Posted by Thomas Richter View Post
Neither SLink, BLink nor SC or GenAm are part of the Os. Nobody has its sources, probably lost somewhere at the SAS Institute, or at HiSoft, somewhere. You cannot update these tools nowadays in any practicable way. Then you have very limited knowledge. Documented since day 1. Get the shell.guide from the aminet. It's there. That is the best documentation you get for the shell and I keep it updated. Any compiler or assembler can be used to create the stack cookie, any linker will be able to handle the cookie correctly. No hunk-processing tool I am aware of can accidentally remove it. That is quite unlike what you propose - which is a fragile method that only happens by chance and incomplete documentation.

It will keep the cookie intact, unless you manually mess around it. That is all it needs to get it supported. Actually, that is the full trick - creating a robust method. You do not need any particular tool to get it in, and it is visible for everyone.
Every program can be updated, via resourcing. Sources are not necessary. I dont think that for handling hunk debug someone must be updated. I dont know how unused legal hunks are handled by these linkers. Anyway you can always wrote new linker for Amiga. And authors of vbcc or/and Amiga version of GCC 6.x can updated linkers too. For adding 8 bytes at end of Amiga exe file simple file joiner is enough. Anyway if you think that your idea is really OK, add checking for LoadSeg for magic strings.
Don_Adan is offline  
Old 08 June 2019, 23:32   #71
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,236
Quote:
Originally Posted by Don_Adan View Post
Every program can be updated, via resourcing. Sources are not necessary.
By which you create a deviate work, which you cannot distribute without permission of the copyright holder. Thus, typically impractical and illegal. Thanks, but no, thanks.
Quote:
Originally Posted by Don_Adan View Post
I dont think that for handling hunk debug someone must be updated.
But it does, and it is not a practical solution either. Once the program is loaded, the information on the stack size is lost. Yet, you may need it later. Did I say "resident"?
Quote:
Originally Posted by Don_Adan View Post
I dont know how unused legal hunks are handled by these linkers.
Precisely.
Quote:
Originally Posted by Don_Adan View Post
Anyway you can always wrote new linker for Amiga.
Thanks, I have more than enough to do. And we both know that you wouldn't write a linker either, so we better stop speculating about this stupid idea.
Quote:
Originally Posted by Don_Adan View Post
Anyway if you think that your idea is really OK, add checking for LoadSeg for magic strings.
Loadseg is the wrong place for that since the stack information is not required by loadseg in first place. It is required when executing the program, not when loading it. Which is one of the reasons for the design at hand.
Thomas Richter is offline  
Old 09 June 2019, 01:36   #72
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,979
Quote:
Originally Posted by Thomas Richter View Post
By which you create a deviate work, which you cannot distribute without permission of the copyright holder. Thus, typically impractical and illegal. Thanks, but no, thanks. But it does, and it is not a practical solution either. Once the program is loaded, the information on the stack size is lost. Yet, you may need it later. Did I say "resident"? Precisely. Thanks, I have more than enough to do. And we both know that you wouldn't write a linker either, so we better stop speculating about this stupid idea. Loadseg is the wrong place for that since the stack information is not required by loadseg in first place. It is required when executing the program, not when loading it. Which is one of the reasons for the design at hand.
Then copy size of stack at any buffer if this is really needed, anyway i think that stack size is stored already, when memory for stack is allocated, because stack must be free too. Someone can wrote new linker in C or ASM, if this is problem. And this is not stupid idea. I heard something similar from you when I asked to add FORCE option for LoadModule for replacing modules with same or lower versions. And what? When AmigaOS 3.1.4 was born, something like this was added to LoadModule. Maybe is not required for LoadSeg, but this the only universal place for Amiga exe files for correct stack handling. But I forget that you dont like ASM, LoadSeg is pure 68k ASM.
Don_Adan 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 08:49.

Top

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