OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /zipcpu
    from Rev 165 to Rev 166
    Reverse comparison

Rev 165 → Rev 166

/trunk/sw/binutils-2.25.patch
28,7 → 28,7
};
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/bfd-in2.h binutils-2.25/bfd/bfd-in2.h
--- binutils-2.25-original/bfd/bfd-in2.h 2014-11-04 04:54:41.000000000 -0500
+++ binutils-2.25/bfd/bfd-in2.h 2016-04-19 07:41:48.387151802 -0400
+++ binutils-2.25/bfd/bfd-in2.h 2016-07-11 15:37:10.745820768 -0400
@@ -2283,6 +2283,8 @@
#define bfd_mach_aarch64_ilp32 32
bfd_arch_nios2,
38,28 → 38,34
bfd_arch_last
};
@@ -6066,6 +6068,25 @@
@@ -6066,6 +6068,31 @@
/* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */
BFD_RELOC_EPIPHANY_IMM8,
+
+/* ZipCPU - 32 bit absolute value for LJMP instruction */
+ BFD_RELOC_ZIP_VALUE,
+
+/* ZipCPU - 18 bit PC-relative offset for BRA (ADD #x,PC) instruction */
+ BFD_RELOC_ZIP_BRANCH,
+
+/* ZipCPU -- 14 (opB) or 13 (mov) bit PC-relative offsets for either generic
+instructions as an operand B (such as xor lbl(PC),R0), or mov instructions
+(ex. mov lbl(pc),uPC). */
+ BFD_RELOC_ZIP_OPB_PCREL,
+ BFD_RELOC_ZIP_MOV_PCREL,
+
+/* ZIP CPU value (not address) relocations. */
+ BFD_RELOC_ZIP_VALUE,
+ BFD_RELOC_ZIP_OPB_IMM,
+ BFD_RELOC_ZIP_OPB_OFFSET,
+ BFD_RELOC_ZIP_OPB_PCREL,
+ BFD_RELOC_ZIP_OPB_GOTREL,
+ BFD_RELOC_ZIP_MOV_OFFSET,
+ BFD_RELOC_ZIP_MOV_PCREL,
+ BFD_RELOC_ZIP_MOV_GOTREL,
+ BFD_RELOC_ZIP_LDI,
+ BFD_RELOC_ZIP_LLO,
+ BFD_RELOC_ZIP_LHI,
+ BFD_RELOC_ZIP_BREV,
+
+/* This is the same as the ZIP_VALUE relocation, save only that the value is
+right shifted by two, since it is an address and Zip addresses increment
+by one per word, not one per byte. */
+/* ZipCPU -- Unused */
+ BFD_RELOC_ZIP_ADDRESS,
BFD_RELOC_UNUSED };
232,8 → 238,8
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/elf32-zip.c binutils-2.25/bfd/elf32-zip.c
--- binutils-2.25-original/bfd/elf32-zip.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/bfd/elf32-zip.c 2016-04-21 10:09:50.311094483 -0400
@@ -0,0 +1,1280 @@
+++ binutils-2.25/bfd/elf32-zip.c 2016-07-11 15:39:08.365117055 -0400
@@ -0,0 +1,1303 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: tc-zip.c
301,7 → 307,7
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_NONE", /* name */
+ FALSE, /* partial_inplace */
324,6 → 330,21
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* An 18 bit pc-relative relocation. */
+ HOWTO (R_ZIP_BRANCH, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_BRANCH", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000000, /* src_mask */
+ 0x0003ffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* An 18 bit operand B immediate. */
+ HOWTO (R_ZIP_OPB_IMM, /* type */
+ 0, /* rightshift */
331,7 → 352,7
+ 18, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_OPB_IMM", /* name */
+ FALSE, /* partial_inplace */
346,7 → 367,7
+ 14, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_OPB_OFFSET", /* name */
+ FALSE, /* partial_inplace */
358,16 → 379,16
+ HOWTO (R_ZIP_OPB_PCREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ 14, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_OPB_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000000, /* src_mask */
+ 0x0003ffff, /* dst_mask-14 bits */
+ FALSE), /* pcrel_offset */
+ 0x00003fff, /* dst_mask-14 bits */
+ TRUE), /* pcrel_offset */
+
+ /* An 18 bit operand B immediate, but relative to the Global Offset Table. */
+ HOWTO (R_ZIP_OPB_GOTREL, /* type */
376,7 → 397,7
+ 18, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_OPB_GOTREL", /* name */
+ FALSE, /* partial_inplace */
391,7 → 412,7
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_MOV_OFFSET", /* name */
+ FALSE, /* partial_inplace */
404,15 → 425,15
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_MOV_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x00001fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
+
+ /* */
+ HOWTO (R_ZIP_MOV_GOTREL, /* type */
421,7 → 442,7
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_MOV_GOTREL", /* name */
+ FALSE, /* partial_inplace */
435,7 → 456,7
+ 23, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
+ zip_relocation, /* special_function */
+ "R_ZIP_LDI", /* name */
+ FALSE, /* partial_inplace */
456,7 → 477,7
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#ifdef USE_R_ZIP_LHI
+ HOWTO (R_ZIP_LHI, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
470,6 → 491,7
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+#endif
+
+ HOWTO (R_ZIP_BREV, /* type -- LDIHI, but with bitreverse */
+ 0, /* rightshift */
512,6 → 534,7
+{
+ { BFD_RELOC_NONE, R_ZIP_NONE },
+ { BFD_RELOC_ZIP_VALUE, R_ZIP_VALUE },
+ { BFD_RELOC_ZIP_BRANCH, R_ZIP_BRANCH },
+ { BFD_RELOC_ZIP_OPB_IMM, R_ZIP_OPB_IMM },
+ { BFD_RELOC_ZIP_OPB_OFFSET, R_ZIP_OPB_OFFSET },
+ { BFD_RELOC_ZIP_OPB_PCREL, R_ZIP_OPB_PCREL },
521,7 → 544,7
+ { BFD_RELOC_ZIP_MOV_GOTREL, R_ZIP_MOV_GOTREL },
+ { BFD_RELOC_ZIP_LDI, R_ZIP_LDI },
+ { BFD_RELOC_ZIP_LLO, R_ZIP_LLO },
+ { BFD_RELOC_ZIP_LHI, R_ZIP_LHI },
+ // { BFD_RELOC_ZIP_LHI, R_ZIP_LHI },
+ { BFD_RELOC_ZIP_BREV, R_ZIP_BREV },
+ { BFD_RELOC_14, R_ZIP_OPB_OFFSET },
+ { BFD_RELOC_16, R_ZIP_LLO },
657,6 → 680,12
+ bfd_put_32(input_bfd, x, location);
+ r = bfd_reloc_ok;
+ }
+ } else if (howto->type == R_ZIP_MOV_PCREL) {
+ r = _bfd_final_link_relocate(howto, input_bfd,
+ input_section,
+ contents, rel->r_offset,
+ relocation,
+ rel->r_addend);
+ } else {
+ r = _bfd_final_link_relocate(howto, input_bfd,
+ input_section,
2140,22 → 2169,22
+#endif /* _ZIPBSD_H */
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/libbfd.h binutils-2.25/bfd/libbfd.h
--- binutils-2.25-original/bfd/libbfd.h 2014-11-04 04:54:41.000000000 -0500
+++ binutils-2.25/bfd/libbfd.h 2016-04-19 07:41:48.395151746 -0400
+++ binutils-2.25/bfd/libbfd.h 2016-07-11 15:37:10.753820721 -0400
@@ -2953,6 +2953,19 @@
"BFD_RELOC_EPIPHANY_SIMM11",
"BFD_RELOC_EPIPHANY_IMM11",
"BFD_RELOC_EPIPHANY_IMM8",
+ "BFD_RELOC_ZIP_VALUE",
+ "BFD_RELOC_ZIP_BRANCH",
+ "BFD_RELOC_ZIP_OPB_PCREL",
+ "BFD_RELOC_ZIP_MOV_PCREL",
+ "BFD_RELOC_ZIP_OPB_IMM",
+ "BFD_RELOC_ZIP_OPB_OFFSET",
+ "BFD_RELOC_ZIP_OPB_PCREL",
+ "BFD_RELOC_ZIP_OPB_GOTREL",
+ "BFD_RELOC_ZIP_MOV_OFFSET",
+ "BFD_RELOC_ZIP_MOV_PCREL",
+ "BFD_RELOC_ZIP_MOV_GOTREL",
+ "BFD_RELOC_ZIP_LDI",
+ "BFD_RELOC_ZIP_LLO",
+ "BFD_RELOC_ZIP_LHI",
+ "BFD_RELOC_ZIP_BREV",
+ "BFD_RELOC_ZIP_ADDRESS",
"@@overflow: BFD_RELOC_UNUSED@@",
2315,7 → 2344,7
/* Tidy up when done. */
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/reloc.c binutils-2.25/bfd/reloc.c
--- binutils-2.25-original/bfd/reloc.c 2014-10-14 03:32:02.000000000 -0400
+++ binutils-2.25/bfd/reloc.c 2016-04-21 10:10:44.122704152 -0400
+++ binutils-2.25/bfd/reloc.c 2016-07-11 15:34:09.170906496 -0400
@@ -1362,7 +1362,7 @@
}
2325,7 → 2354,7
}
/* Relocate a given location using a given value and howto. */
@@ -7325,7 +7325,38 @@
@@ -7325,7 +7325,44 @@
BFD_RELOC_EPIPHANY_IMM8
ENUMDOC
Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction.
2332,19 → 2361,29
-
+ENUM
+ BFD_RELOC_ZIP_VALUE
+ENUMDOC
+ ZipCPU - 32 bit absolute value for LJMP instruction
+ENUM
+ BFD_RELOC_ZIP_BRANCH
+ENUMDOC
+ ZipCPU - 18 bit PC-relative offset for BRA (ADD #x,PC) instruction
+ENUM
+ BFD_RELOC_ZIP_OPB_PCREL
+ENUMX
+ BFD_RELOC_ZIP_MOV_PCREL
+ENUMDOC
+ ZipCPU -- 14 (opB) or 13 (mov) bit PC-relative offsets for either generic
+ instructions as an operand B (such as xor lbl(PC),R0), or mov instructions
+ (ex. mov lbl(pc),uPC).
+ENUM
+ BFD_RELOC_ZIP_OPB_IMM
+ENUMX
+ BFD_RELOC_ZIP_OPB_OFFSET
+ENUMX
+ BFD_RELOC_ZIP_OPB_PCREL
+ENUMX
+ BFD_RELOC_ZIP_OPB_GOTREL
+ENUMX
+ BFD_RELOC_ZIP_MOV_OFFSET
+ENUMX
+ BFD_RELOC_ZIP_MOV_PCREL
+ENUMX
+ BFD_RELOC_ZIP_MOV_GOTREL
+ENUMX
+ BFD_RELOC_ZIP_LDI
2351,8 → 2390,6
+ENUMX
+ BFD_RELOC_ZIP_LLO
+ENUMX
+ BFD_RELOC_ZIP_LHI
+ENUMX
+ BFD_RELOC_ZIP_BREV
+ENUMDOC
+ ZIP CPU value (not address) relocations.
2359,9 → 2396,7
+ENUM
+ BFD_RELOC_ZIP_ADDRESS
+ENUMDOC
+ This is the same as the ZIP_VALUE relocation, save only that the value is
+ right shifted by two, since it is an address and Zip addresses increment
+ by one per word, not one per byte.
+ ZipCPU -- Unused
ENDSENUM
BFD_RELOC_UNUSED
2563,8 → 2598,8
optimize the copying in the simple case without using the
diff -Naur '--exclude=*.swp' binutils-2.25-original/gas/config/tc-zip.c binutils-2.25/gas/config/tc-zip.c
--- binutils-2.25-original/gas/config/tc-zip.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/gas/config/tc-zip.c 2016-05-12 15:50:06.250901352 -0400
@@ -0,0 +1,2404 @@
+++ binutils-2.25/gas/config/tc-zip.c 2016-07-15 11:00:12.695809274 -0400
@@ -0,0 +1,2431 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: tc-zip.c
3575,7 → 3610,7
+ insn->i_op = ZIPO_BUSY;
+ insn->i_imm= -1;
+ insn->i_areg = ZIP_PC;
+ insn->i_breg = ZIP_PC;
+ insn->i_breg = ZIP_RNONE;
+ insn_form = NO_OP;
+ } else if (strcasecmp(opstr, "JMP")==0) {
+ insn->i_op = ZIPO_JMP;
3829,7 → 3864,7
+ insn->i_op = ZIPO_OR;
+ break;
+ case ZIPO_BUSY:
+ insn->i_op = ZIPO_MOV;
+ insn->i_op = ZIPO_ADD;
+ break;
+ case ZIPO_NOT:
+ insn->i_op = ZIPO_XOR;
3893,16 → 3928,20
+
+ switch(op) {
+ case ZIPO_MOV:
+ imm = (a & 0x0fff); if (a&0x1fff) imm |= -0x1000; break;
+ imm = (a & 0x01fff); if (a&0x1000) imm |= -0x1000; break;
+ case ZIPO_LDI:
+ imm = (a & 0x03fffff); break;
+ case ZIPO_LDIn:
+ imm = (a & 0x03fffff); imm |= -0x0200000; break;
+/*
+ * While this makes conceptual sense, it doesn't match the CPU. Hence let's
+ * comment it out and make certain things still work.
+ case ZIPO_LDILO:
+#ifndef LONG_MPY
+ case ZIPO_LDIHI: // BREVx would rm LDIHI
+#endif
+ imm = (a & 0x0ffff); break;
+*/
+ default:
+ if (a & 0x040000) {
+ imm = (a & 0x03fff);
3970,11 → 4009,13
+ break;
+ default:
+ if (a & 0x040000) {
+ // Can't have an immediate and a register in
+ // VLIW mode
+ imma = a & 0x03fff;
+ if (imma !=0)
+ return 0;
+ } else {
+ imma = (a & 0x03ffff);
+ imma = (a & 0x03fff);
+ if (imma & 0x02000) // Sign extension?
+ imma |= -0x02000;
+ if ((imma < -8)||(imma > 7))
4098,6 → 4139,7
+ unsigned long symv = 0;
+ int sym_defined = 0, this_segment = 0, sym_known = 0;
+ symbolS *sym = NULL;
+ unsigned immv = insn->i_imm;
+
+ if (insn->i_rp) {
+ fragS *sym_frag;
4107,7 → 4149,16
+ sym_frag = symbol_get_frag(sym);
+ this_segment = (S_GET_SEGMENT(sym) == seg);
+
+#ifdef ZIP_DEBUG
+ fprintf(stderr, "SYMV(%s) = %08lx + %08lx -> %08lx\n",
+ S_GET_NAME(sym),
+ S_GET_VALUE(sym), fragP->fr_offset,
+ S_GET_VALUE(sym) + fragP->fr_offset);
+#endif
+ symv += fragP->fr_offset;
+ // The immediate value has been included in the fragP->fr_offset
+ // So, to keep us from applying it twice, we'll zero it here.
+ immv = 0;
+
+#ifdef ZIP_DEBUG
+ { int this_frag = (sym_frag == fragP);
4174,7 → 4225,8
+#ifdef ZIP_DEBUG
+ if (sym_known)
+ printf("%08lx@%08lx/%08lx - SYM(%s)-KNOWN %s%s%s%s%s\n",
+ (unsigned long)fragP->fr_literal, fragP->fr_address/OCTETS_PER_BYTE,
+ (unsigned long)fragP->fr_literal,
+ fragP->fr_address/OCTETS_PER_BYTE,
+ (unsigned long)symv, S_GET_NAME(sym),
+ (S_GET_SEGMENT(sym) == absolute_section)?" abs":"",
+ (S_GET_SEGMENT(sym) == expr_section)?" expr":"",
4198,7 → 4250,6
+ (insn->i_rp)&&(symbol_get_frag(insn->i_rp->r_sym)==fragP)?1:0,
+ this_segment, insn->i_imm);
+#endif
+ unsigned immv = insn->i_imm;
+ switch(insn->i_op) {
+ case ZIPO_LDI: // May or may not be conditional
+ if ((sym_known)&&(this_segment)
4214,8 → 4265,7
+ }
+
+ insn->i_aux[0] = 0x7e000000; // NOOP -- if never used.
+ if (insn->i_rp)
+ immv += symv;
+ immv += symv;
+ if ((insn->i_cnd == ZIPC_ALWAYS)
+ // and either no symbol, or we know the symbol
+ &&((!insn->i_rp)||(sym_known))
4351,10 → 4401,16
+ // whereas
+ // MOV BIGVAL(Ry),Rx
+ // could be quietly compiled into
+ // LDI BIGVAL,Ry
+ // ADD Rx,Ry
+ // LDI BIGVAL,Rx
+ // ADD.Z Ry,Rx (Note the contortions to avoid adjusting
+ // ADD.NZ Ry,Rx ... the flag bits)
+ // This would give us access to full 32-bit offsets ...
+ // as long as neither Rx nor Ry was a user register
+ // as long as neither Rx nor Ry was a user register. On the
+ // other hand, if we knew the flag bits would be set between
+ // now and the next conditional instruction, we could do a
+ // LDI BIGVAL,Rx
+ // ADD Ry,Rx
+ // and be okay with it.
+ //
+ // For now we just handle our normal 13 bit signed immediate
+ // offsets.
4361,16 → 4417,19
+ //
+ if (insn->i_rp) {
+ insn->i_rp->r_pcrel = (insn->i_breg == ZIP_PC);
+ if (insn->i_rp->r_sym)
+ immv += symv;
+ immv += symv;
+ if (insn->i_breg == ZIP_PC) {
+ immv +=(int)(-fragP->fr_address/OCTETS_PER_BYTE
+ -insn->i_rp->r_fr_offset-1);
+ if ((sym_known)&&(this_segment))
+ if ((sym_known)&&(this_segment)) {
+ // Tested--this works
+ insn->i_rp->r_type = BFD_RELOC_NONE;
+ else
+ } else {
+#ifdef ZIP_DEBUG
+ printf("ZIP_MOV_PCREL relocation needed for %s, pcrel = %d\n", S_GET_NAME(sym), insn->i_rp->r_pcrel);
+#endif
+ insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_PCREL;
+ }
+// } else if((zip_param_got)&&(insn->i_breg == ZIP_GBL)) {
+// immv = symv;
+// insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_GOTREL;
4378,7 → 4437,6
+ } else {
+ // Do we really want to assume this is an
+ // address?
+ immv += symv;
+ insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_OFFSET;
+ }
+ }
4707,12 → 4765,15
+ case BFD_RELOC_ZIP_MOV_OFFSET:
+ case BFD_RELOC_ZIP_MOV_PCREL:
+ case BFD_RELOC_ZIP_MOV_GOTREL:
+ // if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_OFFSET)
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_OFFSET\n");
+ // else if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_PCREL)
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_PCREL\n");
+ // else
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_GOTREL\n");
+#ifdef ZIP_DEBUG
+ if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_OFFSET)
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_OFFSET\n");
+ else if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_PCREL)
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_PCREL\n");
+ else
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_GOTREL\n");
+ printf("Final-fix = %d\n", final_fix);
+#endif
+ mask = 0x1fff; iword = (iword &(~mask))|((*val)&mask);
+ (*val) &= 0x01fff;
+ md_number_to_chars((char *)buf, iword, 4);
4744,6 → 4805,7
+ md_number_to_chars((char *)buf, iword, 4);
+ fixP->fx_done = final_fix;
+ break;
+#ifdef USE_R_ZIP_LHI
+ case BFD_RELOC_ZIP_LHI:
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_LHI\n");
+ iword |= ((*val)>>16)&0x0ffff;
4751,6 → 4813,7
+ md_number_to_chars((char *)buf, iword, 4);
+ fixP->fx_done = final_fix;
+ break;
+#endif
+ case BFD_RELOC_32:
+ case BFD_RELOC_ZIP_VALUE:
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_VALUE/32\n");
4926,7 → 4989,6
+ insn->i_imm,// Fixed/known offset to the symbol
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc
+ BFD_RELOC_ZIP_BREV); // Reloc type
+ // BFD_RELOC_ZIP_LHI); // Reloc type
+ fix_new(fragP,
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset+1), // where w/in frag?
+ 4, // 1,2, or 4 usually ... ??
4936,7 → 4998,7
+ BFD_RELOC_ZIP_LLO); // Reloc type
+ } else {
+ insn->i_rp->r_fix = fix_new(fragP,
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset+1), // where w/in frag?
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset), // where w/in frag?
+ 4, // 1,2, or 4 usually ... ??
+ insn->i_rp->r_sym, // Add symbol,
+ insn->i_imm, // Fixed/known offset to the symbol
4951,7 → 5013,7
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset +insn->i_naux),
+ 4, // 1,2, or 4 usually ... ??
+ insn->i_rp->r_sym, // Add symbol,
+ 0, // Fixed/known offset to the symbol
+ insn->i_imm, // Fixed/known offset to the symbol
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc
+ BFD_RELOC_ZIP_VALUE); // Reloc type
+ } else {
4963,7 → 5025,7
+ OCTETS_PER_BYTE * insn->i_rp->r_fr_offset, // where w/in frag?
+ 4, // 1,2, or 4 usually ... ??
+ insn->i_rp->r_sym, // Add symbol,
+ 0, // Fixed/known offset to the symbol
+ insn->i_imm, // Fixed/known offset to the symbol
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc
+ insn->i_rp->r_type); // Reloc type
+ }
5983,7 → 6045,7
/* Values for e_version. */
diff -Naur '--exclude=*.swp' binutils-2.25-original/include/elf/zip.h binutils-2.25/include/elf/zip.h
--- binutils-2.25-original/include/elf/zip.h 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/include/elf/zip.h 2016-04-19 07:25:33.241829488 -0400
+++ binutils-2.25/include/elf/zip.h 2016-07-11 15:33:02.971302139 -0400
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////////////////////////
+//
6029,16 → 6091,16
+START_RELOC_NUMBERS(elf_zip_reloc_type)
+ RELOC_NUMBER (R_ZIP_NONE, 0)
+ RELOC_NUMBER (R_ZIP_VALUE, 1)
+ RELOC_NUMBER (R_ZIP_OPB_IMM, 2)
+ RELOC_NUMBER (R_ZIP_OPB_OFFSET, 3)
+ RELOC_NUMBER (R_ZIP_OPB_PCREL, 4)
+ RELOC_NUMBER (R_ZIP_OPB_GOTREL, 5)
+ RELOC_NUMBER (R_ZIP_MOV_OFFSET, 6)
+ RELOC_NUMBER (R_ZIP_MOV_PCREL, 7)
+ RELOC_NUMBER (R_ZIP_MOV_GOTREL, 8)
+ RELOC_NUMBER (R_ZIP_LDI, 9)
+ RELOC_NUMBER (R_ZIP_LLO, 10)
+ RELOC_NUMBER (R_ZIP_LHI, 11)
+ RELOC_NUMBER (R_ZIP_BRANCH, 2)
+ RELOC_NUMBER (R_ZIP_OPB_IMM, 3)
+ RELOC_NUMBER (R_ZIP_OPB_OFFSET, 4)
+ RELOC_NUMBER (R_ZIP_OPB_PCREL, 5)
+ RELOC_NUMBER (R_ZIP_OPB_GOTREL, 6)
+ RELOC_NUMBER (R_ZIP_MOV_OFFSET, 7)
+ RELOC_NUMBER (R_ZIP_MOV_PCREL, 8)
+ RELOC_NUMBER (R_ZIP_MOV_GOTREL, 9)
+ RELOC_NUMBER (R_ZIP_LDI, 10)
+ RELOC_NUMBER (R_ZIP_LLO, 11)
+ RELOC_NUMBER (R_ZIP_BREV ,12)
+ RELOC_NUMBER (R_ZIP_BROKEN_BYTE,13)
+END_RELOC_NUMBERS(R_ZIP_max)
6598,8 → 6660,8
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-dis.c binutils-2.25/opcodes/zip-dis.c
--- binutils-2.25-original/opcodes/zip-dis.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/opcodes/zip-dis.c 2016-04-28 13:23:40.816085799 -0400
@@ -0,0 +1,331 @@
+++ binutils-2.25/opcodes/zip-dis.c 2016-07-15 11:49:53.253965130 -0400
@@ -0,0 +1,377 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: zip-dis.c
6663,6 → 6725,14
+}
+
+static inline int
+OFFSET_PC_MOV(uint32_t ins) {
+ // 0.xxxx.01111.ccc.0.1111.0.iiiiiiiiiiiii
+ // 0xxx.x011.11cc.c011.110i.iiii.iiii.iiii
+ //
+ return ((ins & 0x87c7e000)==0x03c3c000);
+}
+
+static inline int
+TWOWORD_LJMP(uint32_t iword) {
+ // LJMP a long jump instruction, for which the address of the target
+ // is found in the next word
6674,11 → 6744,27
+ return 0;
+}
+
+
+static inline int
+TWOWORD_JSR(uint32_t iword, uint32_t nxtword) {
+ // First word moves the return address to R0
+ if (iword!=0x03c3c001)
+ return 0;
+ // Second word is a BRA statement to ... anywhere
+ // 0.1111.00010.ccc.0.iiiiiiiiiiiiiiiiii
+ // 0111.1000.10cc.c0ii.iiii.iiii.iiii.iiii
+ if ((nxtword&0xffc40000)==0x78800000)
+ return 1;
+ return 0;
+}
+
+static inline int
+POSSIBLE_TWOWORD_BEGINNING(uint32_t iword) {
+ // Unconditional LJMP
+ if (TWOWORD_LJMP(iword))
+ return 1;
+ if (iword == 0x03c3c001)
+ return 1;
+ // The conditional LJMP is three words, which we don't handle ...
+ // Any BREV command could be the beginning of a twoword instruction
+ //
6754,6 → 6840,26
+
+ *refaddr = TWOWORD_VALUE(ins,nxtword);
+ return;
+ } else if (TWOWORD_JSR(ins, nxtword)) {
+ int cv = zip_getbits(nxtword, ZIP_BITFIELD(3,19));
+ int iv = zip_sbits(nxtword, 18);
+
+ *refaddr = iv + addr + 2;
+ sprintf(line, "%s%s", "JSR", zip_ccstr[cv]);
+ sprintf(line, "%-11s", line);
+ sprintf(line, "%s0x%08x", line, *refaddr);
+
+ return;
+ } else if (OFFSET_PC_MOV(ins)) {
+ int cv = zip_getbits(ins, ZIP_BITFIELD(3,19));
+ int dv = zip_getbits(ins, ZIP_REGFIELD(27));
+ int iv = zip_sbits(ins, 13);
+ *refaddr = iv + addr + 1;
+ sprintf(line, "%s%s", "MOV", zip_ccstr[cv]);
+ sprintf(line, "%-11s", line);
+ sprintf(line, "%s0x%08x", line, *refaddr);
+ sprintf(line, "%s,%s", line, zip_regstr[dv]);
+ return;
+ }
+
+ int i;
6919,8 → 7025,10
+ // must match as well.
+ if (TWOWORD_LOAD(iword,nxtword))
+ return 8;
+ if ((iword&0xffc7ffff)==0x7c87c001) // Conditional long jump
+ return 12; // LOD.C 1(PC),PC, BRA 1+PC, @ADDRESS
+ if (TWOWORD_JSR(iword,nxtword))
+ return 8;
+ // if ((iword&0xffc7ffff)==0x7c87c001) // Conditional long jump
+ // return 12; // LOD.C 1(PC),PC, BRA 1+PC, @ADDRESS
+ return 4;
+}
+
6982,8 → 7090,8
+#endif
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-opc.c binutils-2.25/opcodes/zip-opc.c
--- binutils-2.25-original/opcodes/zip-opc.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/opcodes/zip-opc.c 2016-05-02 14:15:12.743655341 -0400
@@ -0,0 +1,552 @@
+++ binutils-2.25/opcodes/zip-opc.c 2016-07-15 11:47:17.674912592 -0400
@@ -0,0 +1,563 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: zip-opc.c
7048,7 → 7156,7
+ // Conditional branches
+ // 0.1111.0111.ccc.0.111.10iiiii--
+ // 0111 1011 11cc c011 110i iiii iiii iiii
+ { "BUSY", 0xffc7ffff, 0x7bc3dfff, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) },
+ { "BUSY", 0xffc7ffff, 0x7883ffff, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) },
+ { "BRA", 0xfffc0000, 0x78800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "BLT", 0xfffc0000, 0x78880000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "BZ", 0xfffc0000, 0x78900000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
7057,6 → 7165,7
+ { "BGE", 0xfffc0000, 0x78a80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "BC", 0xfffc0000, 0x78b00000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "BRV", 0xfffc0000, 0x78b80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "BRV", 0xfffc0000, 0x78b80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ // CLRF ... an XOR w/ self instruction
+ // 0.rrrr.00100.ccc.1.rrrr.iiiii---
+ // 0rrr r001 00cc c1rr rr00 0000 0000 0000
7093,6 → 7202,8
+ // "INT", 0xff10007f, 0x9e00005f, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19),
+ // Return to user space
+ { "RTU", 0xffc7ffff, 0x70c00020, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) },
+ // The return instruction: JMP R0 (possibly conditional)
+ { "RTN", 0xffc7ffff, 0x7bc00000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) },
+ // JMP (possibly a conditional jump, if not covered by branches above)
+ // 0.1111.01111.ccc.a.rrrr.biiiiiiiiiiiiiiii
+ // 0111.1011.11cc.c0rr.rrbi.iiii.iiii.iiii MOV x,PC
7188,7 → 7299,8
+ // 0111.x000.00.xxx.xxx.xxxx.xxxx.xxxx.xxxx
+ { "NOOP", 0xf7ffffff, 0x76000000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "BRK", 0xf7ffffff, 0x76400000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "LOCK", 0xf7ffffff, 0x76800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "BRK", 0xf7fc0000, 0x76400000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED },
+ { "LOCK", 0xf7f80000, 0x76800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ //
+ //
+ // LOD: 0rrr.r100.10cc.cxrr.rrii.iiii.iiii.iiii
7228,6 → 7340,8
+ { "BNZ", 0xffd40000, 0xf8940000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_OPUNUSED },
+ // LDI 1.rrrr.1011x.ccc.iiiii -> 1rrr r101 1xcc ciii ii
+ { "CLR", 0x8787c000, 0x85800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(2,19) },
+ // RTN 1.1111.01111.ccc.1.0000 -> 1111.1011.11cc.c100.00 (Mov R0 to PC)
+ { "RTN", 0xffc7c000, 0xfbc40000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) },
+ // JMP 1.1111.01111.ccc.1rrrr -> 1111 1011 11cc c1rr rr (Mov to PC)
+ { "JMP", 0xffc40000, 0xfbc40000, ZIP_REGFIELD(27),ZIP_OPUNUSED, ZIP_REGFIELD(14), ZIP_OPUNUSED, ZIP_BITFIELD(2,19) },
+ // XOR 1.rrrr.00100.ccc.01111 -> 1rrr r001 00cc c011 11
7312,9 → 7426,10
+ //
+ { "NOOP", 0xf7c00000, 0xf6000000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ //
+ { "BRK", 0xf7c00000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_BITFIELD(2,19) },
+ { "BRK", 0xf7c7c000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "BRK", 0xf7c40000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_OPUNUSED },
+ //
+ { "LOCK", 0xf7c00000, 0xf6800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_BITFIELD(2,19) },
+ { "LOCK", 0xf7c00000, 0xf6800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ //
+ //
+ { "FPADD",0x87c40000, 0x86040000, ZIP_REGFIELD(27), ZIP_REGFIELD(27), ZIP_REGFIELD(14), ZIP_OPUNUSED, ZIP_BITFIELD(2,19) },
7360,6 → 7475,9
+ // "CLRF", 0xffc7cfff, 0x7907c000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19),
+ // CLR -- a LDI of zero
+ // LDI 1xxx.xxxx.xxxx.xxxx.xxrr.rroo.ooo.iiiii -> 1rrr r100 1xcc ciii ii
+ // RTN 1xxx -- xx11.1101.111.ccc.1.0000 -> 1xxx --- xx11.1101.1111.0000
+ { "RTN", 0x80203fff, 0x80003df0, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "RTN", 0x80203fff, 0x80203df0, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(2,19) },
+ // JMP 1xxx -- xx11.1101.1111.rrrr (Mov to PC)
+ { "JMP", 0x80203ff0, 0x80003df0, ZIP_REGFIELD(10),ZIP_OPUNUSED, ZIP_REGFIELD(0), ZIP_OPUNUSED, ZIP_OPUNUSED },
+ // Conditional jump, still move to PC at issue
7499,9 → 7617,10
+ //
+ { "NOOP", 0x80003bf0, 0x80003b00, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ //
+ { "BRK", 0x80003bf0, 0x80003b20, ZIP_REGFIELD(10), ZIP_REGFIELD(10), ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED },
+ { "BRK", 0x80003bff, 0x80003b20, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ { "BRK", 0x80003bf0, 0x80003b20, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED },
+ //
+ { "LOCK", 0x80003bf0, 0x80003b40, ZIP_REGFIELD(10), ZIP_REGFIELD(10), ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED },
+ { "LOCK", 0x80003bf0, 0x80003b40, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED },
+ //
+ // FPU instructions
+ //

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.