|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // パニック
9: //
10:
1.1.1.3 ! root 11: #include "nono.h"
1.1 root 12: #include "mpu.h"
13:
14: // パニック (PC を表示しない)
15: void
1.1.1.2 root 16: panic_func(const char *funcname, const char *fmt, ...)
1.1 root 17: {
18: char fmtbuf[1024];
19: va_list ap;
20:
21: va_start(ap, fmt);
22: vsnprintf(fmtbuf, sizeof(fmtbuf), fmt, ap);
23: va_end(ap);
24:
25: // panic の場合ここでプロセス終了するのでログではなく stderr に出力
26: fprintf(stderr, "panic! %s at %s\n", fmtbuf, funcname);
27: abort();
28: }
29:
30: // VM 用パニック (PC を表示する)
31: void
1.1.1.2 root 32: vmpanic_func(const char *funcname, const char *fmt, ...)
1.1 root 33: {
34: char fmtbuf[1024];
35: va_list ap;
36:
37: va_start(ap, fmt);
38: vsnprintf(fmtbuf, sizeof(fmtbuf), fmt, ap);
39: va_end(ap);
40:
41: // panic の場合ここでプロセス終了するのでログではなく stderr に出力
1.1.1.2 root 42: auto mpu = GetMPUDevice();
1.1 root 43: fprintf(stderr, "panic! PC=$%08x %s at %s\n",
1.1.1.2 root 44: mpu->GetPPC(), fmtbuf, funcname);
1.1 root 45: abort();
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.