Added a nicer trap handler
authorceriel <none@none>
Fri, 3 Nov 1989 11:54:41 +0000 (11:54 +0000)
committerceriel <none@none>
Fri, 3 Nov 1989 11:54:41 +0000 (11:54 +0000)
mach/minix/libsys/LIST
mach/minix/libsys/Makefile
mach/minix/libsys/trp.s [new file with mode: 0644]

index baa746b..cb64e1a 100644 (file)
@@ -55,3 +55,4 @@ write.c
 brksize.s
 sendrec.s
 catchsig.s
+trp.s
index 28b8603..9a20074 100644 (file)
@@ -25,7 +25,7 @@ libsys.a:     libsys_s.a
                march . libsys.a
 
 libsys_o.a:    libsys.a ../../../lib/i86/tail_em
-               mkdir X; cd X; aal x ../libsys.a; aal x ../../../../lib/i86/tail_em; aal rv ../libsys_o.a *.o ; cd ..
+               mkdir X; cd X; aal x ../../../../lib/i86/tail_em; aal x ../libsys.a; aal rv ../libsys_o.a *.o ; cd ..
                rm -rf X
 
 clean:
diff --git a/mach/minix/libsys/trp.s b/mach/minix/libsys/trp.s
new file mode 100644 (file)
index 0000000..1aac8b7
--- /dev/null
@@ -0,0 +1,114 @@
+.sect .text ; .sect .rom; .sect .data; .sect .bss
+.define .trpdivz
+.define .trpilin
+.define .trpcase
+.define .trprang
+.define .trpset
+.define .trpnofp
+.define .trpheap
+.define .trp
+.define .stop
+
+.sect .text
+.extern .trpdivz
+.extern .trpilin
+.extern .trpcase
+.extern .trprang
+.extern .trpset
+.extern .trpnofp
+.extern .trpheap
+.extern .trp
+
+.trpdivz:
+mov ax,6
+mov dx,.Mdivz
+jmp .Trp
+.trpilin:
+mov ax,18
+mov dx,.Milin
+jmp .Trp
+.trpcase:
+mov ax,20
+mov dx,.Mcase
+jmp .Trp
+.trprang:
+mov ax,1
+mov dx,.Mrang
+jmp .Trp
+.trpset:
+mov ax,2
+mov dx,.Mset
+jmp .Trp
+.trpnofp:
+mov ax,18
+mov dx,.Mnofp
+jmp .Trp
+.trpheap:
+mov ax,17
+mov dx,.Mheap
+jmp .Trp
+
+.Trp:
+xor     bx,bx
+.extern .trppc
+xchg    bx,(.trppc)
+test    bx,bx
+jz      2f
+push    ax
+call    (bx)
+pop     ax
+ret
+2:
+mov bx,22
+push bx
+push dx
+mov ax,2
+push ax
+call _write
+.stop:
+call _exit
+
+.trp:
+mov dx,ax
+cmp dx,21
+jae 1f
+sal dx,1
+mov bx,.Mtable
+add bx,dx
+mov bx,(bx)
+test bx,bx
+jz 1f
+mov dx,bx
+jmp 2f
+1:
+mov bx,.Mtrp+14
+mov cx,6
+mov dx,ax
+1:
+and dx,7
+add dx,'0'
+movb (bx),dl
+dec bx
+sar dx,1
+sar dx,1
+sar dx,1
+loop 1b
+mov dx,.Mtrp
+2:
+jmp .Trp
+
+.sect .rom
+.Mtable:
+       .data2 0,       .Mrang, .Mset,  0,      0,      0,      .Mdivz, 0
+       .data2 0,       0,      0,      0,      0,      0,      0,      0
+       .data2 0,       .Mheap, .Milin, .Milin, .Mcase
+
+.Mdivz: .asciz "Error: Division by 0 \n"
+.Milin: .asciz "Illegal EM instruct'n\n"
+.Mcase: .asciz "Err in EM case instr \n"
+.Mrang: .asciz "Variable out of range\n"
+.Mset:  .asciz "Err in EM set instr  \n"
+.Mnofp: .asciz "Floating pt not impl.\n"
+.Mheap: .asciz "Heap overflow        \n"
+
+.Mtrp: .asciz "EM trap 0000000 octal\n"