Mercurial > hg > Members > menikon > CbC_xv6
changeset 314:11cd1c607427
rename..
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 06 Feb 2020 17:40:44 +0900 |
parents | 561eedeb9a99 |
children | 600fd7db5344 |
files | src/impl/KernelError.cbc src/impl/KernelError.h src/impl/kernel_error.cbc src/interface/Error.h src/interface/ErrorGear.h |
diffstat | 5 files changed, 53 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/impl/KernelError.cbc Thu Feb 06 17:40:44 2020 +0900 @@ -0,0 +1,46 @@ +#include "../context.h" +#interface "Error.h" + +// ---- +// typedef struct KernelError <Type, Isa> impl Error { +// __code infinity_loop(Type* error, next(...)); +// } KernelError; +// ---- + +Error* createKernelError(struct Context* cbc_context) { + struct Error* error = new Error(); + struct KernelError* kernel_error = new KernelError(); + error->error = (union Data*)kernel_error; + kernel_error->error = (union Data*)kernel_error; + kernel_error->t = 0; + kernel_error->infinity_loop = C_infinity_loop; + error->error = C_errorKernelError; + error->panic = C_panicKernelError; + return error; +} +__code infinity_loopKernelError(struct KernelError* error, next(...)) { + +} + +__code errorKernelError(struct KernelError* error, int err_code, __code next(...)) { + + goto next(...); +} + +__code panicKernelError(struct KernelError* error, 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(error_gear, error_gear->inifinity_loop); +} + +
--- a/src/impl/KernelError.h Thu Feb 06 16:56:50 2020 +0900 +++ b/src/impl/KernelError.h Thu Feb 06 17:40:44 2020 +0900 @@ -1,3 +1,3 @@ -typedef struct KernelError <Type, Isa> impl ErrorGear { - __code infinity_loop(Type* error_gear,__code next(...)); +typedef struct KernelError <Type, Isa> impl Error { + __code infinity_loop(Type* error, next(...)); } KernelError;
--- a/src/impl/kernel_error.cbc Thu Feb 06 16:56:50 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#include "param.h" -#include "proc.h" -#interface "ErrorGear.h" - -// ---- -// typedef struct KernelError <Type, Isa> impl ErrorGear { -// __code infinity_loop(Type* error_gear,__code next(...)); -// } KernelError; -// ---- - -ErrorGear* createKernelError(struct Context* cbc_context) { - struct ErrorGear* error_gear = new ErrorGear(); - struct KernelError* kernel_error = new KernelError(); - error_gear->error_gear = (union Data*)kernel_error; - kernel_error->error_gear = NULL; - kernel_error->infinity_loop = C_infinity_loopKernelError; - error_gear->error = C_errorKernelError; - error_gear->panic = C_panicKernelError; - return error_gear; -} - -__code infinity_loopKernelError(struct KernelError* error_gear,__code next(...)) { - goto next(...); -} - -__code errorKernelError(struct KernelError* error_gear, int err_code, __code next(...)) { - - goto next(...); -} - -__code panicKernelError(struct KernelError* error_gear, 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(error_gear, error_gear->inifinity_loop); -} - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/interface/Error.h Thu Feb 06 17:40:44 2020 +0900 @@ -0,0 +1,5 @@ +typedef struct Error <Type, Impl> { + __code error(Impl* error, int err_code, __code next(...)); + __code panic(Impl* error, char* msg); + __code next(...); +} Error;
--- a/src/interface/ErrorGear.h Thu Feb 06 16:56:50 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -typedef struct ErrorGear <Type, Impl> { - __code error(Impl* error_gear, int err_code, __code next(...)); - __code panic(Impl* error_gear, char* msg); - __code next(...); -} ErrorGear;