Port-vax archive

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

Re: Some more patches for GCC on NetBSD/VAX coming soon...



>> Lots of PDP-11 instructions [...]
> Not sure where the PDP-11 came into this, [...]

Probably me spazzing.  When writing that email, I somehow got it into
my head that the original example was for the PDP-11.

> Let's say that you have a MOVL (R2),(R3), and you might want to skip
> it, so you need an instruction to precede this instruction sequence.

> Now, a MOVL (R2),(R3) will in fact take three bytes.  The MOVL is one
> byte, the (R2) is one byte, and (R3) is another byte.

Yes.  D0 62 63, if my reading is correct.

> Now, what instruction would you prefix this, in order to eat those
> three bytes?  No matter what it is, this prefix instruction that
> should eat that sequence will then unavoidably interpret the MOVL
> instead as an argument.

Only if you insist on using only one byte for the prefix.  (Which,
admittedly, if the point is to save bytes, you want to do, since a BRB
around it takes only two bytes.)

> If you look at the opcode for MOVL, what is that when interpreted as
> an argument?

Word displacement deferred, off r0: @W^xxxx(R0).  I think.

> It will (hopefully) be something that don't consume more than two
> additional bytes,

Conveniently, it consumes exactly two additional bytes. :-)
Inconveniently, it requires that memory at offset 0x6362 from r0 be
readable; depending on the instruction you use as the prefix, it may
require more memory to be accessible.  And, of course, this is all
MOVL-specific, and works only if neither of the MOVL operands takes
more than one byte - or the byte after the first two can also be taken
as an opcode without causing too much trouble.

Yes, this is far less useful on the VAX, possibly except for a few
special cases.  It could make for some awesomely obfuscated code,
though. :-)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index