summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/boot/lib/libstand/printf.c24
-rw-r--r--usr/src/boot/sys/boot/common/bootstrap.h3
-rw-r--r--usr/src/boot/sys/boot/common/util.c5
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/efi_console.c2
4 files changed, 32 insertions, 2 deletions
diff --git a/usr/src/boot/lib/libstand/printf.c b/usr/src/boot/lib/libstand/printf.c
index d91f705d75..c3e08a5b28 100644
--- a/usr/src/boot/lib/libstand/printf.c
+++ b/usr/src/boot/lib/libstand/printf.c
@@ -217,6 +217,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap)
char nbuf[MAXNBUF];
char *d;
const char *p, *percent, *q;
+ uint16_t *S;
u_char *up;
int ch, n;
uintmax_t num;
@@ -411,6 +412,29 @@ reswitch: switch (ch = (u_char)*fmt++) {
while (width--)
PCHAR(padc);
break;
+ case 'S': /* Assume console can cope with wide chars */
+ S = va_arg(ap, uint16_t *);
+ if (S == NULL)
+ S = (uint16_t *)L"(null)";
+ if (!dot) {
+ for (n = 0; S[n] != 0; n++)
+ continue;
+ } else {
+ for (n = 0; n < dwidth && S[n]; n++)
+ continue;
+ }
+
+ width -= n;
+
+ if (!ladjust && width > 0)
+ while (width--)
+ PCHAR(padc);
+ while (n--)
+ PCHAR(*S++);
+ if (ladjust && width > 0)
+ while (width--)
+ PCHAR(padc);
+ break;
case 't':
tflag = 1;
goto reswitch;
diff --git a/usr/src/boot/sys/boot/common/bootstrap.h b/usr/src/boot/sys/boot/common/bootstrap.h
index fb2201f5d4..10a4e1d4bb 100644
--- a/usr/src/boot/sys/boot/common/bootstrap.h
+++ b/usr/src/boot/sys/boot/common/bootstrap.h
@@ -103,7 +103,8 @@ struct console
#define C_PRESENTOUT (1<<1) /* console can provide output */
#define C_ACTIVEIN (1<<2) /* user wants input from console */
#define C_ACTIVEOUT (1<<3) /* user wants output to console */
-#define C_MODERAW (1<<4) /* raw mode */
+#define C_WIDEOUT (1<<4) /* c_out routine groks wide chars */
+#define C_MODERAW (1<<5) /* raw mode */
void (*c_probe)(struct console *); /* set c_flags to match hardware */
int (*c_init)(struct console *, int); /* reinit XXX may need more args */
void (*c_out)(struct console *, int); /* emit c */
diff --git a/usr/src/boot/sys/boot/common/util.c b/usr/src/boot/sys/boot/common/util.c
index 455053dab8..d73d992105 100644
--- a/usr/src/boot/sys/boot/common/util.c
+++ b/usr/src/boot/sys/boot/common/util.c
@@ -120,6 +120,7 @@ printf(const char *fmt, ...)
va_list ap;
const char *hex = "0123456789abcdef";
char buf[32], *s;
+ uint16_t *S;
unsigned long long u;
int c, l;
@@ -143,6 +144,10 @@ nextfmt:
for (s = va_arg(ap, char *); *s != '\0'; s++)
putchar(*s);
break;
+ case 'S': /* Assume console can cope with wide chars */
+ for (S = va_arg(ap, uint16_t *); *S != 0; S++)
+ putchar(*S);
+ break;
case 'd': /* A lie, always prints unsigned */
case 'u':
case 'x':
diff --git a/usr/src/boot/sys/boot/efi/libefi/efi_console.c b/usr/src/boot/sys/boot/efi/libefi/efi_console.c
index 2b46019bc1..b2d458073f 100644
--- a/usr/src/boot/sys/boot/efi/libefi/efi_console.c
+++ b/usr/src/boot/sys/boot/efi/libefi/efi_console.c
@@ -64,7 +64,7 @@ int efi_cons_poll(struct console *);
struct console efi_console = {
"text",
"EFI console",
- 0,
+ C_WIDEOUT,
efi_cons_probe,
efi_cons_init,
efi_cons_putchar,