Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/arch/vax/vax Pull up revisions 1.3-1.6 (requested b...
details: https://anonhg.NetBSD.org/src/rev/88c613b16ee0
branches: netbsd-1-5
changeset: 491895:88c613b16ee0
user: he <he%NetBSD.org@localhost>
date: Tue Jun 12 21:56:53 2001 +0000
description:
Pull up revisions 1.3-1.6 (requested by ragge):
Add EMODD emulation, as used in e.g. modf().
diffstat:
sys/arch/vax/vax/unimpl_emul.s | 708 +++++++++++++++++++++++++++++++++++++---
1 files changed, 640 insertions(+), 68 deletions(-)
diffs (truncated from 785 to 300 lines):
diff -r 045e0e7d5b81 -r 88c613b16ee0 sys/arch/vax/vax/unimpl_emul.s
--- a/sys/arch/vax/vax/unimpl_emul.s Mon Jun 11 20:54:21 2001 +0000
+++ b/sys/arch/vax/vax/unimpl_emul.s Tue Jun 12 21:56:53 2001 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: unimpl_emul.s,v 1.2.2.2 2000/08/14 21:11:02 ragge Exp $ */
+/* $NetBSD: unimpl_emul.s,v 1.2.2.3 2001/06/12 21:56:53 he Exp $ */
/*
+ * Copyright (c) 2001 Brandon Creighton. All rights reserved.
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,15 +57,24 @@
#define S_PC 60(fp)
#define S_PSL 64(fp)
+# The condition codes.
+
+#define PSL_C 1
+#define PSL_V 2
+#define PSL_Z 4
+#define PSL_N 8
+#define PSL_Q 15 # all four
+
#
# Emulation of instruction trapped via SCB vector 0x18. (reserved op)
#
-unimemu:.globl unimemu
+ALTENTRY(unimemu)
pushl r0
movl 8(sp),r0 # get trap address
movzbl (r0),r0 # fetch insn generating trap
- caseb r0,$0x75,$0 # case to jump to address
-0: .word polyd-0b
+ caseb r0,$0x74,$1 # case to jump to address
+0: .word emodd-0b
+ .word polyd-0b
1: movl (sp)+,r0 # restore reg
rsb # continue fault
@@ -104,82 +114,220 @@
goback: movl fp,sp # be sure
popr $0x7fff # restore all regs
rei
-#
-# getval_dfloat get 8 bytes and stores them in r0/r1. Increases PC.
-#
+
+/*
+ * getval: is used by the getval_* functions. Gets the value specified by the
+ * current operand specifier pointed to by S_PC. It also increments S_PC.
+ */
+getval:
+ clrq r0
+ pushr $(R2+R3+R4+R5+R6)
+ movl S_PC,r3 # argument address
+ extzv $4,$4,(r3),r2 # get mode
+ caseb r2,$0,$0xf
+0: .word getval_literal-0b # 0-3 literal
+ .word getval_literal-0b
+ .word getval_literal-0b
+ .word getval_literal-0b
+ .word 2f-0b # 4 indexed
+ .word getval_reg-0b # 5 register
+ .word getval_regdefer-0b # 6 register deferred
+ .word 2f-0b # 7 register deferred
+ .word getval_ai-0b # 8 autoincrement
+ .word 2f-0b # 9 autoincrement deferred
+ .word getval_bytedis-0b # A byte displacement
+ .word 2f-0b # B byte displacement deferred
+ .word 2f-0b # C word displacement
+ .word 2f-0b # D word displacement deferred
+ .word getval_longdis-0b # E longword displacement
+ .word 2f-0b # F longword displacement deferred
+#ifdef EMULATE_INKERNEL
+2: movab 0f,r0
+ movl r2,r1
+ brw die
+0: .asciz "getval: missing address mode %d\n"
+#else
+2: .word 0xffff # reserved operand
+#endif
+
+ /*
+ * 0x00-0x03
+ * Literal mode. Note: getval_{d,f}float will *never* use this routine
+ * to get literal values, since they treat them differently (see those routines
+ * for details).
+ */
+getval_literal:
+ movzbl (r3)+,r0 # correct operand
+ brw 4f
+
+ /*
+ * 0x05
+ * Register mode. Grab the register number, yank the value out.
+ */
+getval_reg:
+ extzv $0,$4,(r3),r2 # Get reg number
+ incl r3
+ ashl $2,r2,r2
+ addl3 fp,r2,r5
+ bsbw emul_extract
+ brw 4f
+
+ /*
+ * 0x06
+ * Register deferred mode. Grab the register number, yank the value out,
+ * use that as the address to get the real value.
+ */
+getval_regdefer:
+ extzv $0,$4,(r3),r2 # Get reg number
+ incl r3
+ ashl $2,r2,r2
+ addl2 fp,r2
+ movl (r2),r5
+ bsbw emul_extract
+ brw 4f
+
+ /*
+ * 0x08 Autoincrement mode
+ * Get the value in the register, use that as the address of our target,
+ * then increment the register.
+ */
+getval_ai:
+ extzv $0,$4,(r3),r2 # Get reg number
+ incl r3
+
+ /*
+ * In the case of the register being PC (0xf), this is called immediate mode;
+ * we can treat it the same as any other register, as long as we keep r3
+ * and S_PC in sync. We do that here.
+ */
+ movl r3,S_PC
+
+ ashl $2,r2,r2
+ addl2 fp,r2
+ movl (r2),r5
+ bsbw emul_extract
+ addl2 r6,(r2)
+
+ movl S_PC,r3 /* if PC did change, S_PC was changed too */
+ brw 4f
+
+ /*
+ * 0xA
+ * Byte displacement mode.
+ */
+getval_bytedis:
+ extzv $0, $4, (r3), r2 # get register
+ incl r3
+ ashl $2,r2,r2
+ addl2 fp,r2
+ movl (r2),r5
+ movzbl (r3),r4
+ incl r3
+ addl2 r4, r5
+ bsbw emul_extract
+ brw 4f
+
+ /*
+ * 0xE
+ * Longword displacement mode.
+ */
+getval_longdis:
+ extzv $0, $4, (r3), r2 # get register
+ incl r3
+ ashl $2,r2,r2
+ addl2 fp,r2
+ movl (r2),r5
+ movl (r3)+,r4
+ addl2 r4, r5
+ bsbw emul_extract
+
+4: movl r3,S_PC
+ popr $(R2+R3+R4+R5+R6)
+ rsb
+
+/*
+ * emul_extract: used by the getval functions. This extracts exactly r6 bytes
+ * from the address in r5 and places them in r0 and r1 (if necessary).
+ * 8 is the current maximum length.
+ */
+emul_extract:
+ cmpl $0x8, r6
+ bgeq 1f
+ .word 0xffff # reserved operand
+1:
+ caseb r6, $0x1, $0x7
+0: .word 1f-0b # 1: byte
+ .word 2f-0b # 2: word
+ .word 9f-0b # unknown
+ .word 4f-0b # 4: longword
+ .word 9f-0b # unknown
+ .word 9f-0b # unknown
+ .word 9f-0b # unknown
+ .word 8f-0b # 8: quadword
+
+1: movzbl (r5), r0
+ rsb
+
+2: movzwl (r5), r0
+ rsb
+
+4: movl (r5), r0
+ rsb
+
+8: movq (r5), r0
+ rsb
+
+9:
+ .word 0xffff # reserved operand
+ rsb
+
getval_dfloat:
clrq r0
- pushr $(R2+R3) # use r2+r3 as scratch reg
- movl S_PC,r3 # argument address
+ pushr $(R2+R3+R6) # use r2+r3 as scratch reg
+ movl S_PC,r3 # argument address
extzv $4,$4,(r3),r2 # get mode
- caseb r2,$0,$5
+ caseb r2,$0,$0x3
0: .word 1f-0b # 0-3 literal
.word 1f-0b
.word 1f-0b
.word 1f-0b
- .word 2f-0b # 4 indexed
- .word 3f-0b # 5 register
-#ifdef EMULATE_INKERNEL
-2: movab 0f,r0
- movl r2,r1
- brw die
-0: .asciz "getval_dfloat: missing address mode %d\n"
-#else
-2: .word 0xffff # reserved operand
-#endif
+
+ movl $0x8, r6
+ bsbw getval
+ brw 4f
1: insv (r3),$0,$3,r0 # insert fraction
extzv $3,$3,(r3),r2 # get exponent
addl2 $128,r2 # bias the exponent
insv r2,$7,$8,r0 # insert exponent
- tstl (r3)+
- brb 4f
-
-3: extzv $0,$4,(r3),r2 # Get reg number
- incl r3
- ashl $2,r2,r2
- addl2 fp,r2
- movq (r2),r0
-
-4: movl r3,S_PC
- popr $(R2+R3)
+ tstb (r3)+
+ movl r3,S_PC
+4:
+ popr $(R2+R3+R6)
rsb
-#
-# getval_word get 2 bytes and stores them zero-extended in r0. Increases PC.
-#
+getval_long:
+ clrl r0
+ pushr $(R6+R1)
+ movl $0x4, r6
+ bsbw getval
+ popr $(R6+R1)
+ rsb
+
getval_word:
clrl r0
- pushr $(R2+R3) # use r2+r3 as scratch reg
- movl S_PC,r3 # argument address
- extzv $4,$4,(r3),r2 # get mode
- caseb r2,$0,$5
-0: .word 1f-0b # 0-3 literal
- .word 1f-0b
- .word 1f-0b
- .word 1f-0b
- .word 2f-0b # 4 indexed
- .word 3f-0b # 5 register
-#ifdef EMULATE_INKERNEL
-2: movab 0f,r0
- movl r2,r1
- brw die
-0: .asciz "getval_word: missing address mode %d\n"
-#else
-2: .word 0xffff # reserved operand
-#endif
+ pushr $(R6+R1)
+ movl $0x2, r6
+ bsbw getval
+ popr $(R6+R1)
+ rsb
Home |
Main Index |
Thread Index |
Old Index