Browse Source

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
pull/9/head
Andrew Waterman 11 years ago
parent
commit
33e738d643
  1. 3
      config.h.in
  2. 14
      configure
  3. 3
      pk/init.c
  4. 51
      pk/logo.c
  5. 5
      pk/pk.ac
  6. 1
      pk/pk.h
  7. 1
      pk/pk.mk.in

3
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

14
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
@ -4045,6 +4046,19 @@ if test "x$enable_vm" != "xno"; then :
$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.

3
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();

51
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));
}

5
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])

1
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*);

1
pk/pk.mk.in

@ -24,6 +24,7 @@ pk_c_srcs = \
console.c \
vm.c \
string.c \
logo.c \
pk_asm_srcs = \
mentry.S \

Loading…
Cancel
Save