[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


[Sorry if you've already received a copy of this; the mail bottleneck
between the UK and the US is apparently about 12000 messages behind, and is
bouncing things left and right...]

Ok, I've (or rather I will very soon) put a file in my home dir on ardath
called disassem.tar.Z

It contains:
    disassem.lisp	The stuff
    assembler.diff	Diffs for a modified version of
			compiler/assembler.lisp with hooks for the
			disassembler.  I *did* make some non-strictly-
			necessary changes that didn't seem too dangerous,
			like adding a :default-type keyword for format
    miles-backend.lisp	A function that pretends the backend structure has a
			disassem-params field.
    sparc-insts.diff	Diffs for a modified version of
			compiler/sparc/insts.lisp that works with the
			disassembler.  Mostly adding printing templates, but
			I did move some stuff around.

What I do is roughly:

  (compile-file "miles-backend" :load t)
  (compile-file "disassem" :load t)
  (compile-file "assembler" :load t)
  (compile-file "sparc-insts" :load t)

  (disassemble 'car) ; or whatever

WARNING!  I've only used versions of the files assembler & sparc-insts with
the package names changed, since I don't want to deal with the overwriting-
the-compiler-in-use bit.

I wimped out and didn't use any of the assembler data structures-- they
didn't hold what I needed, and I didn't want to have to deal with making sure
I didn't break anything, so I just put hooks into top-level macros in the
assembler, and keep my own parallel data structures.

The one problem I think is that it's a bit bloated, and does lots of consing
when works, but I suppose that's mostly bignum consing to get those top two
bits...  When you disassemble something in a code object, it detects that
fact that a GC has moved it and deals (for purposes of output, it pretends
that it's in the old location).

The magic things it finds are: function headers, LRAs, CODE indexed constant
references, NIL indexed references, NIL indexed symbol-slot references,
assembler-routine addresses and some of the breaks (and the args for errors).
I couldn't see any other other ones that would be easy, except for places
where it loads the address of LRAs, which is obvious anyway, since there's
usually a ".LRA" somewhere near.

What I want to see now is how it works with another processor.  I have some
changes to the mips description that worked a while ago, but I have to bring
it up to date.  The RT, what with multiple instruction sizes, etc., should
be a good test...


Miles Bader  --  HCRC, University of Edinburgh  --  Miles.Bader@ed.ac.uk
99% of everything is grunge