mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
decd
This commit is contained in:
parent
d5970ad5e5
commit
35af39acf6
@ -103,7 +103,7 @@ for _, line in enumerate(fp):
|
||||
.format(tok[0], name, p1, p2, tok[0]))
|
||||
hd.write("#else\n")
|
||||
hd.write("#define I_{} {}\n".format(name.upper(), count))
|
||||
hd.write("extern bool i_{}(ctx_t *, acc_t *, acc_t *, ulong *);\n"
|
||||
hd.write("extern bool i_{}(ctx_t *, acc_t *, acc_t *, ulong *, ulong *);\n"
|
||||
.format(tok[0]))
|
||||
hd.write("#endif\n\n")
|
||||
|
||||
|
@ -15,16 +15,16 @@
|
||||
|
||||
|
||||
#define IMPL_START_0(name) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *ret) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *r1, ulong *r2) \
|
||||
{
|
||||
|
||||
#define IMPL_START_1(name) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *ret) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *r1, ulong *r2) \
|
||||
{ \
|
||||
GETV(v1, p1);
|
||||
|
||||
#define IMPL_START_2(name) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *ret) \
|
||||
bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *r1, ulong *r2) \
|
||||
{ \
|
||||
GETV(v1, p1); \
|
||||
GETV(v2, p2);
|
||||
@ -34,14 +34,14 @@ bool i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2, ulong *ret) \
|
||||
IMPL_OUT
|
||||
|
||||
#define IMPL_OUT \
|
||||
*ret = v1; \
|
||||
*r1 = v1; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
// XXX
|
||||
#define IMPL_OUT_2 \
|
||||
*ret = v1; \
|
||||
return 1; \
|
||||
*r1 = v1; \
|
||||
*r2 = v2; \
|
||||
return 2; \
|
||||
}
|
||||
|
||||
#define IMPL_END \
|
||||
|
25
vm/pc/decd.c
25
vm/pc/decd.c
@ -295,8 +295,8 @@ void exec_instr(
|
||||
bool lock, bool rep,
|
||||
uint cond, ulong pc)
|
||||
{
|
||||
bool out = 0;
|
||||
ulong ret = 0;
|
||||
bool out;
|
||||
ulong r1 = 0, r2 = 0;
|
||||
|
||||
// Debugging
|
||||
dump_instr(ctx, in, p1, p2, lock, rep, cond, pc);
|
||||
@ -306,12 +306,12 @@ do_rep:
|
||||
if (!eval_cond(ctx, cond))
|
||||
return;
|
||||
|
||||
out = in->func(ctx, p1, p2, &ret);
|
||||
out = in->func(ctx, p1, p2, &r1, &r2);
|
||||
|
||||
if (out)
|
||||
{
|
||||
if (p1->type == A_REG)
|
||||
R(p1->reg) = ret;
|
||||
R(p1->reg) = r1;
|
||||
|
||||
else if (p1->type == A_IMM64)
|
||||
_except(ctx, E_ACC, "Trying to output to an IMM64");
|
||||
@ -319,7 +319,22 @@ do_rep:
|
||||
else
|
||||
{
|
||||
assert(ACC_IS_MEM(p1));
|
||||
writemem(ctx, ret, p1->addr, p1->mlen);
|
||||
writemem(ctx, r1, p1->addr, p1->mlen);
|
||||
}
|
||||
}
|
||||
|
||||
if (out == 2)
|
||||
{
|
||||
if (p2->type == A_REG)
|
||||
R(p2->reg) = r2;
|
||||
|
||||
else if (p2->type == A_IMM64)
|
||||
_except(ctx, E_ACC, "Trying to output to an IMM64");
|
||||
|
||||
else
|
||||
{
|
||||
assert(ACC_IS_MEM(p2));
|
||||
writemem(ctx, r2, p2->addr, p2->mlen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ struct instr_t
|
||||
uint prm1;
|
||||
uint prm2;
|
||||
|
||||
bool (*func)(ctx_t *, acc_t *, acc_t *, ulong *);
|
||||
bool (*func)(ctx_t *, acc_t *, acc_t *, ulong *, ulong *);
|
||||
};
|
||||
|
||||
void exec_instr(ctx_t *ctx,
|
||||
|
@ -80,8 +80,13 @@ void dump_instr(
|
||||
|
||||
if (cond)
|
||||
{
|
||||
log("c");
|
||||
|
||||
if (cond & (1 << 4))
|
||||
{
|
||||
cond &= ~(1 << 4);
|
||||
log("n");
|
||||
}
|
||||
|
||||
assert(cond <= sizeof(cond_suffixes)/sizeof(char *));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user