summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-05-10 21:17:16 +0200
committerHelge Deller <deller@gmx.de>2023-05-10 21:17:16 +0200
commit37481ef2e3776292d15883b9f4aa855d4090ee2d (patch)
tree49afb8d6221dce5021b6c67a6030b7d09f881def
parent3258b4444d84876d27bbf3fcf5c849fd58727db4 (diff)
downloadpalo-37481ef2e3776292d15883b9f4aa855d4090ee2d.tar.gz
ipl: Speed up printing the IPL menu on C8000 workstation
It turned out, that calling the IODC to print a char to the console is incredibly slow when running on a C8000 workstation. Speed it up a lot by printing as many chars at once per call to firmware. Since new-line chars need to be replaced by \n\r, break all strings at this char. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--ipl/pdc_cons.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/ipl/pdc_cons.c b/ipl/pdc_cons.c
index c36b55a..4b6f4d9 100644
--- a/ipl/pdc_cons.c
+++ b/ipl/pdc_cons.c
@@ -31,19 +31,31 @@ getchar(void)
static int
putstring(const char *s)
{
- const int len = strlen(s);
-
- if (len == 0)
- return 0;
+ int len_org = strlen(s);
+ int len;
+ char *p;
- if (strchr(s, '\n') == NULL)
+ /*
+ * printing single chars is incredibly slow on C8000 machine.
+ * optimize by printing a whole string but take care of new-lines.
+ */
+ do {
+ len = strlen(s);
+ if (len == 0)
+ break;
+ if (*s == '\n') {
+ putchar(*s);
+ s++;
+ continue;
+ }
+ p = strchr(s, '\n');
+ if (p)
+ len = p - s;
pdc_iodc_cout(s, len);
- else {
- while (*s)
- putchar(*s++);
- }
+ s += len;
+ } while (len);
- return len;
+ return len_org;
}
int