delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/14/12:06:47

Message-ID: <E1FF8239A075D311AF7200A0C9D60AE30F9C70@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Q: Want to know the starting address and size of my program
Date: Thu, 14 Oct 1999 16:14:59 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii writes:
>> I am trying to maximize the test coverage and limited the untouched 
>> area that code and data area.
>
> You could refrain from writing to the used memory by reading it and
> comparing it with the program's image (for code and data only).
>
> But I'd think that even this is an overkill: if a program runs, it
> already means that the memory occupied by it is working.

True: I think it would be sensible to assume that you can't touch
anything from your base address up to the top of your heap.

But there is another option, if you make the memory test be 
non-destructive. You can test a location by reading the old
value, changing the value, reading it back to make sure that
it truly did change, and then writing the original value back
when you are done, and in this case, as long as you don't
touch the specific few instructions that are making these
checks (which can be just a small asm function that you have
direct control over), it doesn't matter if you stomp all over
the rest of your program. As long as you disable interrupts
and aren't running under any fancy OS, it should be pretty
safe to access whatever memory you like in this way.


	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019