ack/mach/vax4/libem/trp.s

53 lines
1.1 KiB
ArmAsm
Raw Normal View History

1985-01-18 14:30:03 +00:00
# $Header$
.globl .trp
.trp:
pushl r0
1985-01-18 14:30:03 +00:00
movl 8(sp),r0
movl 4(sp),8(sp)
movl (sp)+,(sp)
cmpl r0,$16
bgequ L1 # a trapnumber >= 16 cannot be ignored
bbc r0,.trpim,L1
movl (sp)+,r0
rsb
L1:
pushr $017776 # save registers
pushl r0 # trapnumber on stack
1985-01-18 14:30:03 +00:00
movl .trppc,r0
beql L2 # is there a user defined traphandler?
1985-01-18 14:30:03 +00:00
clrl .trppc
calls $1,(r0) # if so, call it
popr $017776 # restore registers
1985-01-18 14:30:03 +00:00
movl (sp)+,r0
rsb
.set write,4
1985-01-18 14:30:03 +00:00
L2:
# Put the (octal) trapnumber in the zeroes in Lemes[].
1986-10-27 10:17:36 +00:00
movl $Lemesend-9,r1 # Addres after last '0'.
movl $5,r2 # Max number of digits.
movl (sp),r0 # Trap number in r0.
L3:
bicw3 $0177770,r0,r3 # Lower 3 bits form lower octal digit.
bisb2 r3,-(r1) # Put them in the '0'.
ashl $-3,r0,r0 # Shift the 3 bits off.
sobgtr r2,L3
movl ap,r2
movl $Lwr,ap
chmk $write
movl r2,ap
1985-01-18 14:30:03 +00:00
bpt
.data
Lemes:
1986-10-27 10:17:36 +00:00
.byte 'E,'M,' ,'t,'r,'a,'p,' ,'0,'0,'0,'0,'0,' ,'(,'o,'c,'t,'a,'l,'),0xa
Lemesend:
.align 2
Lwr:
.long 3 # 3 arguments.
.long 2 # File descriptor 2.
.long Lemes # Address of character buffer.
.long Lemesend - Lemes # Number of characters to write.