Coldfire/m68k Jump Encoding Issue

160 views Asked by At

So I am working with coldfire (mcf5225x series) and I run into some issues with the jump encoding which in this case has the same binary representation as 68k.

asmtest.o:     file format elf32-m68k

Disassembly of section .text:

00000000 <_start>:
   0:   0682 0000 0040  addil #64,%d2
   6:   d481            addl %d1,%d2
   8:   4efa 0008       jmp %pc@(12 <exit>)
   c:   0682 ffff ffff  addil #-1,%d2

00000012 <exit>:
  12:   d081            addl %d1,%d0

As you can see the mode and register of the jmp instruction is 111010 which signifies a 16 bit word extension offset from the PC. The 16 bit extension is an 8hex offset from the current address 8hex. It should result in a 12 however, my math says I am getting a 10. What is the issue here, why does it seem like the wrong address to jump to is being generated? It is causing some issues in a processor model I am designing. Any help would be aprreciated!

0

There are 0 answers