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-06-06 15:06:34 +02:00
parent 7a8474e1de
commit a0572e759f
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
4 changed files with 24 additions and 4 deletions

View File

@ -386,10 +386,14 @@ def parse_instr(line):
regoff = "inv"
# [reg+off]
# [reg+off] or [reg+regoff]
if len(word.split('+')) == 2:
reg, off = word.split('+', 1)
if not is_number(off):
regoff = off
off = '0'
# [reg+regoff+off]
else:
assert(len(word.split('+')) == 3)

View File

@ -26,7 +26,7 @@ main:
mov rsi, 0x10
mov rdi, 8
lea rbi, b[rsi + rdi]
lea rbi, b[rsi + rdi + 1]
leave
ret

View File

@ -44,7 +44,21 @@ static void scan_param(ctx_t *ctx, acc_t *p)
p->mem = 1;
p->mlen = c & 0xF;
p->off = (short)ctx->get(ctx);
p->offreg = ctx->get(ctx);
if (p->offreg > NREGS) {
_except(ctx, E_ILL, "Inexistent REG (offreg)");
}
if (p->offreg != INV) {
r = &ctx->r[p->offreg];
if (r->flags & (RES | CTL)) {
_except(ctx, E_ACC, "Reserved REG (offreg): %s", r->name);
}
}
c = ctx->get(ctx);
}

View File

@ -58,15 +58,17 @@ void dumpinstr(ctx_t *ctx, ulong _rip, uint rep,
p = p1;
lp:
if (p != 0) {
if (p->mem) d_log(ctx, " %c:[", getmempref(p->mlen));
if (p->mem) d_log(ctx, " %c[", getmempref(p->mlen));
else d_log(ctx, " ");
if (p->type == A_REG)
d_log(ctx, "%s", ctx->r[p->val].name);
else
d_log(ctx, "%c:0x%lX", getmempref(p->ilen), p->val);
d_log(ctx, "%c0x%lX", getmempref(p->ilen), p->val);
if (p->mem) {
if (p->offreg)
d_log(ctx, "+%s", ctx->r[p->offreg].name);
if (p->off)
d_log(ctx, "+%hd", p->off);
d_log(ctx, "]");