RISC-V Meaty Skeleton with QEMU virt board: Difference between revisions

[unchecked revision][unchecked revision]
Line 242:
rm -vf *.o
rm -vf $(KERNEL_IMAGE)
</source>
 
===Kernel source===
 
====src/common/common.h====
 
<source lang="c">
#ifndef COMMON_H
#define COMMON_H
 
int toupper(int);
void panic(const char *, ...);
 
#endif
</source>
 
====src/common/common.c====
 
<source lang="c">
#include <stdarg.h>
#include "common.h"
#include "../uart/uart.h"
 
int toupper(int c) {
return 'a' <= c && c <= 'z' ? c + 'A' - 'a' : c;
}
 
void panic(const char *format, ...) {
kputs("Kernel panic!");
kputs("Reason:");
va_list arg;
va_start(arg, format);
kvprintf(format, arg);
va_end(arg);
asm volatile ("wfi");
}
</source>
Anonymous user