diff options
author | Helge Deller <deller@gmx.de> | 2013-10-09 17:31:08 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-10-09 17:31:08 +0200 |
commit | 1f1ffa3b0e88511972e947269f968f9b6cdba08c (patch) | |
tree | 5867a89c41d81e91d46666701a0a83acd69b4fb9 | |
parent | 7eaa124d6d8f14601eedf45cb037788c35c8c7ae (diff) | |
download | palo-1f1ffa3b0e88511972e947269f968f9b6cdba08c.tar.gz |
Fix pdc_iodc_cout() function to be able to print out strings which are
longer than 512 bytes (which is sizeof(iodc_string)).
The maximum of 512 bytes is a limit of the PDC IODC function, so if we
want to print a longer string, we just split it up and print up to 512
characters each time.
-rw-r--r-- | ipl/pdc_misc.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ipl/pdc_misc.c b/ipl/pdc_misc.c index 1d6e342..90298e3 100644 --- a/ipl/pdc_misc.c +++ b/ipl/pdc_misc.c @@ -294,27 +294,31 @@ pdc_iodc_cin(char *buf, int size) void pdc_iodc_cout(const char *s, int size) { - int r; + int r, len; if (s[0] == 0) /* this test is usually the one to catch overwriting palo with kernel */ asm("\npdc_iodc_cout_test1fail: b,n ."); - if (size >= sizeof iodc_string) - asm("\npdc_iodc_cout_test2fail: b,n ."); + while (size) { + if (size >= sizeof iodc_string) + len = sizeof iodc_string; + else + len = size; - memcpy(iodc_string, s, size); + memcpy(iodc_string, s, len); - if (s[0] != iodc_string[0] || s[0] == 0) - asm("\npdc_iodc_cout_test3fail: b,n ."); + size -= len; + s += len; - r = firmware_call(PAGE0->mem_cons.iodc_io, - PAGE0->mem_cons.hpa, ENTRY_IO_COUT, - PAGE0->mem_cons.spa, PAGE0->mem_cons.dp.layers, - pdc_result, 0, iodc_string, size, 0); + r = firmware_call(PAGE0->mem_cons.iodc_io, + PAGE0->mem_cons.hpa, ENTRY_IO_COUT, + PAGE0->mem_cons.spa, PAGE0->mem_cons.dp.layers, + pdc_result, 0, iodc_string, len, 0); - if (r != 0) - asm("\npdc_iodc_cout_test4fail: b,n ."); + if (r != 0) + asm("\npdc_iodc_cout_test4fail: b,n ."); + } } int |