From aa3820495e8c2f103f82923240e7936ca78fab84 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 24 Jul 2025 17:00:55 -0400 Subject: 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 --- usr.bin/oasm/parse.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'usr.bin/oasm/parse.c') 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); -- cgit v1.2.3