1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-05-30 13:25:30 +02:00
parent 0641094a96
commit 474de0309d
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
6 changed files with 30 additions and 5 deletions

View File

@ -22,6 +22,7 @@ main:
;
exit:
enter
break
mov ax0, .msg
call print

View File

@ -5,7 +5,8 @@ all: k.exe
src = instrs/instrs.c decd.c main.c regs.c dump.c \
instrs/jumps.c except.c disd.c mem.c instrs/logic.c \
instrs/stack.c instrs/super.c instrs/arith.c log.c
instrs/stack.c instrs/super.c instrs/arith.c log.c \
instrs/debug.c
obj = $(patsubst %.c,%.o,$(src))

View File

@ -16,6 +16,8 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
log("\n");
dumpregs(ctx);
log("\n");
dumpfwstack(ctx);
if (ctx->mp)

View File

@ -160,9 +160,6 @@ xchg m m
lea r m
lea m m
# get code segment
gcs r m
#
# Stack manipulation instructions
#
@ -199,8 +196,17 @@ popf
cli
sti
#
# Misc. instructions
#
# Prints a character on the screen
prn r
prn i
prn m
#
# Debugging instructions
#
break

15
pc/instrs/debug.c Normal file
View File

@ -0,0 +1,15 @@
// 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 "instrs.h"
#include "arch_i.h"
IMPL_START_0(break)
{
log("\nExecuting BREAK INSTR\n");
dumpregs(ctx);
while ((getchar() != '\n'));
log("Resuming execution\n");
}
IMPL_END;

View File

@ -88,7 +88,7 @@ void dumpregs(ctx_t *ctx)
log("%s%s=0x%-16lX ", r->name,
(strlen(r->name) == 2 ? "=" : ""), r->val);
}
log("\nrip=0x%-16lX rbp=0x%-16lX rsp=0x%-16lX flg=0x%-16lX\n\n",
log("\nrip=0x%-16lX rbp=0x%-16lX rsp=0x%-16lX flg=0x%-16lX\n",
ctx->r[RIP].val,
ctx->r[RBP].val,
ctx->r[RSP].val,