Anonymous user
RISC-V Meaty Skeleton with QEMU virt board: Difference between revisions
Jump to navigation
Jump to search
RISC-V Meaty Skeleton with QEMU virt board (view source)
Revision as of 06:29, 10 September 2022
, 1 year ago→Source Code
[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>
|