Mail Archives: djgpp/1994/01/07/15:15:55

Date: Fri, 7 Jan 94 14:20:46 -0500
From: DJ Delorie <dj AT ctron DOT com>
To: astor AT alkymi DOT unit DOT no
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: What is the address of the code?

> I use have written some assembly routines in TASM that I want to
> port and use with DJGPP. Some of the code is self-modifying, so I need
> to know where the address of the routine is. Now, where is the code
> located and do I have write access to this memory area?
> A small (4-5 lines) AS example would be nice.

	.globl	_foo
	movl $_foo_opcode, %eax
	movl 1(%eax), $0x21
	int	$0

WARNING: Because of the way the cache works on the 386 and 486,
opcodes you modify may not be reflected in the cache and won't do what
you expect.  The "jmp $+2" trick does NOT work with the 486.  See
libsrc/c/dos/int21x.s for an example of self-modiying code that does


- Raw text -

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