// The OS/K Team licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #include int dying = 0; void _except(ctx_t *ctx, int code, char *fmt, ...) { va_list ap; enable_stdin_echoing(); if (dying) { log("Exception thrown while dying=1\n"); exit(-12); } else dying = 1; log("\nException %d - ", code); va_start(ap, fmt); vlog(fmt, ap); va_end(ap); log("\n"); dumpregs(ctx); log("\n"); if (ctx->mp) free(ctx->mp); // // Shut down devices // if (devfiniall(ctx) < 0) { log("Couldn't deinitialize devices\n"); exit(-100 - code); } exit(code); }