linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Amol Mohite <amol@m-net.arbornet.org>
Cc: ralf@uni-koblenz.de, linux-mm@kvack.org
Subject: Re: Somw questions [ MAYBE OFFTOPIC ]
Date: Tue, 6 Apr 1999 23:51:05 +0100 (BST)	[thread overview]
Message-ID: <14090.36825.930363.169515@dukat.scot.redhat.com> (raw)
In-Reply-To: <Pine.BSI.3.96.990405050919.3415A-100000@m-net.arbornet.org>

Hi,

On Mon, 5 Apr 1999 05:12:50 -0400 (EDT), Amol Mohite
<amol@m-net.arbornet.org> said:

>> A NULL pointer is just yet another invalid address.  There is no
>> special test for a NULL pointer.  Most probably for example (char
>> *)0x12345678 will be invalid as a pointer as well and treated the
>> same.  The CPU detects this when the TLB doesn't have a translation
>> valid for the access being attempted.

> Yes but how does it know it is a null pointer ?

It doesn't.  It just looks up the current VM page tables and looks for
the mapping for that page.  If there isn't such a mapping, it just
invokes a page fault handler in the O/S.

It is then up to the kernel to decide whether the pointer was just a
page which is swapped out, or a real invalid pointer.  If the kernel has
a mapping installed for that address, then it can install a valid page
in the process's address space and, if necessary, read the appropriate
page of disk to initialise it (for mmap or swap).  Otherwise, it just
generates a SEGV signal.

> On that note, when c does not allow u to dereference a void pointer , is
> this compiler  doing the trick ?

It is undefined in C.  Dereferencing a null pointer might return zero,
might return garbage or might generate a SEGV; the language doesn't do
anything special about it.  It is all up to the operating system.

--Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

      parent reply	other threads:[~1999-04-06 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-01  9:16 Amol Mohite
1999-04-02  9:35 ` ralf
1999-04-02 18:56   ` Chris Atenasio
1999-04-05  9:12   ` Amol Mohite
1999-04-06 10:55     ` ralf
1999-04-06 22:51     ` Stephen C. Tweedie [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=14090.36825.930363.169515@dukat.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=amol@m-net.arbornet.org \
    --cc=linux-mm@kvack.org \
    --cc=ralf@uni-koblenz.de \
    /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