Page 1 of 1

C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 4:42 pm
by XorA
Are there any known issues with the combo in the topic?

Trying to debug a difference in behaviour in a program between Qemulator and QPC2 and narrowed it down to a 4k buffer as a local variable which seems to be corrupting something to do with file handling. When I move the buffer to a global variable it moves the issue to the next place a 4k buffer is used locally.

Before I replace these with malloc I thought I would check with the QDOS gods!

Re: C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 5:14 pm
by tofro
What's the dataspace you have given to that job?

What's the value of the global variable _stack (that's the stack size given to your job, and default is 2kBytes only)?

Tobias

Re: C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 5:29 pm
by XorA
tofro wrote:What's the dataspace you have given to that job?
Whatever C68 said it was in the Xtcc field
What's the value of the global variable _stack (that's the stack size given to your job, and default is 2kBytes only)?
That would certainly explain the problem as the stack of the program is certainly well over 16k (old unix program).

Id have to look at the value when Im next at devel machine!

Re: C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 5:51 pm
by tofro
Simply increase the stack space of your program by placing an

Code: Select all

extern long _stack = 16384;
declaration somewhere in your program (to set the stack to 16k, for example) and you're done.

Tobias

Re: C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 5:57 pm
by XorA
Thanks Tobias, saved me hours of puzzling ;-)

Is this info somewhere modern PC readable these days? Trying to apply my *nix C skills to QL!

Re: C68 4k Buffers on Stack SMSq/e

Posted: Thu Dec 14, 2017 6:05 pm
by tofro
Dilwyn has some of the C68 manuals on his homepage as e-book and pdf here:

http://www.dilwyn.me.uk/docs/ebooks/index.html

Tobias