summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-03-18 01:08:13 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-03-18 01:08:13 (GMT)
commit4420a1bc0b335221680346af6ad7082ff2fd0273 (patch)
tree93c3f710be97f092656bf10266693f0bd501a837
parent1a624f53c6c7a7fe35e43bb9ecb8c65b06cf3bbd (diff)
downloadvirtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.zip
virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.tar.gz
virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.tar.bz2
virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.tar.xz
printmsg.asm: add support for 2-digit hex debug messages
-rw-r--r--printmsg.asm24
1 files changed, 18 insertions, 6 deletions
diff --git a/printmsg.asm b/printmsg.asm
index 516b5e2..231f568 100644
--- a/printmsg.asm
+++ b/printmsg.asm
@@ -250,21 +250,33 @@ GPROC(debug_printnum)
END(debug_printnum)
/* ------------------------------------------------------------------------- *
- * debug_printhex4
+ * debug_printhex2/4
*
- * Print an hexadecimal 4-digit number from the stack
+ * Print an hexadecimal 2/4-digit number from the stack
* ------------------------------------------------------------------------- */
+GPROC(debug_printhex2)
+ pushw %cx
+ movw $0x208,%cx
+ jmp debug_printhexn
+END(debug_printhex2)
+
GPROC(debug_printhex4)
- pushw %ax
pushw %cx
+ movw $0x400,%cx
+ /* jmp debug_printhexn */
+END(debug_printhex4)
+
+LPROC(debug_printhexn)
+ pushw %ax
pushw %dx
pushw %di
cld
subw $6,%sp
movw %sp,%di
movw (2+4*2+6)(%di),%dx
- movw $4,%cx
+ shlw %cl,%dx
+ shrw $8,%cx
1:
rolw $4,%dx
movb %dl,%al
@@ -283,10 +295,10 @@ GPROC(debug_printhex4)
addw $6,%sp
popw %di
popw %dx
- popw %cx
popw %ax
+ popw %cx
retw $2
-END(debug_printhex4)
+END(debug_printhexn)
/* ------------------------------------------------------------------------- *
* debug_printhex8