Skip to contentSkip to conversation

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

PATCH New Francesco Gringoli 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 9 lines · Michael B?sch
	switch (bin->opcode) {
(quoted diff) +6 -0
+	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;

There's some whitespace damage here.

New patch (non-damaged) including changes to b43-asm/test.asm

Regards,
-Francesco

The following changes are made to b43-tools

1) b43-asm assembles new instructions jdn, jdnz, jdp, jdpz, mul;
2) b43-asm new instructions added to test.asm source;
3) b43-dasm disassembles opcodes 0xD6, 0xD7, 0xD8, 0xD9, 0x101.

main.c.orig renamed from main.c +19 -0
Index: 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);
parser.y.orig renamed from parser.y +77 -1

108 lines not on this page · raw message

scanner.l.orig renamed from scanner.l +6 -0
Index: 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; }
test.asm.orig renamed from test.asm +7 -0
Index: 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 */
main.c.orig renamed from main.c +10 -4
Index: 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 10 lines · On Mon, 12 Sep 2011 17:23:02 +0200 (CEST) Francesco Gringoli…
Quoted 8 lines · Michael B?sch
	switch (bin->opcode) {
main.c.orig renamed from main.c +6 -0
+	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;
Quoted 3 lines
Quoted 1 line

There's some whitespace damage here.

New patch (non-damaged) including changes to b43-asm/test.asm

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

main.c.orig

Quoted 3 lines

===================================================================

main.c.orig renamed from main.c +0 -0
     ^^^

Need one more directory level here. If in doubt, use "git diff".

main.c.orig line 745

Quoted 10 lines
main.c.orig renamed from main.c +3 -0
@@ -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;

^
extra whitespace here

Signature · 1 line
Greetings, Michael.