linux-8086.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Given <dg@cowlark.com>
To: ELKS <linux-8086@vger.kernel.org>
Subject: Fwd: New GCC compiler for 8086 cpu's
Date: Wed, 21 Jun 2017 00:46:14 +0200	[thread overview]
Message-ID: <CALgV52j3dC_hiUbAkJW3AuUFWHbvqbsyKGxZ3sJAeb20o1Vm7Q@mail.gmail.com> (raw)
In-Reply-To: <CALgV52iFRay4y8dYrP0ZGnF2JQJi2h7c=QnSsDniv72azmFPbA@mail.gmail.com>

Unfortunately C doesn't distinguish between pointers to objects in the
heap and pointers to objects on the stack. Consider this:

{
  int buffer[256];
  int* pointer = buffer; // pointer points to stack frame
  pointer = malloc(256*sizeof(int)); // now it points to heap
  return buffer[0]; // so the same instruction here needs to be able
to cope with either
}

Vanilla C has two address spaces --- code and data. You're not allowed
to (portably) turn one to the other, so they can live in different
segments. But the stack and the heap are defined to be in the same
address space, and pointers to them have to be interchangeable. So
they need to live in the same segment.

-- 
┌─── http://www.cowlark.com ───
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

      parent reply	other threads:[~2017-06-20 22:46 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
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                   ` David Given [this message]

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=CALgV52j3dC_hiUbAkJW3AuUFWHbvqbsyKGxZ3sJAeb20o1Vm7Q@mail.gmail.com \
    --to=dg@cowlark.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).