Fix polyd trapping when running pic and grn during groff tool builds on

vax.  From OpenBSD:

Addressing mode work by Jim Uhl:
    - fix PC relative byte displacement in getaddr_byte
    - add support for word displacement to getaddr_byte

This allows certain libm inverse trig functions to work on systems
that lack a native polyd instruction.
This commit is contained in:
mhitch 2007-04-17 22:47:50 +00:00
parent 57b1c008e8
commit a7afe56d70
1 changed files with 25 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: unimpl_emul.S,v 1.2 2002/02/24 01:04:27 matt Exp $ */
/* $NetBSD: unimpl_emul.S,v 1.3 2007/04/17 22:47:50 mhitch Exp $ */
/*
* Copyright (c) 2001 Brandon Creighton. All rights reserved.
@ -351,7 +351,7 @@ getaddr_byte:
.word 2f-0b # 9 autoincr deferred (missing)
.word 7f-0b # 10 byte disp
.word 2f-0b # 11 byte disp deferred (missing)
.word 2f-0b # 12 word disp (missing)
.word 8f-0b # 12 word disp
.word 2f-0b # 13 word disp deferred (missing)
.word 1f-0b # 14 long disp
.word 2f-0b # 15 long disp deferred (missing)
@ -382,15 +382,30 @@ getaddr_byte:
7:
extzv $0, $4, (%r3), %r2 # get register
incl %r3
movl %r3, S_PC
ashl $2,%r2,%r2
addl2 %fp,%r2
movl (%r2),%r5
movzbl (%r3),%r4
movl S_PC, %r3
movl (%fp)[%r2],%r0 # Register contents
pushl %r4
cvtbl (%r3),%r4
addl2 %r4,%r0 # add displacement
movl (%sp)+,%r4
cmpl %r2,$15 # pc?
bneq 0f # no, skip
addl2 $2,%r0 # compensate for displacement size
0: incl %r3 # increase pc
brw 4f
8:
extzv $0, $4, (%r3), %r2 # get register
incl %r3
addl3 %r4, %r5, %r0
brw 4f
movl (%fp)[%r2],%r0 # Register contents
pushl %r4
cvtwl (%r3),%r4
addl2 %r4,%r0 # add displacement
movl (%sp)+,%r4
cmpl %r2,$15 # pc?
bneq 0f # no, skip
addl2 $3,%r0 # compensate for displacement size
0: addl2 $2,%r3 # increase pc
brw 4f
6: extzv $0,$4,(%r3),%r2 # Get reg number
incl %r3