1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00

stack dump doesn't work well

This commit is contained in:
julianb0 2019-05-16 18:45:00 +02:00
parent 5249e01eeb
commit cedd8df711
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
4 changed files with 104 additions and 5 deletions

View File

@ -3,6 +3,54 @@
nop nop
#
# Logical instructions
#
not r
not m
and r r
and r i
and r m
and m r
and m i
and m m
or r r
or r i
or r m
or m r
or m i
or m m
xor r r
xor r i
xor r m
xor m r
xor m i
xor m m
# shift left logical
shl r r
shl r i
shl r m
shl m r
shl m i
shl m m
# shift right logical
shr r r
shr r i
shr r m
shr m r
shr m i
shr m m
#
# Unsigned arithmetic instructions
#
add r r add r r
add r i add r i
add r m add r m
@ -17,13 +65,13 @@ sub m r
sub m i sub m i
sub m m sub m m
# rdx = hi(rax * %0) # rdx = hi(rax * $0)
# rax = lo(rax * %0) # rax = lo(rax * $0)
mul r mul r
mul i mul i
# rdx = rax % %0 # rdx = rax % $0
# rax = rax / %0 # rax = rax / $0
div r div r
div i div i
@ -33,17 +81,27 @@ inc m
dec r dec r
dec m dec m
#
# Movement instructions
#
mov r r mov r r
mov r i mov r i
mov r m mov r m
mov m r mov m r
mov m i mov m i
mov m m
xchg r r xchg r r
xchg r i xchg r i
xchg r m xchg r m
xchg m r xchg m r
xchg m i xchg m i
xchg m m
#
# Stack manipulation instructions
#
push i push i
push r push r
@ -56,6 +114,10 @@ call m
ret ret
#
# Supervisor only instructions
#
cli cli
sti sti

View File

@ -12,6 +12,42 @@ IMPL_START_0(nop)
} }
IMPL_END; IMPL_END;
IMPL_START_2(and)
{
v1 &= v2;
}
IMPL_OUT;
IMPL_START_2(or)
{
v1 |= v2;
}
IMPL_OUT;
IMPL_START_2(xor)
{
v1 ^= v2;
}
IMPL_OUT;
IMPL_START_2(shl)
{
v1 <<= v2;
}
IMPL_OUT;
IMPL_START_2(shr)
{
v1 >>= v2;
}
IMPL_OUT;
IMPL_START_1(not)
{
v1 = ~v1;
}
IMPL_OUT;
IMPL_START_2(add) IMPL_START_2(add)
{ {
v1 += v2; v1 += v2;

0
instr/jumps.c Normal file
View File

View File

@ -26,7 +26,8 @@ ushort fwprog[] = {
ushort bget(ctx_t *ctx) ushort bget(ctx_t *ctx)
{ {
if (addr2real(ctx->r[RIP].val) >= MEMSIZE) { if (addr2real(ctx->r[RIP].val) >= MEMSIZE) {
_except(ctx, E_ACC, "Executing out of memory"); _except(ctx, E_ACC, "Executing out of memory: 0x%016lX",
ctx->r[RIP].val);
} }
ushort c = ctx->mp[addr2real(ctx->r[RIP].val)]; ushort c = ctx->mp[addr2real(ctx->r[RIP].val)];