summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-09 14:50:51 +0200
committerAvi Kivity <avi@qumranet.com>2007-12-09 14:50:51 +0200
commitde5397c2a6519db793f4f23e8c058cd7983cbcaf (patch)
tree4eedcaf6abee4d857b604af6155aba952de3e021 /user
parentd4a27ce9986dfc740483d8bf29b46ad49d114cfb (diff)
kvm: testsuite: improve printf() performance
a string I/O instruction is much faster than byte-at-a-time. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'user')
-rw-r--r--user/test/x86/lib/printf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/user/test/x86/lib/printf.c b/user/test/x86/lib/printf.c
index f13bf0cc..5caec246 100644
--- a/user/test/x86/lib/printf.c
+++ b/user/test/x86/lib/printf.c
@@ -1,6 +1,7 @@
#include "printf.h"
#include "smp.h"
#include <stdarg.h>
+#include "string.h"
static struct spinlock lock;
@@ -149,8 +150,9 @@ int snprintf(char *buf, int size, const char *fmt, ...)
void print_serial(const char *buf)
{
- while (*buf)
- asm volatile ("out %%al, $0xf1" : : "a"(*buf++));
+ unsigned long len = strlen(buf);
+
+ asm volatile ("rep/outsb" : "+S"(buf), "+c"(len) : "d"(0xf1));
}
int printf(const char *fmt, ...)