Mail Archives: djgpp/1994/01/07/15:15:55
> 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
_foo:
movl $_foo_opcode, %eax
movl 1(%eax), $0x21
_foo_opcode:
int $0
ret
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
work.
DJ
- Raw text -