[net.unix-wizards] What are IOT and EMT instructions?

estes@tty3b.UUCP (08/19/83)

	I recently have been trying to port some software to run under
	BTL Unix 4.0 and 5.0.  In these attempts, I have experienced
	both "IOT trap - core dumped" and "EMT trap - core dumped".
	Referring to signal(2), I find that those result from IOT and
	EMT instructions, respectively.  What the manual doesn't say
	is what these instructions are.

	How do these signals occur? and what do they mean?  Am I doing
	something wrong?

	The other signals are fairly easy to figure out, but these two
	have me puzzled.

	Ted Estes
	Teletype Corp., Skokie, Il
	{otuxa, we13}!tty3b!estes

gwyn%brl-vld@sri-unix.UUCP (08/20/83)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

IOT and EMT are PDP-11 machine instructions.  On a non-PDP-11 UNIX these
instructions probably don't exist, but signals SIGIOT and SIGEMT can
still be generated; in fact, the abort() library function generates a
SIGIOT to force a core dump.  SIGEMT, on the other hand, is rarely used.

On a PDP-11, unexpected IOT and EMT signals often are the result of
accidentally executing data as instructions.  Using ld's -n or -i flag
will often help track this particular bug down.

I do recall HCR's RT-11 emulator using EMT instructions (since RT-11 did),
and kernel modification was necessary to keep these from generating
SIGEMT and instead branch to a user process's EMT handler.

If the code you are converting is PDP-11 assembly language, then the
most probable cause of EMTs and IOTs would be the fact that these perform
system calls on DEC operating systems and/or standalone applications, but
UNIX has its own system calls (invoked by TRAP instructions on PDP-11s).
In this case, you will have to find equivalent UNIX functions for the
original EMTs/IOTs.  I would suggest tossing whatever it is and redoing
it in C, since there is no future in PDP-11 assembly language programming.

dbj.rice@rand-relay@sri-unix.UUCP (08/21/83)

From:  Dave Johnson <dbj.rice@rand-relay>

"IOT and EMT are PDP-11 machine instructions.  On a non-PDP-11 UNIX these
instructions probably don't exist..."

Yes, there are no "IOT" or "EMT" instruction on a VAX, but a SIGEMT may be
generated by the XFC machine instruction.  Although "as" doesn't have a
mnemonic for this instruction, you can still generate it by assembling the
constant 0xfc as a byte.

"in fact, the abort() library function generates a SIGIOT to force a core
dump."

No, on 4.1 BSD at least, abort() generates a SIGILL by executing a "halt"
instruction.  Check /usr/src/libc/sys/abort.s

                                        Dave Johnson
                                        Dept. of Math Science
                                        Rice University
                                        dbj.rice@Rand-Relay

gwyn@brl-vld@sri-unix.UUCP (08/22/83)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

The query appeared to originate from a Bell UNIX site.  Only Berkeley
has changed abort() to generate SIGILL; all Bell UNIX systems generate
SIGIOT.