aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-05-02 18:06:53 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-05-02 18:12:34 -0700
commit33e738d643b360d05ffbeaf5449d2a9117f67125 (patch)
treed514bdb66ebb115617487e3640e412c6a63de6a4
parentd3d746f016ccc2218525f950fc00b96dedd00f54 (diff)
downloadriscv-pk-33e738d643b360d05ffbeaf5449d2a9117f67125.zip
riscv-pk-33e738d643b360d05ffbeaf5449d2a9117f67125.tar.gz
riscv-pk-33e738d643b360d05ffbeaf5449d2a9117f67125.tar.bz2
Add ASCII art boot logo
It's only printed when booting the Linux kernel. Feel free to improve the quality of the ASCII art. It looks like this when rendered: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvvvv rr rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr INSTRUCTION SETS WANT TO BE FREE
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure14
-rw-r--r--pk/init.c3
-rw-r--r--pk/logo.c51
-rw-r--r--pk/pk.ac5
-rw-r--r--pk/pk.h1
-rw-r--r--pk/pk.mk.in1
7 files changed, 78 insertions, 0 deletions
diff --git a/config.h.in b/config.h.in
index c23bf16..c15bc0a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -27,6 +27,9 @@
/* Define if floating-point emulation is enabled */
#undef PK_ENABLE_FP_EMULATION
+/* Define if the RISC-V logo is to be displayed */
+#undef PK_ENABLE_LOGO
+
/* Define if virtual memory support is enabled */
#undef PK_ENABLE_VM
diff --git a/configure b/configure
index a6f4ffe..de70ae6 100755
--- a/configure
+++ b/configure
@@ -1301,6 +1301,7 @@ Optional Features:
--enable-optional-subprojects
Enable all optional subprojects
--disable-vm Disable virtual memory
+ --disable-logo Disable boot logo
--disable-fp-emulation Disable floating-point emulation
--disable-atomics Emulate atomic ops nonatomically
@@ -4047,6 +4048,19 @@ $as_echo "#define PK_ENABLE_VM /**/" >>confdefs.h
fi
+# Check whether --enable-vm was given.
+if test "${enable_vm+set}" = set; then :
+ enableval=$enable_vm;
+fi
+
+if test "x$enable_logo" != "xno"; then :
+
+
+$as_echo "#define PK_ENABLE_LOGO /**/" >>confdefs.h
+
+
+fi
+
# Check whether --enable-fp-emulation was given.
if test "${enable_fp_emulation+set}" = set; then :
enableval=$enable_fp_emulation;
diff --git a/pk/init.c b/pk/init.c
index fd9c819..a3f22d9 100644
--- a/pk/init.c
+++ b/pk/init.c
@@ -93,6 +93,9 @@ uintptr_t boot_loader(struct mainvars* args)
if (current.is_supervisor) {
supervisor_vm_init();
+#ifdef PK_ENABLE_LOGO
+ print_logo();
+#endif
write_csr(mepc, current.entry);
asm volatile("eret");
__builtin_unreachable();
diff --git a/pk/logo.c b/pk/logo.c
new file mode 100644
index 0000000..8f868e8
--- /dev/null
+++ b/pk/logo.c
@@ -0,0 +1,51 @@
+#include <string.h>
+#include "file.h"
+
+#define W 46
+#define D 21
+#define T 5
+
+void print_logo()
+{
+ static const char end[] = "\n INSTRUCTION SETS WANT TO BE FREE\n\n";
+ static const char fill[T] = {'r', ' ', 'v', ' ', 'r'};
+ static const char logo[D][T] =
+ {{0, 14, 46, 46, 46},
+ {0, 18, 46, 46, 46},
+ {13, 20, 46, 46, 46},
+ {16, 22, 46, 46, 46},
+ {18, 22, 46, 46, 46},
+ {18, 22, 46, 46, 46},
+ {18, 22, 46, 46, 46},
+ {16, 22, 44, 46, 46},
+ {13, 20, 42, 46, 46},
+ {2, 18, 40, 46, 46},
+ {2, 14, 38, 44, 46},
+ {4, 10, 36, 42, 46},
+ {6, 12, 34, 40, 46},
+ {8, 14, 32, 38, 46},
+ {10, 16, 30, 36, 46},
+ {12, 18, 28, 34, 46},
+ {14, 20, 26, 32, 46},
+ {16, 22, 24, 30, 46},
+ {18, 22, 22, 28, 46},
+ {20, 20, 20, 26, 46},
+ {22, 22, 22, 24, 46}};
+
+ char result[D*(W+1) + sizeof(end)];
+ char* pos = result;
+ for (size_t i = 0; i < D; i++) {
+ for (size_t j = 0, p = 0; j < T; j++) {
+ if (p == logo[i][j])
+ continue;
+ do {
+ *pos++ = fill[j];
+ p++;
+ } while (p < logo[i][j]);
+ }
+ *pos++ = '\n';
+ }
+ memcpy(pos, end, sizeof(end));
+
+ file_write(stderr, result, (pos - result) + sizeof(end));
+}
diff --git a/pk/pk.ac b/pk/pk.ac
index fdcaa65..03af889 100644
--- a/pk/pk.ac
+++ b/pk/pk.ac
@@ -3,6 +3,11 @@ AS_IF([test "x$enable_vm" != "xno"], [
AC_DEFINE([PK_ENABLE_VM],,[Define if virtual memory support is enabled])
])
+AC_ARG_ENABLE([vm], AS_HELP_STRING([--disable-logo], [Disable boot logo]))
+AS_IF([test "x$enable_logo" != "xno"], [
+ AC_DEFINE([PK_ENABLE_LOGO],,[Define if the RISC-V logo is to be displayed])
+])
+
AC_ARG_ENABLE([fp-emulation], AS_HELP_STRING([--disable-fp-emulation], [Disable floating-point emulation]))
AS_IF([test "x$enable_fp_emulation" != "xno"], [
AC_DEFINE([PK_ENABLE_FP_EMULATION],,[Define if floating-point emulation is enabled])
diff --git a/pk/pk.h b/pk/pk.h
index 2df80e4..5b9f3dd 100644
--- a/pk/pk.h
+++ b/pk/pk.h
@@ -52,6 +52,7 @@ int snprintf(char* out, size_t n, const char* s, ...);
void init_tf(trapframe_t*, long pc, long sp, int user64);
void start_user(trapframe_t* tf) __attribute__((noreturn));
void dump_tf(trapframe_t*);
+void print_logo();
void unhandled_trap(trapframe_t*);
void handle_misaligned_load(trapframe_t*);
diff --git a/pk/pk.mk.in b/pk/pk.mk.in
index 72f4412..3c0b455 100644
--- a/pk/pk.mk.in
+++ b/pk/pk.mk.in
@@ -24,6 +24,7 @@ pk_c_srcs = \
console.c \
vm.c \
string.c \
+ logo.c \
pk_asm_srcs = \
mentry.S \