public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@llwyncelyn.cymru>
To: David O'Shea <dcoshea@gmail.com>
Cc: linux-8086 <linux-8086@vger.kernel.org>
Subject: Re: New GCC compiler for 8086 cpu's
Date: Mon, 19 Jun 2017 14:16:39 +0100	[thread overview]
Message-ID: <20170619141639.26444d3a@alans-desktop> (raw)
In-Reply-To: <CAN0DjM12QXu5XvzvnwJPiGVyzH6vY2O_tzt2=efFT_Otm=aBAA@mail.gmail.com>

On Fri, 16 Jun 2017 23:03:26 +0930
"David O'Shea" <dcoshea@gmail.com> wrote:

> Hi Juan,
> 
> Thanks for the link!  Some questions below:
> 
> On Fri, Jun 16, 2017 at 8:23 AM, Juan Perez-Sanchez <lithoxs@gmail.com> wrote:
> > On Thu, Jun 15, 2017 at 5:19 AM, Edoardo <eddyx89@gmail.com> wrote:  
> >> If I remember correctly, one of ELKS limits was that binaries had to
> >> fit on a 64KB page, and that was due to the compiler we used (dev86 /
> >> bcc).  
> >
> > Actually, code size <=  64KB and separately  (data + bss + stack sizes) <= 64KB.
> >  
> >> Do you think/know if GCC may solve this limit, being able to produce
> >> multi-page binaries?  
> >
> > No, those limits still holds.  
> 
> I guess there are both limits in the compiler and limits in ELKS itself, right?
> 
> Alan kindly explained to me in the last few days in the thread
> http://www.spinics.net/lists/linux-8086/msg00813.html what kind of
> complex things ELKS would need to do to handle processes with multiple
> code segments and/or multiple data segments, and those restrictions
> are still there, so simply using GCC doesn't make them go away.
> 
> The "Getting Started Guide" for this new IA16 GCC actually mentions a
> few limitations in this area that the new compiler has:
> 
> - Section 3.2 says "Although this version of Sourcery CodeBench Lite
> uses ELF as its internal object format, it produces executables in DOS
> COM format."  DOS .COM format implies a single 64KB segment for
> combined code and data, i.e. tiny memory model, right?  That's more
> restrictive than ELKS.

The compiler generates .COM but the rest of it can built split I/D
"small" model binaries with the same limits as DOS small model and ELKS
split I/D. That limit is that function pointers don't work totally
strictly to the C standard - but not in a way that ever matters.

In particular

	void *p = &function;

gives a 16bit offset relative to CS: for which there might exist a
different object (a variable) with the same address relative to DS. That
also means that

	uint8_t *p = (uint8_t)&function;
	*p = 4;

doesn't write over the function code as you'd expect 8)

None of this matters in the real world because comparing function
pointers, calling functions by pointer and all the normal uses work
just fine.

Alan

  parent reply	other threads:[~2017-06-19 13:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  0:08 New GCC compiler for 8086 cpu's Juan Perez-Sanchez
2017-06-14  6:47 ` Tom
2017-06-14 19:53   ` Juan Perez-Sanchez
2017-06-15 10:19 ` Edoardo
2017-06-15 22:53   ` Juan Perez-Sanchez
2017-06-16 13:33     ` David O'Shea
2017-06-16 18:57       ` Juan Perez-Sanchez
2017-06-19  3:58         ` David O'Shea
2017-06-19  6:58           ` Georg Potthast
2017-06-19  9:15             ` David O'Shea
2017-06-19 19:36           ` Juan Perez-Sanchez
2017-06-19 13:16       ` Alan Cox [this message]
2017-06-19 13:43     ` Alan Cox
2017-06-19 19:57       ` Juan Perez-Sanchez
2017-06-19 20:55         ` Alan Cox
2017-06-19 22:53           ` Juan Perez-Sanchez
2017-06-20 11:37             ` Alan Cox
2017-06-20 21:57               ` Juan Perez-Sanchez
     [not found]                 ` <CALgV52iFRay4y8dYrP0ZGnF2JQJi2h7c=QnSsDniv72azmFPbA@mail.gmail.com>
2017-06-20 22:46                   ` Fwd: " David Given

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=20170619141639.26444d3a@alans-desktop \
    --to=alan@llwyncelyn.cymru \
    --cc=dcoshea@gmail.com \
    --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