diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-24 17:00:55 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-24 17:04:10 -0400 |
commit | aa3820495e8c2f103f82923240e7936ca78fab84 (patch) | |
tree | fe1441e28054a3e7b7300e2597df9444ac6f018b /usr.bin/oasm/parse.c | |
parent | 24dabe54c845b88ccd4842eb0e7c0fa097a7beaf (diff) |
oasm: Introduce encoding for the NOP instruction
The NOP (no operation) instruction simply tells the processor to do nothing.
This can be useful for various things such as padding, timing, etc.
--
nop
nop
nop
...
--
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/oasm/parse.c')
-rw-r--r-- | usr.bin/oasm/parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/oasm/parse.c b/usr.bin/oasm/parse.c index 229455b..ba97306 100644 --- a/usr.bin/oasm/parse.c +++ b/usr.bin/oasm/parse.c @@ -39,6 +39,7 @@ static struct emit_state emit_state; static const char *tokstr[] = { [ TT_UNKNOWN] = "bad", + [ TT_NOP ] = "nop", [ TT_ADD ] = "add", [ TT_SUB ] = "sub", [ TT_MUL ] = "mul", @@ -154,6 +155,10 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok) int error; switch (tok->type) { + case TT_NOP: + state->last = tok->type; + emit_osmx64(&emit_state, tok); + break; case TT_BR: state->last = tok->type; emit_osmx64(&emit_state, tok); |