Skip to contentSkip to conversation

b43-asm, b43-dasm: Add 5 new instructions.

PATCH New francesco.gringoli at ing.unibs.it 2 participants 2 messages Sep 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43-asm, b43-dasm: Add 5 new instructions.

Quoted 5 lines · Michael Buesch

The patch is still damaged. It contains an extra space at the start of the context lines.

Also, please make sure the patch can be applied with "git am", which means that it can be applied in the repository root directory with -p1

This time it should be ok, I hope. I'm sending using mailx.

Regards,
-Francesco

assembler/main.c.orig renamed from assembler/main.c +19 -0
Index: b43-tools/assembler/main.c
===================================================================
@@ -737,6 +737,9 @@
 	unsigned int opcode;
 
 	switch (insn->op) {
+	case OP_MUL:
+		do_assemble_insn(ctx, insn, 0x101);
+		break;
 	case OP_ADD:
 		do_assemble_insn(ctx, insn, 0x1C0);
 		break;
@@ -855,6 +858,22 @@
 		out = do_assemble_insn(ctx, insn, 0x0DC | 0x1);
 		out->is_jump_insn = 1;
 		break;
+	case OP_JDN:
+		out = do_assemble_insn(ctx, insn, 0x0D6);
+		out->is_jump_insn = 1;
+		break;
+	case OP_JDPZ:
+		out = do_assemble_insn(ctx, insn, 0x0D6 | 0x1);
+		out->is_jump_insn = 1;
+		break;
+	case OP_JDP:
+		out = do_assemble_insn(ctx, insn, 0x0D8);
+		out->is_jump_insn = 1;
+		break;
+	case OP_JDNZ:
+		out = do_assemble_insn(ctx, insn, 0x0D8 | 0x1);
+		out->is_jump_insn = 1;
+		break;
 	case OP_JZX:
 		opcode = merge_ext_into_opcode(ctx, 0x400, insn);
 		out = do_assemble_insn(ctx, insn, opcode);
assembler/parser.y.orig renamed from assembler/parser.y +77 -1

108 lines not on this page · raw message

assembler/scanner.l.orig renamed from assembler/scanner.l +6 -0
Index: b43-tools/assembler/scanner.l
===================================================================
@@ -82,6 +82,8 @@
 \<\<			{ update_lineinfo(); return LEFTSHIFT; }
 \>\>			{ update_lineinfo(); return RIGHTSHIFT; }
 
+mul			{ update_lineinfo(); return OP_MUL; }
+
 add			{ update_lineinfo(); return OP_ADD; }
 add\.			{ update_lineinfo(); return OP_ADDSC; }
 addc			{ update_lineinfo(); return OP_ADDC; }
@@ -120,6 +122,10 @@
 jge			{ update_lineinfo(); return OP_JGE; }
 jg			{ update_lineinfo(); return OP_JG; }
 jle			{ update_lineinfo(); return OP_JLE; }
+jdn			{ update_lineinfo(); return OP_JDN; }
+jdpz			{ update_lineinfo(); return OP_JDPZ; }
+jdp			{ update_lineinfo(); return OP_JDP; }
+jdnz			{ update_lineinfo(); return OP_JDNZ; }
 jzx			{ update_lineinfo(); return OP_JZX; }
 jnzx			{ update_lineinfo(); return OP_JNZX; }
 jext			{ update_lineinfo(); return OP_JEXT; }
assembler/test.asm.orig renamed from assembler/test.asm +7 -0
Index: b43-tools/assembler/test.asm
===================================================================
@@ -39,6 +39,9 @@
 	mov	(1 + (%assert(1 == ((1 + 2) - 2)))), r0
 
 label:
+	/* MUL instruction */
+	mul	r0,r1,r2	/* mul, r2 := msb, spr6d := lsb */
+
 	/* ADD instructions */
 	add	r0,r1,r2	/* add */
 	add.	r0,r1,r2	/* add, set carry */
@@ -89,6 +92,10 @@
 	jge	r0,r1,label	/* jump if greater or equal */
 	jg	r0,r1,label	/* jump if greater */
 	jle	r0,r1,label	/* jump if less or equal */
+	jdn	r0,r1,label	/* jump if difference is negative */
+	jdpz	r0,r1,label	/* jump if difference is non negative */
+	jdp	r0,r1,label	/* jump if difference is positive */
+	jdnz	r0,r1,label	/* jump if difference is non positive */
 
 	jzx	7,8,r0,r1,label	/* Jump if zero after shift and mask */
 	jnzx	7,8,r0,r1,label	/* Jump if nonzero after shift and mask */
disassembler/main.c.orig renamed from disassembler/main.c +10 -4
Index: b43-tools/disassembler/main.c
===================================================================
@@ -284,6 +284,12 @@
 	struct bin_instruction *bin = stmt->u.insn.bin;
 
 	switch (bin->opcode) {
+	case 0x101:
+		stmt->u.insn.name = "mul";
+		disasm_std_operand(stmt, 0, 0);
+		disasm_std_operand(stmt, 1, 1);
+		disasm_std_operand(stmt, 2, 2);
+		break;
 	case 0x1C0:
 		stmt->u.insn.name = "add";
 		disasm_std_operand(stmt, 0, 0);
@@ -457,28 +463,28 @@
 		disasm_std_operand(stmt, 1, 1);
 		break;
 	case 0x0D6:
-		stmt->u.insn.name = "@D6"; /* FIXME */
+		stmt->u.insn.name = "jdn";
 		stmt->u.insn.labelref_operand = 2;
 		stmt->u.insn.labeladdr = stmt->u.insn.bin->operands[2];
 		disasm_std_operand(stmt, 0, 0);
 		disasm_std_operand(stmt, 1, 1);
 		break;
 	case (0x0D6 | 0x1):
-		stmt->u.insn.name = "@D7"; /* FIXME */
+		stmt->u.insn.name = "jdpz";
 		stmt->u.insn.labelref_operand = 2;
 		stmt->u.insn.labeladdr = stmt->u.insn.bin->operands[2];
 		disasm_std_operand(stmt, 0, 0);
 		disasm_std_operand(stmt, 1, 1);
 		break;
 	case 0x0D8:
-		stmt->u.insn.name = "@D8"; /* FIXME */
+		stmt->u.insn.name = "jdp";
 		stmt->u.insn.labelref_operand = 2;
 		stmt->u.insn.labeladdr = stmt->u.insn.bin->operands[2];
 		disasm_std_operand(stmt, 0, 0);
 		disasm_std_operand(stmt, 1, 1);
 		break;
 	case (0x0D8 | 0x1):
-		stmt->u.insn.name = "@D9"; /* FIXME */
+		stmt->u.insn.name = "jdnz";
 		stmt->u.insn.labelref_operand = 2;
 		stmt->u.insn.labeladdr = stmt->u.insn.bin->operands[2];
 		disasm_std_operand(stmt, 0, 0);
#1 lore raw

PATCH 1/1 b43-asm, b43-dasm: Add 5 new instructions.

Quoted 9 lines · On Mon, 12 Sep 2011 19:30:57 +0200 francesco.gringoli at ing.unibs.it wrote:
Quoted 5 lines · Michael Buesch

The patch is still damaged. It contains an extra space at the start of the context lines.

Also, please make sure the patch can be applied with "git am", which means that it can be applied in the repository root directory with -p1

This time it should be ok, I hope. I'm sending using mailx.

Well, now the header and the signed-off-by was missing, but I added them manually. Thanks ;)

Signature · 1 line
Greetings, Michael.