delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/14/05:33:13

Date: Tue, 14 Mar 2000 09:53:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alistair_P SHILTON <apsh AT ecr DOT mu DOT oz DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: self-mod code and DJGPP - writable code segment?
In-Reply-To: <8ak78h$dsd$1@mulga.cs.mu.OZ.AU>
Message-ID: <Pine.SUN.3.91.1000314095319.4527K-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 14 Mar 2000, Alistair_P SHILTON wrote:

> I was wondering if it is possible to link self-modifying assembler
> code to DJGPP.  When I try, I get an error message.  So I checked
> the documentation, which says that the code segment is not writable.
> Is there some way around this?

Yes, put the assembly code into a data variable.  This will allow to
modify it using the DS selector, but also to execute it using the CS
selector, since DJGPP runtime is set up so that both CS and DS have
the same base address and the same limit.  (Translation: they both
reference the same memory area.)

- Raw text -


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