Mercurial > hg > Members > menikon > CbC_xv6
view src/impl/KernelError.cbc @ 315:600fd7db5344
fix_build_about_kernel_error
author | anatofuz |
---|---|
date | Thu, 06 Feb 2020 17:58:56 +0900 |
parents | 11cd1c607427 |
children | f0b337cb6024 |
line wrap: on
line source
#include "param.h" #include "proc.h" #interface "Err.h" // ---- // typedef struct KernelError <Type, Isa> impl Error { // __code infinity_loop(Type* error, next(...)); // } KernelError; // ---- Err* createKernelError(struct Context* cbc_context) { struct Err* err = new Err(); struct KernelError* kernel_error = new KernelError(); err->err = (union Data*)kernel_error; kernel_error->err = (union Data*)kernel_error; kernel_error->infinity_loop = C_infinity_loopKernelError; err->error = C_errorKernelError; err->panic = C_panicKernelError; return err; } __code infinity_loopKernelError(struct KernelError* err, __code next(...)) { } __code errorKernelError(struct KernelError* err, int err_code, __code next(...)) { goto next(...); } __code panicKernelError(struct KernelError* err, char* msg) { extern struct cpu* cpu; extern struct { struct spinlock lock; int locking; } cons; extern int panicked; cli(); cons.locking = 0; cprintf("cpu%d: panic: ", cpu->id); show_callstk(msg); panicked = 1; // freeze other CPU goto infinity_loopKernelError(err, err->inifinity_loop); }