summaryrefslogtreecommitdiff
path: root/usr.bin/oasm
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/oasm')
-rw-r--r--usr.bin/oasm/emit.c5
-rw-r--r--usr.bin/oasm/parse.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/oasm/emit.c b/usr.bin/oasm/emit.c
index 83dbe46..0e8ad4e 100644
--- a/usr.bin/oasm/emit.c
+++ b/usr.bin/oasm/emit.c
@@ -194,6 +194,10 @@ emit_encode_arith(struct emit_state *state, struct oasm_token *tok)
inst_str = "mul";
opcode = OSMX64_MUL;
break;
+ case TT_DIV:
+ inst_str = "div";
+ opcode = OSMX64_DIV;
+ break;
}
/*
@@ -334,6 +338,7 @@ emit_process(struct oasm_state *oasm, struct emit_state *emit)
case TT_ADD:
case TT_SUB:
case TT_MUL:
+ case TT_DIV:
curtok = emit_encode_arith(emit, curtok);
break;
case TT_HLT:
diff --git a/usr.bin/oasm/parse.c b/usr.bin/oasm/parse.c
index 2b5eb14..9a4dd0e 100644
--- a/usr.bin/oasm/parse.c
+++ b/usr.bin/oasm/parse.c
@@ -111,6 +111,7 @@ parse_reg(struct oasm_state *state, struct oasm_token *tok)
case TT_ADD:
case TT_SUB:
case TT_MUL:
+ case TT_DIV:
state->last = tok->type;
break;
default:
@@ -151,6 +152,10 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok)
state->last = tok->type;
emit_osmx64(&emit_state, tok);
break;
+ case TT_DIV:
+ state->last = tok->type;
+ emit_osmx64(&emit_state, tok);
+ break;
case TT_MOV:
state->last = tok->type;
emit_osmx64(&emit_state, tok);