From d6089b3999be960daf4f6b27055293b506f3011d Mon Sep 17 00:00:00 2001 From: julianb0 Date: Sat, 8 Jun 2019 09:47:19 +0200 Subject: [PATCH] vm --- vm/pc/arch.h | 3 --- vm/pc/except.c | 4 ++-- vm/pc/main.c | 17 ++--------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/vm/pc/arch.h b/vm/pc/arch.h index 22aa3aa..f76e4a2 100644 --- a/vm/pc/arch.h +++ b/vm/pc/arch.h @@ -47,9 +47,6 @@ struct ctx_t // Read next instruction ushort (*get)(ctx_t *ctx); - // For disassembly - FILE *disf; - // Step by step int step; diff --git a/vm/pc/except.c b/vm/pc/except.c index 9ebb94b..0e0a140 100644 --- a/vm/pc/except.c +++ b/vm/pc/except.c @@ -16,7 +16,6 @@ void _except(ctx_t *ctx, int code, char *fmt, ...) t.c_lflag |= ECHO; tcsetattr(0, TCSANOW, &t); - log("\nException %d - ", code); va_start(ap, fmt); @@ -34,7 +33,8 @@ void _except(ctx_t *ctx, int code, char *fmt, ...) // // Shut down devices // - if (devfiniall(ctx) < 0) { + if (devfiniall(ctx) < 0) + { log("Couldn't deinitialize devices\n"); exit(-100 - code); } diff --git a/vm/pc/main.c b/vm/pc/main.c index c77e191..84437fe 100644 --- a/vm/pc/main.c +++ b/vm/pc/main.c @@ -1,6 +1,7 @@ // 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 #include #include #include @@ -28,20 +29,6 @@ ushort bget(ctx_t *ctx) return c; } -ushort dget(ctx_t *ctx) -{ - static int i = 0; - - if (i >= fwsize) { - log("Finished disassembling\n"); - fclose(ctx->disf); - exit(0); - } - - rip += 2; - return fwprog[i++]; -} - ctx_t main_ctx; void sigint(int _) @@ -87,6 +74,7 @@ int main(int argc, char **argv) // // Signal handling // + signal(SIGINT, sigint); // // Load program @@ -121,7 +109,6 @@ int main(int argc, char **argv) main_ctx.mz = MEMSIZE; main_ctx.get = bget; - main_ctx.disf = NULL; main_ctx.r[RIP].val = MEMOFF;