From: Georg Potthast 2 <nospam@georgpotthast.de>
To: Linux-8086@vger.kernel.org
Subject: Re: Elks networking
Date: Tue, 31 Jan 2017 11:32:48 +0100 (CET) [thread overview]
Message-ID: <990587541.474117.1485858768986@com4.strato.de> (raw)
In-Reply-To: <20170130215909.0653a2ed@www.etchedpixels.co.uk>
There is a remark in the file documentation/text/memory:
"When the linker (ld) creates a binary it gives a default setting for chmem
(see writebin.c in the ld source). If you know that a particular program
uses little or no heap, you can patch bytes 24..27 in the executable to a
lower value: dseg+bseg+desired stack size."
So currently the stack is usually way too big. Usually a stack of 2k would be more than sufficient. This should be the default "desired stack size".
One could save a lot of memory if the loader would not just use the stack size ld86 has put into the executable header as its default, this means a data/stack segment of 64k, but to use the spezified bss size and a stack size of 2k instead.
So I recommend to modify the loader to use just 2k as the stack size limit (a configurable option). Should this turn out to be insufficient for a program it will terminate with "stack overflow" and one could reconfigure this limit. With currently available programs for ELKS I do not think this will happen though.
Georg
> Alan Cox <alan@lxorguk.ukuu.org.uk> hat am 30. Januar 2017 um 22:59 geschrieben:
>
> 2. The commercial 8086 Unix platforms actually didn't preallocate memory
> or do chmem like hacks. Instead each process got allocated two chunks of
> memory. CS pointed to the code one (which may be shared) and the code
> runs from CS:0000 to CS:whatever. The clever bit is that the data segment
> stretches from DS:0000 to DS:brk and stack from DS:sp to DS:FFFF. That
> means each data/stack segment is always 64K long. However rather than
> waste that memory the memory allocator actually interleaved processes -
> that is the space between DS:brk and DS:sp of one process might be the
> code or data of another.
>
> This means they could always grow by swapping out/moving another task when
> either the brk/sbrk() grew memory or the compiler assisted stack pointer
> checking called the kernel to grow the stack.
next prev parent reply other threads:[~2017-01-31 10:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-28 20:17 Elks networking Derek Johansen
2016-05-29 6:31 ` Jody Bruchon
2016-05-31 9:15 ` Marc-François LUCCA-DANIAU
2016-05-31 10:50 ` Alan
2017-01-22 10:37 ` Marc-F. LUCCA-DANIAU
2017-01-22 13:23 ` Marc-François LUCCA-DANIAU
2017-01-23 19:48 ` Marc-F. LUCCA-DANIAU
[not found] ` <CAMXth7QD+jMbeTx9YOvQnwd2FLvyvZ8F9Y-mjmdw5wLU6VHtuQ@mail.gmail.com>
2017-01-28 7:50 ` Marc-François LUCCA-DANIAU
[not found] ` <CAMXth7SJWiuq7z4wgMNrL+dEhG40s=q9QrkMThOv3voj+6uh-Q@mail.gmail.com>
2017-01-29 13:43 ` Fwd: " Marc-François LUCCA-DANIAU
2017-01-29 14:01 ` Alan Cox
2017-01-29 19:51 ` Georg Potthast
2017-01-30 12:13 ` Georg Potthast 2
2017-01-30 20:08 ` Marc-François LUCCA-DANIAU
2017-01-30 21:59 ` Alan Cox
2017-01-31 10:32 ` Georg Potthast 2 [this message]
2017-02-02 16:47 ` One Thousand Gnomes
2016-05-31 10:07 ` Alan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=990587541.474117.1485858768986@com4.strato.de \
--to=nospam@georgpotthast.de \
--cc=Linux-8086@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox