Commit 15e6569e authored by Michael Büsch's avatar Michael Büsch

b43-asm: Fix the reverse search for JMPs before RETs

We must ignore labels.
Signed-off-by: Michael Büsch's avatarMichael Buesch <mb@bu3sch.de>
parent f9562fae
......@@ -816,13 +816,16 @@ static void assemble_instruction(struct assembler_context *ctx,
do_assemble_insn(ctx, insn, 0x002);
break;
case OP_RET:
if (!list_empty(&ctx->output)) {
/* Get the previous instruction and check whether it
* is a jump instruction. */
out = list_entry(ctx->output.prev, struct code_output, list);
if (out->is_jump_insn) {
asm_error(ctx, "RET instruction directly after "
"jump instruction. The hardware won't like this.");
/* Get the previous instruction and check whether it
* is a jump instruction. */
list_for_each_entry_reverse(out, &ctx->output, list) {
/* Search the last insn. */
if (out->type == OUT_INSN) {
if (out->is_jump_insn) {
asm_error(ctx, "RET instruction directly after "
"jump instruction. The hardware won't like this.");
}
break;
}
}
do_assemble_insn(ctx, insn, 0x003);
......
......@@ -122,6 +122,7 @@ function_a:
nap
jmp loop-
out:
mov r0, r0
ret lr0, lr1
function_b:
......@@ -130,6 +131,7 @@ function_b:
nap
jmp loop-
out:
mov r0, r0
ret lr0, lr1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment