Re: executing code in mmapped memory

From: Anton Ertl (anton_at_mips.complang.tuwien.ac.at)
Date: 08/27/03


Date: Wed, 27 Aug 2003 13:21:13 GMT

dhandly@cup.hp.com (Dennis Handly) writes:
>Anton Ertl (anton@mips.complang.tuwien.ac.at) wrote:
>: I allocate the memory for the code I generate at run-time with
>: mmap(next_address, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0)
>
>: As soon as the program tries to execute the first instruction in this
>: region, it produces a SIGSEGV
>: - the PA-RISC segmentation somehow gets in the way.
>
>This is probably it. How did you "call" this code?

I just jump into it with a

0x4c34 <engine+132>: bv %r0(%r3)

This is what gcc generates for a "goto *...".

>>From a register dump, what is sr4, sr5, pcsqh and pcoqh?
>Unfortunately gdb doesn't model the hardware and track the 96 bit PC value.

sr4: 0x4c39c00 (only displays with "p/x $sr4", not with "info reg")
sr5: 0x95e3400
pcsqh: 4c39c00
pcoqh: 6f616b10

r3 is 6f616b10 (same as pcoqh), and gdb shows $pc as having the same value.

- anton

-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html


Relevant Pages

  • Re: executing code in mmapped memory
    ... Anton Ertl wrote: ... I allocate the memory for the code I generate at run-time with ... As soon as the program tries to execute the first instruction in this ...
    (comp.sys.hp.hpux)
  • STATE-less text interpreter (was: LC53 statistics)
    ... I guess for that one would use a factor of: that does not execute], ... Another suggestion for dealing with STATE and parsing words is to ... compile always, and, when "interpreting", execute each line (or each ... M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html ...
    (comp.lang.forth)
  • Re: stack error detection
    ... Anton Ertl wrote: ... EXECUTE, however, is very frequently used in ways having nothing to do with recursion, and an overflow check there would be an unacceptable performance hit. ... The convenience of that was worth the cost. ...
    (comp.lang.forth)
  • Re: number prefix survey
    ... anton@xxxxxxxxxxxxxxxxxxxxxxxxxx (Anton Ertl) wrote: ... I'll start with a survey of what current systems do. ...
    (comp.lang.forth)