PCBUILD Archives

Personal Computer Hardware discussion List

PCBUILD@LISTSERV.ICORS.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Dave Gillett <[log in to unmask]>
Reply To:
PCBUILD - Personal Computer Hardware discussion List <[log in to unmask]>
Date:
Wed, 4 Aug 1999 15:21:39 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (43 lines)
On 4 Aug 99, at 16:26, Dean Kukral wrote:

> When you program in C or C++, the two most common languages
> in non-business computing, you use what are known as "pointers,"
> which are, simply put, addresses in memory.  A frequent error is
> to forget to set the value of a pointer, which then gets the default
> value of zero.  When the code goes to the zero memory location,
> the system traps it (because the system owns that location), and
> gives you an error, usually "general protection fault."  You can get
> the same error for other problems, too.  This is a "null data pointer
> variable," i.e. null=zero; data pointer variable = address.
> null = zero = default "unitialized" value.
>
> If a pointer erroneously has a value that is outside of the memory
> that the program "owns," then a protection fault can also occur.

  "Faults" occur when such errors are detected by the CPU hardware.

  One could reasonably ask why the software doesn't check for these things.
There are two basic reasons:

1.  The check would take time -- even in the 99.9% of cases where there is
nothing wrong.  Despite accusations of "code bloat", many programmers do
still, out of habit, try not to waste program cycles.

2.  The code that was running when the fault was detected may have been part
of the OS, but a bad pointer here is usually something it was handed by some
other *trusted* piece of code -- very often, a driver of some sort.  The
writers of the OS have no basis (except experience...) to expect such a
trusted module to hand the OS a bogus pointer.
  But it happens, wither because the driver is misconfigured or has gotten
corrupted or is for a different piece of hardware from what's actually
installed....




David G

                  Visit our website regularly for FAQs,
               articles, how-to's, tech tips and much more
                  http://nospin.com - http://nospin.org

ATOM RSS1 RSS2