diff options
author | H. Peter Anvin <hpa@zytor.com> | 2013-03-17 18:08:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2013-03-17 18:08:13 -0700 |
commit | 4420a1bc0b335221680346af6ad7082ff2fd0273 (patch) | |
tree | 93c3f710be97f092656bf10266693f0bd501a837 /printmsg.asm | |
parent | 1a624f53c6c7a7fe35e43bb9ecb8c65b06cf3bbd (diff) | |
download | virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.tar.gz virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.tar.xz virtio9p-4420a1bc0b335221680346af6ad7082ff2fd0273.zip |
printmsg.asm: add support for 2-digit hex debug messages
Diffstat (limited to 'printmsg.asm')
-rw-r--r-- | printmsg.asm | 24 |
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 |