mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
vm
This commit is contained in:
parent
c667bd23fc
commit
d6089b3999
@ -47,9 +47,6 @@ struct ctx_t
|
|||||||
// Read next instruction
|
// Read next instruction
|
||||||
ushort (*get)(ctx_t *ctx);
|
ushort (*get)(ctx_t *ctx);
|
||||||
|
|
||||||
// For disassembly
|
|
||||||
FILE *disf;
|
|
||||||
|
|
||||||
// Step by step
|
// Step by step
|
||||||
int step;
|
int step;
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
|
|||||||
t.c_lflag |= ECHO;
|
t.c_lflag |= ECHO;
|
||||||
tcsetattr(0, TCSANOW, &t);
|
tcsetattr(0, TCSANOW, &t);
|
||||||
|
|
||||||
|
|
||||||
log("\nException %d - ", code);
|
log("\nException %d - ", code);
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
@ -34,7 +33,8 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
|
|||||||
//
|
//
|
||||||
// Shut down devices
|
// Shut down devices
|
||||||
//
|
//
|
||||||
if (devfiniall(ctx) < 0) {
|
if (devfiniall(ctx) < 0)
|
||||||
|
{
|
||||||
log("Couldn't deinitialize devices\n");
|
log("Couldn't deinitialize devices\n");
|
||||||
exit(-100 - code);
|
exit(-100 - code);
|
||||||
}
|
}
|
||||||
|
17
vm/pc/main.c
17
vm/pc/main.c
@ -1,6 +1,7 @@
|
|||||||
// The OS/K Team licenses this file to you under the MIT license.
|
// The OS/K Team licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <dv/dev.h>
|
#include <dv/dev.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
@ -28,20 +29,6 @@ ushort bget(ctx_t *ctx)
|
|||||||
return c;
|
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;
|
ctx_t main_ctx;
|
||||||
|
|
||||||
void sigint(int _)
|
void sigint(int _)
|
||||||
@ -87,6 +74,7 @@ int main(int argc, char **argv)
|
|||||||
//
|
//
|
||||||
// Signal handling
|
// Signal handling
|
||||||
//
|
//
|
||||||
|
signal(SIGINT, sigint);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load program
|
// Load program
|
||||||
@ -121,7 +109,6 @@ int main(int argc, char **argv)
|
|||||||
main_ctx.mz = MEMSIZE;
|
main_ctx.mz = MEMSIZE;
|
||||||
|
|
||||||
main_ctx.get = bget;
|
main_ctx.get = bget;
|
||||||
main_ctx.disf = NULL;
|
|
||||||
|
|
||||||
main_ctx.r[RIP].val = MEMOFF;
|
main_ctx.r[RIP].val = MEMOFF;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user